From a2f3e3bd7c590c64bf0c49a7b273e78e825acc9a Mon Sep 17 00:00:00 2001 From: Jonathan Budzenski Date: Thu, 25 Aug 2022 12:11:11 -0400 Subject: [PATCH 01/28] Bump linux bazel cache timeout to 30 minutes (#139491) We're seeing some timeouts recently in the 15 minute range. Mac timeouts are already at 60 min. --- .buildkite/pipelines/on_merge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.buildkite/pipelines/on_merge.yml b/.buildkite/pipelines/on_merge.yml index a20dd7c3dce6a..7ea0317b56e70 100644 --- a/.buildkite/pipelines/on_merge.yml +++ b/.buildkite/pipelines/on_merge.yml @@ -135,7 +135,7 @@ steps: label: 'Populate local dev bazel cache (Linux)' agents: queue: n2-4-spot - timeout_in_minutes: 15 + timeout_in_minutes: 30 retry: automatic: - exit_status: '-1' From 7429f78cfa1d3d1722dd3b77ad8e2774b4e62b60 Mon Sep 17 00:00:00 2001 From: Dmitrii Shevchenko Date: Thu, 25 Aug 2022 18:21:39 +0200 Subject: [PATCH 02/28] Allow to bump rule version for prebuilt rules (#139287) --- .../routes/rules/patch_rules_bulk_route.ts | 4 +- .../routes/rules/patch_rules_route.ts | 4 +- .../routes/rules/utils/import_rules_utils.ts | 4 +- .../rules/patch_rules.test.ts | 44 ++++---- .../lib/detection_engine/rules/patch_rules.ts | 28 ++--- .../lib/detection_engine/rules/types.ts | 4 +- .../rules/update_prepacked_rules.test.ts | 10 +- .../rules/update_prepacked_rules.ts | 4 +- .../schemas/rule_converters.test.ts | 54 +++++++--- .../schemas/rule_converters.ts | 102 ++++++++++-------- 10 files changed, 150 insertions(+), 108 deletions(-) diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/patch_rules_bulk_route.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/patch_rules_bulk_route.ts index aeff52f61cfbf..f80a5ffb94e5c 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/patch_rules_bulk_route.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/patch_rules_bulk_route.ts @@ -85,9 +85,9 @@ export const patchRulesBulkRoute = ( }); const rule = await patchRules({ - rule: migratedRule, + existingRule: migratedRule, rulesClient, - params: payloadRule, + nextParams: payloadRule, }); if (rule != null && rule.enabled != null && rule.name != null) { const ruleExecutionSummary = await ruleExecutionLog.getExecutionSummary(rule.id); diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/patch_rules_route.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/patch_rules_route.ts index f6f2ff03efa25..cdd46c2c189d6 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/patch_rules_route.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/patch_rules_route.ts @@ -77,8 +77,8 @@ export const patchRulesRoute = (router: SecuritySolutionPluginRouter, ml: SetupP const rule = await patchRules({ rulesClient, - rule: migratedRule, - params, + existingRule: migratedRule, + nextParams: params, }); if (rule != null && rule.enabled != null && rule.name != null) { const ruleExecutionSummary = await ruleExecutionLog.getExecutionSummary(rule.id); diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/utils/import_rules_utils.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/utils/import_rules_utils.ts index 49d85307cac06..a623f3887276a 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/utils/import_rules_utils.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/utils/import_rules_utils.ts @@ -129,8 +129,8 @@ export const importRules = async ({ }); await patchRules({ rulesClient, - rule: migratedRule, - params: { + existingRule: migratedRule, + nextParams: { ...parsedRule, exceptions_list: [...exceptions], }, diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/patch_rules.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/patch_rules.test.ts index d79f36f029a98..e99f7f85df156 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/patch_rules.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/patch_rules.test.ts @@ -18,48 +18,48 @@ import { describe('patchRules', () => { it('should call rulesClient.disable if the rule was enabled and enabled is false', async () => { const rulesClient = rulesClientMock.create(); - const params = { + const nextParams = { ...getCreateRulesSchemaMock(), enabled: false, }; - const rule = { + const existingRule = { ...getRuleMock(getQueryRuleParams()), enabled: true, }; rulesClient.update.mockResolvedValue(getRuleMock(getQueryRuleParams())); - await patchRules({ rulesClient, params, rule }); + await patchRules({ rulesClient, nextParams, existingRule }); expect(rulesClient.disable).toHaveBeenCalledWith( expect.objectContaining({ - id: rule.id, + id: existingRule.id, }) ); }); it('should call rulesClient.enable if the rule was disabled and enabled is true', async () => { const rulesClient = rulesClientMock.create(); - const params = { + const nextParams = { ...getCreateRulesSchemaMock(), enabled: true, }; - const rule = { + const existingRule = { ...getRuleMock(getQueryRuleParams()), enabled: false, }; rulesClient.update.mockResolvedValue(getRuleMock(getQueryRuleParams())); - await patchRules({ rulesClient, params, rule }); + await patchRules({ rulesClient, nextParams, existingRule }); expect(rulesClient.enable).toHaveBeenCalledWith( expect.objectContaining({ - id: rule.id, + id: existingRule.id, }) ); }); it('calls the rulesClient with legacy ML params', async () => { const rulesClient = rulesClientMock.create(); - const params = getCreateMachineLearningRulesSchemaMock(); - const rule = getRuleMock(getMlRuleParams()); + const nextParams = getCreateMachineLearningRulesSchemaMock(); + const existingRule = getRuleMock(getMlRuleParams()); rulesClient.update.mockResolvedValue(getRuleMock(getMlRuleParams())); - await patchRules({ rulesClient, params, rule }); + await patchRules({ rulesClient, nextParams, existingRule }); expect(rulesClient.update).toHaveBeenCalledWith( expect.objectContaining({ data: expect.objectContaining({ @@ -74,13 +74,13 @@ describe('patchRules', () => { it('calls the rulesClient with new ML params', async () => { const rulesClient = rulesClientMock.create(); - const params = { + const nextParams = { ...getCreateMachineLearningRulesSchemaMock(), machine_learning_job_id: ['new_job_1', 'new_job_2'], }; - const rule = getRuleMock(getMlRuleParams()); + const existingRule = getRuleMock(getMlRuleParams()); rulesClient.update.mockResolvedValue(getRuleMock(getMlRuleParams())); - await patchRules({ rulesClient, params, rule }); + await patchRules({ rulesClient, nextParams, existingRule }); expect(rulesClient.update).toHaveBeenCalledWith( expect.objectContaining({ data: expect.objectContaining({ @@ -96,7 +96,7 @@ describe('patchRules', () => { describe('regression tests', () => { it("updates the rule's actions if provided", async () => { const rulesClient = rulesClientMock.create(); - const params = { + const nextParams = { ...getCreateRulesSchemaMock(), actions: [ { @@ -109,9 +109,9 @@ describe('patchRules', () => { }, ], }; - const rule = getRuleMock(getQueryRuleParams()); + const existingRule = getRuleMock(getQueryRuleParams()); rulesClient.update.mockResolvedValue(getRuleMock(getQueryRuleParams())); - await patchRules({ rulesClient, params, rule }); + await patchRules({ rulesClient, nextParams, existingRule }); expect(rulesClient.update).toHaveBeenCalledWith( expect.objectContaining({ data: expect.objectContaining({ @@ -132,10 +132,10 @@ describe('patchRules', () => { it('does not update actions if none are specified', async () => { const rulesClient = rulesClientMock.create(); - const params = getCreateRulesSchemaMock(); - delete params.actions; - const rule = getRuleMock(getQueryRuleParams()); - rule.actions = [ + const nextParams = getCreateRulesSchemaMock(); + delete nextParams.actions; + const existingRule = getRuleMock(getQueryRuleParams()); + existingRule.actions = [ { actionTypeId: '.slack', id: '2933e581-d81c-4fe3-88fe-c57c6b8a5bfd', @@ -146,7 +146,7 @@ describe('patchRules', () => { }, ]; rulesClient.update.mockResolvedValue(getRuleMock(getQueryRuleParams())); - await patchRules({ rulesClient, params, rule }); + await patchRules({ rulesClient, nextParams, existingRule }); expect(rulesClient.update).toHaveBeenCalledWith( expect.objectContaining({ data: expect.objectContaining({ diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/patch_rules.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/patch_rules.ts index d6fc0fba71bf6..0a8342ae265a0 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/patch_rules.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/patch_rules.ts @@ -13,39 +13,39 @@ import { convertPatchAPIToInternalSchema } from '../schemas/rule_converters'; export const patchRules = async ({ rulesClient, - rule, - params, + existingRule, + nextParams, }: PatchRulesOptions): Promise | null> => { - if (rule == null) { + if (existingRule == null) { return null; } - const patchedRule = convertPatchAPIToInternalSchema(params, rule); + const patchedRule = convertPatchAPIToInternalSchema(nextParams, existingRule); const update = await rulesClient.update({ - id: rule.id, + id: existingRule.id, data: patchedRule, }); - if (params.throttle !== undefined) { + if (nextParams.throttle !== undefined) { await maybeMute({ rulesClient, - muteAll: rule.muteAll, - throttle: params.throttle, + muteAll: existingRule.muteAll, + throttle: nextParams.throttle, id: update.id, }); } - if (rule.enabled && params.enabled === false) { - await rulesClient.disable({ id: rule.id }); - } else if (!rule.enabled && params.enabled === true) { - await rulesClient.enable({ id: rule.id }); + if (existingRule.enabled && nextParams.enabled === false) { + await rulesClient.disable({ id: existingRule.id }); + } else if (!existingRule.enabled && nextParams.enabled === true) { + await rulesClient.enable({ id: existingRule.id }); } else { // enabled is null or undefined and we do not touch the rule } - if (params.enabled != null) { - return { ...update, enabled: params.enabled }; + if (nextParams.enabled != null) { + return { ...update, enabled: nextParams.enabled }; } else { return update; } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/types.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/types.ts index 6e3b1a3dea2cb..e02daa7c88c40 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/types.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/types.ts @@ -79,8 +79,8 @@ export interface UpdateRulesOptions { export interface PatchRulesOptions { rulesClient: RulesClient; - params: PatchRulesSchema; - rule: RuleAlertType | null | undefined; + nextParams: PatchRulesSchema; + existingRule: RuleAlertType | null | undefined; } export interface ReadRuleOptions { diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/update_prepacked_rules.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/update_prepacked_rules.test.ts index d71274c7f1540..88d543cc77007 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/update_prepacked_rules.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/update_prepacked_rules.test.ts @@ -62,7 +62,7 @@ describe('updatePrepackagedRules', () => { expect(patchRules).toHaveBeenCalledWith( expect.objectContaining({ - params: expect.objectContaining({ + nextParams: expect.objectContaining({ actions: undefined, }), }) @@ -70,7 +70,7 @@ describe('updatePrepackagedRules', () => { expect(patchRules).toHaveBeenCalledWith( expect.objectContaining({ - params: expect.objectContaining({ + nextParams: expect.objectContaining({ enabled: undefined, }), }) @@ -99,7 +99,7 @@ describe('updatePrepackagedRules', () => { expect(patchRules).toHaveBeenCalledWith( expect.objectContaining({ - params: expect.objectContaining({ + nextParams: expect.objectContaining({ threat_indicator_path: 'test.path', }), }) @@ -107,7 +107,7 @@ describe('updatePrepackagedRules', () => { expect(patchRules).toHaveBeenCalledWith( expect.objectContaining({ - params: expect.objectContaining({ + nextParams: expect.objectContaining({ threat_index: ['test-index'], }), }) @@ -115,7 +115,7 @@ describe('updatePrepackagedRules', () => { expect(patchRules).toHaveBeenCalledWith( expect.objectContaining({ - params: expect.objectContaining({ + nextParams: expect.objectContaining({ threat_query: 'threat:*', }), }) diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/update_prepacked_rules.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/update_prepacked_rules.ts index 1487aa79e4874..aaee033dd8e96 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/update_prepacked_rules.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/update_prepacked_rules.ts @@ -99,8 +99,8 @@ export const createPromises = ( } else { return patchRules({ rulesClient, - rule: migratedRule, - params: { + existingRule: migratedRule, + nextParams: { ...rule, // Force enabled to use the enabled state from the existing rule by passing in undefined to patchRules enabled: undefined, diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/schemas/rule_converters.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/schemas/rule_converters.test.ts index 0a728f9c9e5c8..50cfce7ac905a 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/schemas/rule_converters.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/schemas/rule_converters.test.ts @@ -206,13 +206,43 @@ describe('rule_converters', () => { }); describe('convertPatchAPIToInternalSchema', () => { - test('should not update version for immutable rules', () => { - const patchParams = { + test('should set version to one specified in next params for custom rules', () => { + const nextParams = { index: ['new-test-index'], language: 'lucene', + version: 3, }; - const rule = getRuleMock({ ...getQueryRuleParams(), immutable: true }); - const patchedParams = convertPatchAPIToInternalSchema(patchParams, rule); + const existingRule = getRuleMock({ ...getQueryRuleParams(), version: 1 }); + const patchedParams = convertPatchAPIToInternalSchema(nextParams, existingRule); + expect(patchedParams).toEqual( + expect.objectContaining({ + params: expect.objectContaining({ version: 3 }), + }) + ); + }); + + test('should set version to one specified in next params for immutable rules', () => { + const nextParams = { + index: ['new-test-index'], + language: 'lucene', + version: 3, + }; + const existingRule = getRuleMock({ ...getQueryRuleParams(), version: 1, immutable: true }); + const patchedParams = convertPatchAPIToInternalSchema(nextParams, existingRule); + expect(patchedParams).toEqual( + expect.objectContaining({ + params: expect.objectContaining({ version: 3 }), + }) + ); + }); + + test('should not increment version for immutable rules if it is not specified in next params', () => { + const nextParams = { + index: ['new-test-index'], + language: 'lucene', + }; + const existingRule = getRuleMock({ ...getQueryRuleParams(), version: 1, immutable: true }); + const patchedParams = convertPatchAPIToInternalSchema(nextParams, existingRule); expect(patchedParams).toEqual( expect.objectContaining({ params: expect.objectContaining({ version: 1 }), @@ -220,13 +250,13 @@ describe('rule_converters', () => { ); }); - test('should update version for mutable rules', () => { - const patchParams = { + test('should increment version for custom rules if it is not specified in next params', () => { + const nextParams = { index: ['new-test-index'], language: 'lucene', }; - const rule = getRuleMock({ ...getQueryRuleParams() }); - const patchedParams = convertPatchAPIToInternalSchema(patchParams, rule); + const existingRule = getRuleMock({ ...getQueryRuleParams(), version: 1 }); + const patchedParams = convertPatchAPIToInternalSchema(nextParams, existingRule); expect(patchedParams).toEqual( expect.objectContaining({ params: expect.objectContaining({ version: 2 }), @@ -234,14 +264,14 @@ describe('rule_converters', () => { ); }); - test('should not update version due to enabled, id, or rule_id, ', () => { - const patchParams = { + test('should not increment version due to enabled, id, or rule_id, ', () => { + const nextParams = { enabled: false, id: 'some-id', rule_id: 'some-rule-id', }; - const rule = getRuleMock(getQueryRuleParams()); - const patchedParams = convertPatchAPIToInternalSchema(patchParams, rule); + const existingRule = getRuleMock({ ...getQueryRuleParams(), version: 1 }); + const patchedParams = convertPatchAPIToInternalSchema(nextParams, existingRule); expect(patchedParams).toEqual( expect.objectContaining({ params: expect.objectContaining({ version: 1 }), diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/schemas/rule_converters.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/schemas/rule_converters.ts index 74d55c262d17b..59811ac03900d 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/schemas/rule_converters.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/schemas/rule_converters.ts @@ -375,75 +375,87 @@ export const patchTypeSpecificSnakeToCamel = ( }; const versionExcludedKeys = ['enabled', 'id', 'rule_id']; -const shouldUpdateVersion = (params: PatchRulesSchema): boolean => { - for (const key in params) { +const incrementVersion = (nextParams: PatchRulesSchema, existingRule: RuleParams) => { + // The the version from nextParams if it's provided + if (nextParams.version) { + return nextParams.version; + } + + // If the rule is immutable, keep the current version + if (existingRule.immutable) { + return existingRule.version; + } + + // For custom rules, check modified params to deicide whether version increment is needed + for (const key in nextParams) { if (!versionExcludedKeys.includes(key)) { - return true; + return existingRule.version + 1; } } - return false; + return existingRule.version; }; // eslint-disable-next-line complexity export const convertPatchAPIToInternalSchema = ( - params: PatchRulesSchema & { + nextParams: PatchRulesSchema & { related_integrations?: RelatedIntegrationArray; required_fields?: RequiredFieldArray; setup?: SetupGuide; }, existingRule: SanitizedRule ): InternalRuleUpdate => { - const typeSpecificParams = patchTypeSpecificSnakeToCamel(params, existingRule.params); + const typeSpecificParams = patchTypeSpecificSnakeToCamel(nextParams, existingRule.params); const existingParams = existingRule.params; return { - name: params.name ?? existingRule.name, - tags: params.tags ?? existingRule.tags, + name: nextParams.name ?? existingRule.name, + tags: nextParams.tags ?? existingRule.tags, params: { - author: params.author ?? existingParams.author, - buildingBlockType: params.building_block_type ?? existingParams.buildingBlockType, - description: params.description ?? existingParams.description, + author: nextParams.author ?? existingParams.author, + buildingBlockType: nextParams.building_block_type ?? existingParams.buildingBlockType, + description: nextParams.description ?? existingParams.description, ruleId: existingParams.ruleId, - falsePositives: params.false_positives ?? existingParams.falsePositives, - from: params.from ?? existingParams.from, + falsePositives: nextParams.false_positives ?? existingParams.falsePositives, + from: nextParams.from ?? existingParams.from, immutable: existingParams.immutable, - license: params.license ?? existingParams.license, - outputIndex: params.output_index ?? existingParams.outputIndex, - timelineId: params.timeline_id ?? existingParams.timelineId, - timelineTitle: params.timeline_title ?? existingParams.timelineTitle, - meta: params.meta ?? existingParams.meta, - maxSignals: params.max_signals ?? existingParams.maxSignals, - relatedIntegrations: params.related_integrations ?? existingParams.relatedIntegrations, - requiredFields: params.required_fields ?? existingParams.requiredFields, - riskScore: params.risk_score ?? existingParams.riskScore, - riskScoreMapping: params.risk_score_mapping ?? existingParams.riskScoreMapping, - ruleNameOverride: params.rule_name_override ?? existingParams.ruleNameOverride, - setup: params.setup ?? existingParams.setup, - severity: params.severity ?? existingParams.severity, - severityMapping: params.severity_mapping ?? existingParams.severityMapping, - threat: params.threat ?? existingParams.threat, - timestampOverride: params.timestamp_override ?? existingParams.timestampOverride, + license: nextParams.license ?? existingParams.license, + outputIndex: nextParams.output_index ?? existingParams.outputIndex, + timelineId: nextParams.timeline_id ?? existingParams.timelineId, + timelineTitle: nextParams.timeline_title ?? existingParams.timelineTitle, + meta: nextParams.meta ?? existingParams.meta, + maxSignals: nextParams.max_signals ?? existingParams.maxSignals, + relatedIntegrations: nextParams.related_integrations ?? existingParams.relatedIntegrations, + requiredFields: nextParams.required_fields ?? existingParams.requiredFields, + riskScore: nextParams.risk_score ?? existingParams.riskScore, + riskScoreMapping: nextParams.risk_score_mapping ?? existingParams.riskScoreMapping, + ruleNameOverride: nextParams.rule_name_override ?? existingParams.ruleNameOverride, + setup: nextParams.setup ?? existingParams.setup, + severity: nextParams.severity ?? existingParams.severity, + severityMapping: nextParams.severity_mapping ?? existingParams.severityMapping, + threat: nextParams.threat ?? existingParams.threat, + timestampOverride: nextParams.timestamp_override ?? existingParams.timestampOverride, timestampOverrideFallbackDisabled: - params.timestamp_override_fallback_disabled ?? + nextParams.timestamp_override_fallback_disabled ?? existingParams.timestampOverrideFallbackDisabled, - to: params.to ?? existingParams.to, - references: params.references ?? existingParams.references, - namespace: params.namespace ?? existingParams.namespace, - note: params.note ?? existingParams.note, + to: nextParams.to ?? existingParams.to, + references: nextParams.references ?? existingParams.references, + namespace: nextParams.namespace ?? existingParams.namespace, + note: nextParams.note ?? existingParams.note, // Always use the version from the request if specified. If it isn't specified, leave immutable rules alone and // increment the version of mutable rules by 1. - version: - params.version ?? existingParams.immutable - ? existingParams.version - : shouldUpdateVersion(params) - ? existingParams.version + 1 - : existingParams.version, - exceptionsList: params.exceptions_list ?? existingParams.exceptionsList, + version: incrementVersion(nextParams, existingParams), + exceptionsList: nextParams.exceptions_list ?? existingParams.exceptionsList, ...typeSpecificParams, }, - schedule: { interval: params.interval ?? existingRule.schedule.interval }, - actions: params.actions ? params.actions.map(transformRuleToAlertAction) : existingRule.actions, - throttle: params.throttle ? transformToAlertThrottle(params.throttle) : existingRule.throttle, - notifyWhen: params.throttle ? transformToNotifyWhen(params.throttle) : existingRule.notifyWhen, + schedule: { interval: nextParams.interval ?? existingRule.schedule.interval }, + actions: nextParams.actions + ? nextParams.actions.map(transformRuleToAlertAction) + : existingRule.actions, + throttle: nextParams.throttle + ? transformToAlertThrottle(nextParams.throttle) + : existingRule.throttle, + notifyWhen: nextParams.throttle + ? transformToNotifyWhen(nextParams.throttle) + : existingRule.notifyWhen, }; }; From 135115d833165a7eb2ef10b571a0cd0ee3cae2e4 Mon Sep 17 00:00:00 2001 From: Peter Pisljar Date: Thu, 25 Aug 2022 18:31:41 +0200 Subject: [PATCH 03/28] [DataViews] dont check relationships for adhoc data views (#139376) --- .../public/components/edit_index_pattern/edit_index_pattern.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/data_view_management/public/components/edit_index_pattern/edit_index_pattern.tsx b/src/plugins/data_view_management/public/components/edit_index_pattern/edit_index_pattern.tsx index 74e1eb77cf503..3c9eeaa63109d 100644 --- a/src/plugins/data_view_management/public/components/edit_index_pattern/edit_index_pattern.tsx +++ b/src/plugins/data_view_management/public/components/edit_index_pattern/edit_index_pattern.tsx @@ -82,7 +82,7 @@ export const EditIndexPattern = withRouter( }, [savedObjectsManagement]); useEffect(() => { - if (allowedTypes.length === 0) { + if (allowedTypes.length === 0 || !indexPattern.isPersisted()) { return; } const allowedAsString = allowedTypes.map((item) => item.name); From f68751054a3d736b209bc0b096fae5c339bda19c Mon Sep 17 00:00:00 2001 From: Peter Pisljar Date: Thu, 25 Aug 2022 18:32:06 +0200 Subject: [PATCH 04/28] [DataViews] expose list of matched indices (#139067) --- packages/kbn-optimizer/limits.yml | 2 +- .../data_views/common/data_views/data_view.ts | 5 +++ .../common/data_views/data_views.test.ts | 2 +- .../common/data_views/data_views.ts | 41 ++++++++++++++++--- src/plugins/data_views/common/types.ts | 10 ++++- .../data_views/data_views_api_client.ts | 9 ++-- .../server/fetcher/index_patterns_fetcher.ts | 17 ++++---- .../field_capabilities.test.js | 12 +++--- .../field_capabilities/field_capabilities.ts | 7 +++- .../data_views/server/routes/fields_for.ts | 4 +- .../fields_for_wildcard_route/conflicts.js | 1 + .../fields_for_wildcard_route/response.js | 3 ++ .../rule_data_client/rule_data_client.test.ts | 2 +- .../rule_data_client/rule_data_client.ts | 2 +- .../lib/requests/get_index_pattern.ts | 2 +- .../search_strategy/index_fields/index.ts | 22 +++++----- 16 files changed, 100 insertions(+), 41 deletions(-) diff --git a/packages/kbn-optimizer/limits.yml b/packages/kbn-optimizer/limits.yml index d41a5356af082..7883acc833ad3 100644 --- a/packages/kbn-optimizer/limits.yml +++ b/packages/kbn-optimizer/limits.yml @@ -101,7 +101,7 @@ pageLoadAssetSize: visTypeMetric: 23332 bfetch: 22837 kibanaUtils: 79713 - dataViews: 43532 + dataViews: 44532 expressions: 140958 fieldFormats: 65209 kibanaReact: 74422 diff --git a/src/plugins/data_views/common/data_views/data_view.ts b/src/plugins/data_views/common/data_views/data_view.ts index 29654c5d57847..42ab6d10834d4 100644 --- a/src/plugins/data_views/common/data_views/data_view.ts +++ b/src/plugins/data_views/common/data_views/data_view.ts @@ -146,6 +146,11 @@ export class DataView implements DataViewBase { */ public name: string = ''; + /* + * list of indices that the index pattern matched + */ + public matchedIndices: string[] = []; + /** * constructor * @param config - config data and dependencies diff --git a/src/plugins/data_views/common/data_views/data_views.test.ts b/src/plugins/data_views/common/data_views/data_views.test.ts index fcf60947db758..af95942393e11 100644 --- a/src/plugins/data_views/common/data_views/data_views.test.ts +++ b/src/plugins/data_views/common/data_views/data_views.test.ts @@ -21,7 +21,7 @@ import { stubbedSavedObjectIndexPattern } from '../data_view.stub'; const createFieldsFetcher = () => ({ - getFieldsForWildcard: jest.fn(async () => []), + getFieldsForWildcard: jest.fn(async () => ({ fields: [], indices: [] })), } as any as IDataViewsApiClient); const fieldFormats = fieldFormatsMock; diff --git a/src/plugins/data_views/common/data_views/data_views.ts b/src/plugins/data_views/common/data_views/data_views.ts index aca409ea08624..7c5e9314a153e 100644 --- a/src/plugins/data_views/common/data_views/data_views.ts +++ b/src/plugins/data_views/common/data_views/data_views.ts @@ -478,7 +478,7 @@ export class DataViewsService { */ getFieldsForWildcard = async (options: GetFieldsOptions): Promise => { const metaFields = await this.config.get(META_FIELDS); - return this.apiClient.getFieldsForWildcard({ + const { fields } = await this.apiClient.getFieldsForWildcard({ pattern: options.pattern, metaFields, type: options.type, @@ -486,6 +486,7 @@ export class DataViewsService { allowNoIndex: options.allowNoIndex, filter: options.filter, }); + return fields; }; /** @@ -505,13 +506,36 @@ export class DataViewsService { pattern: indexPattern.title as string, }); + private getFieldsAndIndicesForDataView = async (dataView: DataView) => { + const metaFields = await this.config.get(META_FIELDS); + return this.apiClient.getFieldsForWildcard({ + type: dataView.type, + rollupIndex: dataView?.typeMeta?.params?.rollup_index, + allowNoIndex: dataView.allowNoIndex, + pattern: dataView.title as string, + metaFields, + }); + }; + + private getFieldsAndIndicesForWildcard = async (options: GetFieldsOptions) => { + const metaFields = await this.config.get(META_FIELDS); + return await this.apiClient.getFieldsForWildcard({ + pattern: options.pattern, + metaFields, + type: options.type, + rollupIndex: options.rollupIndex, + allowNoIndex: options.allowNoIndex, + filter: options.filter, + }); + }; + /** * Refresh field list for a given index pattern. * @param indexPattern */ refreshFields = async (indexPattern: DataView) => { try { - const fields = (await this.getFieldsForIndexPattern(indexPattern)) as FieldSpec[]; + const { fields, indices } = await this.getFieldsAndIndicesForDataView(indexPattern); fields.forEach((field) => (field.isMapped = true)); const scripted = indexPattern.getScriptedFields().map((field) => field.spec); const fieldAttrs = indexPattern.getFieldAttrs(); @@ -527,6 +551,7 @@ export class DataViewsService { !fieldsWithSavedAttrs.find((mappedField) => mappedField.name === runtimeField.name) ); indexPattern.fields.replaceAll([...runtimeFieldsArray, ...fieldsWithSavedAttrs]); + indexPattern.matchedIndices = indices; } catch (err) { if (err instanceof DataViewMissingIndices) { this.onNotification( @@ -567,7 +592,7 @@ export class DataViewsService { const scriptedFields = fieldsAsArr.filter((field) => field.scripted); try { let updatedFieldList: FieldSpec[]; - const newFields = (await this.getFieldsForWildcard(options)) as FieldSpec[]; + const { fields: newFields, indices } = await this.getFieldsAndIndicesForWildcard(options); newFields.forEach((field) => (field.isMapped = true)); // If allowNoIndex, only update field list if field caps finds fields. To support @@ -578,7 +603,7 @@ export class DataViewsService { updatedFieldList = fieldsAsArr; } - return this.fieldArrayToMap(updatedFieldList, fieldAttrs); + return { fields: this.fieldArrayToMap(updatedFieldList, fieldAttrs), indices }; } catch (err) { if (err instanceof DataViewMissingIndices) { this.onNotification( @@ -693,8 +718,10 @@ export class DataViewsService { ? JSON.parse(savedObject.attributes.fieldAttrs) : {}; + let matchedIndices: string[] = []; + try { - spec.fields = await this.refreshFieldSpecMap( + const { fields, indices } = await this.refreshFieldSpecMap( spec.fields || {}, savedObject.id, spec.title as string, @@ -708,6 +735,9 @@ export class DataViewsService { spec.fieldAttrs ); + spec.fields = fields; + matchedIndices = indices || []; + const runtimeFieldSpecs = this.getRuntimeFields(runtimeFieldMap, spec.fieldAttrs); // mapped fields overwrite runtime fields spec.fields = { ...runtimeFieldSpecs, ...spec.fields }; @@ -740,6 +770,7 @@ export class DataViewsService { : {}; const indexPattern = await this.create(spec, true); + indexPattern.matchedIndices = matchedIndices; indexPattern.resetOriginalSavedObjectBody(); return indexPattern; }; diff --git a/src/plugins/data_views/common/types.ts b/src/plugins/data_views/common/types.ts index 4fcacc01c3738..ec0aeb081124e 100644 --- a/src/plugins/data_views/common/types.ts +++ b/src/plugins/data_views/common/types.ts @@ -317,8 +317,16 @@ export interface GetFieldsOptions { filter?: QueryDslQueryContainer; } +/** + * FieldsForWildcard response + */ +export interface FieldsForWildcardResponse { + fields: FieldSpec[]; + indices: string[]; +} + export interface IDataViewsApiClient { - getFieldsForWildcard: (options: GetFieldsOptions) => Promise; + getFieldsForWildcard: (options: GetFieldsOptions) => Promise; hasUserDataView: () => Promise; } diff --git a/src/plugins/data_views/public/data_views/data_views_api_client.ts b/src/plugins/data_views/public/data_views/data_views_api_client.ts index b2b8c169c3257..835c22891c68c 100644 --- a/src/plugins/data_views/public/data_views/data_views_api_client.ts +++ b/src/plugins/data_views/public/data_views/data_views_api_client.ts @@ -8,7 +8,8 @@ import { HttpSetup } from '@kbn/core/public'; import { DataViewMissingIndices } from '../../common/lib'; -import { FieldSpec, GetFieldsOptions, IDataViewsApiClient } from '../../common'; +import { GetFieldsOptions, IDataViewsApiClient } from '../../common'; +import { FieldsForWildcardResponse } from '../../common/types'; const API_BASE_URL: string = `/api/index_patterns/`; @@ -50,14 +51,16 @@ export class DataViewsApiClient implements IDataViewsApiClient { */ getFieldsForWildcard(options: GetFieldsOptions) { const { pattern, metaFields, type, rollupIndex, allowNoIndex, filter } = options; - return this._request<{ fields: FieldSpec[] }>(this._getUrl(['_fields_for_wildcard']), { + return this._request(this._getUrl(['_fields_for_wildcard']), { pattern, meta_fields: metaFields, type, rollup_index: rollupIndex, allow_no_index: allowNoIndex, filter, - }).then((resp) => resp?.fields || []); + }).then((response) => { + return response || { fields: [], indices: [] }; + }); } /** diff --git a/src/plugins/data_views/server/fetcher/index_patterns_fetcher.ts b/src/plugins/data_views/server/fetcher/index_patterns_fetcher.ts index 0ff410e53fca3..3049c2d1a3dec 100644 --- a/src/plugins/data_views/server/fetcher/index_patterns_fetcher.ts +++ b/src/plugins/data_views/server/fetcher/index_patterns_fetcher.ts @@ -61,7 +61,7 @@ export class IndexPatternsFetcher { type?: string; rollupIndex?: string; filter?: QueryDslQueryContainer; - }): Promise { + }): Promise<{ fields: FieldDescriptor[]; indices: string[] }> { const { pattern, metaFields = [], fieldCapsOptions, type, rollupIndex, filter } = options; const patternList = Array.isArray(pattern) ? pattern : pattern.split(','); const allowNoIndices = fieldCapsOptions @@ -94,17 +94,20 @@ export class IndexPatternsFetcher { } const rollupIndexCapabilities = capabilityCheck.aggs; - const fieldCapsResponseObj = keyBy(fieldCapsResponse, 'name'); + const fieldCapsResponseObj = keyBy(fieldCapsResponse.fields, 'name'); // Keep meta fields metaFields!.forEach( (field: string) => fieldCapsResponseObj[field] && rollupFields.push(fieldCapsResponseObj[field]) ); - return mergeCapabilitiesWithFields( - rollupIndexCapabilities!, - fieldCapsResponseObj, - rollupFields - ); + return { + fields: mergeCapabilitiesWithFields( + rollupIndexCapabilities!, + fieldCapsResponseObj, + rollupFields + ), + indices: fieldCapsResponse.indices, + }; } return fieldCapsResponse; } diff --git a/src/plugins/data_views/server/fetcher/lib/field_capabilities/field_capabilities.test.js b/src/plugins/data_views/server/fetcher/lib/field_capabilities/field_capabilities.test.js index 88e91749b11d8..422364a67dd96 100644 --- a/src/plugins/data_views/server/fetcher/lib/field_capabilities/field_capabilities.test.js +++ b/src/plugins/data_views/server/fetcher/lib/field_capabilities/field_capabilities.test.js @@ -85,7 +85,7 @@ describe('index_patterns/field_capabilities/field_capabilities', () => { fieldsFromFieldCaps: fields.map((name) => ({ name })), }); - const fieldNames = (await getFieldCapabilities(getArgsWithCallCluster())).map( + const fieldNames = (await getFieldCapabilities(getArgsWithCallCluster())).fields.map( (field) => field.name ); expect(fieldNames).toEqual(fields); @@ -99,7 +99,7 @@ describe('index_patterns/field_capabilities/field_capabilities', () => { fieldsFromFieldCaps: shuffle(letters.map((name) => ({ name }))), }); - const fieldNames = (await getFieldCapabilities(getArgsWithCallCluster())).map( + const fieldNames = (await getFieldCapabilities(getArgsWithCallCluster())).fields.map( (field) => field.name ); expect(fieldNames).toEqual(sortedLetters); @@ -115,8 +115,8 @@ describe('index_patterns/field_capabilities/field_capabilities', () => { const args = getArgsWithCallCluster({ metaFields: ['meta1', 'meta2'] }); const resp = await getFieldCapabilities(args); - expect(resp).toHaveLength(4); - expect(resp.map((field) => field.name)).toEqual(['bar', 'foo', 'meta1', 'meta2']); + expect(resp.fields).toHaveLength(4); + expect(resp.fields.map((field) => field.name)).toEqual(['bar', 'foo', 'meta1', 'meta2']); }); }); @@ -141,7 +141,7 @@ describe('index_patterns/field_capabilities/field_capabilities', () => { fieldsFromFieldCaps: [field], }); - const resp = await getFieldCapabilities(getArgsWithCallCluster()); + const { fields: resp } = await getFieldCapabilities(getArgsWithCallCluster()); expect(resp).toHaveLength(1); expect(resp[0]).toHaveProperty(property); expect(resp[0][property]).not.toBe(footballs[0]); @@ -185,7 +185,7 @@ describe('index_patterns/field_capabilities/field_capabilities', () => { }, }); - expect(await getFieldCapabilities(getArgsWithCallCluster())).toEqual([ + expect((await getFieldCapabilities(getArgsWithCallCluster())).fields).toEqual([ { notFieldAnymore: 1 }, { notFieldAnymore: 1 }, ]); diff --git a/src/plugins/data_views/server/fetcher/lib/field_capabilities/field_capabilities.ts b/src/plugins/data_views/server/fetcher/lib/field_capabilities/field_capabilities.ts index 875ebb2490613..7a050c8b9d80a 100644 --- a/src/plugins/data_views/server/fetcher/lib/field_capabilities/field_capabilities.ts +++ b/src/plugins/data_views/server/fetcher/lib/field_capabilities/field_capabilities.ts @@ -31,7 +31,7 @@ interface FieldCapabilitiesParams { * @param {Array} [indices=[]] the list of indexes to check * @param {Array} [metaFields=[]] the list of internal fields to include * @param {Object} fieldCapsOptions - * @return {Promise>} + * @return {Promise<{ fields: Array, indices: Array>}>} */ export async function getFieldCapabilities(params: FieldCapabilitiesParams) { const { callCluster, indices = [], fieldCapsOptions, filter, metaFields = [] } = params; @@ -67,5 +67,8 @@ export async function getFieldCapabilities(params: FieldCapabilitiesParams) { ) .map(mergeOverrides); - return sortBy(allFieldsUnsorted, 'name'); + return { + fields: sortBy(allFieldsUnsorted, 'name'), + indices: esFieldCaps.body.indices as string[], + }; } diff --git a/src/plugins/data_views/server/routes/fields_for.ts b/src/plugins/data_views/server/routes/fields_for.ts index 60321c7185185..9e0e94bd57511 100644 --- a/src/plugins/data_views/server/routes/fields_for.ts +++ b/src/plugins/data_views/server/routes/fields_for.ts @@ -73,7 +73,7 @@ const handler: RequestHandler<{}, IQuery, IBody> = async (context, request, resp } try { - const fields = await indexPatterns.getFieldsForWildcard({ + const { fields, indices } = await indexPatterns.getFieldsForWildcard({ pattern, metaFields: parsedFields, type, @@ -85,7 +85,7 @@ const handler: RequestHandler<{}, IQuery, IBody> = async (context, request, resp }); return response.ok({ - body: { fields }, + body: { fields, indices }, headers: { 'content-type': 'application/json', }, diff --git a/test/api_integration/apis/index_patterns/fields_for_wildcard_route/conflicts.js b/test/api_integration/apis/index_patterns/fields_for_wildcard_route/conflicts.js index 2e7cc4a76340e..343160d47ea41 100644 --- a/test/api_integration/apis/index_patterns/fields_for_wildcard_route/conflicts.js +++ b/test/api_integration/apis/index_patterns/fields_for_wildcard_route/conflicts.js @@ -69,6 +69,7 @@ export default function ({ getService }) { metadata_field: false, }, ], + indices: ['logs-2017.01.01', 'logs-2017.01.02'], }); })); }); diff --git a/test/api_integration/apis/index_patterns/fields_for_wildcard_route/response.js b/test/api_integration/apis/index_patterns/fields_for_wildcard_route/response.js index 07603be1de9ac..2dfcdbb35cd71 100644 --- a/test/api_integration/apis/index_patterns/fields_for_wildcard_route/response.js +++ b/test/api_integration/apis/index_patterns/fields_for_wildcard_route/response.js @@ -85,6 +85,7 @@ export default function ({ getService }) { .query({ pattern: 'basic_index' }) .expect(200, { fields: testFields, + indices: ['basic_index'], }) .then(ensureFieldsAreSorted); }); @@ -176,6 +177,7 @@ export default function ({ getService }) { metadata_field: false, }, ], + indices: ['basic_index'], }) .then(ensureFieldsAreSorted); }); @@ -186,6 +188,7 @@ export default function ({ getService }) { .query({ pattern: 'bad_index,basic_index' }) .expect(200, { fields: testFields, + indices: ['basic_index'], }); }); it('returns 404 when no patterns exist', async () => { diff --git a/x-pack/plugins/rule_registry/server/rule_data_client/rule_data_client.test.ts b/x-pack/plugins/rule_registry/server/rule_data_client/rule_data_client.test.ts index 03dd09a0dc8d8..ea51c0104d775 100644 --- a/x-pack/plugins/rule_registry/server/rule_data_client/rule_data_client.test.ts +++ b/x-pack/plugins/rule_registry/server/rule_data_client/rule_data_client.test.ts @@ -75,7 +75,7 @@ describe('RuleDataClient', () => { describe('getReader()', () => { beforeEach(() => { jest.resetAllMocks(); - getFieldsForWildcardMock.mockResolvedValue(['foo']); + getFieldsForWildcardMock.mockResolvedValue({ fields: ['foo'] }); IndexPatternsFetcher.prototype.getFieldsForWildcard = getFieldsForWildcardMock; }); diff --git a/x-pack/plugins/rule_registry/server/rule_data_client/rule_data_client.ts b/x-pack/plugins/rule_registry/server/rule_data_client/rule_data_client.ts index 7b7fead83d4ea..f0fbc81964562 100644 --- a/x-pack/plugins/rule_registry/server/rule_data_client/rule_data_client.ts +++ b/x-pack/plugins/rule_registry/server/rule_data_client/rule_data_client.ts @@ -131,7 +131,7 @@ export class RuleDataClient implements IRuleDataClient { const indexPatternsFetcher = new IndexPatternsFetcher(clusterClient); try { - const fields = await indexPatternsFetcher.getFieldsForWildcard({ + const { fields } = await indexPatternsFetcher.getFieldsForWildcard({ pattern: indexPattern, }); diff --git a/x-pack/plugins/synthetics/server/legacy_uptime/lib/requests/get_index_pattern.ts b/x-pack/plugins/synthetics/server/legacy_uptime/lib/requests/get_index_pattern.ts index fbee794b4f3d8..539a2be1b7d1a 100644 --- a/x-pack/plugins/synthetics/server/legacy_uptime/lib/requests/get_index_pattern.ts +++ b/x-pack/plugins/synthetics/server/legacy_uptime/lib/requests/get_index_pattern.ts @@ -29,7 +29,7 @@ export const getUptimeIndexPattern = async ({ // we have to catch errors here to avoid all endpoints returning 500 for users without APM data // (would be a bad first time experience) try { - const fields = await indexPatternsFetcher.getFieldsForWildcard({ + const { fields } = await indexPatternsFetcher.getFieldsForWildcard({ pattern: dynamicSettings.heartbeatIndices, }); diff --git a/x-pack/plugins/timelines/server/search_strategy/index_fields/index.ts b/x-pack/plugins/timelines/server/search_strategy/index_fields/index.ts index 2a69b60b708b5..bf433179f7ddb 100644 --- a/x-pack/plugins/timelines/server/search_strategy/index_fields/index.ts +++ b/x-pack/plugins/timelines/server/search_strategy/index_fields/index.ts @@ -136,18 +136,20 @@ export const requestIndexFieldSearch = async ( [] ); if (!request.onlyCheckIfIndicesExist) { - const fieldDescriptor = await Promise.all( - indicesExist.map(async (index, n) => { - if (index.startsWith('.alerts-observability')) { - return indexPatternsFetcherAsInternalUser.getFieldsForWildcard({ + const fieldDescriptor = ( + await Promise.all( + indicesExist.map(async (index, n) => { + if (index.startsWith('.alerts-observability')) { + return indexPatternsFetcherAsInternalUser.getFieldsForWildcard({ + pattern: index, + }); + } + return indexPatternsFetcherAsCurrentUser.getFieldsForWildcard({ pattern: index, }); - } - return indexPatternsFetcherAsCurrentUser.getFieldsForWildcard({ - pattern: index, - }); - }) - ); + }) + ) + ).map((response) => response.fields || []); indexFields = await formatIndexFields(beatFields, fieldDescriptor, patternList); } } From bb05fa7d2431b26093bd9746c3608a8849d2c0c0 Mon Sep 17 00:00:00 2001 From: Nicolas Chaulet Date: Thu, 25 Aug 2022 12:43:17 -0400 Subject: [PATCH 05/28] [Fleet] Remove unsupported output_id property from package policy (#139314) --- .../components/fleet_extensions/mocks.ts | 1 - x-pack/plugins/fleet/common/mocks.ts | 1 - .../plugins/fleet/common/openapi/bundled.json | 7 ++++-- .../plugins/fleet/common/openapi/bundled.yaml | 3 +++ .../schemas/new_package_policy.yaml | 1 + .../schemas/update_package_policy.yaml | 2 ++ .../package_to_package_policy.test.ts.snap | 1 - .../common/services/fixtures/aws_package.ts | 2 -- .../package_to_package_policy.test.ts | 12 +++------- .../services/package_to_package_policy.ts | 2 -- .../services/validate_package_policy.test.ts | 2 -- .../common/types/models/package_policy.ts | 1 - x-pack/plugins/fleet/dev_docs/data_model.md | 6 ++--- .../fleet/dev_docs/schema/saved_objects.mml | 1 - .../steps/step_configure_package.test.tsx | 1 - .../steps/step_define_package_policy.test.tsx | 2 -- .../steps/step_define_package_policy.tsx | 2 -- .../components/page_steps/add_integration.tsx | 1 - .../hooks/send_generate_package_policy.tsx | 2 -- .../single_page_layout/index.test.tsx | 1 - .../single_page_layout/index.tsx | 1 - .../edit_package_policy_page/index.test.tsx | 1 - .../edit_package_policy_page/index.tsx | 1 - .../epm/screens/detail/index.test.tsx | 2 -- .../package_policy_actions_menu.test.tsx | 1 - .../routes/package_policy/handlers.test.ts | 5 ---- .../server/routes/package_policy/handlers.ts | 6 ++++- .../fleet/server/saved_objects/index.ts | 4 ++-- .../security_solution/to_v7_11_0.test.ts | 4 ---- .../security_solution/to_v7_12_0.test.ts | 4 ---- .../security_solution/to_v7_13_0.test.ts | 1 - .../security_solution/to_v7_14_0.test.ts | 3 --- .../security_solution/to_v7_15_0.test.ts | 3 --- .../security_solution/to_v7_16_0.test.ts | 3 --- .../security_solution/to_v8_2_0.test.ts | 3 --- .../security_solution/to_v8_3_0.test.ts | 3 --- .../security_solution/to_v8_4_0.test.ts | 3 --- .../saved_objects/migrations/to_v8_5_0.ts | 11 +++++++++ .../package_policies_to_agent_inputs.test.ts | 1 - ...kage_policies_to_agent_permissions.test.ts | 4 ---- .../fleet/server/services/agent_policy.ts | 1 - .../services/agent_policy_create.test.ts | 1 - .../server/services/epm/packages/get.test.ts | 4 ---- .../server/services/package_policy.test.ts | 19 --------------- .../fleet/server/services/package_policy.ts | 23 +++++++------------ .../server/services/preconfiguration.test.ts | 1 - .../server/types/models/package_policy.ts | 4 +++- .../fleet_package_policy_generator.ts | 1 - .../index_fleet_endpoint_policy.ts | 1 - .../common/endpoint/generate_data.ts | 1 - .../policy/store/policy_details/index.test.ts | 2 -- .../hooks/use_update_policy.test.tsx | 1 - ...s_policy_create_extension_wrapper.test.tsx | 1 - ...ics_policy_edit_extension_wrapper.test.tsx | 1 - .../synthetics_private_location.ts | 1 - .../private_location/test_policy.ts | 1 - .../update_rules_config.ts | 1 - .../api_integration/apis/osquery/packs.ts | 1 - .../uptime/rest/sample_data/test_policy.ts | 6 ++--- .../apis/agents/upgrade.ts | 1 - .../apis/package_policy/create.ts | 18 --------------- .../apis/package_policy/delete.ts | 2 -- .../apis/package_policy/get.ts | 3 --- .../apis/package_policy/update.ts | 8 ------- .../apis/package_policy/upgrade.ts | 10 -------- .../services/endpoint_policy.ts | 1 - 66 files changed, 48 insertions(+), 181 deletions(-) diff --git a/x-pack/plugins/cloud_security_posture/public/components/fleet_extensions/mocks.ts b/x-pack/plugins/cloud_security_posture/public/components/fleet_extensions/mocks.ts index c5e39a3623d1f..2af55809f1c91 100644 --- a/x-pack/plugins/cloud_security_posture/public/components/fleet_extensions/mocks.ts +++ b/x-pack/plugins/cloud_security_posture/public/components/fleet_extensions/mocks.ts @@ -15,7 +15,6 @@ export const getCspNewPolicyMock = (type: BenchmarkId = 'cis_k8s'): NewPackagePo namespace: 'default', policy_id: '', enabled: true, - output_id: '', inputs: [ { type: CLOUDBEAT_VANILLA, diff --git a/x-pack/plugins/fleet/common/mocks.ts b/x-pack/plugins/fleet/common/mocks.ts index b60e1ac13748d..bc8880ed385af 100644 --- a/x-pack/plugins/fleet/common/mocks.ts +++ b/x-pack/plugins/fleet/common/mocks.ts @@ -15,7 +15,6 @@ export const createNewPackagePolicyMock = (): NewPackagePolicy => { namespace: 'default', enabled: true, policy_id: '93c46720-c217-11ea-9906-b5b8a21b268e', - output_id: '', package: { name: 'endpoint', title: 'Elastic Endpoint', diff --git a/x-pack/plugins/fleet/common/openapi/bundled.json b/x-pack/plugins/fleet/common/openapi/bundled.json index adb49b25782cd..fefb3da0b0fd9 100644 --- a/x-pack/plugins/fleet/common/openapi/bundled.json +++ b/x-pack/plugins/fleet/common/openapi/bundled.json @@ -4621,7 +4621,8 @@ "type": "string" }, "output_id": { - "type": "string" + "type": "string", + "deprecated": true }, "inputs": { "type": "array", @@ -5031,7 +5032,9 @@ "type": "string" }, "output_id": { - "type": "string" + "type": "string", + "description": "Not supported output can be set at the agent policy level only", + "deprecated": true }, "inputs": { "type": "array", diff --git a/x-pack/plugins/fleet/common/openapi/bundled.yaml b/x-pack/plugins/fleet/common/openapi/bundled.yaml index 3cc16afc3f410..425a457b78d1a 100644 --- a/x-pack/plugins/fleet/common/openapi/bundled.yaml +++ b/x-pack/plugins/fleet/common/openapi/bundled.yaml @@ -2923,6 +2923,7 @@ components: type: string output_id: type: string + deprecated: true inputs: type: array items: @@ -3186,6 +3187,8 @@ components: type: string output_id: type: string + description: Not supported output can be set at the agent policy level only + deprecated: true inputs: type: array items: diff --git a/x-pack/plugins/fleet/common/openapi/components/schemas/new_package_policy.yaml b/x-pack/plugins/fleet/common/openapi/components/schemas/new_package_policy.yaml index ad400a9eb8e0c..263efb36b504a 100644 --- a/x-pack/plugins/fleet/common/openapi/components/schemas/new_package_policy.yaml +++ b/x-pack/plugins/fleet/common/openapi/components/schemas/new_package_policy.yaml @@ -20,6 +20,7 @@ properties: type: string output_id: type: string + deprecated: true inputs: type: array items: diff --git a/x-pack/plugins/fleet/common/openapi/components/schemas/update_package_policy.yaml b/x-pack/plugins/fleet/common/openapi/components/schemas/update_package_policy.yaml index bd14910303a0d..71e898017d06a 100644 --- a/x-pack/plugins/fleet/common/openapi/components/schemas/update_package_policy.yaml +++ b/x-pack/plugins/fleet/common/openapi/components/schemas/update_package_policy.yaml @@ -23,6 +23,8 @@ properties: type: string output_id: type: string + description: Not supported output can be set at the agent policy level only + deprecated: true inputs: type: array items: diff --git a/x-pack/plugins/fleet/common/services/__snapshots__/package_to_package_policy.test.ts.snap b/x-pack/plugins/fleet/common/services/__snapshots__/package_to_package_policy.test.ts.snap index d49743fa487f4..3235ebbd9a8f9 100644 --- a/x-pack/plugins/fleet/common/services/__snapshots__/package_to_package_policy.test.ts.snap +++ b/x-pack/plugins/fleet/common/services/__snapshots__/package_to_package_policy.test.ts.snap @@ -763,7 +763,6 @@ Object { ], "name": "aws-1", "namespace": "default", - "output_id": "some-output-id", "package": Object { "name": "aws", "title": "AWS", diff --git a/x-pack/plugins/fleet/common/services/fixtures/aws_package.ts b/x-pack/plugins/fleet/common/services/fixtures/aws_package.ts index 63397e484a7df..35e5b9654c175 100644 --- a/x-pack/plugins/fleet/common/services/fixtures/aws_package.ts +++ b/x-pack/plugins/fleet/common/services/fixtures/aws_package.ts @@ -1930,7 +1930,6 @@ export const INVALID_AWS_POLICY = { package: { name: 'aws', title: 'AWS', version: '0.5.3' }, enabled: true, policy_id: 'some-agent-policy-id', - output_id: 'some-output-id', inputs: [ { type: 'aws/metrics', @@ -2338,7 +2337,6 @@ export const VALID_AWS_POLICY = { package: { name: 'aws', title: 'AWS', version: '0.5.3' }, enabled: true, policy_id: 'some-agent-policy-id', - output_id: 'some-output-id', inputs: [ { type: 'aws/metrics', diff --git a/x-pack/plugins/fleet/common/services/package_to_package_policy.test.ts b/x-pack/plugins/fleet/common/services/package_to_package_policy.test.ts index 79a501140a184..f3e1121ab766f 100644 --- a/x-pack/plugins/fleet/common/services/package_to_package_policy.test.ts +++ b/x-pack/plugins/fleet/common/services/package_to_package_policy.test.ts @@ -346,13 +346,12 @@ describe('Fleet - packageToPackagePolicy', () => { describe('packageToPackagePolicy', () => { it('returns package policy with default name', () => { - expect(packageToPackagePolicy(mockPackage, '1', '2')).toEqual({ + expect(packageToPackagePolicy(mockPackage, '1')).toEqual({ policy_id: '1', namespace: '', enabled: true, inputs: [], name: 'mock-package-1', - output_id: '2', package: { name: 'mock-package', title: 'Mock package', @@ -362,13 +361,12 @@ describe('Fleet - packageToPackagePolicy', () => { }); it('returns package policy with custom name', () => { - expect(packageToPackagePolicy(mockPackage, '1', '2', 'default', 'pkgPolicy-1')).toEqual({ + expect(packageToPackagePolicy(mockPackage, '1', 'default', 'pkgPolicy-1')).toEqual({ policy_id: '1', namespace: 'default', enabled: true, inputs: [], name: 'pkgPolicy-1', - output_id: '2', package: { name: 'mock-package', title: 'Mock package', @@ -382,7 +380,6 @@ describe('Fleet - packageToPackagePolicy', () => { packageToPackagePolicy( mockPackage, '1', - '2', 'mock-namespace', 'pkgPolicy-1', 'Test description' @@ -394,7 +391,6 @@ describe('Fleet - packageToPackagePolicy', () => { name: 'pkgPolicy-1', namespace: 'mock-namespace', description: 'Test description', - output_id: '2', package: { name: 'mock-package', title: 'Mock package', @@ -410,14 +406,13 @@ describe('Fleet - packageToPackagePolicy', () => { } as unknown as PackageInfo; expect( - packageToPackagePolicy(mockPackageWithPolicyTemplates, '1', '2', 'default', 'pkgPolicy-1') + packageToPackagePolicy(mockPackageWithPolicyTemplates, '1', 'default', 'pkgPolicy-1') ).toEqual({ policy_id: '1', namespace: 'default', enabled: true, inputs: [{ type: 'foo', enabled: true, streams: [] }], name: 'pkgPolicy-1', - output_id: '2', package: { name: 'mock-package', title: 'Mock package', @@ -431,7 +426,6 @@ describe('Fleet - packageToPackagePolicy', () => { packageToPackagePolicy( AWS_PACKAGE as unknown as PackageInfo, 'some-agent-policy-id', - 'some-output-id', 'default', 'aws-1' ) diff --git a/x-pack/plugins/fleet/common/services/package_to_package_policy.ts b/x-pack/plugins/fleet/common/services/package_to_package_policy.ts index 3b8a384ede0b6..cea02893e849d 100644 --- a/x-pack/plugins/fleet/common/services/package_to_package_policy.ts +++ b/x-pack/plugins/fleet/common/services/package_to_package_policy.ts @@ -162,7 +162,6 @@ export const packageToPackagePolicyInputs = ( export const packageToPackagePolicy = ( packageInfo: PackageInfo, agentPolicyId: string, - outputId: string, namespace: string = '', packagePolicyName?: string, description?: string, @@ -179,7 +178,6 @@ export const packageToPackagePolicy = ( }, enabled: true, policy_id: agentPolicyId, - output_id: outputId, inputs: packageToPackagePolicyInputs(packageInfo, integrationToEnable), vars: undefined, }; diff --git a/x-pack/plugins/fleet/common/services/validate_package_policy.test.ts b/x-pack/plugins/fleet/common/services/validate_package_policy.test.ts index 7de52ac07bef1..c3844b8a06bf1 100644 --- a/x-pack/plugins/fleet/common/services/validate_package_policy.test.ts +++ b/x-pack/plugins/fleet/common/services/validate_package_policy.test.ts @@ -163,7 +163,6 @@ describe('Fleet - validatePackagePolicy()', () => { namespace: 'default', policy_id: 'test-policy', enabled: true, - output_id: 'test-output', inputs: [ { type: 'foo', @@ -651,7 +650,6 @@ describe('Fleet - validatePackagePolicy()', () => { ], name: 'linux-3d13ada6-a9ae-46df-8e57-ff5050f4b671', namespace: 'default', - output_id: '', package: { name: 'linux', title: 'Linux Metrics', 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 047bd9a403d9d..ec6b04ae64fc8 100644 --- a/x-pack/plugins/fleet/common/types/models/package_policy.ts +++ b/x-pack/plugins/fleet/common/types/models/package_policy.ts @@ -65,7 +65,6 @@ export interface NewPackagePolicy { enabled: boolean; is_managed?: boolean; policy_id: string; - output_id: string; package?: PackagePolicyPackage; inputs: NewPackagePolicyInput[]; vars?: PackagePolicyConfigRecord; diff --git a/x-pack/plugins/fleet/dev_docs/data_model.md b/x-pack/plugins/fleet/dev_docs/data_model.md index 1399cec4c3318..483eabb4ed569 100644 --- a/x-pack/plugins/fleet/dev_docs/data_model.md +++ b/x-pack/plugins/fleet/dev_docs/data_model.md @@ -1,6 +1,7 @@ # Fleet Data Model The Fleet plugin has 3 sources of data that it reads and writes to, these large categories are: + - **Package Registry**: read-only data source for retrieving packages published by Elastic - **`.fleet-*` Indices**: read & write data source for interacting with Elastic Agent policies, actions, and enrollment tokens - **Saved Objects**: read & write data source for storing installed packages, configured policies, outputs, and other settings @@ -65,6 +66,7 @@ This document is intended to outline what each type is for, the primary places i any caveats regarding the history of that saved object type. At this point in time, all types are currently: + - `hidden: false` - `namespaceType: agnostic` - `management.importableAndExportable: false` @@ -81,7 +83,6 @@ Tracks the Fleet server host addresses and whether or not the cluster has been s Can be accessed via the APIs exposed in the [server's settings service](../server/services/settings.ts). - ### `ingest-agent-policies` - Constant in code: `AGENT_POLICY_SAVED_OBJECT_TYPE` @@ -102,7 +103,6 @@ enrolled agents. - Migrations: 7.10.0, 7.11.0, 7.12.0, 7.13.0, 7.14.0, 7.15.0 - References to other objects: - `policy_id` - ID that points to an agent policy (`ingest-agent-policies`) - - `output_id` - ID that points to an output (`ingest-outputs`) Contains the configuration for a specific instance of a package integration as configured for an agent policy. @@ -134,7 +134,7 @@ used for other types of outputs like separate monitoring clusters, Logstash, etc - `package_assets` - array of original file contents of the package as it was installed - `package_assets.id` - Saved Object ID for a `epm-package-assets` type - `package_assets.type` - Saved Object type for the asset. As of now, only `epm-packages-assets` are supported. - + Contains metadata on an installed integration package including references to all assets installed in Kibana and Elasticsearch. This allows for easy cleanup when a package is removed or upgraded. diff --git a/x-pack/plugins/fleet/dev_docs/schema/saved_objects.mml b/x-pack/plugins/fleet/dev_docs/schema/saved_objects.mml index 9f73a15bed2eb..5755537191b10 100644 --- a/x-pack/plugins/fleet/dev_docs/schema/saved_objects.mml +++ b/x-pack/plugins/fleet/dev_docs/schema/saved_objects.mml @@ -50,7 +50,6 @@ classDiagram policy_id enabled package - output_id // Inputs inputs.type inputs.enabled diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/components/steps/step_configure_package.test.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/components/steps/step_configure_package.test.tsx index a7722524fc303..776ee1957eaf9 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/components/steps/step_configure_package.test.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/components/steps/step_configure_package.test.tsx @@ -105,7 +105,6 @@ describe('StepConfigurePackage', () => { namespace: 'default', policy_id: '', enabled: true, - output_id: '', inputs: [ { type: 'logfile', diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/components/steps/step_define_package_policy.test.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/components/steps/step_define_package_policy.test.tsx index 7dd7d23b38745..178d8c8c331df 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/components/steps/step_define_package_policy.test.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/components/steps/step_define_package_policy.test.tsx @@ -112,7 +112,6 @@ describe('StepDefinePackagePolicy', () => { namespace: 'default', policy_id: '', enabled: true, - output_id: '', inputs: [], }; testRenderer = createFleetTestRendererMock(); @@ -137,7 +136,6 @@ describe('StepDefinePackagePolicy', () => { name: 'apache-1', namespace: 'default', policy_id: 'agent-policy-1', - output_id: '', package: { name: 'apache', title: 'Apache', diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/components/steps/step_define_package_policy.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/components/steps/step_define_package_policy.tsx index 37e408e3cf275..09080789d62be 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/components/steps/step_define_package_policy.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/components/steps/step_define_package_policy.tsx @@ -112,7 +112,6 @@ export const StepDefinePackagePolicy: React.FunctionComponent<{ packageToPackagePolicy( packageInfo, agentPolicy?.id || '', - packagePolicy.output_id, packagePolicy.namespace, packagePolicy.name, packagePolicy.description, @@ -134,7 +133,6 @@ export const StepDefinePackagePolicy: React.FunctionComponent<{ packageToPackagePolicy( packageInfo, agentPolicy?.id || '', - packagePolicy.output_id, packagePolicy.namespace, packagePolicy.name || incrementedName, packagePolicy.description, diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/multi_page_layout/components/page_steps/add_integration.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/multi_page_layout/components/page_steps/add_integration.tsx index 3727dc38cf58a..bce4d71b04259 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/multi_page_layout/components/page_steps/add_integration.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/multi_page_layout/components/page_steps/add_integration.tsx @@ -94,7 +94,6 @@ export const AddIntegrationPageStep: React.FC = (props namespace: 'default', policy_id: '', enabled: true, - output_id: '', inputs: [], }); diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/multi_page_layout/hooks/send_generate_package_policy.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/multi_page_layout/hooks/send_generate_package_policy.tsx index 3b6e70ab9632d..f4cf4e3a59103 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/multi_page_layout/hooks/send_generate_package_policy.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/multi_page_layout/hooks/send_generate_package_policy.tsx @@ -32,14 +32,12 @@ export const sendGeneratePackagePolicy = async ( namespace: 'default', policy_id: agentPolicyId, enabled: true, - output_id: '', inputs: [], }; const packagePolicy = packageToPackagePolicy( packageInfo, agentPolicyId, - defaultPolicy.output_id, defaultPolicy.namespace, defaultPolicy.name, defaultPolicy.description, 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 427db14295a36..88061897abf76 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 @@ -253,7 +253,6 @@ describe('when on the package policy create page', () => { ], name: 'nginx-1', namespace: 'default', - output_id: '', package: { name: 'nginx', title: 'Nginx', 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 d57f246ecbb4d..51a8826456fc6 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 @@ -143,7 +143,6 @@ export const CreatePackagePolicySinglePage: CreatePackagePolicyParams = ({ namespace: 'default', policy_id: '', enabled: true, - output_id: '', inputs: [], }); diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/index.test.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/index.test.tsx index 7372bb0d7252b..df42a287ffa16 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/index.test.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/index.test.tsx @@ -152,7 +152,6 @@ const mockPackagePolicy = { package: { name: 'nginx', title: 'Nginx', version: '1.3.0' }, enabled: true, policy_id: 'agent-policy-1', - output_id: '', inputs: [ { type: 'logfile', diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/index.tsx index 9381dfcbe3bd6..c0f9c95e1e0e8 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/index.tsx @@ -110,7 +110,6 @@ export const EditPackagePolicyForm = memo<{ namespace: '', policy_id: '', enabled: true, - output_id: '', inputs: [], version: '', }); diff --git a/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/index.test.tsx b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/index.test.tsx index 693dee99ebf69..49a8cbeb37d21 100644 --- a/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/index.test.tsx +++ b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/index.test.tsx @@ -553,7 +553,6 @@ On Windows, the module was tested with Nginx installed from the Chocolatey repos namespace: 'default', policy_id: '521c1b70-3976-11eb-ad1c-3baa423084d9', enabled: true, - output_id: '', inputs: [ { type: 'logfile', @@ -632,7 +631,6 @@ On Windows, the module was tested with Nginx installed from the Chocolatey repos namespace: 'default', policy_id: '125c1b70-3976-11eb-ad1c-3baa423085y6', enabled: true, - output_id: '', inputs: [ { type: 'logfile', 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 b1eff0b4b3b3d..cb4f89be5d3cb 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 @@ -72,7 +72,6 @@ function createMockPackagePolicy( updated_by: '', policy_id: '', enabled: true, - output_id: '', namespace: 'default', inputs: [], revision: 1, diff --git a/x-pack/plugins/fleet/server/routes/package_policy/handlers.test.ts b/x-pack/plugins/fleet/server/routes/package_policy/handlers.test.ts index 5e67857540143..57879eeea058b 100644 --- a/x-pack/plugins/fleet/server/routes/package_policy/handlers.test.ts +++ b/x-pack/plugins/fleet/server/routes/package_policy/handlers.test.ts @@ -128,7 +128,6 @@ describe('When calling package policy', () => { description: '', policy_id: 'a5ca00c0-b30c-11ea-9732-1bb05811278c', enabled: true, - output_id: '', inputs: [], namespace: 'default', package: { name: 'endpoint', title: 'Elastic Endpoint', version: '0.5.0' }, @@ -222,7 +221,6 @@ describe('When calling package policy', () => { ], name: 'endpoint-1', namespace: 'default', - output_id: '', package: { name: 'endpoint', title: 'Elastic Endpoint', @@ -254,7 +252,6 @@ describe('When calling package policy', () => { ], name: 'endpoint-1', namespace: 'default', - output_id: '', package: { name: 'endpoint', title: 'Elastic Endpoint', @@ -322,7 +319,6 @@ describe('When calling package policy', () => { description: 'desc', policy_id: '2', enabled: true, - output_id: '3', inputs: [ { type: 'logfile', @@ -396,7 +392,6 @@ describe('When calling package policy', () => { description: '', policy_id: '3', enabled: false, - output_id: '', inputs: [ { type: 'metrics', diff --git a/x-pack/plugins/fleet/server/routes/package_policy/handlers.ts b/x-pack/plugins/fleet/server/routes/package_policy/handlers.ts index 0b5f71910cfa9..9d1cbac194bcb 100644 --- a/x-pack/plugins/fleet/server/routes/package_policy/handlers.ts +++ b/x-pack/plugins/fleet/server/routes/package_policy/handlers.ts @@ -174,6 +174,8 @@ export const createPackagePolicyHandler: FleetRequestHandler< const esClient = coreContext.elasticsearch.client.asInternalUser; const user = appContextService.getSecurity()?.authc.getCurrentUser(request) || undefined; const { force, ...newPolicy } = request.body; + // TODO Remove deprecated APIs https://github.com/elastic/kibana/issues/121485 + delete newPolicy.output_id; const spaceId = fleetContext.spaceId; try { const newPackagePolicy = await packagePolicyService.enrichPolicyWithDefaultsFromPackage( @@ -234,6 +236,8 @@ export const updatePackagePolicyHandler: RequestHandler< } const { force, ...body } = request.body; + // TODO Remove deprecated APIs https://github.com/elastic/kibana/issues/121485 + delete body.output_id; // removed fields not recognized by schema const packagePolicyInputs = packagePolicy.inputs.map((input) => { const newInput = { @@ -247,6 +251,7 @@ export const updatePackagePolicyHandler: RequestHandler< delete newInput.compiled_input; return newInput; }); + // listing down accepted properties, because loaded packagePolicy contains some that are not accepted in update let newData = { ...body, @@ -255,7 +260,6 @@ export const updatePackagePolicyHandler: RequestHandler< namespace: body.namespace ?? packagePolicy.namespace, policy_id: body.policy_id ?? packagePolicy.policy_id, enabled: body.enabled ?? packagePolicy.enabled, - output_id: body.output_id ?? packagePolicy.output_id, package: body.package ?? packagePolicy.package, inputs: body.inputs ?? packagePolicyInputs, vars: body.vars ?? packagePolicy.vars, diff --git a/x-pack/plugins/fleet/server/saved_objects/index.ts b/x-pack/plugins/fleet/server/saved_objects/index.ts index 71134a67ca6d1..bd031cf9b0274 100644 --- a/x-pack/plugins/fleet/server/saved_objects/index.ts +++ b/x-pack/plugins/fleet/server/saved_objects/index.ts @@ -45,7 +45,7 @@ import { migrateAgentPolicyToV840, migratePackagePolicyToV840, } from './migrations/to_v8_4_0'; -import { migrateAgentPolicyToV850 } from './migrations/to_v8_5_0'; +import { migratePackagePolicyToV850, migrateAgentPolicyToV850 } from './migrations/to_v8_5_0'; /* * Saved object types and mappings @@ -153,7 +153,6 @@ const getSavedObjectTypes = ( enabled: { type: 'boolean' }, is_managed: { type: 'boolean' }, policy_id: { type: 'keyword' }, - output_id: { type: 'keyword' }, package: { properties: { name: { type: 'keyword' }, @@ -223,6 +222,7 @@ const getSavedObjectTypes = ( '8.2.0': migratePackagePolicyToV820, '8.3.0': migratePackagePolicyToV830, '8.4.0': migratePackagePolicyToV840, + '8.5.0': migratePackagePolicyToV850, }, }, [PACKAGES_SAVED_OBJECT_TYPE]: { diff --git a/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v7_11_0.test.ts b/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v7_11_0.test.ts index 4461cf288dc9d..cd251e4dcdde3 100644 --- a/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v7_11_0.test.ts +++ b/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v7_11_0.test.ts @@ -27,7 +27,6 @@ describe('7.11.0 Endpoint Package Policy migration', () => { policy_id: '', enabled: true, namespace: '', - output_id: '', revision: 0, updated_at: '', updated_by: '', @@ -66,7 +65,6 @@ describe('7.11.0 Endpoint Package Policy migration', () => { policy_id: '', enabled: true, namespace: '', - output_id: '', revision: 0, updated_at: '', updated_by: '', @@ -122,7 +120,6 @@ describe('7.11.0 Endpoint Package Policy migration', () => { policy_id: '', enabled: true, namespace: '', - output_id: '', revision: 0, updated_at: '', updated_by: '', @@ -154,7 +151,6 @@ describe('7.11.0 Endpoint Package Policy migration', () => { policy_id: '', enabled: true, namespace: '', - output_id: '', revision: 0, updated_at: '', updated_by: '', diff --git a/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v7_12_0.test.ts b/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v7_12_0.test.ts index ef26ab759999e..7f7ed90a91672 100644 --- a/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v7_12_0.test.ts +++ b/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v7_12_0.test.ts @@ -27,7 +27,6 @@ describe('7.12.0 Endpoint Package Policy migration', () => { policy_id: '', enabled: true, namespace: '', - output_id: '', revision: 0, updated_at: '', updated_by: '', @@ -70,7 +69,6 @@ describe('7.12.0 Endpoint Package Policy migration', () => { policy_id: '', enabled: true, namespace: '', - output_id: '', revision: 0, updated_at: '', updated_by: '', @@ -124,7 +122,6 @@ describe('7.12.0 Endpoint Package Policy migration', () => { policy_id: '', enabled: true, namespace: '', - output_id: '', revision: 0, updated_at: '', updated_by: '', @@ -156,7 +153,6 @@ describe('7.12.0 Endpoint Package Policy migration', () => { policy_id: '', enabled: true, namespace: '', - output_id: '', revision: 0, updated_at: '', updated_by: '', diff --git a/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v7_13_0.test.ts b/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v7_13_0.test.ts index be6888f802400..f633974713b42 100644 --- a/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v7_13_0.test.ts +++ b/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v7_13_0.test.ts @@ -29,7 +29,6 @@ describe('7.13.0 Endpoint Package Policy migration', () => { policy_id: '', enabled: true, namespace: '', - output_id: '', revision: 0, updated_at: '', updated_by: '', diff --git a/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v7_14_0.test.ts b/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v7_14_0.test.ts index 3340d4af0085b..4ef4d79fe9a3f 100644 --- a/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v7_14_0.test.ts +++ b/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v7_14_0.test.ts @@ -33,7 +33,6 @@ describe('7.14.0 Endpoint Package Policy migration', () => { policy_id: '', enabled: true, namespace: '', - output_id: '', revision: 0, updated_at: '', updated_by: '', @@ -235,7 +234,6 @@ describe('7.14.0 Endpoint Package Policy migration', () => { policy_id: '', enabled: true, namespace: '', - output_id: '', revision: 0, updated_at: '', updated_by: '', @@ -267,7 +265,6 @@ describe('7.14.0 Endpoint Package Policy migration', () => { policy_id: '', enabled: true, namespace: '', - output_id: '', revision: 0, updated_at: '', updated_by: '', diff --git a/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v7_15_0.test.ts b/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v7_15_0.test.ts index 38866e7f971dd..25ec0c74f7cb2 100644 --- a/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v7_15_0.test.ts +++ b/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v7_15_0.test.ts @@ -38,7 +38,6 @@ describe('7.15.0 Endpoint Package Policy migration', () => { policy_id: '', enabled: true, namespace: '', - output_id: '', revision: 0, updated_at: '', updated_by: '', @@ -192,7 +191,6 @@ describe('7.15.0 Endpoint Package Policy migration', () => { policy_id: '', enabled: true, namespace: '', - output_id: '', revision: 0, updated_at: '', updated_by: '', @@ -224,7 +222,6 @@ describe('7.15.0 Endpoint Package Policy migration', () => { policy_id: '', enabled: true, namespace: '', - output_id: '', revision: 0, updated_at: '', updated_by: '', diff --git a/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v7_16_0.test.ts b/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v7_16_0.test.ts index a062f3f4097f6..4ca2f19682b23 100644 --- a/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v7_16_0.test.ts +++ b/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v7_16_0.test.ts @@ -40,7 +40,6 @@ describe('7.16.0 Endpoint Package Policy migration', () => { policy_id: '', enabled: true, namespace: '', - output_id: '', revision: 0, updated_at: '', updated_by: '', @@ -224,7 +223,6 @@ describe('7.16.0 Endpoint Package Policy migration', () => { policy_id: '', enabled: true, namespace: '', - output_id: '', revision: 0, updated_at: '', updated_by: '', @@ -256,7 +254,6 @@ describe('7.16.0 Endpoint Package Policy migration', () => { policy_id: '', enabled: true, namespace: '', - output_id: '', revision: 0, updated_at: '', updated_by: '', diff --git a/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v8_2_0.test.ts b/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v8_2_0.test.ts index c6e853569b594..e84d9de623c65 100644 --- a/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v8_2_0.test.ts +++ b/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v8_2_0.test.ts @@ -31,7 +31,6 @@ describe('8.2.0 Endpoint Package Policy migration', () => { policy_id: '', enabled: true, namespace: '', - output_id: '', revision: 0, updated_at: '', updated_by: '', @@ -133,7 +132,6 @@ describe('8.2.0 Endpoint Package Policy migration', () => { policy_id: '', enabled: true, namespace: '', - output_id: '', revision: 0, updated_at: '', updated_by: '', @@ -165,7 +163,6 @@ describe('8.2.0 Endpoint Package Policy migration', () => { policy_id: '', enabled: true, namespace: '', - output_id: '', revision: 0, updated_at: '', updated_by: '', diff --git a/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v8_3_0.test.ts b/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v8_3_0.test.ts index d5eb8c5a86547..13c66f565e14c 100644 --- a/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v8_3_0.test.ts +++ b/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v8_3_0.test.ts @@ -26,7 +26,6 @@ describe('8.3.0 Endpoint Package Policy migration', () => { policy_id: '', enabled: true, namespace: '', - output_id: '', revision: 0, updated_at: '', updated_by: '', @@ -101,7 +100,6 @@ describe('8.3.0 Endpoint Package Policy migration', () => { policy_id: '', enabled: true, namespace: '', - output_id: '', revision: 0, updated_at: '', updated_by: '', @@ -133,7 +131,6 @@ describe('8.3.0 Endpoint Package Policy migration', () => { policy_id: '', enabled: true, namespace: '', - output_id: '', revision: 0, updated_at: '', updated_by: '', diff --git a/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v8_4_0.test.ts b/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v8_4_0.test.ts index 5184498fc5290..d0555c5da6d94 100644 --- a/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v8_4_0.test.ts +++ b/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v8_4_0.test.ts @@ -26,7 +26,6 @@ describe('8.4.0 Endpoint Package Policy migration', () => { policy_id: '', enabled: true, namespace: '', - output_id: '', revision: 0, updated_at: '', updated_by: '', @@ -97,7 +96,6 @@ describe('8.4.0 Endpoint Package Policy migration', () => { policy_id: '', enabled: true, namespace: '', - output_id: '', revision: 0, updated_at: '', updated_by: '', @@ -129,7 +127,6 @@ describe('8.4.0 Endpoint Package Policy migration', () => { policy_id: '', enabled: true, namespace: '', - output_id: '', revision: 0, updated_at: '', updated_by: '', diff --git a/x-pack/plugins/fleet/server/saved_objects/migrations/to_v8_5_0.ts b/x-pack/plugins/fleet/server/saved_objects/migrations/to_v8_5_0.ts index 9cbcc85c46936..cf835ec87c949 100644 --- a/x-pack/plugins/fleet/server/saved_objects/migrations/to_v8_5_0.ts +++ b/x-pack/plugins/fleet/server/saved_objects/migrations/to_v8_5_0.ts @@ -7,8 +7,19 @@ import type { SavedObjectMigrationFn } from '@kbn/core/server'; +import type { PackagePolicy } from '../../../common'; import type { AgentPolicy } from '../../types'; +export const migratePackagePolicyToV850: SavedObjectMigrationFn = ( + packagePolicyDoc, + migrationContext +) => { + // @ts-expect-error output_id property does not exists anymore + delete packagePolicyDoc.attributes.output_id; + + return packagePolicyDoc; +}; + export const migrateAgentPolicyToV850: SavedObjectMigrationFn< Exclude & { package_policies: string[]; diff --git a/x-pack/plugins/fleet/server/services/agent_policies/package_policies_to_agent_inputs.test.ts b/x-pack/plugins/fleet/server/services/agent_policies/package_policies_to_agent_inputs.test.ts index 82a7612cc8195..5914da1716efc 100644 --- a/x-pack/plugins/fleet/server/services/agent_policies/package_policies_to_agent_inputs.test.ts +++ b/x-pack/plugins/fleet/server/services/agent_policies/package_policies_to_agent_inputs.test.ts @@ -51,7 +51,6 @@ describe('Fleet - storedPackagePoliciesToAgentInputs', () => { updated_by: '', policy_id: '', enabled: true, - output_id: '', namespace: 'default', inputs: [], revision: 1, diff --git a/x-pack/plugins/fleet/server/services/agent_policies/package_policies_to_agent_permissions.test.ts b/x-pack/plugins/fleet/server/services/agent_policies/package_policies_to_agent_permissions.test.ts index a60b5c68d05a9..3c490268af094 100644 --- a/x-pack/plugins/fleet/server/services/agent_policies/package_policies_to_agent_permissions.test.ts +++ b/x-pack/plugins/fleet/server/services/agent_policies/package_policies_to_agent_permissions.test.ts @@ -145,7 +145,6 @@ describe('storedPackagePoliciesToAgentPermissions()', () => { updated_by: '', revision: 1, policy_id: '', - output_id: '', }, ]; @@ -240,7 +239,6 @@ describe('storedPackagePoliciesToAgentPermissions()', () => { updated_by: '', revision: 1, policy_id: '', - output_id: '', }, ]; @@ -340,7 +338,6 @@ describe('storedPackagePoliciesToAgentPermissions()', () => { updated_by: '', revision: 1, policy_id: '', - output_id: '', }, ]; @@ -449,7 +446,6 @@ describe('storedPackagePoliciesToAgentPermissions()', () => { updated_by: '', revision: 1, policy_id: '', - output_id: '', }, ]; diff --git a/x-pack/plugins/fleet/server/services/agent_policy.ts b/x-pack/plugins/fleet/server/services/agent_policy.ts index 9c70e4a58c388..1e833377a3374 100644 --- a/x-pack/plugins/fleet/server/services/agent_policy.ts +++ b/x-pack/plugins/fleet/server/services/agent_policy.ts @@ -972,7 +972,6 @@ export async function addPackageToAgentPolicy( const basePackagePolicy = packageToPackagePolicy( packageInfo, agentPolicy.id, - defaultOutput.id, agentPolicy.namespace ?? 'default', packagePolicyName, packagePolicyDescription diff --git a/x-pack/plugins/fleet/server/services/agent_policy_create.test.ts b/x-pack/plugins/fleet/server/services/agent_policy_create.test.ts index c477d08395552..1231e99f2865f 100644 --- a/x-pack/plugins/fleet/server/services/agent_policy_create.test.ts +++ b/x-pack/plugins/fleet/server/services/agent_policy_create.test.ts @@ -44,7 +44,6 @@ function getPackagePolicy(name: string, policyId = '') { namespace: 'default', enabled: true, policy_id: policyId, - output_id: '', inputs: [], }; } diff --git a/x-pack/plugins/fleet/server/services/epm/packages/get.test.ts b/x-pack/plugins/fleet/server/services/epm/packages/get.test.ts index 41bbaeab494d3..af168a8cc1619 100644 --- a/x-pack/plugins/fleet/server/services/epm/packages/get.test.ts +++ b/x-pack/plugins/fleet/server/services/epm/packages/get.test.ts @@ -42,7 +42,6 @@ describe('When using EPM `get` services', () => { namespace: 'default', policy_id: '22222-22222-2222-2222', enabled: true, - output_id: '', inputs: [], package: { name: 'system', title: 'System', version: '0.10.4' }, revision: 1, @@ -66,7 +65,6 @@ describe('When using EPM `get` services', () => { package: { name: 'system', title: 'System', version: '0.10.4' }, enabled: true, policy_id: '11111-111111-11111-11111', // << duplicate id with plicy below - output_id: 'ca111b80-43c1-11eb-84bf-7177b74381c5', inputs: [], revision: 1, created_at: '2020-12-21T19:22:04.902Z', @@ -89,7 +87,6 @@ describe('When using EPM `get` services', () => { namespace: 'default', policy_id: '11111-111111-11111-11111', enabled: true, - output_id: '', inputs: [], package: { name: 'system', title: 'System', version: '0.10.4' }, revision: 1, @@ -113,7 +110,6 @@ describe('When using EPM `get` services', () => { namespace: 'default', policy_id: '33333-33333-333333-333333', enabled: true, - output_id: '', inputs: [], package: { name: 'system', title: 'System', version: '0.10.4' }, revision: 1, diff --git a/x-pack/plugins/fleet/server/services/package_policy.test.ts b/x-pack/plugins/fleet/server/services/package_policy.test.ts index b2caca6cae904..3f11900d87e75 100644 --- a/x-pack/plugins/fleet/server/services/package_policy.test.ts +++ b/x-pack/plugins/fleet/server/services/package_policy.test.ts @@ -1228,7 +1228,6 @@ describe('Package policy service', () => { inputs: [], name: 'endpoint-1', namespace: 'default', - output_id: '', package: { name: 'endpoint', title: 'Elastic Endpoint', @@ -1409,7 +1408,6 @@ describe('Package policy service', () => { }, enabled: true, policy_id: '1e6d0690-b995-11ec-a355-d35391e25881', - output_id: '', inputs: [ { type: 'cloudbeat', @@ -1497,7 +1495,6 @@ describe('Package policy service', () => { namespace: 'default', enabled: true, policy_id: 'xxxx', - output_id: 'xxxx', package: { name: 'test-package', title: 'Test Package', @@ -1585,7 +1582,6 @@ describe('Package policy service', () => { namespace: 'default', enabled: true, policy_id: 'xxxx', - output_id: 'xxxx', package: { name: 'test-package', title: 'Test Package', @@ -1683,7 +1679,6 @@ describe('Package policy service', () => { namespace: 'default', enabled: true, policy_id: 'xxxx', - output_id: 'xxxx', package: { name: 'test-package', title: 'Test Package', @@ -1781,7 +1776,6 @@ describe('Package policy service', () => { namespace: 'default', enabled: true, policy_id: 'xxxx', - output_id: 'xxxx', package: { name: 'test-package', title: 'Test Package', @@ -1951,7 +1945,6 @@ describe('Package policy service', () => { namespace: 'default', enabled: true, policy_id: 'xxxx', - output_id: 'xxxx', package: { name: 'test-package', title: 'Test Package', @@ -2171,7 +2164,6 @@ describe('Package policy service', () => { namespace: 'default', enabled: true, policy_id: 'xxxx', - output_id: 'xxxx', package: { name: 'test-package', title: 'Test Package', @@ -2266,7 +2258,6 @@ describe('Package policy service', () => { namespace: 'default', enabled: true, policy_id: 'xxxx', - output_id: 'xxxx', package: { name: 'test-package', title: 'Test Package', @@ -2368,7 +2359,6 @@ describe('Package policy service', () => { namespace: 'default', enabled: true, policy_id: 'xxxx', - output_id: 'xxxx', package: { name: 'test-package', title: 'Test Package', @@ -2467,7 +2457,6 @@ describe('Package policy service', () => { namespace: 'default', enabled: true, policy_id: 'xxxx', - output_id: 'xxxx', package: { name: 'test-package', title: 'Test Package', @@ -2566,7 +2555,6 @@ describe('Package policy service', () => { namespace: 'default', enabled: true, policy_id: 'xxxx', - output_id: 'xxxx', package: { name: 'test-package', title: 'Test Package', @@ -2737,7 +2725,6 @@ describe('Package policy service', () => { namespace: 'default', enabled: true, policy_id: 'xxxx', - output_id: 'xxxx', package: { name: 'test-package', title: 'Test Package', @@ -2958,7 +2945,6 @@ describe('Package policy service', () => { namespace: 'default', enabled: true, policy_id: 'xxxx', - output_id: 'xxxx', package: { name: 'test-package', title: 'Test Package', @@ -3052,7 +3038,6 @@ describe('Package policy service', () => { namespace: 'default', enabled: true, policy_id: 'xxxx', - output_id: 'xxxx', package: { name: 'test-package', title: 'Test Package', @@ -3193,7 +3178,6 @@ describe('Package policy service', () => { package: { name: 'apache', title: 'Apache', version: '1.0.0' }, enabled: true, policy_id: '1', - output_id: '', inputs: [ { enabled: false, @@ -3270,7 +3254,6 @@ describe('Package policy service', () => { package: { name: 'aws', title: 'AWS', version: '1.0.0' }, enabled: true, policy_id: '1', - output_id: '', inputs: [ { type: 'aws/metrics', @@ -3297,7 +3280,6 @@ describe('Package policy service', () => { description: 'desc', enabled: false, policy_id: '2', - output_id: '3', inputs: [ { type: 'logfile', @@ -3332,7 +3314,6 @@ describe('Package policy service', () => { package: { name: 'apache', title: 'Apache', version: '1.0.0' }, enabled: false, policy_id: '2', - output_id: '3', inputs: [ { enabled: true, diff --git a/x-pack/plugins/fleet/server/services/package_policy.ts b/x-pack/plugins/fleet/server/services/package_policy.ts index f7668f8fe19bf..0d471133186f1 100644 --- a/x-pack/plugins/fleet/server/services/package_policy.ts +++ b/x-pack/plugins/fleet/server/services/package_policy.ts @@ -72,7 +72,6 @@ import type { ExternalCallback } from '..'; import { storedPackagePolicyToAgentInputs } from './agent_policies'; import { agentPolicyService } from './agent_policy'; import { getDataOutputForAgentPolicy } from './agent_policies'; -import { outputService } from './output'; import { getPackageInfo, getInstallation, ensureInstalledPackage } from './epm/packages'; import { getAssetsData } from './epm/packages/assets'; import { compileTemplate } from './epm/agent/agent'; @@ -869,7 +868,6 @@ class PackagePolicyService implements PackagePolicyServiceInterface { description: newPolicy.description ?? '', enabled: newPolicy.enabled ?? true, policy_id: newPolicy.policy_id ?? agentPolicyId, - output_id: newPolicy.output_id ?? '', inputs: newPolicy.inputs[0]?.streams ? newPolicy.inputs : inputs, vars: newPolicy.vars || newPP.vars, }; @@ -890,7 +888,7 @@ class PackagePolicyService implements PackagePolicyServiceInterface { skipArchive: true, }); if (packageInfo) { - return packageToPackagePolicy(packageInfo, '', ''); + return packageToPackagePolicy(packageInfo, ''); } } @@ -901,19 +899,14 @@ class PackagePolicyService implements PackagePolicyServiceInterface { ): Promise { const pkgInstall = await getInstallation({ savedObjectsClient: soClient, pkgName, logger }); if (pkgInstall) { - const [packageInfo, defaultOutputId] = await Promise.all([ - getPackageInfo({ - savedObjectsClient: soClient, - pkgName: pkgInstall.name, - pkgVersion: pkgInstall.version, - }), - outputService.getDefaultDataOutputId(soClient), - ]); + const packageInfo = await getPackageInfo({ + savedObjectsClient: soClient, + pkgName: pkgInstall.name, + pkgVersion: pkgInstall.version, + }); + if (packageInfo) { - if (!defaultOutputId) { - throw new Error('Default output is not set'); - } - return packageToPackagePolicy(packageInfo, '', defaultOutputId); + return packageToPackagePolicy(packageInfo, ''); } } } diff --git a/x-pack/plugins/fleet/server/services/preconfiguration.test.ts b/x-pack/plugins/fleet/server/services/preconfiguration.test.ts index 245ab2316cb02..df02c6dd27e71 100644 --- a/x-pack/plugins/fleet/server/services/preconfiguration.test.ts +++ b/x-pack/plugins/fleet/server/services/preconfiguration.test.ts @@ -928,7 +928,6 @@ describe('comparePreconfiguredPolicyToCurrent', () => { created_by: 'system', inputs: [], policy_id: 'abc123', - output_id: 'default', }, ], }; 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 e0c8cf63ce623..afceb08b3e89e 100644 --- a/x-pack/plugins/fleet/server/types/models/package_policy.ts +++ b/x-pack/plugins/fleet/server/types/models/package_policy.ts @@ -89,7 +89,8 @@ const PackagePolicyBaseSchema = { version: schema.string(), }) ), - output_id: schema.string(), + // Deprecated TODO create remove issue + output_id: schema.maybe(schema.string()), inputs: schema.arrayOf(schema.object(PackagePolicyInputsSchema)), vars: schema.maybe(ConfigRecordSchema), }; @@ -112,6 +113,7 @@ const CreatePackagePolicyProps = { version: schema.string(), }) ), + // Deprecated TODO create remove issue output_id: schema.maybe(schema.string()), inputs: schema.arrayOf( schema.object({ diff --git a/x-pack/plugins/security_solution/common/endpoint/data_generators/fleet_package_policy_generator.ts b/x-pack/plugins/security_solution/common/endpoint/data_generators/fleet_package_policy_generator.ts index fef93fe1e674b..248d27236f494 100644 --- a/x-pack/plugins/security_solution/common/endpoint/data_generators/fleet_package_policy_generator.ts +++ b/x-pack/plugins/security_solution/common/endpoint/data_generators/fleet_package_policy_generator.ts @@ -30,7 +30,6 @@ export class FleetPackagePolicyGenerator extends BaseDataGenerator { updated_by: '', policy_id: '', enabled: true, - output_id: '', inputs: [ { type: 'endpoint', @@ -259,7 +258,6 @@ describe('policy details: ', () => { description: '', policy_id: '', enabled: true, - output_id: '', inputs: [ { type: 'endpoint', diff --git a/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/hooks/use_update_policy.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/hooks/use_update_policy.test.tsx index a5b4b7fab01ed..fb7687d28f6e2 100644 --- a/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/hooks/use_update_policy.test.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/hooks/use_update_policy.test.tsx @@ -30,7 +30,6 @@ describe('useBarChartsHooks', () => { namespace: 'default', policy_id: 'ae774160-8e49-11eb-aba5-99269d21ba6e', enabled: true, - output_id: '', inputs: [ { type: 'synthetics/http', diff --git a/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/synthetics_policy_create_extension_wrapper.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/synthetics_policy_create_extension_wrapper.test.tsx index 977f2a94660ce..1749a29ffa4fd 100644 --- a/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/synthetics_policy_create_extension_wrapper.test.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/synthetics_policy_create_extension_wrapper.test.tsx @@ -50,7 +50,6 @@ const defaultNewPolicy: NewPackagePolicy = { namespace: 'default', policy_id: 'ae774160-8e49-11eb-aba5-99269d21ba6e', enabled: true, - output_id: '', inputs: [ { type: 'synthetics/http', diff --git a/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/synthetics_policy_edit_extension_wrapper.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/synthetics_policy_edit_extension_wrapper.test.tsx index ed7f02a159822..28eeafc00adcc 100644 --- a/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/synthetics_policy_edit_extension_wrapper.test.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/synthetics_policy_edit_extension_wrapper.test.tsx @@ -50,7 +50,6 @@ const defaultNewPolicy: NewPackagePolicy = { namespace: 'default', policy_id: 'ae774160-8e49-11eb-aba5-99269d21ba6e', enabled: true, - output_id: '', inputs: [ { type: 'synthetics/http', diff --git a/x-pack/plugins/synthetics/server/synthetics_service/private_location/synthetics_private_location.ts b/x-pack/plugins/synthetics/server/synthetics_service/private_location/synthetics_private_location.ts index 78c8193f8f582..c3c54c5aab81e 100644 --- a/x-pack/plugins/synthetics/server/synthetics_service/private_location/synthetics_private_location.ts +++ b/x-pack/plugins/synthetics/server/synthetics_service/private_location/synthetics_private_location.ts @@ -69,7 +69,6 @@ export class SyntheticsPrivateLocation { newPolicy.name = `${config[ConfigKey.NAME]}-${locName}-${spaceId}`; } - newPolicy.output_id = ''; newPolicy.namespace = 'default'; const { formattedPolicy } = formatSyntheticsPolicy(newPolicy, config.type, { diff --git a/x-pack/plugins/synthetics/server/synthetics_service/private_location/test_policy.ts b/x-pack/plugins/synthetics/server/synthetics_service/private_location/test_policy.ts index 2082faa6ed9de..597045ea45973 100644 --- a/x-pack/plugins/synthetics/server/synthetics_service/private_location/test_policy.ts +++ b/x-pack/plugins/synthetics/server/synthetics_service/private_location/test_policy.ts @@ -11,7 +11,6 @@ export const testMonitorPolicy = { package: { name: 'synthetics', title: 'Elastic Synthetics', version: '0.9.10' }, enabled: true, policy_id: '', - output_id: 'fleet-default-output', inputs: [ { type: 'synthetics/http', diff --git a/x-pack/test/api_integration/apis/cloud_security_posture/update_rules_config.ts b/x-pack/test/api_integration/apis/cloud_security_posture/update_rules_config.ts index 0a645f7c4d4cb..b5d92e2daec3c 100644 --- a/x-pack/test/api_integration/apis/cloud_security_posture/update_rules_config.ts +++ b/x-pack/test/api_integration/apis/cloud_security_posture/update_rules_config.ts @@ -60,7 +60,6 @@ export default function ({ getService }: FtrProviderContext) { namespace: 'default', policy_id: agentPolicyId, enabled: true, - output_id: '', inputs: [], package: { name: 'cloud_security_posture', diff --git a/x-pack/test/api_integration/apis/osquery/packs.ts b/x-pack/test/api_integration/apis/osquery/packs.ts index dc019bffeec6f..9d00249a4e1b0 100644 --- a/x-pack/test/api_integration/apis/osquery/packs.ts +++ b/x-pack/test/api_integration/apis/osquery/packs.ts @@ -93,7 +93,6 @@ export default function ({ getService }: FtrProviderContext) { }, inputs: [], namespace: 'default', - output_id: '', policy_id: hostedPolicy.id, name: 'TEST', description: '123', diff --git a/x-pack/test/api_integration/apis/uptime/rest/sample_data/test_policy.ts b/x-pack/test/api_integration/apis/uptime/rest/sample_data/test_policy.ts index f31704302caf1..5e6795ba86ef0 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/sample_data/test_policy.ts +++ b/x-pack/test/api_integration/apis/uptime/rest/sample_data/test_policy.ts @@ -20,8 +20,7 @@ export const getTestSyntheticsPolicy = ( namespace: 'default', package: { name: 'synthetics', title: 'Elastic Synthetics', version: '0.10.2' }, enabled: true, - policy_id: '27337270-22ed-11ed-8c6b-09a2d21dfbc3', - output_id: '', + policy_id: '5347cd10-0368-11ed-8df7-a7424c6f5167', inputs: [ { type: 'synthetics/http', @@ -308,8 +307,7 @@ export const getTestProjectSyntheticsPolicy = ( namespace: 'default', package: { name: 'synthetics', title: 'Elastic Synthetics', version: '0.10.2' }, enabled: true, - policy_id: 'd70a46e0-22ea-11ed-8c6b-09a2d21dfbc3', - output_id: '', + policy_id: '46034710-0ba6-11ed-ba04-5f123b9faa8b', inputs: [ { type: 'synthetics/http', diff --git a/x-pack/test/fleet_api_integration/apis/agents/upgrade.ts b/x-pack/test/fleet_api_integration/apis/agents/upgrade.ts index 03ef3c533dbab..9b0a6586e1c25 100644 --- a/x-pack/test/fleet_api_integration/apis/agents/upgrade.ts +++ b/x-pack/test/fleet_api_integration/apis/agents/upgrade.ts @@ -324,7 +324,6 @@ export default function (providerContext: FtrProviderContext) { attributes: { policy_id: 'fleet-server-policy', name: 'Fleet Server', - output_id: 'default', package: { name: 'fleet_server', }, diff --git a/x-pack/test/fleet_api_integration/apis/package_policy/create.ts b/x-pack/test/fleet_api_integration/apis/package_policy/create.ts index 4a4ac33623b8d..3bdbd06cf7f0d 100644 --- a/x-pack/test/fleet_api_integration/apis/package_policy/create.ts +++ b/x-pack/test/fleet_api_integration/apis/package_policy/create.ts @@ -82,7 +82,6 @@ export default function (providerContext: FtrProviderContext) { namespace: 'default', policy_id: hostedPolicy.id, enabled: true, - output_id: '', inputs: [], package: { name: 'filetest', @@ -108,7 +107,6 @@ export default function (providerContext: FtrProviderContext) { namespace: 'default', policy_id: hostedPolicy.id, enabled: true, - output_id: '', inputs: [], package: { name: 'filetest', @@ -136,7 +134,6 @@ export default function (providerContext: FtrProviderContext) { namespace: 'default', policy_id: agentPolicyId, enabled: true, - output_id: '', inputs: [], package: { name: 'filetest', @@ -162,7 +159,6 @@ export default function (providerContext: FtrProviderContext) { namespace: '', policy_id: agentPolicyId, enabled: true, - output_id: '', inputs: [], package: { name: 'filetest', @@ -183,7 +179,6 @@ export default function (providerContext: FtrProviderContext) { namespace: 'InvalidNamespace', policy_id: agentPolicyId, enabled: true, - output_id: '', inputs: [], package: { name: 'filetest', @@ -202,7 +197,6 @@ export default function (providerContext: FtrProviderContext) { 'testlength😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀', policy_id: agentPolicyId, enabled: true, - output_id: '', inputs: [], package: { name: 'filetest', @@ -223,7 +217,6 @@ export default function (providerContext: FtrProviderContext) { namespace: 'default', policy_id: agentPolicyId, enabled: true, - output_id: '', inputs: [], package: { name: 'endpoint', @@ -242,7 +235,6 @@ export default function (providerContext: FtrProviderContext) { namespace: 'default', policy_id: agentPolicyId, enabled: true, - output_id: '', inputs: [], package: { name: 'endpoint', @@ -263,7 +255,6 @@ export default function (providerContext: FtrProviderContext) { namespace: 'default', policy_id: agentPolicyId, enabled: true, - output_id: '', inputs: [], package: { name: 'filetest', @@ -281,7 +272,6 @@ export default function (providerContext: FtrProviderContext) { namespace: 'default', policy_id: agentPolicyId, enabled: true, - output_id: '', inputs: [], package: { name: 'filetest', @@ -311,7 +301,6 @@ export default function (providerContext: FtrProviderContext) { namespace: 'default', policy_id: otherAgentPolicyId, enabled: true, - output_id: '', inputs: [], package: { name: 'filetest', @@ -329,7 +318,6 @@ export default function (providerContext: FtrProviderContext) { namespace: 'default', policy_id: agentPolicyId, enabled: true, - output_id: '', inputs: [], package: { name: 'filetest', @@ -350,7 +338,6 @@ export default function (providerContext: FtrProviderContext) { namespace: 'default', policy_id: agentPolicyId, enabled: true, - output_id: '', inputs: [ { enabled: true, @@ -386,7 +373,6 @@ export default function (providerContext: FtrProviderContext) { namespace: 'default', policy_id: agentPolicyId, enabled: true, - output_id: '', inputs: [ { enabled: true, @@ -426,7 +412,6 @@ export default function (providerContext: FtrProviderContext) { namespace: 'default', policy_id: agentPolicyId, enabled: true, - output_id: '', inputs: [ { enabled: true, @@ -490,7 +475,6 @@ export default function (providerContext: FtrProviderContext) { namespace: 'default', policy_id: agentPolicyId, enabled: true, - output_id: '', inputs: [ { type: 'logfile', @@ -527,7 +511,6 @@ export default function (providerContext: FtrProviderContext) { namespace: 'default', policy_id: agentPolicyId, enabled: true, - output_id: '', inputs: [ { type: 'logfile', @@ -564,7 +547,6 @@ export default function (providerContext: FtrProviderContext) { namespace: 'default', policy_id: agentPolicyId, enabled: true, - output_id: '', inputs: [ { type: 'logfile', diff --git a/x-pack/test/fleet_api_integration/apis/package_policy/delete.ts b/x-pack/test/fleet_api_integration/apis/package_policy/delete.ts index e95fbc9ad3dfd..89328d4b61400 100644 --- a/x-pack/test/fleet_api_integration/apis/package_policy/delete.ts +++ b/x-pack/test/fleet_api_integration/apis/package_policy/delete.ts @@ -61,7 +61,6 @@ export default function (providerContext: FtrProviderContext) { namespace: 'default', policy_id: agentPolicy.id, enabled: true, - output_id: '', inputs: [], package: { name: 'filetest', @@ -194,7 +193,6 @@ export default function (providerContext: FtrProviderContext) { namespace: 'default', policy_id: agentPolicy.id, enabled: true, - output_id: '', inputs: [], package: { name: 'filetest', diff --git a/x-pack/test/fleet_api_integration/apis/package_policy/get.ts b/x-pack/test/fleet_api_integration/apis/package_policy/get.ts index dbfb8109a2c19..d46aea0dbbd1b 100644 --- a/x-pack/test/fleet_api_integration/apis/package_policy/get.ts +++ b/x-pack/test/fleet_api_integration/apis/package_policy/get.ts @@ -64,7 +64,6 @@ export default function (providerContext: FtrProviderContext) { namespace: 'default', policy_id: agentPolicyId, enabled: true, - output_id: '', inputs: [], package: { name: 'filetest', @@ -129,7 +128,6 @@ export default function (providerContext: FtrProviderContext) { namespace: 'default', policy_id: agentPolicyId, enabled: true, - output_id: '', inputs: [], package: { name: 'filetest', @@ -219,7 +217,6 @@ export default function (providerContext: FtrProviderContext) { namespace: 'default', policy_id: agentPolicyId, enabled: true, - output_id: '', inputs: [], package: { name: 'filetest', diff --git a/x-pack/test/fleet_api_integration/apis/package_policy/update.ts b/x-pack/test/fleet_api_integration/apis/package_policy/update.ts index d1fa97b715b76..2f82e4ca7265a 100644 --- a/x-pack/test/fleet_api_integration/apis/package_policy/update.ts +++ b/x-pack/test/fleet_api_integration/apis/package_policy/update.ts @@ -80,7 +80,6 @@ export default function (providerContext: FtrProviderContext) { namespace: 'default', policy_id: agentPolicyId, enabled: true, - output_id: '', inputs: [], package: { name: 'filetest', @@ -99,7 +98,6 @@ export default function (providerContext: FtrProviderContext) { namespace: 'default', policy_id: agentPolicyId, enabled: true, - output_id: '', inputs: [], package: { name: 'filetest', @@ -134,7 +132,6 @@ export default function (providerContext: FtrProviderContext) { namespace: 'updated_namespace', policy_id: agentPolicyId, enabled: true, - output_id: '', inputs: [], package: { name: 'filetest', @@ -154,7 +151,6 @@ export default function (providerContext: FtrProviderContext) { namespace: 'updated_namespace', policy_id: agentPolicyId, enabled: true, - output_id: '', inputs: [], package: { name: 'filetest', @@ -178,7 +174,6 @@ export default function (providerContext: FtrProviderContext) { namespace: 'updated_namespace', policy_id: managedAgentPolicyId, enabled: true, - output_id: '', inputs: [], package: { name: 'filetest', @@ -198,7 +193,6 @@ export default function (providerContext: FtrProviderContext) { namespace: 'updated_namespace', policy_id: agentPolicyId, enabled: true, - output_id: '', inputs: [], package: { name: 'filetest', @@ -228,7 +222,6 @@ export default function (providerContext: FtrProviderContext) { namespace: 'updated_namespace', policy_id: otherAgentPolicyId, enabled: true, - output_id: '', inputs: [], package: { name: 'filetest', @@ -249,7 +242,6 @@ export default function (providerContext: FtrProviderContext) { namespace: 'updated_namespace', policy_id: agentPolicyId, enabled: true, - output_id: '', inputs: [ { enabled: true, diff --git a/x-pack/test/fleet_api_integration/apis/package_policy/upgrade.ts b/x-pack/test/fleet_api_integration/apis/package_policy/upgrade.ts index 4a113714dc324..7e280357ff5c3 100644 --- a/x-pack/test/fleet_api_integration/apis/package_policy/upgrade.ts +++ b/x-pack/test/fleet_api_integration/apis/package_policy/upgrade.ts @@ -78,7 +78,6 @@ export default function (providerContext: FtrProviderContext) { namespace: 'default', policy_id: agentPolicyId, enabled: true, - output_id: '', inputs: [ { policy_template: 'package_policy_upgrade', @@ -200,7 +199,6 @@ export default function (providerContext: FtrProviderContext) { namespace: 'default', policy_id: agentPolicyId, enabled: true, - output_id: '', inputs: [ { policy_template: 'package_policy_upgrade', @@ -315,7 +313,6 @@ export default function (providerContext: FtrProviderContext) { namespace: 'default', policy_id: agentPolicyId, enabled: true, - output_id: '', inputs: [ { policy_template: 'package_policy_upgrade', @@ -420,7 +417,6 @@ export default function (providerContext: FtrProviderContext) { namespace: 'default', policy_id: agentPolicyId, enabled: true, - output_id: '', inputs: [ { policy_template: 'package_policy_upgrade', @@ -524,7 +520,6 @@ export default function (providerContext: FtrProviderContext) { namespace: 'default', policy_id: agentPolicyId, enabled: true, - output_id: '', inputs: [ { policy_template: 'package_policy_upgrade', @@ -618,7 +613,6 @@ export default function (providerContext: FtrProviderContext) { namespace: 'default', policy_id: agentPolicyId, enabled: true, - output_id: '', inputs: [ { policy_template: 'package_policy_upgrade', @@ -716,7 +710,6 @@ export default function (providerContext: FtrProviderContext) { namespace: 'default', policy_id: agentPolicyId, enabled: true, - output_id: '', inputs: [ { policy_template: 'package_policy_upgrade', @@ -816,7 +809,6 @@ export default function (providerContext: FtrProviderContext) { namespace: 'default', policy_id: agentPolicyId, enabled: true, - output_id: '', inputs: [ { policy_template: 'package_policy_upgrade', @@ -948,7 +940,6 @@ export default function (providerContext: FtrProviderContext) { namespace: 'default', policy_id: agentPolicyId, enabled: true, - output_id: '', inputs: [ { policy_template: 'package_policy_upgrade', @@ -1088,7 +1079,6 @@ export default function (providerContext: FtrProviderContext) { namespace: 'default', policy_id: agentPolicyId, enabled: true, - output_id: '', inputs: [ { policy_template: 'package_policy_upgrade', diff --git a/x-pack/test/security_solution_endpoint/services/endpoint_policy.ts b/x-pack/test/security_solution_endpoint/services/endpoint_policy.ts index f9ba6a123ac6b..9d90e2530c18c 100644 --- a/x-pack/test/security_solution_endpoint/services/endpoint_policy.ts +++ b/x-pack/test/security_solution_endpoint/services/endpoint_policy.ts @@ -190,7 +190,6 @@ export function EndpointPolicyTestResourcesProvider({ getService }: FtrProviderC description: 'Protect the worlds data - but in the East Coast', policy_id: agentPolicy!.id, enabled: true, - output_id: '', inputs: [ { type: 'endpoint', From dbcee0cc734ae3729118d7223d65df47b2554b49 Mon Sep 17 00:00:00 2001 From: Kyle Pollich Date: Thu, 25 Aug 2022 13:23:59 -0400 Subject: [PATCH 06/28] Overwrite default download source to prevent collisions (#139494) --- x-pack/plugins/fleet/server/services/download_source.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/fleet/server/services/download_source.ts b/x-pack/plugins/fleet/server/services/download_source.ts index b4261008e5c37..e95e7eee014f9 100644 --- a/x-pack/plugins/fleet/server/services/download_source.ts +++ b/x-pack/plugins/fleet/server/services/download_source.ts @@ -63,7 +63,7 @@ class DownloadSourceService { public async create( soClient: SavedObjectsClientContract, downloadSource: DownloadSourceBase, - options?: { id?: string } + options?: { id?: string; overwrite?: boolean } ): Promise { const data: DownloadSourceAttributes = downloadSource; @@ -89,6 +89,7 @@ class DownloadSourceService { data, { id: options?.id, + overwrite: options?.overwrite ?? false, } ); return savedObjectToDownloadSource(newSo); @@ -171,6 +172,7 @@ class DownloadSourceService { return await this.create(soClient, newDefaultDS, { id: DEFAULT_DOWNLOAD_SOURCE_ID, + overwrite: true, }); } From 2187087c44bd45c952585442836165109759a35d Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 25 Aug 2022 15:51:40 -0500 Subject: [PATCH 07/28] Update dependency core-js to ^3.25.0 (main) (#138214) * Update dependency core-js to ^3.25.0 * dedupe * update corejs version Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Jonathan Budzenski --- package.json | 2 +- packages/kbn-babel-preset/node_preset.js | 2 +- packages/kbn-babel-preset/webpack_preset.js | 2 +- yarn.lock | 8 ++++---- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 32dadf55d2d09..643aa57db3472 100644 --- a/package.json +++ b/package.json @@ -398,7 +398,7 @@ "constate": "^3.3.2", "content-disposition": "^0.5.4", "copy-to-clipboard": "^3.0.8", - "core-js": "^3.23.5", + "core-js": "^3.25.0", "cronstrue": "^1.51.0", "cuid": "^2.1.8", "cytoscape": "^3.10.0", diff --git a/packages/kbn-babel-preset/node_preset.js b/packages/kbn-babel-preset/node_preset.js index 8fb06d0c293ba..5b50e91354988 100644 --- a/packages/kbn-babel-preset/node_preset.js +++ b/packages/kbn-babel-preset/node_preset.js @@ -31,7 +31,7 @@ module.exports = (_, options = {}) => { // Because of that we should use for that value the same version we install // in the package.json in order to have the same polyfills between the environment // and the tests - corejs: '3.23.5', + corejs: '3.25.0', bugfixes: true, ...(options['@babel/preset-env'] || {}), diff --git a/packages/kbn-babel-preset/webpack_preset.js b/packages/kbn-babel-preset/webpack_preset.js index 02bc6270a8b00..e3b52cc1e5e11 100644 --- a/packages/kbn-babel-preset/webpack_preset.js +++ b/packages/kbn-babel-preset/webpack_preset.js @@ -18,7 +18,7 @@ module.exports = (_, options = {}) => { modules: false, // Please read the explanation for this // in node_preset.js - corejs: '3.23.5', + corejs: '3.25.0', bugfixes: true, }, ], diff --git a/yarn.lock b/yarn.lock index c5e1ab95e5b7c..a65095864346e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11834,10 +11834,10 @@ core-js@^2.4.0, core-js@^2.5.0, core-js@^2.6.9: resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.9.tgz#6b4b214620c834152e179323727fc19741b084f2" integrity sha512-HOpZf6eXmnl7la+cUdMnLvUxKNqLUzJvgIziQ0DiF3JwSImNphIqdGqzj6hIKyX04MmV0poclQ7+wjWvxQyR2A== -core-js@^3.0.4, core-js@^3.23.5, core-js@^3.6.5, core-js@^3.8.2, core-js@^3.8.3: - version "3.23.5" - resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.23.5.tgz#1f82b0de5eece800827a2f59d597509c67650475" - integrity sha512-7Vh11tujtAZy82da4duVreQysIoO2EvVrur7y6IzZkH1IHPSekuDi8Vuw1+YKjkbfWLRD7Nc9ICQ/sIUDutcyg== +core-js@^3.0.4, core-js@^3.6.5, core-js@^3.8.2, core-js@^3.8.3, core-js@^3.25.0: + version "3.25.0" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.25.0.tgz#be71d9e0dd648ffd70c44a7ec2319d039357eceb" + integrity sha512-CVU1xvJEfJGhyCpBrzzzU1kjCfgsGUxhEvwUV2e/cOedYWHdmluamx+knDnmhqALddMG16fZvIqvs9aijsHHaA== core-util-is@1.0.2, core-util-is@^1.0.2, core-util-is@~1.0.0: version "1.0.2" From 568c2603694ba45e57303829afe4df85688f4b12 Mon Sep 17 00:00:00 2001 From: Jiawei Wu <74562234+JiaweiWu@users.noreply.github.com> Date: Thu, 25 Aug 2022 15:36:23 -0600 Subject: [PATCH 08/28] [RAM] Fix blank rule details page when displaying SIEM rules and small alignment issue (#138659) * Fix rule details page erroring while displaying SIEM rules * Add unit test to verify fix * Address comment and add generic SIEM rule description for now Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Faisal Kanout --- .../rule_details/components/rule_actions.tsx | 6 +-- .../components/rule_definition.test.tsx | 44 ++++++++++++++++--- .../components/rule_definition.tsx | 39 ++++++++++++---- 3 files changed, 70 insertions(+), 19 deletions(-) diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule_actions.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule_actions.tsx index ddae5bf09317b..bff95fe1ce93c 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule_actions.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule_actions.tsx @@ -46,9 +46,9 @@ export function RuleActions({ ruleActions, actionTypeRegistry }: RuleActionsProp } if (isLoadingActionConnectors) return ; return ( - + {actionConnectors.map(({ actionTypeId, name }) => ( - + @@ -60,7 +60,7 @@ export function RuleActions({ ruleActions, actionTypeRegistry }: RuleActionsProp - + ))} ); diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule_definition.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule_definition.test.tsx index 4b065bcd63aa9..5166642eaabba 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule_definition.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule_definition.test.tsx @@ -69,19 +69,28 @@ const mockedRuleTypeIndex = new Map( }) ); +interface SetupProps { + ruleOverwrite?: any; +} + describe('Rule Definition', () => { let wrapper: ReactWrapper; - async function setup() { + async function setup({ ruleOverwrite }: SetupProps = {}) { const actionTypeRegistry = actionTypeRegistryMock.create(); const ruleTypeRegistry = ruleTypeRegistryMock.create(); - const mockedRule = mockRule(); + const mockedRule = mockRule(ruleOverwrite); jest.mock('../../../lib/capabilities', () => ({ hasAllPrivilege: jest.fn(() => true), hasSaveRulesCapability: jest.fn(() => true), hasExecuteActionsCapability: jest.fn(() => true), hasManageApiKeysCapability: jest.fn(() => true), })); - ruleTypeRegistry.has.mockReturnValue(true); + ruleTypeRegistry.has.mockImplementation((id) => { + if (id === 'siem_rule') { + return false; + } + return true; + }); const ruleTypeR: RuleTypeModel = { id: 'my-rule-type', iconClass: 'test', @@ -93,7 +102,12 @@ describe('Rule Definition', () => { ruleParamsExpression: jest.fn(), requiresAppContext: false, }; - ruleTypeRegistry.get.mockReturnValue(ruleTypeR); + ruleTypeRegistry.get.mockImplementation((id) => { + if (id === 'siem_rule') { + throw new Error('error'); + } + return ruleTypeR; + }); actionTypeRegistry.list.mockReturnValue([ { id: '.server-log', iconClass: 'logsApp' }, { id: '.slack', iconClass: 'logoSlack' }, @@ -117,7 +131,10 @@ describe('Rule Definition', () => { }); } - beforeAll(async () => await setup()); + beforeEach(async () => await setup()); + afterEach(() => { + jest.clearAllMocks(); + }); it('renders rule definition ', async () => { expect(wrapper.find('[data-test-subj="ruleSummaryRuleDefinition"]')).toBeTruthy(); @@ -138,6 +155,18 @@ describe('Rule Definition', () => { expect(ruleDescription.find('div.euiText').text()).toEqual('Rule when testing'); }); + it('show SIEM rule type description "', async () => { + await setup({ + ruleOverwrite: { + consumer: 'siem', + ruleTypeId: 'siem_rule', + }, + }); + const ruleDescription = wrapper.find('[data-test-subj="ruleSummaryRuleDescription"]'); + expect(ruleDescription).toBeTruthy(); + expect(ruleDescription.find('div.euiText').text()).toEqual('Security detection rule'); + }); + it('show rule conditions "', async () => { const ruleConditions = wrapper.find('[data-test-subj="ruleSummaryRuleConditions"]'); expect(ruleConditions).toBeTruthy(); @@ -166,7 +195,7 @@ describe('Rule Definition', () => { expect(editButton).toMatchObject({}); }); }); -function mockRule(): Rule { +function mockRule(overwrite = {}): Rule { return { id: '1', name: 'test rule', @@ -175,7 +204,7 @@ function mockRule(): Rule { ruleTypeId: 'test_rule_type', schedule: { interval: '1s' }, actions: [], - params: { name: 'test rule type name' }, + params: { name: 'test rule type name', description: 'siem description' }, createdBy: null, updatedBy: null, apiKeyOwner: null, @@ -218,5 +247,6 @@ function mockRule(): Rule { }, }, }, + ...overwrite, }; } diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule_definition.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule_definition.tsx index 1823e12090379..c2aa170455ea2 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule_definition.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule_definition.tsx @@ -15,6 +15,7 @@ import { EuiTitle, EuiLoadingSpinner, } from '@elastic/eui'; +import { AlertConsumers } from '@kbn/rule-data-utils'; import { i18n } from '@kbn/i18n'; import { formatDuration } from '@kbn/alerting-plugin/common'; import { RuleDefinitionProps } from '../../../../types'; @@ -83,6 +84,20 @@ export const RuleDefinition: React.FunctionComponent = ({ : false) ); }, [hideEditButton, canSaveRule, ruleTypeRegistry, rule]); + + const ruleDescription = useMemo(() => { + if (ruleTypeRegistry.has(rule.ruleTypeId)) { + return ruleTypeRegistry.get(rule.ruleTypeId).description; + } + // TODO: Replace this generic description with proper SIEM rule descriptions + if (rule.consumer === AlertConsumers.SIEM) { + return i18n.translate('xpack.triggersActionsUI.ruleDetails.securityDetectionRule', { + defaultMessage: 'Security detection rule', + }); + } + return ''; + }, [rule, ruleTypeRegistry]); + return ( @@ -143,27 +158,33 @@ export const RuleDefinition: React.FunctionComponent = ({ - + {i18n.translate('xpack.triggersActionsUI.ruleDetails.conditionsTitle', { defaultMessage: 'Conditions', })} - - {hasEditButton ? ( - setEditFlyoutVisible(true)}> + + + {hasEditButton ? ( + setEditFlyoutVisible(true)} flush="left"> + {getRuleConditionsWording()} + + ) : ( {getRuleConditionsWording()} - - ) : ( - {getRuleConditionsWording()} - )} + )} + From e7870e30034f0b62859745a2abc2b02da1a11c79 Mon Sep 17 00:00:00 2001 From: Justin Kambic Date: Thu, 25 Aug 2022 18:11:03 -0400 Subject: [PATCH 09/28] Add synthetics e2e test README file. (#139522) --- x-pack/plugins/synthetics/e2e/README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 x-pack/plugins/synthetics/e2e/README.md diff --git a/x-pack/plugins/synthetics/e2e/README.md b/x-pack/plugins/synthetics/e2e/README.md new file mode 100644 index 0000000000000..fa20275af977f --- /dev/null +++ b/x-pack/plugins/synthetics/e2e/README.md @@ -0,0 +1,15 @@ +## How to run these tests + +These tests rely on the Kibana functional test runner. There is a Kibana config in this directory, and a dedicated +script for standing up the test server. + +### Start the server + +From `~/x-pack/plugins/synthetics/scripts`, run `node e2e.js --server`. Wait for the server to startup. It will provide you +with an example run command when it finishes. + +### Run the tests + +From this directory, `~/x-pack/plugins/synthetics/e2e`, you can now run `node ../../../../scripts/functional_test_runner --config synthetics_run.ts`. + +In addition to the usual flags like `--grep`, you can also specify `--no-headless` in order to view your tests as you debug/develop. From 7e27b2321e1efee93487a63ec7810e3751ddab13 Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Fri, 26 Aug 2022 00:45:39 -0400 Subject: [PATCH 10/28] [api-docs] Daily api_docs build (#139526) --- api_docs/actions.mdx | 2 +- api_docs/advanced_settings.mdx | 2 +- api_docs/aiops.mdx | 2 +- api_docs/alerting.mdx | 2 +- api_docs/apm.mdx | 2 +- api_docs/banners.mdx | 2 +- api_docs/bfetch.mdx | 2 +- api_docs/canvas.mdx | 2 +- api_docs/cases.devdocs.json | 49 ++++++++++++++- api_docs/cases.mdx | 7 ++- api_docs/charts.mdx | 2 +- api_docs/cloud.mdx | 2 +- api_docs/cloud_security_posture.mdx | 2 +- api_docs/console.mdx | 2 +- api_docs/controls.mdx | 2 +- api_docs/core.mdx | 2 +- api_docs/core_application.devdocs.json | 24 ++----- api_docs/core_application.mdx | 2 +- api_docs/core_chrome.mdx | 2 +- api_docs/core_saved_objects.mdx | 2 +- api_docs/custom_integrations.mdx | 2 +- api_docs/dashboard.mdx | 2 +- api_docs/dashboard_enhanced.mdx | 2 +- api_docs/data.devdocs.json | 40 +++++++++--- api_docs/data.mdx | 4 +- api_docs/data_query.mdx | 4 +- api_docs/data_search.mdx | 4 +- 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.devdocs.json | 63 +++++++++++++------ api_docs/data_views.mdx | 4 +- api_docs/data_visualizer.mdx | 2 +- api_docs/deprecations_by_api.mdx | 2 +- api_docs/deprecations_by_plugin.mdx | 6 +- api_docs/deprecations_by_team.mdx | 6 +- api_docs/dev_tools.mdx | 2 +- api_docs/discover.mdx | 2 +- api_docs/discover_enhanced.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/es_ui_shared.mdx | 2 +- api_docs/event_annotation.mdx | 2 +- api_docs/event_log.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/file_upload.mdx | 2 +- api_docs/files.mdx | 2 +- api_docs/fleet.devdocs.json | 22 +------ api_docs/fleet.mdx | 4 +- api_docs/global_search.mdx | 2 +- api_docs/home.mdx | 2 +- api_docs/index_lifecycle_management.mdx | 2 +- api_docs/index_management.mdx | 2 +- api_docs/infra.mdx | 2 +- api_docs/inspector.mdx | 2 +- api_docs/interactive_setup.mdx | 2 +- api_docs/kbn_ace.mdx | 2 +- api_docs/kbn_aiops_components.mdx | 2 +- api_docs/kbn_aiops_utils.mdx | 2 +- api_docs/kbn_alerts.mdx | 2 +- api_docs/kbn_analytics.mdx | 2 +- api_docs/kbn_analytics_client.mdx | 2 +- ..._analytics_shippers_elastic_v3_browser.mdx | 2 +- ...n_analytics_shippers_elastic_v3_common.mdx | 2 +- ...n_analytics_shippers_elastic_v3_server.mdx | 2 +- api_docs/kbn_analytics_shippers_fullstory.mdx | 2 +- api_docs/kbn_apm_config_loader.mdx | 2 +- api_docs/kbn_apm_synthtrace.mdx | 2 +- api_docs/kbn_apm_utils.mdx | 2 +- api_docs/kbn_axe_config.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_coloring.mdx | 2 +- api_docs/kbn_config.mdx | 2 +- api_docs/kbn_config_mocks.mdx | 2 +- api_docs/kbn_config_schema.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_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 +- 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_config_server_internal.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_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_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 +- .../kbn_core_http_router_server_internal.mdx | 2 +- .../kbn_core_http_router_server_mocks.mdx | 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_i18n_browser.mdx | 2 +- api_docs/kbn_core_i18n_browser_mocks.mdx | 2 +- .../kbn_core_injected_metadata_browser.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_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 +- .../kbn_core_mount_utils_browser_internal.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_preboot_server.mdx | 2 +- api_docs/kbn_core_preboot_server_mocks.mdx | 2 +- .../kbn_core_saved_objects_api_browser.mdx | 2 +- .../kbn_core_saved_objects_api_server.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 +- api_docs/kbn_core_saved_objects_server.mdx | 2 +- .../kbn_core_saved_objects_utils_server.mdx | 2 +- ...core_test_helpers_deprecations_getters.mdx | 2 +- ...n_core_test_helpers_http_setup_browser.mdx | 2 +- api_docs/kbn_core_theme_browser.mdx | 2 +- api_docs/kbn_core_theme_browser_internal.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_crypto.mdx | 2 +- api_docs/kbn_crypto_browser.mdx | 2 +- api_docs/kbn_datemath.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 +- api_docs/kbn_doc_links.mdx | 2 +- api_docs/kbn_docs_utils.mdx | 2 +- api_docs/kbn_ebt_tools.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_eslint_plugin_imports.mdx | 2 +- api_docs/kbn_field_types.mdx | 2 +- api_docs/kbn_find_used_node_modules.mdx | 2 +- api_docs/kbn_generate.mdx | 2 +- api_docs/kbn_get_repo_files.mdx | 2 +- api_docs/kbn_handlebars.mdx | 2 +- api_docs/kbn_hapi_mocks.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_import_resolver.mdx | 2 +- api_docs/kbn_interpreter.mdx | 2 +- api_docs/kbn_io_ts_utils.mdx | 2 +- api_docs/kbn_jest_serializers.mdx | 2 +- api_docs/kbn_kibana_manifest_parser.mdx | 2 +- api_docs/kbn_kibana_manifest_schema.mdx | 2 +- api_docs/kbn_logging.mdx | 2 +- api_docs/kbn_logging_mocks.mdx | 2 +- api_docs/kbn_managed_vscode_config.mdx | 2 +- api_docs/kbn_mapbox_gl.mdx | 2 +- api_docs/kbn_ml_agg_utils.mdx | 2 +- api_docs/kbn_ml_is_populated_object.mdx | 2 +- api_docs/kbn_ml_string_hash.mdx | 2 +- api_docs/kbn_monaco.mdx | 2 +- api_docs/kbn_optimizer.mdx | 2 +- api_docs/kbn_optimizer_webpack_helpers.mdx | 2 +- ..._performance_testing_dataset_extractor.mdx | 2 +- api_docs/kbn_plugin_generator.mdx | 2 +- api_docs/kbn_plugin_helpers.mdx | 2 +- api_docs/kbn_react_field.mdx | 2 +- api_docs/kbn_repo_source_classifier.mdx | 2 +- api_docs/kbn_rule_data_utils.mdx | 2 +- .../kbn_securitysolution_autocomplete.mdx | 2 +- api_docs/kbn_securitysolution_es_utils.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 +- api_docs/kbn_server_route_repository.mdx | 2 +- api_docs/kbn_shared_svg.mdx | 2 +- ...hared_ux_button_exit_full_screen_mocks.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 +- .../kbn_shared_ux_link_redirect_app_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_storybook_mock.mdx | 2 +- api_docs/kbn_shared_ux_utility.mdx | 2 +- api_docs/kbn_some_dev_log.mdx | 2 +- api_docs/kbn_sort_package_json.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_telemetry_tools.mdx | 2 +- api_docs/kbn_test.mdx | 2 +- api_docs/kbn_test_jest_helpers.mdx | 2 +- api_docs/kbn_tooling_log.mdx | 2 +- api_docs/kbn_type_summarizer.mdx | 2 +- api_docs/kbn_type_summarizer_core.mdx | 2 +- api_docs/kbn_typed_react_router_config.mdx | 2 +- api_docs/kbn_ui_theme.mdx | 2 +- api_docs/kbn_user_profile_components.mdx | 2 +- api_docs/kbn_utility_types.mdx | 2 +- api_docs/kbn_utility_types_jest.mdx | 2 +- api_docs/kbn_utils.mdx | 2 +- api_docs/kbn_yarn_lock_validator.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/lists.mdx | 2 +- api_docs/management.mdx | 2 +- api_docs/maps.mdx | 2 +- api_docs/maps_ems.mdx | 2 +- api_docs/ml.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/observability.mdx | 2 +- api_docs/osquery.mdx | 2 +- api_docs/plugin_directory.mdx | 12 ++-- api_docs/presentation_util.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_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/security.mdx | 2 +- api_docs/security_solution.devdocs.json | 4 +- api_docs/security_solution.mdx | 2 +- api_docs/session_view.mdx | 2 +- api_docs/share.mdx | 2 +- api_docs/snapshot_restore.mdx | 2 +- api_docs/spaces.mdx | 2 +- api_docs/stack_alerts.mdx | 2 +- api_docs/task_manager.mdx | 2 +- api_docs/telemetry.mdx | 2 +- api_docs/telemetry_collection_manager.mdx | 2 +- api_docs/telemetry_collection_xpack.mdx | 2 +- api_docs/telemetry_management_section.mdx | 2 +- api_docs/threat_intelligence.mdx | 2 +- api_docs/timelines.devdocs.json | 8 ++- 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_field_list.mdx | 2 +- api_docs/unified_search.mdx | 2 +- api_docs/unified_search_autocomplete.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 +- 360 files changed, 506 insertions(+), 443 deletions(-) diff --git a/api_docs/actions.mdx b/api_docs/actions.mdx index f8be69588abf7..b3dc1d5f93ed0 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: 2022-08-25 +date: 2022-08-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 47f3ae612e243..af02710d79c7a 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'advancedSettings'] --- import advancedSettingsObj from './advanced_settings.devdocs.json'; diff --git a/api_docs/aiops.mdx b/api_docs/aiops.mdx index 439f4170a658c..9a2d71b4045e3 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: 2022-08-25 +date: 2022-08-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 1a6cc589dbe51..e6b0f372f6755 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'alerting'] --- import alertingObj from './alerting.devdocs.json'; diff --git a/api_docs/apm.mdx b/api_docs/apm.mdx index 1794b674df982..5692d52dbb7ed 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'apm'] --- import apmObj from './apm.devdocs.json'; diff --git a/api_docs/banners.mdx b/api_docs/banners.mdx index 3263a34c995fb..90883d94d7359 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: 2022-08-25 +date: 2022-08-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 ebcc0c37e90a7..e27a9fcb2581d 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: 2022-08-25 +date: 2022-08-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 fc1e7215dfc91..ba12a54284509 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'canvas'] --- import canvasObj from './canvas.devdocs.json'; diff --git a/api_docs/cases.devdocs.json b/api_docs/cases.devdocs.json index 5f8bc2d01e9f1..937717964aca9 100644 --- a/api_docs/cases.devdocs.json +++ b/api_docs/cases.devdocs.json @@ -98,7 +98,13 @@ ", plugins: ", "CasesPluginSetup", ") => ", - "CasesUiSetup" + { + "pluginId": "cases", + "scope": "public", + "docId": "kibCasesPluginApi", + "section": "def-public.CasesUiSetup", + "text": "CasesUiSetup" + } ], "path": "x-pack/plugins/cases/public/plugin.ts", "deprecated": false, @@ -442,7 +448,34 @@ "initialIsOpen": false } ], - "interfaces": [], + "interfaces": [ + { + "parentPluginId": "cases", + "id": "def-public.CasesUiSetup", + "type": "Interface", + "tags": [], + "label": "CasesUiSetup", + "description": [], + "path": "x-pack/plugins/cases/public/types.ts", + "deprecated": false, + "children": [ + { + "parentPluginId": "cases", + "id": "def-public.CasesUiSetup.attachmentFramework", + "type": "Object", + "tags": [], + "label": "attachmentFramework", + "description": [], + "signature": [ + "AttachmentFramework" + ], + "path": "x-pack/plugins/cases/public/types.ts", + "deprecated": false + } + ], + "initialIsOpen": false + } + ], "enums": [], "misc": [ { @@ -689,7 +722,17 @@ "section": "def-common.CommentType", "text": "CommentType" }, - ".alert; alertId: string | string[]; index: string | string[]; rule: { id: string | null; name: string | null; }; owner: string; }" + ".alert; alertId: string | string[]; index: string | string[]; rule: { id: string | null; name: string | null; }; owner: string; } | { type: ", + { + "pluginId": "cases", + "scope": "common", + "docId": "kibCasesPluginApi", + "section": "def-common.CommentType", + "text": "CommentType" + }, + ".persistableState; owner: string; persistableStateAttachmentTypeId: string; persistableStateAttachmentState: { [x: string]: ", + "JsonValue", + "; }; }" ], "path": "x-pack/plugins/cases/public/types.ts", "deprecated": false, diff --git a/api_docs/cases.mdx b/api_docs/cases.mdx index 4b87b04c5d1de..d86be2b4780f2 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'cases'] --- import casesObj from './cases.devdocs.json'; @@ -21,7 +21,7 @@ Contact [ResponseOps](https://github.com/orgs/elastic/teams/response-ops) for qu | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 82 | 0 | 66 | 29 | +| 84 | 0 | 68 | 29 | ## Client @@ -37,6 +37,9 @@ Contact [ResponseOps](https://github.com/orgs/elastic/teams/response-ops) for qu ### Classes +### Interfaces + + ### Consts, variables and types diff --git a/api_docs/charts.mdx b/api_docs/charts.mdx index e84bc2c147344..2c497c7b571da 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: 2022-08-25 +date: 2022-08-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 f6ccfde39d010..9e88a920c73f2 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'cloud'] --- import cloudObj from './cloud.devdocs.json'; diff --git a/api_docs/cloud_security_posture.mdx b/api_docs/cloud_security_posture.mdx index f1562959a17b6..918ed94186634 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: 2022-08-25 +date: 2022-08-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 553e430ae8e5d..10a5875ec89e2 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'console'] --- import consoleObj from './console.devdocs.json'; diff --git a/api_docs/controls.mdx b/api_docs/controls.mdx index 2a55b90dbdb3d..5e20fd9ae5ed3 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'controls'] --- import controlsObj from './controls.devdocs.json'; diff --git a/api_docs/core.mdx b/api_docs/core.mdx index 681aaff8d393f..96882c03eb2ff 100644 --- a/api_docs/core.mdx +++ b/api_docs/core.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/core title: "core" image: https://source.unsplash.com/400x175/?github description: API docs for the core plugin -date: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'core'] --- import coreObj from './core.devdocs.json'; diff --git a/api_docs/core_application.devdocs.json b/api_docs/core_application.devdocs.json index 30eaa3462a34a..931f19050f912 100644 --- a/api_docs/core_application.devdocs.json +++ b/api_docs/core_application.devdocs.json @@ -1508,6 +1508,10 @@ "plugin": "securitySolution", "path": "x-pack/plugins/security_solution/public/app/index.tsx" }, + { + "plugin": "securitySolution", + "path": "x-pack/plugins/security_solution/public/plugin.tsx" + }, { "plugin": "security", "path": "x-pack/plugins/security/public/authentication/logout/logout_app.test.ts" @@ -1991,27 +1995,11 @@ }, { "plugin": "securitySolution", - "path": "x-pack/plugins/security_solution/public/app/home/template_wrapper/bottom_bar/index.tsx" - }, - { - "plugin": "securitySolution", - "path": "x-pack/plugins/security_solution/public/app/home/template_wrapper/bottom_bar/index.tsx" - }, - { - "plugin": "securitySolution", - "path": "x-pack/plugins/security_solution/public/app/home/template_wrapper/index.tsx" - }, - { - "plugin": "securitySolution", - "path": "x-pack/plugins/security_solution/public/app/home/template_wrapper/index.tsx" - }, - { - "plugin": "securitySolution", - "path": "x-pack/plugins/security_solution/public/app/home/index.tsx" + "path": "x-pack/plugins/security_solution/public/types.ts" }, { "plugin": "securitySolution", - "path": "x-pack/plugins/security_solution/public/app/home/index.tsx" + "path": "x-pack/plugins/security_solution/public/types.ts" }, { "plugin": "securitySolution", diff --git a/api_docs/core_application.mdx b/api_docs/core_application.mdx index fd80f7ca72623..827328bfe6303 100644 --- a/api_docs/core_application.mdx +++ b/api_docs/core_application.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/core-application title: "core.application" image: https://source.unsplash.com/400x175/?github description: API docs for the core.application plugin -date: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'core.application'] --- import coreApplicationObj from './core_application.devdocs.json'; diff --git a/api_docs/core_chrome.mdx b/api_docs/core_chrome.mdx index fc269df45a2ab..bc1127f35ea25 100644 --- a/api_docs/core_chrome.mdx +++ b/api_docs/core_chrome.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/core-chrome title: "core.chrome" image: https://source.unsplash.com/400x175/?github description: API docs for the core.chrome plugin -date: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'core.chrome'] --- import coreChromeObj from './core_chrome.devdocs.json'; diff --git a/api_docs/core_saved_objects.mdx b/api_docs/core_saved_objects.mdx index bc8e9dfaf14ff..048c34dc34615 100644 --- a/api_docs/core_saved_objects.mdx +++ b/api_docs/core_saved_objects.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/core-savedObjects title: "core.savedObjects" image: https://source.unsplash.com/400x175/?github description: API docs for the core.savedObjects plugin -date: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'core.savedObjects'] --- import coreSavedObjectsObj from './core_saved_objects.devdocs.json'; diff --git a/api_docs/custom_integrations.mdx b/api_docs/custom_integrations.mdx index 9cbd867e55539..5d695c42ee935 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: 2022-08-25 +date: 2022-08-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 dbe6ad66e89a2..962dfa3447eb8 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: 2022-08-25 +date: 2022-08-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 da3a2b1ae8109..bc42f8c1d37e4 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'dashboardEnhanced'] --- import dashboardEnhancedObj from './dashboard_enhanced.devdocs.json'; diff --git a/api_docs/data.devdocs.json b/api_docs/data.devdocs.json index 92bb53862bd10..fe5af7c66d56b 100644 --- a/api_docs/data.devdocs.json +++ b/api_docs/data.devdocs.json @@ -11853,6 +11853,19 @@ "path": "src/plugins/data_views/common/data_views/data_view.ts", "deprecated": false }, + { + "parentPluginId": "data", + "id": "def-server.DataView.matchedIndices", + "type": "Array", + "tags": [], + "label": "matchedIndices", + "description": [], + "signature": [ + "string[]" + ], + "path": "src/plugins/data_views/common/data_views/data_view.ts", + "deprecated": false + }, { "parentPluginId": "data", "id": "def-server.DataView.Unnamed", @@ -14427,7 +14440,7 @@ "signature": [ "(options: { pattern: string | string[]; metaFields?: string[] | undefined; fieldCapsOptions?: { allow_no_indices: boolean; } | undefined; type?: string | undefined; rollupIndex?: string | undefined; filter?: ", "QueryDslQueryContainer", - " | undefined; }) => Promise<", + " | undefined; }) => Promise<{ fields: ", { "pluginId": "dataViews", "scope": "server", @@ -14435,7 +14448,7 @@ "section": "def-server.FieldDescriptor", "text": "FieldDescriptor" }, - "[]>" + "[]; indices: string[]; }>" ], "path": "src/plugins/data_views/server/fetcher/index_patterns_fetcher.ts", "deprecated": false, @@ -18048,6 +18061,19 @@ "path": "src/plugins/data_views/common/data_views/data_view.ts", "deprecated": false }, + { + "parentPluginId": "data", + "id": "def-common.DataView.matchedIndices", + "type": "Array", + "tags": [], + "label": "matchedIndices", + "description": [], + "signature": [ + "string[]" + ], + "path": "src/plugins/data_views/common/data_views/data_view.ts", + "deprecated": false + }, { "parentPluginId": "data", "id": "def-common.DataView.Unnamed", @@ -22478,14 +22504,8 @@ "text": "GetFieldsOptions" }, ") => Promise<", - { - "pluginId": "dataViews", - "scope": "common", - "docId": "kibDataViewsPluginApi", - "section": "def-common.FieldSpec", - "text": "FieldSpec" - }, - "[]>" + "FieldsForWildcardResponse", + ">" ], "path": "src/plugins/data_views/common/types.ts", "deprecated": false, diff --git a/api_docs/data.mdx b/api_docs/data.mdx index 3a230a771d7cf..24aa8ca3d3608 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'data'] --- import dataObj from './data.devdocs.json'; @@ -21,7 +21,7 @@ Contact [App Services](https://github.com/orgs/elastic/teams/kibana-app-services | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 3117 | 34 | 2431 | 22 | +| 3119 | 34 | 2433 | 22 | ## Client diff --git a/api_docs/data_query.mdx b/api_docs/data_query.mdx index e940895f72695..671320cdd81a5 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'data.query'] --- import dataQueryObj from './data_query.devdocs.json'; @@ -21,7 +21,7 @@ Contact [App Services](https://github.com/orgs/elastic/teams/kibana-app-services | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 3117 | 34 | 2431 | 22 | +| 3119 | 34 | 2433 | 22 | ## Client diff --git a/api_docs/data_search.mdx b/api_docs/data_search.mdx index 59766a04d8f0e..a1fca320137c5 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'data.search'] --- import dataSearchObj from './data_search.devdocs.json'; @@ -21,7 +21,7 @@ Contact [App Services](https://github.com/orgs/elastic/teams/kibana-app-services | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 3117 | 34 | 2431 | 22 | +| 3119 | 34 | 2433 | 22 | ## Client diff --git a/api_docs/data_view_editor.mdx b/api_docs/data_view_editor.mdx index 38833081351a5..54412d27e0577 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: 2022-08-25 +date: 2022-08-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 e0d69bf4df012..9e287a5eed66f 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: 2022-08-25 +date: 2022-08-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 3e93985e623f0..0f75cc5398ccf 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'dataViewManagement'] --- import dataViewManagementObj from './data_view_management.devdocs.json'; diff --git a/api_docs/data_views.devdocs.json b/api_docs/data_views.devdocs.json index 8dd55e506010a..f56b736e4cf43 100644 --- a/api_docs/data_views.devdocs.json +++ b/api_docs/data_views.devdocs.json @@ -304,6 +304,19 @@ "path": "src/plugins/data_views/common/data_views/data_view.ts", "deprecated": false }, + { + "parentPluginId": "dataViews", + "id": "def-public.DataView.matchedIndices", + "type": "Array", + "tags": [], + "label": "matchedIndices", + "description": [], + "signature": [ + "string[]" + ], + "path": "src/plugins/data_views/common/data_views/data_view.ts", + "deprecated": false + }, { "parentPluginId": "dataViews", "id": "def-public.DataView.Unnamed", @@ -2368,14 +2381,8 @@ "text": "GetFieldsOptions" }, ") => Promise<", - { - "pluginId": "dataViews", - "scope": "common", - "docId": "kibDataViewsPluginApi", - "section": "def-common.FieldSpec", - "text": "FieldSpec" - }, - "[]>" + "FieldsForWildcardResponse", + ">" ], "path": "src/plugins/data_views/public/data_views/data_views_api_client.ts", "deprecated": false, @@ -6597,6 +6604,19 @@ "path": "src/plugins/data_views/common/data_views/data_view.ts", "deprecated": false }, + { + "parentPluginId": "dataViews", + "id": "def-server.DataView.matchedIndices", + "type": "Array", + "tags": [], + "label": "matchedIndices", + "description": [], + "signature": [ + "string[]" + ], + "path": "src/plugins/data_views/common/data_views/data_view.ts", + "deprecated": false + }, { "parentPluginId": "dataViews", "id": "def-server.DataView.Unnamed", @@ -9433,7 +9453,7 @@ "signature": [ "(options: { pattern: string | string[]; metaFields?: string[] | undefined; fieldCapsOptions?: { allow_no_indices: boolean; } | undefined; type?: string | undefined; rollupIndex?: string | undefined; filter?: ", "QueryDslQueryContainer", - " | undefined; }) => Promise<", + " | undefined; }) => Promise<{ fields: ", { "pluginId": "dataViews", "scope": "server", @@ -9441,7 +9461,7 @@ "section": "def-server.FieldDescriptor", "text": "FieldDescriptor" }, - "[]>" + "[]; indices: string[]; }>" ], "path": "src/plugins/data_views/server/fetcher/index_patterns_fetcher.ts", "deprecated": false, @@ -12404,6 +12424,19 @@ "path": "src/plugins/data_views/common/data_views/data_view.ts", "deprecated": false }, + { + "parentPluginId": "dataViews", + "id": "def-common.DataView.matchedIndices", + "type": "Array", + "tags": [], + "label": "matchedIndices", + "description": [], + "signature": [ + "string[]" + ], + "path": "src/plugins/data_views/common/data_views/data_view.ts", + "deprecated": false + }, { "parentPluginId": "dataViews", "id": "def-common.DataView.Unnamed", @@ -18096,14 +18129,8 @@ "text": "GetFieldsOptions" }, ") => Promise<", - { - "pluginId": "dataViews", - "scope": "common", - "docId": "kibDataViewsPluginApi", - "section": "def-common.FieldSpec", - "text": "FieldSpec" - }, - "[]>" + "FieldsForWildcardResponse", + ">" ], "path": "src/plugins/data_views/common/types.ts", "deprecated": false, diff --git a/api_docs/data_views.mdx b/api_docs/data_views.mdx index 6898ade1db8a7..fd4096a5c431a 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'dataViews'] --- import dataViewsObj from './data_views.devdocs.json'; @@ -21,7 +21,7 @@ Contact [App Services](https://github.com/orgs/elastic/teams/kibana-app-services | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 960 | 0 | 203 | 0 | +| 963 | 0 | 206 | 1 | ## Client diff --git a/api_docs/data_visualizer.mdx b/api_docs/data_visualizer.mdx index 2523a065ec0ad..4355e0004a66a 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'dataVisualizer'] --- import dataVisualizerObj from './data_visualizer.devdocs.json'; diff --git a/api_docs/deprecations_by_api.mdx b/api_docs/deprecations_by_api.mdx index 34fb5ebddb39e..51ca115e6d423 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana'] --- diff --git a/api_docs/deprecations_by_plugin.mdx b/api_docs/deprecations_by_plugin.mdx index 8d4a55330ef95..831a7df0f89b2 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana'] --- @@ -566,8 +566,8 @@ migrates to using the Kibana Privilege model: https://github.com/elastic/kibana/ | | [policy_config.test.ts](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/common/license/policy_config.test.ts#:~:text=mode), [policy_config.test.ts](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/common/license/policy_config.test.ts#:~:text=mode), [policy_config.test.ts](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/common/license/policy_config.test.ts#:~:text=mode), [fleet_integration.test.ts](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/server/fleet_integration/fleet_integration.test.ts#:~:text=mode), [fleet_integration.test.ts](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/server/fleet_integration/fleet_integration.test.ts#:~:text=mode), [license_watch.test.ts](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/server/endpoint/lib/policy/license_watch.test.ts#:~:text=mode), [license_watch.test.ts](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/server/endpoint/lib/policy/license_watch.test.ts#:~:text=mode), [license_watch.test.ts](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/server/endpoint/lib/policy/license_watch.test.ts#:~:text=mode), [list.test.ts](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/server/endpoint/routes/actions/list.test.ts#:~:text=mode), [response_actions.test.ts](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/server/endpoint/routes/actions/response_actions.test.ts#:~:text=mode)+ 3 more | 8.8.0 | | | [policy_config.test.ts](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/common/license/policy_config.test.ts#:~:text=mode), [policy_config.test.ts](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/common/license/policy_config.test.ts#:~:text=mode), [policy_config.test.ts](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/common/license/policy_config.test.ts#:~:text=mode), [fleet_integration.test.ts](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/server/fleet_integration/fleet_integration.test.ts#:~:text=mode), [fleet_integration.test.ts](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/server/fleet_integration/fleet_integration.test.ts#:~:text=mode), [license_watch.test.ts](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/server/endpoint/lib/policy/license_watch.test.ts#:~:text=mode), [license_watch.test.ts](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/server/endpoint/lib/policy/license_watch.test.ts#:~:text=mode), [license_watch.test.ts](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/server/endpoint/lib/policy/license_watch.test.ts#:~:text=mode), [list.test.ts](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/server/endpoint/routes/actions/list.test.ts#:~:text=mode), [response_actions.test.ts](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/server/endpoint/routes/actions/response_actions.test.ts#:~:text=mode)+ 3 more | 8.8.0 | | | [request_context_factory.ts](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/server/request_context_factory.ts#:~:text=authc), [request_context_factory.ts](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/server/request_context_factory.ts#:~:text=authc), [create_signals_migration_route.ts](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals/create_signals_migration_route.ts#:~:text=authc), [delete_signals_migration_route.ts](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals/delete_signals_migration_route.ts#:~:text=authc), [finalize_signals_migration_route.ts](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals/finalize_signals_migration_route.ts#:~:text=authc), [open_close_signals_route.ts](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals/open_close_signals_route.ts#:~:text=authc), [preview_rules_route.ts](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/preview_rules_route.ts#:~:text=authc), [common.ts](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/server/lib/timeline/utils/common.ts#:~:text=authc) | - | -| | [index.tsx](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/app/index.tsx#:~:text=onAppLeave) | 8.8.0 | -| | [index.tsx](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/timelines/components/flyout/index.tsx#:~:text=AppLeaveHandler), [index.tsx](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/timelines/components/flyout/index.tsx#:~:text=AppLeaveHandler), [index.tsx](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/app/home/template_wrapper/bottom_bar/index.tsx#:~:text=AppLeaveHandler), [index.tsx](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/app/home/template_wrapper/bottom_bar/index.tsx#:~:text=AppLeaveHandler), [index.tsx](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/app/home/template_wrapper/index.tsx#:~:text=AppLeaveHandler), [index.tsx](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/app/home/template_wrapper/index.tsx#:~:text=AppLeaveHandler), [index.tsx](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/app/home/index.tsx#:~:text=AppLeaveHandler), [index.tsx](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/app/home/index.tsx#:~:text=AppLeaveHandler), [routes.tsx](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/app/routes.tsx#:~:text=AppLeaveHandler), [routes.tsx](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/app/routes.tsx#:~:text=AppLeaveHandler)+ 3 more | 8.8.0 | +| | [index.tsx](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/app/index.tsx#:~:text=onAppLeave), [plugin.tsx](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/plugin.tsx#:~:text=onAppLeave) | 8.8.0 | +| | [index.tsx](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/timelines/components/flyout/index.tsx#:~:text=AppLeaveHandler), [index.tsx](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/timelines/components/flyout/index.tsx#:~:text=AppLeaveHandler), [types.ts](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/types.ts#:~:text=AppLeaveHandler), [types.ts](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/types.ts#:~:text=AppLeaveHandler), [routes.tsx](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/app/routes.tsx#:~:text=AppLeaveHandler), [routes.tsx](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/app/routes.tsx#:~:text=AppLeaveHandler), [app.tsx](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/app/app.tsx#:~:text=AppLeaveHandler), [app.tsx](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/app/app.tsx#:~:text=AppLeaveHandler), [app.tsx](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/app/app.tsx#:~:text=AppLeaveHandler) | 8.8.0 | diff --git a/api_docs/deprecations_by_team.mdx b/api_docs/deprecations_by_team.mdx index 04569f6620d1c..b44054f8a1792 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana'] --- @@ -164,8 +164,8 @@ migrates to using the Kibana Privilege model: https://github.com/elastic/kibana/ | --------|-------|-----------|-----------| | securitySolution | | [policy_config.test.ts](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/common/license/policy_config.test.ts#:~:text=mode), [policy_config.test.ts](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/common/license/policy_config.test.ts#:~:text=mode), [policy_config.test.ts](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/common/license/policy_config.test.ts#:~:text=mode), [fleet_integration.test.ts](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/server/fleet_integration/fleet_integration.test.ts#:~:text=mode), [fleet_integration.test.ts](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/server/fleet_integration/fleet_integration.test.ts#:~:text=mode), [license_watch.test.ts](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/server/endpoint/lib/policy/license_watch.test.ts#:~:text=mode), [license_watch.test.ts](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/server/endpoint/lib/policy/license_watch.test.ts#:~:text=mode), [license_watch.test.ts](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/server/endpoint/lib/policy/license_watch.test.ts#:~:text=mode), [list.test.ts](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/server/endpoint/routes/actions/list.test.ts#:~:text=mode), [response_actions.test.ts](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/server/endpoint/routes/actions/response_actions.test.ts#:~:text=mode)+ 3 more | 8.8.0 | | securitySolution | | [policy_config.test.ts](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/common/license/policy_config.test.ts#:~:text=mode), [policy_config.test.ts](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/common/license/policy_config.test.ts#:~:text=mode), [policy_config.test.ts](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/common/license/policy_config.test.ts#:~:text=mode), [fleet_integration.test.ts](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/server/fleet_integration/fleet_integration.test.ts#:~:text=mode), [fleet_integration.test.ts](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/server/fleet_integration/fleet_integration.test.ts#:~:text=mode), [license_watch.test.ts](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/server/endpoint/lib/policy/license_watch.test.ts#:~:text=mode), [license_watch.test.ts](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/server/endpoint/lib/policy/license_watch.test.ts#:~:text=mode), [license_watch.test.ts](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/server/endpoint/lib/policy/license_watch.test.ts#:~:text=mode), [list.test.ts](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/server/endpoint/routes/actions/list.test.ts#:~:text=mode), [response_actions.test.ts](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/server/endpoint/routes/actions/response_actions.test.ts#:~:text=mode)+ 3 more | 8.8.0 | -| securitySolution | | [index.tsx](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/app/index.tsx#:~:text=onAppLeave) | 8.8.0 | -| securitySolution | | [index.tsx](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/timelines/components/flyout/index.tsx#:~:text=AppLeaveHandler), [index.tsx](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/timelines/components/flyout/index.tsx#:~:text=AppLeaveHandler), [index.tsx](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/app/home/template_wrapper/bottom_bar/index.tsx#:~:text=AppLeaveHandler), [index.tsx](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/app/home/template_wrapper/bottom_bar/index.tsx#:~:text=AppLeaveHandler), [index.tsx](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/app/home/template_wrapper/index.tsx#:~:text=AppLeaveHandler), [index.tsx](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/app/home/template_wrapper/index.tsx#:~:text=AppLeaveHandler), [index.tsx](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/app/home/index.tsx#:~:text=AppLeaveHandler), [index.tsx](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/app/home/index.tsx#:~:text=AppLeaveHandler), [routes.tsx](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/app/routes.tsx#:~:text=AppLeaveHandler), [routes.tsx](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/app/routes.tsx#:~:text=AppLeaveHandler)+ 3 more | 8.8.0 | +| securitySolution | | [index.tsx](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/app/index.tsx#:~:text=onAppLeave), [plugin.tsx](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/plugin.tsx#:~:text=onAppLeave) | 8.8.0 | +| securitySolution | | [index.tsx](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/timelines/components/flyout/index.tsx#:~:text=AppLeaveHandler), [index.tsx](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/timelines/components/flyout/index.tsx#:~:text=AppLeaveHandler), [types.ts](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/types.ts#:~:text=AppLeaveHandler), [types.ts](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/types.ts#:~:text=AppLeaveHandler), [routes.tsx](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/app/routes.tsx#:~:text=AppLeaveHandler), [routes.tsx](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/app/routes.tsx#:~:text=AppLeaveHandler), [app.tsx](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/app/app.tsx#:~:text=AppLeaveHandler), [app.tsx](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/app/app.tsx#:~:text=AppLeaveHandler), [app.tsx](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/app/app.tsx#:~:text=AppLeaveHandler) | 8.8.0 | diff --git a/api_docs/dev_tools.mdx b/api_docs/dev_tools.mdx index 8f53f14df881b..0686a6d693ee6 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: 2022-08-25 +date: 2022-08-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 416129b0f7c81..53195eade230b 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: 2022-08-25 +date: 2022-08-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 d9416f82d7272..6df6e47255232 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'discoverEnhanced'] --- import discoverEnhancedObj from './discover_enhanced.devdocs.json'; diff --git a/api_docs/embeddable.mdx b/api_docs/embeddable.mdx index 2d044eaed2df0..b218b03615793 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: 2022-08-25 +date: 2022-08-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 303ee7d4814e0..733be8ab7517a 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: 2022-08-25 +date: 2022-08-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 d46398597a3bf..ab4974d750cab 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: 2022-08-25 +date: 2022-08-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 537eac8ae6255..2740973114e71 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'enterpriseSearch'] --- import enterpriseSearchObj from './enterprise_search.devdocs.json'; diff --git a/api_docs/es_ui_shared.mdx b/api_docs/es_ui_shared.mdx index 21fde4ca00cd8..7334ecf600d49 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'esUiShared'] --- import esUiSharedObj from './es_ui_shared.devdocs.json'; diff --git a/api_docs/event_annotation.mdx b/api_docs/event_annotation.mdx index f2e397b4837e1..8a0295dd05ba6 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'eventAnnotation'] --- import eventAnnotationObj from './event_annotation.devdocs.json'; diff --git a/api_docs/event_log.mdx b/api_docs/event_log.mdx index 949fdc31e2563..99efa51923290 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'eventLog'] --- import eventLogObj from './event_log.devdocs.json'; diff --git a/api_docs/expression_error.mdx b/api_docs/expression_error.mdx index 6924d1fdc11f3..f3f5168b28012 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: 2022-08-25 +date: 2022-08-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 d4ac656d865e0..5e426c8ecd2b4 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: 2022-08-25 +date: 2022-08-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 6a76daa94e785..3bc8ce0a4f110 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: 2022-08-25 +date: 2022-08-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 e394f6f4646d5..e37fd456bb96e 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: 2022-08-25 +date: 2022-08-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 b2b2079d20aca..08053b4efe151 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: 2022-08-25 +date: 2022-08-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 35bb18195921f..c516ce28fbcd2 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: 2022-08-25 +date: 2022-08-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 09d6b508d6785..10d15480a3f94 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: 2022-08-25 +date: 2022-08-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 d37aa5391a740..9a16085875aa9 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: 2022-08-25 +date: 2022-08-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 a5ff25b3f3de9..db884db7e94cb 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: 2022-08-25 +date: 2022-08-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 461a4eeb233e6..9dc941d59c518 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: 2022-08-25 +date: 2022-08-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 5f743d7841d1b..5f345b23fba56 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: 2022-08-25 +date: 2022-08-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 19135263bf6ba..90bc058821196 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: 2022-08-25 +date: 2022-08-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 493a1b33b8397..aa45a96fcbb30 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: 2022-08-25 +date: 2022-08-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 459c90120808f..800e8c33bb1a8 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: 2022-08-25 +date: 2022-08-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 be1c451bab829..0a4dbbc79630c 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: 2022-08-25 +date: 2022-08-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 3279f77dbdd12..6a40753c24505 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'fieldFormats'] --- import fieldFormatsObj from './field_formats.devdocs.json'; diff --git a/api_docs/file_upload.mdx b/api_docs/file_upload.mdx index 5ba2604a3d224..bd88bfa214dd0 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: 2022-08-25 +date: 2022-08-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 c40715a2d6813..4079dbdb47d78 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'files'] --- import filesObj from './files.devdocs.json'; diff --git a/api_docs/fleet.devdocs.json b/api_docs/fleet.devdocs.json index 3f9ade6024017..518b523489208 100644 --- a/api_docs/fleet.devdocs.json +++ b/api_docs/fleet.devdocs.json @@ -613,16 +613,6 @@ "path": "x-pack/plugins/fleet/common/types/models/package_policy.ts", "deprecated": false }, - { - "parentPluginId": "fleet", - "id": "def-public.NewPackagePolicy.output_id", - "type": "string", - "tags": [], - "label": "output_id", - "description": [], - "path": "x-pack/plugins/fleet/common/types/models/package_policy.ts", - "deprecated": false - }, { "parentPluginId": "fleet", "id": "def-public.NewPackagePolicy.package", @@ -1381,7 +1371,7 @@ "The updated Integration Policy to be merged back and included in the API call" ], "signature": [ - "{ id?: string | number | undefined; name?: string | undefined; description?: string | undefined; namespace?: string | undefined; enabled?: boolean | undefined; is_managed?: boolean | undefined; policy_id?: string | undefined; output_id?: string | undefined; package?: ", + "{ id?: string | number | undefined; name?: string | undefined; description?: string | undefined; namespace?: string | undefined; enabled?: boolean | undefined; is_managed?: boolean | undefined; policy_id?: string | undefined; package?: ", { "pluginId": "fleet", "scope": "common", @@ -10584,16 +10574,6 @@ "path": "x-pack/plugins/fleet/common/types/models/package_policy.ts", "deprecated": false }, - { - "parentPluginId": "fleet", - "id": "def-common.NewPackagePolicy.output_id", - "type": "string", - "tags": [], - "label": "output_id", - "description": [], - "path": "x-pack/plugins/fleet/common/types/models/package_policy.ts", - "deprecated": false - }, { "parentPluginId": "fleet", "id": "def-common.NewPackagePolicy.package", diff --git a/api_docs/fleet.mdx b/api_docs/fleet.mdx index b8d273186a630..de705db1b3cbd 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'fleet'] --- import fleetObj from './fleet.devdocs.json'; @@ -21,7 +21,7 @@ Contact [Fleet](https://github.com/orgs/elastic/teams/fleet) for questions regar | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 967 | 3 | 872 | 10 | +| 965 | 3 | 870 | 10 | ## Client diff --git a/api_docs/global_search.mdx b/api_docs/global_search.mdx index 21759cd989137..9f643c1cc2ad5 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'globalSearch'] --- import globalSearchObj from './global_search.devdocs.json'; diff --git a/api_docs/home.mdx b/api_docs/home.mdx index b1b72919388cc..138372c6c83f9 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'home'] --- import homeObj from './home.devdocs.json'; diff --git a/api_docs/index_lifecycle_management.mdx b/api_docs/index_lifecycle_management.mdx index 689a436547bcc..279ffb1047bae 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: 2022-08-25 +date: 2022-08-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 e7adf60721b6f..685392da3350d 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'indexManagement'] --- import indexManagementObj from './index_management.devdocs.json'; diff --git a/api_docs/infra.mdx b/api_docs/infra.mdx index b33b8f461e284..71dd514f27ce4 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'infra'] --- import infraObj from './infra.devdocs.json'; diff --git a/api_docs/inspector.mdx b/api_docs/inspector.mdx index 539fe072161bc..56ccd5f936485 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'inspector'] --- import inspectorObj from './inspector.devdocs.json'; diff --git a/api_docs/interactive_setup.mdx b/api_docs/interactive_setup.mdx index deaa0e1cec9d3..0372b7eba4fe7 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'interactiveSetup'] --- import interactiveSetupObj from './interactive_setup.devdocs.json'; diff --git a/api_docs/kbn_ace.mdx b/api_docs/kbn_ace.mdx index 0f6b9bcb90b56..1fa1b355c27c9 100644 --- a/api_docs/kbn_ace.mdx +++ b/api_docs/kbn_ace.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-ace title: "@kbn/ace" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/ace plugin -date: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/ace'] --- import kbnAceObj from './kbn_ace.devdocs.json'; diff --git a/api_docs/kbn_aiops_components.mdx b/api_docs/kbn_aiops_components.mdx index 21ff36ae4a279..739ccbb931d36 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/aiops-components'] --- import kbnAiopsComponentsObj from './kbn_aiops_components.devdocs.json'; diff --git a/api_docs/kbn_aiops_utils.mdx b/api_docs/kbn_aiops_utils.mdx index e1da3419bb0c9..d0c78d9e3025f 100644 --- a/api_docs/kbn_aiops_utils.mdx +++ b/api_docs/kbn_aiops_utils.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-aiops-utils title: "@kbn/aiops-utils" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/aiops-utils plugin -date: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/aiops-utils'] --- import kbnAiopsUtilsObj from './kbn_aiops_utils.devdocs.json'; diff --git a/api_docs/kbn_alerts.mdx b/api_docs/kbn_alerts.mdx index 3ae8606b2d747..c3b520d62919d 100644 --- a/api_docs/kbn_alerts.mdx +++ b/api_docs/kbn_alerts.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-alerts title: "@kbn/alerts" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/alerts plugin -date: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/alerts'] --- import kbnAlertsObj from './kbn_alerts.devdocs.json'; diff --git a/api_docs/kbn_analytics.mdx b/api_docs/kbn_analytics.mdx index eb2b459f0bcd2..67c5883342268 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/analytics'] --- import kbnAnalyticsObj from './kbn_analytics.devdocs.json'; diff --git a/api_docs/kbn_analytics_client.mdx b/api_docs/kbn_analytics_client.mdx index 142b73c9e4efc..8391ddf8b4c60 100644 --- a/api_docs/kbn_analytics_client.mdx +++ b/api_docs/kbn_analytics_client.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-analytics-client title: "@kbn/analytics-client" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/analytics-client plugin -date: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/analytics-client'] --- import kbnAnalyticsClientObj from './kbn_analytics_client.devdocs.json'; diff --git a/api_docs/kbn_analytics_shippers_elastic_v3_browser.mdx b/api_docs/kbn_analytics_shippers_elastic_v3_browser.mdx index c66f0c591143e..fe3774e3ad857 100644 --- a/api_docs/kbn_analytics_shippers_elastic_v3_browser.mdx +++ b/api_docs/kbn_analytics_shippers_elastic_v3_browser.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-analytics-shippers-elastic-v3-browser title: "@kbn/analytics-shippers-elastic-v3-browser" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/analytics-shippers-elastic-v3-browser plugin -date: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/analytics-shippers-elastic-v3-browser'] --- import kbnAnalyticsShippersElasticV3BrowserObj from './kbn_analytics_shippers_elastic_v3_browser.devdocs.json'; diff --git a/api_docs/kbn_analytics_shippers_elastic_v3_common.mdx b/api_docs/kbn_analytics_shippers_elastic_v3_common.mdx index 4e51e798e0437..d33bf0e85a3b0 100644 --- a/api_docs/kbn_analytics_shippers_elastic_v3_common.mdx +++ b/api_docs/kbn_analytics_shippers_elastic_v3_common.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-analytics-shippers-elastic-v3-common title: "@kbn/analytics-shippers-elastic-v3-common" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/analytics-shippers-elastic-v3-common plugin -date: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/analytics-shippers-elastic-v3-common'] --- import kbnAnalyticsShippersElasticV3CommonObj from './kbn_analytics_shippers_elastic_v3_common.devdocs.json'; diff --git a/api_docs/kbn_analytics_shippers_elastic_v3_server.mdx b/api_docs/kbn_analytics_shippers_elastic_v3_server.mdx index 96b8ede73e0f5..849a54e3212df 100644 --- a/api_docs/kbn_analytics_shippers_elastic_v3_server.mdx +++ b/api_docs/kbn_analytics_shippers_elastic_v3_server.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-analytics-shippers-elastic-v3-server title: "@kbn/analytics-shippers-elastic-v3-server" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/analytics-shippers-elastic-v3-server plugin -date: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/analytics-shippers-elastic-v3-server'] --- import kbnAnalyticsShippersElasticV3ServerObj from './kbn_analytics_shippers_elastic_v3_server.devdocs.json'; diff --git a/api_docs/kbn_analytics_shippers_fullstory.mdx b/api_docs/kbn_analytics_shippers_fullstory.mdx index 26bd13037ceb2..2de9a296def7b 100644 --- a/api_docs/kbn_analytics_shippers_fullstory.mdx +++ b/api_docs/kbn_analytics_shippers_fullstory.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-analytics-shippers-fullstory title: "@kbn/analytics-shippers-fullstory" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/analytics-shippers-fullstory plugin -date: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/analytics-shippers-fullstory'] --- import kbnAnalyticsShippersFullstoryObj from './kbn_analytics_shippers_fullstory.devdocs.json'; diff --git a/api_docs/kbn_apm_config_loader.mdx b/api_docs/kbn_apm_config_loader.mdx index b57651f7f6011..bd1e4d88418eb 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: 2022-08-25 +date: 2022-08-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_synthtrace.mdx b/api_docs/kbn_apm_synthtrace.mdx index c50a83c885a4f..bbedcdb0aa646 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/apm-synthtrace'] --- import kbnApmSynthtraceObj from './kbn_apm_synthtrace.devdocs.json'; diff --git a/api_docs/kbn_apm_utils.mdx b/api_docs/kbn_apm_utils.mdx index 13fa1f4261db2..630e38918831d 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/apm-utils'] --- import kbnApmUtilsObj from './kbn_apm_utils.devdocs.json'; diff --git a/api_docs/kbn_axe_config.mdx b/api_docs/kbn_axe_config.mdx index 6e55fa6311b52..c9639dc06d4b3 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/axe-config'] --- import kbnAxeConfigObj from './kbn_axe_config.devdocs.json'; diff --git a/api_docs/kbn_chart_icons.mdx b/api_docs/kbn_chart_icons.mdx index 13fcb34711b75..d04a5fe90760c 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: 2022-08-25 +date: 2022-08-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 0f29b4c02494c..256391a4bb917 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: 2022-08-25 +date: 2022-08-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 9a459e5756dc2..c454a3e1a9d1b 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: 2022-08-25 +date: 2022-08-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 579087a4c8c15..cfa392b9ee0a7 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: 2022-08-25 +date: 2022-08-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 0c525e974e952..cf9439c98c702 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: 2022-08-25 +date: 2022-08-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_coloring.mdx b/api_docs/kbn_coloring.mdx index beb5c51b19b81..5bd07da9c0425 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: 2022-08-25 +date: 2022-08-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 0cc4dcec069fd..e9c7d5dd4e536 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: 2022-08-25 +date: 2022-08-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 ff40e7357f4ea..6af75e0bd8fae 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: 2022-08-25 +date: 2022-08-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 4b32220dffb1e..f7ecc06585d4f 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/config-schema'] --- import kbnConfigSchemaObj from './kbn_config_schema.devdocs.json'; diff --git a/api_docs/kbn_core_analytics_browser.mdx b/api_docs/kbn_core_analytics_browser.mdx index 361d959773c62..714006813a484 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: 2022-08-25 +date: 2022-08-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 d1a5204464650..1262d844cd2d3 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: 2022-08-25 +date: 2022-08-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 b58e8bf786079..d9929f4d3592c 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: 2022-08-25 +date: 2022-08-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 6e19dcc8e95eb..17b0120e798c7 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: 2022-08-25 +date: 2022-08-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 32679e51b89ec..11763a1b66c42 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: 2022-08-25 +date: 2022-08-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 301adb5accf2a..4c3ad6e058a2b 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: 2022-08-25 +date: 2022-08-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_base_browser_mocks.mdx b/api_docs/kbn_core_base_browser_mocks.mdx index d730776c69c3f..7ce886865cfa2 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: 2022-08-25 +date: 2022-08-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 1a4f548c2381a..95d24a9aa3a11 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: 2022-08-25 +date: 2022-08-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 3048af4df7951..609cf27b980b6 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: 2022-08-25 +date: 2022-08-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 81d39c857bc75..7b2aeddac42e3 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: 2022-08-25 +date: 2022-08-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_common.mdx b/api_docs/kbn_core_capabilities_common.mdx index b65234189ffbf..3ca0bf81fcf1d 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: 2022-08-25 +date: 2022-08-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 25ac37c0c582c..1fe79a5c36a05 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: 2022-08-25 +date: 2022-08-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 8584a38cc4b96..27c4a1f46b35a 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: 2022-08-25 +date: 2022-08-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_config_server_internal.mdx b/api_docs/kbn_core_config_server_internal.mdx index 99d14e245ce9e..3995d86b057c1 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: 2022-08-25 +date: 2022-08-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_deprecations_browser.mdx b/api_docs/kbn_core_deprecations_browser.mdx index 9734a0272a7f1..8d61a8bde5ec7 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: 2022-08-25 +date: 2022-08-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 0ab2c193b1fc2..13dee31647a87 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: 2022-08-25 +date: 2022-08-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 1d5e75c985775..cab1123abfa3c 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: 2022-08-25 +date: 2022-08-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 165ec174a14c8..b8deaae0038bb 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: 2022-08-25 +date: 2022-08-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_doc_links_browser.mdx b/api_docs/kbn_core_doc_links_browser.mdx index 27916555e84cb..ff2ce73d80dd2 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: 2022-08-25 +date: 2022-08-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 c5ccf915f056c..065e37a2ce143 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: 2022-08-25 +date: 2022-08-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 6e69751c8fb47..95da1b91502e8 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: 2022-08-25 +date: 2022-08-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 33f7f683adc63..5ab1993546f9b 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: 2022-08-25 +date: 2022-08-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 4d860f4cf93ac..6c7c49f5b9f9c 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: 2022-08-25 +date: 2022-08-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 76f6287fee800..e7e5f7a49156c 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: 2022-08-25 +date: 2022-08-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 196bc63a91e4d..3c6515307e667 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: 2022-08-25 +date: 2022-08-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 93789d07a50b2..f5525d48b522b 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: 2022-08-25 +date: 2022-08-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 d59c95db6ae40..14ad843a24fcc 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: 2022-08-25 +date: 2022-08-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 3194ab710d177..843c2a26461a3 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: 2022-08-25 +date: 2022-08-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 dd7ee84d75d17..569074f6d5e2a 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: 2022-08-25 +date: 2022-08-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 7059dd0d4ee24..7efe8b6d5c881 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: 2022-08-25 +date: 2022-08-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 4e28ceaa675e2..1e545969194b5 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: 2022-08-25 +date: 2022-08-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 1e4637bd487a4..ec4bac7e3c931 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: 2022-08-25 +date: 2022-08-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 3816de53c4059..5f57a08cbb329 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: 2022-08-25 +date: 2022-08-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 d99fb7f0a6fe7..176bf73ab022e 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: 2022-08-25 +date: 2022-08-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 396e9eef6afc2..ffaeb7fee7dfa 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: 2022-08-25 +date: 2022-08-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 4a9b0dd7275ad..712b795f547fd 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: 2022-08-25 +date: 2022-08-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 f86ee3da147ca..690377d74f88c 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: 2022-08-25 +date: 2022-08-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 451da47630311..7f4fd0e61fd50 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: 2022-08-25 +date: 2022-08-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_http_browser.mdx b/api_docs/kbn_core_http_browser.mdx index 6a7b3b85f86ea..a81814631b9a8 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: 2022-08-25 +date: 2022-08-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 69b4013701604..e5b9ea2a5701d 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: 2022-08-25 +date: 2022-08-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 26236f96310fa..96b1eb8a6d945 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: 2022-08-25 +date: 2022-08-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 1fff00ffd660d..ac6bde988c378 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: 2022-08-25 +date: 2022-08-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 6f7c5df0252ed..98454c5540df8 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: 2022-08-25 +date: 2022-08-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_router_server_internal.mdx b/api_docs/kbn_core_http_router_server_internal.mdx index bf330fbea65f6..bcad268923047 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: 2022-08-25 +date: 2022-08-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 627bbbfd92fd9..e7e7efafeabe4 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: 2022-08-25 +date: 2022-08-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.mdx b/api_docs/kbn_core_http_server.mdx index b186519537a31..307ee6c122367 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: 2022-08-25 +date: 2022-08-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 90b38eebfa2c9..a9c06be70272c 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: 2022-08-25 +date: 2022-08-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 58720d141e5e1..0e89ca32661bb 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: 2022-08-25 +date: 2022-08-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_i18n_browser.mdx b/api_docs/kbn_core_i18n_browser.mdx index eecb82626a0a1..97a4004be4122 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: 2022-08-25 +date: 2022-08-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 668c33d8a6821..adc13fbbe6761 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: 2022-08-25 +date: 2022-08-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_injected_metadata_browser.mdx b/api_docs/kbn_core_injected_metadata_browser.mdx index 4a70ed46b2de5..993ad090d3b78 100644 --- a/api_docs/kbn_core_injected_metadata_browser.mdx +++ b/api_docs/kbn_core_injected_metadata_browser.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-injected-metadata-browser title: "@kbn/core-injected-metadata-browser" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-injected-metadata-browser plugin -date: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-injected-metadata-browser'] --- import kbnCoreInjectedMetadataBrowserObj from './kbn_core_injected_metadata_browser.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 628cdbec04261..3d7eff7cd5f50 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: 2022-08-25 +date: 2022-08-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 94f147e72ef23..e62f851a807ac 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: 2022-08-25 +date: 2022-08-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 3744ac452b365..141f7dc2833a9 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: 2022-08-25 +date: 2022-08-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_logging_server.mdx b/api_docs/kbn_core_logging_server.mdx index 25ce64f9ff32c..4d20da7dda16a 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: 2022-08-25 +date: 2022-08-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 b80c7d289950b..6c1a8a5ffe868 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: 2022-08-25 +date: 2022-08-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 ec792bfd4fbe8..6726534506b08 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: 2022-08-25 +date: 2022-08-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 a4ef238a675f3..46f34b5465ac6 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: 2022-08-25 +date: 2022-08-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 fb6397fba9e88..9294214f42555 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: 2022-08-25 +date: 2022-08-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 746f70eb51839..61ef5a7a51a2c 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: 2022-08-25 +date: 2022-08-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 8620a2641beb8..7666183acff5a 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: 2022-08-25 +date: 2022-08-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 1bab9701441cf..0768d8648c7b5 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: 2022-08-25 +date: 2022-08-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 6176f6a169165..84156ef63abbe 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: 2022-08-25 +date: 2022-08-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_mount_utils_browser_internal.mdx b/api_docs/kbn_core_mount_utils_browser_internal.mdx index 85c3c5de1ee4e..526a23017dbf0 100644 --- a/api_docs/kbn_core_mount_utils_browser_internal.mdx +++ b/api_docs/kbn_core_mount_utils_browser_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-mount-utils-browser-internal title: "@kbn/core-mount-utils-browser-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-mount-utils-browser-internal plugin -date: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-mount-utils-browser-internal'] --- import kbnCoreMountUtilsBrowserInternalObj from './kbn_core_mount_utils_browser_internal.devdocs.json'; diff --git a/api_docs/kbn_core_node_server.mdx b/api_docs/kbn_core_node_server.mdx index 991e396061471..3c29698b00cd2 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: 2022-08-25 +date: 2022-08-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 25d39317e7102..7573ec8f52e03 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: 2022-08-25 +date: 2022-08-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 41f6f06cd116e..c65bcb22ff01b 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: 2022-08-25 +date: 2022-08-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 b3959248e4aa0..c39e23766cb72 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: 2022-08-25 +date: 2022-08-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 8f9e314d05c1a..ce6818e0ad257 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: 2022-08-25 +date: 2022-08-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 e6204ca84ace6..3388a7f1a3b3d 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: 2022-08-25 +date: 2022-08-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 a06620f5fdcea..37af6696eb092 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: 2022-08-25 +date: 2022-08-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 5d0d655621308..b73da1ca586d5 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: 2022-08-25 +date: 2022-08-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 2dec4dc5a5a69..09490569fb02c 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: 2022-08-25 +date: 2022-08-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_preboot_server.mdx b/api_docs/kbn_core_preboot_server.mdx index ac44620d1c141..7b752c736d660 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: 2022-08-25 +date: 2022-08-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 24fa387046f44..b4d36cd0b7e5b 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: 2022-08-25 +date: 2022-08-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_saved_objects_api_browser.mdx b/api_docs/kbn_core_saved_objects_api_browser.mdx index 599bf504b0b5a..3a3c46b6eb6be 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: 2022-08-25 +date: 2022-08-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 6868276b44cdf..42c97103ee4f5 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: 2022-08-25 +date: 2022-08-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_base_server_internal.mdx b/api_docs/kbn_core_saved_objects_base_server_internal.mdx index 3707d6348f8b1..2c20dc0243013 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: 2022-08-25 +date: 2022-08-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 2b8f88f511a1e..25a26f194c8a1 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: 2022-08-25 +date: 2022-08-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 f7e6490cf1a7b..609a8cf777dde 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: 2022-08-25 +date: 2022-08-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 15eb1a7df1d42..35c1a7f034873 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: 2022-08-25 +date: 2022-08-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 6611824b8bbbe..9b8b12f8e9a47 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: 2022-08-25 +date: 2022-08-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 2198c485b6d86..8ef70538abe0b 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: 2022-08-25 +date: 2022-08-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_server.mdx b/api_docs/kbn_core_saved_objects_server.mdx index f2a7b87bb6a9b..9db921feffe7d 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: 2022-08-25 +date: 2022-08-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_utils_server.mdx b/api_docs/kbn_core_saved_objects_utils_server.mdx index 42d9491fcd3a8..dbf94cccdfb20 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: 2022-08-25 +date: 2022-08-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_test_helpers_deprecations_getters.mdx b/api_docs/kbn_core_test_helpers_deprecations_getters.mdx index fba7e48326cbe..291ac1065813f 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: 2022-08-25 +date: 2022-08-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 7723464eff918..bd22230b40c07 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: 2022-08-25 +date: 2022-08-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_theme_browser.mdx b/api_docs/kbn_core_theme_browser.mdx index 0ce5777cc40fc..11b728694818b 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: 2022-08-25 +date: 2022-08-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_internal.mdx b/api_docs/kbn_core_theme_browser_internal.mdx index fce599ab96991..43125675ac1d7 100644 --- a/api_docs/kbn_core_theme_browser_internal.mdx +++ b/api_docs/kbn_core_theme_browser_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-theme-browser-internal title: "@kbn/core-theme-browser-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-theme-browser-internal plugin -date: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-theme-browser-internal'] --- import kbnCoreThemeBrowserInternalObj from './kbn_core_theme_browser_internal.devdocs.json'; diff --git a/api_docs/kbn_core_theme_browser_mocks.mdx b/api_docs/kbn_core_theme_browser_mocks.mdx index f489e5ff51c81..3f2734d440bd5 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: 2022-08-25 +date: 2022-08-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 f39b941a83cbb..4b81d752504b4 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: 2022-08-25 +date: 2022-08-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 29ca43d1a1783..30585ecd5b00c 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: 2022-08-25 +date: 2022-08-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 dd62cdf5a686e..7302a32c6e003 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: 2022-08-25 +date: 2022-08-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 1b178047b1504..53f556e763693 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: 2022-08-25 +date: 2022-08-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_crypto.mdx b/api_docs/kbn_crypto.mdx index 8299fe8caedd0..6fdcdb89afe70 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: 2022-08-25 +date: 2022-08-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 7f4a9abbbf4af..3870d746da1d4 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/crypto-browser'] --- import kbnCryptoBrowserObj from './kbn_crypto_browser.devdocs.json'; diff --git a/api_docs/kbn_datemath.mdx b/api_docs/kbn_datemath.mdx index fc02121271dd6..1fbdb4209cb6e 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/datemath'] --- import kbnDatemathObj from './kbn_datemath.devdocs.json'; diff --git a/api_docs/kbn_dev_cli_errors.mdx b/api_docs/kbn_dev_cli_errors.mdx index b7ee4a2263f8d..05a150f541c2a 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: 2022-08-25 +date: 2022-08-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 96c35150e548c..efee8f7aebd98 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: 2022-08-25 +date: 2022-08-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 ae73ffe8bc937..f11b0a160cfe7 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: 2022-08-25 +date: 2022-08-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 10ea45231e1be..7eb48c1afb22c 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/dev-utils'] --- import kbnDevUtilsObj from './kbn_dev_utils.devdocs.json'; diff --git a/api_docs/kbn_doc_links.mdx b/api_docs/kbn_doc_links.mdx index b14a4a980f7d8..6368ac692263a 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: 2022-08-25 +date: 2022-08-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 cde479f18f3d8..07e6ee6e285e5 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/docs-utils'] --- import kbnDocsUtilsObj from './kbn_docs_utils.devdocs.json'; diff --git a/api_docs/kbn_ebt_tools.mdx b/api_docs/kbn_ebt_tools.mdx index 29f2d2b987449..2c6a0d026ed9d 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/ebt-tools'] --- import kbnEbtToolsObj from './kbn_ebt_tools.devdocs.json'; diff --git a/api_docs/kbn_es_archiver.mdx b/api_docs/kbn_es_archiver.mdx index d3610261dcf5f..75725e906b703 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: 2022-08-25 +date: 2022-08-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 df79d7a318c97..49d5de785f8e6 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: 2022-08-25 +date: 2022-08-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 825b5b462f428..b5e15619d10d4 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/es-query'] --- import kbnEsQueryObj from './kbn_es_query.devdocs.json'; diff --git a/api_docs/kbn_eslint_plugin_imports.mdx b/api_docs/kbn_eslint_plugin_imports.mdx index 58d7cf091846f..d6d7c6c7de245 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: 2022-08-25 +date: 2022-08-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_field_types.mdx b/api_docs/kbn_field_types.mdx index d5a2804105ba0..bddff4d438a17 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/field-types'] --- import kbnFieldTypesObj from './kbn_field_types.devdocs.json'; diff --git a/api_docs/kbn_find_used_node_modules.mdx b/api_docs/kbn_find_used_node_modules.mdx index ef7a3d78994ec..74c1f3f4e2195 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: 2022-08-25 +date: 2022-08-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_generate.mdx b/api_docs/kbn_generate.mdx index 634febc75767c..445ac5f0d6ea5 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/generate'] --- import kbnGenerateObj from './kbn_generate.devdocs.json'; diff --git a/api_docs/kbn_get_repo_files.mdx b/api_docs/kbn_get_repo_files.mdx index cfb3e0e083019..059d83739c0fa 100644 --- a/api_docs/kbn_get_repo_files.mdx +++ b/api_docs/kbn_get_repo_files.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-get-repo-files title: "@kbn/get-repo-files" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/get-repo-files plugin -date: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/get-repo-files'] --- import kbnGetRepoFilesObj from './kbn_get_repo_files.devdocs.json'; diff --git a/api_docs/kbn_handlebars.mdx b/api_docs/kbn_handlebars.mdx index dd563a6548b2b..9d18ba0d137e5 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: 2022-08-25 +date: 2022-08-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 c0740082b80e5..30fda71cf58d1 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/hapi-mocks'] --- import kbnHapiMocksObj from './kbn_hapi_mocks.devdocs.json'; diff --git a/api_docs/kbn_home_sample_data_card.mdx b/api_docs/kbn_home_sample_data_card.mdx index cceee429a87c5..6b03ca9665cf4 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: 2022-08-25 +date: 2022-08-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 433b3679a19cf..e35558b98262f 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: 2022-08-25 +date: 2022-08-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 46dff09c58596..637b697b8ac82 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/i18n'] --- import kbnI18nObj from './kbn_i18n.devdocs.json'; diff --git a/api_docs/kbn_import_resolver.mdx b/api_docs/kbn_import_resolver.mdx index 027823b0bc87e..65f7c975af65b 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/import-resolver'] --- import kbnImportResolverObj from './kbn_import_resolver.devdocs.json'; diff --git a/api_docs/kbn_interpreter.mdx b/api_docs/kbn_interpreter.mdx index af5bb6448b1bd..c4ebf39eee91c 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/interpreter'] --- import kbnInterpreterObj from './kbn_interpreter.devdocs.json'; diff --git a/api_docs/kbn_io_ts_utils.mdx b/api_docs/kbn_io_ts_utils.mdx index b9c9ffd22ab74..5a3cca57b2fb0 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: 2022-08-25 +date: 2022-08-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_jest_serializers.mdx b/api_docs/kbn_jest_serializers.mdx index 4567abd7f169a..9216157b132ac 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/jest-serializers'] --- import kbnJestSerializersObj from './kbn_jest_serializers.devdocs.json'; diff --git a/api_docs/kbn_kibana_manifest_parser.mdx b/api_docs/kbn_kibana_manifest_parser.mdx index 069493d85b12c..5904cde4a77be 100644 --- a/api_docs/kbn_kibana_manifest_parser.mdx +++ b/api_docs/kbn_kibana_manifest_parser.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-kibana-manifest-parser title: "@kbn/kibana-manifest-parser" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/kibana-manifest-parser plugin -date: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/kibana-manifest-parser'] --- import kbnKibanaManifestParserObj from './kbn_kibana_manifest_parser.devdocs.json'; diff --git a/api_docs/kbn_kibana_manifest_schema.mdx b/api_docs/kbn_kibana_manifest_schema.mdx index 6fe5ae34bb51e..6ce28e15f087f 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: 2022-08-25 +date: 2022-08-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_logging.mdx b/api_docs/kbn_logging.mdx index 95e10f042ddbc..1440037e51c29 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: 2022-08-25 +date: 2022-08-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 b0668b44936d5..b99d7f88ad8c6 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/logging-mocks'] --- import kbnLoggingMocksObj from './kbn_logging_mocks.devdocs.json'; diff --git a/api_docs/kbn_managed_vscode_config.mdx b/api_docs/kbn_managed_vscode_config.mdx index c8a5cb18efb35..a58a919e6face 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: 2022-08-25 +date: 2022-08-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_mapbox_gl.mdx b/api_docs/kbn_mapbox_gl.mdx index b85ec952040e7..fdb46bad7b33e 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/mapbox-gl'] --- import kbnMapboxGlObj from './kbn_mapbox_gl.devdocs.json'; diff --git a/api_docs/kbn_ml_agg_utils.mdx b/api_docs/kbn_ml_agg_utils.mdx index c4c952ff999a3..ed5aa7a76d1b6 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: 2022-08-25 +date: 2022-08-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_is_populated_object.mdx b/api_docs/kbn_ml_is_populated_object.mdx index 1965a997aaf8c..6d2341759dc79 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: 2022-08-25 +date: 2022-08-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_string_hash.mdx b/api_docs/kbn_ml_string_hash.mdx index e92d7fb5cf2ad..145308eb4bde7 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: 2022-08-25 +date: 2022-08-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_monaco.mdx b/api_docs/kbn_monaco.mdx index 86a2d437f5192..2efff66b003fa 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/monaco'] --- import kbnMonacoObj from './kbn_monaco.devdocs.json'; diff --git a/api_docs/kbn_optimizer.mdx b/api_docs/kbn_optimizer.mdx index 69b23f80f1119..91940ce237646 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: 2022-08-25 +date: 2022-08-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 ed0734e3eb62a..894b19e4a99ea 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: 2022-08-25 +date: 2022-08-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_performance_testing_dataset_extractor.mdx b/api_docs/kbn_performance_testing_dataset_extractor.mdx index d575f66b3cfbd..90fadf3324a58 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: 2022-08-25 +date: 2022-08-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_generator.mdx b/api_docs/kbn_plugin_generator.mdx index e95babe2350e1..997b69d91c7a9 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: 2022-08-25 +date: 2022-08-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 907269ac19443..24a5cae829a08 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/plugin-helpers'] --- import kbnPluginHelpersObj from './kbn_plugin_helpers.devdocs.json'; diff --git a/api_docs/kbn_react_field.mdx b/api_docs/kbn_react_field.mdx index ecd0cf2f2058b..7c3ca220ed7dc 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/react-field'] --- import kbnReactFieldObj from './kbn_react_field.devdocs.json'; diff --git a/api_docs/kbn_repo_source_classifier.mdx b/api_docs/kbn_repo_source_classifier.mdx index 0ee6199ed4e4c..ede30355959ee 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: 2022-08-25 +date: 2022-08-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_rule_data_utils.mdx b/api_docs/kbn_rule_data_utils.mdx index e65840adebc55..15e01d2f94b1d 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: 2022-08-25 +date: 2022-08-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_securitysolution_autocomplete.mdx b/api_docs/kbn_securitysolution_autocomplete.mdx index 02430d8571d9c..5b112ad06ee46 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/securitysolution-autocomplete'] --- import kbnSecuritysolutionAutocompleteObj from './kbn_securitysolution_autocomplete.devdocs.json'; diff --git a/api_docs/kbn_securitysolution_es_utils.mdx b/api_docs/kbn_securitysolution_es_utils.mdx index d172ebb469ecd..f2b9ca25decd7 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: 2022-08-25 +date: 2022-08-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_hook_utils.mdx b/api_docs/kbn_securitysolution_hook_utils.mdx index efea1bb051e8f..c0568d16829bc 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: 2022-08-25 +date: 2022-08-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 f3023292149d0..3659735300ee0 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: 2022-08-25 +date: 2022-08-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 8a8c195569506..f3c8a7d314287 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: 2022-08-25 +date: 2022-08-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 9a441e05898f0..97d4045e11363 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: 2022-08-25 +date: 2022-08-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 12f3518e7c7ea..a0b22250b033d 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: 2022-08-25 +date: 2022-08-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 cbb6203fec0c2..a658e918fc4c3 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: 2022-08-25 +date: 2022-08-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 ece6d3b9543a1..ddd7e5b5f5a04 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: 2022-08-25 +date: 2022-08-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 42e285f0b7798..afb4d4175116c 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: 2022-08-25 +date: 2022-08-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 d147cdfa750fa..ec7bc813f7f15 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: 2022-08-25 +date: 2022-08-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 87fbfd7b1341f..d9c0d30a1854f 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: 2022-08-25 +date: 2022-08-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 6288580920a99..ad46d463e2710 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: 2022-08-25 +date: 2022-08-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 ca078e4f0bc55..c2ffa9419bd0f 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: 2022-08-25 +date: 2022-08-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 d3be0bba4ebed..32b4802cf9ae2 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: 2022-08-25 +date: 2022-08-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.mdx b/api_docs/kbn_server_route_repository.mdx index 4315909e93387..3be4e97693afd 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/server-route-repository'] --- import kbnServerRouteRepositoryObj from './kbn_server_route_repository.devdocs.json'; diff --git a/api_docs/kbn_shared_svg.mdx b/api_docs/kbn_shared_svg.mdx index e288f2438d3fa..442f778af7049 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: 2022-08-25 +date: 2022-08-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_button_exit_full_screen_mocks.mdx b/api_docs/kbn_shared_ux_button_exit_full_screen_mocks.mdx index 0f9f525843603..680789fba38f6 100644 --- a/api_docs/kbn_shared_ux_button_exit_full_screen_mocks.mdx +++ b/api_docs/kbn_shared_ux_button_exit_full_screen_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-button-exit-full-screen-mocks title: "@kbn/shared-ux-button-exit-full-screen-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-button-exit-full-screen-mocks plugin -date: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-button-exit-full-screen-mocks'] --- import kbnSharedUxButtonExitFullScreenMocksObj from './kbn_shared_ux_button_exit_full_screen_mocks.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_button_toolbar.mdx b/api_docs/kbn_shared_ux_button_toolbar.mdx index d62b7d8a4aeda..df516da6266bf 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: 2022-08-25 +date: 2022-08-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 1279be4774448..d424cd5f18cc0 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: 2022-08-25 +date: 2022-08-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 52cae038c1e4f..c764e58c411a0 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: 2022-08-25 +date: 2022-08-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_link_redirect_app_mocks.mdx b/api_docs/kbn_shared_ux_link_redirect_app_mocks.mdx index e195f34ddbfb1..f5cf1445b9e1c 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: 2022-08-25 +date: 2022-08-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_page_analytics_no_data.mdx b/api_docs/kbn_shared_ux_page_analytics_no_data.mdx index 247087983788f..ef8ef073ea8bc 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: 2022-08-25 +date: 2022-08-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 0bb545d64f0ba..a3a127dc91b4f 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: 2022-08-25 +date: 2022-08-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 36a9e8d6aa659..17aff2098b06f 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: 2022-08-25 +date: 2022-08-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 700490347e741..604765484a78e 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: 2022-08-25 +date: 2022-08-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 2e47e3f23dda2..d3bd6568178de 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: 2022-08-25 +date: 2022-08-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 9115be422ea25..ea816187d4b6c 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: 2022-08-25 +date: 2022-08-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 dd280251393e3..c2a4a620c05eb 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: 2022-08-25 +date: 2022-08-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 30502004d0106..275a5132bb308 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: 2022-08-25 +date: 2022-08-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 803dc7906dcc5..52956ab771e39 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: 2022-08-25 +date: 2022-08-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 d91266e247f9f..bb391ffcd1e0e 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: 2022-08-25 +date: 2022-08-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 45daf159d190e..53446f4877a3e 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: 2022-08-25 +date: 2022-08-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 385ef459b8790..cc69e07a0c79f 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: 2022-08-25 +date: 2022-08-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 8d5f9d13869b4..aafc933ecba0a 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: 2022-08-25 +date: 2022-08-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_storybook_mock.mdx b/api_docs/kbn_shared_ux_storybook_mock.mdx index 5796fe94200d2..90126c247ebb6 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: 2022-08-25 +date: 2022-08-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_utility.mdx b/api_docs/kbn_shared_ux_utility.mdx index 852a3177ec89f..b99f92a8bce5a 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: 2022-08-25 +date: 2022-08-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_some_dev_log.mdx b/api_docs/kbn_some_dev_log.mdx index 6793ae06564f2..7ef6359cee364 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: 2022-08-25 +date: 2022-08-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_package_json.mdx b/api_docs/kbn_sort_package_json.mdx index 6fd7ccd3ccb94..3bf0905227be2 100644 --- a/api_docs/kbn_sort_package_json.mdx +++ b/api_docs/kbn_sort_package_json.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-sort-package-json title: "@kbn/sort-package-json" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/sort-package-json plugin -date: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/sort-package-json'] --- import kbnSortPackageJsonObj from './kbn_sort_package_json.devdocs.json'; diff --git a/api_docs/kbn_std.mdx b/api_docs/kbn_std.mdx index b8e1b3f0f4575..aa6f2fee5e431 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: 2022-08-25 +date: 2022-08-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 2936901ae456a..8d34a9c3da8ff 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: 2022-08-25 +date: 2022-08-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 70e12866b86f9..cc283e52c37b0 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/storybook'] --- import kbnStorybookObj from './kbn_storybook.devdocs.json'; diff --git a/api_docs/kbn_telemetry_tools.mdx b/api_docs/kbn_telemetry_tools.mdx index 310de0af20e73..a304f8cde35b9 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: 2022-08-25 +date: 2022-08-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 7c2f3bc09722d..b75c680d199d5 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/test'] --- import kbnTestObj from './kbn_test.devdocs.json'; diff --git a/api_docs/kbn_test_jest_helpers.mdx b/api_docs/kbn_test_jest_helpers.mdx index bc6337f893c27..1eb6f4ee924ca 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: 2022-08-25 +date: 2022-08-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_tooling_log.mdx b/api_docs/kbn_tooling_log.mdx index 56649babd28a4..7935863bde91f 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/tooling-log'] --- import kbnToolingLogObj from './kbn_tooling_log.devdocs.json'; diff --git a/api_docs/kbn_type_summarizer.mdx b/api_docs/kbn_type_summarizer.mdx index da35bb05f58ed..80d8867c0e085 100644 --- a/api_docs/kbn_type_summarizer.mdx +++ b/api_docs/kbn_type_summarizer.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-type-summarizer title: "@kbn/type-summarizer" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/type-summarizer plugin -date: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/type-summarizer'] --- import kbnTypeSummarizerObj from './kbn_type_summarizer.devdocs.json'; diff --git a/api_docs/kbn_type_summarizer_core.mdx b/api_docs/kbn_type_summarizer_core.mdx index bb8aa45b65d1a..5725bd60ccc2c 100644 --- a/api_docs/kbn_type_summarizer_core.mdx +++ b/api_docs/kbn_type_summarizer_core.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-type-summarizer-core title: "@kbn/type-summarizer-core" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/type-summarizer-core plugin -date: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/type-summarizer-core'] --- import kbnTypeSummarizerCoreObj from './kbn_type_summarizer_core.devdocs.json'; diff --git a/api_docs/kbn_typed_react_router_config.mdx b/api_docs/kbn_typed_react_router_config.mdx index c067cc15b9ee8..acc3841da6cab 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/typed-react-router-config'] --- import kbnTypedReactRouterConfigObj from './kbn_typed_react_router_config.devdocs.json'; diff --git a/api_docs/kbn_ui_theme.mdx b/api_docs/kbn_ui_theme.mdx index 9e64769992089..4142f0beac9eb 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/ui-theme'] --- import kbnUiThemeObj from './kbn_ui_theme.devdocs.json'; diff --git a/api_docs/kbn_user_profile_components.mdx b/api_docs/kbn_user_profile_components.mdx index f04a901fe2e4d..26ef04ca995c0 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: 2022-08-25 +date: 2022-08-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.mdx b/api_docs/kbn_utility_types.mdx index 55e2c616a8e85..2e4610d5feef8 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: 2022-08-25 +date: 2022-08-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 697e016ae22ce..04850b9d8a9eb 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: 2022-08-25 +date: 2022-08-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 68f4b36b52d52..2c77bc33f6c36 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/utils'] --- import kbnUtilsObj from './kbn_utils.devdocs.json'; diff --git a/api_docs/kbn_yarn_lock_validator.mdx b/api_docs/kbn_yarn_lock_validator.mdx index 8e784f1748f23..0e6b920ea9d2c 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/yarn-lock-validator'] --- import kbnYarnLockValidatorObj from './kbn_yarn_lock_validator.devdocs.json'; diff --git a/api_docs/kibana_overview.mdx b/api_docs/kibana_overview.mdx index 818f5c0c3d5e7..60ea7190ed086 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: 2022-08-25 +date: 2022-08-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 45dbf2c5047ed..8cd1a4faf9b2f 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: 2022-08-25 +date: 2022-08-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 3819b8e03202a..c48cc9b847b93 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: 2022-08-25 +date: 2022-08-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 ffb1985651e92..d60dcb649ad15 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: 2022-08-25 +date: 2022-08-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 38ea1bce48cc5..c12e40158a534 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: 2022-08-25 +date: 2022-08-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 7d7c25360023f..154777863ae8a 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: 2022-08-25 +date: 2022-08-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 629266010d63a..b7cd8c3333297 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: 2022-08-25 +date: 2022-08-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 822b0e9e3407a..a38ecf961b5dc 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'licensing'] --- import licensingObj from './licensing.devdocs.json'; diff --git a/api_docs/lists.mdx b/api_docs/lists.mdx index 57866b533a841..91ce79dc98f9f 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'lists'] --- import listsObj from './lists.devdocs.json'; diff --git a/api_docs/management.mdx b/api_docs/management.mdx index 7a9b14a24b536..b15c941773c8e 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: 2022-08-25 +date: 2022-08-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 22034db9582f9..f6c83e308a10e 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: 2022-08-25 +date: 2022-08-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 693caaa4a340c..3290f619b425c 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'mapsEms'] --- import mapsEmsObj from './maps_ems.devdocs.json'; diff --git a/api_docs/ml.mdx b/api_docs/ml.mdx index d0dd804285115..abcac9c4aa568 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'ml'] --- import mlObj from './ml.devdocs.json'; diff --git a/api_docs/monitoring.mdx b/api_docs/monitoring.mdx index 1127a83a494fe..23fbb345e2e2d 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: 2022-08-25 +date: 2022-08-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 2c8f3acc14f82..e9aabd408f754 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: 2022-08-25 +date: 2022-08-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 6c5136d7f8fac..65954294d6467 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: 2022-08-25 +date: 2022-08-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 1939f028e3fb6..d0f9acae345c4 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'newsfeed'] --- import newsfeedObj from './newsfeed.devdocs.json'; diff --git a/api_docs/observability.mdx b/api_docs/observability.mdx index 03c2c042e4004..d177c3008e133 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'observability'] --- import observabilityObj from './observability.devdocs.json'; diff --git a/api_docs/osquery.mdx b/api_docs/osquery.mdx index b74d8b6797378..91c62fe761b26 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'osquery'] --- import osqueryObj from './osquery.devdocs.json'; diff --git a/api_docs/plugin_directory.mdx b/api_docs/plugin_directory.mdx index a7a5d75116707..78b1a74aff531 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana'] --- @@ -21,7 +21,7 @@ tags: ['contributor', 'dev', 'apidocs', 'kibana'] | API Count | Any Count | Missing comments | Missing exports | |--------------|----------|-----------------|--------| -| 29523 | 180 | 19900 | 922 | +| 29528 | 180 | 19905 | 923 | ## Plugin Directory @@ -35,7 +35,7 @@ tags: ['contributor', 'dev', 'apidocs', 'kibana'] | | [Kibana Core](https://github.com/orgs/elastic/teams/kibana-core) | - | 9 | 0 | 9 | 0 | | | [App Services](https://github.com/orgs/elastic/teams/kibana-app-services) | Considering using bfetch capabilities when fetching large amounts of data. This services supports batching HTTP requests and streaming responses back. | 80 | 1 | 71 | 2 | | | [Kibana Presentation](https://github.com/orgs/elastic/teams/kibana-presentation) | Adds Canvas application to Kibana | 9 | 0 | 8 | 3 | -| | [ResponseOps](https://github.com/orgs/elastic/teams/response-ops) | The Case management system in Kibana | 82 | 0 | 66 | 29 | +| | [ResponseOps](https://github.com/orgs/elastic/teams/response-ops) | The Case management system in Kibana | 84 | 0 | 68 | 29 | | | [Vis Editors](https://github.com/orgs/elastic/teams/kibana-vis-editors) | - | 261 | 2 | 246 | 9 | | | [Kibana Core](https://github.com/orgs/elastic/teams/kibana-core) | - | 29 | 0 | 24 | 0 | | | [Cloud Security Posture](https://github.com/orgs/elastic/teams/cloud-posture-security) | The cloud security posture plugin | 18 | 0 | 2 | 3 | @@ -46,11 +46,11 @@ tags: ['contributor', 'dev', 'apidocs', 'kibana'] | | [Fleet](https://github.com/orgs/elastic/teams/fleet) | Add custom data integrations so they can be displayed in the Fleet integrations app | 102 | 0 | 83 | 1 | | | [Kibana Presentation](https://github.com/orgs/elastic/teams/kibana-presentation) | Adds the Dashboard app to Kibana | 146 | 0 | 141 | 12 | | | [App Services](https://github.com/orgs/elastic/teams/kibana-app-services) | - | 52 | 0 | 51 | 0 | -| | [App Services](https://github.com/orgs/elastic/teams/kibana-app-services) | Data services are useful for searching and querying data from Elasticsearch. Helpful utilities include: a re-usable react query bar, KQL autocomplete, async search, Data Views (Index Patterns) and field formatters. | 3117 | 34 | 2431 | 22 | +| | [App Services](https://github.com/orgs/elastic/teams/kibana-app-services) | Data services are useful for searching and querying data from Elasticsearch. Helpful utilities include: a re-usable react query bar, KQL autocomplete, async search, Data Views (Index Patterns) and field formatters. | 3119 | 34 | 2433 | 22 | | | [App Services](https://github.com/orgs/elastic/teams/kibana-app-services) | This plugin provides the ability to create data views via a modal flyout inside Kibana apps | 15 | 0 | 7 | 0 | | | [App Services](https://github.com/orgs/elastic/teams/kibana-app-services) | Reusable data view field editor across Kibana | 49 | 0 | 29 | 3 | | | [App Services](https://github.com/orgs/elastic/teams/kibana-app-services) | Data view management app | 2 | 0 | 2 | 0 | -| | [App Services](https://github.com/orgs/elastic/teams/kibana-app-services) | Data services are useful for searching and querying data from Elasticsearch. Helpful utilities include: a re-usable react query bar, KQL autocomplete, async search, Data Views (Index Patterns) and field formatters. | 960 | 0 | 203 | 0 | +| | [App Services](https://github.com/orgs/elastic/teams/kibana-app-services) | Data services are useful for searching and querying data from Elasticsearch. Helpful utilities include: a re-usable react query bar, KQL autocomplete, async search, Data Views (Index Patterns) and field formatters. | 963 | 0 | 206 | 1 | | | [Machine Learning UI](https://github.com/orgs/elastic/teams/ml-ui) | The Data Visualizer tools help you understand your data, by analyzing the metrics and fields in a log file or an existing Elasticsearch index. | 28 | 3 | 24 | 1 | | | [Stack Management](https://github.com/orgs/elastic/teams/kibana-stack-management) | - | 10 | 0 | 8 | 2 | | | [Data Discovery](https://github.com/orgs/elastic/teams/kibana-data-discovery) | This plugin contains the Discover application and the saved search embeddable. | 93 | 0 | 76 | 4 | @@ -80,7 +80,7 @@ tags: ['contributor', 'dev', 'apidocs', 'kibana'] | | [App Services](https://github.com/orgs/elastic/teams/kibana-app-services) | Index pattern fields and ambiguous values formatters | 288 | 5 | 249 | 3 | | | [Machine Learning UI](https://github.com/orgs/elastic/teams/ml-ui) | 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. | 62 | 0 | 62 | 2 | | | [@elastic/kibana-app-services](https://github.com/orgs/elastic/teams/team:AppServicesUx) | File upload, download, sharing, and serving over HTTP implementation in Kibana. | 243 | 0 | 6 | 2 | -| | [Fleet](https://github.com/orgs/elastic/teams/fleet) | - | 967 | 3 | 872 | 10 | +| | [Fleet](https://github.com/orgs/elastic/teams/fleet) | - | 965 | 3 | 870 | 10 | | | [Kibana Core](https://github.com/orgs/elastic/teams/kibana-core) | - | 68 | 0 | 14 | 5 | | globalSearchBar | [Kibana Core](https://github.com/orgs/elastic/teams/kibana-core) | - | 0 | 0 | 0 | 0 | | globalSearchProviders | [Kibana Core](https://github.com/orgs/elastic/teams/kibana-core) | - | 0 | 0 | 0 | 0 | diff --git a/api_docs/presentation_util.mdx b/api_docs/presentation_util.mdx index 8f5e4f6079ad5..1d5ccd6952462 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'presentationUtil'] --- import presentationUtilObj from './presentation_util.devdocs.json'; diff --git a/api_docs/remote_clusters.mdx b/api_docs/remote_clusters.mdx index 47166aee1522c..1251f477dfe6e 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: 2022-08-25 +date: 2022-08-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 806cba91608cc..8386f38b55b73 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: 2022-08-25 +date: 2022-08-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 f4f6009992153..d462ed4ad2f28 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: 2022-08-25 +date: 2022-08-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 fa3710bf717a3..2555504390b77 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: 2022-08-25 +date: 2022-08-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 b581d8eeeeeaa..cbbab3ef67bc0 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: 2022-08-25 +date: 2022-08-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 16c89d0cf9bc7..48ed84d34bf72 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'savedObjects'] --- import savedObjectsObj from './saved_objects.devdocs.json'; diff --git a/api_docs/saved_objects_management.mdx b/api_docs/saved_objects_management.mdx index f1d02b45f72f2..7304a111f9ec6 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: 2022-08-25 +date: 2022-08-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 9dfae6bdef8b1..eb133da2af98b 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: 2022-08-25 +date: 2022-08-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 c8898c6c9b9ed..0ebcacfa67954 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: 2022-08-25 +date: 2022-08-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 be960eb7f89e8..a5f3017978da3 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: 2022-08-25 +date: 2022-08-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 edf4738ae42ad..635ffd617cd7e 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: 2022-08-25 +date: 2022-08-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 b30e9d341fc74..66b1cb7e83609 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'screenshotting'] --- import screenshottingObj from './screenshotting.devdocs.json'; diff --git a/api_docs/security.mdx b/api_docs/security.mdx index f592b5699c353..be910312f73ca 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: 2022-08-25 +date: 2022-08-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 9f2200d922ae5..fa27f05e2beae 100644 --- a/api_docs/security_solution.devdocs.json +++ b/api_docs/security_solution.devdocs.json @@ -62,7 +62,7 @@ "label": "experimentalFeatures", "description": [], "signature": [ - "{ readonly tGridEnabled: boolean; readonly tGridEventRenderedViewEnabled: boolean; readonly excludePoliciesInFilterEnabled: boolean; readonly kubernetesEnabled: boolean; readonly disableIsolationUIPendingStatuses: boolean; readonly riskyHostsEnabled: boolean; readonly riskyUsersEnabled: boolean; readonly pendingActionResponsesWithAck: boolean; readonly policyListEnabled: boolean; readonly policyResponseInFleetEnabled: boolean; readonly threatIntelligenceEnabled: boolean; readonly previewTelemetryUrlEnabled: boolean; readonly responseActionsConsoleEnabled: boolean; readonly insightsRelatedAlertsByProcessAncestry: boolean; readonly extendedRuleExecutionLoggingEnabled: boolean; }" + "{ readonly tGridEnabled: boolean; readonly tGridEventRenderedViewEnabled: boolean; readonly excludePoliciesInFilterEnabled: boolean; readonly kubernetesEnabled: boolean; readonly disableIsolationUIPendingStatuses: boolean; readonly riskyHostsEnabled: boolean; readonly riskyUsersEnabled: boolean; readonly pendingActionResponsesWithAck: boolean; readonly policyListEnabled: boolean; readonly policyResponseInFleetEnabled: boolean; readonly threatIntelligenceEnabled: boolean; readonly entityAnalyticsDashboardEnabled: boolean; readonly previewTelemetryUrlEnabled: boolean; readonly responseActionsConsoleEnabled: boolean; readonly insightsRelatedAlertsByProcessAncestry: boolean; readonly extendedRuleExecutionLoggingEnabled: boolean; }" ], "path": "x-pack/plugins/security_solution/public/plugin.tsx", "deprecated": false @@ -1044,7 +1044,7 @@ "label": "ConfigType", "description": [], "signature": [ - "Readonly<{} & { signalsIndex: string; maxRuleImportExportSize: number; maxRuleImportPayloadBytes: number; maxTimelineImportExportSize: number; maxTimelineImportPayloadBytes: number; alertMergeStrategy: \"allFields\" | \"missingFields\" | \"noFields\"; alertIgnoreFields: string[]; enableExperimental: string[]; packagerTaskInterval: string; prebuiltRulesFromFileSystem: boolean; prebuiltRulesFromSavedObjects: boolean; }> & { experimentalFeatures: Readonly<{ tGridEnabled: boolean; tGridEventRenderedViewEnabled: boolean; excludePoliciesInFilterEnabled: boolean; kubernetesEnabled: boolean; disableIsolationUIPendingStatuses: boolean; riskyHostsEnabled: boolean; riskyUsersEnabled: boolean; pendingActionResponsesWithAck: boolean; policyListEnabled: boolean; policyResponseInFleetEnabled: boolean; threatIntelligenceEnabled: boolean; previewTelemetryUrlEnabled: boolean; responseActionsConsoleEnabled: boolean; insightsRelatedAlertsByProcessAncestry: boolean; extendedRuleExecutionLoggingEnabled: boolean; }>; }" + "Readonly<{} & { signalsIndex: string; maxRuleImportExportSize: number; maxRuleImportPayloadBytes: number; maxTimelineImportExportSize: number; maxTimelineImportPayloadBytes: number; alertMergeStrategy: \"allFields\" | \"missingFields\" | \"noFields\"; alertIgnoreFields: string[]; enableExperimental: string[]; packagerTaskInterval: string; prebuiltRulesFromFileSystem: boolean; prebuiltRulesFromSavedObjects: boolean; }> & { experimentalFeatures: Readonly<{ tGridEnabled: boolean; tGridEventRenderedViewEnabled: boolean; excludePoliciesInFilterEnabled: boolean; kubernetesEnabled: boolean; disableIsolationUIPendingStatuses: boolean; riskyHostsEnabled: boolean; riskyUsersEnabled: boolean; pendingActionResponsesWithAck: boolean; policyListEnabled: boolean; policyResponseInFleetEnabled: boolean; threatIntelligenceEnabled: boolean; entityAnalyticsDashboardEnabled: boolean; previewTelemetryUrlEnabled: boolean; responseActionsConsoleEnabled: boolean; insightsRelatedAlertsByProcessAncestry: boolean; extendedRuleExecutionLoggingEnabled: boolean; }>; }" ], "path": "x-pack/plugins/security_solution/server/config.ts", "deprecated": false, diff --git a/api_docs/security_solution.mdx b/api_docs/security_solution.mdx index 20d2810e73db6..5a3a50027845f 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'securitySolution'] --- import securitySolutionObj from './security_solution.devdocs.json'; diff --git a/api_docs/session_view.mdx b/api_docs/session_view.mdx index f1b0b4fab2df7..6cd7ccfa26c4d 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: 2022-08-25 +date: 2022-08-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 0431ccbca521a..68a8d14b3913c 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'share'] --- import shareObj from './share.devdocs.json'; diff --git a/api_docs/snapshot_restore.mdx b/api_docs/snapshot_restore.mdx index 11769ea4d6d38..b17807dd2861f 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: 2022-08-25 +date: 2022-08-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 3a9bd72f22cfe..3d8727ffef849 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: 2022-08-25 +date: 2022-08-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 1d1931e25f639..9810ea11c1054 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'stackAlerts'] --- import stackAlertsObj from './stack_alerts.devdocs.json'; diff --git a/api_docs/task_manager.mdx b/api_docs/task_manager.mdx index c01979fcd638f..1d18374d7443c 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: 2022-08-25 +date: 2022-08-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 a0e19a07f2726..a7df4dc50df10 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: 2022-08-25 +date: 2022-08-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 7406adb26dd58..59bde89398662 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'telemetryCollectionManager'] --- import telemetryCollectionManagerObj from './telemetry_collection_manager.devdocs.json'; diff --git a/api_docs/telemetry_collection_xpack.mdx b/api_docs/telemetry_collection_xpack.mdx index e283523d813b9..2b0db15b1b0fa 100644 --- a/api_docs/telemetry_collection_xpack.mdx +++ b/api_docs/telemetry_collection_xpack.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/telemetryCollectionXpack title: "telemetryCollectionXpack" image: https://source.unsplash.com/400x175/?github description: API docs for the telemetryCollectionXpack plugin -date: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'telemetryCollectionXpack'] --- import telemetryCollectionXpackObj from './telemetry_collection_xpack.devdocs.json'; diff --git a/api_docs/telemetry_management_section.mdx b/api_docs/telemetry_management_section.mdx index f38ec6b63b991..bcc0fc1c2e13d 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: 2022-08-25 +date: 2022-08-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 63d5eba82166e..2680aa2a92e2b 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'threatIntelligence'] --- import threatIntelligenceObj from './threat_intelligence.devdocs.json'; diff --git a/api_docs/timelines.devdocs.json b/api_docs/timelines.devdocs.json index 992276211171f..b1f83b8dcea42 100644 --- a/api_docs/timelines.devdocs.json +++ b/api_docs/timelines.devdocs.json @@ -768,7 +768,7 @@ "label": "getManageTimelineById", "description": [], "signature": [ - "() => Reselect.OutputParametricSelector ((state: {}, params_0: string) => { dataViewId: string | null; documentType: string; defaultColumns: (Pick<", "EuiDataGridColumn", ", \"id\" | \"display\" | \"displayAsText\" | \"initialWidth\"> & Pick<", "EuiDataGridColumn", @@ -792,7 +792,9 @@ "section": "def-public.FilterManager", "text": "FilterManager" }, - " | undefined; footerText: React.ReactNode; loadingText: React.ReactNode; queryFields: string[]; selectAll: boolean; title: string; }, (res: ", + " | undefined; footerText: React.ReactNode; loadingText: React.ReactNode; queryFields: string[]; selectAll: boolean; title: string; }) & ", + "OutputSelectorFields", + "<(args_0: ", { "pluginId": "timelines", "scope": "public", @@ -824,7 +826,7 @@ "section": "def-public.FilterManager", "text": "FilterManager" }, - " | undefined; footerText: React.ReactNode; loadingText: React.ReactNode; queryFields: string[]; selectAll: boolean; title: string; }>" + " | undefined; footerText: React.ReactNode; loadingText: React.ReactNode; queryFields: string[]; selectAll: boolean; title: string; } & { clearCache: () => void; }> & { clearCache: () => void; }" ], "path": "x-pack/plugins/timelines/public/store/t_grid/selectors.ts", "deprecated": false, diff --git a/api_docs/timelines.mdx b/api_docs/timelines.mdx index 910a0beb3fcd6..b7e477ddbff48 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: 2022-08-25 +date: 2022-08-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 078bbf107310f..1955a1aeb40e0 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: 2022-08-25 +date: 2022-08-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 861fd29fb1981..49e8350b8a7d0 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: 2022-08-25 +date: 2022-08-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 84a2623f5a0c9..abec400ea3e92 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: 2022-08-25 +date: 2022-08-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 d0aaccdc6fa27..5babd1ef9b8c5 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'uiActionsEnhanced'] --- import uiActionsEnhancedObj from './ui_actions_enhanced.devdocs.json'; diff --git a/api_docs/unified_field_list.mdx b/api_docs/unified_field_list.mdx index 4ef72a4d459d8..6dae65ba1b9bc 100644 --- a/api_docs/unified_field_list.mdx +++ b/api_docs/unified_field_list.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/unifiedFieldList title: "unifiedFieldList" image: https://source.unsplash.com/400x175/?github description: API docs for the unifiedFieldList plugin -date: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'unifiedFieldList'] --- import unifiedFieldListObj from './unified_field_list.devdocs.json'; diff --git a/api_docs/unified_search.mdx b/api_docs/unified_search.mdx index b655a2f3cb6fa..ab1663a92bb74 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: 2022-08-25 +date: 2022-08-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 dec2a17eac39d..e1aa55f00e67f 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'unifiedSearch.autocomplete'] --- import unifiedSearchAutocompleteObj from './unified_search_autocomplete.devdocs.json'; diff --git a/api_docs/url_forwarding.mdx b/api_docs/url_forwarding.mdx index 56fd8bd91c9d1..be6d5bf88b51b 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: 2022-08-25 +date: 2022-08-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 df043bf15019e..cc79236e95014 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: 2022-08-25 +date: 2022-08-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 0f08c0ee2306a..121eb4f1bd9c2 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: 2022-08-25 +date: 2022-08-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 f84ff31d6fbae..a1f83968f2db5 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: 2022-08-25 +date: 2022-08-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 1138f795098dc..6c7c46e4aaac3 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: 2022-08-25 +date: 2022-08-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 8d99493a58c0b..752dddd2bd01a 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: 2022-08-25 +date: 2022-08-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 61693a0b9cb4a..6df3539b33350 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: 2022-08-25 +date: 2022-08-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 8cd6c3b678c06..b6de14724a90f 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: 2022-08-25 +date: 2022-08-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 ceda83d61a25a..a0d7fc8f29bf1 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: 2022-08-25 +date: 2022-08-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 d56f0d281da37..894e312ee0ac6 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: 2022-08-25 +date: 2022-08-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 ce05ba4845f54..fa0386973a687 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: 2022-08-25 +date: 2022-08-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 c71aeb39c3cbc..96766a96ff7be 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: 2022-08-25 +date: 2022-08-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 469a6cca57efd..170e2b7595edd 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: 2022-08-25 +date: 2022-08-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 10ae90e72dda3..51ea108618509 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: 2022-08-25 +date: 2022-08-26 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'visualizations'] --- import visualizationsObj from './visualizations.devdocs.json'; From 4f65c099bcdbfc286a418696b85352fa2f8162c5 Mon Sep 17 00:00:00 2001 From: James Gowdy Date: Fri, 26 Aug 2022 08:49:37 +0100 Subject: [PATCH 11/28] [ML] Quickly create ML jobs from lens visualizations (#136421) * [ML] Quickly create ML jobs from lens visualizations * adding additional settings * adding model plot for single metric jobs * adding results link * form logic improvements * translations * translations * translations * changing view results link generation * handling opening already open jobs * fixing count detector * removing unused file * improving error displaying * updating tests * removing unused test code * deleting jobs after test * code clean up * fixing issue with layers sharing resources * removing fragment * moving code about * minor changes based on review * translations * updating results link for non-running job * renaming variables * refactoring job creation code into class * using context refactor * renaming things * catching isCompatible errors * fixing behaviour in canvas * removing comment * small refactor moving code * handling error * fixing typo * further refactoring based on review * adding vis title to description * white layer panels * translations --- x-pack/plugins/ml/common/constants/new_job.ts | 2 + x-pack/plugins/ml/common/types/errors.ts | 20 - x-pack/plugins/ml/common/util/job_utils.ts | 4 + .../convert_lens_to_job_action.tsx | 34 -- .../jobs/new_job/job_from_lens/create_job.ts | 413 --------------- .../jobs/new_job/job_from_lens/index.ts | 12 +- .../new_job/job_from_lens/quick_create_job.ts | 333 +++++++++++++ .../new_job/job_from_lens/route_resolver.ts | 21 +- .../jobs/new_job/job_from_lens/utils.ts | 44 +- .../job_from_lens/visualization_extractor.ts | 224 +++++++++ .../preconfigured_job_redirect.ts | 2 + .../services/ml_api_service/index.ts | 14 +- .../common/resolve_job_selection.tsx | 14 +- .../ml/public/embeddables/lens/context.ts | 23 + .../flyout.tsx | 51 +- .../flyout_body.tsx | 135 ----- .../layer/compatible_layer.tsx | 471 ++++++++++++++++++ .../layer/incompatible_layer.tsx | 43 ++ .../layer/index.ts | 7 + .../layer/layer.tsx | 59 +++ .../style.scss | 3 - .../public/embeddables/lens/show_flyout.tsx | 37 +- .../ui_actions/open_lens_vis_in_ml_action.tsx | 10 +- .../translations/translations/fr-FR.json | 2 - .../translations/translations/ja-JP.json | 2 - .../translations/translations/zh-CN.json | 2 - .../apps/ml/anomaly_detection/index.ts | 1 + .../apps/ml/anomaly_detection/lens_to_ml.ts | 146 ++---- .../lens_to_ml_with_wizard.ts | 222 +++++++++ x-pack/test/functional/services/ml/index.ts | 2 +- .../services/ml/lens_visualizations.ts | 45 +- 31 files changed, 1595 insertions(+), 803 deletions(-) delete mode 100644 x-pack/plugins/ml/common/types/errors.ts delete mode 100644 x-pack/plugins/ml/public/application/jobs/new_job/job_from_lens/convert_lens_to_job_action.tsx delete mode 100644 x-pack/plugins/ml/public/application/jobs/new_job/job_from_lens/create_job.ts create mode 100644 x-pack/plugins/ml/public/application/jobs/new_job/job_from_lens/quick_create_job.ts create mode 100644 x-pack/plugins/ml/public/application/jobs/new_job/job_from_lens/visualization_extractor.ts create mode 100644 x-pack/plugins/ml/public/embeddables/lens/context.ts delete mode 100644 x-pack/plugins/ml/public/embeddables/lens/lens_vis_layer_selection_flyout/flyout_body.tsx create mode 100644 x-pack/plugins/ml/public/embeddables/lens/lens_vis_layer_selection_flyout/layer/compatible_layer.tsx create mode 100644 x-pack/plugins/ml/public/embeddables/lens/lens_vis_layer_selection_flyout/layer/incompatible_layer.tsx create mode 100644 x-pack/plugins/ml/public/embeddables/lens/lens_vis_layer_selection_flyout/layer/index.ts create mode 100644 x-pack/plugins/ml/public/embeddables/lens/lens_vis_layer_selection_flyout/layer/layer.tsx delete mode 100644 x-pack/plugins/ml/public/embeddables/lens/lens_vis_layer_selection_flyout/style.scss create mode 100644 x-pack/test/functional/apps/ml/anomaly_detection/lens_to_ml_with_wizard.ts diff --git a/x-pack/plugins/ml/common/constants/new_job.ts b/x-pack/plugins/ml/common/constants/new_job.ts index 800b81d473726..c029394798463 100644 --- a/x-pack/plugins/ml/common/constants/new_job.ts +++ b/x-pack/plugins/ml/common/constants/new_job.ts @@ -21,6 +21,8 @@ export enum CREATED_BY_LABEL { CATEGORIZATION = 'categorization-wizard', RARE = 'rare-wizard', APM_TRANSACTION = 'ml-module-apm-transaction', + SINGLE_METRIC_FROM_LENS = 'single-metric-wizard-from-lens', + MULTI_METRIC_FROM_LENS = 'multi-metric-wizard-from-lens', } export const DEFAULT_MODEL_MEMORY_LIMIT = '10MB'; diff --git a/x-pack/plugins/ml/common/types/errors.ts b/x-pack/plugins/ml/common/types/errors.ts deleted file mode 100644 index 415c9d9f4c74c..0000000000000 --- a/x-pack/plugins/ml/common/types/errors.ts +++ /dev/null @@ -1,20 +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 interface ErrorResponse { - body: { - statusCode: number; - error: string; - message: string; - attributes?: any; - }; - name: string; -} - -export function isErrorResponse(arg: any): arg is ErrorResponse { - return arg?.body?.error !== undefined && arg?.body?.message !== undefined; -} diff --git a/x-pack/plugins/ml/common/util/job_utils.ts b/x-pack/plugins/ml/common/util/job_utils.ts index d7faf732a7c84..fc600afaa233a 100644 --- a/x-pack/plugins/ml/common/util/job_utils.ts +++ b/x-pack/plugins/ml/common/util/job_utils.ts @@ -410,6 +410,10 @@ export function prefixDatafeedId(datafeedId: string, prefix: string): string { : `datafeed-${prefix}${datafeedId}`; } +export function createDatafeedId(jobId: string) { + return `datafeed-${jobId}`; +} + // Returns a name which is safe to use in elasticsearch aggregations for the supplied // field name. Aggregation names must be alpha-numeric and can only contain '_' and '-' characters, // so if the supplied field names contains disallowed characters, the provided index diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/job_from_lens/convert_lens_to_job_action.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/job_from_lens/convert_lens_to_job_action.tsx deleted file mode 100644 index ab00fa7e2d474..0000000000000 --- a/x-pack/plugins/ml/public/application/jobs/new_job/job_from_lens/convert_lens_to_job_action.tsx +++ /dev/null @@ -1,34 +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 { SharePluginStart } from '@kbn/share-plugin/public'; -import type { Embeddable } from '@kbn/lens-plugin/public'; -import { getJobsItemsFromEmbeddable } from './utils'; -import { ML_PAGES, ML_APP_LOCATOR } from '../../../../../common/constants/locator'; - -export async function convertLensToADJob( - embeddable: Embeddable, - share: SharePluginStart, - layerIndex?: number -) { - const { query, filters, to, from, vis } = getJobsItemsFromEmbeddable(embeddable); - const locator = share.url.locators.get(ML_APP_LOCATOR); - - const url = await locator?.getUrl({ - page: ML_PAGES.ANOMALY_DETECTION_CREATE_JOB_FROM_LENS, - pageState: { - vis: vis as any, - from, - to, - query, - filters, - layerIndex, - }, - }); - - window.open(url, '_blank'); -} diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/job_from_lens/create_job.ts b/x-pack/plugins/ml/public/application/jobs/new_job/job_from_lens/create_job.ts deleted file mode 100644 index 35654fbc28786..0000000000000 --- a/x-pack/plugins/ml/public/application/jobs/new_job/job_from_lens/create_job.ts +++ /dev/null @@ -1,413 +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 { mergeWith } from 'lodash'; -import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; -import type { IUiSettingsClient, SavedObjectReference } from '@kbn/core/public'; -import type { DataViewsContract } from '@kbn/data-views-plugin/public'; - -import { Filter, Query, DataViewBase } from '@kbn/es-query'; - -import type { - Embeddable, - LensPublicStart, - LensSavedObjectAttributes, - FieldBasedIndexPatternColumn, - XYDataLayerConfig, - IndexPatternPersistedState, - IndexPatternLayer, - XYLayerConfig, -} from '@kbn/lens-plugin/public'; -import { layerTypes } from '@kbn/lens-plugin/public'; -import type { TimefilterContract } from '@kbn/data-plugin/public'; - -import { i18n } from '@kbn/i18n'; - -import type { JobCreatorType } from '../common/job_creator'; -import { createEmptyJob, createEmptyDatafeed } from '../common/job_creator/util/default_configs'; -import { stashJobForCloning } from '../common/job_creator/util/general'; -import { CREATED_BY_LABEL, DEFAULT_BUCKET_SPAN } from '../../../../../common/constants/new_job'; -import { ErrorType } from '../../../../../common/util/errors'; -import { createQueries } from '../utils/new_job_utils'; -import { - getVisTypeFactory, - isCompatibleLayer, - hasIncompatibleProperties, - hasSourceField, - isTermsField, - isCompatibleSplitFieldType, - getMlFunction, - getJobsItemsFromEmbeddable, -} from './utils'; - -type VisualizationType = Awaited>[number]; - -export interface LayerResult { - id: string; - layerType: typeof layerTypes[keyof typeof layerTypes]; - label: string; - icon: VisualizationType['icon']; - isCompatible: boolean; - jobWizardType: CREATED_BY_LABEL | null; - error?: ErrorType; -} - -export async function canCreateAndStashADJob( - vis: LensSavedObjectAttributes, - startString: string, - endString: string, - query: Query, - filters: Filter[], - dataViewClient: DataViewsContract, - kibanaConfig: IUiSettingsClient, - timeFilter: TimefilterContract, - layerIndex: number | undefined -) { - try { - const { jobConfig, datafeedConfig, createdBy } = await createADJobFromLensSavedObject( - vis, - query, - filters, - dataViewClient, - kibanaConfig, - layerIndex - ); - - let start: number | undefined; - let end: number | undefined; - let includeTimeRange = true; - - try { - // attempt to parse the start and end dates. - // if start and end values cannot be determined - // instruct the job cloning code to auto-select the - // full time range for the index. - const { min, max } = timeFilter.calculateBounds({ to: endString, from: startString }); - start = min?.valueOf(); - end = max?.valueOf(); - - if (start === undefined || end === undefined || isNaN(start) || isNaN(end)) { - throw Error( - i18n.translate('xpack.ml.newJob.fromLens.createJob.error.timeRange', { - defaultMessage: 'Incompatible time range', - }) - ); - } - } catch (error) { - // eslint-disable-next-line no-console - console.error(error); - includeTimeRange = false; - start = undefined; - end = undefined; - } - - // add job config and start and end dates to the - // job cloning stash, so they can be used - // by the new job wizards - stashJobForCloning( - { - jobConfig, - datafeedConfig, - createdBy, - start, - end, - } as JobCreatorType, - true, - includeTimeRange, - !includeTimeRange - ); - } catch (error) { - // eslint-disable-next-line no-console - console.error(error); - } -} - -export async function getResultLayersFromEmbeddable( - embeddable: Embeddable, - dataViewClient: DataViewsContract, - lens: LensPublicStart -): Promise { - const { vis } = getJobsItemsFromEmbeddable(embeddable); - return getLayers(vis, dataViewClient, lens); -} - -async function getLayers( - vis: LensSavedObjectAttributes, - dataViewClient: DataViewsContract, - lens: LensPublicStart -): Promise { - const visualization = vis.state.visualization as { layers: XYLayerConfig[] }; - const getVisType = await getVisTypeFactory(lens); - - const layers: LayerResult[] = await Promise.all( - visualization.layers - .filter(({ layerType }) => layerType === layerTypes.DATA) // remove non chart layers - .map(async (layer) => { - const { icon, label } = getVisType(layer); - try { - const { fields, splitField } = await extractFields(layer, vis, dataViewClient); - const detectors = createDetectors(fields, splitField); - const createdBy = - splitField || detectors.length > 1 - ? CREATED_BY_LABEL.MULTI_METRIC - : CREATED_BY_LABEL.SINGLE_METRIC; - - return { - id: layer.layerId, - layerType: layer.layerType, - label, - icon, - jobWizardType: createdBy, - isCompatible: true, - }; - } catch (error) { - return { - id: layer.layerId, - layerType: layer.layerType, - label, - icon, - jobWizardType: null, - isCompatible: false, - error, - }; - } - }) - ); - - return layers; -} - -async function createADJobFromLensSavedObject( - vis: LensSavedObjectAttributes, - query: Query, - filters: Filter[], - dataViewClient: DataViewsContract, - kibanaConfig: IUiSettingsClient, - layerIndex?: number -) { - const visualization = vis.state.visualization as { layers: XYDataLayerConfig[] }; - - const compatibleLayers = visualization.layers.filter(isCompatibleLayer); - - const selectedLayer = - layerIndex !== undefined ? visualization.layers[layerIndex] : compatibleLayers[0]; - - const { fields, timeField, splitField, dataView } = await extractFields( - selectedLayer, - vis, - dataViewClient - ); - - const jobConfig = createEmptyJob(); - const datafeedConfig = createEmptyDatafeed(dataView.title); - - const combinedFiltersAndQueries = combineQueriesAndFilters( - { query, filters }, - { query: vis.state.query, filters: vis.state.filters }, - dataView, - kibanaConfig - ); - - datafeedConfig.query = combinedFiltersAndQueries; - - jobConfig.analysis_config.detectors = createDetectors(fields, splitField); - - jobConfig.data_description.time_field = timeField.sourceField; - jobConfig.analysis_config.bucket_span = DEFAULT_BUCKET_SPAN; - if (splitField) { - jobConfig.analysis_config.influencers = [splitField.sourceField]; - } - - const createdBy = - splitField || jobConfig.analysis_config.detectors.length > 1 - ? CREATED_BY_LABEL.MULTI_METRIC - : CREATED_BY_LABEL.SINGLE_METRIC; - - return { - jobConfig, - datafeedConfig, - createdBy, - }; -} - -async function extractFields( - layer: XYLayerConfig, - vis: LensSavedObjectAttributes, - dataViewClient: DataViewsContract -) { - if (!isCompatibleLayer(layer)) { - throw Error( - i18n.translate('xpack.ml.newJob.fromLens.createJob.error.incompatibleLayerType', { - defaultMessage: 'Layer is incompatible. Only chart layers can be used.', - }) - ); - } - - const indexpattern = vis.state.datasourceStates.indexpattern as IndexPatternPersistedState; - const compatibleIndexPatternLayer = Object.entries(indexpattern.layers).find( - ([id]) => layer.layerId === id - ); - if (compatibleIndexPatternLayer === undefined) { - throw Error( - i18n.translate('xpack.ml.newJob.fromLens.createJob.error.noCompatibleLayers', { - defaultMessage: - 'Visualization does not contain any layers which can be used for creating an anomaly detection job.', - }) - ); - } - - const [layerId, columnsLayer] = compatibleIndexPatternLayer; - - const columns = getColumns(columnsLayer, layer); - const timeField = Object.values(columns).find(({ dataType }) => dataType === 'date'); - if (timeField === undefined) { - throw Error( - i18n.translate('xpack.ml.newJob.fromLens.createJob.error.noDateField', { - defaultMessage: 'Cannot find a date field.', - }) - ); - } - - const fields = layer.accessors.map((a) => columns[a]); - - const splitField = layer.splitAccessor ? columns[layer.splitAccessor] : null; - - if ( - splitField !== null && - isTermsField(splitField) && - splitField.params.secondaryFields?.length - ) { - throw Error( - i18n.translate('xpack.ml.newJob.fromLens.createJob.error.splitFieldHasMultipleFields', { - defaultMessage: 'Selected split field contains more than one field.', - }) - ); - } - - if (splitField !== null && isCompatibleSplitFieldType(splitField) === false) { - throw Error( - i18n.translate('xpack.ml.newJob.fromLens.createJob.error.splitFieldMustBeString', { - defaultMessage: 'Selected split field type must be string.', - }) - ); - } - - const dataView = await getDataViewFromLens(vis.references, layerId, dataViewClient); - if (dataView === null) { - throw Error( - i18n.translate('xpack.ml.newJob.fromLens.createJob.error.noDataViews', { - defaultMessage: 'No data views can be found in the visualization.', - }) - ); - } - - if (timeField.sourceField !== dataView.timeFieldName) { - throw Error( - i18n.translate('xpack.ml.newJob.fromLens.createJob.error.timeFieldNotInDataView', { - defaultMessage: - 'Selected time field must be the default time field configured for data view.', - }) - ); - } - - return { fields, timeField, splitField, dataView }; -} - -function createDetectors( - fields: FieldBasedIndexPatternColumn[], - splitField: FieldBasedIndexPatternColumn | null -) { - return fields.map(({ operationType, sourceField }) => { - return { - function: getMlFunction(operationType), - field_name: sourceField, - ...(splitField ? { partition_field_name: splitField.sourceField } : {}), - }; - }); -} - -async function getDataViewFromLens( - references: SavedObjectReference[], - layerId: string, - dataViewClient: DataViewsContract -) { - const dv = references.find( - (r) => r.type === 'index-pattern' && r.name === `indexpattern-datasource-layer-${layerId}` - ); - if (!dv) { - return null; - } - return dataViewClient.get(dv.id); -} - -function getColumns( - { columns }: Omit, - layer: XYDataLayerConfig -) { - layer.accessors.forEach((a) => { - const col = columns[a]; - // fail early if any of the cols being used as accessors - // contain functions we don't support - return col.dataType !== 'date' && getMlFunction(col.operationType); - }); - - if (Object.values(columns).some((c) => hasSourceField(c) === false)) { - throw Error( - i18n.translate('xpack.ml.newJob.fromLens.createJob.error.colsNoSourceField', { - defaultMessage: 'Some columns do not contain a source field.', - }) - ); - } - - if (Object.values(columns).some((c) => hasIncompatibleProperties(c) === true)) { - throw Error( - i18n.translate('xpack.ml.newJob.fromLens.createJob.error.colsUsingFilterTimeSift', { - defaultMessage: - 'Columns contain settings which are incompatible with ML detectors, time shift and filter by are not supported.', - }) - ); - } - - return columns as Record; -} - -function combineQueriesAndFilters( - dashboard: { query: Query; filters: Filter[] }, - vis: { query: Query; filters: Filter[] }, - dataView: DataViewBase, - kibanaConfig: IUiSettingsClient -): estypes.QueryDslQueryContainer { - const { combinedQuery: dashboardQueries } = createQueries( - { - query: dashboard.query, - filter: dashboard.filters, - }, - dataView, - kibanaConfig - ); - - const { combinedQuery: visQueries } = createQueries( - { - query: vis.query, - filter: vis.filters, - }, - dataView, - kibanaConfig - ); - - const mergedQueries = mergeWith( - dashboardQueries, - visQueries, - (objValue: estypes.QueryDslQueryContainer, srcValue: estypes.QueryDslQueryContainer) => { - if (Array.isArray(objValue)) { - return objValue.concat(srcValue); - } - } - ); - - return mergedQueries; -} diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/job_from_lens/index.ts b/x-pack/plugins/ml/public/application/jobs/new_job/job_from_lens/index.ts index 373e445748ab1..0caf7b9704bf0 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/job_from_lens/index.ts +++ b/x-pack/plugins/ml/public/application/jobs/new_job/job_from_lens/index.ts @@ -5,8 +5,12 @@ * 2.0. */ -export type { LayerResult } from './create_job'; +export type { LayerResult } from './visualization_extractor'; +export { VisualizationExtractor } from './visualization_extractor'; export { resolver } from './route_resolver'; -export { getResultLayersFromEmbeddable } from './create_job'; -export { convertLensToADJob } from './convert_lens_to_job_action'; -export { getJobsItemsFromEmbeddable, isCompatibleVisualizationType } from './utils'; +export { QuickJobCreator } from './quick_create_job'; +export { + getJobsItemsFromEmbeddable, + isCompatibleVisualizationType, + redirectToADJobWizards, +} from './utils'; 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 new file mode 100644 index 0000000000000..a9585fe617365 --- /dev/null +++ b/x-pack/plugins/ml/public/application/jobs/new_job/job_from_lens/quick_create_job.ts @@ -0,0 +1,333 @@ +/* + * 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 { mergeWith, uniqBy, isEqual } from 'lodash'; +import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import type { Embeddable } from '@kbn/lens-plugin/public'; +import type { IUiSettingsClient } from '@kbn/core/public'; +import type { DataViewsContract } from '@kbn/data-views-plugin/public'; +import type { TimefilterContract } from '@kbn/data-plugin/public'; + +import { Filter, Query, DataViewBase } from '@kbn/es-query'; + +import type { LensSavedObjectAttributes, XYDataLayerConfig } from '@kbn/lens-plugin/public'; + +import { i18n } from '@kbn/i18n'; + +import type { JobCreatorType } from '../common/job_creator'; +import { createEmptyJob, createEmptyDatafeed } from '../common/job_creator/util/default_configs'; +import { stashJobForCloning } from '../common/job_creator/util/general'; +import type { ErrorType } from '../../../../../common/util/errors'; +import { createDatafeedId } from '../../../../../common/util/job_utils'; +import type { MlApiServices } from '../../../services/ml_api_service'; +import { + CREATED_BY_LABEL, + DEFAULT_BUCKET_SPAN, + JOB_TYPE, +} from '../../../../../common/constants/new_job'; +import { createQueries } from '../utils/new_job_utils'; +import { isCompatibleLayer, createDetectors, getJobsItemsFromEmbeddable } from './utils'; +import { VisualizationExtractor } from './visualization_extractor'; + +interface CreationState { + success: boolean; + error?: ErrorType; +} + +interface CreateState { + jobCreated: CreationState; + datafeedCreated: CreationState; + jobOpened: CreationState; + datafeedStarted: CreationState; +} + +export class QuickJobCreator { + constructor( + private dataViewClient: DataViewsContract, + private kibanaConfig: IUiSettingsClient, + private timeFilter: TimefilterContract, + private mlApiServices: MlApiServices + ) {} + + public async createAndSaveJob( + jobId: string, + bucketSpan: string, + embeddable: Embeddable, + startJob: boolean, + runInRealTime: boolean, + layerIndex: number + ): Promise { + const { query, filters, to, from, vis } = getJobsItemsFromEmbeddable(embeddable); + if (query === undefined || filters === undefined) { + throw new Error('Cannot create job, query and filters are undefined'); + } + + const { jobConfig, datafeedConfig, start, end, jobType } = await this.createJob( + vis, + from, + to, + query, + filters, + bucketSpan, + + layerIndex + ); + const job = { + ...jobConfig, + job_id: jobId, + custom_settings: { + created_by: + jobType === JOB_TYPE.SINGLE_METRIC + ? CREATED_BY_LABEL.SINGLE_METRIC_FROM_LENS + : CREATED_BY_LABEL.MULTI_METRIC_FROM_LENS, + }, + }; + + const datafeedId = createDatafeedId(jobId); + const datafeed = { ...datafeedConfig, job_id: jobId, datafeed_id: datafeedId }; + + const result: CreateState = { + jobCreated: { success: false }, + datafeedCreated: { success: false }, + jobOpened: { success: false }, + datafeedStarted: { success: false }, + }; + + try { + await this.mlApiServices.addJob({ jobId: job.job_id, job }); + } catch (error) { + result.jobCreated.error = error; + return result; + } + result.jobCreated.success = true; + + try { + await this.mlApiServices.addDatafeed({ datafeedId, datafeedConfig: datafeed }); + } catch (error) { + result.datafeedCreated.error = error; + return result; + } + result.datafeedCreated.success = true; + + if (startJob) { + try { + await this.mlApiServices.openJob({ jobId }); + } catch (error) { + // job may already be open, so ignore 409 error. + if (error.body.statusCode !== 409) { + result.jobOpened.error = error; + return result; + } + } + result.jobOpened.success = true; + + try { + await this.mlApiServices.startDatafeed({ + datafeedId, + start, + ...(runInRealTime ? {} : { end }), + }); + } catch (error) { + result.datafeedStarted.error = error; + return result; + } + result.datafeedStarted.success = true; + } + + return result; + } + public async createAndStashADJob( + vis: LensSavedObjectAttributes, + startString: string, + endString: string, + query: Query, + filters: Filter[], + layerIndex: number | undefined + ) { + try { + const { jobConfig, datafeedConfig, jobType, start, end, includeTimeRange } = + await this.createJob( + vis, + startString, + endString, + query, + filters, + DEFAULT_BUCKET_SPAN, + layerIndex + ); + + // add job config and start and end dates to the + // job cloning stash, so they can be used + // by the new job wizards + stashJobForCloning( + { + jobConfig, + datafeedConfig, + createdBy: + jobType === JOB_TYPE.SINGLE_METRIC + ? CREATED_BY_LABEL.SINGLE_METRIC + : CREATED_BY_LABEL.MULTI_METRIC, + start, + end, + } as JobCreatorType, + true, + includeTimeRange, + !includeTimeRange + ); + } catch (error) { + // eslint-disable-next-line no-console + console.error(error); + } + } + + async createJob( + vis: LensSavedObjectAttributes, + startString: string, + endString: string, + query: Query, + filters: Filter[], + bucketSpan: string, + layerIndex: number | undefined + ) { + const { jobConfig, datafeedConfig, jobType } = await this.createADJobFromLensSavedObject( + vis, + query, + filters, + bucketSpan, + layerIndex + ); + + let start: number | undefined; + let end: number | undefined; + let includeTimeRange = true; + + try { + // attempt to parse the start and end dates. + // if start and end values cannot be determined + // instruct the job cloning code to auto-select the + // full time range for the index. + const { min, max } = this.timeFilter.calculateBounds({ to: endString, from: startString }); + start = min?.valueOf(); + end = max?.valueOf(); + + if (start === undefined || end === undefined || isNaN(start) || isNaN(end)) { + throw Error( + i18n.translate('xpack.ml.newJob.fromLens.createJob.error.timeRange', { + defaultMessage: 'Incompatible time range', + }) + ); + } + } catch (error) { + // eslint-disable-next-line no-console + console.error(error); + includeTimeRange = false; + start = undefined; + end = undefined; + } + + return { + jobConfig, + datafeedConfig, + jobType, + start, + end, + includeTimeRange, + }; + } + + private async createADJobFromLensSavedObject( + vis: LensSavedObjectAttributes, + query: Query, + filters: Filter[], + bucketSpan: string, + layerIndex?: number + ) { + const visualization = vis.state.visualization as { layers: XYDataLayerConfig[] }; + + const compatibleLayers = visualization.layers.filter(isCompatibleLayer); + + const selectedLayer = + layerIndex !== undefined ? visualization.layers[layerIndex] : compatibleLayers[0]; + + const visExtractor = new VisualizationExtractor(this.dataViewClient); + const { fields, timeField, splitField, dataView } = await visExtractor.extractFields( + selectedLayer, + vis + ); + + const jobConfig = createEmptyJob(); + const datafeedConfig = createEmptyDatafeed(dataView.title); + + const combinedFiltersAndQueries = this.combineQueriesAndFilters( + { query, filters }, + { query: vis.state.query, filters: vis.state.filters }, + dataView + ); + + datafeedConfig.query = combinedFiltersAndQueries; + + jobConfig.analysis_config.detectors = createDetectors(fields, splitField); + + jobConfig.data_description.time_field = timeField.sourceField; + jobConfig.analysis_config.bucket_span = bucketSpan; + if (splitField) { + jobConfig.analysis_config.influencers = [splitField.sourceField]; + } + const isSingleMetric = splitField === null && jobConfig.analysis_config.detectors.length === 1; + const jobType = isSingleMetric ? JOB_TYPE.SINGLE_METRIC : JOB_TYPE.MULTI_METRIC; + + if (isSingleMetric) { + jobConfig.model_plot_config = { + enabled: true, + annotations_enabled: true, + }; + } + + return { + jobConfig, + datafeedConfig, + jobType, + }; + } + + private combineQueriesAndFilters( + dashboard: { query: Query; filters: Filter[] }, + vis: { query: Query; filters: Filter[] }, + dataView: DataViewBase + ): estypes.QueryDslQueryContainer { + const { combinedQuery: dashboardQueries } = createQueries( + { + query: dashboard.query, + filter: dashboard.filters, + }, + dataView, + this.kibanaConfig + ); + + const { combinedQuery: visQueries } = createQueries( + { + query: vis.query, + filter: vis.filters, + }, + dataView, + this.kibanaConfig + ); + + const mergedQueries = mergeWith( + dashboardQueries, + visQueries, + (objValue: estypes.QueryDslQueryContainer, srcValue: estypes.QueryDslQueryContainer) => { + if (Array.isArray(objValue)) { + const combinedQuery = objValue.concat(srcValue); + return uniqBy(combinedQuery, isEqual); + } + } + ); + + return mergedQueries; + } +} diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/job_from_lens/route_resolver.ts b/x-pack/plugins/ml/public/application/jobs/new_job/job_from_lens/route_resolver.ts index a9819812601fa..df487380044ae 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/job_from_lens/route_resolver.ts +++ b/x-pack/plugins/ml/public/application/jobs/new_job/job_from_lens/route_resolver.ts @@ -9,7 +9,9 @@ import rison from 'rison-node'; import type { Query } from '@kbn/es-query'; import { Filter } from '@kbn/es-query'; import type { LensSavedObjectAttributes } from '@kbn/lens-plugin/public'; -import { canCreateAndStashADJob } from './create_job'; +import { QuickJobCreator } from './quick_create_job'; +import { ml } from '../../../services/ml_api_service'; + import { getUiSettings, getDataViews, @@ -68,21 +70,8 @@ export async function resolver( layerIndex = undefined; } - const dataViewClient = getDataViews(); - const kibanaConfig = getUiSettings(); - const timeFilter = getTimefilter(); - - await canCreateAndStashADJob( - vis, - from, - to, - query, - filters, - dataViewClient, - kibanaConfig, - timeFilter, - layerIndex - ); + const jobCreator = new QuickJobCreator(getDataViews(), getUiSettings(), getTimefilter(), ml); + await jobCreator.createAndStashADJob(vis, from, to, query, filters, layerIndex); } async function getLensSavedObject(id: string) { diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/job_from_lens/utils.ts b/x-pack/plugins/ml/public/application/jobs/new_job/job_from_lens/utils.ts index d2440fa756a80..cec998e1262bc 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/job_from_lens/utils.ts +++ b/x-pack/plugins/ml/public/application/jobs/new_job/job_from_lens/utils.ts @@ -18,9 +18,12 @@ import type { XYLayerConfig, DataType, } from '@kbn/lens-plugin/public'; +import type { SerializableRecord } from '@kbn/utility-types'; +import type { SharePluginStart } from '@kbn/share-plugin/public'; import { layerTypes } from '@kbn/lens-plugin/public'; import { KBN_FIELD_TYPES } from '@kbn/data-plugin/public'; +import { ML_PAGES, ML_APP_LOCATOR } from '../../../../../common/constants/locator'; import { ML_JOB_AGGREGATION } from '../../../../../common/constants/aggregation_types'; export const COMPATIBLE_SERIES_TYPES: SeriesType[] = [ @@ -44,8 +47,32 @@ export const COMPATIBLE_SPLIT_FIELD_TYPES: DataType[] = [ KBN_FIELD_TYPES.IP, ]; +export async function redirectToADJobWizards( + embeddable: Embeddable, + layerIndex: number, + share: SharePluginStart +) { + const { query, filters, to, from, vis } = getJobsItemsFromEmbeddable(embeddable); + const locator = share.url.locators.get(ML_APP_LOCATOR); + + const url = await locator?.getUrl({ + page: ML_PAGES.ANOMALY_DETECTION_CREATE_JOB_FROM_LENS, + pageState: { + vis: vis as unknown as SerializableRecord, + from, + to, + query, + filters, + layerIndex, + }, + }); + + window.open(url, '_blank'); +} + export function getJobsItemsFromEmbeddable(embeddable: Embeddable) { - const { query, filters, timeRange } = embeddable.getInput(); + const { filters, timeRange, ...input } = embeddable.getInput(); + const query = input.query === undefined ? { query: '', language: 'kuery' } : input.query; if (timeRange === undefined) { throw Error( @@ -183,3 +210,18 @@ export function isCompatibleSplitFieldType(column: GenericIndexPatternColumn) { export function hasIncompatibleProperties(column: GenericIndexPatternColumn) { return 'timeShift' in column || 'filter' in column; } + +export function createDetectors( + fields: FieldBasedIndexPatternColumn[], + splitField: FieldBasedIndexPatternColumn | null +) { + return fields.map(({ operationType, sourceField }) => { + const func = getMlFunction(operationType); + return { + function: func, + // don't use the source field if the detector is count + ...(func === 'count' ? {} : { field_name: sourceField }), + ...(splitField ? { partition_field_name: splitField.sourceField } : {}), + }; + }); +} diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/job_from_lens/visualization_extractor.ts b/x-pack/plugins/ml/public/application/jobs/new_job/job_from_lens/visualization_extractor.ts new file mode 100644 index 0000000000000..d3fe88a390c1e --- /dev/null +++ b/x-pack/plugins/ml/public/application/jobs/new_job/job_from_lens/visualization_extractor.ts @@ -0,0 +1,224 @@ +/* + * 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/public'; +import type { DataViewsContract } from '@kbn/data-views-plugin/public'; + +import type { + Embeddable, + LensPublicStart, + LensSavedObjectAttributes, + FieldBasedIndexPatternColumn, + XYDataLayerConfig, + IndexPatternPersistedState, + IndexPatternLayer, + XYLayerConfig, +} from '@kbn/lens-plugin/public'; +import { layerTypes } from '@kbn/lens-plugin/public'; + +import { i18n } from '@kbn/i18n'; + +import { JOB_TYPE } from '../../../../../common/constants/new_job'; +import { ErrorType } from '../../../../../common/util/errors'; +import { + getVisTypeFactory, + isCompatibleLayer, + hasIncompatibleProperties, + hasSourceField, + isTermsField, + isCompatibleSplitFieldType, + getMlFunction, + getJobsItemsFromEmbeddable, + createDetectors, +} from './utils'; + +type VisualizationType = Awaited>[number]; + +export interface LayerResult { + id: string; + layerType: typeof layerTypes[keyof typeof layerTypes]; + label: string; + icon: VisualizationType['icon']; + isCompatible: boolean; + jobType: JOB_TYPE | null; + error?: ErrorType; +} + +export class VisualizationExtractor { + constructor(private dataViewClient: DataViewsContract) {} + + public async getResultLayersFromEmbeddable( + embeddable: Embeddable, + lens: LensPublicStart + ): Promise { + const { vis } = getJobsItemsFromEmbeddable(embeddable); + return this.getLayers(vis, lens); + } + + public async extractFields(layer: XYLayerConfig, vis: LensSavedObjectAttributes) { + if (!isCompatibleLayer(layer)) { + throw Error( + i18n.translate('xpack.ml.newJob.fromLens.createJob.error.incompatibleLayerType', { + defaultMessage: 'Layer is incompatible. Only chart layers can be used.', + }) + ); + } + + const indexpattern = vis.state.datasourceStates.indexpattern as IndexPatternPersistedState; + const compatibleIndexPatternLayer = Object.entries(indexpattern.layers).find( + ([id]) => layer.layerId === id + ); + if (compatibleIndexPatternLayer === undefined) { + throw Error( + i18n.translate('xpack.ml.newJob.fromLens.createJob.error.noCompatibleLayers', { + defaultMessage: + 'Visualization does not contain any layers which can be used for creating an anomaly detection job.', + }) + ); + } + + const [layerId, columnsLayer] = compatibleIndexPatternLayer; + + const columns = getColumns(columnsLayer, layer); + const timeField = Object.values(columns).find(({ dataType }) => dataType === 'date'); + if (timeField === undefined) { + throw Error( + i18n.translate('xpack.ml.newJob.fromLens.createJob.error.noDateField', { + defaultMessage: 'Cannot find a date field.', + }) + ); + } + + const fields = layer.accessors.map((a) => columns[a]); + + const splitField = layer.splitAccessor ? columns[layer.splitAccessor] : null; + + if ( + splitField !== null && + isTermsField(splitField) && + splitField.params.secondaryFields?.length + ) { + throw Error( + i18n.translate('xpack.ml.newJob.fromLens.createJob.error.splitFieldHasMultipleFields', { + defaultMessage: 'Selected split field contains more than one field.', + }) + ); + } + + if (splitField !== null && isCompatibleSplitFieldType(splitField) === false) { + throw Error( + i18n.translate('xpack.ml.newJob.fromLens.createJob.error.splitFieldMustBeString', { + defaultMessage: 'Selected split field type must be string.', + }) + ); + } + + const dataView = await this.getDataViewFromLens(vis.references, layerId); + if (dataView === null) { + throw Error( + i18n.translate('xpack.ml.newJob.fromLens.createJob.error.noDataViews', { + defaultMessage: 'No data views can be found in the visualization.', + }) + ); + } + + if (timeField.sourceField !== dataView.timeFieldName) { + throw Error( + i18n.translate('xpack.ml.newJob.fromLens.createJob.error.timeFieldNotInDataView', { + defaultMessage: + 'Selected time field must be the default time field configured for data view.', + }) + ); + } + + return { fields, timeField, splitField, dataView }; + } + + private async getLayers( + vis: LensSavedObjectAttributes, + lens: LensPublicStart + ): Promise { + const visualization = vis.state.visualization as { layers: XYLayerConfig[] }; + const getVisType = await getVisTypeFactory(lens); + + const layers: LayerResult[] = await Promise.all( + visualization.layers + .filter(({ layerType }) => layerType === layerTypes.DATA) // remove non chart layers + .map(async (layer) => { + const { icon, label } = getVisType(layer); + try { + const { fields, splitField } = await this.extractFields(layer, vis); + const detectors = createDetectors(fields, splitField); + const jobType = + splitField || detectors.length > 1 ? JOB_TYPE.MULTI_METRIC : JOB_TYPE.SINGLE_METRIC; + + return { + id: layer.layerId, + layerType: layer.layerType, + label, + icon, + jobType, + isCompatible: true, + }; + } catch (error) { + return { + id: layer.layerId, + layerType: layer.layerType, + label, + icon, + jobType: null, + isCompatible: false, + error, + }; + } + }) + ); + + return layers; + } + + private async getDataViewFromLens(references: SavedObjectReference[], layerId: string) { + const dv = references.find( + (r) => r.type === 'index-pattern' && r.name === `indexpattern-datasource-layer-${layerId}` + ); + if (!dv) { + return null; + } + return this.dataViewClient.get(dv.id); + } +} + +function getColumns( + { columns }: Omit, + layer: XYDataLayerConfig +) { + layer.accessors.forEach((a) => { + const col = columns[a]; + // fail early if any of the cols being used as accessors + // contain functions we don't support + return col.dataType !== 'date' && getMlFunction(col.operationType); + }); + + if (Object.values(columns).some((c) => hasSourceField(c) === false)) { + throw Error( + i18n.translate('xpack.ml.newJob.fromLens.createJob.error.colsNoSourceField', { + defaultMessage: 'Some columns do not contain a source field.', + }) + ); + } + + if (Object.values(columns).some((c) => hasIncompatibleProperties(c) === true)) { + throw Error( + i18n.translate('xpack.ml.newJob.fromLens.createJob.error.colsUsingFilterTimeSift', { + defaultMessage: + 'Columns contain settings which are incompatible with ML detectors, time shift and filter by are not supported.', + }) + ); + } + + return columns as Record; +} diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/index_or_search/preconfigured_job_redirect.ts b/x-pack/plugins/ml/public/application/jobs/new_job/pages/index_or_search/preconfigured_job_redirect.ts index 1b9a3cacc4102..1f8e6247a4fa8 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/index_or_search/preconfigured_job_redirect.ts +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/index_or_search/preconfigured_job_redirect.ts @@ -44,9 +44,11 @@ async function getWizardUrlFromCloningJob(createdBy: string | undefined, dataVie switch (created) { case CREATED_BY_LABEL.SINGLE_METRIC: + case CREATED_BY_LABEL.SINGLE_METRIC_FROM_LENS: page = JOB_TYPE.SINGLE_METRIC; break; case CREATED_BY_LABEL.MULTI_METRIC: + case CREATED_BY_LABEL.MULTI_METRIC_FROM_LENS: page = JOB_TYPE.MULTI_METRIC; break; case CREATED_BY_LABEL.POPULATION: diff --git a/x-pack/plugins/ml/public/application/services/ml_api_service/index.ts b/x-pack/plugins/ml/public/application/services/ml_api_service/index.ts index 0b03d86f9dc03..9f3c3a4350a79 100644 --- a/x-pack/plugins/ml/public/application/services/ml_api_service/index.ts +++ b/x-pack/plugins/ml/public/application/services/ml_api_service/index.ts @@ -130,7 +130,7 @@ export function mlApiServicesProvider(httpService: HttpService) { addJob({ jobId, job }: { jobId: string; job: Job }) { const body = JSON.stringify(job); - return httpService.http({ + return httpService.http({ path: `${basePath()}/anomaly_detectors/${jobId}`, method: 'PUT', body, @@ -247,7 +247,7 @@ export function mlApiServicesProvider(httpService: HttpService) { addDatafeed({ datafeedId, datafeedConfig }: { datafeedId: string; datafeedConfig: Datafeed }) { const body = JSON.stringify(datafeedConfig); - return httpService.http({ + return httpService.http({ path: `${basePath()}/datafeeds/${datafeedId}`, method: 'PUT', body, @@ -283,7 +283,15 @@ export function mlApiServicesProvider(httpService: HttpService) { }); }, - startDatafeed({ datafeedId, start, end }: { datafeedId: string; start: number; end: number }) { + startDatafeed({ + datafeedId, + start, + end, + }: { + datafeedId: string; + start?: number; + end?: number; + }) { const body = JSON.stringify({ ...(start !== undefined ? { start } : {}), ...(end !== undefined ? { end } : {}), diff --git a/x-pack/plugins/ml/public/embeddables/common/resolve_job_selection.tsx b/x-pack/plugins/ml/public/embeddables/common/resolve_job_selection.tsx index 259eb734f5383..61512ff46a66d 100644 --- a/x-pack/plugins/ml/public/embeddables/common/resolve_job_selection.tsx +++ b/x-pack/plugins/ml/public/embeddables/common/resolve_job_selection.tsx @@ -6,7 +6,7 @@ */ import { CoreStart } from '@kbn/core/public'; import moment from 'moment'; -import { takeUntil } from 'rxjs/operators'; +import { takeUntil, distinctUntilChanged, skip } from 'rxjs/operators'; import { from } from 'rxjs'; import React from 'react'; import { @@ -14,7 +14,6 @@ import { toMountPoint, wrapWithTheme, } from '@kbn/kibana-react-plugin/public'; -import { DashboardConstants } from '@kbn/dashboard-plugin/public'; import { getInitialGroupsMap } from '../../application/components/job_selector/job_selector'; import { getMlGlobalServices } from '../../application/app'; import { JobId } from '../../../common/types/anomaly_detection_jobs'; @@ -95,13 +94,14 @@ export async function resolveJobSelection( ownFocus: true, closeButtonAriaLabel: 'jobSelectorFlyout', } - ); // Close the flyout when user navigates out of the dashboard plugin + ); - currentAppId$.pipe(takeUntil(from(flyoutSession.onClose))).subscribe((appId) => { - if (appId !== DashboardConstants.DASHBOARDS_ID) { + // Close the flyout when user navigates out of the current plugin + currentAppId$ + .pipe(skip(1), takeUntil(from(flyoutSession.onClose)), distinctUntilChanged()) + .subscribe(() => { flyoutSession.close(); - } - }); + }); } catch (error) { reject(error); } diff --git a/x-pack/plugins/ml/public/embeddables/lens/context.ts b/x-pack/plugins/ml/public/embeddables/lens/context.ts new file mode 100644 index 0000000000000..61a55bc001b44 --- /dev/null +++ b/x-pack/plugins/ml/public/embeddables/lens/context.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 { DataPublicPluginStart } from '@kbn/data-plugin/public'; +import type { CoreStart } from '@kbn/core/public'; + +import { useKibana } from '@kbn/kibana-react-plugin/public'; + +import type { SharePluginStart } from '@kbn/share-plugin/public'; +import type { LensPublicStart } from '@kbn/lens-plugin/public'; +import type { MlServicesContext } from '../../application/app'; + +interface StartPlugins { + data: DataPublicPluginStart; + share: SharePluginStart; + lens: LensPublicStart; +} +export type StartServices = CoreStart & StartPlugins & MlServicesContext; +export const useMlFromLensKibanaContext = () => useKibana(); diff --git a/x-pack/plugins/ml/public/embeddables/lens/lens_vis_layer_selection_flyout/flyout.tsx b/x-pack/plugins/ml/public/embeddables/lens/lens_vis_layer_selection_flyout/flyout.tsx index 56926c9d76c8f..7bbc54d1837a4 100644 --- a/x-pack/plugins/ml/public/embeddables/lens/lens_vis_layer_selection_flyout/flyout.tsx +++ b/x-pack/plugins/ml/public/embeddables/lens/lens_vis_layer_selection_flyout/flyout.tsx @@ -5,11 +5,9 @@ * 2.0. */ -import React, { FC } from 'react'; +import React, { FC, useState, useEffect } from 'react'; import type { Embeddable } from '@kbn/lens-plugin/public'; -import type { SharePluginStart } from '@kbn/share-plugin/public'; import { FormattedMessage } from '@kbn/i18n-react'; - import { EuiFlyoutFooter, EuiFlyoutHeader, @@ -20,24 +18,39 @@ import { EuiTitle, EuiSpacer, EuiText, + useEuiTheme, } from '@elastic/eui'; -import { FlyoutBody } from './flyout_body'; +import { Layer } from './layer'; import type { LayerResult } from '../../../application/jobs/new_job/job_from_lens'; +import { VisualizationExtractor } from '../../../application/jobs/new_job/job_from_lens'; +import { useMlFromLensKibanaContext } from '../context'; interface Props { - layerResults: LayerResult[]; embeddable: Embeddable; - share: SharePluginStart; onClose: () => void; } -export const LensLayerSelectionFlyout: FC = ({ - onClose, - layerResults, - embeddable, - share, -}) => { +export const LensLayerSelectionFlyout: FC = ({ onClose, embeddable }) => { + const { euiTheme } = useEuiTheme(); + const { + services: { data, lens }, + } = useMlFromLensKibanaContext(); + + const [layerResults, setLayerResults] = useState([]); + + useEffect(() => { + const visExtractor = new VisualizationExtractor(data.dataViews); + visExtractor + .getResultLayersFromEmbeddable(embeddable, lens) + .then(setLayerResults) + .catch((error) => { + // eslint-disable-next-line no-console + console.error('Layers could not be extracted from embeddable', error); + onClose(); + }); + }, [data, lens, embeddable]); + return ( <> @@ -53,17 +66,15 @@ export const LensLayerSelectionFlyout: FC = ({ - - + + {layerResults.map((layer, i) => ( + + ))} diff --git a/x-pack/plugins/ml/public/embeddables/lens/lens_vis_layer_selection_flyout/flyout_body.tsx b/x-pack/plugins/ml/public/embeddables/lens/lens_vis_layer_selection_flyout/flyout_body.tsx deleted file mode 100644 index 8f0587dffcdf3..0000000000000 --- a/x-pack/plugins/ml/public/embeddables/lens/lens_vis_layer_selection_flyout/flyout_body.tsx +++ /dev/null @@ -1,135 +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 } from 'react'; -import type { Embeddable } from '@kbn/lens-plugin/public'; -import type { SharePluginStart } from '@kbn/share-plugin/public'; -import { FormattedMessage } from '@kbn/i18n-react'; - -import './style.scss'; -import { - EuiFlexGroup, - EuiFlexItem, - EuiButton, - EuiSpacer, - EuiIcon, - EuiText, - EuiSplitPanel, - EuiHorizontalRule, -} from '@elastic/eui'; - -import { convertLensToADJob } from '../../../application/jobs/new_job/job_from_lens'; -import type { LayerResult } from '../../../application/jobs/new_job/job_from_lens'; -import { CREATED_BY_LABEL } from '../../../../common/constants/new_job'; -import { extractErrorMessage } from '../../../../common/util/errors'; - -interface Props { - layerResults: LayerResult[]; - embeddable: Embeddable; - share: SharePluginStart; - onClose: () => void; -} - -export const FlyoutBody: FC = ({ onClose, layerResults, embeddable, share }) => { - function createADJob(layerIndex: number) { - convertLensToADJob(embeddable, share, layerIndex); - } - - return ( - <> - {layerResults.map((layer, i) => ( - - - - - {layer.icon && ( - - - - )} - - -
{layer.label}
-
-
-
-
- - - {layer.isCompatible ? ( - <> - - - - - - - - - - - - - - - - - - ) : ( - <> - - - - - - - - - {layer.error ? ( - extractErrorMessage(layer.error) - ) : ( - - )} - - - - - )} - -
- -
- ))} - - ); -}; diff --git a/x-pack/plugins/ml/public/embeddables/lens/lens_vis_layer_selection_flyout/layer/compatible_layer.tsx b/x-pack/plugins/ml/public/embeddables/lens/lens_vis_layer_selection_flyout/layer/compatible_layer.tsx new file mode 100644 index 0000000000000..342a37fe4b0c0 --- /dev/null +++ b/x-pack/plugins/ml/public/embeddables/lens/lens_vis_layer_selection_flyout/layer/compatible_layer.tsx @@ -0,0 +1,471 @@ +/* + * 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 * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import React, { FC, useState, useCallback, useMemo } from 'react'; +import { FormattedMessage } from '@kbn/i18n-react'; +import useDebounce from 'react-use/lib/useDebounce'; +import type { Embeddable } from '@kbn/lens-plugin/public'; + +import { + EuiFlexGroup, + EuiFlexItem, + EuiButton, + EuiSpacer, + EuiIcon, + EuiText, + EuiFieldText, + EuiForm, + EuiFormRow, + EuiLoadingSpinner, + EuiButtonEmpty, + EuiCheckbox, + EuiAccordion, + EuiCallOut, +} from '@elastic/eui'; + +import { + redirectToADJobWizards, + QuickJobCreator, +} from '../../../../application/jobs/new_job/job_from_lens'; +import type { LayerResult } from '../../../../application/jobs/new_job/job_from_lens'; +import { JOB_TYPE, DEFAULT_BUCKET_SPAN } from '../../../../../common/constants/new_job'; +import { extractErrorMessage } from '../../../../../common/util/errors'; +import { basicJobValidation } from '../../../../../common/util/job_utils'; +import { JOB_ID_MAX_LENGTH } from '../../../../../common/constants/validation'; +import { invalidTimeIntervalMessage } from '../../../../application/jobs/new_job/common/job_validator/util'; +import { ML_APP_LOCATOR, ML_PAGES } from '../../../../../common/constants/locator'; +import { useMlFromLensKibanaContext } from '../../context'; + +interface Props { + layer: LayerResult; + layerIndex: number; + embeddable: Embeddable; +} + +enum STATE { + DEFAULT, + VALIDATING, + SAVING, + SAVE_SUCCESS, + SAVE_FAILED, +} + +export const CompatibleLayer: FC = ({ layer, layerIndex, embeddable }) => { + const { + services: { + data, + share, + application, + uiSettings, + mlServices: { mlApiServices }, + }, + } = useMlFromLensKibanaContext(); + + const [jobId, setJobId] = useState(undefined); + const [startJob, setStartJob] = useState(true); + const [runInRealTime, setRunInRealTime] = useState(true); + const [bucketSpan, setBucketSpan] = useState(DEFAULT_BUCKET_SPAN); + + const [jobIdValidationError, setJobIdValidationError] = useState(''); + const [bucketSpanValidationError, setBucketSpanValidationError] = useState(''); + const [state, setState] = useState(STATE.DEFAULT); + const [createError, setCreateError] = useState<{ text: string; errorText: string } | null>(null); + const quickJobCreator = useMemo( + () => + new QuickJobCreator( + data.dataViews, + uiSettings, + data.query.timefilter.timefilter, + mlApiServices + ), + [data, uiSettings] + ); + + function createADJobInWizard() { + redirectToADJobWizards(embeddable, layerIndex, share); + } + + async function createADJob() { + if (jobId === undefined) { + return; + } + + setState(STATE.SAVING); + setCreateError(null); + const result = await quickJobCreator.createAndSaveJob( + jobId, + bucketSpan, + embeddable, + startJob, + runInRealTime, + layerIndex + ); + const error = checkForCreationErrors(result); + if (error === null) { + setState(STATE.SAVE_SUCCESS); + } else { + setState(STATE.SAVE_FAILED); + setCreateError(error); + } + } + + const viewResults = useCallback( + async (jobType: JOB_TYPE | null) => { + const { timeRange } = embeddable.getInput(); + const locator = share.url.locators.get(ML_APP_LOCATOR); + if (locator) { + const page = startJob + ? jobType === JOB_TYPE.MULTI_METRIC + ? ML_PAGES.ANOMALY_EXPLORER + : ML_PAGES.SINGLE_METRIC_VIEWER + : ML_PAGES.ANOMALY_DETECTION_JOBS_MANAGE; + const pageState = startJob + ? { + jobIds: [jobId], + timeRange, + } + : { jobId }; + + const url = await locator!.getUrl({ + page, + pageState, + }); + + application.navigateToUrl(url); + } + }, + [jobId, embeddable, share, application, startJob] + ); + + function setStartJobWrapper(start: boolean) { + setStartJob(start); + setRunInRealTime(start && runInRealTime); + } + + useDebounce( + function validateJobId() { + if (jobId === undefined) { + return; + } + setJobIdValidationError(''); + setBucketSpanValidationError(''); + const validationResults = basicJobValidation( + { + job_id: jobId, + analysis_config: { detectors: [], bucket_span: bucketSpan }, + } as unknown as estypes.MlJob, + undefined, + { max_model_memory_limit: '', effective_max_model_memory_limit: '' }, + true + ); + + if (validationResults.contains('job_id_invalid')) { + setJobIdValidationError( + i18n.translate('xpack.ml.newJob.wizard.validateJob.jobNameAllowedCharactersDescription', { + defaultMessage: + 'Job ID can contain lowercase alphanumeric (a-z and 0-9), hyphens or underscores; ' + + 'must start and end with an alphanumeric character', + }) + ); + } else if (validationResults.contains('job_id_invalid_max_length')) { + setJobIdValidationError( + i18n.translate('xpack.ml.newJob.wizard.validateJob.jobIdInvalidMaxLengthErrorMessage', { + defaultMessage: + 'Job ID must be no more than {maxLength, plural, one {# character} other {# characters}} long.', + values: { + maxLength: JOB_ID_MAX_LENGTH, + }, + }) + ); + } else { + mlApiServices.jobs + .jobsExist([jobId]) + .then((resp) => { + if (resp[jobId].exists) { + setJobIdValidationError( + i18n.translate('xpack.ml.newJob.wizard.validateJob.jobNameAlreadyExists', { + defaultMessage: + 'Job ID already exists. A job ID cannot be the same as an existing job or group.', + }) + ); + } + }) + .catch((error) => { + // eslint-disable-next-line no-console + console.error('Could not validate whether job ID exists'); + }); + } + + if (validationResults.contains('bucket_span_invalid')) { + setBucketSpanValidationError(invalidTimeIntervalMessage(bucketSpan)); + } + setState(STATE.DEFAULT); + }, + 500, + [jobId, bucketSpan] + ); + + return ( + <> + {state !== STATE.SAVE_SUCCESS && state !== STATE.SAVING ? ( + <> + + + + + + + + + {layer.jobType === JOB_TYPE.MULTI_METRIC ? ( + + ) : ( + + )} + + + + + + + { + setJobId(e.target.value); + setState(STATE.VALIDATING); + }} + /> + + + + + + + { + setBucketSpan(e.target.value); + setState(STATE.VALIDATING); + }} + /> + + + + setStartJobWrapper(e.target.checked)} + label={i18n.translate( + 'xpack.ml.embeddables.lensLayerFlyout.createJobCallout.additionalSettings.start', + { + defaultMessage: 'Start the job after saving', + } + )} + /> + + + + + setRunInRealTime(e.target.checked)} + label={i18n.translate( + 'xpack.ml.embeddables.lensLayerFlyout.createJobCallout.additionalSettings.realTime', + { + defaultMessage: 'Leave the job running for new data', + } + )} + /> + + + + + + + + + + + + + + + + + + + + ) : null} + + {state === STATE.SAVE_SUCCESS ? ( + <> + + + + + + + + + + + + + + + + {startJob === false ? ( + + ) : layer.jobType === JOB_TYPE.MULTI_METRIC ? ( + + ) : ( + + )} + + + ) : null} + + {state === STATE.SAVING ? ( + + + + + + + + + ) : null} + + {state === STATE.SAVE_FAILED && createError !== null ? ( + <> + + + {createError.errorText} + + + ) : null} + + ); +}; + +const checkForCreationErrors = ( + result: Awaited> +) => { + if (result.jobCreated.error) { + return { + text: i18n.translate('xpack.ml.embeddables.lensLayerFlyout.jobCreateError.jobCreated', { + defaultMessage: 'Job could not be created.', + }), + errorText: extractErrorMessage(result.jobCreated.error), + }; + } else if (result.datafeedCreated.error) { + return { + text: i18n.translate('xpack.ml.embeddables.lensLayerFlyout.jobCreateError.datafeedCreated', { + defaultMessage: 'Job created but datafeed could not be created.', + }), + errorText: extractErrorMessage(result.datafeedCreated.error), + }; + } else if (result.jobOpened.error) { + return { + text: i18n.translate('xpack.ml.embeddables.lensLayerFlyout.jobCreateError.jobOpened', { + defaultMessage: 'Job and datafeed created but the job could not be opened.', + }), + errorText: extractErrorMessage(result.jobOpened.error), + }; + } else if (result.datafeedStarted.error) { + return { + text: i18n.translate('xpack.ml.embeddables.lensLayerFlyout.jobCreateError.datafeedStarted', { + defaultMessage: 'Job and datafeed created but the datafeed could not be started.', + }), + errorText: extractErrorMessage(result.datafeedStarted.error), + }; + } else { + return null; + } +}; diff --git a/x-pack/plugins/ml/public/embeddables/lens/lens_vis_layer_selection_flyout/layer/incompatible_layer.tsx b/x-pack/plugins/ml/public/embeddables/lens/lens_vis_layer_selection_flyout/layer/incompatible_layer.tsx new file mode 100644 index 0000000000000..4e6dc1eb84a15 --- /dev/null +++ b/x-pack/plugins/ml/public/embeddables/lens/lens_vis_layer_selection_flyout/layer/incompatible_layer.tsx @@ -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 React, { FC } from 'react'; +import { FormattedMessage } from '@kbn/i18n-react'; + +import { EuiFlexGroup, EuiFlexItem, EuiIcon, EuiText } from '@elastic/eui'; + +import type { LayerResult } from '../../../../application/jobs/new_job/job_from_lens'; + +import { extractErrorMessage } from '../../../../../common/util/errors'; + +interface Props { + layer: LayerResult; +} + +export const IncompatibleLayer: FC = ({ layer }) => { + return ( + + + + + + + + + {layer.error ? ( + extractErrorMessage(layer.error) + ) : ( + + )} + + + + ); +}; diff --git a/x-pack/plugins/ml/public/embeddables/lens/lens_vis_layer_selection_flyout/layer/index.ts b/x-pack/plugins/ml/public/embeddables/lens/lens_vis_layer_selection_flyout/layer/index.ts new file mode 100644 index 0000000000000..bbbfe2fbaa8e7 --- /dev/null +++ b/x-pack/plugins/ml/public/embeddables/lens/lens_vis_layer_selection_flyout/layer/index.ts @@ -0,0 +1,7 @@ +/* + * 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 { Layer } from './layer'; diff --git a/x-pack/plugins/ml/public/embeddables/lens/lens_vis_layer_selection_flyout/layer/layer.tsx b/x-pack/plugins/ml/public/embeddables/lens/lens_vis_layer_selection_flyout/layer/layer.tsx new file mode 100644 index 0000000000000..0614292cbf9d2 --- /dev/null +++ b/x-pack/plugins/ml/public/embeddables/lens/lens_vis_layer_selection_flyout/layer/layer.tsx @@ -0,0 +1,59 @@ +/* + * 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 } from 'react'; +import type { Embeddable } from '@kbn/lens-plugin/public'; +import { + EuiFlexGroup, + EuiFlexItem, + EuiSpacer, + EuiIcon, + EuiText, + EuiSplitPanel, + EuiHorizontalRule, +} from '@elastic/eui'; +import type { LayerResult } from '../../../../application/jobs/new_job/job_from_lens'; +import { CompatibleLayer } from './compatible_layer'; +import { IncompatibleLayer } from './incompatible_layer'; + +interface Props { + layer: LayerResult; + layerIndex: number; + embeddable: Embeddable; +} + +export const Layer: FC = ({ layer, layerIndex, embeddable }) => { + return ( + <> + + + + {layer.icon && ( + + + + )} + + +
{layer.label}
+
+
+
+
+ + + {layer.isCompatible ? ( + + ) : ( + + )} + +
+ + + ); +}; diff --git a/x-pack/plugins/ml/public/embeddables/lens/lens_vis_layer_selection_flyout/style.scss b/x-pack/plugins/ml/public/embeddables/lens/lens_vis_layer_selection_flyout/style.scss deleted file mode 100644 index 0da0eb92c9637..0000000000000 --- a/x-pack/plugins/ml/public/embeddables/lens/lens_vis_layer_selection_flyout/style.scss +++ /dev/null @@ -1,3 +0,0 @@ -.mlLensToJobFlyoutBody { - background-color: $euiColorLightestShade; -} diff --git a/x-pack/plugins/ml/public/embeddables/lens/show_flyout.tsx b/x-pack/plugins/ml/public/embeddables/lens/show_flyout.tsx index 81a9cfcf9dc8e..325565998f1e4 100644 --- a/x-pack/plugins/ml/public/embeddables/lens/show_flyout.tsx +++ b/x-pack/plugins/ml/public/embeddables/lens/show_flyout.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { takeUntil } from 'rxjs/operators'; +import { takeUntil, distinctUntilChanged, skip } from 'rxjs/operators'; import { from } from 'rxjs'; import type { Embeddable } from '@kbn/lens-plugin/public'; import type { CoreStart } from '@kbn/core/public'; @@ -19,15 +19,10 @@ import { wrapWithTheme, KibanaContextProvider, } from '@kbn/kibana-react-plugin/public'; -import { DashboardConstants } from '@kbn/dashboard-plugin/public'; + import { getMlGlobalServices } from '../../application/app'; import { LensLayerSelectionFlyout } from './lens_vis_layer_selection_flyout'; -import { - getResultLayersFromEmbeddable, - convertLensToADJob, -} from '../../application/jobs/new_job/job_from_lens'; - export async function showLensVisToADJobFlyout( embeddable: Embeddable, coreStart: CoreStart, @@ -44,14 +39,6 @@ export async function showLensVisToADJobFlyout( return new Promise(async (resolve, reject) => { try { - // do not show the flyout if the results only contain one layer - // and that layer can be used for creating an AD job - const layerResults = await getResultLayersFromEmbeddable(embeddable, data.dataViews, lens); - if (layerResults.length === 1 && layerResults[0].isCompatible) { - convertLensToADJob(embeddable, share, 0); - return resolve(); - } - const onFlyoutClose = () => { flyoutSession.close(); resolve(); @@ -61,7 +48,13 @@ export async function showLensVisToADJobFlyout( toMountPoint( wrapWithTheme( , theme$ @@ -86,12 +77,12 @@ export async function showLensVisToADJobFlyout( } ); - // Close the flyout when user navigates out of the dashboard plugin - currentAppId$.pipe(takeUntil(from(flyoutSession.onClose))).subscribe((appId) => { - if (appId !== DashboardConstants.DASHBOARDS_ID) { + // Close the flyout when user navigates out of the current plugin + currentAppId$ + .pipe(skip(1), takeUntil(from(flyoutSession.onClose)), distinctUntilChanged()) + .subscribe(() => { flyoutSession.close(); - } - }); + }); } catch (error) { reject(error); } diff --git a/x-pack/plugins/ml/public/ui_actions/open_lens_vis_in_ml_action.tsx b/x-pack/plugins/ml/public/ui_actions/open_lens_vis_in_ml_action.tsx index 692f0e2ac5f9b..da083a2ca34a1 100644 --- a/x-pack/plugins/ml/public/ui_actions/open_lens_vis_in_ml_action.tsx +++ b/x-pack/plugins/ml/public/ui_actions/open_lens_vis_in_ml_action.tsx @@ -57,8 +57,14 @@ export function createLensVisToADJobAction(getStartServices: MlCoreSetup['getSta return false; } - const { vis } = getJobsItemsFromEmbeddable(context.embeddable); - return isCompatibleVisualizationType(vis); + try { + const { vis } = getJobsItemsFromEmbeddable(context.embeddable); + return isCompatibleVisualizationType(vis); + } catch (error) { + // eslint-disable-next-line no-console + console.error('Error attempting to check for ML job compatibility', error); + return false; + } }, }); } diff --git a/x-pack/plugins/translations/translations/fr-FR.json b/x-pack/plugins/translations/translations/fr-FR.json index 7b89ea63eb466..8d405c00cc551 100644 --- a/x-pack/plugins/translations/translations/fr-FR.json +++ b/x-pack/plugins/translations/translations/fr-FR.json @@ -19049,7 +19049,6 @@ "xpack.ml.deleteSpaceAwareItemCheckModal.unTagSuccessTitle": "Mise à jour réussie de {id}", "xpack.ml.editModelSnapshotFlyout.calloutText": "Il s'agit du snapshot actuel qui est en cours d'utilisation par {jobId} ; il ne peut donc pas être supprimé.", "xpack.ml.editModelSnapshotFlyout.title": "Modifier le snapshot {ssId}", - "xpack.ml.embeddables.lensLayerFlyout.createJobCalloutTitle": "Ce calque peut être utilisé pour créer une tâche {type}", "xpack.ml.entityFilter.addFilterAriaLabel": "Ajouter un filtre pour {influencerFieldName} {influencerFieldValue}", "xpack.ml.entityFilter.removeFilterAriaLabel": "Retirer le filtre pour {influencerFieldName} {influencerFieldValue}", "xpack.ml.explorer.annotationsOutOfTotalCountTitle": "Premiers {visibleCount} sur un total de {totalCount}", @@ -20125,7 +20124,6 @@ "xpack.ml.embeddables.lensLayerFlyout.closeButton": "Fermer", "xpack.ml.embeddables.lensLayerFlyout.createJobButton": "Créer une tâche à partir de ce calque", "xpack.ml.embeddables.lensLayerFlyout.defaultLayerError": "Ce calque ne peut pas être utilisé pour créer une tâche de détection des anomalies", - "xpack.ml.embeddables.lensLayerFlyout.secondTitle": "Sélectionnez un calque compatible à partir de la visualisation pour créer une tâche de détection des anomalies.", "xpack.ml.embeddables.lensLayerFlyout.title": "Créer une tâche de détection des anomalies", "xpack.ml.entityFilter.addFilterTooltip": "Ajouter un filtre", "xpack.ml.entityFilter.removeFilterTooltip": "Supprimer le filtre", diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index c63e2c118d8e1..92f7bb0888cda 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -19031,7 +19031,6 @@ "xpack.ml.deleteSpaceAwareItemCheckModal.unTagSuccessTitle": "正常に {id} を更新しました", "xpack.ml.editModelSnapshotFlyout.calloutText": "これはジョブ{jobId}で使用されている現在のスナップショットであるため削除できません。", "xpack.ml.editModelSnapshotFlyout.title": "スナップショット{ssId}の編集", - "xpack.ml.embeddables.lensLayerFlyout.createJobCalloutTitle": "このレイヤーを使用して、{type}ジョブを作成できます", "xpack.ml.entityFilter.addFilterAriaLabel": "{influencerFieldName} {influencerFieldValue}のフィルターを追加", "xpack.ml.entityFilter.removeFilterAriaLabel": "{influencerFieldName} {influencerFieldValue}のフィルターを削除", "xpack.ml.explorer.annotationsOutOfTotalCountTitle": "合計{totalCount}件中最初の{visibleCount}件", @@ -20108,7 +20107,6 @@ "xpack.ml.embeddables.lensLayerFlyout.closeButton": "閉じる", "xpack.ml.embeddables.lensLayerFlyout.createJobButton": "このレイヤーからジョブを作成", "xpack.ml.embeddables.lensLayerFlyout.defaultLayerError": "このレイヤーを使用して、異常検知ジョブを作成できません", - "xpack.ml.embeddables.lensLayerFlyout.secondTitle": "ビジュアライゼーションから互換性があるレイヤーを選択し、異常検知ジョブを作成してください。", "xpack.ml.embeddables.lensLayerFlyout.title": "異常検知ジョブの作成", "xpack.ml.entityFilter.addFilterTooltip": "フィルターを追加します", "xpack.ml.entityFilter.removeFilterTooltip": "フィルターを削除", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index 944064892238c..4884259e023cb 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -19055,7 +19055,6 @@ "xpack.ml.deleteSpaceAwareItemCheckModal.unTagSuccessTitle": "成功更新 {id}", "xpack.ml.editModelSnapshotFlyout.calloutText": "这是作业 {jobId} 当前正在使用的快照,因此无法删除。", "xpack.ml.editModelSnapshotFlyout.title": "编辑快照 {ssId}", - "xpack.ml.embeddables.lensLayerFlyout.createJobCalloutTitle": "此图层可用于创建 {type} 作业", "xpack.ml.entityFilter.addFilterAriaLabel": "添加 {influencerFieldName} {influencerFieldValue} 的筛选", "xpack.ml.entityFilter.removeFilterAriaLabel": "移除 {influencerFieldName} {influencerFieldValue} 的筛选", "xpack.ml.explorer.annotationsOutOfTotalCountTitle": "前 {visibleCount} 个,共 {totalCount} 个", @@ -20135,7 +20134,6 @@ "xpack.ml.embeddables.lensLayerFlyout.closeButton": "关闭", "xpack.ml.embeddables.lensLayerFlyout.createJobButton": "从此图层创建作业", "xpack.ml.embeddables.lensLayerFlyout.defaultLayerError": "此图层无法用于创建异常检测作业", - "xpack.ml.embeddables.lensLayerFlyout.secondTitle": "从可视化中选择兼容的图层以创建异常检测作业。", "xpack.ml.embeddables.lensLayerFlyout.title": "创建异常检测作业", "xpack.ml.entityFilter.addFilterTooltip": "添加筛选", "xpack.ml.entityFilter.removeFilterTooltip": "移除筛选", diff --git a/x-pack/test/functional/apps/ml/anomaly_detection/index.ts b/x-pack/test/functional/apps/ml/anomaly_detection/index.ts index 60bc92990b905..35bfd4471233a 100644 --- a/x-pack/test/functional/apps/ml/anomaly_detection/index.ts +++ b/x-pack/test/functional/apps/ml/anomaly_detection/index.ts @@ -49,5 +49,6 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) { loadTestFile(require.resolve('./custom_urls')); loadTestFile(require.resolve('./forecasts')); loadTestFile(require.resolve('./lens_to_ml')); + loadTestFile(require.resolve('./lens_to_ml_with_wizard')); }); } diff --git a/x-pack/test/functional/apps/ml/anomaly_detection/lens_to_ml.ts b/x-pack/test/functional/apps/ml/anomaly_detection/lens_to_ml.ts index 31964c5144d89..a2c176fa2dda4 100644 --- a/x-pack/test/functional/apps/ml/anomaly_detection/lens_to_ml.ts +++ b/x-pack/test/functional/apps/ml/anomaly_detection/lens_to_ml.ts @@ -7,12 +7,10 @@ import { FtrProviderContext } from '../../../ftr_provider_context'; -export default function ({ getService, getPageObject, getPageObjects }: FtrProviderContext) { +export default function ({ getService, getPageObjects }: FtrProviderContext) { const ml = getService('ml'); const dashboardPanelActions = getService('dashboardPanelActions'); const browser = getService('browser'); - const retry = getService('retry'); - const headerPage = getPageObject('header'); const PageObjects = getPageObjects(['common', 'timePicker', 'dashboard']); const kibanaServer = getService('kibanaServer'); const esArchiver = getService('esArchiver'); @@ -21,13 +19,6 @@ export default function ({ getService, getPageObject, getPageObjects }: FtrProvi const dashboardArchive = 'x-pack/test/functional/fixtures/kbn_archiver/ml/lens_to_ml_dashboard.json'; - async function retrySwitchTab(tabIndex: number, seconds: number) { - await retry.tryForTime(seconds * 1000, async () => { - await browser.switchTab(tabIndex); - }); - await browser.setWindowSize(1920, 1080); - } - async function setFarequoteTimerange() { await PageObjects.timePicker.setAbsoluteRange( 'Feb 7, 2016 @ 00:00:00.000', @@ -45,50 +36,6 @@ export default function ({ getService, getPageObject, getPageObjects }: FtrProvi await dashboardPanelActions.openContextMenuMorePanel(header); } - async function createJobInWizard( - jobId: string, - splitField?: string, - aggAndFieldIdentifier?: string - ) { - await headerPage.waitUntilLoadingHasFinished(); - - if (splitField !== undefined) { - await ml.jobTypeSelection.assertMultiMetricJobWizardOpen(); - await ml.jobWizardMultiMetric.assertDetectorSplitExists(splitField); - await ml.jobWizardCommon.assertInfluencerSelection([splitField]); - } else if (aggAndFieldIdentifier !== undefined) { - await ml.jobTypeSelection.assertSingleMetricJobWizardOpen(); - await ml.jobWizardCommon.assertAggAndFieldInputExists(); - await ml.jobWizardCommon.selectAggAndField(aggAndFieldIdentifier, true); - await ml.jobWizardCommon.assertAnomalyChartExists('LINE'); - } - - await ml.testExecution.logTestStep('job creation displays the job details step'); - await ml.jobWizardCommon.advanceToJobDetailsSection(); - - await ml.testExecution.logTestStep('job creation inputs the job id'); - await ml.jobWizardCommon.assertJobIdInputExists(); - await ml.jobWizardCommon.setJobId(jobId); - - await ml.testExecution.logTestStep('job creation displays the validation step'); - await ml.jobWizardCommon.advanceToValidationSection(); - - await ml.testExecution.logTestStep('job creation displays the summary step'); - await ml.jobWizardCommon.advanceToSummarySection(); - - await ml.testExecution.logTestStep('job creation creates the job and finishes processing'); - await ml.jobWizardCommon.assertCreateJobButtonExists(); - await ml.jobWizardCommon.createJobAndWaitForCompletion(); - - await ml.testExecution.logTestStep('job creation displays the created job in the job list'); - await ml.navigation.navigateToMl(); - await ml.navigation.navigateToJobManagement(); - - await ml.jobTable.filterWithSearchString(jobId, 1); - - await ml.jobTable.assertJobRowJobId(jobId); - } - describe('create jobs from lens', function () { this.tags(['ml']); @@ -110,52 +57,43 @@ export default function ({ getService, getPageObject, getPageObjects }: FtrProvi await PageObjects.common.navigateToApp('dashboard'); }); - let tabsCount = 1; - - afterEach(async () => { - if (tabsCount > 1) { - await browser.closeCurrentWindow(); - await retrySwitchTab(0, 10); - tabsCount--; - } - }); - - it('can create multi metric job from vis with single layer', async () => { - const selectedPanelTitle = 'panel1'; + it('can create a single metric job from vis with single layer', async () => { + const selectedPanelTitle = 'panel2'; const jobId = 'job_from_lens_1'; - const splitField = 'airline'; + const numberOfCompatibleLayers = 1; + const layerIndex = 0; await dashboardPreparation(selectedPanelTitle); await ml.lensVisualizations.clickCreateMLJobMenuAction(); - await retrySwitchTab(1, 10); - tabsCount++; + await ml.lensVisualizations.assertLensLayerSelectorExists(); - await createJobInWizard(jobId, splitField, undefined); - }); + await ml.lensVisualizations.assertNumberOfCompatibleLensLayers(numberOfCompatibleLayers); - it('can create single metric job from vis with single layer', async () => { - const selectedPanelTitle = 'panel2'; - const aggAndFieldIdentifier = 'Count(Event rate)'; - const jobId = 'job_from_lens_2'; + await ml.lensVisualizations.setJobId(jobId, layerIndex); - await dashboardPreparation(selectedPanelTitle); + await ml.lensVisualizations.clickCreateJob(layerIndex); + await ml.lensVisualizations.assertJobHasBeenCreated(layerIndex); - await ml.lensVisualizations.clickCreateMLJobMenuAction(); + await ml.lensVisualizations.clickViewResults(layerIndex); + + await ml.commonUI.waitForMlLoadingIndicatorToDisappear(); + + await ml.testExecution.logTestStep('Single metric page loaded'); + await ml.lensVisualizations.singleMetricViewerPageLoaded(); - await retrySwitchTab(1, 10); - tabsCount++; + await ml.testExecution.logTestStep('pre-fills the job selection'); + await ml.jobSelection.assertJobSelection([jobId]); - await createJobInWizard(jobId, undefined, aggAndFieldIdentifier); + await ml.api.deleteAnomalyDetectionJobES(jobId); }); - it('can create multi metric job from vis with multiple compatible layers and single incompatible layer', async () => { - const selectedPanelTitle = 'panel3'; - const aggAndFieldIdentifier = 'Mean(responsetime)'; - const jobId = 'job_from_lens_3'; - const numberOfCompatibleLayers = 2; - const numberOfIncompatibleLayers = 1; + it('can create multi metric job from vis with single layer', async () => { + const selectedPanelTitle = 'panel1'; + const jobId = 'job_from_lens_2'; + const numberOfCompatibleLayers = 1; + const layerIndex = 0; await dashboardPreparation(selectedPanelTitle); @@ -165,38 +103,22 @@ export default function ({ getService, getPageObject, getPageObjects }: FtrProvi await ml.lensVisualizations.assertNumberOfCompatibleLensLayers(numberOfCompatibleLayers); - await ml.lensVisualizations.assertNumberOfIncompatibleLensLayers(numberOfIncompatibleLayers); - - ml.lensVisualizations.clickCreateJobFromLayer(1); - - await retrySwitchTab(1, 10); - tabsCount++; + await ml.lensVisualizations.setJobId(jobId, layerIndex); - await createJobInWizard(jobId, undefined, aggAndFieldIdentifier); - }); - - it('shows flyout for job from vis with no compatible layers', async () => { - const selectedPanelTitle = 'panel4'; - const numberOfCompatibleLayers = 0; - const numberOfIncompatibleLayers = 1; + await ml.lensVisualizations.clickCreateJob(layerIndex); + await ml.lensVisualizations.assertJobHasBeenCreated(layerIndex); - await dashboardPreparation(selectedPanelTitle); + await ml.lensVisualizations.clickViewResults(layerIndex); - await ml.lensVisualizations.clickCreateMLJobMenuAction(); + await ml.commonUI.waitForMlLoadingIndicatorToDisappear(); - await ml.lensVisualizations.assertLensLayerSelectorExists(); + await ml.testExecution.logTestStep('Anomaly explorer page loaded'); + await ml.lensVisualizations.anomalyExplorerPageLoaded(); - await ml.lensVisualizations.assertNumberOfCompatibleLensLayers(numberOfCompatibleLayers); - - await ml.lensVisualizations.assertNumberOfIncompatibleLensLayers(numberOfIncompatibleLayers); - }); - - it('does not show link to ml with vis with only incompatible layer types', async () => { - const selectedPanelTitle = 'panel5'; - - await dashboardPreparation(selectedPanelTitle); + await ml.testExecution.logTestStep('pre-fills the job selection'); + await ml.jobSelection.assertJobSelection([jobId]); - ml.lensVisualizations.assertMLJobMenuActionDoesNotExist(); + await ml.api.deleteAnomalyDetectionJobES(jobId); }); }); } diff --git a/x-pack/test/functional/apps/ml/anomaly_detection/lens_to_ml_with_wizard.ts b/x-pack/test/functional/apps/ml/anomaly_detection/lens_to_ml_with_wizard.ts new file mode 100644 index 0000000000000..9c70e92a02026 --- /dev/null +++ b/x-pack/test/functional/apps/ml/anomaly_detection/lens_to_ml_with_wizard.ts @@ -0,0 +1,222 @@ +/* + * 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 { FtrProviderContext } from '../../../ftr_provider_context'; + +export default function ({ getService, getPageObject, getPageObjects }: FtrProviderContext) { + const ml = getService('ml'); + const dashboardPanelActions = getService('dashboardPanelActions'); + const browser = getService('browser'); + const retry = getService('retry'); + const headerPage = getPageObject('header'); + const PageObjects = getPageObjects(['common', 'timePicker', 'dashboard']); + const kibanaServer = getService('kibanaServer'); + const esArchiver = getService('esArchiver'); + + const dashboardTitle = 'lens_to_ml'; + const dashboardArchive = + 'x-pack/test/functional/fixtures/kbn_archiver/ml/lens_to_ml_dashboard.json'; + + async function retrySwitchTab(tabIndex: number, seconds: number) { + await retry.tryForTime(seconds * 1000, async () => { + await browser.switchTab(tabIndex); + }); + await browser.setWindowSize(1920, 1080); + } + + async function setFarequoteTimerange() { + await PageObjects.timePicker.setAbsoluteRange( + 'Feb 7, 2016 @ 00:00:00.000', + 'Feb 11, 2016 @ 23:59:54.000' + ); + } + + async function dashboardPreparation(selectedPanelTitle: string) { + await PageObjects.dashboard.loadSavedDashboard(dashboardTitle); + await ml.dashboardEmbeddables.assertDashboardPanelExists(selectedPanelTitle); + + await setFarequoteTimerange(); + + const header = await dashboardPanelActions.getPanelHeading(selectedPanelTitle); + await dashboardPanelActions.openContextMenuMorePanel(header); + } + + async function createJobInWizard( + jobId: string, + splitField?: string, + aggAndFieldIdentifier?: string + ) { + await headerPage.waitUntilLoadingHasFinished(); + + if (splitField !== undefined) { + await ml.jobTypeSelection.assertMultiMetricJobWizardOpen(); + await ml.jobWizardMultiMetric.assertDetectorSplitExists(splitField); + await ml.jobWizardCommon.assertInfluencerSelection([splitField]); + } else if (aggAndFieldIdentifier !== undefined) { + await ml.jobTypeSelection.assertSingleMetricJobWizardOpen(); + await ml.jobWizardCommon.assertAggAndFieldInputExists(); + await ml.jobWizardCommon.selectAggAndField(aggAndFieldIdentifier, true); + await ml.jobWizardCommon.assertAnomalyChartExists('LINE'); + } + + await ml.testExecution.logTestStep('job creation displays the job details step'); + await ml.jobWizardCommon.advanceToJobDetailsSection(); + + await ml.testExecution.logTestStep('job creation inputs the job id'); + await ml.jobWizardCommon.assertJobIdInputExists(); + await ml.jobWizardCommon.setJobId(jobId); + + await ml.testExecution.logTestStep('job creation displays the validation step'); + await ml.jobWizardCommon.advanceToValidationSection(); + + await ml.testExecution.logTestStep('job creation displays the summary step'); + await ml.jobWizardCommon.advanceToSummarySection(); + + await ml.testExecution.logTestStep('job creation creates the job and finishes processing'); + await ml.jobWizardCommon.assertCreateJobButtonExists(); + await ml.jobWizardCommon.createJobAndWaitForCompletion(); + + await ml.testExecution.logTestStep('job creation displays the created job in the job list'); + await ml.navigation.navigateToMl(); + await ml.navigation.navigateToJobManagement(); + + await ml.jobTable.filterWithSearchString(jobId, 1); + + await ml.jobTable.assertJobRowJobId(jobId); + } + + describe('create jobs from lens with wizard', function () { + this.tags(['ml']); + + before(async () => { + await ml.testResources.setKibanaTimeZoneToUTC(); + await ml.securityUI.loginAsMlPowerUser(); + + await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/ml/farequote'); + await kibanaServer.importExport.load(dashboardArchive); + await browser.setWindowSize(1920, 1080); + }); + + after(async () => { + await ml.api.cleanMlIndices(); + await kibanaServer.importExport.unload(dashboardArchive); + }); + + beforeEach(async () => { + await PageObjects.common.navigateToApp('dashboard'); + }); + + let tabsCount = 1; + + afterEach(async () => { + if (tabsCount > 1) { + await browser.closeCurrentWindow(); + await retrySwitchTab(0, 10); + tabsCount--; + } + }); + + it('can create multi metric job from vis with single layer', async () => { + const selectedPanelTitle = 'panel1'; + const jobId = 'job_from_lens_1'; + const splitField = 'airline'; + const numberOfCompatibleLayers = 1; + const numberOfIncompatibleLayers = 0; + + await dashboardPreparation(selectedPanelTitle); + + await ml.lensVisualizations.clickCreateMLJobMenuAction(); + + await ml.lensVisualizations.assertLensLayerSelectorExists(); + + await ml.lensVisualizations.assertNumberOfCompatibleLensLayers(numberOfCompatibleLayers); + + await ml.lensVisualizations.assertNumberOfIncompatibleLensLayers(numberOfIncompatibleLayers); + + ml.lensVisualizations.clickCreateJobFromLayerWithWizard(0); + + await retrySwitchTab(1, 10); + tabsCount++; + + await createJobInWizard(jobId, splitField, undefined); + }); + + it('can create single metric job from vis with single layer', async () => { + const selectedPanelTitle = 'panel2'; + const aggAndFieldIdentifier = 'Count(Event rate)'; + const jobId = 'job_from_lens_2'; + const numberOfCompatibleLayers = 1; + const numberOfIncompatibleLayers = 0; + + await dashboardPreparation(selectedPanelTitle); + + await ml.lensVisualizations.clickCreateMLJobMenuAction(); + + await ml.lensVisualizations.assertLensLayerSelectorExists(); + + await ml.lensVisualizations.assertNumberOfCompatibleLensLayers(numberOfCompatibleLayers); + + await ml.lensVisualizations.assertNumberOfIncompatibleLensLayers(numberOfIncompatibleLayers); + + ml.lensVisualizations.clickCreateJobFromLayerWithWizard(0); + + await retrySwitchTab(1, 10); + tabsCount++; + + await createJobInWizard(jobId, undefined, aggAndFieldIdentifier); + }); + + it('can create multi metric job from vis with multiple compatible layers and single incompatible layer', async () => { + const selectedPanelTitle = 'panel3'; + const aggAndFieldIdentifier = 'Mean(responsetime)'; + const jobId = 'job_from_lens_3'; + const numberOfCompatibleLayers = 2; + const numberOfIncompatibleLayers = 1; + + await dashboardPreparation(selectedPanelTitle); + + await ml.lensVisualizations.clickCreateMLJobMenuAction(); + + await ml.lensVisualizations.assertLensLayerSelectorExists(); + + await ml.lensVisualizations.assertNumberOfCompatibleLensLayers(numberOfCompatibleLayers); + + await ml.lensVisualizations.assertNumberOfIncompatibleLensLayers(numberOfIncompatibleLayers); + + ml.lensVisualizations.clickCreateJobFromLayerWithWizard(1); + + await retrySwitchTab(1, 10); + tabsCount++; + + await createJobInWizard(jobId, undefined, aggAndFieldIdentifier); + }); + + it('shows flyout for job from vis with no compatible layers', async () => { + const selectedPanelTitle = 'panel4'; + const numberOfCompatibleLayers = 0; + const numberOfIncompatibleLayers = 1; + + await dashboardPreparation(selectedPanelTitle); + + await ml.lensVisualizations.clickCreateMLJobMenuAction(); + + await ml.lensVisualizations.assertLensLayerSelectorExists(); + + await ml.lensVisualizations.assertNumberOfCompatibleLensLayers(numberOfCompatibleLayers); + + await ml.lensVisualizations.assertNumberOfIncompatibleLensLayers(numberOfIncompatibleLayers); + }); + + it('does not show link to ml with vis with only incompatible layer types', async () => { + const selectedPanelTitle = 'panel5'; + + await dashboardPreparation(selectedPanelTitle); + + ml.lensVisualizations.assertMLJobMenuActionDoesNotExist(); + }); + }); +} diff --git a/x-pack/test/functional/services/ml/index.ts b/x-pack/test/functional/services/ml/index.ts index 92898efe4b564..09246da860b52 100644 --- a/x-pack/test/functional/services/ml/index.ts +++ b/x-pack/test/functional/services/ml/index.ts @@ -111,7 +111,7 @@ export function MachineLearningProvider(context: FtrProviderContext) { const jobWizardCommon = MachineLearningJobWizardCommonProvider(context, commonUI, customUrls); const jobWizardMultiMetric = MachineLearningJobWizardMultiMetricProvider(context); const jobWizardPopulation = MachineLearningJobWizardPopulationProvider(context); - const lensVisualizations = MachineLearningLensVisualizationsProvider(context); + const lensVisualizations = MachineLearningLensVisualizationsProvider(context, commonUI); const navigation = MachineLearningNavigationProvider(context); const overviewPage = MachineLearningOverviewPageProvider(context); const securityCommon = MachineLearningSecurityCommonProvider(context); diff --git a/x-pack/test/functional/services/ml/lens_visualizations.ts b/x-pack/test/functional/services/ml/lens_visualizations.ts index 3c05ec234a3c2..1c8a4410f57a7 100644 --- a/x-pack/test/functional/services/ml/lens_visualizations.ts +++ b/x-pack/test/functional/services/ml/lens_visualizations.ts @@ -7,16 +7,23 @@ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../ftr_provider_context'; +import { MlCommonUI } from './common_ui'; -export function MachineLearningLensVisualizationsProvider({ getService }: FtrProviderContext) { +export function MachineLearningLensVisualizationsProvider( + { getService }: FtrProviderContext, + mlCommonUI: MlCommonUI +) { const testSubjects = getService('testSubjects'); return { async clickCreateMLJobMenuAction() { await testSubjects.click('embeddablePanelAction-create-ml-ad-job-action'); }, - async clickCreateJobFromLayer(layerIndex: number) { - await testSubjects.click(`mlLensLayerCompatibleButton_${layerIndex}`); + async clickCreateJob(layerIndex: number) { + await testSubjects.clickWhenNotDisabled(`mlLensLayerCreateJobButton_${layerIndex}`); + }, + async clickCreateJobFromLayerWithWizard(layerIndex: number) { + await testSubjects.click(`mlLensLayerCreateWithWizardButton_${layerIndex}`); }, async assertLensLayerSelectorExists() { await testSubjects.existOrFail('mlFlyoutLensLayerSelector'); @@ -38,5 +45,37 @@ export function MachineLearningLensVisualizationsProvider({ getService }: FtrPro `Expected number of compatible layers to be ${numberOfIncompatibleLayers} (got '${incompatibleLayers.length}')` ); }, + async assertJobIdValue(expectedValue: string, layerIndex: number) { + const actualJobId = await testSubjects.getAttribute( + `mlLensLayerJobIdInput_${layerIndex}`, + 'value' + ); + expect(actualJobId).to.eql( + expectedValue, + `Expected job id value to be '${expectedValue}' (got '${actualJobId}')` + ); + }, + + async setJobId(jobId: string, layerIndex: number) { + await mlCommonUI.setValueWithChecks(`mlLensLayerJobIdInput_${layerIndex}`, jobId, { + clearWithKeyboard: true, + }); + await this.assertJobIdValue(jobId, layerIndex); + }, + + async assertJobHasBeenCreated(layerIndex: number) { + await testSubjects.existOrFail(`mlLensLayerCompatible.jobCreated.success_${layerIndex}`, { + timeout: 60 * 1000, + }); + }, + async clickViewResults(layerIndex: number) { + await testSubjects.click(`mlLensLayerResultsButton_${layerIndex}`); + }, + async singleMetricViewerPageLoaded() { + await testSubjects.existOrFail('~mlPageSingleMetricViewer'); + }, + async anomalyExplorerPageLoaded() { + await testSubjects.existOrFail('~mlPageAnomalyExplorer'); + }, }; } From 7b5819c940fbe9111dc3abf3baafaca4a2d30c68 Mon Sep 17 00:00:00 2001 From: Tre Date: Fri, 26 Aug 2022 09:23:49 +0100 Subject: [PATCH 12/28] [Archive Migrations] x-pack dashboard/session_in_spaces (#136531) * [Archive Migrations] x-pack dashboard/session_in_spaces Replaces the old es archive with kbn archive. Change test to use new archive. Helps with: https://github.com/elastic/kibana/issues/102552 * fix deleting sessions * improve Co-authored-by: Anton Dosov --- scripts/archive_migration_functions.sh | 129 ++++--- .../dashboard/session_in_space/data.json | 328 ------------------ .../dashboard/session_in_space/mappings.json | 205 ----------- .../dashboard/session_in_another_space.json | 77 ++++ .../dashboard/session_in_space.json | 255 ++++++++++++++ .../functional/services/search_sessions.ts | 20 +- .../apps/dashboard/async_search/index.ts | 1 + .../async_search/sessions_in_space.ts | 159 +++------ .../apps/dashboard/session_sharing/index.ts | 5 + .../tests/apps/discover/sessions_in_space.ts | 160 ++++----- .../tests/apps/lens/index.ts | 6 + .../apps/management/search_sessions/index.ts | 2 + .../search_sessions/sessions_management.ts | 1 + 13 files changed, 563 insertions(+), 785 deletions(-) delete mode 100644 x-pack/test/functional/es_archives/dashboard/session_in_space/data.json delete mode 100644 x-pack/test/functional/es_archives/dashboard/session_in_space/mappings.json create mode 100644 x-pack/test/functional/fixtures/kbn_archiver/dashboard/session_in_another_space.json create mode 100644 x-pack/test/functional/fixtures/kbn_archiver/dashboard/session_in_space.json diff --git a/scripts/archive_migration_functions.sh b/scripts/archive_migration_functions.sh index 391a7d766e81b..be8300ec022a2 100644 --- a/scripts/archive_migration_functions.sh +++ b/scripts/archive_migration_functions.sh @@ -2,11 +2,76 @@ standard_list="url,index-pattern,query,graph-workspace,tag,visualization,canvas-element,canvas-workpad,dashboard,search,lens,map,cases,uptime-dynamic-settings,osquery-saved-query,osquery-pack,infrastructure-ui-source,metrics-explorer-view,inventory-view,infrastructure-monitoring-log-view,apm-indices" -orig_archive="x-pack/test/functional/es_archives/reporting/ecommerce_kibana_spaces" -new_archive="x-pack/test/functional/fixtures/kbn_archiver/reporting/ecommerce_kibana_spaces" -newArchives=("x-pack/test/functional/fixtures/kbn_archiver/reporting/ecommerce_kibana_non_default_space") -newArchives+=("x-pack/test/functional/fixtures/kbn_archiver/reporting/ecommerce_kibana_non_timezone_space") -test_config="x-pack/test/reporting_api_integration/reporting_and_security.config.ts" +orig_archive="x-pack/test/functional/es_archives/dashboard/session_in_space" +new_archive="x-pack/test/functional/fixtures/kbn_archiver/dashboard/session_in_space" +newArchives=("x-pack/test/functional/fixtures/kbn_archiver/dashboard/session_in_space") +newArchives+=("x-pack/test/functional/fixtures/kbn_archiver/dashboard/session_in_another_space") +test_config="x-pack/test/search_sessions_integration/config.ts" + +curl_so_count() { + local so=${1:-search-session} + local count + count=$(curl -s -XGET "http://elastic:changeme@localhost:9220/.kibana/_count" -H "kbn-xsrf: archive-migration-functions" -H "Content-Type: application/json" -d' +{ + "query": { + "bool": { + "should": [ + { + "match_phrase": { + "type": "${so}" + } + } + ] + } + } +}' | jq '.count') + + echo " ### [${so}] count: ${count}" +} + +watch_so_count() { + local so=${1:-search-session} + + while true; do + curl_so_count "$so" + sleep 1 + done +} + +create_space() { + # Ex: Id, Name, and Disabled Features. + # create_space tre "Tre Space" apm,ml,canvas,dashboard,visualize,maps,monitoring,uptime + # Ex: Id. Name is generated + # create_space rashmi + # Ex: Id and Name. No disabled features. + # create_space another-space "Another Space" + local id=${1:-sales} + local upperCased + upperCased=$(echo "${id:0:1}" | tr '[:lower:]' '[:upper:]')"${id:1}" + local name=${2:-$upperCased} + local disabledFeatures=${3:-} + + if [[ -n $3 ]]; then + disabledFeatures="$3" + fi + + # Use jq to create the i and n variables, then inject them. + local payload + payload=$(jq -n --arg i "$id" --arg n "$name" --arg df "$disabledFeatures" \ + '{ "id": $i, "name": $n, "disabledFeatures": [$df] }') + + curl -H "Content-Type: application/json" -H "kbn-xsrf: archive-migration-functions" \ + -X POST -d "$payload" \ + --user elastic:changeme http://localhost:5620/api/spaces/space +} + +delete_space() { + local id=${1:?Need a space id.} + + curl -H "kbn-xsrf: archive-migration-functions" \ + -X DELETE \ + --user elastic:changeme http://localhost:5620/api/spaces/space/"$id" +} arrayify_csv() { local xs=${1} @@ -31,11 +96,6 @@ intersection() { echo "${intersections[@]}" } -# Just a note that this is using Gnu date. -# On OSX if you don't install this, and instead use the native date you only get seconds. -# With gdate you can something like nanoseconds. -alias timestamp='while read line; do echo "[`gdate +%H:%M:%S.%N`] $line"; done' - is_zipped() { local archive=$1 @@ -98,6 +158,7 @@ _find_config() { local current local parent + local grandParent local greatGrand current=$(dirname "$test_file") parent=$(dirname "$current") @@ -107,8 +168,9 @@ _find_config() { local dirs=("$current" "$parent" "$grandParent" "$greatGrand") local configs=() + local config for x in "${dirs[@]}"; do - local config=$(find "$x" -maxdepth 1 -type f -name '*config.js' -or -name '*config.ts') + config=$(find "$x" -maxdepth 1 -type f -name '*config.js' -or -name '*config.ts') if [ -n "$config" ]; then configs+=("$config") fi @@ -277,42 +339,29 @@ save_kbn() { load_kbn() { local space=${1:-default} + local archive=${2:-${new_archive}} set -x - node scripts/kbn_archiver.js --config "$test_config" load "$new_archive" --space "$space" - set +x -} - -load_kbns() { - local space=${1:-default} - - for x in "${newArchives[@]}"; do - set -x - node scripts/kbn_archiver.js --config "$test_config" load "$x" --space "$space" - set +x - done -} - -load_created_kbn_archive() { - set -x - node scripts/kbn_archiver.js --config "$test_config" load "$new_archive" + node scripts/kbn_archiver.js --config "$test_config" load "$archive" --space "$space" set +x } unload_kbn() { + local archive=${1:-${new_archive}} set -x - node scripts/kbn_archiver.js --config "$test_config" unload "$new_archive" + node scripts/kbn_archiver.js --config "$test_config" unload "$archive" set +x } -unload_kbns() { - local space=${1:-default} +load_kbn_custom() { + load_kbn default "${newArchives[1]}" + create_space another-space "Another Space" + load_kbn another-space "${newArchives[2]}" +} - for x in "${newArchives[@]}"; do - set -x - node scripts/kbn_archiver.js --config "$test_config" unload "$x" - set +x - done +unload_kbn_custom() { + unload_kbn "${newArchives[1]}" + delete_space another-space } ping_server() { @@ -338,14 +387,6 @@ run_test() { set +x } -run_test_with_timestamp() { - local config=${1:-$test_config} - - set -x - node scripts/functional_test_runner --config "$config" | timestamp - set +x -} - run_test_extra() { set -x node scripts/functional_test_runner --config "$test_config" \ diff --git a/x-pack/test/functional/es_archives/dashboard/session_in_space/data.json b/x-pack/test/functional/es_archives/dashboard/session_in_space/data.json deleted file mode 100644 index 64756843245a3..0000000000000 --- a/x-pack/test/functional/es_archives/dashboard/session_in_space/data.json +++ /dev/null @@ -1,328 +0,0 @@ -{ - "type": "doc", - "value": { - "id": "space:default", - "index": ".kibana", - "source": { - "space": { - "description": "This is the default space!", - "name": "Default" - }, - "type": "space" - } - } -} - -{ - "type": "doc", - "value": { - "id": "space:another-space", - "index": ".kibana", - "source": { - "space": { - "description": "This is another space", - "name": "Another Space" - }, - "type": "space" - } - } -} - -{ - "type": "doc", - "value": { - "id": "visualization:6c9f3830-01e3-11eb-9b63-176d7b28a352", - "index": ".kibana", - "source": { - "type": "visualization", - "visualization": { - "description": "", - "kibanaSavedObjectMeta": { - "searchSourceJSON": "{\"index\":\"logstash-*\",\"query\":{\"query_string\":{\"query\":\"*\",\"analyze_wildcard\":true}},\"filter\":[]}" - }, - "title": "Sum of Bytes by Extension (Delayed 5s)", - "uiStateJSON": "{}", - "version": 1, - "visState": "{\"title\":\"Sum of Bytes by Extension (Delayed 5s)\",\"type\":\"histogram\",\"aggs\":[{\"id\":\"1\",\"enabled\":true,\"type\":\"sum\",\"params\":{\"field\":\"bytes\"},\"schema\":\"metric\"},{\"id\":\"2\",\"enabled\":true,\"type\":\"terms\",\"params\":{\"field\":\"extension.raw\",\"orderBy\":\"1\",\"order\":\"desc\",\"size\":5,\"otherBucket\":false,\"otherBucketLabel\":\"Other\",\"missingBucket\":false,\"missingBucketLabel\":\"Missing\"},\"schema\":\"segment\"},{\"id\":\"3\",\"enabled\":true,\"type\":\"shard_delay\",\"params\":{\"delay\":\"5s\"},\"schema\":\"group\"}],\"params\":{\"type\":\"histogram\",\"grid\":{\"categoryLines\":false},\"categoryAxes\":[{\"id\":\"CategoryAxis-1\",\"type\":\"category\",\"position\":\"bottom\",\"show\":true,\"style\":{},\"scale\":{\"type\":\"linear\"},\"labels\":{\"show\":true,\"filter\":true,\"truncate\":100},\"title\":{}}],\"valueAxes\":[{\"id\":\"ValueAxis-1\",\"name\":\"LeftAxis-1\",\"type\":\"value\",\"position\":\"left\",\"show\":true,\"style\":{},\"scale\":{\"type\":\"linear\",\"mode\":\"normal\"},\"labels\":{\"show\":true,\"rotate\":0,\"filter\":false,\"truncate\":100},\"title\":{\"text\":\"Sum of bytes\"}}],\"seriesParams\":[{\"show\":true,\"type\":\"histogram\",\"mode\":\"stacked\",\"data\":{\"label\":\"Sum of bytes\",\"id\":\"1\"},\"valueAxis\":\"ValueAxis-1\",\"drawLinesBetweenPoints\":true,\"lineWidth\":2,\"showCircles\":true}],\"addTooltip\":true,\"addLegend\":true,\"legendPosition\":\"right\",\"times\":[],\"addTimeMarker\":false,\"labels\":{\"show\":false},\"thresholdLine\":{\"show\":false,\"value\":10,\"width\":1,\"style\":\"full\",\"color\":\"#E7664C\"},\"row\":true}}" - } - } - } -} - -{ - "type": "doc", - "value": { - "id": "visualization:14501a50-01e3-11eb-9b63-176d7b28a352", - "index": ".kibana", - "source": { - "type": "visualization", - "visualization": { - "description": "", - "kibanaSavedObjectMeta": { - "searchSourceJSON": "{\"index\":\"logstash-*\",\"query\":{\"query_string\":{\"query\":\"*\",\"analyze_wildcard\":true}},\"filter\":[]}" - }, - "title": "Sum of Bytes by Extension", - "uiStateJSON": "{}", - "version": 1, - "visState": "{\"title\":\"Sum of Bytes by Extension\",\"type\":\"histogram\",\"aggs\":[{\"id\":\"1\",\"enabled\":true,\"type\":\"sum\",\"params\":{\"field\":\"bytes\"},\"schema\":\"metric\"},{\"id\":\"2\",\"enabled\":true,\"type\":\"terms\",\"params\":{\"field\":\"extension.raw\",\"orderBy\":\"1\",\"order\":\"desc\",\"size\":5,\"otherBucket\":false,\"otherBucketLabel\":\"Other\",\"missingBucket\":false,\"missingBucketLabel\":\"Missing\"},\"schema\":\"segment\"}],\"params\":{\"type\":\"histogram\",\"grid\":{\"categoryLines\":false},\"categoryAxes\":[{\"id\":\"CategoryAxis-1\",\"type\":\"category\",\"position\":\"bottom\",\"show\":true,\"style\":{},\"scale\":{\"type\":\"linear\"},\"labels\":{\"show\":true,\"filter\":true,\"truncate\":100},\"title\":{}}],\"valueAxes\":[{\"id\":\"ValueAxis-1\",\"name\":\"LeftAxis-1\",\"type\":\"value\",\"position\":\"left\",\"show\":true,\"style\":{},\"scale\":{\"type\":\"linear\",\"mode\":\"normal\"},\"labels\":{\"show\":true,\"rotate\":0,\"filter\":false,\"truncate\":100},\"title\":{\"text\":\"Sum of bytes\"}}],\"seriesParams\":[{\"show\":true,\"type\":\"histogram\",\"mode\":\"stacked\",\"data\":{\"label\":\"Sum of bytes\",\"id\":\"1\"},\"valueAxis\":\"ValueAxis-1\",\"drawLinesBetweenPoints\":true,\"lineWidth\":2,\"showCircles\":true}],\"addTooltip\":true,\"addLegend\":true,\"legendPosition\":\"right\",\"times\":[],\"addTimeMarker\":false,\"labels\":{\"show\":false},\"thresholdLine\":{\"show\":false,\"value\":10,\"width\":1,\"style\":\"full\",\"color\":\"#E7664C\"},\"row\":true}}" - } - } - } -} - -{ - "type": "doc", - "value": { - "id": "visualization:50a67010-075d-11eb-be70-0bd5e8b57d02", - "index": ".kibana", - "source": { - "type": "visualization", - "visualization": { - "description": "", - "kibanaSavedObjectMeta": { - "searchSourceJSON": "{\"index\":\"logstash-*\",\"query\":{\"query_string\":{\"query\":\"*\",\"analyze_wildcard\":true}},\"filter\":[]}" - }, - "title": "Sum of Bytes by Extension (Delayed 15s)", - "uiStateJSON": "{}", - "version": 1, - "visState": "{\"title\":\"Sum of Bytes by Extension (Delayed 15s)\",\"type\":\"histogram\",\"aggs\":[{\"id\":\"1\",\"enabled\":true,\"type\":\"sum\",\"params\":{\"field\":\"bytes\"},\"schema\":\"metric\"},{\"id\":\"2\",\"enabled\":true,\"type\":\"terms\",\"params\":{\"field\":\"extension.raw\",\"orderBy\":\"1\",\"order\":\"desc\",\"size\":5,\"otherBucket\":false,\"otherBucketLabel\":\"Other\",\"missingBucket\":false,\"missingBucketLabel\":\"Missing\"},\"schema\":\"segment\"},{\"id\":\"3\",\"enabled\":true,\"type\":\"shard_delay\",\"params\":{\"delay\":\"15s\"},\"schema\":\"group\"}],\"params\":{\"type\":\"histogram\",\"grid\":{\"categoryLines\":false},\"categoryAxes\":[{\"id\":\"CategoryAxis-1\",\"type\":\"category\",\"position\":\"bottom\",\"show\":true,\"style\":{},\"scale\":{\"type\":\"linear\"},\"labels\":{\"show\":true,\"filter\":true,\"truncate\":100},\"title\":{}}],\"valueAxes\":[{\"id\":\"ValueAxis-1\",\"name\":\"LeftAxis-1\",\"type\":\"value\",\"position\":\"left\",\"show\":true,\"style\":{},\"scale\":{\"type\":\"linear\",\"mode\":\"normal\"},\"labels\":{\"show\":true,\"rotate\":0,\"filter\":false,\"truncate\":100},\"title\":{\"text\":\"Sum of bytes\"}}],\"seriesParams\":[{\"show\":true,\"type\":\"histogram\",\"mode\":\"stacked\",\"data\":{\"label\":\"Sum of bytes\",\"id\":\"1\"},\"valueAxis\":\"ValueAxis-1\",\"drawLinesBetweenPoints\":true,\"lineWidth\":2,\"showCircles\":true}],\"addTooltip\":true,\"addLegend\":true,\"legendPosition\":\"right\",\"times\":[],\"addTimeMarker\":false,\"labels\":{\"show\":false},\"thresholdLine\":{\"show\":false,\"value\":10,\"width\":1,\"style\":\"full\",\"color\":\"#E7664C\"},\"row\":true}}" - } - } - } -} - -{ - "type": "doc", - "value": { - "id": "index-pattern:logstash-*", - "index": ".kibana", - "source": { - "index-pattern": { - "fields": "[{\"name\":\"referer\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"agent\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":true,\"doc_values\":false},{\"name\":\"relatedContent.og:image:width\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":true,\"doc_values\":false},{\"name\":\"relatedContent.og:type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":true,\"doc_values\":false},{\"name\":\"xss.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"headings.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"relatedContent.og:description\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":true,\"doc_values\":false},{\"name\":\"meta.user.lastname\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"relatedContent.article:tag.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"geo.dest\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"relatedContent.twitter:image\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":true,\"doc_values\":false},{\"name\":\"relatedContent.article:section.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"utc_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"relatedContent.twitter:card\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":true,\"doc_values\":false},{\"name\":\"meta.char\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"clientip\",\"type\":\"ip\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"relatedContent.og:image:height\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":true,\"doc_values\":false},{\"name\":\"host\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":true,\"doc_values\":false},{\"name\":\"machine.ram\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"links\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":true,\"doc_values\":false},{\"name\":\"id\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"@tags.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"phpmemory\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"relatedContent.twitter:card.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"ip\",\"type\":\"ip\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"relatedContent.og:image\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":true,\"doc_values\":false},{\"name\":\"relatedContent.article:modified_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"index\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":true,\"doc_values\":false},{\"name\":\"relatedContent.url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":true,\"doc_values\":false},{\"name\":\"relatedContent.og:site_name.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"request.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"relatedContent.article:tag\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":true,\"doc_values\":false},{\"name\":\"agent.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"spaces\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":true,\"doc_values\":false},{\"name\":\"relatedContent.twitter:site.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"headings\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":true,\"doc_values\":false},{\"name\":\"_source\",\"type\":\"_source\",\"count\":0,\"scripted\":false,\"indexed\":false,\"analyzed\":false,\"doc_values\":false},{\"name\":\"relatedContent.og:image.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"request\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":true,\"doc_values\":false},{\"name\":\"index.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"extension\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":true,\"doc_values\":false},{\"name\":\"memory\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"_index\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":false,\"analyzed\":false,\"doc_values\":false},{\"name\":\"relatedContent.twitter:site\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":true,\"doc_values\":false},{\"name\":\"relatedContent.twitter:description\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":true,\"doc_values\":false},{\"name\":\"relatedContent.og:url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":true,\"doc_values\":false},{\"name\":\"geo.coordinates\",\"type\":\"geo_point\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"relatedContent.url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"meta.related\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":true,\"doc_values\":false},{\"name\":\"relatedContent.twitter:title.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"relatedContent.og:title.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"response.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"@message.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"machine.os\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":true,\"doc_values\":false},{\"name\":\"relatedContent.article:section\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":true,\"doc_values\":false},{\"name\":\"relatedContent.og:url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"xss\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":true,\"doc_values\":false},{\"name\":\"links.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"relatedContent.og:title\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":true,\"doc_values\":false},{\"name\":\"geo.srcdest\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"extension.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"machine.os.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"@tags\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":true,\"doc_values\":false},{\"name\":\"host.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"relatedContent.og:type.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"geo.src\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"spaces.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"relatedContent.og:image:height.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":true,\"doc_values\":false},{\"name\":\"relatedContent.twitter:description.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"relatedContent.og:site_name\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":true,\"doc_values\":false},{\"name\":\"relatedContent.twitter:title\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":true,\"doc_values\":false},{\"name\":\"@message\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":true,\"doc_values\":false},{\"name\":\"relatedContent.twitter:image.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"@timestamp\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"bytes\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"response\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":true,\"doc_values\":false},{\"name\":\"meta.user.firstname\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":true,\"doc_values\":false},{\"name\":\"relatedContent.og:image:width.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"relatedContent.og:description.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"relatedContent.article:published_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"_id\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":false,\"analyzed\":false,\"doc_values\":false},{\"name\":\"_type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":false,\"analyzed\":false,\"doc_values\":false},{\"name\":\"_score\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"indexed\":false,\"analyzed\":false,\"doc_values\":false}]", - "timeFieldName": "@timestamp", - "title": "logstash-*" - }, - "type": "index-pattern" - } - } -} - -{ - "type": "doc", - "value": { - "id": "dashboard:24f3f950-69d9-11ea-a14d-e341629a29e6", - "index": ".kibana", - "source": { - "dashboard": { - "description": "", - "hits": 0, - "kibanaSavedObjectMeta": { - "searchSourceJSON": "{\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filter\":[]}" - }, - "optionsJSON": "{\"useMargins\":true,\"hidePanelTitles\":false}", - "panelsJSON": "[{\"version\":\"7.10.0\",\"gridData\":{\"x\":0,\"y\":0,\"w\":24,\"h\":15,\"i\":\"f8f7f5b5-b840-443c-a766-d22a8a87c493\"},\"panelIndex\":\"f8f7f5b5-b840-443c-a766-d22a8a87c493\",\"embeddableConfig\":{},\"panelRefName\":\"panel_0\"}]", - "refreshInterval": { "pause": true, "value": 0 }, - "timeFrom": "2015-09-19T17:34:10.297Z", - "timeRestore": true, - "timeTo": "2015-09-23T00:09:17.180Z", - "title" : "Delayed 5s", - "version": 1 - }, - "references": [ - { - "name" : "panel_0", - "type" : "visualization", - "id" : "6c9f3830-01e3-11eb-9b63-176d7b28a352" - } - ], - "type": "dashboard", - "updated_at": "2020-03-19T11:59:53.701Z" - } - } -} - -{ - "type": "doc", - "value": { - "id": "dashboard:41e77910-69d9-11ea-a14d-e341629a29e6", - "index": ".kibana", - "source": { - "dashboard": { - "description": "", - "hits": 0, - "kibanaSavedObjectMeta": { - "searchSourceJSON": "{\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filter\":[]}" - }, - "optionsJSON": "{\"useMargins\":true,\"hidePanelTitles\":false}", - "panelsJSON": "[{\"version\":\"7.7.0\",\"gridData\":{\"w\":24,\"h\":15,\"x\":0,\"y\":0,\"i\":\"8c5df6b2-0cc9-4887-a2d9-6a9a192f3407\"},\"panelIndex\":\"8c5df6b2-0cc9-4887-a2d9-6a9a192f3407\",\"embeddableConfig\":{},\"panelRefName\":\"panel_0\"}]", - "refreshInterval": { "pause": true, "value": 0 }, - "timeFrom": "2015-09-19T17:34:10.297Z", - "timeRestore": true, - "timeTo": "2015-09-23T00:09:17.180Z", - "title": "Not Delayed", - "version": 1 - }, - "references": [ - { - "name" : "panel_0", - "type" : "visualization", - "id" : "14501a50-01e3-11eb-9b63-176d7b28a352" - } - ], - "type": "dashboard", - "updated_at": "2020-03-19T11:59:53.701Z" - } - } -} - -{ - "type": "doc", - "value": { - "id": "dashboard:a41c6790-075d-11eb-be70-0bd5e8b57d02", - "index": ".kibana", - "source": { - "dashboard": { - "description": "", - "hits": 0, - "kibanaSavedObjectMeta": { - "searchSourceJSON": "{\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filter\":[]}" - }, - "optionsJSON": "{\"useMargins\":true,\"hidePanelTitles\":false}", - "panelsJSON": "[{\"version\":\"7.7.0\",\"gridData\":{\"w\":24,\"h\":15,\"x\":0,\"y\":0,\"i\":\"eedeb943-5cfc-4e2c-bc1a-10ce06345cc1\"},\"panelIndex\":\"eedeb943-5cfc-4e2c-bc1a-10ce06345cc1\",\"embeddableConfig\":{},\"panelRefName\":\"panel_0\"}]", - "refreshInterval": { "pause": true, "value": 0 }, - "timeFrom": "2015-09-19T17:34:10.297Z", - "timeRestore": true, - "timeTo": "2015-09-23T00:09:17.180Z", - "title": "Delayed 15s", - "version": 1 - }, - "references": [ - { - "name" : "panel_0", - "type" : "visualization", - "id" : "50a67010-075d-11eb-be70-0bd5e8b57d02" - } - ], - "type": "dashboard", - "updated_at": "2020-03-19T11:59:53.701Z" - } - } -} - -{ - "type": "doc", - "value": { - "id": "dashboard:a41c6790-075d-11eb-be70-0bd5e8b57d03", - "index": ".kibana", - "source": { - "dashboard": { - "description": "", - "hits": 0, - "kibanaSavedObjectMeta": { - "searchSourceJSON": "{\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filter\":[]}" - }, - "optionsJSON": "{\"useMargins\":true,\"hidePanelTitles\":false}", - "panelsJSON": "[{\"version\":\"8.0.0\",\"gridData\":{\"x\":0,\"y\":0,\"w\":24,\"h\":15,\"i\":\"ec585931-ce8e-43fd-aa94-a1a9612d24ba\"},\"panelIndex\":\"ec585931-ce8e-43fd-aa94-a1a9612d24ba\",\"embeddableConfig\":{},\"panelRefName\":\"panel_0\"},{\"version\":\"8.0.0\",\"gridData\":{\"x\":24,\"y\":0,\"w\":24,\"h\":15,\"i\":\"c7b18010-462b-4e55-a974-fdec2ae64b06\"},\"panelIndex\":\"c7b18010-462b-4e55-a974-fdec2ae64b06\",\"embeddableConfig\":{},\"panelRefName\":\"panel_1\"},{\"version\":\"8.0.0\",\"gridData\":{\"x\":0,\"y\":15,\"w\":24,\"h\":15,\"i\":\"e67704f7-20b7-4ade-8dee-972a9d187107\"},\"panelIndex\":\"e67704f7-20b7-4ade-8dee-972a9d187107\",\"embeddableConfig\":{},\"panelRefName\":\"panel_2\"},{\"version\":\"8.0.0\",\"gridData\":{\"x\":24,\"y\":15,\"w\":24,\"h\":15,\"i\":\"f0b03592-10f1-41cd-9929-0cb4163bcd16\"},\"panelIndex\":\"f0b03592-10f1-41cd-9929-0cb4163bcd16\",\"embeddableConfig\":{},\"panelRefName\":\"panel_3\"}]", - "refreshInterval": { "pause": true, "value": 0 }, - "timeFrom": "2015-09-19T17:34:10.297Z", - "timeRestore": true, - "timeTo": "2015-09-23T00:09:17.180Z", - "title": "Multiple delayed", - "version": 1 - }, - "references": [ - { - "id": "14501a50-01e3-11eb-9b63-176d7b28a352", - "name": "panel_0", - "type": "visualization" - }, - { - "id": "50a67010-075d-11eb-be70-0bd5e8b57d02", - "name": "panel_1", - "type": "visualization" - }, - { - "id": "6c9f3830-01e3-11eb-9b63-176d7b28a352", - "name": "panel_2", - "type": "visualization" - }, - { - "id": "50a67010-075d-11eb-be70-0bd5e8b57d02", - "name": "panel_3", - "type": "visualization" - } - ], - "type": "dashboard", - "updated_at": "2020-03-19T11:59:53.701Z" - } - } -} - -{ - "type": "doc", - "value": { - "index": ".kibana", - "type": "doc", - "id": "another-space:index-pattern:logstash-*", - "source": { - "index-pattern": { - "title": "logstash-*", - "timeFieldName": "@timestamp", - "fields": "[{\"name\":\"@message\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"@message.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"@tags\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"@tags.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"@timestamp\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"_id\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"_index\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"_score\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":false,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"_source\",\"type\":\"_source\",\"count\":0,\"scripted\":false,\"searchable\":false,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"_type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"agent\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"agent.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"bytes\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"clientip\",\"type\":\"ip\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"extension\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"extension.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.coordinates\",\"type\":\"geo_point\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.dest\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.src\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.srcdest\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"headings\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"headings.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"host\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"host.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"id\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"index\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"index.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"ip\",\"type\":\"ip\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"links\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"links.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"machine.os\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"machine.os.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"machine.ram\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"memory\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"meta.char\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"meta.related\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"meta.user.firstname\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"meta.user.lastname\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"phpmemory\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"referer\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:modified_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:published_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:section\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.article:section.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:tag\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.article:tag.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:description\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:description.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:image\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:image.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:image:height\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:image:height.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:image:width\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:image:width.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:site_name\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:site_name.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:title\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:title.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:type.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:card\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:card.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:description\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:description.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:image\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:image.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:site\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:site.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:title\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:title.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"request\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"request.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"response\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"response.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"spaces\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"spaces.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"utc_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"xss\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"xss.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true}]" - }, - "type": "index-pattern", - "namespace": "another-space", - "updated_at": "2018-12-21T00:43:07.096Z" - } - } -} - -{ - "type": "doc", - "value": { - "index": ".kibana", - "type": "doc", - "id": "another-space:visualization:75c3e060-1e7c-11e9-8488-65449e65d0ed", - "source": { - "visualization": { - "title": "A Pie in another space", - "visState": "{\"title\":\"A Pie\",\"type\":\"pie\",\"params\":{\"type\":\"pie\",\"addTooltip\":true,\"addLegend\":true,\"legendPosition\":\"right\",\"isDonut\":true,\"labels\":{\"show\":false,\"values\":true,\"last_level\":true,\"truncate\":100},\"dimensions\":{\"metric\":{\"accessor\":0,\"format\":{\"id\":\"number\"},\"params\":{},\"aggType\":\"count\"}}},\"aggs\":[{\"id\":\"1\",\"enabled\":true,\"type\":\"count\",\"schema\":\"metric\",\"params\":{}},{\"id\":\"2\",\"enabled\":true,\"type\":\"terms\",\"schema\":\"segment\",\"params\":{\"field\":\"geo.src\",\"size\":5,\"order\":\"desc\",\"orderBy\":\"1\",\"otherBucket\":false,\"otherBucketLabel\":\"Other\",\"missingBucket\":false,\"missingBucketLabel\":\"Missing\"}}]}", - "uiStateJSON": "{}", - "description": "", - "version": 1, - "kibanaSavedObjectMeta": { - "searchSourceJSON": "{\"index\":\"logstash-*\",\"query\":{\"query\":\"\",\"language\":\"lucene\"},\"filter\":[]}" - } - }, - "namespace": "another-space", - "type": "visualization", - "updated_at": "2019-01-22T19:32:31.206Z" - } - } -} - -{ - "type": "doc", - "value": { - "index": ".kibana", - "type": "doc", - "id": "another-space:dashboard:my-dashboard", - "source": { - "dashboard": { - "title": "A Dashboard in another space", - "hits": 0, - "description": "", - "panelsJSON": "[{\"gridData\":{\"w\":24,\"h\":15,\"x\":0,\"y\":0,\"i\":\"1\"},\"version\":\"7.0.0\",\"panelIndex\":\"1\",\"type\":\"visualization\",\"id\":\"75c3e060-1e7c-11e9-8488-65449e65d0ed\",\"embeddableConfig\":{}}]", - "optionsJSON": "{\"darkTheme\":false,\"useMargins\":true,\"hidePanelTitles\":false}", - "version": 1, - "timeRestore": false, - "kibanaSavedObjectMeta": { - "searchSourceJSON": "{\"query\":{\"query\":\"\",\"language\":\"lucene\"},\"filter\":[]}" - } - }, - "namespace": "another-space", - "type": "dashboard", - "updated_at": "2019-01-22T19:32:47.232Z" - } - } -} \ No newline at end of file diff --git a/x-pack/test/functional/es_archives/dashboard/session_in_space/mappings.json b/x-pack/test/functional/es_archives/dashboard/session_in_space/mappings.json deleted file mode 100644 index 8382a490ac230..0000000000000 --- a/x-pack/test/functional/es_archives/dashboard/session_in_space/mappings.json +++ /dev/null @@ -1,205 +0,0 @@ -{ - "type": "index", - "value": { - "aliases": { - ".kibana": {} - }, - "index": ".kibana_1", - "mappings": { - "properties": { - "config": { - "dynamic": "true", - "properties": { - "buildNum": { - "type": "keyword" - } - } - }, - "dashboard": { - "dynamic": "strict", - "properties": { - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "optionsJSON": { - "type": "text" - }, - "panelsJSON": { - "type": "text" - }, - "refreshInterval": { - "properties": { - "display": { - "type": "keyword" - }, - "pause": { - "type": "boolean" - }, - "section": { - "type": "integer" - }, - "value": { - "type": "integer" - } - } - }, - "timeFrom": { - "type": "keyword" - }, - "timeRestore": { - "type": "boolean" - }, - "timeTo": { - "type": "keyword" - }, - "title": { - "type": "text" - }, - "uiStateJSON": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, - "index-pattern": { - "dynamic": "strict", - "properties": { - "fieldFormatMap": { - "type": "text" - }, - "fields": { - "type": "text" - }, - "intervalName": { - "type": "keyword" - }, - "notExpandable": { - "type": "boolean" - }, - "sourceFilters": { - "type": "text" - }, - "timeFieldName": { - "type": "keyword" - }, - "title": { - "type": "text" - } - } - }, - "search": { - "dynamic": "strict", - "properties": { - "columns": { - "type": "keyword" - }, - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "sort": { - "type": "keyword" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, - "server": { - "dynamic": "strict", - "properties": { - "uuid": { - "type": "keyword" - } - } - }, - "type": { - "type": "keyword" - }, - "url": { - "dynamic": "strict", - "properties": { - "accessCount": { - "type": "long" - }, - "accessDate": { - "type": "date" - }, - "createDate": { - "type": "date" - }, - "url": { - "fields": { - "keyword": { - "ignore_above": 2048, - "type": "keyword" - } - }, - "type": "text" - } - } - }, - "visualization": { - "dynamic": "strict", - "properties": { - "description": { - "type": "text" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "savedSearchId": { - "type": "keyword" - }, - "title": { - "type": "text" - }, - "uiStateJSON": { - "type": "text" - }, - "version": { - "type": "integer" - }, - "visState": { - "type": "text" - } - } - } - } - }, - "settings": { - "index": { - "number_of_replicas": "1", - "number_of_shards": "1" - } - } - } -} diff --git a/x-pack/test/functional/fixtures/kbn_archiver/dashboard/session_in_another_space.json b/x-pack/test/functional/fixtures/kbn_archiver/dashboard/session_in_another_space.json new file mode 100644 index 0000000000000..04475287bd8a0 --- /dev/null +++ b/x-pack/test/functional/fixtures/kbn_archiver/dashboard/session_in_another_space.json @@ -0,0 +1,77 @@ +{ + "attributes": { + "fields": "[{\"name\":\"@message\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"@message.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"@tags\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"@tags.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"@timestamp\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"_id\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"_index\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"_score\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":false,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"_source\",\"type\":\"_source\",\"count\":0,\"scripted\":false,\"searchable\":false,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"_type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"agent\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"agent.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"bytes\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"clientip\",\"type\":\"ip\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"extension\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"extension.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.coordinates\",\"type\":\"geo_point\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.dest\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.src\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.srcdest\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"headings\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"headings.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"host\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"host.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"id\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"index\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"index.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"ip\",\"type\":\"ip\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"links\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"links.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"machine.os\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"machine.os.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"machine.ram\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"memory\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"meta.char\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"meta.related\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"meta.user.firstname\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"meta.user.lastname\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"phpmemory\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"referer\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:modified_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:published_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:section\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.article:section.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:tag\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.article:tag.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:description\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:description.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:image\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:image.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:image:height\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:image:height.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:image:width\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:image:width.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:site_name\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:site_name.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:title\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:title.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:type.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:card\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:card.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:description\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:description.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:image\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:image.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:site\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:site.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:title\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:title.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"request\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"request.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"response\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"response.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"spaces\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"spaces.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"utc_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"xss\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"xss.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true}]", + "timeFieldName": "@timestamp", + "title": "logstash-*" + }, + "coreMigrationVersion": "8.4.0", + "id": "d1bd6c84-d9d0-56fb-8a72-63fe60020920", + "migrationVersion": { + "index-pattern": "8.0.0" + }, + "originId": "logstash-*", + "references": [], + "type": "index-pattern", + "updated_at": "2018-12-21T00:43:07.096Z", + "version": "WzI2LDJd" +} + +{ + "attributes": { + "description": "", + "kibanaSavedObjectMeta": { + "searchSourceJSON": "{\"query\":{\"query\":\"\",\"language\":\"lucene\"},\"filter\":[],\"indexRefName\":\"kibanaSavedObjectMeta.searchSourceJSON.index\"}" + }, + "title": "A Pie in another space", + "uiStateJSON": "{}", + "version": 1, + "visState": "{\"title\":\"A Pie\",\"type\":\"pie\",\"params\":{\"type\":\"pie\",\"addTooltip\":true,\"legendPosition\":\"right\",\"isDonut\":true,\"labels\":{\"show\":false,\"values\":true,\"last_level\":true,\"truncate\":100},\"dimensions\":{\"metric\":{\"accessor\":0,\"format\":{\"id\":\"number\"},\"params\":{},\"aggType\":\"count\"}},\"palette\":{\"type\":\"palette\",\"name\":\"kibana_palette\"},\"distinctColors\":true,\"legendDisplay\":\"show\",\"legendSize\":\"auto\"},\"aggs\":[{\"id\":\"1\",\"enabled\":true,\"type\":\"count\",\"schema\":\"metric\",\"params\":{}},{\"id\":\"2\",\"enabled\":true,\"type\":\"terms\",\"schema\":\"segment\",\"params\":{\"field\":\"geo.src\",\"size\":5,\"order\":\"desc\",\"orderBy\":\"1\",\"otherBucket\":false,\"otherBucketLabel\":\"Other\",\"missingBucket\":false,\"missingBucketLabel\":\"Missing\"}}]}" + }, + "coreMigrationVersion": "8.4.0", + "id": "73f456f1-e0df-570b-82c1-0ff40e1321b9", + "migrationVersion": { + "visualization": "8.3.0" + }, + "originId": "75c3e060-1e7c-11e9-8488-65449e65d0ed", + "references": [ + { + "id": "d1bd6c84-d9d0-56fb-8a72-63fe60020920", + "name": "kibanaSavedObjectMeta.searchSourceJSON.index", + "type": "index-pattern" + } + ], + "type": "visualization", + "updated_at": "2019-01-22T19:32:31.206Z", + "version": "WzI4LDJd" +} + +{ + "attributes": { + "description": "", + "hits": 0, + "kibanaSavedObjectMeta": { + "searchSourceJSON": "{\"query\":{\"query\":\"\",\"language\":\"lucene\"},\"filter\":[]}" + }, + "optionsJSON": "{\"darkTheme\":false,\"useMargins\":true,\"hidePanelTitles\":false}", + "panelsJSON": "[{\"version\":\"7.3.0\",\"type\":\"visualization\",\"gridData\":{\"w\":24,\"h\":15,\"x\":0,\"y\":0,\"i\":\"1\"},\"panelIndex\":\"1\",\"embeddableConfig\":{\"enhancements\":{}},\"panelRefName\":\"panel_1\"}]", + "timeRestore": false, + "title": "A Dashboard in another space", + "version": 1 + }, + "coreMigrationVersion": "8.4.0", + "id": "09c616b0-b819-5f6e-b1a0-8c2d73a28e5e", + "migrationVersion": { + "dashboard": "8.3.0" + }, + "originId": "my-dashboard", + "references": [ + { + "id": "73f456f1-e0df-570b-82c1-0ff40e1321b9", + "name": "1:panel_1", + "type": "visualization" + } + ], + "type": "dashboard", + "updated_at": "2019-01-22T19:32:47.232Z", + "version": "WzMwLDJd" +} \ No newline at end of file diff --git a/x-pack/test/functional/fixtures/kbn_archiver/dashboard/session_in_space.json b/x-pack/test/functional/fixtures/kbn_archiver/dashboard/session_in_space.json new file mode 100644 index 0000000000000..718d45e98302f --- /dev/null +++ b/x-pack/test/functional/fixtures/kbn_archiver/dashboard/session_in_space.json @@ -0,0 +1,255 @@ +{ + "attributes": { + "fields": "[{\"name\":\"referer\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"agent\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":true,\"doc_values\":false},{\"name\":\"relatedContent.og:image:width\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":true,\"doc_values\":false},{\"name\":\"relatedContent.og:type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":true,\"doc_values\":false},{\"name\":\"xss.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"headings.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"relatedContent.og:description\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":true,\"doc_values\":false},{\"name\":\"meta.user.lastname\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"relatedContent.article:tag.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"geo.dest\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"relatedContent.twitter:image\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":true,\"doc_values\":false},{\"name\":\"relatedContent.article:section.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"utc_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"relatedContent.twitter:card\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":true,\"doc_values\":false},{\"name\":\"meta.char\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"clientip\",\"type\":\"ip\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"relatedContent.og:image:height\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":true,\"doc_values\":false},{\"name\":\"host\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":true,\"doc_values\":false},{\"name\":\"machine.ram\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"links\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":true,\"doc_values\":false},{\"name\":\"id\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"@tags.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"phpmemory\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"relatedContent.twitter:card.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"ip\",\"type\":\"ip\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"relatedContent.og:image\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":true,\"doc_values\":false},{\"name\":\"relatedContent.article:modified_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"index\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":true,\"doc_values\":false},{\"name\":\"relatedContent.url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":true,\"doc_values\":false},{\"name\":\"relatedContent.og:site_name.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"request.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"relatedContent.article:tag\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":true,\"doc_values\":false},{\"name\":\"agent.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"spaces\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":true,\"doc_values\":false},{\"name\":\"relatedContent.twitter:site.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"headings\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":true,\"doc_values\":false},{\"name\":\"_source\",\"type\":\"_source\",\"count\":0,\"scripted\":false,\"indexed\":false,\"analyzed\":false,\"doc_values\":false},{\"name\":\"relatedContent.og:image.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"request\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":true,\"doc_values\":false},{\"name\":\"index.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"extension\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":true,\"doc_values\":false},{\"name\":\"memory\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"_index\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":false,\"analyzed\":false,\"doc_values\":false},{\"name\":\"relatedContent.twitter:site\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":true,\"doc_values\":false},{\"name\":\"relatedContent.twitter:description\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":true,\"doc_values\":false},{\"name\":\"relatedContent.og:url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":true,\"doc_values\":false},{\"name\":\"geo.coordinates\",\"type\":\"geo_point\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"relatedContent.url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"meta.related\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":true,\"doc_values\":false},{\"name\":\"relatedContent.twitter:title.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"relatedContent.og:title.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"response.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"@message.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"machine.os\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":true,\"doc_values\":false},{\"name\":\"relatedContent.article:section\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":true,\"doc_values\":false},{\"name\":\"relatedContent.og:url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"xss\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":true,\"doc_values\":false},{\"name\":\"links.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"relatedContent.og:title\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":true,\"doc_values\":false},{\"name\":\"geo.srcdest\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"extension.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"machine.os.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"@tags\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":true,\"doc_values\":false},{\"name\":\"host.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"relatedContent.og:type.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"geo.src\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"spaces.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"relatedContent.og:image:height.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":true,\"doc_values\":false},{\"name\":\"relatedContent.twitter:description.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"relatedContent.og:site_name\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":true,\"doc_values\":false},{\"name\":\"relatedContent.twitter:title\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":true,\"doc_values\":false},{\"name\":\"@message\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":true,\"doc_values\":false},{\"name\":\"relatedContent.twitter:image.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"@timestamp\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"bytes\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"response\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":true,\"doc_values\":false},{\"name\":\"meta.user.firstname\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":true,\"doc_values\":false},{\"name\":\"relatedContent.og:image:width.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"relatedContent.og:description.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"relatedContent.article:published_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"_id\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":false,\"analyzed\":false,\"doc_values\":false},{\"name\":\"_type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":false,\"analyzed\":false,\"doc_values\":false},{\"name\":\"_score\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"indexed\":false,\"analyzed\":false,\"doc_values\":false}]", + "timeFieldName": "@timestamp", + "title": "logstash-*" + }, + "coreMigrationVersion": "8.4.0", + "id": "logstash-*", + "migrationVersion": { + "index-pattern": "8.0.0" + }, + "references": [], + "type": "index-pattern", + "version": "WzIxLDJd" +} + +{ + "attributes": { + "description": "", + "kibanaSavedObjectMeta": { + "searchSourceJSON": "{\"query\":{\"query_string\":{\"query\":\"*\",\"analyze_wildcard\":true}},\"filter\":[],\"indexRefName\":\"kibanaSavedObjectMeta.searchSourceJSON.index\"}" + }, + "title": "Sum of Bytes by Extension", + "uiStateJSON": "{}", + "version": 1, + "visState": "{\"title\":\"Sum of Bytes by Extension\",\"type\":\"histogram\",\"aggs\":[{\"id\":\"1\",\"enabled\":true,\"type\":\"sum\",\"params\":{\"field\":\"bytes\"},\"schema\":\"metric\"},{\"id\":\"2\",\"enabled\":true,\"type\":\"terms\",\"params\":{\"field\":\"extension.raw\",\"orderBy\":\"1\",\"order\":\"desc\",\"size\":5,\"otherBucket\":false,\"otherBucketLabel\":\"Other\",\"missingBucket\":false,\"missingBucketLabel\":\"Missing\"},\"schema\":\"segment\"}],\"params\":{\"type\":\"histogram\",\"grid\":{\"categoryLines\":false},\"categoryAxes\":[{\"id\":\"CategoryAxis-1\",\"type\":\"category\",\"position\":\"bottom\",\"show\":true,\"style\":{},\"scale\":{\"type\":\"linear\"},\"labels\":{\"show\":true,\"filter\":true,\"truncate\":100},\"title\":{}}],\"valueAxes\":[{\"id\":\"ValueAxis-1\",\"name\":\"LeftAxis-1\",\"type\":\"value\",\"position\":\"left\",\"show\":true,\"style\":{},\"scale\":{\"type\":\"linear\",\"mode\":\"normal\"},\"labels\":{\"show\":true,\"rotate\":0,\"filter\":false,\"truncate\":100},\"title\":{\"text\":\"Sum of bytes\"}}],\"seriesParams\":[{\"show\":true,\"type\":\"histogram\",\"mode\":\"stacked\",\"data\":{\"label\":\"Sum of bytes\",\"id\":\"1\"},\"valueAxis\":\"ValueAxis-1\",\"drawLinesBetweenPoints\":true,\"lineWidth\":2,\"showCircles\":true,\"circlesRadius\":1}],\"addTooltip\":true,\"addLegend\":true,\"legendPosition\":\"right\",\"times\":[],\"addTimeMarker\":false,\"labels\":{\"show\":false},\"thresholdLine\":{\"show\":false,\"value\":10,\"width\":1,\"style\":\"full\",\"color\":\"#E7664C\"},\"row\":true,\"palette\":{\"type\":\"palette\",\"name\":\"kibana_palette\"},\"isVislibVis\":true,\"detailedTooltip\":true,\"legendSize\":\"auto\"}}" + }, + "coreMigrationVersion": "8.4.0", + "id": "14501a50-01e3-11eb-9b63-176d7b28a352", + "migrationVersion": { + "visualization": "8.3.0" + }, + "references": [ + { + "id": "logstash-*", + "name": "kibanaSavedObjectMeta.searchSourceJSON.index", + "type": "index-pattern" + } + ], + "type": "visualization", + "version": "WzE5LDJd" +} + +{ + "attributes": { + "description": "", + "kibanaSavedObjectMeta": { + "searchSourceJSON": "{\"query\":{\"query_string\":{\"query\":\"*\",\"analyze_wildcard\":true}},\"filter\":[],\"indexRefName\":\"kibanaSavedObjectMeta.searchSourceJSON.index\"}" + }, + "title": "Sum of Bytes by Extension (Delayed 5s)", + "uiStateJSON": "{}", + "version": 1, + "visState": "{\"title\":\"Sum of Bytes by Extension (Delayed 5s)\",\"type\":\"histogram\",\"aggs\":[{\"id\":\"1\",\"enabled\":true,\"type\":\"sum\",\"params\":{\"field\":\"bytes\"},\"schema\":\"metric\"},{\"id\":\"2\",\"enabled\":true,\"type\":\"terms\",\"params\":{\"field\":\"extension.raw\",\"orderBy\":\"1\",\"order\":\"desc\",\"size\":5,\"otherBucket\":false,\"otherBucketLabel\":\"Other\",\"missingBucket\":false,\"missingBucketLabel\":\"Missing\"},\"schema\":\"segment\"},{\"id\":\"3\",\"enabled\":true,\"type\":\"shard_delay\",\"params\":{\"delay\":\"5s\"},\"schema\":\"group\"}],\"params\":{\"type\":\"histogram\",\"grid\":{\"categoryLines\":false},\"categoryAxes\":[{\"id\":\"CategoryAxis-1\",\"type\":\"category\",\"position\":\"bottom\",\"show\":true,\"style\":{},\"scale\":{\"type\":\"linear\"},\"labels\":{\"show\":true,\"filter\":true,\"truncate\":100},\"title\":{}}],\"valueAxes\":[{\"id\":\"ValueAxis-1\",\"name\":\"LeftAxis-1\",\"type\":\"value\",\"position\":\"left\",\"show\":true,\"style\":{},\"scale\":{\"type\":\"linear\",\"mode\":\"normal\"},\"labels\":{\"show\":true,\"rotate\":0,\"filter\":false,\"truncate\":100},\"title\":{\"text\":\"Sum of bytes\"}}],\"seriesParams\":[{\"show\":true,\"type\":\"histogram\",\"mode\":\"stacked\",\"data\":{\"label\":\"Sum of bytes\",\"id\":\"1\"},\"valueAxis\":\"ValueAxis-1\",\"drawLinesBetweenPoints\":true,\"lineWidth\":2,\"showCircles\":true,\"circlesRadius\":1}],\"addTooltip\":true,\"addLegend\":true,\"legendPosition\":\"right\",\"times\":[],\"addTimeMarker\":false,\"labels\":{\"show\":false},\"thresholdLine\":{\"show\":false,\"value\":10,\"width\":1,\"style\":\"full\",\"color\":\"#E7664C\"},\"row\":true,\"palette\":{\"type\":\"palette\",\"name\":\"kibana_palette\"},\"isVislibVis\":true,\"detailedTooltip\":true,\"legendSize\":\"auto\"}}" + }, + "coreMigrationVersion": "8.4.0", + "id": "6c9f3830-01e3-11eb-9b63-176d7b28a352", + "migrationVersion": { + "visualization": "8.3.0" + }, + "references": [ + { + "id": "logstash-*", + "name": "kibanaSavedObjectMeta.searchSourceJSON.index", + "type": "index-pattern" + } + ], + "type": "visualization", + "version": "WzE4LDJd" +} + +{ + "attributes": { + "description": "", + "hits": 0, + "kibanaSavedObjectMeta": { + "searchSourceJSON": "{\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filter\":[]}" + }, + "optionsJSON": "{\"useMargins\":true,\"hidePanelTitles\":false}", + "panelsJSON": "[{\"version\":\"7.10.0\",\"type\":\"visualization\",\"gridData\":{\"x\":0,\"y\":0,\"w\":24,\"h\":15,\"i\":\"f8f7f5b5-b840-443c-a766-d22a8a87c493\"},\"panelIndex\":\"f8f7f5b5-b840-443c-a766-d22a8a87c493\",\"embeddableConfig\":{\"enhancements\":{}},\"panelRefName\":\"panel_f8f7f5b5-b840-443c-a766-d22a8a87c493\"}]", + "refreshInterval": { + "pause": true, + "value": 0 + }, + "timeFrom": "2015-09-19T17:34:10.297Z", + "timeRestore": true, + "timeTo": "2015-09-23T00:09:17.180Z", + "title": "Delayed 5s", + "version": 1 + }, + "coreMigrationVersion": "8.4.0", + "id": "24f3f950-69d9-11ea-a14d-e341629a29e6", + "migrationVersion": { + "dashboard": "8.3.0" + }, + "references": [ + { + "id": "6c9f3830-01e3-11eb-9b63-176d7b28a352", + "name": "f8f7f5b5-b840-443c-a766-d22a8a87c493:panel_f8f7f5b5-b840-443c-a766-d22a8a87c493", + "type": "visualization" + } + ], + "type": "dashboard", + "updated_at": "2020-03-19T11:59:53.701Z", + "version": "WzIyLDJd" +} + +{ + "attributes": { + "description": "", + "hits": 0, + "kibanaSavedObjectMeta": { + "searchSourceJSON": "{\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filter\":[]}" + }, + "optionsJSON": "{\"useMargins\":true,\"hidePanelTitles\":false}", + "panelsJSON": "[{\"version\":\"7.7.0\",\"type\":\"visualization\",\"gridData\":{\"w\":24,\"h\":15,\"x\":0,\"y\":0,\"i\":\"8c5df6b2-0cc9-4887-a2d9-6a9a192f3407\"},\"panelIndex\":\"8c5df6b2-0cc9-4887-a2d9-6a9a192f3407\",\"embeddableConfig\":{\"enhancements\":{}},\"panelRefName\":\"panel_8c5df6b2-0cc9-4887-a2d9-6a9a192f3407\"}]", + "refreshInterval": { + "pause": true, + "value": 0 + }, + "timeFrom": "2015-09-19T17:34:10.297Z", + "timeRestore": true, + "timeTo": "2015-09-23T00:09:17.180Z", + "title": "Not Delayed", + "version": 1 + }, + "coreMigrationVersion": "8.4.0", + "id": "41e77910-69d9-11ea-a14d-e341629a29e6", + "migrationVersion": { + "dashboard": "8.3.0" + }, + "references": [ + { + "id": "14501a50-01e3-11eb-9b63-176d7b28a352", + "name": "8c5df6b2-0cc9-4887-a2d9-6a9a192f3407:panel_8c5df6b2-0cc9-4887-a2d9-6a9a192f3407", + "type": "visualization" + } + ], + "type": "dashboard", + "updated_at": "2020-03-19T11:59:53.701Z", + "version": "WzIzLDJd" +} + +{ + "attributes": { + "description": "", + "kibanaSavedObjectMeta": { + "searchSourceJSON": "{\"query\":{\"query_string\":{\"query\":\"*\",\"analyze_wildcard\":true}},\"filter\":[],\"indexRefName\":\"kibanaSavedObjectMeta.searchSourceJSON.index\"}" + }, + "title": "Sum of Bytes by Extension (Delayed 15s)", + "uiStateJSON": "{}", + "version": 1, + "visState": "{\"title\":\"Sum of Bytes by Extension (Delayed 15s)\",\"type\":\"histogram\",\"aggs\":[{\"id\":\"1\",\"enabled\":true,\"type\":\"sum\",\"params\":{\"field\":\"bytes\"},\"schema\":\"metric\"},{\"id\":\"2\",\"enabled\":true,\"type\":\"terms\",\"params\":{\"field\":\"extension.raw\",\"orderBy\":\"1\",\"order\":\"desc\",\"size\":5,\"otherBucket\":false,\"otherBucketLabel\":\"Other\",\"missingBucket\":false,\"missingBucketLabel\":\"Missing\"},\"schema\":\"segment\"},{\"id\":\"3\",\"enabled\":true,\"type\":\"shard_delay\",\"params\":{\"delay\":\"15s\"},\"schema\":\"group\"}],\"params\":{\"type\":\"histogram\",\"grid\":{\"categoryLines\":false},\"categoryAxes\":[{\"id\":\"CategoryAxis-1\",\"type\":\"category\",\"position\":\"bottom\",\"show\":true,\"style\":{},\"scale\":{\"type\":\"linear\"},\"labels\":{\"show\":true,\"filter\":true,\"truncate\":100},\"title\":{}}],\"valueAxes\":[{\"id\":\"ValueAxis-1\",\"name\":\"LeftAxis-1\",\"type\":\"value\",\"position\":\"left\",\"show\":true,\"style\":{},\"scale\":{\"type\":\"linear\",\"mode\":\"normal\"},\"labels\":{\"show\":true,\"rotate\":0,\"filter\":false,\"truncate\":100},\"title\":{\"text\":\"Sum of bytes\"}}],\"seriesParams\":[{\"show\":true,\"type\":\"histogram\",\"mode\":\"stacked\",\"data\":{\"label\":\"Sum of bytes\",\"id\":\"1\"},\"valueAxis\":\"ValueAxis-1\",\"drawLinesBetweenPoints\":true,\"lineWidth\":2,\"showCircles\":true,\"circlesRadius\":1}],\"addTooltip\":true,\"addLegend\":true,\"legendPosition\":\"right\",\"times\":[],\"addTimeMarker\":false,\"labels\":{\"show\":false},\"thresholdLine\":{\"show\":false,\"value\":10,\"width\":1,\"style\":\"full\",\"color\":\"#E7664C\"},\"row\":true,\"palette\":{\"type\":\"palette\",\"name\":\"kibana_palette\"},\"isVislibVis\":true,\"detailedTooltip\":true,\"legendSize\":\"auto\"}}" + }, + "coreMigrationVersion": "8.4.0", + "id": "50a67010-075d-11eb-be70-0bd5e8b57d02", + "migrationVersion": { + "visualization": "8.3.0" + }, + "references": [ + { + "id": "logstash-*", + "name": "kibanaSavedObjectMeta.searchSourceJSON.index", + "type": "index-pattern" + } + ], + "type": "visualization", + "version": "WzIwLDJd" +} + +{ + "attributes": { + "description": "", + "hits": 0, + "kibanaSavedObjectMeta": { + "searchSourceJSON": "{\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filter\":[]}" + }, + "optionsJSON": "{\"useMargins\":true,\"hidePanelTitles\":false}", + "panelsJSON": "[{\"version\":\"7.7.0\",\"type\":\"visualization\",\"gridData\":{\"w\":24,\"h\":15,\"x\":0,\"y\":0,\"i\":\"eedeb943-5cfc-4e2c-bc1a-10ce06345cc1\"},\"panelIndex\":\"eedeb943-5cfc-4e2c-bc1a-10ce06345cc1\",\"embeddableConfig\":{\"enhancements\":{}},\"panelRefName\":\"panel_eedeb943-5cfc-4e2c-bc1a-10ce06345cc1\"}]", + "refreshInterval": { + "pause": true, + "value": 0 + }, + "timeFrom": "2015-09-19T17:34:10.297Z", + "timeRestore": true, + "timeTo": "2015-09-23T00:09:17.180Z", + "title": "Delayed 15s", + "version": 1 + }, + "coreMigrationVersion": "8.4.0", + "id": "a41c6790-075d-11eb-be70-0bd5e8b57d02", + "migrationVersion": { + "dashboard": "8.3.0" + }, + "references": [ + { + "id": "50a67010-075d-11eb-be70-0bd5e8b57d02", + "name": "eedeb943-5cfc-4e2c-bc1a-10ce06345cc1:panel_eedeb943-5cfc-4e2c-bc1a-10ce06345cc1", + "type": "visualization" + } + ], + "type": "dashboard", + "updated_at": "2020-03-19T11:59:53.701Z", + "version": "WzI0LDJd" +} + +{ + "attributes": { + "description": "", + "hits": 0, + "kibanaSavedObjectMeta": { + "searchSourceJSON": "{\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filter\":[]}" + }, + "optionsJSON": "{\"useMargins\":true,\"hidePanelTitles\":false}", + "panelsJSON": "[{\"version\":\"8.0.0\",\"type\":\"visualization\",\"gridData\":{\"x\":0,\"y\":0,\"w\":24,\"h\":15,\"i\":\"ec585931-ce8e-43fd-aa94-a1a9612d24ba\"},\"panelIndex\":\"ec585931-ce8e-43fd-aa94-a1a9612d24ba\",\"embeddableConfig\":{\"enhancements\":{}},\"panelRefName\":\"panel_ec585931-ce8e-43fd-aa94-a1a9612d24ba\"},{\"version\":\"8.0.0\",\"type\":\"visualization\",\"gridData\":{\"x\":24,\"y\":0,\"w\":24,\"h\":15,\"i\":\"c7b18010-462b-4e55-a974-fdec2ae64b06\"},\"panelIndex\":\"c7b18010-462b-4e55-a974-fdec2ae64b06\",\"embeddableConfig\":{\"enhancements\":{}},\"panelRefName\":\"panel_c7b18010-462b-4e55-a974-fdec2ae64b06\"},{\"version\":\"8.0.0\",\"type\":\"visualization\",\"gridData\":{\"x\":0,\"y\":15,\"w\":24,\"h\":15,\"i\":\"e67704f7-20b7-4ade-8dee-972a9d187107\"},\"panelIndex\":\"e67704f7-20b7-4ade-8dee-972a9d187107\",\"embeddableConfig\":{\"enhancements\":{}},\"panelRefName\":\"panel_e67704f7-20b7-4ade-8dee-972a9d187107\"},{\"version\":\"8.0.0\",\"type\":\"visualization\",\"gridData\":{\"x\":24,\"y\":15,\"w\":24,\"h\":15,\"i\":\"f0b03592-10f1-41cd-9929-0cb4163bcd16\"},\"panelIndex\":\"f0b03592-10f1-41cd-9929-0cb4163bcd16\",\"embeddableConfig\":{\"enhancements\":{}},\"panelRefName\":\"panel_f0b03592-10f1-41cd-9929-0cb4163bcd16\"}]", + "refreshInterval": { + "pause": true, + "value": 0 + }, + "timeFrom": "2015-09-19T17:34:10.297Z", + "timeRestore": true, + "timeTo": "2015-09-23T00:09:17.180Z", + "title": "Multiple delayed", + "version": 1 + }, + "coreMigrationVersion": "8.4.0", + "id": "a41c6790-075d-11eb-be70-0bd5e8b57d03", + "migrationVersion": { + "dashboard": "8.3.0" + }, + "references": [ + { + "id": "14501a50-01e3-11eb-9b63-176d7b28a352", + "name": "ec585931-ce8e-43fd-aa94-a1a9612d24ba:panel_ec585931-ce8e-43fd-aa94-a1a9612d24ba", + "type": "visualization" + }, + { + "id": "50a67010-075d-11eb-be70-0bd5e8b57d02", + "name": "c7b18010-462b-4e55-a974-fdec2ae64b06:panel_c7b18010-462b-4e55-a974-fdec2ae64b06", + "type": "visualization" + }, + { + "id": "6c9f3830-01e3-11eb-9b63-176d7b28a352", + "name": "e67704f7-20b7-4ade-8dee-972a9d187107:panel_e67704f7-20b7-4ade-8dee-972a9d187107", + "type": "visualization" + }, + { + "id": "50a67010-075d-11eb-be70-0bd5e8b57d02", + "name": "f0b03592-10f1-41cd-9929-0cb4163bcd16:panel_f0b03592-10f1-41cd-9929-0cb4163bcd16", + "type": "visualization" + } + ], + "type": "dashboard", + "updated_at": "2020-03-19T11:59:53.701Z", + "version": "WzI1LDJd" +} \ No newline at end of file diff --git a/x-pack/test/functional/services/search_sessions.ts b/x-pack/test/functional/services/search_sessions.ts index a3d04af530d54..0b9ec73080e8e 100644 --- a/x-pack/test/functional/services/search_sessions.ts +++ b/x-pack/test/functional/services/search_sessions.ts @@ -30,7 +30,7 @@ export class SearchSessionsService extends FtrService { private readonly log = this.ctx.getService('log'); private readonly retry = this.ctx.getService('retry'); private readonly browser = this.ctx.getService('browser'); - private readonly supertest = this.ctx.getService('supertest'); + private readonly security = this.ctx.getService('security'); public async find(): Promise { return this.testSubjects.find(SEARCH_SESSION_INDICATOR_TEST_SUBJ); @@ -138,21 +138,31 @@ export class SearchSessionsService extends FtrService { this.log.debug('Deleting created search sessions'); // ignores 409 errs and keeps retrying await this.retry.tryForTime(10000, async () => { - const { body } = await this.supertest + const { body } = await this.security.testUserSupertest .post('/internal/session/_find') .set('kbn-xsrf', 'anything') .set('kbn-system-request', 'true') - .send({ page: 1, perPage: 10000, sortField: 'created', sortOrder: 'asc' }) + .send({ + page: 1, + perPage: 10000, + sortField: 'created', + sortOrder: 'asc', + }) .expect(200); const { saved_objects: savedObjects } = body as SavedObjectsFindResponse; - if (savedObjects.length) { + + if (savedObjects.length > 0) { this.log.debug(`Found created search sessions: ${savedObjects.map(({ id }) => id)}`); + } else { + this.log.debug(`Found no search sessions to delete`); + return; } + await Promise.all( savedObjects.map(async (so) => { this.log.debug(`Deleting search session: ${so.id}`); - await this.supertest + await this.security.testUserSupertest .delete(`/internal/session/${so.id}`) .set(`kbn-xsrf`, `anything`) .expect(200); diff --git a/x-pack/test/search_sessions_integration/tests/apps/dashboard/async_search/index.ts b/x-pack/test/search_sessions_integration/tests/apps/dashboard/async_search/index.ts index 77dc12bfec031..1eb5f3d8e17bd 100644 --- a/x-pack/test/search_sessions_integration/tests/apps/dashboard/async_search/index.ts +++ b/x-pack/test/search_sessions_integration/tests/apps/dashboard/async_search/index.ts @@ -31,6 +31,7 @@ export default function ({ loadTestFile, getService, getPageObjects }: FtrProvid after(async () => { await kibanaServer.savedObjects.cleanStandardList(); + await searchSessions.deleteAllSearchSessions(); }); loadTestFile(require.resolve('./async_search')); diff --git a/x-pack/test/search_sessions_integration/tests/apps/dashboard/async_search/sessions_in_space.ts b/x-pack/test/search_sessions_integration/tests/apps/dashboard/async_search/sessions_in_space.ts index d1a36e5a33784..e7cefd782f9aa 100644 --- a/x-pack/test/search_sessions_integration/tests/apps/dashboard/async_search/sessions_in_space.ts +++ b/x-pack/test/search_sessions_integration/tests/apps/dashboard/async_search/sessions_in_space.ts @@ -10,7 +10,7 @@ import { FtrProviderContext } from '../../../../ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { const testSubjects = getService('testSubjects'); - const esArchiver = getService('esArchiver'); + const spacesService = getService('spaces'); const security = getService('security'); const PageObjects = getPageObjects([ 'common', @@ -28,57 +28,9 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const toasts = getService('toasts'); describe('dashboard in space', () => { + afterEach(async () => await clean()); describe('Storing search sessions in space', () => { - before(async () => { - await esArchiver.load('x-pack/test/functional/es_archives/dashboard/session_in_space'); - - await kibanaServer.uiSettings.replace( - { - 'timepicker:timeDefaults': - '{ "from": "2015-09-01T00:00:00.000Z", "to": "2015-10-01T00:00:00.000Z"}', - defaultIndex: 'd1bd6c84-d9d0-56fb-8a72-63fe60020920', - }, - { space: 'another-space' } - ); - - await security.role.create('data_analyst', { - elasticsearch: { - indices: [{ names: ['logstash-*'], privileges: ['all'] }], - }, - kibana: [ - { - feature: { - dashboard: ['minimal_read', 'store_search_session'], - }, - spaces: ['another-space'], - }, - ], - }); - - await security.user.create('analyst', { - password: 'analyst-password', - roles: ['data_analyst'], - full_name: 'test user', - }); - - await PageObjects.security.forceLogout(); - - await PageObjects.security.login('analyst', 'analyst-password', { - expectSpaceSelector: false, - }); - }); - - after(async () => { - // NOTE: Logout needs to happen before anything else to avoid flaky behavior - await PageObjects.security.forceLogout(); - - await security.role.delete('data_analyst'); - await security.user.delete('analyst'); - - await kibanaServer.uiSettings.unset('timepicker:timeDefaults', { space: 'another-space' }); - await kibanaServer.uiSettings.unset('defaultIndex', { space: 'another-space' }); - await esArchiver.unload('x-pack/test/functional/es_archives/dashboard/session_in_space'); - }); + before(async () => await load(['minimal_read', 'store_search_session'])); it('Saves and restores a session', async () => { await PageObjects.common.navigateToApp('dashboard', { basePath: 's/another-space' }); @@ -119,58 +71,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { expect(await toasts.getToastCount()).to.be(0); // no session restoration related warnings }); }); - describe('Disabled storing search sessions', () => { - before(async () => { - await esArchiver.load('x-pack/test/functional/es_archives/dashboard/session_in_space'); - - await kibanaServer.uiSettings.replace( - { - 'timepicker:timeDefaults': - '{ "from": "2015-09-01T00:00:00.000Z", "to": "2015-10-01T00:00:00.000Z"}', - defaultIndex: 'd1bd6c84-d9d0-56fb-8a72-63fe60020920', - }, - { space: 'another-space' } - ); - - await security.role.create('data_analyst', { - elasticsearch: { - indices: [{ names: ['logstash-*'], privileges: ['all'] }], - }, - kibana: [ - { - feature: { - dashboard: ['minimal_read'], - }, - spaces: ['another-space'], - }, - ], - }); - - await security.user.create('analyst', { - password: 'analyst-password', - roles: ['data_analyst'], - full_name: 'test user', - }); - - await PageObjects.security.forceLogout(); - - await PageObjects.security.login('analyst', 'analyst-password', { - expectSpaceSelector: false, - }); - }); - - after(async () => { - // NOTE: Logout needs to happen before anything else to avoid flaky behavior - await PageObjects.security.forceLogout(); - - await security.role.delete('data_analyst'); - await security.user.delete('analyst'); - - await kibanaServer.uiSettings.unset('timepicker:timeDefaults', { space: 'another-space' }); - await kibanaServer.uiSettings.unset('defaultIndex', { space: 'another-space' }); - await esArchiver.unload('x-pack/test/functional/es_archives/dashboard/session_in_space'); - }); + before(async () => await load(['minimal_read'])); it("Doesn't allow to store a session", async () => { await PageObjects.common.navigateToApp('dashboard', { basePath: 's/another-space' }); @@ -183,4 +85,57 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); }); }); + async function load(dashboard: string[]) { + await kibanaServer.importExport.load( + `x-pack/test/functional/fixtures/kbn_archiver/dashboard/session_in_space` + ); + await spacesService.create({ id: 'another-space', name: 'Another Space' }); + await kibanaServer.importExport.load( + `x-pack/test/functional/fixtures/kbn_archiver/dashboard/session_in_another_space`, + { space: 'another-space' } + ); + await kibanaServer.uiSettings.replace( + { + 'timepicker:timeDefaults': + '{ "from": "2015-09-01T00:00:00.000Z", "to": "2015-10-01T00:00:00.000Z"}', + defaultIndex: 'd1bd6c84-d9d0-56fb-8a72-63fe60020920', + }, + { space: 'another-space' } + ); + + await security.role.create('data_analyst', { + elasticsearch: { + indices: [{ names: ['logstash-*'], privileges: ['all'] }], + }, + kibana: [ + { + feature: { + dashboard, + }, + spaces: ['another-space'], + }, + ], + }); + + await security.user.create('analyst', { + password: 'analyst-password', + roles: ['data_analyst'], + full_name: 'test user', + }); + + await PageObjects.security.forceLogout(); + + await PageObjects.security.login('analyst', 'analyst-password', { + expectSpaceSelector: false, + }); + } + async function clean() { + await kibanaServer.savedObjects.cleanStandardList(); + // NOTE: Logout needs to happen before anything else to avoid flaky behavior + await PageObjects.security.forceLogout(); + await security.role.delete('data_analyst'); + await security.user.delete('analyst'); + await spacesService.delete('another-space'); + await searchSessions.deleteAllSearchSessions(); + } } diff --git a/x-pack/test/search_sessions_integration/tests/apps/dashboard/session_sharing/index.ts b/x-pack/test/search_sessions_integration/tests/apps/dashboard/session_sharing/index.ts index 1ff11eb988456..021842a53191a 100644 --- a/x-pack/test/search_sessions_integration/tests/apps/dashboard/session_sharing/index.ts +++ b/x-pack/test/search_sessions_integration/tests/apps/dashboard/session_sharing/index.ts @@ -11,6 +11,7 @@ export default function ({ loadTestFile, getService, getPageObjects }: FtrProvid const kibanaServer = getService('kibanaServer'); const esArchiver = getService('esArchiver'); const PageObjects = getPageObjects(['common']); + const searchSessions = getService('searchSessions'); describe('Search session sharing', function () { before(async () => { @@ -19,6 +20,10 @@ export default function ({ loadTestFile, getService, getPageObjects }: FtrProvid await PageObjects.common.navigateToApp('dashboard'); }); + after(async () => { + await searchSessions.deleteAllSearchSessions(); + }); + loadTestFile(require.resolve('./lens')); }); } diff --git a/x-pack/test/search_sessions_integration/tests/apps/discover/sessions_in_space.ts b/x-pack/test/search_sessions_integration/tests/apps/discover/sessions_in_space.ts index 922ecfc12dc4f..ad1e2cae04877 100644 --- a/x-pack/test/search_sessions_integration/tests/apps/discover/sessions_in_space.ts +++ b/x-pack/test/search_sessions_integration/tests/apps/discover/sessions_in_space.ts @@ -10,7 +10,7 @@ import { FtrProviderContext } from '../../../ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { const testSubjects = getService('testSubjects'); - const esArchiver = getService('esArchiver'); + const spacesService = getService('spaces'); const security = getService('security'); const inspector = getService('inspector'); const PageObjects = getPageObjects([ @@ -28,57 +28,9 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const toasts = getService('toasts'); describe('discover in space', () => { + afterEach(async () => await clean()); describe('Storing search sessions in space', () => { - before(async () => { - await esArchiver.load('x-pack/test/functional/es_archives/dashboard/session_in_space'); - - await kibanaServer.uiSettings.replace( - { - 'timepicker:timeDefaults': - '{ "from": "2015-09-01T00:00:00.000Z", "to": "2015-10-01T00:00:00.000Z"}', - defaultIndex: 'd1bd6c84-d9d0-56fb-8a72-63fe60020920', - }, - { space: 'another-space' } - ); - - await security.role.create('data_analyst', { - elasticsearch: { - indices: [{ names: ['logstash-*'], privileges: ['all'] }], - }, - kibana: [ - { - feature: { - discover: ['all'], - }, - spaces: ['another-space'], - }, - ], - }); - - await security.user.create('analyst', { - password: 'analyst-password', - roles: ['data_analyst'], - full_name: 'test user', - }); - - await PageObjects.security.forceLogout(); - - await PageObjects.security.login('analyst', 'analyst-password', { - expectSpaceSelector: false, - }); - }); - - after(async () => { - // NOTE: Logout needs to happen before anything else to avoid flaky behavior - await PageObjects.security.forceLogout(); - - await security.role.delete('data_analyst'); - await security.user.delete('analyst'); - - await kibanaServer.uiSettings.unset('timepicker:timeDefaults', { space: 'another-space' }); - await kibanaServer.uiSettings.unset('defaultIndex', { space: 'another-space' }); - await esArchiver.unload('x-pack/test/functional/es_archives/dashboard/session_in_space'); - }); + before(async () => await load(['all'])); it('Saves and restores a session', async () => { await PageObjects.common.navigateToApp('discover', { basePath: 's/another-space' }); @@ -124,56 +76,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); }); describe('Disabled storing search sessions in space', () => { - before(async () => { - await esArchiver.load('x-pack/test/functional/es_archives/dashboard/session_in_space'); - - await kibanaServer.uiSettings.replace( - { - 'timepicker:timeDefaults': - '{ "from": "2015-09-01T00:00:00.000Z", "to": "2015-10-01T00:00:00.000Z"}', - defaultIndex: 'd1bd6c84-d9d0-56fb-8a72-63fe60020920', - }, - { space: 'another-space' } - ); - - await security.role.create('data_analyst', { - elasticsearch: { - indices: [{ names: ['logstash-*'], privileges: ['all'] }], - }, - kibana: [ - { - feature: { - discover: ['read'], - }, - spaces: ['another-space'], - }, - ], - }); - - await security.user.create('analyst', { - password: 'analyst-password', - roles: ['data_analyst'], - full_name: 'test user', - }); - - await PageObjects.security.forceLogout(); - - await PageObjects.security.login('analyst', 'analyst-password', { - expectSpaceSelector: false, - }); - }); - - after(async () => { - // NOTE: Logout needs to happen before anything else to avoid flaky behavior - await PageObjects.security.forceLogout(); - - await security.role.delete('data_analyst'); - await security.user.delete('analyst'); - - await kibanaServer.uiSettings.unset('timepicker:timeDefaults', { space: 'another-space' }); - await kibanaServer.uiSettings.unset('defaultIndex', { space: 'another-space' }); - await esArchiver.unload('x-pack/test/functional/es_archives/dashboard/session_in_space'); - }); + before(async () => await load(['read'])); it("Doesn't allow to store a session", async () => { await PageObjects.common.navigateToApp('discover', { basePath: 's/another-space' }); @@ -192,4 +95,59 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); }); }); + async function load(discover: string[]) { + await kibanaServer.importExport.load( + `x-pack/test/functional/fixtures/kbn_archiver/dashboard/session_in_space` + ); + await spacesService.create({ id: 'another-space', name: 'Another Space' }); + await kibanaServer.importExport.load( + `x-pack/test/functional/fixtures/kbn_archiver/dashboard/session_in_another_space`, + { space: 'another-space' } + ); + await kibanaServer.uiSettings.replace( + { + 'timepicker:timeDefaults': + '{ "from": "2015-09-01T00:00:00.000Z", "to": "2015-10-01T00:00:00.000Z"}', + defaultIndex: 'd1bd6c84-d9d0-56fb-8a72-63fe60020920', + }, + { space: 'another-space' } + ); + + await security.role.create('data_analyst', { + elasticsearch: { + indices: [{ names: ['logstash-*'], privileges: ['all'] }], + }, + kibana: [ + { + feature: { + discover, + }, + spaces: ['another-space'], + }, + ], + }); + + await security.user.create('analyst', { + password: 'analyst-password', + roles: ['data_analyst'], + full_name: 'test user', + }); + + await PageObjects.security.forceLogout(); + + await PageObjects.security.login('analyst', 'analyst-password', { + expectSpaceSelector: false, + }); + } + async function clean() { + await kibanaServer.importExport.unload( + 'x-pack/test/functional/fixtures/kbn_archiver/dashboard/session_in_space' + ); + // NOTE: Logout needs to happen before anything else to avoid flaky behavior + await PageObjects.security.forceLogout(); + await security.role.delete('data_analyst'); + await security.user.delete('analyst'); + await spacesService.delete('another-space'); + await searchSessions.deleteAllSearchSessions(); + } } diff --git a/x-pack/test/search_sessions_integration/tests/apps/lens/index.ts b/x-pack/test/search_sessions_integration/tests/apps/lens/index.ts index 978c5bdec0df5..647cff3432200 100644 --- a/x-pack/test/search_sessions_integration/tests/apps/lens/index.ts +++ b/x-pack/test/search_sessions_integration/tests/apps/lens/index.ts @@ -10,6 +10,7 @@ import { FtrProviderContext } from '../../../ftr_provider_context'; export default function ({ loadTestFile, getService }: FtrProviderContext) { const kibanaServer = getService('kibanaServer'); const esArchiver = getService('esArchiver'); + const searchSessions = getService('searchSessions'); describe('lens search sessions', function () { before(async () => { @@ -17,6 +18,11 @@ export default function ({ loadTestFile, getService }: FtrProviderContext) { await kibanaServer.uiSettings.replace({ defaultIndex: 'logstash-*' }); }); + after(async () => { + await searchSessions.deleteAllSearchSessions(); + await kibanaServer.savedObjects.cleanStandardList(); + }); + loadTestFile(require.resolve('./search_sessions.ts')); }); } diff --git a/x-pack/test/search_sessions_integration/tests/apps/management/search_sessions/index.ts b/x-pack/test/search_sessions_integration/tests/apps/management/search_sessions/index.ts index cae745c6431d3..f1d9a66c73a31 100644 --- a/x-pack/test/search_sessions_integration/tests/apps/management/search_sessions/index.ts +++ b/x-pack/test/search_sessions_integration/tests/apps/management/search_sessions/index.ts @@ -10,6 +10,7 @@ import { FtrProviderContext } from '../../../../ftr_provider_context'; export default function ({ loadTestFile, getService }: FtrProviderContext) { const kibanaServer = getService('kibanaServer'); const esArchiver = getService('esArchiver'); + const searchSessions = getService('searchSessions'); describe('search sessions management', function () { before(async () => { @@ -25,6 +26,7 @@ export default function ({ loadTestFile, getService }: FtrProviderContext) { after(async () => { await kibanaServer.savedObjects.cleanStandardList(); + await searchSessions.deleteAllSearchSessions(); }); loadTestFile(require.resolve('./sessions_management')); diff --git a/x-pack/test/search_sessions_integration/tests/apps/management/search_sessions/sessions_management.ts b/x-pack/test/search_sessions_integration/tests/apps/management/search_sessions/sessions_management.ts index 513a315bf148b..f350700933aa6 100644 --- a/x-pack/test/search_sessions_integration/tests/apps/management/search_sessions/sessions_management.ts +++ b/x-pack/test/search_sessions_integration/tests/apps/management/search_sessions/sessions_management.ts @@ -26,6 +26,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { describe('Search Sessions Management UI', () => { describe('New search sessions', () => { before(async () => { + await searchSessions.deleteAllSearchSessions(); await PageObjects.common.navigateToApp('dashboard'); log.debug('wait for dashboard landing page'); await retry.tryForTime(10000, async () => { From 0b0dd6bac7eec6698688eda854a4ab7cc03195f8 Mon Sep 17 00:00:00 2001 From: Cristina Amico Date: Fri, 26 Aug 2022 10:50:53 +0200 Subject: [PATCH 13/28] [Fleet] Improve search functionality in integrations searchbar (#139386) * [Fleet] Improve search functionality in integrations searchbar * Fix types * Add constant * Show name instead of id; bring changes to installed packages tab * Fix tests and stories * Fix storybook failure Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../integration/integrations_real.spec.ts | 5 ++- .../fleet/cypress/screens/integrations.ts | 1 + .../integrations/hooks/use_local_search.tsx | 6 +-- .../components/package_list_grid.stories.tsx | 43 ++++++++++++++----- .../epm/components/package_list_grid.tsx | 38 ++++++++++++++-- .../epm/screens/home/available_packages.tsx | 30 +++++++------ .../epm/screens/home/category_facets.tsx | 13 +++++- .../sections/epm/screens/home/index.tsx | 14 +++--- .../epm/screens/home/installed_packages.tsx | 32 +++++++------- 9 files changed, 126 insertions(+), 56 deletions(-) diff --git a/x-pack/plugins/fleet/cypress/integration/integrations_real.spec.ts b/x-pack/plugins/fleet/cypress/integration/integrations_real.spec.ts index cbd08b6e8f5d6..1caa90ba1b785 100644 --- a/x-pack/plugins/fleet/cypress/integration/integrations_real.spec.ts +++ b/x-pack/plugins/fleet/cypress/integration/integrations_real.spec.ts @@ -23,6 +23,7 @@ import { POLICIES_TAB, SETTINGS_TAB, UPDATE_PACKAGE_BTN, + INTEGRATIONS_SEARCHBAR_INPUT, } from '../screens/integrations'; import { ADD_PACKAGE_POLICY_BTN } from '../screens/fleet'; import { cleanupAgentPolicies } from '../tasks/cleanup'; @@ -66,7 +67,7 @@ describe.skip('Add Integration - Real API', () => { navigateTo(INTEGRATIONS); cy.wait('@packages'); cy.get('.euiLoadingSpinner').should('not.exist'); - cy.get('input[placeholder="Search for integrations"]').type('Apache'); + cy.get(INTEGRATIONS_SEARCHBAR_INPUT).type('Apache'); cy.get(INTEGRATIONS_CARD).contains(integration).click(); addIntegration(); cy.getBySel(INTEGRATION_NAME_LINK).contains('apache-1'); @@ -104,7 +105,7 @@ describe.skip('Add Integration - Real API', () => { cy.getBySel(ADD_PACKAGE_POLICY_BTN).click(); cy.wait('@packages'); cy.get('.euiLoadingSpinner').should('not.exist'); - cy.get('input[placeholder="Search for integrations"]').type('Apache'); + cy.get(INTEGRATIONS_SEARCHBAR_INPUT).type('Apache'); cy.get(INTEGRATIONS_CARD).contains(integration).click(); addIntegration({ useExistingPolicy: true }); cy.get('.euiBasicTable-loading').should('not.exist'); diff --git a/x-pack/plugins/fleet/cypress/screens/integrations.ts b/x-pack/plugins/fleet/cypress/screens/integrations.ts index ed645d08d9b5f..929e36d191230 100644 --- a/x-pack/plugins/fleet/cypress/screens/integrations.ts +++ b/x-pack/plugins/fleet/cypress/screens/integrations.ts @@ -26,3 +26,4 @@ export const UPDATE_PACKAGE_BTN = 'updatePackageBtn'; export const LATEST_VERSION = 'latestVersion'; export const PACKAGE_VERSION = 'packageVersionText'; +export const INTEGRATIONS_SEARCHBAR_INPUT = 'epmList.searchBar'; diff --git a/x-pack/plugins/fleet/public/applications/integrations/hooks/use_local_search.tsx b/x-pack/plugins/fleet/public/applications/integrations/hooks/use_local_search.tsx index 458c4d94f9cd4..58d3a847d3efc 100644 --- a/x-pack/plugins/fleet/public/applications/integrations/hooks/use_local_search.tsx +++ b/x-pack/plugins/fleet/public/applications/integrations/hooks/use_local_search.tsx @@ -5,20 +5,20 @@ * 2.0. */ -import { Search as LocalSearch, AllSubstringsIndexStrategy } from 'js-search'; +import { Search as LocalSearch, PrefixIndexStrategy } from 'js-search'; import { useEffect, useRef } from 'react'; import type { IntegrationCardItem } from '../../../../common/types/models'; export const searchIdField = 'id'; -export const fieldsToSearch = ['name', 'title', 'description']; +export const fieldsToSearch = ['name', 'title']; export function useLocalSearch(packageList: IntegrationCardItem[]) { const localSearchRef = useRef(new LocalSearch(searchIdField)); useEffect(() => { const localSearch = new LocalSearch(searchIdField); - localSearch.indexStrategy = new AllSubstringsIndexStrategy(); + localSearch.indexStrategy = new PrefixIndexStrategy(); fieldsToSearch.forEach((field) => localSearch.addIndex(field)); localSearch.addDocuments(packageList); localSearchRef.current = localSearch; diff --git a/x-pack/plugins/fleet/public/applications/integrations/sections/epm/components/package_list_grid.stories.tsx b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/components/package_list_grid.stories.tsx index f43c18d167717..0e746d8ca8195 100644 --- a/x-pack/plugins/fleet/public/applications/integrations/sections/epm/components/package_list_grid.stories.tsx +++ b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/components/package_list_grid.stories.tsx @@ -24,12 +24,31 @@ const args: Args = { isLoading: false, showMissingIntegrationMessage: false, }; +const categories = [ + { + title: 'Category One', + id: 'category_one', + count: 2, + }, + { + title: 'Category Two', + id: 'category_two', + count: 3, + }, + { + title: 'Web', + id: 'web', + count: 1, + }, +]; export const EmptyList = (props: Args) => ( ); @@ -46,8 +65,8 @@ export const List = (props: Args) => ( version: '1.0.0', url: 'https://example.com', icons: [], - integration: 'integation', - categories: ['web'], + integration: 'integration', + categories: ['category_two'], }, { title: 'Package Two', @@ -58,8 +77,8 @@ export const List = (props: Args) => ( version: '1.0.0', url: 'https://example.com', icons: [], - integration: 'integation', - categories: ['web'], + integration: 'integration', + categories: ['category_one'], }, { title: 'Package Three', @@ -70,7 +89,7 @@ export const List = (props: Args) => ( version: '1.0.0', url: 'https://example.com', icons: [], - integration: 'integation', + integration: 'integration', categories: ['web'], }, { @@ -82,8 +101,8 @@ export const List = (props: Args) => ( version: '1.0.0', url: 'https://example.com', icons: [], - integration: 'integation', - categories: ['web'], + integration: 'integration', + categories: ['category_one'], }, { title: 'Package Five', @@ -94,8 +113,8 @@ export const List = (props: Args) => ( version: '1.0.0', url: 'https://example.com', icons: [], - integration: 'integation', - categories: ['web'], + integration: 'integration', + categories: ['category_two'], }, { title: 'Package Six', @@ -106,12 +125,14 @@ export const List = (props: Args) => ( version: '1.0.0', url: 'https://example.com', icons: [], - integration: 'integation', - categories: ['web'], + integration: 'integration', + categories: ['category_two'], }, ]} onSearchChange={action('onSearchChange')} setSelectedCategory={action('setSelectedCategory')} + categories={categories} + selectedCategory="" {...props} /> ); diff --git a/x-pack/plugins/fleet/public/applications/integrations/sections/epm/components/package_list_grid.tsx b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/components/package_list_grid.tsx index 09e28e649b84e..98efc91cfc34c 100644 --- a/x-pack/plugins/fleet/public/applications/integrations/sections/epm/components/package_list_grid.tsx +++ b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/components/package_list_grid.tsx @@ -7,6 +7,7 @@ import type { ReactNode, FunctionComponent } from 'react'; import React, { useCallback, useState, useRef, useEffect } from 'react'; + import { EuiFlexGrid, EuiFlexGroup, @@ -16,7 +17,9 @@ import { EuiTitle, EuiSearchBar, EuiText, + EuiBadge, } from '@elastic/eui'; + import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n-react'; @@ -26,6 +29,8 @@ import { useLocalSearch, searchIdField } from '../../../hooks'; import type { IntegrationCardItem } from '../../../../../../common/types/models'; +import type { ExtendedIntegrationCategory, CategoryFacet } from '../screens/home/category_facets'; + import { PackageCard } from './package_card'; export interface Props { @@ -35,7 +40,9 @@ export interface Props { list: IntegrationCardItem[]; featuredList?: JSX.Element | null; initialSearch?: string; + selectedCategory: ExtendedIntegrationCategory; setSelectedCategory: (category: string) => void; + categories: CategoryFacet[]; onSearchChange: (search: string) => void; showMissingIntegrationMessage?: boolean; callout?: JSX.Element | null; @@ -49,7 +56,9 @@ export const PackageListGrid: FunctionComponent = ({ list, initialSearch, onSearchChange, + selectedCategory, setSelectedCategory, + categories, showMissingIntegrationMessage = false, featuredList = null, callout, @@ -73,15 +82,15 @@ export const PackageListGrid: FunctionComponent = ({ }, [windowScrollY, isSticky]); const onQueryChange = ({ - queryText: userInput, + queryText, error, }: { queryText: string; error: { message: string } | null; }) => { if (!error) { - onSearchChange(userInput); - setSearchTerm(userInput); + onSearchChange(queryText); + setSearchTerm(queryText); } }; @@ -89,6 +98,10 @@ export const PackageListGrid: FunctionComponent = ({ setSearchTerm(''); }; + const selectedCategoryTitle = selectedCategory + ? categories.find((category) => category.id === selectedCategory)?.title + : undefined; + const controlsContent = ; let gridContent: JSX.Element; @@ -123,12 +136,31 @@ export const PackageListGrid: FunctionComponent = ({ + { + setSelectedCategory(''); + }} + iconOnClickAriaLabel="Remove category" + data-test-sub="epmList.categoryBadge" + > + {selectedCategoryTitle} + + + ) : undefined + } /> {callout ? ( <> diff --git a/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/home/available_packages.tsx b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/home/available_packages.tsx index 67792355fbd77..0ef9b47f9096e 100644 --- a/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/home/available_packages.tsx +++ b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/home/available_packages.tsx @@ -52,7 +52,7 @@ import { IntegrationPreference } from '../../components/integration_preference'; import { mergeCategoriesAndCount } from './util'; import { ALL_CATEGORY, CategoryFacets } from './category_facets'; -import type { CategoryFacet } from './category_facets'; +import type { CategoryFacet, ExtendedIntegrationCategory } from './category_facets'; import type { CategoryParams } from '.'; import { getParams, categoryExists, mapToCard } from '.'; @@ -185,6 +185,7 @@ export const AvailablePackages: React.FC<{ isLoading: boolean; }> = ({ allPackages, isLoading }) => { const [preference, setPreference] = useState('recommended'); + useBreadcrumbs('integrations_all'); const { http } = useStartServices(); @@ -194,11 +195,14 @@ export const AvailablePackages: React.FC<{ useParams(), useLocation().search ); + const [category, setCategory] = useState(selectedCategory); const history = useHistory(); const { getHref, getAbsolutePath } = useLink(); - function setSelectedCategory(categoryId: string) { + function setUrlCategory(categoryId: string) { + setCategory(categoryId as ExtendedIntegrationCategory); + const url = pagePathGetters.integrations_all({ category: categoryId, searchTerm: searchParam, @@ -206,9 +210,9 @@ export const AvailablePackages: React.FC<{ history.push(url); } - function setSearchTerm(search: string) { + function setUrlSearchTerm(search: string) { // Use .replace so the browser's back button is not tied to single keystroke - history.replace(pagePathGetters.integrations_all({ searchTerm: search })[1]); + history.replace(pagePathGetters.integrations_all({ searchTerm: search, category })[1]); } const { @@ -265,7 +269,7 @@ export const AvailablePackages: React.FC<{ include_policy_templates: true, }); - const categories = useMemo(() => { + const categories: CategoryFacet[] = useMemo(() => { const eprAndCustomCategories: CategoryFacet[] = isLoadingCategories ? [] : mergeCategoriesAndCount( @@ -280,7 +284,7 @@ export const AvailablePackages: React.FC<{ count: cards.length, }, ...(eprAndCustomCategories ? eprAndCustomCategories : []), - ] as CategoryFacet[]; + ]; }, [cards, eprCategories, isLoadingCategories]); if (!isLoadingCategories && !categoryExists(selectedCategory, categories)) { @@ -303,9 +307,9 @@ export const AvailablePackages: React.FC<{ isLoadingCategories || isLoadingAllPackages || isLoadingAppendCustomIntegrations } categories={categories} - selectedCategory={selectedCategory} + selectedCategory={category} onCategoryChange={({ id }) => { - setSelectedCategory(id); + setUrlCategory(id); }} /> , @@ -314,11 +318,11 @@ export const AvailablePackages: React.FC<{ } const filteredCards = cards.filter((c) => { - if (selectedCategory === '') { + if (category === '') { return true; } - return c.categories.includes(selectedCategory); + return c.categories.includes(category); }); // TODO: Remove this hard coded list of integrations with a suggestion service @@ -393,8 +397,10 @@ export const AvailablePackages: React.FC<{ controls={controls} initialSearch={searchParam} list={filteredCards} - setSelectedCategory={setSelectedCategory} - onSearchChange={setSearchTerm} + selectedCategory={category} + setSelectedCategory={setUrlCategory} + categories={categories} + onSearchChange={setUrlSearchTerm} showMissingIntegrationMessage callout={noEprCallout} showCardLabels={false} diff --git a/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/home/category_facets.tsx b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/home/category_facets.tsx index 059fcd45b449d..573701ae9a6fb 100644 --- a/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/home/category_facets.tsx +++ b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/home/category_facets.tsx @@ -6,6 +6,7 @@ */ import { EuiFacetButton, EuiFacetGroup } from '@elastic/eui'; +import type { IntegrationCategory } from '@kbn/custom-integrations-plugin/common'; import React from 'react'; import { i18n } from '@kbn/i18n'; @@ -18,6 +19,9 @@ export interface CategoryFacet { title: string; } +export const UPDATES_AVAILABLE = 'updates_available'; +export type ExtendedIntegrationCategory = IntegrationCategory | typeof UPDATES_AVAILABLE | ''; + export const ALL_CATEGORY = { id: '', title: i18n.translate('xpack.fleet.epmList.allPackagesFilterLinkText', { @@ -25,13 +29,20 @@ export const ALL_CATEGORY = { }), }; -export const INSTALLED_CATEGORY = { +export const ALL_INSTALLED_CATEGORY = { id: '', title: i18n.translate('xpack.fleet.epmList.allPackagesInstalledFilterLinkText', { defaultMessage: 'All installed', }), }; +export const UPDATES_AVAILABLE_CATEGORY = { + id: UPDATES_AVAILABLE, + title: i18n.translate('xpack.fleet.epmList.updatesAvailableFilterLinkText', { + defaultMessage: 'Updates available', + }), +}; + export interface Props { isLoading?: boolean; categories: CategoryFacet[]; diff --git a/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/home/index.tsx b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/home/index.tsx index 93d226f885119..a384288d1050b 100644 --- a/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/home/index.tsx +++ b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/home/index.tsx @@ -8,8 +8,6 @@ import React, { useMemo } from 'react'; import { Switch, Route } from 'react-router-dom'; -import type { IntegrationCategory } from '@kbn/custom-integrations-plugin/common'; - import type { CustomIntegration } from '@kbn/custom-integrations-plugin/common'; import { installationStatuses } from '../../../../../../../common/constants'; @@ -27,23 +25,21 @@ import { useGetPackages } from '../../../../hooks'; import type { Section } from '../../..'; -import type { CategoryFacet } from './category_facets'; +import type { CategoryFacet, ExtendedIntegrationCategory } from './category_facets'; + import { InstalledPackages } from './installed_packages'; import { AvailablePackages } from './available_packages'; export interface CategoryParams { - category?: string; + category?: ExtendedIntegrationCategory; } export const getParams = (params: CategoryParams, search: string) => { const { category } = params; - const selectedCategory = category || ''; + const selectedCategory: ExtendedIntegrationCategory = category || ''; const queryParams = new URLSearchParams(search); const searchParam = queryParams.get(INTEGRATIONS_SEARCH_QUERYPARAM) || ''; - return { selectedCategory, searchParam } as { - selectedCategory: IntegrationCategory & ''; - searchParam: string; - }; + return { selectedCategory, searchParam }; }; export const categoryExists = (category: string, categories: CategoryFacet[]) => { diff --git a/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/home/installed_packages.tsx b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/home/installed_packages.tsx index 7fdcb5bf335fb..f5b3b50f8f2b1 100644 --- a/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/home/installed_packages.tsx +++ b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/home/installed_packages.tsx @@ -24,7 +24,11 @@ import { CategoryFacets } from './category_facets'; import type { CategoryParams } from '.'; import { getParams, categoryExists, mapToCard } from '.'; -import { INSTALLED_CATEGORY } from './category_facets'; +import { + ALL_INSTALLED_CATEGORY, + UPDATES_AVAILABLE, + UPDATES_AVAILABLE_CATEGORY, +} from './category_facets'; const AnnouncementLink = () => { const { docLinks } = useStartServices(); @@ -107,7 +111,7 @@ export const InstalledPackages: React.FC<{ const history = useHistory(); - function setSelectedCategory(categoryId: string) { + function setUrlCategory(categoryId: string) { const url = pagePathGetters.integrations_installed({ category: categoryId, searchTerm: searchParam, @@ -116,12 +120,12 @@ export const InstalledPackages: React.FC<{ history.push(url); } - function setSearchTerm(search: string) { + function setUrlSearchTerm(search: string) { // Use .replace so the browser's back button is not tied to single keystroke history.replace( pagePathGetters.integrations_installed({ - category: selectedCategory, searchTerm: search, + selectedCategory, })[1] ); } @@ -138,15 +142,12 @@ export const InstalledPackages: React.FC<{ const categories: CategoryFacet[] = useMemo( () => [ { - ...INSTALLED_CATEGORY, + ...ALL_INSTALLED_CATEGORY, count: installedPackages.length, }, { - id: 'updates_available', + ...UPDATES_AVAILABLE_CATEGORY, count: updatablePackages.length, - title: i18n.translate('xpack.fleet.epmList.updatesAvailableFilterLinkText', { - defaultMessage: 'Updates available', - }), }, ], [installedPackages.length, updatablePackages.length] @@ -164,12 +165,12 @@ export const InstalledPackages: React.FC<{ setSelectedCategory(id)} + onCategoryChange={({ id }: CategoryFacet) => setUrlCategory(id)} /> ); const cards = ( - selectedCategory === 'updates_available' ? updatablePackages : installedPackages + selectedCategory === UPDATES_AVAILABLE ? updatablePackages : installedPackages ).map((item) => mapToCard({ getAbsolutePath, @@ -183,13 +184,14 @@ export const InstalledPackages: React.FC<{ const CalloutComponent = cards.some((c) => c.isUnverified) ? VerificationWarningCallout : InstalledIntegrationsInfoCallout; - const callout = - selectedCategory === 'updates_available' || isLoading ? null : ; + const callout = selectedCategory === UPDATES_AVAILABLE || isLoading ? null : ; return ( From 34c228b0c941308e01298e31223e7af0a5a2cee9 Mon Sep 17 00:00:00 2001 From: Pierre Gayvallet Date: Fri, 26 Aug 2022 10:53:37 +0200 Subject: [PATCH 14/28] Migrate remaining parts of server-side SO domain to packages (#139305) * create empty packages * create empty mock packages * start moving client/repository implementation * finish moving client/repo code * move import/export code * move migration code * create empty mocks package * start moving service code * continue fixing stuff, create yet another package * create usage-data package for internal contract * create core-deprecations-server package * fix last problems * fix mock package * start fixing usages * fix index exports * start fixing unit tests for new packages * lint * fix invalid char * fix more violations and test failures * fix more package tests * adapt more test files * one more fix * adapt repo tests * fix last (?) package tests * fix moment mocking * expose import/export error types again * remove test mocking * adapt imports * export as type * trying to fix the schema check task * duplicating usage collection types for now * fix stack trace assertion * fix duplicate import from different paths * [CI] Auto-commit changed files from 'node scripts/generate packages_build_manifest' * update readme's * move mocks to a dedicated folder * self review * move test_utils to integration tests * update package files * rename mocks * manually adapting exclude Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> --- package.json | 22 +++ packages/BUILD.bazel | 22 +++ .../core-deprecations-server/BUILD.bazel | 110 +++++++++++++ .../core-deprecations-server/README.md | 3 + .../core-deprecations-server/index.ts | 11 +- .../core-deprecations-server/jest.config.js | 13 ++ .../core-deprecations-server/package.json | 8 + .../core-deprecations-server/src/contracts.ts | 112 +++++++++++++ .../core-deprecations-server/src}/index.ts | 9 +- .../core-deprecations-server/tsconfig.json | 18 +++ .../BUILD.bazel | 132 ++++++++++++++++ .../README.md | 3 + .../index.ts | 15 ++ .../jest.config.js | 13 ++ .../package.json | 8 + .../src}/index.ts | 4 +- .../priority_collection.test.ts.snap | 0 .../aggregations/aggs_types/bucket_aggs.ts | 0 .../aggregations/aggs_types/common_schemas.ts | 0 .../src}/lib/aggregations/aggs_types/index.ts | 0 .../aggregations/aggs_types/metrics_aggs.ts | 0 .../aggregations/aggs_types/pipeline_aggs.ts | 0 .../aggregations/aggs_types/schemas.test.ts | 0 .../src}/lib/aggregations/index.ts | 0 .../src}/lib/aggregations/validation.test.ts | 0 .../src}/lib/aggregations/validation.ts | 0 .../lib/aggregations/validation_utils.test.ts | 0 .../src}/lib/aggregations/validation_utils.ts | 0 ...ct_multi_namespace_references.test.mock.ts | 0 ...collect_multi_namespace_references.test.ts | 0 .../lib/collect_multi_namespace_references.ts | 11 +- .../src}/lib/decorate_es_error.test.ts | 0 .../src}/lib/decorate_es_error.ts | 0 .../src}/lib/filter_utils.test.ts | 0 .../src}/lib/filter_utils.ts | 0 .../lib/find_shared_origin_objects.test.ts | 12 +- .../src}/lib/find_shared_origin_objects.ts | 2 +- .../src}/lib/included_fields.test.ts | 0 .../src}/lib/included_fields.ts | 0 .../src}/lib/index.ts | 5 +- .../lib/internal_bulk_resolve.test.mock.ts | 0 .../src}/lib/internal_bulk_resolve.test.ts | 0 .../src}/lib/internal_bulk_resolve.ts | 2 +- .../src}/lib/internal_utils.test.ts | 18 --- .../src}/lib/internal_utils.ts | 23 --- .../delete_legacy_url_aliases.test.mock.ts | 0 .../delete_legacy_url_aliases.test.ts | 0 .../delete_legacy_url_aliases.ts | 0 .../find_legacy_url_aliases.test.ts | 11 +- .../find_legacy_url_aliases.ts | 2 +- .../src}/lib/legacy_url_aliases/index.ts | 0 .../src}/lib/point_in_time_finder.test.ts | 16 +- .../src}/lib/point_in_time_finder.ts | 9 +- .../preflight_check_for_create.test.mock.ts | 0 .../lib/preflight_check_for_create.test.ts | 0 .../src}/lib/preflight_check_for_create.ts | 3 +- .../src}/lib/priority_collection.test.ts | 0 .../src}/lib/priority_collection.ts | 0 .../src}/lib/repository.test.mock.ts | 0 .../src}/lib/repository.test.ts | 21 ++- .../src}/lib/repository.ts | 5 +- .../lib/repository_create_repository.test.ts | 11 +- .../lib/repository_es_client.test.mock.ts | 0 .../src}/lib/repository_es_client.test.ts | 0 .../src}/lib/repository_es_client.ts | 0 .../src}/lib/scoped_client_provider.test.ts | 0 .../src}/lib/scoped_client_provider.ts | 0 .../__snapshots__/sorting_params.test.ts.snap | 0 .../src}/lib/search_dsl/index.ts | 0 .../src}/lib/search_dsl/pit_params.test.ts | 0 .../src}/lib/search_dsl/pit_params.ts | 0 .../src}/lib/search_dsl/query_params.test.ts | 0 .../search_dsl/query_params.tests.mocks.ts | 0 .../src}/lib/search_dsl/query_params.ts | 0 .../lib/search_dsl/references_filter.test.ts | 0 .../src}/lib/search_dsl/references_filter.ts | 0 .../src}/lib/search_dsl/search_dsl.test.ts | 0 .../src}/lib/search_dsl/search_dsl.ts | 0 .../lib/search_dsl/sorting_params.test.ts | 0 .../src}/lib/search_dsl/sorting_params.ts | 0 .../lib/update_objects_spaces.test.mock.ts | 0 .../src}/lib/update_objects_spaces.test.ts | 0 .../src}/lib/update_objects_spaces.ts | 0 .../src/mocks/index.ts | 11 ++ .../src/mocks/kibana_migrator.mock.ts | 51 ++++++ .../src/mocks/point_in_time_finder.mock.ts | 59 +++++++ .../src/mocks/repository.mock.ts | 41 +++++ .../src}/saved_objects_client.test.ts | 11 +- .../src}/saved_objects_client.ts | 0 .../tsconfig.json | 18 +++ .../BUILD.bazel | 110 +++++++++++++ .../README.md | 7 + .../index.ts | 10 +- .../jest.config.js | 13 ++ .../package.json | 8 + .../src/index.ts | 11 ++ .../src}/point_in_time_finder.mock.ts | 2 +- .../src}/repository.mock.ts | 0 .../src}/saved_objects_client.mock.ts | 2 +- .../src}/scoped_client_provider.mock.ts | 2 +- .../tsconfig.json | 18 +++ .../src/apis/create_point_in_time_finder.ts | 10 +- .../src/apis/index.ts | 1 + .../src/index.ts | 1 + .../package.json | 1 + .../src/index.ts | 7 + .../src/migration/index.ts | 14 ++ .../src/migration/kibana_migrator.ts | 78 +++++++++ .../src/utils}/get_index_for_type.test.ts | 0 .../src/utils}/get_index_for_type.ts | 0 .../src/utils/index.ts | 10 ++ .../src/utils/object_key.test.ts | 25 +++ .../src/utils/object_key.ts | 30 ++++ .../package.json | 1 + .../BUILD.bazel | 120 ++++++++++++++ .../README.md | 3 + .../index.ts | 14 ++ .../jest.config.js | 13 ++ .../package.json | 8 + .../export/apply_export_transforms.test.ts | 0 .../src}/export/apply_export_transforms.ts | 0 .../collect_exported_objects.test.mocks.ts | 0 .../export/collect_exported_objects.test.ts | 2 +- .../src}/export/collect_exported_objects.ts | 0 .../src}/export/errors.ts | 0 .../src}/export/index.ts | 0 .../export/saved_objects_exporter.test.ts | 2 +- .../src}/export/saved_objects_exporter.ts | 0 .../src}/export/sort_objects.test.ts | 0 .../src}/export/sort_objects.ts | 0 .../src}/export/utils.test.ts | 0 .../src}/export/utils.ts | 0 .../src}/import/errors.ts | 0 .../import/import_saved_objects.test.mock.ts | 0 .../src}/import/import_saved_objects.test.ts | 2 +- .../src}/import/import_saved_objects.ts | 0 .../src}/import/index.ts | 0 .../src}/import/lib/check_conflicts.test.ts | 2 +- .../src}/import/lib/check_conflicts.ts | 0 .../lib/check_origin_conflicts.test.mock.ts | 0 .../import/lib/check_origin_conflicts.test.ts | 2 +- .../src}/import/lib/check_origin_conflicts.ts | 2 +- .../lib/check_reference_origins.test.mock.ts | 0 .../lib/check_reference_origins.test.ts | 2 +- .../import/lib/check_reference_origins.ts | 2 +- .../import/lib/collect_saved_objects.test.ts | 0 .../src}/import/lib/collect_saved_objects.ts | 0 .../import/lib/create_limit_stream.test.ts | 0 .../src}/import/lib/create_limit_stream.ts | 0 .../import/lib/create_objects_filter.test.ts | 0 .../src}/import/lib/create_objects_filter.ts | 0 .../import/lib/create_saved_objects.test.ts | 2 +- .../src}/import/lib/create_saved_objects.ts | 0 .../import/lib/execute_import_hooks.test.ts | 0 .../src}/import/lib/execute_import_hooks.ts | 0 .../src}/import/lib/extract_errors.test.ts | 0 .../src}/import/lib/extract_errors.ts | 0 .../get_import_state_map_for_retries.test.ts | 0 .../lib/get_import_state_map_for_retries.ts | 0 .../import/lib/get_non_unique_entries.test.ts | 0 .../src}/import/lib/get_non_unique_entries.ts | 0 .../src}/import/lib/index.ts | 0 .../src}/import/lib/regenerate_ids.test.ts | 0 .../src}/import/lib/regenerate_ids.ts | 0 .../src}/import/lib/split_overwrites.test.ts | 0 .../src}/import/lib/split_overwrites.ts | 0 .../src}/import/lib/types.ts | 0 .../src}/import/lib/utils.test.ts | 0 .../src}/import/lib/utils.ts | 0 .../import/lib/validate_references.test.ts | 2 +- .../src}/import/lib/validate_references.ts | 0 .../src}/import/lib/validate_retries.test.ts | 0 .../src}/import/lib/validate_retries.ts | 0 .../import/resolve_import_errors.test.mock.ts | 0 .../src}/import/resolve_import_errors.test.ts | 2 +- .../src}/import/resolve_import_errors.ts | 0 .../src}/import/saved_objects_importer.ts | 0 .../src/index.ts | 10 ++ .../tsconfig.json | 18 +++ .../BUILD.bazel | 106 +++++++++++++ .../README.md | 5 + .../index.ts | 9 ++ .../jest.config.js | 13 ++ .../package.json | 8 + .../src/index.ts | 10 ++ .../src}/saved_objects_exporter.mock.ts | 0 .../src}/saved_objects_importer.mock.ts | 0 .../tsconfig.json | 18 +++ .../BUILD.bazel | 134 ++++++++++++++++ .../README.md | 3 + .../index.ts | 60 +++++++ .../jest.config.js | 13 ++ .../package.json | 8 + .../src}/README.md | 0 .../kibana_migrator.test.ts.snap | 0 ...grations_state_action_machine.test.ts.snap | 0 ...lk_overwrite_transformed_documents.test.ts | 0 .../bulk_overwrite_transformed_documents.ts | 0 .../actions/calculate_exclude_filters.test.ts | 0 .../src}/actions/calculate_exclude_filters.ts | 0 .../catch_retryable_es_client_errors.test.ts | 0 .../catch_retryable_es_client_errors.ts | 0 .../actions/check_for_unknown_docs.mocks.ts | 0 .../actions/check_for_unknown_docs.test.ts | 0 .../src}/actions/check_for_unknown_docs.ts | 0 .../src}/actions/clone_index.test.ts | 0 .../src}/actions/clone_index.ts | 2 +- .../src}/actions/close_pit.test.ts | 0 .../src}/actions/close_pit.ts | 0 .../src}/actions/constants.ts | 0 .../src}/actions/create_index.test.ts | 0 .../src}/actions/create_index.ts | 0 .../src}/actions/es_errors.test.ts | 0 .../src}/actions/es_errors.ts | 0 .../src}/actions/fetch_indices.test.ts | 0 .../src}/actions/fetch_indices.ts | 0 .../src}/actions/index.ts | 0 .../src}/actions/initialize_action.test.ts | 0 .../src}/actions/initialize_action.ts | 0 .../src}/actions/open_pit.test.ts | 0 .../src}/actions/open_pit.ts | 0 .../actions/pickup_updated_mappings.test.ts | 0 .../src}/actions/pickup_updated_mappings.ts | 0 .../src}/actions/read_with_pit.test.ts | 0 .../src}/actions/read_with_pit.ts | 0 .../src}/actions/refresh_index.test.ts | 0 .../src}/actions/refresh_index.ts | 0 .../src}/actions/reindex.test.ts | 0 .../src}/actions/reindex.ts | 0 .../src}/actions/remove_write_block.test.ts | 0 .../src}/actions/remove_write_block.ts | 0 .../search_for_outdated_documents.test.ts | 0 .../actions/search_for_outdated_documents.ts | 0 .../src}/actions/set_write_block.test.ts | 0 .../src}/actions/set_write_block.ts | 0 .../src}/actions/transform_docs.ts | 0 .../src}/actions/update_aliases.test.ts | 0 .../src}/actions/update_aliases.ts | 0 .../update_and_pickup_mappings.test.ts | 0 .../actions/update_and_pickup_mappings.ts | 0 .../actions/wait_for_index_status.test.ts | 0 .../src}/actions/wait_for_index_status.ts | 0 ...t_for_pickup_updated_mappings_task.test.ts | 0 .../wait_for_pickup_updated_mappings_task.ts | 0 .../actions/wait_for_reindex_task.test.ts | 0 .../src}/actions/wait_for_reindex_task.ts | 0 .../src}/actions/wait_for_task.test.ts | 0 .../src}/actions/wait_for_task.ts | 0 .../build_active_mappings.test.ts.snap | 0 .../src}/core/build_active_mappings.test.ts | 0 .../src}/core/build_active_mappings.ts | 0 .../src}/core/build_index_map.test.ts | 0 .../src}/core/build_index_map.ts | 0 ...isable_unknown_type_mapping_fields.test.ts | 0 .../disable_unknown_type_mapping_fields.ts | 0 .../src}/core/document_migrator.test.mock.ts | 0 .../src}/core/document_migrator.test.ts | 0 .../src}/core/document_migrator.ts | 0 .../src}/core/index.ts | 1 - .../src}/core/migrate_raw_docs.test.ts | 0 .../src}/core/migrate_raw_docs.ts | 0 .../src}/core/migration_logger.ts | 0 ...nsform_saved_object_document_error.test.ts | 0 .../transform_saved_object_document_error.ts | 0 .../src}/core/unused_types.ts | 0 .../src/index.ts | 11 ++ .../src}/initial_state.test.ts | 2 +- .../src}/initial_state.ts | 0 .../src}/kibana_migrator.test.ts | 0 .../src}/kibana_migrator.ts | 46 +----- .../migrations_state_action_machine.test.ts | 2 +- .../src}/migrations_state_action_machine.ts | 0 .../migrations_state_machine_cleanup.mocks.ts | 0 .../src}/migrations_state_machine_cleanup.ts | 0 .../src}/model/create_batches.test.ts | 0 .../src}/model/create_batches.ts | 0 .../src}/model/extract_errors.test.ts | 0 .../src}/model/extract_errors.ts | 0 .../src}/model/helpers.test.ts | 0 .../src}/model/helpers.ts | 0 .../src}/model/index.ts | 0 .../src}/model/model.test.ts | 0 .../src}/model/model.ts | 0 .../src}/model/progress.test.ts | 0 .../src}/model/progress.ts | 0 .../src}/model/retry_state.test.ts | 0 .../src}/model/retry_state.ts | 0 .../src}/model/types.ts | 0 .../src}/next.test.ts | 0 .../src}/next.ts | 0 .../src}/run_resilient_migrator.ts | 2 +- .../src}/state.ts | 0 .../src}/state_action_machine.test.ts | 0 .../src}/state_action_machine.ts | 0 .../src}/types.ts | 2 +- .../tsconfig.json | 18 +++ .../BUILD.bazel | 111 +++++++++++++ .../README.md | 8 + .../index.ts | 14 ++ .../jest.config.js | 13 ++ .../package.json | 8 + .../src/helpers}/retry.test.ts | 0 .../src/helpers}/retry_async.ts | 0 .../src/index.ts | 11 ++ .../src}/kibana_migrator.mock.ts | 11 +- .../src/migration.mocks.ts | 0 .../tsconfig.json | 18 +++ .../BUILD.bazel | 130 +++++++++++++++ .../README.md | 3 + .../index.ts | 34 ++++ .../jest.config.js | 13 ++ .../package.json | 8 + .../src}/deprecations/deprecation_factory.ts | 2 +- .../src}/deprecations/index.ts | 0 .../unknown_object_types.test.mocks.ts | 17 ++ .../deprecations/unknown_object_types.test.ts | 35 ++++- .../src}/deprecations/unknown_object_types.ts | 8 +- .../src}/index.ts | 14 +- .../src}/internal_types.ts | 0 .../src/mocks/internal_mocks.ts | 40 +++++ .../src}/object_types/index.ts | 0 .../src}/object_types/registration.test.ts | 0 .../src}/object_types/registration.ts | 0 .../src}/routes/bulk_create.ts | 2 +- .../src}/routes/bulk_get.ts | 2 +- .../src}/routes/bulk_resolve.ts | 2 +- .../src}/routes/bulk_update.ts | 2 +- .../src}/routes/create.ts | 2 +- .../src}/routes/delete.ts | 2 +- .../deprecations/delete_unknown_types.ts | 0 .../src}/routes/deprecations/index.ts | 0 .../src}/routes/export.ts | 4 +- .../src}/routes/find.ts | 2 +- .../src}/routes/get.ts | 2 +- .../src}/routes/import.ts | 4 +- .../src}/routes/index.ts | 8 +- .../routes/legacy_import_export/export.ts | 2 +- .../routes/legacy_import_export/import.ts | 4 +- .../lib/collect_references_deep.test.ts | 2 +- .../lib/collect_references_deep.ts | 3 +- .../lib/export_dashboards.ts | 2 +- .../lib/import_dashboards.test.ts | 4 +- .../lib/import_dashboards.ts | 3 +- .../routes/legacy_import_export/lib/index.ts | 0 .../src}/routes/migrate.ts | 2 +- .../src}/routes/resolve.ts | 2 +- .../src}/routes/resolve_import_errors.ts | 4 +- .../src}/routes/update.ts | 2 +- .../src}/routes/utils.test.ts | 0 .../src}/routes/utils.ts | 4 +- .../saved_objects_route_handler_context.ts | 0 .../src}/saved_objects_service.test.mocks.ts | 32 +++- .../src}/saved_objects_service.test.ts | 26 +-- .../src}/saved_objects_service.ts | 24 +-- .../src}/status.test.ts | 2 +- .../src}/status.ts | 4 +- .../tsconfig.json | 18 +++ .../BUILD.bazel | 120 ++++++++++++++ .../core-saved-objects-server-mocks/README.md | 5 + .../core-saved-objects-server-mocks/index.ts | 9 ++ .../jest.config.js | 13 ++ .../package.json | 8 + .../src/index.ts | 9 ++ .../src}/saved_objects_service.mock.ts | 19 ++- .../tsconfig.json | 18 +++ .../package.json | 1 + .../BUILD.bazel | 109 +++++++++++++ .../README.md | 6 + .../index.ts | 21 +++ .../jest.config.js | 13 ++ .../package.json | 8 + .../src/constants.ts | 22 +++ .../src/index.ts | 21 +++ .../src/internal_contract.ts | 25 +++ .../src/usage_stats_client.ts | 69 ++++++++ .../tsconfig.json | 18 +++ .../core-usage-data-server/BUILD.bazel | 106 +++++++++++++ .../core-usage-data-server/README.md | 3 + .../core-usage-data-server/index.ts | 21 +++ .../core-usage-data-server/jest.config.js | 13 ++ .../core-usage-data-server/package.json | 8 + .../src/core_usage_data.ts | 148 ++++++++++++++++++ .../src/core_usage_stats.ts | 138 ++++++++++++++++ .../core-usage-data-server/src/index.ts | 21 +++ .../src/setup_contract.ts | 50 ++++++ .../src/start_contract.ts | 52 ++++++ .../core-usage-data-server/tsconfig.json | 18 +++ src/core/server/core_route_handler_context.ts | 2 +- .../core_usage_data_service.mock.ts | 5 +- .../core_usage_data_service.test.ts | 4 +- .../core_usage_data_service.ts | 15 +- .../core_usage_data/core_usage_stats.ts | 2 +- .../core_usage_stats_client.test.ts | 5 +- .../core_usage_stats_client.ts | 44 ++---- src/core/server/core_usage_data/index.ts | 34 ++-- .../server/core_usage_data/migrations.test.ts | 2 +- src/core/server/core_usage_data/migrations.ts | 2 +- .../deprecations/deprecations_factory.test.ts | 2 +- .../deprecations/deprecations_factory.ts | 2 +- .../deprecations_registry.mock.ts | 4 +- .../deprecations_registry.test.ts | 5 +- .../deprecations/deprecations_registry.ts | 6 +- .../deprecations_route_handler_context.ts | 2 +- .../deprecations/deprecations_service.mock.ts | 3 +- .../deprecations/deprecations_service.ts | 87 +--------- src/core/server/deprecations/index.ts | 7 +- src/core/server/deprecations/types.ts | 27 ---- src/core/server/index.ts | 9 +- .../migrations/actions/actions.test.ts | 10 +- .../migrations/actions/es_errors.test.ts | 6 +- .../migrations/batch_size_bytes.test.ts | 2 +- ...ze_bytes_exceeds_es_content_length.test.ts | 2 +- .../migrations/collects_corrupt_docs.test.ts | 10 +- ...patible_cluster_routing_allocation.test.ts | 2 +- .../migrations/rewriting_id.test.ts | 2 +- .../migrations/type_registrations.test.ts | 2 +- .../saved_objects/routes/bulk_create.test.ts | 8 +- .../saved_objects/routes/bulk_get.test.ts | 8 +- .../saved_objects/routes/bulk_resolve.test.ts | 8 +- .../saved_objects/routes/bulk_update.test.ts | 8 +- .../saved_objects/routes/create.test.ts | 10 +- .../saved_objects/routes/delete.test.ts | 8 +- .../routes/delete_unknown_types.test.ts | 8 +- .../saved_objects/routes/export.test.ts | 14 +- .../saved_objects/routes/find.test.ts | 8 +- .../saved_objects/routes/get.test.ts | 8 +- .../saved_objects/routes/import.test.ts | 10 +- .../legacy_import_export/export.test.ts | 26 +-- .../legacy_import_export/import.test.ts | 20 ++- .../routes/migrate.test.mocks.ts | 12 +- .../saved_objects/routes/resolve.test.ts | 8 +- .../routes/resolve_import_errors.test.ts | 10 +- .../saved_objects/routes/test_utils.ts | 13 +- .../saved_objects/routes/update.test.ts | 8 +- src/core/server/internal_types.ts | 2 +- src/core/server/mocks.ts | 14 +- .../saved_objects/migrations/core/types.ts | 23 --- src/core/server/server.test.mocks.ts | 4 +- src/core/server/server.ts | 4 +- src/core/server/status/routes/status.ts | 2 +- src/core/server/status/status_service.ts | 2 +- src/core/server/test_utils.ts | 2 +- .../create_or_upgrade_saved_config.test.ts | 2 +- .../get_upgradeable_config.test.ts | 2 +- .../ui_settings/ui_settings_client.test.ts | 4 +- .../ui_settings_route_handler_context.ts | 2 +- .../ui_settings/ui_settings_service.test.ts | 4 +- .../server/ui_settings/ui_settings_service.ts | 2 +- .../collectors/core/core_usage_collector.ts | 3 +- .../collectors/core/core_usage_data.ts} | 122 ++------------- .../elasticsearch/transform/remove.test.ts | 2 +- .../elasticsearch/transform/transform.test.ts | 2 +- .../services/epm/kibana/assets/install.ts | 6 +- .../services/epm/packages/_install_package.ts | 4 +- .../alerts/license_expiration_rule.test.ts | 9 +- yarn.lock | 88 +++++++++++ 456 files changed, 3733 insertions(+), 721 deletions(-) create mode 100644 packages/core/deprecations/core-deprecations-server/BUILD.bazel create mode 100644 packages/core/deprecations/core-deprecations-server/README.md rename src/core/server/core_usage_data/constants.ts => packages/core/deprecations/core-deprecations-server/index.ts (70%) create mode 100644 packages/core/deprecations/core-deprecations-server/jest.config.js create mode 100644 packages/core/deprecations/core-deprecations-server/package.json create mode 100644 packages/core/deprecations/core-deprecations-server/src/contracts.ts rename {src/core/server/saved_objects/migrations => packages/core/deprecations/core-deprecations-server/src}/index.ts (66%) create mode 100644 packages/core/deprecations/core-deprecations-server/tsconfig.json create mode 100644 packages/core/saved-objects/core-saved-objects-api-server-internal/BUILD.bazel create mode 100644 packages/core/saved-objects/core-saved-objects-api-server-internal/README.md create mode 100644 packages/core/saved-objects/core-saved-objects-api-server-internal/index.ts create mode 100644 packages/core/saved-objects/core-saved-objects-api-server-internal/jest.config.js create mode 100644 packages/core/saved-objects/core-saved-objects-api-server-internal/package.json rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/index.ts (73%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/__snapshots__/priority_collection.test.ts.snap (100%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/aggregations/aggs_types/bucket_aggs.ts (100%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/aggregations/aggs_types/common_schemas.ts (100%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/aggregations/aggs_types/index.ts (100%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/aggregations/aggs_types/metrics_aggs.ts (100%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/aggregations/aggs_types/pipeline_aggs.ts (100%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/aggregations/aggs_types/schemas.test.ts (100%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/aggregations/index.ts (100%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/aggregations/validation.test.ts (100%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/aggregations/validation.ts (100%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/aggregations/validation_utils.test.ts (100%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/aggregations/validation_utils.ts (100%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/collect_multi_namespace_references.test.mock.ts (100%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/collect_multi_namespace_references.test.ts (100%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/collect_multi_namespace_references.ts (97%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/decorate_es_error.test.ts (100%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/decorate_es_error.ts (100%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/filter_utils.test.ts (100%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/filter_utils.ts (100%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/find_shared_origin_objects.test.ts (94%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/find_shared_origin_objects.ts (98%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/included_fields.test.ts (100%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/included_fields.ts (100%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/index.ts (81%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/internal_bulk_resolve.test.mock.ts (100%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/internal_bulk_resolve.test.ts (100%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/internal_bulk_resolve.ts (99%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/internal_utils.test.ts (96%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/internal_utils.ts (93%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/legacy_url_aliases/delete_legacy_url_aliases.test.mock.ts (100%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/legacy_url_aliases/delete_legacy_url_aliases.test.ts (100%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/legacy_url_aliases/delete_legacy_url_aliases.ts (100%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/legacy_url_aliases/find_legacy_url_aliases.test.ts (94%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/legacy_url_aliases/find_legacy_url_aliases.ts (98%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/legacy_url_aliases/index.ts (100%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/point_in_time_finder.test.ts (96%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/point_in_time_finder.ts (96%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/preflight_check_for_create.test.mock.ts (100%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/preflight_check_for_create.test.ts (100%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/preflight_check_for_create.ts (99%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/priority_collection.test.ts (100%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/priority_collection.ts (100%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/repository.test.mock.ts (100%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/repository.test.ts (99%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/repository.ts (99%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/repository_create_repository.test.ts (90%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/repository_es_client.test.mock.ts (100%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/repository_es_client.test.ts (100%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/repository_es_client.ts (100%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/scoped_client_provider.test.ts (100%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/scoped_client_provider.ts (100%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/search_dsl/__snapshots__/sorting_params.test.ts.snap (100%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/search_dsl/index.ts (100%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/search_dsl/pit_params.test.ts (100%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/search_dsl/pit_params.ts (100%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/search_dsl/query_params.test.ts (100%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/search_dsl/query_params.tests.mocks.ts (100%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/search_dsl/query_params.ts (100%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/search_dsl/references_filter.test.ts (100%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/search_dsl/references_filter.ts (100%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/search_dsl/search_dsl.test.ts (100%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/search_dsl/search_dsl.ts (100%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/search_dsl/sorting_params.test.ts (100%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/search_dsl/sorting_params.ts (100%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/update_objects_spaces.test.mock.ts (100%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/update_objects_spaces.test.ts (100%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/lib/update_objects_spaces.ts (100%) create mode 100644 packages/core/saved-objects/core-saved-objects-api-server-internal/src/mocks/index.ts create mode 100644 packages/core/saved-objects/core-saved-objects-api-server-internal/src/mocks/kibana_migrator.mock.ts create mode 100644 packages/core/saved-objects/core-saved-objects-api-server-internal/src/mocks/point_in_time_finder.mock.ts create mode 100644 packages/core/saved-objects/core-saved-objects-api-server-internal/src/mocks/repository.mock.ts rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/saved_objects_client.test.ts (97%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-internal/src}/saved_objects_client.ts (100%) create mode 100644 packages/core/saved-objects/core-saved-objects-api-server-internal/tsconfig.json create mode 100644 packages/core/saved-objects/core-saved-objects-api-server-mocks/BUILD.bazel create mode 100644 packages/core/saved-objects/core-saved-objects-api-server-mocks/README.md rename src/core/server/saved_objects/deprecations/unknown_object_types.test.mocks.ts => packages/core/saved-objects/core-saved-objects-api-server-mocks/index.ts (70%) create mode 100644 packages/core/saved-objects/core-saved-objects-api-server-mocks/jest.config.js create mode 100644 packages/core/saved-objects/core-saved-objects-api-server-mocks/package.json create mode 100644 packages/core/saved-objects/core-saved-objects-api-server-mocks/src/index.ts rename {src/core/server/saved_objects/service/lib => packages/core/saved-objects/core-saved-objects-api-server-mocks/src}/point_in_time_finder.mock.ts (94%) rename {src/core/server/saved_objects/service/lib => packages/core/saved-objects/core-saved-objects-api-server-mocks/src}/repository.mock.ts (100%) rename {src/core/server/saved_objects/service => packages/core/saved-objects/core-saved-objects-api-server-mocks/src}/saved_objects_client.mock.ts (94%) rename {src/core/server/saved_objects/service/lib => packages/core/saved-objects/core-saved-objects-api-server-mocks/src}/scoped_client_provider.mock.ts (85%) create mode 100644 packages/core/saved-objects/core-saved-objects-api-server-mocks/tsconfig.json create mode 100644 packages/core/saved-objects/core-saved-objects-base-server-internal/src/migration/index.ts create mode 100644 packages/core/saved-objects/core-saved-objects-base-server-internal/src/migration/kibana_migrator.ts rename {src/core/server/saved_objects/service/lib => packages/core/saved-objects/core-saved-objects-base-server-internal/src/utils}/get_index_for_type.test.ts (100%) rename {src/core/server/saved_objects/service/lib => packages/core/saved-objects/core-saved-objects-base-server-internal/src/utils}/get_index_for_type.ts (100%) create mode 100644 packages/core/saved-objects/core-saved-objects-base-server-internal/src/utils/index.ts create mode 100644 packages/core/saved-objects/core-saved-objects-base-server-internal/src/utils/object_key.test.ts create mode 100644 packages/core/saved-objects/core-saved-objects-base-server-internal/src/utils/object_key.ts create mode 100644 packages/core/saved-objects/core-saved-objects-import-export-server-internal/BUILD.bazel create mode 100644 packages/core/saved-objects/core-saved-objects-import-export-server-internal/README.md create mode 100644 packages/core/saved-objects/core-saved-objects-import-export-server-internal/index.ts create mode 100644 packages/core/saved-objects/core-saved-objects-import-export-server-internal/jest.config.js create mode 100644 packages/core/saved-objects/core-saved-objects-import-export-server-internal/package.json rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-import-export-server-internal/src}/export/apply_export_transforms.test.ts (100%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-import-export-server-internal/src}/export/apply_export_transforms.ts (100%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-import-export-server-internal/src}/export/collect_exported_objects.test.mocks.ts (100%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-import-export-server-internal/src}/export/collect_exported_objects.test.ts (99%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-import-export-server-internal/src}/export/collect_exported_objects.ts (100%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-import-export-server-internal/src}/export/errors.ts (100%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-import-export-server-internal/src}/export/index.ts (100%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-import-export-server-internal/src}/export/saved_objects_exporter.test.ts (99%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-import-export-server-internal/src}/export/saved_objects_exporter.ts (100%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-import-export-server-internal/src}/export/sort_objects.test.ts (100%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-import-export-server-internal/src}/export/sort_objects.ts (100%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-import-export-server-internal/src}/export/utils.test.ts (100%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-import-export-server-internal/src}/export/utils.ts (100%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-import-export-server-internal/src}/import/errors.ts (100%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-import-export-server-internal/src}/import/import_saved_objects.test.mock.ts (100%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-import-export-server-internal/src}/import/import_saved_objects.test.ts (99%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-import-export-server-internal/src}/import/import_saved_objects.ts (100%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-import-export-server-internal/src}/import/index.ts (100%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-import-export-server-internal/src}/import/lib/check_conflicts.test.ts (98%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-import-export-server-internal/src}/import/lib/check_conflicts.ts (100%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-import-export-server-internal/src}/import/lib/check_origin_conflicts.test.mock.ts (100%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-import-export-server-internal/src}/import/lib/check_origin_conflicts.test.ts (99%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-import-export-server-internal/src}/import/lib/check_origin_conflicts.ts (99%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-import-export-server-internal/src}/import/lib/check_reference_origins.test.mock.ts (100%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-import-export-server-internal/src}/import/lib/check_reference_origins.test.ts (98%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-import-export-server-internal/src}/import/lib/check_reference_origins.ts (97%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-import-export-server-internal/src}/import/lib/collect_saved_objects.test.ts (100%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-import-export-server-internal/src}/import/lib/collect_saved_objects.ts (100%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-import-export-server-internal/src}/import/lib/create_limit_stream.test.ts (100%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-import-export-server-internal/src}/import/lib/create_limit_stream.ts (100%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-import-export-server-internal/src}/import/lib/create_objects_filter.test.ts (100%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-import-export-server-internal/src}/import/lib/create_objects_filter.ts (100%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-import-export-server-internal/src}/import/lib/create_saved_objects.test.ts (99%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-import-export-server-internal/src}/import/lib/create_saved_objects.ts (100%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-import-export-server-internal/src}/import/lib/execute_import_hooks.test.ts (100%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-import-export-server-internal/src}/import/lib/execute_import_hooks.ts (100%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-import-export-server-internal/src}/import/lib/extract_errors.test.ts (100%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-import-export-server-internal/src}/import/lib/extract_errors.ts (100%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-import-export-server-internal/src}/import/lib/get_import_state_map_for_retries.test.ts (100%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-import-export-server-internal/src}/import/lib/get_import_state_map_for_retries.ts (100%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-import-export-server-internal/src}/import/lib/get_non_unique_entries.test.ts (100%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-import-export-server-internal/src}/import/lib/get_non_unique_entries.ts (100%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-import-export-server-internal/src}/import/lib/index.ts (100%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-import-export-server-internal/src}/import/lib/regenerate_ids.test.ts (100%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-import-export-server-internal/src}/import/lib/regenerate_ids.ts (100%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-import-export-server-internal/src}/import/lib/split_overwrites.test.ts (100%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-import-export-server-internal/src}/import/lib/split_overwrites.ts (100%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-import-export-server-internal/src}/import/lib/types.ts (100%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-import-export-server-internal/src}/import/lib/utils.test.ts (100%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-import-export-server-internal/src}/import/lib/utils.ts (100%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-import-export-server-internal/src}/import/lib/validate_references.test.ts (99%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-import-export-server-internal/src}/import/lib/validate_references.ts (100%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-import-export-server-internal/src}/import/lib/validate_retries.test.ts (100%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-import-export-server-internal/src}/import/lib/validate_retries.ts (100%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-import-export-server-internal/src}/import/resolve_import_errors.test.mock.ts (100%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-import-export-server-internal/src}/import/resolve_import_errors.test.ts (99%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-import-export-server-internal/src}/import/resolve_import_errors.ts (100%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-import-export-server-internal/src}/import/saved_objects_importer.ts (100%) create mode 100644 packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/index.ts create mode 100644 packages/core/saved-objects/core-saved-objects-import-export-server-internal/tsconfig.json create mode 100644 packages/core/saved-objects/core-saved-objects-import-export-server-mocks/BUILD.bazel create mode 100644 packages/core/saved-objects/core-saved-objects-import-export-server-mocks/README.md create mode 100644 packages/core/saved-objects/core-saved-objects-import-export-server-mocks/index.ts create mode 100644 packages/core/saved-objects/core-saved-objects-import-export-server-mocks/jest.config.js create mode 100644 packages/core/saved-objects/core-saved-objects-import-export-server-mocks/package.json create mode 100644 packages/core/saved-objects/core-saved-objects-import-export-server-mocks/src/index.ts rename {src/core/server/saved_objects/export => packages/core/saved-objects/core-saved-objects-import-export-server-mocks/src}/saved_objects_exporter.mock.ts (100%) rename {src/core/server/saved_objects/import => packages/core/saved-objects/core-saved-objects-import-export-server-mocks/src}/saved_objects_importer.mock.ts (100%) create mode 100644 packages/core/saved-objects/core-saved-objects-import-export-server-mocks/tsconfig.json create mode 100644 packages/core/saved-objects/core-saved-objects-migration-server-internal/BUILD.bazel create mode 100644 packages/core/saved-objects/core-saved-objects-migration-server-internal/README.md create mode 100644 packages/core/saved-objects/core-saved-objects-migration-server-internal/index.ts create mode 100644 packages/core/saved-objects/core-saved-objects-migration-server-internal/jest.config.js create mode 100644 packages/core/saved-objects/core-saved-objects-migration-server-internal/package.json rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/README.md (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/__snapshots__/kibana_migrator.test.ts.snap (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/__snapshots__/migrations_state_action_machine.test.ts.snap (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/actions/bulk_overwrite_transformed_documents.test.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/actions/bulk_overwrite_transformed_documents.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/actions/calculate_exclude_filters.test.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/actions/calculate_exclude_filters.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/actions/catch_retryable_es_client_errors.test.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/actions/catch_retryable_es_client_errors.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/actions/check_for_unknown_docs.mocks.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/actions/check_for_unknown_docs.test.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/actions/check_for_unknown_docs.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/actions/clone_index.test.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/actions/clone_index.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/actions/close_pit.test.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/actions/close_pit.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/actions/constants.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/actions/create_index.test.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/actions/create_index.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/actions/es_errors.test.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/actions/es_errors.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/actions/fetch_indices.test.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/actions/fetch_indices.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/actions/index.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/actions/initialize_action.test.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/actions/initialize_action.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/actions/open_pit.test.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/actions/open_pit.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/actions/pickup_updated_mappings.test.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/actions/pickup_updated_mappings.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/actions/read_with_pit.test.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/actions/read_with_pit.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/actions/refresh_index.test.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/actions/refresh_index.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/actions/reindex.test.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/actions/reindex.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/actions/remove_write_block.test.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/actions/remove_write_block.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/actions/search_for_outdated_documents.test.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/actions/search_for_outdated_documents.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/actions/set_write_block.test.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/actions/set_write_block.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/actions/transform_docs.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/actions/update_aliases.test.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/actions/update_aliases.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/actions/update_and_pickup_mappings.test.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/actions/update_and_pickup_mappings.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/actions/wait_for_index_status.test.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/actions/wait_for_index_status.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/actions/wait_for_pickup_updated_mappings_task.test.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/actions/wait_for_pickup_updated_mappings_task.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/actions/wait_for_reindex_task.test.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/actions/wait_for_reindex_task.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/actions/wait_for_task.test.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/actions/wait_for_task.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/core/__snapshots__/build_active_mappings.test.ts.snap (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/core/build_active_mappings.test.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/core/build_active_mappings.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/core/build_index_map.test.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/core/build_index_map.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/core/disable_unknown_type_mapping_fields.test.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/core/disable_unknown_type_mapping_fields.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/core/document_migrator.test.mock.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/core/document_migrator.test.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/core/document_migrator.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/core/index.ts (93%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/core/migrate_raw_docs.test.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/core/migrate_raw_docs.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/core/migration_logger.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/core/transform_saved_object_document_error.test.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/core/transform_saved_object_document_error.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/core/unused_types.ts (100%) create mode 100644 packages/core/saved-objects/core-saved-objects-migration-server-internal/src/index.ts rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/initial_state.test.ts (99%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/initial_state.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/kibana_migrator.test.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/kibana_migrator.ts (78%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/migrations_state_action_machine.test.ts (99%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/migrations_state_action_machine.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/migrations_state_machine_cleanup.mocks.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/migrations_state_machine_cleanup.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/model/create_batches.test.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/model/create_batches.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/model/extract_errors.test.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/model/extract_errors.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/model/helpers.test.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/model/helpers.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/model/index.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/model/model.test.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/model/model.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/model/progress.test.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/model/progress.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/model/retry_state.test.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/model/retry_state.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/model/types.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/next.test.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/next.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/run_resilient_migrator.ts (98%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/state.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/state_action_machine.test.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/state_action_machine.ts (100%) rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-internal/src}/types.ts (94%) create mode 100644 packages/core/saved-objects/core-saved-objects-migration-server-internal/tsconfig.json create mode 100644 packages/core/saved-objects/core-saved-objects-migration-server-mocks/BUILD.bazel create mode 100644 packages/core/saved-objects/core-saved-objects-migration-server-mocks/README.md create mode 100644 packages/core/saved-objects/core-saved-objects-migration-server-mocks/index.ts create mode 100644 packages/core/saved-objects/core-saved-objects-migration-server-mocks/jest.config.js create mode 100644 packages/core/saved-objects/core-saved-objects-migration-server-mocks/package.json rename {src/core/server/saved_objects/migrations/test_helpers => packages/core/saved-objects/core-saved-objects-migration-server-mocks/src/helpers}/retry.test.ts (100%) rename {src/core/server/saved_objects/migrations/test_helpers => packages/core/saved-objects/core-saved-objects-migration-server-mocks/src/helpers}/retry_async.ts (100%) create mode 100644 packages/core/saved-objects/core-saved-objects-migration-server-mocks/src/index.ts rename {src/core/server/saved_objects/migrations => packages/core/saved-objects/core-saved-objects-migration-server-mocks/src}/kibana_migrator.mock.ts (88%) rename src/core/server/saved_objects/migrations/mocks.ts => packages/core/saved-objects/core-saved-objects-migration-server-mocks/src/migration.mocks.ts (100%) create mode 100644 packages/core/saved-objects/core-saved-objects-migration-server-mocks/tsconfig.json create mode 100644 packages/core/saved-objects/core-saved-objects-server-internal/BUILD.bazel create mode 100644 packages/core/saved-objects/core-saved-objects-server-internal/README.md create mode 100644 packages/core/saved-objects/core-saved-objects-server-internal/index.ts create mode 100644 packages/core/saved-objects/core-saved-objects-server-internal/jest.config.js create mode 100644 packages/core/saved-objects/core-saved-objects-server-internal/package.json rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-server-internal/src}/deprecations/deprecation_factory.ts (93%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-server-internal/src}/deprecations/index.ts (100%) create mode 100644 packages/core/saved-objects/core-saved-objects-server-internal/src/deprecations/unknown_object_types.test.mocks.ts rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-server-internal/src}/deprecations/unknown_object_types.test.ts (85%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-server-internal/src}/deprecations/unknown_object_types.ts (95%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-server-internal/src}/index.ts (74%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-server-internal/src}/internal_types.ts (100%) create mode 100644 packages/core/saved-objects/core-saved-objects-server-internal/src/mocks/internal_mocks.ts rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-server-internal/src}/object_types/index.ts (100%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-server-internal/src}/object_types/registration.test.ts (100%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-server-internal/src}/object_types/registration.ts (100%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-server-internal/src}/routes/bulk_create.ts (95%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-server-internal/src}/routes/bulk_get.ts (94%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-server-internal/src}/routes/bulk_resolve.ts (93%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-server-internal/src}/routes/bulk_update.ts (95%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-server-internal/src}/routes/create.ts (96%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-server-internal/src}/routes/delete.ts (94%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-server-internal/src}/routes/deprecations/delete_unknown_types.ts (100%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-server-internal/src}/routes/deprecations/index.ts (100%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-server-internal/src}/routes/export.ts (97%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-server-internal/src}/routes/find.ts (97%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-server-internal/src}/routes/get.ts (93%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-server-internal/src}/routes/import.ts (94%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-server-internal/src}/routes/index.ts (94%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-server-internal/src}/routes/legacy_import_export/export.ts (95%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-server-internal/src}/routes/legacy_import_export/import.ts (93%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-server-internal/src}/routes/legacy_import_export/lib/collect_references_deep.test.ts (98%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-server-internal/src}/routes/legacy_import_export/lib/collect_references_deep.ts (89%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-server-internal/src}/routes/legacy_import_export/lib/export_dashboards.ts (90%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-server-internal/src}/routes/legacy_import_export/lib/import_dashboards.test.ts (94%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-server-internal/src}/routes/legacy_import_export/lib/import_dashboards.ts (89%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-server-internal/src}/routes/legacy_import_export/lib/index.ts (100%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-server-internal/src}/routes/migrate.ts (92%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-server-internal/src}/routes/resolve.ts (93%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-server-internal/src}/routes/resolve_import_errors.ts (95%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-server-internal/src}/routes/update.ts (95%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-server-internal/src}/routes/utils.test.ts (100%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-server-internal/src}/routes/utils.ts (92%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-server-internal/src}/saved_objects_route_handler_context.ts (100%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-server-internal/src}/saved_objects_service.test.mocks.ts (55%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-server-internal/src}/saved_objects_service.test.ts (96%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-server-internal/src}/saved_objects_service.ts (94%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-server-internal/src}/status.test.ts (98%) rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-server-internal/src}/status.ts (94%) create mode 100644 packages/core/saved-objects/core-saved-objects-server-internal/tsconfig.json create mode 100644 packages/core/saved-objects/core-saved-objects-server-mocks/BUILD.bazel create mode 100644 packages/core/saved-objects/core-saved-objects-server-mocks/README.md create mode 100644 packages/core/saved-objects/core-saved-objects-server-mocks/index.ts create mode 100644 packages/core/saved-objects/core-saved-objects-server-mocks/jest.config.js create mode 100644 packages/core/saved-objects/core-saved-objects-server-mocks/package.json create mode 100644 packages/core/saved-objects/core-saved-objects-server-mocks/src/index.ts rename {src/core/server/saved_objects => packages/core/saved-objects/core-saved-objects-server-mocks/src}/saved_objects_service.mock.ts (89%) create mode 100644 packages/core/saved-objects/core-saved-objects-server-mocks/tsconfig.json create mode 100644 packages/core/usage-data/core-usage-data-base-server-internal/BUILD.bazel create mode 100644 packages/core/usage-data/core-usage-data-base-server-internal/README.md create mode 100644 packages/core/usage-data/core-usage-data-base-server-internal/index.ts create mode 100644 packages/core/usage-data/core-usage-data-base-server-internal/jest.config.js create mode 100644 packages/core/usage-data/core-usage-data-base-server-internal/package.json create mode 100644 packages/core/usage-data/core-usage-data-base-server-internal/src/constants.ts create mode 100644 packages/core/usage-data/core-usage-data-base-server-internal/src/index.ts create mode 100644 packages/core/usage-data/core-usage-data-base-server-internal/src/internal_contract.ts create mode 100644 packages/core/usage-data/core-usage-data-base-server-internal/src/usage_stats_client.ts create mode 100644 packages/core/usage-data/core-usage-data-base-server-internal/tsconfig.json create mode 100644 packages/core/usage-data/core-usage-data-server/BUILD.bazel create mode 100644 packages/core/usage-data/core-usage-data-server/README.md create mode 100644 packages/core/usage-data/core-usage-data-server/index.ts create mode 100644 packages/core/usage-data/core-usage-data-server/jest.config.js create mode 100644 packages/core/usage-data/core-usage-data-server/package.json create mode 100644 packages/core/usage-data/core-usage-data-server/src/core_usage_data.ts create mode 100644 packages/core/usage-data/core-usage-data-server/src/core_usage_stats.ts create mode 100644 packages/core/usage-data/core-usage-data-server/src/index.ts create mode 100644 packages/core/usage-data/core-usage-data-server/src/setup_contract.ts create mode 100644 packages/core/usage-data/core-usage-data-server/src/start_contract.ts create mode 100644 packages/core/usage-data/core-usage-data-server/tsconfig.json delete mode 100644 src/core/server/deprecations/types.ts rename src/core/server/{ => integration_tests}/saved_objects/routes/test_utils.ts (83%) delete mode 100644 src/core/server/saved_objects/migrations/core/types.ts rename src/{core/server/core_usage_data/types.ts => plugins/kibana_usage_collection/server/collectors/core/core_usage_data.ts} (81%) diff --git a/package.json b/package.json index 643aa57db3472..eaca21c41ee2f 100644 --- a/package.json +++ b/package.json @@ -169,6 +169,7 @@ "@kbn/core-deprecations-browser-internal": "link:bazel-bin/packages/core/deprecations/core-deprecations-browser-internal", "@kbn/core-deprecations-browser-mocks": "link:bazel-bin/packages/core/deprecations/core-deprecations-browser-mocks", "@kbn/core-deprecations-common": "link:bazel-bin/packages/core/deprecations/core-deprecations-common", + "@kbn/core-deprecations-server": "link:bazel-bin/packages/core/deprecations/core-deprecations-server", "@kbn/core-doc-links-browser": "link:bazel-bin/packages/core/doc-links/core-doc-links-browser", "@kbn/core-doc-links-browser-internal": "link:bazel-bin/packages/core/doc-links/core-doc-links-browser-internal", "@kbn/core-doc-links-browser-mocks": "link:bazel-bin/packages/core/doc-links/core-doc-links-browser-mocks", @@ -237,13 +238,21 @@ "@kbn/core-preboot-server-mocks": "link:bazel-bin/packages/core/preboot/core-preboot-server-mocks", "@kbn/core-saved-objects-api-browser": "link:bazel-bin/packages/core/saved-objects/core-saved-objects-api-browser", "@kbn/core-saved-objects-api-server": "link:bazel-bin/packages/core/saved-objects/core-saved-objects-api-server", + "@kbn/core-saved-objects-api-server-internal": "link:bazel-bin/packages/core/saved-objects/core-saved-objects-api-server-internal", + "@kbn/core-saved-objects-api-server-mocks": "link:bazel-bin/packages/core/saved-objects/core-saved-objects-api-server-mocks", "@kbn/core-saved-objects-base-server-internal": "link:bazel-bin/packages/core/saved-objects/core-saved-objects-base-server-internal", "@kbn/core-saved-objects-base-server-mocks": "link:bazel-bin/packages/core/saved-objects/core-saved-objects-base-server-mocks", "@kbn/core-saved-objects-browser": "link:bazel-bin/packages/core/saved-objects/core-saved-objects-browser", "@kbn/core-saved-objects-browser-internal": "link:bazel-bin/packages/core/saved-objects/core-saved-objects-browser-internal", "@kbn/core-saved-objects-browser-mocks": "link:bazel-bin/packages/core/saved-objects/core-saved-objects-browser-mocks", "@kbn/core-saved-objects-common": "link:bazel-bin/packages/core/saved-objects/core-saved-objects-common", + "@kbn/core-saved-objects-import-export-server-internal": "link:bazel-bin/packages/core/saved-objects/core-saved-objects-import-export-server-internal", + "@kbn/core-saved-objects-import-export-server-mocks": "link:bazel-bin/packages/core/saved-objects/core-saved-objects-import-export-server-mocks", + "@kbn/core-saved-objects-migration-server-internal": "link:bazel-bin/packages/core/saved-objects/core-saved-objects-migration-server-internal", + "@kbn/core-saved-objects-migration-server-mocks": "link:bazel-bin/packages/core/saved-objects/core-saved-objects-migration-server-mocks", "@kbn/core-saved-objects-server": "link:bazel-bin/packages/core/saved-objects/core-saved-objects-server", + "@kbn/core-saved-objects-server-internal": "link:bazel-bin/packages/core/saved-objects/core-saved-objects-server-internal", + "@kbn/core-saved-objects-server-mocks": "link:bazel-bin/packages/core/saved-objects/core-saved-objects-server-mocks", "@kbn/core-saved-objects-utils-server": "link:bazel-bin/packages/core/saved-objects/core-saved-objects-utils-server", "@kbn/core-test-helpers-deprecations-getters": "link:bazel-bin/packages/core/test-helpers/core-test-helpers-deprecations-getters", "@kbn/core-test-helpers-http-setup-browser": "link:bazel-bin/packages/core/test-helpers/core-test-helpers-http-setup-browser", @@ -254,6 +263,8 @@ "@kbn/core-ui-settings-browser-internal": "link:bazel-bin/packages/core/ui-settings/core-ui-settings-browser-internal", "@kbn/core-ui-settings-browser-mocks": "link:bazel-bin/packages/core/ui-settings/core-ui-settings-browser-mocks", "@kbn/core-ui-settings-common": "link:bazel-bin/packages/core/ui-settings/core-ui-settings-common", + "@kbn/core-usage-data-base-server-internal": "link:bazel-bin/packages/core/usage-data/core-usage-data-base-server-internal", + "@kbn/core-usage-data-server": "link:bazel-bin/packages/core/usage-data/core-usage-data-server", "@kbn/crypto": "link:bazel-bin/packages/kbn-crypto", "@kbn/crypto-browser": "link:bazel-bin/packages/kbn-crypto-browser", "@kbn/datemath": "link:bazel-bin/packages/kbn-datemath", @@ -827,6 +838,7 @@ "@types/kbn__core-deprecations-browser-internal": "link:bazel-bin/packages/core/deprecations/core-deprecations-browser-internal/npm_module_types", "@types/kbn__core-deprecations-browser-mocks": "link:bazel-bin/packages/core/deprecations/core-deprecations-browser-mocks/npm_module_types", "@types/kbn__core-deprecations-common": "link:bazel-bin/packages/core/deprecations/core-deprecations-common/npm_module_types", + "@types/kbn__core-deprecations-server": "link:bazel-bin/packages/core/deprecations/core-deprecations-server/npm_module_types", "@types/kbn__core-doc-links-browser": "link:bazel-bin/packages/core/doc-links/core-doc-links-browser/npm_module_types", "@types/kbn__core-doc-links-browser-internal": "link:bazel-bin/packages/core/doc-links/core-doc-links-browser-internal/npm_module_types", "@types/kbn__core-doc-links-browser-mocks": "link:bazel-bin/packages/core/doc-links/core-doc-links-browser-mocks/npm_module_types", @@ -896,13 +908,21 @@ "@types/kbn__core-public-internal-base": "link:bazel-bin/packages/core/public/internal-base/npm_module_types", "@types/kbn__core-saved-objects-api-browser": "link:bazel-bin/packages/core/saved-objects/core-saved-objects-api-browser/npm_module_types", "@types/kbn__core-saved-objects-api-server": "link:bazel-bin/packages/core/saved-objects/core-saved-objects-api-server/npm_module_types", + "@types/kbn__core-saved-objects-api-server-internal": "link:bazel-bin/packages/core/saved-objects/core-saved-objects-api-server-internal/npm_module_types", + "@types/kbn__core-saved-objects-api-server-mocks": "link:bazel-bin/packages/core/saved-objects/core-saved-objects-api-server-mocks/npm_module_types", "@types/kbn__core-saved-objects-base-server-internal": "link:bazel-bin/packages/core/saved-objects/core-saved-objects-base-server-internal/npm_module_types", "@types/kbn__core-saved-objects-base-server-mocks": "link:bazel-bin/packages/core/saved-objects/core-saved-objects-base-server-mocks/npm_module_types", "@types/kbn__core-saved-objects-browser": "link:bazel-bin/packages/core/saved-objects/core-saved-objects-browser/npm_module_types", "@types/kbn__core-saved-objects-browser-internal": "link:bazel-bin/packages/core/saved-objects/core-saved-objects-browser-internal/npm_module_types", "@types/kbn__core-saved-objects-browser-mocks": "link:bazel-bin/packages/core/saved-objects/core-saved-objects-browser-mocks/npm_module_types", "@types/kbn__core-saved-objects-common": "link:bazel-bin/packages/core/saved-objects/core-saved-objects-common/npm_module_types", + "@types/kbn__core-saved-objects-import-export-server-internal": "link:bazel-bin/packages/core/saved-objects/core-saved-objects-import-export-server-internal/npm_module_types", + "@types/kbn__core-saved-objects-import-export-server-mocks": "link:bazel-bin/packages/core/saved-objects/core-saved-objects-import-export-server-mocks/npm_module_types", + "@types/kbn__core-saved-objects-migration-server-internal": "link:bazel-bin/packages/core/saved-objects/core-saved-objects-migration-server-internal/npm_module_types", + "@types/kbn__core-saved-objects-migration-server-mocks": "link:bazel-bin/packages/core/saved-objects/core-saved-objects-migration-server-mocks/npm_module_types", "@types/kbn__core-saved-objects-server": "link:bazel-bin/packages/core/saved-objects/core-saved-objects-server/npm_module_types", + "@types/kbn__core-saved-objects-server-internal": "link:bazel-bin/packages/core/saved-objects/core-saved-objects-server-internal/npm_module_types", + "@types/kbn__core-saved-objects-server-mocks": "link:bazel-bin/packages/core/saved-objects/core-saved-objects-server-mocks/npm_module_types", "@types/kbn__core-saved-objects-utils-server": "link:bazel-bin/packages/core/saved-objects/core-saved-objects-utils-server/npm_module_types", "@types/kbn__core-server-internal-base": "link:bazel-bin/packages/core/server/internal-base/npm_module_types", "@types/kbn__core-test-helpers-deprecations-getters": "link:bazel-bin/packages/core/test-helpers/core-test-helpers-deprecations-getters/npm_module_types", @@ -914,6 +934,8 @@ "@types/kbn__core-ui-settings-browser-internal": "link:bazel-bin/packages/core/ui-settings/core-ui-settings-browser-internal/npm_module_types", "@types/kbn__core-ui-settings-browser-mocks": "link:bazel-bin/packages/core/ui-settings/core-ui-settings-browser-mocks/npm_module_types", "@types/kbn__core-ui-settings-common": "link:bazel-bin/packages/core/ui-settings/core-ui-settings-common/npm_module_types", + "@types/kbn__core-usage-data-base-server-internal": "link:bazel-bin/packages/core/usage-data/core-usage-data-base-server-internal/npm_module_types", + "@types/kbn__core-usage-data-server": "link:bazel-bin/packages/core/usage-data/core-usage-data-server/npm_module_types", "@types/kbn__crypto": "link:bazel-bin/packages/kbn-crypto/npm_module_types", "@types/kbn__crypto-browser": "link:bazel-bin/packages/kbn-crypto-browser/npm_module_types", "@types/kbn__datemath": "link:bazel-bin/packages/kbn-datemath/npm_module_types", diff --git a/packages/BUILD.bazel b/packages/BUILD.bazel index 812d73e82826f..ee2001f502162 100644 --- a/packages/BUILD.bazel +++ b/packages/BUILD.bazel @@ -35,6 +35,7 @@ filegroup( "//packages/core/deprecations/core-deprecations-browser-internal:build", "//packages/core/deprecations/core-deprecations-browser-mocks:build", "//packages/core/deprecations/core-deprecations-common:build", + "//packages/core/deprecations/core-deprecations-server:build", "//packages/core/doc-links/core-doc-links-browser:build", "//packages/core/doc-links/core-doc-links-browser-internal:build", "//packages/core/doc-links/core-doc-links-browser-mocks:build", @@ -102,13 +103,21 @@ filegroup( "//packages/core/preboot/core-preboot-server-mocks:build", "//packages/core/saved-objects/core-saved-objects-api-browser:build", "//packages/core/saved-objects/core-saved-objects-api-server:build", + "//packages/core/saved-objects/core-saved-objects-api-server-internal:build", + "//packages/core/saved-objects/core-saved-objects-api-server-mocks:build", "//packages/core/saved-objects/core-saved-objects-base-server-internal:build", "//packages/core/saved-objects/core-saved-objects-base-server-mocks:build", "//packages/core/saved-objects/core-saved-objects-browser:build", "//packages/core/saved-objects/core-saved-objects-browser-internal:build", "//packages/core/saved-objects/core-saved-objects-browser-mocks:build", "//packages/core/saved-objects/core-saved-objects-common:build", + "//packages/core/saved-objects/core-saved-objects-import-export-server-internal:build", + "//packages/core/saved-objects/core-saved-objects-import-export-server-mocks:build", + "//packages/core/saved-objects/core-saved-objects-migration-server-internal:build", + "//packages/core/saved-objects/core-saved-objects-migration-server-mocks:build", "//packages/core/saved-objects/core-saved-objects-server:build", + "//packages/core/saved-objects/core-saved-objects-server-internal:build", + "//packages/core/saved-objects/core-saved-objects-server-mocks:build", "//packages/core/saved-objects/core-saved-objects-utils-server:build", "//packages/core/test-helpers/core-test-helpers-deprecations-getters:build", "//packages/core/test-helpers/core-test-helpers-http-setup-browser:build", @@ -119,6 +128,8 @@ filegroup( "//packages/core/ui-settings/core-ui-settings-browser-internal:build", "//packages/core/ui-settings/core-ui-settings-browser-mocks:build", "//packages/core/ui-settings/core-ui-settings-common:build", + "//packages/core/usage-data/core-usage-data-base-server-internal:build", + "//packages/core/usage-data/core-usage-data-server:build", "//packages/home/sample_data_card:build", "//packages/home/sample_data_tab:build", "//packages/home/sample_data_types:build", @@ -311,6 +322,7 @@ filegroup( "//packages/core/deprecations/core-deprecations-browser-internal:build_types", "//packages/core/deprecations/core-deprecations-browser-mocks:build_types", "//packages/core/deprecations/core-deprecations-common:build_types", + "//packages/core/deprecations/core-deprecations-server:build_types", "//packages/core/doc-links/core-doc-links-browser:build_types", "//packages/core/doc-links/core-doc-links-browser-internal:build_types", "//packages/core/doc-links/core-doc-links-browser-mocks:build_types", @@ -378,13 +390,21 @@ filegroup( "//packages/core/preboot/core-preboot-server-mocks:build_types", "//packages/core/saved-objects/core-saved-objects-api-browser:build_types", "//packages/core/saved-objects/core-saved-objects-api-server:build_types", + "//packages/core/saved-objects/core-saved-objects-api-server-internal:build_types", + "//packages/core/saved-objects/core-saved-objects-api-server-mocks:build_types", "//packages/core/saved-objects/core-saved-objects-base-server-internal:build_types", "//packages/core/saved-objects/core-saved-objects-base-server-mocks:build_types", "//packages/core/saved-objects/core-saved-objects-browser:build_types", "//packages/core/saved-objects/core-saved-objects-browser-internal:build_types", "//packages/core/saved-objects/core-saved-objects-browser-mocks:build_types", "//packages/core/saved-objects/core-saved-objects-common:build_types", + "//packages/core/saved-objects/core-saved-objects-import-export-server-internal:build_types", + "//packages/core/saved-objects/core-saved-objects-import-export-server-mocks:build_types", + "//packages/core/saved-objects/core-saved-objects-migration-server-internal:build_types", + "//packages/core/saved-objects/core-saved-objects-migration-server-mocks:build_types", "//packages/core/saved-objects/core-saved-objects-server:build_types", + "//packages/core/saved-objects/core-saved-objects-server-internal:build_types", + "//packages/core/saved-objects/core-saved-objects-server-mocks:build_types", "//packages/core/saved-objects/core-saved-objects-utils-server:build_types", "//packages/core/test-helpers/core-test-helpers-deprecations-getters:build_types", "//packages/core/test-helpers/core-test-helpers-http-setup-browser:build_types", @@ -395,6 +415,8 @@ filegroup( "//packages/core/ui-settings/core-ui-settings-browser-internal:build_types", "//packages/core/ui-settings/core-ui-settings-browser-mocks:build_types", "//packages/core/ui-settings/core-ui-settings-common:build_types", + "//packages/core/usage-data/core-usage-data-base-server-internal:build_types", + "//packages/core/usage-data/core-usage-data-server:build_types", "//packages/home/sample_data_card:build_types", "//packages/home/sample_data_tab:build_types", "//packages/kbn-ace:build_types", diff --git a/packages/core/deprecations/core-deprecations-server/BUILD.bazel b/packages/core/deprecations/core-deprecations-server/BUILD.bazel new file mode 100644 index 0000000000000..4038dda7b56ad --- /dev/null +++ b/packages/core/deprecations/core-deprecations-server/BUILD.bazel @@ -0,0 +1,110 @@ +load("@npm//@bazel/typescript:index.bzl", "ts_config") +load("@build_bazel_rules_nodejs//:index.bzl", "js_library") +load("//src/dev/bazel:index.bzl", "jsts_transpiler", "pkg_npm", "pkg_npm_types", "ts_project") + +PKG_DIRNAME = "core-deprecations-server" +PKG_REQUIRE_NAME = "@kbn/core-deprecations-server" + +SOURCE_FILES = glob( + [ + "**/*.ts", + ], + exclude = [ + "**/*.config.js", + "**/*.mock.*", + "**/*.test.*", + "**/*.stories.*", + "**/__snapshots__", + "**/integration_tests", + "**/mocks", + "**/scripts", + "**/storybook", + "**/test_fixtures", + "**/test_helpers", + ], +) + +SRCS = SOURCE_FILES + +filegroup( + name = "srcs", + srcs = SRCS, +) + +NPM_MODULE_EXTRA_FILES = [ + "package.json", +] + +RUNTIME_DEPS = [ +] + +TYPES_DEPS = [ + "@npm//@types/node", + "@npm//@types/jest", + "//packages/kbn-utility-types:npm_module_types", + "//packages/core/deprecations/core-deprecations-common:npm_module_types", + "//packages/core/elasticsearch/core-elasticsearch-server:npm_module_types", + "//packages/core/saved-objects/core-saved-objects-api-server:npm_module_types", +] + +jsts_transpiler( + name = "target_node", + srcs = SRCS, + build_pkg_name = package_name(), +) + +ts_config( + name = "tsconfig", + src = "tsconfig.json", + deps = [ + "//:tsconfig.base.json", + "//:tsconfig.bazel.json", + ], +) + +ts_project( + name = "tsc_types", + args = ['--pretty'], + srcs = SRCS, + deps = TYPES_DEPS, + declaration = True, + declaration_map = True, + emit_declaration_only = True, + out_dir = "target_types", + root_dir = ".", + tsconfig = ":tsconfig", +) + +js_library( + name = PKG_DIRNAME, + srcs = NPM_MODULE_EXTRA_FILES, + deps = RUNTIME_DEPS + [":target_node"], + package_name = PKG_REQUIRE_NAME, + visibility = ["//visibility:public"], +) + +pkg_npm( + name = "npm_module", + deps = [":" + PKG_DIRNAME], +) + +filegroup( + name = "build", + srcs = [":npm_module"], + visibility = ["//visibility:public"], +) + +pkg_npm_types( + name = "npm_module_types", + srcs = SRCS, + deps = [":tsc_types"], + package_name = PKG_REQUIRE_NAME, + tsconfig = ":tsconfig", + visibility = ["//visibility:public"], +) + +filegroup( + name = "build_types", + srcs = [":npm_module_types"], + visibility = ["//visibility:public"], +) diff --git a/packages/core/deprecations/core-deprecations-server/README.md b/packages/core/deprecations/core-deprecations-server/README.md new file mode 100644 index 0000000000000..ce44c5529f2b2 --- /dev/null +++ b/packages/core/deprecations/core-deprecations-server/README.md @@ -0,0 +1,3 @@ +# @kbn/core-deprecations-server + +This package contains public types for Core's server-side `deprecations` domain. diff --git a/src/core/server/core_usage_data/constants.ts b/packages/core/deprecations/core-deprecations-server/index.ts similarity index 70% rename from src/core/server/core_usage_data/constants.ts rename to packages/core/deprecations/core-deprecations-server/index.ts index 169c7b24e8092..ace64af1dda39 100644 --- a/src/core/server/core_usage_data/constants.ts +++ b/packages/core/deprecations/core-deprecations-server/index.ts @@ -6,8 +6,9 @@ * Side Public License, v 1. */ -/** @internal */ -export const CORE_USAGE_STATS_TYPE = 'core-usage-stats'; - -/** @internal */ -export const CORE_USAGE_STATS_ID = 'core-usage-stats'; +export type { + RegisterDeprecationsConfig, + GetDeprecationsContext, + DeprecationsServiceSetup, + DeprecationRegistryProvider, +} from './src'; diff --git a/packages/core/deprecations/core-deprecations-server/jest.config.js b/packages/core/deprecations/core-deprecations-server/jest.config.js new file mode 100644 index 0000000000000..c2c3456e9279a --- /dev/null +++ b/packages/core/deprecations/core-deprecations-server/jest.config.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 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 or the Server + * Side Public License, v 1. + */ + +module.exports = { + preset: '@kbn/test/jest_node', + rootDir: '../../../..', + roots: ['/packages/core/deprecations/core-deprecations-server'], +}; diff --git a/packages/core/deprecations/core-deprecations-server/package.json b/packages/core/deprecations/core-deprecations-server/package.json new file mode 100644 index 0000000000000..ebd6fb9aeeef9 --- /dev/null +++ b/packages/core/deprecations/core-deprecations-server/package.json @@ -0,0 +1,8 @@ +{ + "name": "@kbn/core-deprecations-server", + "private": true, + "version": "1.0.0", + "main": "./target_node/index.js", + "author": "Kibana Core", + "license": "SSPL-1.0 OR Elastic License 2.0" +} diff --git a/packages/core/deprecations/core-deprecations-server/src/contracts.ts b/packages/core/deprecations/core-deprecations-server/src/contracts.ts new file mode 100644 index 0000000000000..2fbae86399457 --- /dev/null +++ b/packages/core/deprecations/core-deprecations-server/src/contracts.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 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 or the Server + * Side Public License, v 1. + */ + +import type { MaybePromise } from '@kbn/utility-types'; +import type { DeprecationsDetails } from '@kbn/core-deprecations-common'; +import type { IScopedClusterClient } from '@kbn/core-elasticsearch-server'; +import type { SavedObjectsClientContract } from '@kbn/core-saved-objects-api-server'; + +/** + * The deprecations service provides a way for the Kibana platform to communicate deprecated + * features and configs with its users. These deprecations are only communicated + * if the deployment is using these features. Allowing for a user tailored experience + * for upgrading the stack version. + * + * The Deprecation service is consumed by the upgrade assistant to assist with the upgrade + * experience. + * + * If a deprecated feature can be resolved without manual user intervention. + * Using correctiveActions.api allows the Upgrade Assistant to use this api to correct the + * deprecation upon a user trigger. + * + * @example + * ```ts + * import { DeprecationsDetails, GetDeprecationsContext, CoreSetup } from 'src/core/server'; + * import { i18n } from '@kbn/i18n'; + * + * async function getDeprecations({ esClient, savedObjectsClient }: GetDeprecationsContext): Promise { + * const deprecations: DeprecationsDetails[] = []; + * const count = await getFooCount(savedObjectsClient); + * if (count > 0) { + * deprecations.push({ + * title: i18n.translate('xpack.foo.deprecations.title', { + * defaultMessage: `Foo's are deprecated` + * }), + * message: i18n.translate('xpack.foo.deprecations.message', { + * defaultMessage: `You have {count} Foo's. Migrate your Foo's to a dashboard to continue using them.`, + * values: { count }, + * }), + * documentationUrl: + * 'https://www.elastic.co/guide/en/kibana/current/foo.html', + * level: 'warning', + * correctiveActions: { + * manualSteps: [ + * i18n.translate('xpack.foo.deprecations.manualStepOneMessage', { + * defaultMessage: 'Navigate to the Kibana Dashboard and click "Create dashboard".', + * }), + * i18n.translate('xpack.foo.deprecations.manualStepTwoMessage', { + * defaultMessage: 'Select Foo from the "New Visualization" window.', + * }), + * ], + * api: { + * path: '/internal/security/users/test_dashboard_user', + * method: 'POST', + * body: { + * username: 'test_dashboard_user', + * roles: [ + * "machine_learning_user", + * "enrich_user", + * "kibana_admin" + * ], + * full_name: "Alison Goryachev", + * email: "alisongoryachev@gmail.com", + * metadata: {}, + * enabled: true + * } + * }, + * }, + * }); + * } + * return deprecations; + * } + * + * + * export class Plugin() { + * setup: (core: CoreSetup) => { + * core.deprecations.registerDeprecations({ getDeprecations }); + * } + * } + * ``` + * + * @public + */ +export interface DeprecationsServiceSetup { + registerDeprecations: (deprecationContext: RegisterDeprecationsConfig) => void; +} + +/** + * @public + */ +export interface RegisterDeprecationsConfig { + getDeprecations: (context: GetDeprecationsContext) => MaybePromise; +} + +/** + * @public + */ +export interface GetDeprecationsContext { + esClient: IScopedClusterClient; + savedObjectsClient: SavedObjectsClientContract; +} + +/** + * @public + */ +export interface DeprecationRegistryProvider { + getRegistry: (domainId: string) => DeprecationsServiceSetup; +} diff --git a/src/core/server/saved_objects/migrations/index.ts b/packages/core/deprecations/core-deprecations-server/src/index.ts similarity index 66% rename from src/core/server/saved_objects/migrations/index.ts rename to packages/core/deprecations/core-deprecations-server/src/index.ts index 707b777330ec3..9d4a624c2f23a 100644 --- a/src/core/server/saved_objects/migrations/index.ts +++ b/packages/core/deprecations/core-deprecations-server/src/index.ts @@ -6,6 +6,9 @@ * Side Public License, v 1. */ -export type { MigrationResult } from './core'; -export { KibanaMigrator } from './kibana_migrator'; -export type { IKibanaMigrator, KibanaMigratorStatus } from './kibana_migrator'; +export type { + RegisterDeprecationsConfig, + GetDeprecationsContext, + DeprecationsServiceSetup, + DeprecationRegistryProvider, +} from './contracts'; diff --git a/packages/core/deprecations/core-deprecations-server/tsconfig.json b/packages/core/deprecations/core-deprecations-server/tsconfig.json new file mode 100644 index 0000000000000..ff8b3da96b4db --- /dev/null +++ b/packages/core/deprecations/core-deprecations-server/tsconfig.json @@ -0,0 +1,18 @@ +{ + "extends": "../../../../tsconfig.bazel.json", + "compilerOptions": { + "declaration": true, + "declarationMap": true, + "emitDeclarationOnly": true, + "outDir": "target_types", + "rootDir": ".", + "stripInternal": false, + "types": [ + "jest", + "node" + ] + }, + "include": [ + "**/*.ts", + ] +} diff --git a/packages/core/saved-objects/core-saved-objects-api-server-internal/BUILD.bazel b/packages/core/saved-objects/core-saved-objects-api-server-internal/BUILD.bazel new file mode 100644 index 0000000000000..93f8baadd9fee --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-api-server-internal/BUILD.bazel @@ -0,0 +1,132 @@ +load("@npm//@bazel/typescript:index.bzl", "ts_config") +load("@build_bazel_rules_nodejs//:index.bzl", "js_library") +load("//src/dev/bazel:index.bzl", "jsts_transpiler", "pkg_npm", "pkg_npm_types", "ts_project") + +PKG_DIRNAME = "core-saved-objects-api-server-internal" +PKG_REQUIRE_NAME = "@kbn/core-saved-objects-api-server-internal" + +SOURCE_FILES = glob( + [ + "**/*.ts", + ], + exclude = [ + "**/*.config.js", + "**/*.mock.*", + "**/*.test.*", + "**/*.stories.*", + "**/__snapshots__", + "**/integration_tests", + "**/mocks/*", + "**/scripts", + "**/storybook", + "**/test_fixtures", + "**/test_helpers", + ], +) + +SRCS = SOURCE_FILES + +filegroup( + name = "srcs", + srcs = SRCS, +) + +NPM_MODULE_EXTRA_FILES = [ + "package.json", +] + +RUNTIME_DEPS = [ + "@npm//lodash", + "@npm//p-map", + "@npm//@hapi/boom", + "//packages/kbn-config-schema", + "//packages/kbn-es-query", + "//packages/core/elasticsearch/core-elasticsearch-client-server-internal", + "//packages/core/elasticsearch/core-elasticsearch-server-internal", + "//packages/core/usage-data/core-usage-data-base-server-internal", + "//packages/core/saved-objects/core-saved-objects-utils-server", + #### test dependencies + "//packages/core/elasticsearch/core-elasticsearch-client-server-mocks", + "//packages/core/saved-objects/core-saved-objects-base-server-mocks", +] + +TYPES_DEPS = [ + "@npm//@types/node", + "@npm//@types/jest", + "@npm//lodash", + "@npm//p-map", + "@npm//@hapi/boom", + "@npm//@elastic/elasticsearch", + "//packages/kbn-config-schema:npm_module_types", + "//packages/kbn-es-query:npm_module_types", + "//packages/core/elasticsearch/core-elasticsearch-client-server-internal:npm_module_types", + "//packages/core/elasticsearch/core-elasticsearch-server-internal:npm_module_types", + "//packages/core/usage-data/core-usage-data-base-server-internal:npm_module_types", + "//packages/core/saved-objects/core-saved-objects-common:npm_module_types", + "//packages/core/saved-objects/core-saved-objects-base-server-internal:npm_module_types", + "//packages/core/saved-objects/core-saved-objects-api-server:npm_module_types", + "//packages/core/saved-objects/core-saved-objects-server:npm_module_types", + "//packages/core/saved-objects/core-saved-objects-utils-server:npm_module_types", +] + +jsts_transpiler( + name = "target_node", + srcs = SRCS, + build_pkg_name = package_name(), +) + +ts_config( + name = "tsconfig", + src = "tsconfig.json", + deps = [ + "//:tsconfig.base.json", + "//:tsconfig.bazel.json", + ], +) + +ts_project( + name = "tsc_types", + args = ['--pretty'], + srcs = SRCS, + deps = TYPES_DEPS, + declaration = True, + declaration_map = True, + emit_declaration_only = True, + out_dir = "target_types", + root_dir = ".", + tsconfig = ":tsconfig", +) + +js_library( + name = PKG_DIRNAME, + srcs = NPM_MODULE_EXTRA_FILES, + deps = RUNTIME_DEPS + [":target_node"], + package_name = PKG_REQUIRE_NAME, + visibility = ["//visibility:public"], +) + +pkg_npm( + name = "npm_module", + deps = [":" + PKG_DIRNAME], +) + +filegroup( + name = "build", + srcs = [":npm_module"], + visibility = ["//visibility:public"], +) + +pkg_npm_types( + name = "npm_module_types", + srcs = SRCS, + deps = [":tsc_types"], + package_name = PKG_REQUIRE_NAME, + tsconfig = ":tsconfig", + visibility = ["//visibility:public"], +) + +filegroup( + name = "build_types", + srcs = [":npm_module_types"], + visibility = ["//visibility:public"], +) diff --git a/packages/core/saved-objects/core-saved-objects-api-server-internal/README.md b/packages/core/saved-objects/core-saved-objects-api-server-internal/README.md new file mode 100644 index 0000000000000..69dca03cec051 --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-api-server-internal/README.md @@ -0,0 +1,3 @@ +# @kbn/core-saved-objects-api-server-internal + +This package contains the internal implementation of core's server-side savedObjects client and repository. diff --git a/packages/core/saved-objects/core-saved-objects-api-server-internal/index.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/index.ts new file mode 100644 index 0000000000000..73b3bc2777aae --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-api-server-internal/index.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 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 or the Server + * Side Public License, v 1. + */ + +export { + SavedObjectsRepository, + SavedObjectsClient, + SavedObjectsClientProvider, + PointInTimeFinder, +} from './src'; +export type { ISavedObjectsClientProvider } from './src'; diff --git a/packages/core/saved-objects/core-saved-objects-api-server-internal/jest.config.js b/packages/core/saved-objects/core-saved-objects-api-server-internal/jest.config.js new file mode 100644 index 0000000000000..f05cb54c737f7 --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-api-server-internal/jest.config.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 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 or the Server + * Side Public License, v 1. + */ + +module.exports = { + preset: '@kbn/test/jest_node', + rootDir: '../../../..', + roots: ['/packages/core/saved-objects/core-saved-objects-api-server-internal'], +}; diff --git a/packages/core/saved-objects/core-saved-objects-api-server-internal/package.json b/packages/core/saved-objects/core-saved-objects-api-server-internal/package.json new file mode 100644 index 0000000000000..e7f962034bc41 --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-api-server-internal/package.json @@ -0,0 +1,8 @@ +{ + "name": "@kbn/core-saved-objects-api-server-internal", + "private": true, + "version": "1.0.0", + "main": "./target_node/index.js", + "author": "Kibana Core", + "license": "SSPL-1.0 OR Elastic License 2.0" +} diff --git a/src/core/server/saved_objects/service/index.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/index.ts similarity index 73% rename from src/core/server/saved_objects/service/index.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/index.ts index 0737fc725d1a4..38811b1948551 100644 --- a/src/core/server/saved_objects/service/index.ts +++ b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/index.ts @@ -6,6 +6,6 @@ * Side Public License, v 1. */ -export { SavedObjectsClientProvider } from './lib'; -export type { SavedObjectsRepository, ISavedObjectsClientProvider } from './lib'; export { SavedObjectsClient } from './saved_objects_client'; +export { SavedObjectsClientProvider, SavedObjectsRepository, PointInTimeFinder } from './lib'; +export type { ISavedObjectsClientProvider } from './lib'; diff --git a/src/core/server/saved_objects/service/lib/__snapshots__/priority_collection.test.ts.snap b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/__snapshots__/priority_collection.test.ts.snap similarity index 100% rename from src/core/server/saved_objects/service/lib/__snapshots__/priority_collection.test.ts.snap rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/__snapshots__/priority_collection.test.ts.snap diff --git a/src/core/server/saved_objects/service/lib/aggregations/aggs_types/bucket_aggs.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/aggregations/aggs_types/bucket_aggs.ts similarity index 100% rename from src/core/server/saved_objects/service/lib/aggregations/aggs_types/bucket_aggs.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/aggregations/aggs_types/bucket_aggs.ts diff --git a/src/core/server/saved_objects/service/lib/aggregations/aggs_types/common_schemas.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/aggregations/aggs_types/common_schemas.ts similarity index 100% rename from src/core/server/saved_objects/service/lib/aggregations/aggs_types/common_schemas.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/aggregations/aggs_types/common_schemas.ts diff --git a/src/core/server/saved_objects/service/lib/aggregations/aggs_types/index.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/aggregations/aggs_types/index.ts similarity index 100% rename from src/core/server/saved_objects/service/lib/aggregations/aggs_types/index.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/aggregations/aggs_types/index.ts diff --git a/src/core/server/saved_objects/service/lib/aggregations/aggs_types/metrics_aggs.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/aggregations/aggs_types/metrics_aggs.ts similarity index 100% rename from src/core/server/saved_objects/service/lib/aggregations/aggs_types/metrics_aggs.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/aggregations/aggs_types/metrics_aggs.ts diff --git a/src/core/server/saved_objects/service/lib/aggregations/aggs_types/pipeline_aggs.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/aggregations/aggs_types/pipeline_aggs.ts similarity index 100% rename from src/core/server/saved_objects/service/lib/aggregations/aggs_types/pipeline_aggs.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/aggregations/aggs_types/pipeline_aggs.ts diff --git a/src/core/server/saved_objects/service/lib/aggregations/aggs_types/schemas.test.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/aggregations/aggs_types/schemas.test.ts similarity index 100% rename from src/core/server/saved_objects/service/lib/aggregations/aggs_types/schemas.test.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/aggregations/aggs_types/schemas.test.ts diff --git a/src/core/server/saved_objects/service/lib/aggregations/index.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/aggregations/index.ts similarity index 100% rename from src/core/server/saved_objects/service/lib/aggregations/index.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/aggregations/index.ts diff --git a/src/core/server/saved_objects/service/lib/aggregations/validation.test.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/aggregations/validation.test.ts similarity index 100% rename from src/core/server/saved_objects/service/lib/aggregations/validation.test.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/aggregations/validation.test.ts diff --git a/src/core/server/saved_objects/service/lib/aggregations/validation.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/aggregations/validation.ts similarity index 100% rename from src/core/server/saved_objects/service/lib/aggregations/validation.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/aggregations/validation.ts diff --git a/src/core/server/saved_objects/service/lib/aggregations/validation_utils.test.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/aggregations/validation_utils.test.ts similarity index 100% rename from src/core/server/saved_objects/service/lib/aggregations/validation_utils.test.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/aggregations/validation_utils.test.ts diff --git a/src/core/server/saved_objects/service/lib/aggregations/validation_utils.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/aggregations/validation_utils.ts similarity index 100% rename from src/core/server/saved_objects/service/lib/aggregations/validation_utils.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/aggregations/validation_utils.ts diff --git a/src/core/server/saved_objects/service/lib/collect_multi_namespace_references.test.mock.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/collect_multi_namespace_references.test.mock.ts similarity index 100% rename from src/core/server/saved_objects/service/lib/collect_multi_namespace_references.test.mock.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/collect_multi_namespace_references.test.mock.ts diff --git a/src/core/server/saved_objects/service/lib/collect_multi_namespace_references.test.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/collect_multi_namespace_references.test.ts similarity index 100% rename from src/core/server/saved_objects/service/lib/collect_multi_namespace_references.test.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/collect_multi_namespace_references.test.ts diff --git a/src/core/server/saved_objects/service/lib/collect_multi_namespace_references.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/collect_multi_namespace_references.ts similarity index 97% rename from src/core/server/saved_objects/service/lib/collect_multi_namespace_references.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/collect_multi_namespace_references.ts index 222b58d3a03e0..16343ee38c4fd 100644 --- a/src/core/server/saved_objects/service/lib/collect_multi_namespace_references.ts +++ b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/collect_multi_namespace_references.ts @@ -16,15 +16,14 @@ import type { } from '@kbn/core-saved-objects-api-server'; import type { ISavedObjectTypeRegistry } from '@kbn/core-saved-objects-server'; import { SavedObjectsErrorHelpers } from '@kbn/core-saved-objects-utils-server'; -import type { SavedObjectsSerializer } from '@kbn/core-saved-objects-base-server-internal'; -import { findLegacyUrlAliases } from './legacy_url_aliases'; -import { getRootFields } from './included_fields'; import { + type SavedObjectsSerializer, getObjectKey, - getSavedObjectFromSource, parseObjectKey, - rawDocExistsInNamespace, -} from './internal_utils'; +} from '@kbn/core-saved-objects-base-server-internal'; +import { findLegacyUrlAliases } from './legacy_url_aliases'; +import { getRootFields } from './included_fields'; +import { getSavedObjectFromSource, rawDocExistsInNamespace } from './internal_utils'; import type { CreatePointInTimeFinderFn } from './point_in_time_finder'; import type { RepositoryEsClient } from './repository_es_client'; import { findSharedOriginObjects } from './find_shared_origin_objects'; diff --git a/src/core/server/saved_objects/service/lib/decorate_es_error.test.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/decorate_es_error.test.ts similarity index 100% rename from src/core/server/saved_objects/service/lib/decorate_es_error.test.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/decorate_es_error.test.ts diff --git a/src/core/server/saved_objects/service/lib/decorate_es_error.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/decorate_es_error.ts similarity index 100% rename from src/core/server/saved_objects/service/lib/decorate_es_error.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/decorate_es_error.ts diff --git a/src/core/server/saved_objects/service/lib/filter_utils.test.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/filter_utils.test.ts similarity index 100% rename from src/core/server/saved_objects/service/lib/filter_utils.test.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/filter_utils.test.ts diff --git a/src/core/server/saved_objects/service/lib/filter_utils.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/filter_utils.ts similarity index 100% rename from src/core/server/saved_objects/service/lib/filter_utils.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/filter_utils.ts diff --git a/src/core/server/saved_objects/service/lib/find_shared_origin_objects.test.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/find_shared_origin_objects.test.ts similarity index 94% rename from src/core/server/saved_objects/service/lib/find_shared_origin_objects.test.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/find_shared_origin_objects.test.ts index 36501b00294f8..760a33689dbfc 100644 --- a/src/core/server/saved_objects/service/lib/find_shared_origin_objects.test.ts +++ b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/find_shared_origin_objects.test.ts @@ -7,11 +7,8 @@ */ import type { DeeplyMockedKeys } from '@kbn/utility-types-jest'; - -import type { ISavedObjectsRepository } from '@kbn/core-saved-objects-api-server'; import type { CreatePointInTimeFinderFn, PointInTimeFinder } from './point_in_time_finder'; -import { savedObjectsPointInTimeFinderMock } from './point_in_time_finder.mock'; -import { savedObjectsRepositoryMock } from './repository.mock'; +import { savedObjectsPointInTimeFinderMock } from '../mocks/point_in_time_finder.mock'; import { findSharedOriginObjects } from './find_shared_origin_objects'; interface MockFindResultParams { @@ -22,12 +19,15 @@ interface MockFindResultParams { } describe('findSharedOriginObjects', () => { - let savedObjectsMock: jest.Mocked; + let savedObjectsMock: ReturnType; let pointInTimeFinder: DeeplyMockedKeys; let createPointInTimeFinder: jest.MockedFunction; beforeEach(() => { - savedObjectsMock = savedObjectsRepositoryMock.create(); + savedObjectsMock = savedObjectsPointInTimeFinderMock.createClient(); + savedObjectsMock.openPointInTimeForType.mockResolvedValueOnce({ + id: 'abc123', + }); savedObjectsMock.find.mockResolvedValue({ pit_id: 'foo', saved_objects: [], diff --git a/src/core/server/saved_objects/service/lib/find_shared_origin_objects.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/find_shared_origin_objects.ts similarity index 98% rename from src/core/server/saved_objects/service/lib/find_shared_origin_objects.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/find_shared_origin_objects.ts index 34aff0b11d6d0..578cb2fda238d 100644 --- a/src/core/server/saved_objects/service/lib/find_shared_origin_objects.ts +++ b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/find_shared_origin_objects.ts @@ -8,7 +8,7 @@ import * as esKuery from '@kbn/es-query'; import { ALL_NAMESPACES_STRING } from '@kbn/core-saved-objects-utils-server'; -import { getObjectKey } from './internal_utils'; +import { getObjectKey } from '@kbn/core-saved-objects-base-server-internal'; import type { CreatePointInTimeFinderFn } from './point_in_time_finder'; interface ObjectOrigin { diff --git a/src/core/server/saved_objects/service/lib/included_fields.test.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/included_fields.test.ts similarity index 100% rename from src/core/server/saved_objects/service/lib/included_fields.test.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/included_fields.test.ts diff --git a/src/core/server/saved_objects/service/lib/included_fields.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/included_fields.ts similarity index 100% rename from src/core/server/saved_objects/service/lib/included_fields.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/included_fields.ts diff --git a/src/core/server/saved_objects/service/lib/index.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/index.ts similarity index 81% rename from src/core/server/saved_objects/service/lib/index.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/index.ts index a43750608bf95..c53306047c53f 100644 --- a/src/core/server/saved_objects/service/lib/index.ts +++ b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/index.ts @@ -6,9 +6,8 @@ * Side Public License, v 1. */ -export type { SavedObjectsRepository } from './repository'; +export { SavedObjectsRepository } from './repository'; export { SavedObjectsClientProvider } from './scoped_client_provider'; +export { PointInTimeFinder } from './point_in_time_finder'; export type { ISavedObjectsClientProvider } from './scoped_client_provider'; - -export { getIndexForType } from './get_index_for_type'; diff --git a/src/core/server/saved_objects/service/lib/internal_bulk_resolve.test.mock.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/internal_bulk_resolve.test.mock.ts similarity index 100% rename from src/core/server/saved_objects/service/lib/internal_bulk_resolve.test.mock.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/internal_bulk_resolve.test.mock.ts diff --git a/src/core/server/saved_objects/service/lib/internal_bulk_resolve.test.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/internal_bulk_resolve.test.ts similarity index 100% rename from src/core/server/saved_objects/service/lib/internal_bulk_resolve.test.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/internal_bulk_resolve.test.ts diff --git a/src/core/server/saved_objects/service/lib/internal_bulk_resolve.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/internal_bulk_resolve.ts similarity index 99% rename from src/core/server/saved_objects/service/lib/internal_bulk_resolve.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/internal_bulk_resolve.ts index b15fc56e2f3c0..28e22d6e2634c 100644 --- a/src/core/server/saved_objects/service/lib/internal_bulk_resolve.ts +++ b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/internal_bulk_resolve.ts @@ -34,7 +34,7 @@ import { CORE_USAGE_STATS_ID, CORE_USAGE_STATS_TYPE, REPOSITORY_RESOLVE_OUTCOME_STATS, -} from '../../../core_usage_data'; +} from '@kbn/core-usage-data-base-server-internal'; import { getCurrentTime, getSavedObjectFromSource, diff --git a/src/core/server/saved_objects/service/lib/internal_utils.test.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/internal_utils.test.ts similarity index 96% rename from src/core/server/saved_objects/service/lib/internal_utils.test.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/internal_utils.test.ts index 96ca3949a4775..c295c0b3faad8 100644 --- a/src/core/server/saved_objects/service/lib/internal_utils.test.ts +++ b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/internal_utils.test.ts @@ -13,10 +13,8 @@ import { typeRegistryMock } from '@kbn/core-saved-objects-base-server-mocks'; import { getBulkOperationError, getCurrentTime, - getObjectKey, getSavedObjectFromSource, normalizeNamespace, - parseObjectKey, rawDocExistsInNamespace, rawDocExistsInNamespaces, } from './internal_utils'; @@ -361,19 +359,3 @@ describe('#getCurrentTime', () => { expect(getCurrentTime()).toEqual('2021-09-10T21:00:00.000Z'); }); }); - -describe('#getObjectKey', () => { - it('returns the expected key string', () => { - expect(getObjectKey({ type: 'foo', id: 'bar' })).toEqual('foo:bar'); - }); -}); - -describe('#parseObjectKey', () => { - it('returns the expected object', () => { - expect(parseObjectKey('foo:bar')).toEqual({ type: 'foo', id: 'bar' }); - }); - - it('throws error when input is malformed', () => { - expect(() => parseObjectKey('foobar')).toThrowError('Malformed object key'); - }); -}); diff --git a/src/core/server/saved_objects/service/lib/internal_utils.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/internal_utils.ts similarity index 93% rename from src/core/server/saved_objects/service/lib/internal_utils.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/internal_utils.ts index 84539510504a2..cbe209012ff1a 100644 --- a/src/core/server/saved_objects/service/lib/internal_utils.ts +++ b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/internal_utils.ts @@ -254,26 +254,3 @@ export function normalizeNamespace(namespace?: string) { export function getCurrentTime() { return new Date(Date.now()).toISOString(); } - -/** - * Takes an object with a `type` and `id` field and returns a key string. - * - * @internal - */ -export function getObjectKey({ type, id }: { type: string; id: string }) { - return `${type}:${id}`; -} - -/** - * Parses a 'type:id' key string and returns an object with a `type` field and an `id` field. - * - * @internal - */ -export function parseObjectKey(key: string) { - const type = key.slice(0, key.indexOf(':')); - const id = key.slice(type.length + 1); - if (!type || !id) { - throw new Error('Malformed object key (should be "type:id")'); - } - return { type, id }; -} diff --git a/src/core/server/saved_objects/service/lib/legacy_url_aliases/delete_legacy_url_aliases.test.mock.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/legacy_url_aliases/delete_legacy_url_aliases.test.mock.ts similarity index 100% rename from src/core/server/saved_objects/service/lib/legacy_url_aliases/delete_legacy_url_aliases.test.mock.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/legacy_url_aliases/delete_legacy_url_aliases.test.mock.ts diff --git a/src/core/server/saved_objects/service/lib/legacy_url_aliases/delete_legacy_url_aliases.test.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/legacy_url_aliases/delete_legacy_url_aliases.test.ts similarity index 100% rename from src/core/server/saved_objects/service/lib/legacy_url_aliases/delete_legacy_url_aliases.test.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/legacy_url_aliases/delete_legacy_url_aliases.test.ts diff --git a/src/core/server/saved_objects/service/lib/legacy_url_aliases/delete_legacy_url_aliases.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/legacy_url_aliases/delete_legacy_url_aliases.ts similarity index 100% rename from src/core/server/saved_objects/service/lib/legacy_url_aliases/delete_legacy_url_aliases.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/legacy_url_aliases/delete_legacy_url_aliases.ts diff --git a/src/core/server/saved_objects/service/lib/legacy_url_aliases/find_legacy_url_aliases.test.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/legacy_url_aliases/find_legacy_url_aliases.test.ts similarity index 94% rename from src/core/server/saved_objects/service/lib/legacy_url_aliases/find_legacy_url_aliases.test.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/legacy_url_aliases/find_legacy_url_aliases.test.ts index 36435b9828be4..1af8bec312d77 100644 --- a/src/core/server/saved_objects/service/lib/legacy_url_aliases/find_legacy_url_aliases.test.ts +++ b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/legacy_url_aliases/find_legacy_url_aliases.test.ts @@ -8,23 +8,21 @@ import type { DeeplyMockedKeys } from '@kbn/utility-types-jest'; -import type { ISavedObjectsRepository } from '@kbn/core-saved-objects-api-server'; import { type LegacyUrlAlias, LEGACY_URL_ALIAS_TYPE, } from '@kbn/core-saved-objects-base-server-internal'; import type { CreatePointInTimeFinderFn, PointInTimeFinder } from '../point_in_time_finder'; -import { savedObjectsPointInTimeFinderMock } from '../point_in_time_finder.mock'; -import { savedObjectsRepositoryMock } from '../repository.mock'; import { findLegacyUrlAliases } from './find_legacy_url_aliases'; +import { savedObjectsPointInTimeFinderMock } from '../../mocks'; describe('findLegacyUrlAliases', () => { - let savedObjectsMock: jest.Mocked; + let savedObjectsMock: ReturnType; let pointInTimeFinder: DeeplyMockedKeys; let createPointInTimeFinder: jest.MockedFunction; beforeEach(() => { - savedObjectsMock = savedObjectsRepositoryMock.create(); + savedObjectsMock = savedObjectsPointInTimeFinderMock.createClient(); savedObjectsMock.find.mockResolvedValue({ pit_id: 'foo', saved_objects: [], @@ -33,6 +31,9 @@ describe('findLegacyUrlAliases', () => { page: 1, per_page: 100, }); + savedObjectsMock.openPointInTimeForType.mockResolvedValueOnce({ + id: 'abc123', + }); pointInTimeFinder = savedObjectsPointInTimeFinderMock.create({ savedObjectsMock })(); // PIT finder mock uses the actual implementation, but it doesn't need to be created with real params because the SOR is mocked too createPointInTimeFinder = jest.fn().mockReturnValue(pointInTimeFinder); }); diff --git a/src/core/server/saved_objects/service/lib/legacy_url_aliases/find_legacy_url_aliases.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/legacy_url_aliases/find_legacy_url_aliases.ts similarity index 98% rename from src/core/server/saved_objects/service/lib/legacy_url_aliases/find_legacy_url_aliases.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/legacy_url_aliases/find_legacy_url_aliases.ts index 5a90a2e70d073..be87a42de718c 100644 --- a/src/core/server/saved_objects/service/lib/legacy_url_aliases/find_legacy_url_aliases.ts +++ b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/legacy_url_aliases/find_legacy_url_aliases.ts @@ -10,8 +10,8 @@ import * as esKuery from '@kbn/es-query'; import { type LegacyUrlAlias, LEGACY_URL_ALIAS_TYPE, + getObjectKey, } from '@kbn/core-saved-objects-base-server-internal'; -import { getObjectKey } from '../internal_utils'; import type { CreatePointInTimeFinderFn } from '../point_in_time_finder'; interface FindLegacyUrlAliasesObject { diff --git a/src/core/server/saved_objects/service/lib/legacy_url_aliases/index.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/legacy_url_aliases/index.ts similarity index 100% rename from src/core/server/saved_objects/service/lib/legacy_url_aliases/index.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/legacy_url_aliases/index.ts diff --git a/src/core/server/saved_objects/service/lib/point_in_time_finder.test.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/point_in_time_finder.test.ts similarity index 96% rename from src/core/server/saved_objects/service/lib/point_in_time_finder.test.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/point_in_time_finder.test.ts index 29fe08e48b16d..2e31de3b267ef 100644 --- a/src/core/server/saved_objects/service/lib/point_in_time_finder.test.ts +++ b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/point_in_time_finder.test.ts @@ -11,7 +11,7 @@ import type { SavedObjectsFindResult, SavedObjectsCreatePointInTimeFinderOptions, } from '@kbn/core-saved-objects-api-server'; -import { savedObjectsRepositoryMock } from './repository.mock'; +import { savedObjectsPointInTimeFinderMock } from '../mocks'; import { PointInTimeFinder } from './point_in_time_finder'; @@ -42,11 +42,11 @@ const mockHits = [ describe('createPointInTimeFinder()', () => { let logger: MockedLogger; - let repository: ReturnType; + let repository: ReturnType; beforeEach(() => { logger = loggerMock.create(); - repository = savedObjectsRepositoryMock.create(); + repository = savedObjectsPointInTimeFinderMock.createClient(); }); describe('#find', () => { @@ -332,9 +332,13 @@ describe('createPointInTimeFinder()', () => { }); test('finder can be reused after closing', async () => { - repository.openPointInTimeForType.mockResolvedValueOnce({ - id: 'abc123', - }); + repository.openPointInTimeForType + .mockResolvedValueOnce({ + id: 'abc123', + }) + .mockResolvedValueOnce({ + id: 'abc456', + }); repository.find .mockResolvedValueOnce({ total: 2, diff --git a/src/core/server/saved_objects/service/lib/point_in_time_finder.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/point_in_time_finder.ts similarity index 96% rename from src/core/server/saved_objects/service/lib/point_in_time_finder.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/point_in_time_finder.ts index 03249c3e2799a..2245201a634a0 100644 --- a/src/core/server/saved_objects/service/lib/point_in_time_finder.ts +++ b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/point_in_time_finder.ts @@ -10,17 +10,12 @@ import type { Logger } from '@kbn/logging'; import type { SavedObjectsFindOptions, SavedObjectsFindResponse, - SavedObjectsClientContract, SavedObjectsCreatePointInTimeFinderDependencies, SavedObjectsCreatePointInTimeFinderOptions, ISavedObjectsPointInTimeFinder, + SavedObjectsPointInTimeFinderClient, } from '@kbn/core-saved-objects-api-server'; -type PointInTimeFinderClient = Pick< - SavedObjectsClientContract, - 'find' | 'openPointInTimeForType' | 'closePointInTime' ->; - /** * @internal */ @@ -43,7 +38,7 @@ export class PointInTimeFinder implements ISavedObjectsPointInTimeFinder { readonly #log: Logger; - readonly #client: PointInTimeFinderClient; + readonly #client: SavedObjectsPointInTimeFinderClient; readonly #findOptions: SavedObjectsFindOptions; #open: boolean = false; #pitId?: string; diff --git a/src/core/server/saved_objects/service/lib/preflight_check_for_create.test.mock.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/preflight_check_for_create.test.mock.ts similarity index 100% rename from src/core/server/saved_objects/service/lib/preflight_check_for_create.test.mock.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/preflight_check_for_create.test.mock.ts diff --git a/src/core/server/saved_objects/service/lib/preflight_check_for_create.test.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/preflight_check_for_create.test.ts similarity index 100% rename from src/core/server/saved_objects/service/lib/preflight_check_for_create.test.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/preflight_check_for_create.test.ts diff --git a/src/core/server/saved_objects/service/lib/preflight_check_for_create.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/preflight_check_for_create.ts similarity index 99% rename from src/core/server/saved_objects/service/lib/preflight_check_for_create.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/preflight_check_for_create.ts index a3fd4218c3eeb..1d1b4839635e8 100644 --- a/src/core/server/saved_objects/service/lib/preflight_check_for_create.ts +++ b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/preflight_check_for_create.ts @@ -19,12 +19,13 @@ import { } from '@kbn/core-saved-objects-utils-server'; import { LEGACY_URL_ALIAS_TYPE, + getObjectKey, type LegacyUrlAlias, type SavedObjectsSerializer, } from '@kbn/core-saved-objects-base-server-internal'; import { findLegacyUrlAliases } from './legacy_url_aliases'; import { Either, rawDocExistsInNamespaces } from './internal_utils'; -import { getObjectKey, isLeft, isRight } from './internal_utils'; +import { isLeft, isRight } from './internal_utils'; import type { CreatePointInTimeFinderFn } from './point_in_time_finder'; import type { RepositoryEsClient } from './repository_es_client'; diff --git a/src/core/server/saved_objects/service/lib/priority_collection.test.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/priority_collection.test.ts similarity index 100% rename from src/core/server/saved_objects/service/lib/priority_collection.test.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/priority_collection.test.ts diff --git a/src/core/server/saved_objects/service/lib/priority_collection.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/priority_collection.ts similarity index 100% rename from src/core/server/saved_objects/service/lib/priority_collection.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/priority_collection.ts diff --git a/src/core/server/saved_objects/service/lib/repository.test.mock.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/repository.test.mock.ts similarity index 100% rename from src/core/server/saved_objects/service/lib/repository.test.mock.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/repository.test.mock.ts diff --git a/src/core/server/saved_objects/service/lib/repository.test.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/repository.test.ts similarity index 99% rename from src/core/server/saved_objects/service/lib/repository.test.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/repository.test.ts index 30a6b1ab36151..c86945c6acb5c 100644 --- a/src/core/server/saved_objects/service/lib/repository.test.ts +++ b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/repository.test.ts @@ -68,8 +68,7 @@ import { encodeHitVersion, LEGACY_URL_ALIAS_TYPE, } from '@kbn/core-saved-objects-base-server-internal'; -import { DocumentMigrator } from '../../migrations/core/document_migrator'; -import { mockKibanaMigrator } from '../../migrations/kibana_migrator.mock'; +import { kibanaMigratorMock } from '../mocks'; import { elasticsearchClientMock } from '@kbn/core-elasticsearch-client-server-mocks'; import * as esKuery from '@kbn/es-query'; import { errors as EsErrors } from '@elastic/elasticsearch'; @@ -105,7 +104,7 @@ const createUnsupportedTypeError = (type: string) => describe('SavedObjectsRepository', () => { let client: ReturnType; let savedObjectsRepository: SavedObjectsRepository; - let migrator: ReturnType; + let migrator: ReturnType; let logger: ReturnType; let serializer: jest.Mocked; @@ -252,12 +251,6 @@ describe('SavedObjectsRepository', () => { }) ); - const documentMigrator = new DocumentMigrator({ - typeRegistry: registry, - kibanaVersion: KIBANA_VERSION, - log: loggerMock.create(), - }); - const getMockGetResponse = ( { type, @@ -376,9 +369,13 @@ describe('SavedObjectsRepository', () => { beforeEach(() => { pointInTimeFinderMock.mockClear(); client = elasticsearchClientMock.createElasticsearchClient(); - migrator = mockKibanaMigrator.create(); - documentMigrator.prepareMigrations(); - migrator.migrateDocument = jest.fn().mockImplementation(documentMigrator.migrate); + migrator = kibanaMigratorMock.create(); + migrator.migrateDocument.mockImplementation((doc) => ({ + ...doc, + migrationVersion: { [doc.type]: '1.1.1' }, + coreMigrationVersion: KIBANA_VERSION, + })); + migrator.runMigrations = jest.fn().mockResolvedValue([{ status: 'skipped' }]); logger = loggerMock.create(); diff --git a/src/core/server/saved_objects/service/lib/repository.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/repository.ts similarity index 99% rename from src/core/server/saved_objects/service/lib/repository.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/repository.ts index 524fe5f7eb966..961b44a1cd688 100644 --- a/src/core/server/saved_objects/service/lib/repository.ts +++ b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/repository.ts @@ -7,6 +7,7 @@ */ import { omit, isObject } from 'lodash'; +import type { Payload } from '@hapi/boom'; import * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; import * as esKuery from '@kbn/es-query'; import type { Logger } from '@kbn/logging'; @@ -78,13 +79,14 @@ import { encodeHitVersion, getRootPropertiesObjects, LEGACY_URL_ALIAS_TYPE, + getIndexForType, type IndexMapping, + type IKibanaMigrator, } from '@kbn/core-saved-objects-base-server-internal'; import { PointInTimeFinder } from './point_in_time_finder'; import { createRepositoryEsClient, RepositoryEsClient } from './repository_es_client'; import { getSearchDsl } from './search_dsl'; import { includedFields } from './included_fields'; -import { IKibanaMigrator } from '../../migrations'; import { internalBulkResolve, InternalBulkResolveError } from './internal_bulk_resolve'; import { validateConvertFilterToKueryNode } from './filter_utils'; import { validateAndConvertAggregations } from './aggregations'; @@ -102,7 +104,6 @@ import { } from './internal_utils'; import { collectMultiNamespaceReferences } from './collect_multi_namespace_references'; import { updateObjectsSpaces } from './update_objects_spaces'; -import { getIndexForType } from './get_index_for_type'; import { preflightCheckForCreate, PreflightCheckForCreateObject, diff --git a/src/core/server/saved_objects/service/lib/repository_create_repository.test.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/repository_create_repository.test.ts similarity index 90% rename from src/core/server/saved_objects/service/lib/repository_create_repository.test.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/repository_create_repository.test.ts index 9a2d56cdaaa89..564021482714d 100644 --- a/src/core/server/saved_objects/service/lib/repository_create_repository.test.ts +++ b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/repository_create_repository.test.ts @@ -8,8 +8,7 @@ import { SavedObjectTypeRegistry } from '@kbn/core-saved-objects-base-server-internal'; import { SavedObjectsRepository } from './repository'; -import { mockKibanaMigrator } from '../../migrations/kibana_migrator.mock'; -import { KibanaMigrator } from '../../migrations'; +import { kibanaMigratorMock } from '../mocks'; import { loggerMock, MockedLogger } from '@kbn/logging-mocks'; jest.mock('./repository'); @@ -57,7 +56,7 @@ describe('SavedObjectsRepository#createRepository', () => { migrations: {}, }); - const migrator = mockKibanaMigrator.create({ types: typeRegistry.getAllTypes() }); + const migrator = kibanaMigratorMock.create({ types: typeRegistry.getAllTypes() }); const RepositoryConstructor = SavedObjectsRepository as unknown as jest.Mock; @@ -69,7 +68,7 @@ describe('SavedObjectsRepository#createRepository', () => { it('should not allow a repository with an undefined type', () => { try { originalRepository.createRepository( - migrator as unknown as KibanaMigrator, + migrator, typeRegistry, '.kibana-test', callAdminCluster, @@ -85,7 +84,7 @@ describe('SavedObjectsRepository#createRepository', () => { it('should create a repository without hidden types', () => { const repository = originalRepository.createRepository( - migrator as unknown as KibanaMigrator, + migrator, typeRegistry, '.kibana-test', callAdminCluster, @@ -104,7 +103,7 @@ describe('SavedObjectsRepository#createRepository', () => { it('should create a repository with a unique list of hidden types', () => { const repository = originalRepository.createRepository( - migrator as unknown as KibanaMigrator, + migrator, typeRegistry, '.kibana-test', callAdminCluster, diff --git a/src/core/server/saved_objects/service/lib/repository_es_client.test.mock.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/repository_es_client.test.mock.ts similarity index 100% rename from src/core/server/saved_objects/service/lib/repository_es_client.test.mock.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/repository_es_client.test.mock.ts diff --git a/src/core/server/saved_objects/service/lib/repository_es_client.test.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/repository_es_client.test.ts similarity index 100% rename from src/core/server/saved_objects/service/lib/repository_es_client.test.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/repository_es_client.test.ts diff --git a/src/core/server/saved_objects/service/lib/repository_es_client.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/repository_es_client.ts similarity index 100% rename from src/core/server/saved_objects/service/lib/repository_es_client.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/repository_es_client.ts diff --git a/src/core/server/saved_objects/service/lib/scoped_client_provider.test.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/scoped_client_provider.test.ts similarity index 100% rename from src/core/server/saved_objects/service/lib/scoped_client_provider.test.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/scoped_client_provider.test.ts diff --git a/src/core/server/saved_objects/service/lib/scoped_client_provider.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/scoped_client_provider.ts similarity index 100% rename from src/core/server/saved_objects/service/lib/scoped_client_provider.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/scoped_client_provider.ts diff --git a/src/core/server/saved_objects/service/lib/search_dsl/__snapshots__/sorting_params.test.ts.snap b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/search_dsl/__snapshots__/sorting_params.test.ts.snap similarity index 100% rename from src/core/server/saved_objects/service/lib/search_dsl/__snapshots__/sorting_params.test.ts.snap rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/search_dsl/__snapshots__/sorting_params.test.ts.snap diff --git a/src/core/server/saved_objects/service/lib/search_dsl/index.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/search_dsl/index.ts similarity index 100% rename from src/core/server/saved_objects/service/lib/search_dsl/index.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/search_dsl/index.ts diff --git a/src/core/server/saved_objects/service/lib/search_dsl/pit_params.test.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/search_dsl/pit_params.test.ts similarity index 100% rename from src/core/server/saved_objects/service/lib/search_dsl/pit_params.test.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/search_dsl/pit_params.test.ts diff --git a/src/core/server/saved_objects/service/lib/search_dsl/pit_params.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/search_dsl/pit_params.ts similarity index 100% rename from src/core/server/saved_objects/service/lib/search_dsl/pit_params.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/search_dsl/pit_params.ts diff --git a/src/core/server/saved_objects/service/lib/search_dsl/query_params.test.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/search_dsl/query_params.test.ts similarity index 100% rename from src/core/server/saved_objects/service/lib/search_dsl/query_params.test.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/search_dsl/query_params.test.ts diff --git a/src/core/server/saved_objects/service/lib/search_dsl/query_params.tests.mocks.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/search_dsl/query_params.tests.mocks.ts similarity index 100% rename from src/core/server/saved_objects/service/lib/search_dsl/query_params.tests.mocks.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/search_dsl/query_params.tests.mocks.ts diff --git a/src/core/server/saved_objects/service/lib/search_dsl/query_params.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/search_dsl/query_params.ts similarity index 100% rename from src/core/server/saved_objects/service/lib/search_dsl/query_params.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/search_dsl/query_params.ts diff --git a/src/core/server/saved_objects/service/lib/search_dsl/references_filter.test.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/search_dsl/references_filter.test.ts similarity index 100% rename from src/core/server/saved_objects/service/lib/search_dsl/references_filter.test.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/search_dsl/references_filter.test.ts diff --git a/src/core/server/saved_objects/service/lib/search_dsl/references_filter.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/search_dsl/references_filter.ts similarity index 100% rename from src/core/server/saved_objects/service/lib/search_dsl/references_filter.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/search_dsl/references_filter.ts diff --git a/src/core/server/saved_objects/service/lib/search_dsl/search_dsl.test.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/search_dsl/search_dsl.test.ts similarity index 100% rename from src/core/server/saved_objects/service/lib/search_dsl/search_dsl.test.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/search_dsl/search_dsl.test.ts diff --git a/src/core/server/saved_objects/service/lib/search_dsl/search_dsl.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/search_dsl/search_dsl.ts similarity index 100% rename from src/core/server/saved_objects/service/lib/search_dsl/search_dsl.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/search_dsl/search_dsl.ts diff --git a/src/core/server/saved_objects/service/lib/search_dsl/sorting_params.test.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/search_dsl/sorting_params.test.ts similarity index 100% rename from src/core/server/saved_objects/service/lib/search_dsl/sorting_params.test.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/search_dsl/sorting_params.test.ts diff --git a/src/core/server/saved_objects/service/lib/search_dsl/sorting_params.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/search_dsl/sorting_params.ts similarity index 100% rename from src/core/server/saved_objects/service/lib/search_dsl/sorting_params.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/search_dsl/sorting_params.ts diff --git a/src/core/server/saved_objects/service/lib/update_objects_spaces.test.mock.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/update_objects_spaces.test.mock.ts similarity index 100% rename from src/core/server/saved_objects/service/lib/update_objects_spaces.test.mock.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/update_objects_spaces.test.mock.ts diff --git a/src/core/server/saved_objects/service/lib/update_objects_spaces.test.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/update_objects_spaces.test.ts similarity index 100% rename from src/core/server/saved_objects/service/lib/update_objects_spaces.test.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/update_objects_spaces.test.ts diff --git a/src/core/server/saved_objects/service/lib/update_objects_spaces.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/update_objects_spaces.ts similarity index 100% rename from src/core/server/saved_objects/service/lib/update_objects_spaces.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/update_objects_spaces.ts diff --git a/packages/core/saved-objects/core-saved-objects-api-server-internal/src/mocks/index.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/mocks/index.ts new file mode 100644 index 0000000000000..a2d933b58404e --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/mocks/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 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 or the Server + * Side Public License, v 1. + */ + +export { savedObjectsPointInTimeFinderMock } from './point_in_time_finder.mock'; +export { kibanaMigratorMock } from './kibana_migrator.mock'; +export { repositoryMock } from './repository.mock'; diff --git a/packages/core/saved-objects/core-saved-objects-api-server-internal/src/mocks/kibana_migrator.mock.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/mocks/kibana_migrator.mock.ts new file mode 100644 index 0000000000000..e2c7107ca380c --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/mocks/kibana_migrator.mock.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 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 or the Server + * Side Public License, v 1. + */ + +import type { SavedObjectsType } from '@kbn/core-saved-objects-server'; +import type { IKibanaMigrator } from '@kbn/core-saved-objects-base-server-internal'; + +// mock duplicated from `@kbn/core/saved-objects-migration-server-mocks` to avoid cyclic dependencies + +const defaultSavedObjectTypes: SavedObjectsType[] = [ + { + name: 'testtype', + hidden: false, + namespaceType: 'single', + mappings: { + properties: { + name: { type: 'keyword' }, + }, + }, + migrations: () => ({}), + }, +]; + +const createMigratorMock = ( + { + types, + }: { + types: SavedObjectsType[]; + } = { types: defaultSavedObjectTypes } +) => { + const mockMigrator: jest.Mocked = { + kibanaVersion: '8.0.0-testing', + runMigrations: jest.fn(), + getActiveMappings: jest.fn(), + migrateDocument: jest.fn(), + prepareMigrations: jest.fn(), + getStatus$: jest.fn(), + }; + + // mockMigrator.getActiveMappings.mockReturnValue(buildActiveMappings(mergeTypes(types))); + mockMigrator.migrateDocument.mockImplementation((doc) => doc); + return mockMigrator; +}; + +export const kibanaMigratorMock = { + create: createMigratorMock, +}; diff --git a/packages/core/saved-objects/core-saved-objects-api-server-internal/src/mocks/point_in_time_finder.mock.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/mocks/point_in_time_finder.mock.ts new file mode 100644 index 0000000000000..d6b7e51f78bd1 --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/mocks/point_in_time_finder.mock.ts @@ -0,0 +1,59 @@ +/* + * 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 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 or the Server + * Side Public License, v 1. + */ + +import { loggerMock, MockedLogger } from '@kbn/logging-mocks'; +import type { + SavedObjectsClientContract, + ISavedObjectsRepository, + SavedObjectsPointInTimeFinderClient, +} from '@kbn/core-saved-objects-api-server'; +import { PointInTimeFinder } from '../lib/point_in_time_finder'; + +// mock duplicated from `@kbn/core/saved-objects-api-server-mocks` to avoid cyclic dependencies + +const createPointInTimeFinderMock = ({ + logger = loggerMock.create(), + savedObjectsMock, +}: { + logger?: MockedLogger; + savedObjectsMock: jest.Mocked< + ISavedObjectsRepository | SavedObjectsClientContract | SavedObjectsPointInTimeFinderClient + >; +}): jest.Mock => { + const mock = jest.fn(); + + // To simplify testing, we use the actual implementation here, but pass through the + // mocked dependencies. This allows users to set their own `mockResolvedValue` on + // the SO client mock and have it reflected when using `createPointInTimeFinder`. + mock.mockImplementation((findOptions) => { + const finder = new PointInTimeFinder(findOptions, { + logger, + client: savedObjectsMock, + }); + + jest.spyOn(finder, 'find'); + jest.spyOn(finder, 'close'); + + return finder; + }); + + return mock; +}; + +const createPointInTimeFinderClientMock = (): jest.Mocked => { + return { + find: jest.fn(), + openPointInTimeForType: jest.fn(), + closePointInTime: jest.fn(), + }; +}; + +export const savedObjectsPointInTimeFinderMock = { + create: createPointInTimeFinderMock, + createClient: createPointInTimeFinderClientMock, +}; diff --git a/packages/core/saved-objects/core-saved-objects-api-server-internal/src/mocks/repository.mock.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/mocks/repository.mock.ts new file mode 100644 index 0000000000000..2cdfcf1710ad4 --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/mocks/repository.mock.ts @@ -0,0 +1,41 @@ +/* + * 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 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 or the Server + * Side Public License, v 1. + */ + +import type { ISavedObjectsRepository } from '@kbn/core-saved-objects-api-server'; + +// mock duplicated from `@kbn/core/saved-objects-api-server-mocks` to avoid cyclic dependencies + +const createRepositoryMock = () => { + const mock: jest.Mocked = { + checkConflicts: jest.fn(), + create: jest.fn(), + bulkCreate: jest.fn(), + bulkUpdate: jest.fn(), + delete: jest.fn(), + bulkGet: jest.fn(), + find: jest.fn(), + get: jest.fn(), + closePointInTime: jest.fn(), + createPointInTimeFinder: jest.fn(), + openPointInTimeForType: jest.fn().mockResolvedValue({ id: 'some_pit_id' }), + bulkResolve: jest.fn(), + resolve: jest.fn(), + update: jest.fn(), + deleteByNamespace: jest.fn(), + incrementCounter: jest.fn(), + removeReferencesTo: jest.fn(), + collectMultiNamespaceReferences: jest.fn(), + updateObjectsSpaces: jest.fn(), + }; + + return mock; +}; + +export const repositoryMock = { + create: createRepositoryMock, +}; diff --git a/src/core/server/saved_objects/service/saved_objects_client.test.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/saved_objects_client.test.ts similarity index 97% rename from src/core/server/saved_objects/service/saved_objects_client.test.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/saved_objects_client.test.ts index 77afd3f771a12..5829f34a6ba79 100644 --- a/src/core/server/saved_objects/service/saved_objects_client.test.ts +++ b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/saved_objects_client.test.ts @@ -25,14 +25,13 @@ import type { SavedObjectsUpdateObjectsSpacesOptions, } from '@kbn/core-saved-objects-api-server'; import { SavedObjectsClient } from './saved_objects_client'; -import { savedObjectsRepositoryMock } from './lib/repository.mock'; -import { savedObjectsClientMock } from './saved_objects_client.mock'; +import { repositoryMock, savedObjectsPointInTimeFinderMock } from './mocks'; -describe('', () => { - let mockRepository: ReturnType; +describe('SavedObjectsClient', () => { + let mockRepository: ReturnType; beforeEach(() => { - mockRepository = savedObjectsRepositoryMock.create(); + mockRepository = repositoryMock.create(); }); test(`#create`, async () => { @@ -111,7 +110,7 @@ describe('', () => { type: 'foo', }; const dependencies = { - client: savedObjectsClientMock.create(), + client: savedObjectsPointInTimeFinderMock.createClient(), }; const result = client.createPointInTimeFinder(options, dependencies); diff --git a/src/core/server/saved_objects/service/saved_objects_client.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/saved_objects_client.ts similarity index 100% rename from src/core/server/saved_objects/service/saved_objects_client.ts rename to packages/core/saved-objects/core-saved-objects-api-server-internal/src/saved_objects_client.ts diff --git a/packages/core/saved-objects/core-saved-objects-api-server-internal/tsconfig.json b/packages/core/saved-objects/core-saved-objects-api-server-internal/tsconfig.json new file mode 100644 index 0000000000000..ff8b3da96b4db --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-api-server-internal/tsconfig.json @@ -0,0 +1,18 @@ +{ + "extends": "../../../../tsconfig.bazel.json", + "compilerOptions": { + "declaration": true, + "declarationMap": true, + "emitDeclarationOnly": true, + "outDir": "target_types", + "rootDir": ".", + "stripInternal": false, + "types": [ + "jest", + "node" + ] + }, + "include": [ + "**/*.ts", + ] +} diff --git a/packages/core/saved-objects/core-saved-objects-api-server-mocks/BUILD.bazel b/packages/core/saved-objects/core-saved-objects-api-server-mocks/BUILD.bazel new file mode 100644 index 0000000000000..f3bb20f392461 --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-api-server-mocks/BUILD.bazel @@ -0,0 +1,110 @@ +load("@npm//@bazel/typescript:index.bzl", "ts_config") +load("@build_bazel_rules_nodejs//:index.bzl", "js_library") +load("//src/dev/bazel:index.bzl", "jsts_transpiler", "pkg_npm", "pkg_npm_types", "ts_project") + +PKG_DIRNAME = "core-saved-objects-api-server-mocks" +PKG_REQUIRE_NAME = "@kbn/core-saved-objects-api-server-mocks" + +SOURCE_FILES = glob( + [ + "**/*.ts", + ], + exclude = [ + "**/*.config.js", + "**/*.test.*", + "**/*.stories.*", + "**/__snapshots__", + "**/integration_tests", + "**/mocks", + "**/scripts", + "**/storybook", + "**/test_fixtures", + "**/test_helpers", + ], +) + +SRCS = SOURCE_FILES + +filegroup( + name = "srcs", + srcs = SRCS, +) + +NPM_MODULE_EXTRA_FILES = [ + "package.json", +] + +RUNTIME_DEPS = [ + "//packages/core/saved-objects/core-saved-objects-utils-server", + "//packages/core/saved-objects/core-saved-objects-api-server-internal", +] + +TYPES_DEPS = [ + "@npm//@types/node", + "@npm//@types/jest", + "//packages/core/saved-objects/core-saved-objects-api-server:npm_module_types", + "//packages/core/saved-objects/core-saved-objects-api-server-internal:npm_module_types", + "//packages/core/saved-objects/core-saved-objects-utils-server:npm_module_types", +] + +jsts_transpiler( + name = "target_node", + srcs = SRCS, + build_pkg_name = package_name(), +) + +ts_config( + name = "tsconfig", + src = "tsconfig.json", + deps = [ + "//:tsconfig.base.json", + "//:tsconfig.bazel.json", + ], +) + +ts_project( + name = "tsc_types", + args = ['--pretty'], + srcs = SRCS, + deps = TYPES_DEPS, + declaration = True, + declaration_map = True, + emit_declaration_only = True, + out_dir = "target_types", + root_dir = ".", + tsconfig = ":tsconfig", +) + +js_library( + name = PKG_DIRNAME, + srcs = NPM_MODULE_EXTRA_FILES, + deps = RUNTIME_DEPS + [":target_node"], + package_name = PKG_REQUIRE_NAME, + visibility = ["//visibility:public"], +) + +pkg_npm( + name = "npm_module", + deps = [":" + PKG_DIRNAME], +) + +filegroup( + name = "build", + srcs = [":npm_module"], + visibility = ["//visibility:public"], +) + +pkg_npm_types( + name = "npm_module_types", + srcs = SRCS, + deps = [":tsc_types"], + package_name = PKG_REQUIRE_NAME, + tsconfig = ":tsconfig", + visibility = ["//visibility:public"], +) + +filegroup( + name = "build_types", + srcs = [":npm_module_types"], + visibility = ["//visibility:public"], +) diff --git a/packages/core/saved-objects/core-saved-objects-api-server-mocks/README.md b/packages/core/saved-objects/core-saved-objects-api-server-mocks/README.md new file mode 100644 index 0000000000000..f45e68d7fb17e --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-api-server-mocks/README.md @@ -0,0 +1,7 @@ +# @kbn/core-saved-objects-api-server-mocks + +This package contains mocks for core's server-side savedObjects client (and repository) APIs. +- savedObjectsRepositoryMock +- savedObjectsClientMock +- savedObjectsClientProviderMock +- savedObjectsPointInTimeFinderMock diff --git a/src/core/server/saved_objects/deprecations/unknown_object_types.test.mocks.ts b/packages/core/saved-objects/core-saved-objects-api-server-mocks/index.ts similarity index 70% rename from src/core/server/saved_objects/deprecations/unknown_object_types.test.mocks.ts rename to packages/core/saved-objects/core-saved-objects-api-server-mocks/index.ts index 312204ad77846..b558e2d93d6d9 100644 --- a/src/core/server/saved_objects/deprecations/unknown_object_types.test.mocks.ts +++ b/packages/core/saved-objects/core-saved-objects-api-server-mocks/index.ts @@ -6,8 +6,8 @@ * Side Public License, v 1. */ -export const getIndexForTypeMock = jest.fn(); - -jest.doMock('../service/lib/get_index_for_type', () => ({ - getIndexForType: getIndexForTypeMock, -})); +export { + savedObjectsClientMock, + savedObjectsRepositoryMock, + savedObjectsClientProviderMock, +} from './src'; diff --git a/packages/core/saved-objects/core-saved-objects-api-server-mocks/jest.config.js b/packages/core/saved-objects/core-saved-objects-api-server-mocks/jest.config.js new file mode 100644 index 0000000000000..ec56c40550ede --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-api-server-mocks/jest.config.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 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 or the Server + * Side Public License, v 1. + */ + +module.exports = { + preset: '@kbn/test/jest_node', + rootDir: '../../../..', + roots: ['/packages/core/saved-objects/core-saved-objects-api-server-mocks'], +}; diff --git a/packages/core/saved-objects/core-saved-objects-api-server-mocks/package.json b/packages/core/saved-objects/core-saved-objects-api-server-mocks/package.json new file mode 100644 index 0000000000000..59726267976f3 --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-api-server-mocks/package.json @@ -0,0 +1,8 @@ +{ + "name": "@kbn/core-saved-objects-api-server-mocks", + "private": true, + "version": "1.0.0", + "main": "./target_node/index.js", + "author": "Kibana Core", + "license": "SSPL-1.0 OR Elastic License 2.0" +} diff --git a/packages/core/saved-objects/core-saved-objects-api-server-mocks/src/index.ts b/packages/core/saved-objects/core-saved-objects-api-server-mocks/src/index.ts new file mode 100644 index 0000000000000..7dad32d20a57f --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-api-server-mocks/src/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 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 or the Server + * Side Public License, v 1. + */ + +export { savedObjectsClientMock } from './saved_objects_client.mock'; +export { savedObjectsRepositoryMock } from './repository.mock'; +export { savedObjectsClientProviderMock } from './scoped_client_provider.mock'; diff --git a/src/core/server/saved_objects/service/lib/point_in_time_finder.mock.ts b/packages/core/saved-objects/core-saved-objects-api-server-mocks/src/point_in_time_finder.mock.ts similarity index 94% rename from src/core/server/saved_objects/service/lib/point_in_time_finder.mock.ts rename to packages/core/saved-objects/core-saved-objects-api-server-mocks/src/point_in_time_finder.mock.ts index 371c45e90c71c..b14715db34ddd 100644 --- a/src/core/server/saved_objects/service/lib/point_in_time_finder.mock.ts +++ b/packages/core/saved-objects/core-saved-objects-api-server-mocks/src/point_in_time_finder.mock.ts @@ -11,7 +11,7 @@ import type { SavedObjectsClientContract, ISavedObjectsRepository, } from '@kbn/core-saved-objects-api-server'; -import { PointInTimeFinder } from './point_in_time_finder'; +import { PointInTimeFinder } from '@kbn/core-saved-objects-api-server-internal'; const createPointInTimeFinderMock = ({ logger = loggerMock.create(), diff --git a/src/core/server/saved_objects/service/lib/repository.mock.ts b/packages/core/saved-objects/core-saved-objects-api-server-mocks/src/repository.mock.ts similarity index 100% rename from src/core/server/saved_objects/service/lib/repository.mock.ts rename to packages/core/saved-objects/core-saved-objects-api-server-mocks/src/repository.mock.ts diff --git a/src/core/server/saved_objects/service/saved_objects_client.mock.ts b/packages/core/saved-objects/core-saved-objects-api-server-mocks/src/saved_objects_client.mock.ts similarity index 94% rename from src/core/server/saved_objects/service/saved_objects_client.mock.ts rename to packages/core/saved-objects/core-saved-objects-api-server-mocks/src/saved_objects_client.mock.ts index 55a96ea3cecfc..75ee540cb7d8a 100644 --- a/src/core/server/saved_objects/service/saved_objects_client.mock.ts +++ b/packages/core/saved-objects/core-saved-objects-api-server-mocks/src/saved_objects_client.mock.ts @@ -8,7 +8,7 @@ import type { SavedObjectsClientContract } from '@kbn/core-saved-objects-api-server'; import { SavedObjectsErrorHelpers } from '@kbn/core-saved-objects-utils-server'; -import { savedObjectsPointInTimeFinderMock } from './lib/point_in_time_finder.mock'; +import { savedObjectsPointInTimeFinderMock } from './point_in_time_finder.mock'; const create = () => { const mock = { diff --git a/src/core/server/saved_objects/service/lib/scoped_client_provider.mock.ts b/packages/core/saved-objects/core-saved-objects-api-server-mocks/src/scoped_client_provider.mock.ts similarity index 85% rename from src/core/server/saved_objects/service/lib/scoped_client_provider.mock.ts rename to packages/core/saved-objects/core-saved-objects-api-server-mocks/src/scoped_client_provider.mock.ts index 66f1c1ed94829..dd617cdbf3d3c 100644 --- a/src/core/server/saved_objects/service/lib/scoped_client_provider.mock.ts +++ b/packages/core/saved-objects/core-saved-objects-api-server-mocks/src/scoped_client_provider.mock.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { ISavedObjectsClientProvider } from './scoped_client_provider'; +import type { ISavedObjectsClientProvider } from '@kbn/core-saved-objects-api-server-internal'; const create = (): jest.Mocked => ({ addClientWrapperFactory: jest.fn(), diff --git a/packages/core/saved-objects/core-saved-objects-api-server-mocks/tsconfig.json b/packages/core/saved-objects/core-saved-objects-api-server-mocks/tsconfig.json new file mode 100644 index 0000000000000..ff8b3da96b4db --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-api-server-mocks/tsconfig.json @@ -0,0 +1,18 @@ +{ + "extends": "../../../../tsconfig.bazel.json", + "compilerOptions": { + "declaration": true, + "declarationMap": true, + "emitDeclarationOnly": true, + "outDir": "target_types", + "rootDir": ".", + "stripInternal": false, + "types": [ + "jest", + "node" + ] + }, + "include": [ + "**/*.ts", + ] +} diff --git a/packages/core/saved-objects/core-saved-objects-api-server/src/apis/create_point_in_time_finder.ts b/packages/core/saved-objects/core-saved-objects-api-server/src/apis/create_point_in_time_finder.ts index ea7e1f319a582..e46a259dfd4cf 100644 --- a/packages/core/saved-objects/core-saved-objects-api-server/src/apis/create_point_in_time_finder.ts +++ b/packages/core/saved-objects/core-saved-objects-api-server/src/apis/create_point_in_time_finder.ts @@ -17,11 +17,19 @@ export type SavedObjectsCreatePointInTimeFinderOptions = Omit< 'page' | 'pit' | 'searchAfter' >; +/** + * @public + */ +export type SavedObjectsPointInTimeFinderClient = Pick< + SavedObjectsClientContract, + 'find' | 'openPointInTimeForType' | 'closePointInTime' +>; + /** * @public */ export interface SavedObjectsCreatePointInTimeFinderDependencies { - client: Pick; + client: SavedObjectsPointInTimeFinderClient; } /** @public */ diff --git a/packages/core/saved-objects/core-saved-objects-api-server/src/apis/index.ts b/packages/core/saved-objects/core-saved-objects-api-server/src/apis/index.ts index 53457c98f20f6..7dc8e7ab09fc6 100644 --- a/packages/core/saved-objects/core-saved-objects-api-server/src/apis/index.ts +++ b/packages/core/saved-objects/core-saved-objects-api-server/src/apis/index.ts @@ -41,6 +41,7 @@ export type { SavedObjectsCreatePointInTimeFinderOptions, SavedObjectsCreatePointInTimeFinderDependencies, ISavedObjectsPointInTimeFinder, + SavedObjectsPointInTimeFinderClient, } from './create_point_in_time_finder'; export type { SavedObjectsDeleteOptions } from './delete'; export type { SavedObjectsDeleteByNamespaceOptions } from './delete_by_namespace'; diff --git a/packages/core/saved-objects/core-saved-objects-api-server/src/index.ts b/packages/core/saved-objects/core-saved-objects-api-server/src/index.ts index f10ee8e548819..93e35d01a6a3f 100644 --- a/packages/core/saved-objects/core-saved-objects-api-server/src/index.ts +++ b/packages/core/saved-objects/core-saved-objects-api-server/src/index.ts @@ -51,4 +51,5 @@ export type { SavedObjectsClosePointInTimeOptions, SavedObjectsCreatePointInTimeFinderOptions, SavedObjectsFindOptions, + SavedObjectsPointInTimeFinderClient, } from './apis'; diff --git a/packages/core/saved-objects/core-saved-objects-base-server-internal/package.json b/packages/core/saved-objects/core-saved-objects-base-server-internal/package.json index ff4b901f49056..6192262ab0084 100644 --- a/packages/core/saved-objects/core-saved-objects-base-server-internal/package.json +++ b/packages/core/saved-objects/core-saved-objects-base-server-internal/package.json @@ -3,5 +3,6 @@ "private": true, "version": "1.0.0", "main": "./target_node/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/saved-objects/core-saved-objects-base-server-internal/src/index.ts b/packages/core/saved-objects/core-saved-objects-base-server-internal/src/index.ts index 5b504f43244d6..5a4ef1447cd67 100644 --- a/packages/core/saved-objects/core-saved-objects-base-server-internal/src/index.ts +++ b/packages/core/saved-objects/core-saved-objects-base-server-internal/src/index.ts @@ -27,3 +27,10 @@ export { type SavedObjectsMigrationConfigType, } from './saved_objects_config'; export { SavedObjectTypeRegistry } from './saved_objects_type_registry'; +export type { + IKibanaMigrator, + KibanaMigratorStatus, + MigrationResult, + MigrationStatus, +} from './migration'; +export { parseObjectKey, getObjectKey, getIndexForType } from './utils'; diff --git a/packages/core/saved-objects/core-saved-objects-base-server-internal/src/migration/index.ts b/packages/core/saved-objects/core-saved-objects-base-server-internal/src/migration/index.ts new file mode 100644 index 0000000000000..fe33846c41545 --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-base-server-internal/src/migration/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 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 or the Server + * Side Public License, v 1. + */ + +export type { + IKibanaMigrator, + KibanaMigratorStatus, + MigrationStatus, + MigrationResult, +} from './kibana_migrator'; diff --git a/packages/core/saved-objects/core-saved-objects-base-server-internal/src/migration/kibana_migrator.ts b/packages/core/saved-objects/core-saved-objects-base-server-internal/src/migration/kibana_migrator.ts new file mode 100644 index 0000000000000..bb078135c8bcc --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-base-server-internal/src/migration/kibana_migrator.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 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 or the Server + * Side Public License, v 1. + */ + +import { Observable } from 'rxjs'; +import type { SavedObjectUnsanitizedDoc } from '@kbn/core-saved-objects-server'; +import type { IndexMapping } from '../mappings'; + +/** @internal */ +export interface IKibanaMigrator { + readonly kibanaVersion: string; + + /** + * Migrates the mappings and documents in the Kibana index. By default, this will run only + * once and subsequent calls will return the result of the original call. + * + * @param options.rerun - If true, method will run a new migration when called again instead of + * returning the result of the initial migration. This should only be used when factors external + * to Kibana itself alter the kibana index causing the saved objects mappings or data to change + * after the Kibana server performed the initial migration. + * + * @remarks When the `rerun` parameter is set to true, no checks are performed to ensure that no migration + * is currently running. Chained or concurrent calls to `runMigrations({ rerun: true })` can lead to + * multiple migrations running at the same time. When calling with this parameter, it's expected that the calling + * code should ensure that the initial call resolves before calling the function again. + * + * @returns - A promise which resolves once all migrations have been applied. + * The promise resolves with an array of migration statuses, one for each + * elasticsearch index which was migrated. + */ + runMigrations(options?: { rerun?: boolean }): Promise; + + prepareMigrations(): void; + + getStatus$(): Observable; + + /** + * Gets all the index mappings defined by Kibana's enabled plugins. + */ + getActiveMappings(): IndexMapping; + + /** + * Migrates an individual doc to the latest version, as defined by the plugin migrations. + * + * @param doc - The saved object to migrate + * @returns `doc` with all registered migrations applied. + */ + migrateDocument(doc: SavedObjectUnsanitizedDoc): SavedObjectUnsanitizedDoc; +} + +/** @internal */ +export interface KibanaMigratorStatus { + status: MigrationStatus; + result?: MigrationResult[]; + waitingIndex?: string; +} + +/** @internal */ +export type MigrationStatus = + | 'waiting_to_start' + | 'waiting_for_other_nodes' + | 'running' + | 'completed'; + +/** @internal */ +export type MigrationResult = + | { status: 'skipped' } + | { status: 'patched' } + | { + status: 'migrated'; + destIndex: string; + sourceIndex: string; + elapsedMs: number; + }; diff --git a/src/core/server/saved_objects/service/lib/get_index_for_type.test.ts b/packages/core/saved-objects/core-saved-objects-base-server-internal/src/utils/get_index_for_type.test.ts similarity index 100% rename from src/core/server/saved_objects/service/lib/get_index_for_type.test.ts rename to packages/core/saved-objects/core-saved-objects-base-server-internal/src/utils/get_index_for_type.test.ts diff --git a/src/core/server/saved_objects/service/lib/get_index_for_type.ts b/packages/core/saved-objects/core-saved-objects-base-server-internal/src/utils/get_index_for_type.ts similarity index 100% rename from src/core/server/saved_objects/service/lib/get_index_for_type.ts rename to packages/core/saved-objects/core-saved-objects-base-server-internal/src/utils/get_index_for_type.ts diff --git a/packages/core/saved-objects/core-saved-objects-base-server-internal/src/utils/index.ts b/packages/core/saved-objects/core-saved-objects-base-server-internal/src/utils/index.ts new file mode 100644 index 0000000000000..8db62a4c52280 --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-base-server-internal/src/utils/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 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 or the Server + * Side Public License, v 1. + */ + +export { getObjectKey, parseObjectKey } from './object_key'; +export { getIndexForType } from './get_index_for_type'; diff --git a/packages/core/saved-objects/core-saved-objects-base-server-internal/src/utils/object_key.test.ts b/packages/core/saved-objects/core-saved-objects-base-server-internal/src/utils/object_key.test.ts new file mode 100644 index 0000000000000..20ed6a1e0e9d8 --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-base-server-internal/src/utils/object_key.test.ts @@ -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 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 or the Server + * Side Public License, v 1. + */ + +import { parseObjectKey, getObjectKey } from './object_key'; + +describe('#getObjectKey', () => { + it('returns the expected key string', () => { + expect(getObjectKey({ type: 'foo', id: 'bar' })).toEqual('foo:bar'); + }); +}); + +describe('#parseObjectKey', () => { + it('returns the expected object', () => { + expect(parseObjectKey('foo:bar')).toEqual({ type: 'foo', id: 'bar' }); + }); + + it('throws error when input is malformed', () => { + expect(() => parseObjectKey('foobar')).toThrowError('Malformed object key'); + }); +}); diff --git a/packages/core/saved-objects/core-saved-objects-base-server-internal/src/utils/object_key.ts b/packages/core/saved-objects/core-saved-objects-base-server-internal/src/utils/object_key.ts new file mode 100644 index 0000000000000..6698174990bd0 --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-base-server-internal/src/utils/object_key.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 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 or the Server + * Side Public License, v 1. + */ + +/** + * Takes an object with a `type` and `id` field and returns a key string. + * + * @internal + */ +export function getObjectKey({ type, id }: { type: string; id: string }) { + return `${type}:${id}`; +} + +/** + * Parses a 'type:id' key string and returns an object with a `type` field and an `id` field. + * + * @internal + */ +export function parseObjectKey(key: string) { + const type = key.slice(0, key.indexOf(':')); + const id = key.slice(type.length + 1); + if (!type || !id) { + throw new Error('Malformed object key (should be "type:id")'); + } + return { type, id }; +} diff --git a/packages/core/saved-objects/core-saved-objects-base-server-mocks/package.json b/packages/core/saved-objects/core-saved-objects-base-server-mocks/package.json index e119e704c7ace..e6120310e30e7 100644 --- a/packages/core/saved-objects/core-saved-objects-base-server-mocks/package.json +++ b/packages/core/saved-objects/core-saved-objects-base-server-mocks/package.json @@ -3,5 +3,6 @@ "private": true, "version": "1.0.0", "main": "./target_node/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/saved-objects/core-saved-objects-import-export-server-internal/BUILD.bazel b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/BUILD.bazel new file mode 100644 index 0000000000000..6f44087cd02f4 --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/BUILD.bazel @@ -0,0 +1,120 @@ +load("@npm//@bazel/typescript:index.bzl", "ts_config") +load("@build_bazel_rules_nodejs//:index.bzl", "js_library") +load("//src/dev/bazel:index.bzl", "jsts_transpiler", "pkg_npm", "pkg_npm_types", "ts_project") + +PKG_DIRNAME = "core-saved-objects-import-export-server-internal" +PKG_REQUIRE_NAME = "@kbn/core-saved-objects-import-export-server-internal" + +SOURCE_FILES = glob( + [ + "**/*.ts", + ], + exclude = [ + "**/*.config.js", + "**/*.mock.*", + "**/*.test.*", + "**/*.stories.*", + "**/__snapshots__", + "**/integration_tests", + "**/mocks", + "**/scripts", + "**/storybook", + "**/test_fixtures", + "**/test_helpers", + ], +) + +SRCS = SOURCE_FILES + +filegroup( + name = "srcs", + srcs = SRCS, +) + +NPM_MODULE_EXTRA_FILES = [ + "package.json", +] + +RUNTIME_DEPS = [ + "@npm//uuid", + "@npm//p-map", + "//packages/kbn-utils", + ### test dependencies + "//packages/core/saved-objects/core-saved-objects-api-server-mocks", +] + +TYPES_DEPS = [ + "@npm//@types/node", + "@npm//@types/jest", + "@npm//@types/uuid", + "@npm//p-map", + "//packages/kbn-utils:npm_module_types", + "//packages/kbn-logging:npm_module_types", + "//packages/core/http/core-http-server:npm_module_types", + "//packages/core/saved-objects/core-saved-objects-common:npm_module_types", + "//packages/core/saved-objects/core-saved-objects-base-server-internal:npm_module_types", + "//packages/core/saved-objects/core-saved-objects-api-server:npm_module_types", + "//packages/core/saved-objects/core-saved-objects-server:npm_module_types", +] + +jsts_transpiler( + name = "target_node", + srcs = SRCS, + build_pkg_name = package_name(), +) + +ts_config( + name = "tsconfig", + src = "tsconfig.json", + deps = [ + "//:tsconfig.base.json", + "//:tsconfig.bazel.json", + ], +) + +ts_project( + name = "tsc_types", + args = ['--pretty'], + srcs = SRCS, + deps = TYPES_DEPS, + declaration = True, + declaration_map = True, + emit_declaration_only = True, + out_dir = "target_types", + root_dir = ".", + tsconfig = ":tsconfig", +) + +js_library( + name = PKG_DIRNAME, + srcs = NPM_MODULE_EXTRA_FILES, + deps = RUNTIME_DEPS + [":target_node"], + package_name = PKG_REQUIRE_NAME, + visibility = ["//visibility:public"], +) + +pkg_npm( + name = "npm_module", + deps = [":" + PKG_DIRNAME], +) + +filegroup( + name = "build", + srcs = [":npm_module"], + visibility = ["//visibility:public"], +) + +pkg_npm_types( + name = "npm_module_types", + srcs = SRCS, + deps = [":tsc_types"], + package_name = PKG_REQUIRE_NAME, + tsconfig = ":tsconfig", + visibility = ["//visibility:public"], +) + +filegroup( + name = "build_types", + srcs = [":npm_module_types"], + visibility = ["//visibility:public"], +) diff --git a/packages/core/saved-objects/core-saved-objects-import-export-server-internal/README.md b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/README.md new file mode 100644 index 0000000000000..37db6ccbc1f80 --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/README.md @@ -0,0 +1,3 @@ +# @kbn/core-saved-objects-import-export-server-internal + +This package contains the internal implementation of core's server-side savedObjects import/export feature. diff --git a/packages/core/saved-objects/core-saved-objects-import-export-server-internal/index.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/index.ts new file mode 100644 index 0000000000000..498c5ab00d6c9 --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/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 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 or the Server + * Side Public License, v 1. + */ + +export { + SavedObjectsExporter, + SavedObjectsExportError, + SavedObjectsImporter, + SavedObjectsImportError, +} from './src'; diff --git a/packages/core/saved-objects/core-saved-objects-import-export-server-internal/jest.config.js b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/jest.config.js new file mode 100644 index 0000000000000..85d3971fb7ef4 --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/jest.config.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 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 or the Server + * Side Public License, v 1. + */ + +module.exports = { + preset: '@kbn/test/jest_node', + rootDir: '../../../..', + roots: ['/packages/core/saved-objects/core-saved-objects-import-export-server-internal'], +}; diff --git a/packages/core/saved-objects/core-saved-objects-import-export-server-internal/package.json b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/package.json new file mode 100644 index 0000000000000..666eda215a5d7 --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/package.json @@ -0,0 +1,8 @@ +{ + "name": "@kbn/core-saved-objects-import-export-server-internal", + "private": true, + "version": "1.0.0", + "main": "./target_node/index.js", + "author": "Kibana Core", + "license": "SSPL-1.0 OR Elastic License 2.0" +} diff --git a/src/core/server/saved_objects/export/apply_export_transforms.test.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/export/apply_export_transforms.test.ts similarity index 100% rename from src/core/server/saved_objects/export/apply_export_transforms.test.ts rename to packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/export/apply_export_transforms.test.ts diff --git a/src/core/server/saved_objects/export/apply_export_transforms.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/export/apply_export_transforms.ts similarity index 100% rename from src/core/server/saved_objects/export/apply_export_transforms.ts rename to packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/export/apply_export_transforms.ts diff --git a/src/core/server/saved_objects/export/collect_exported_objects.test.mocks.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/export/collect_exported_objects.test.mocks.ts similarity index 100% rename from src/core/server/saved_objects/export/collect_exported_objects.test.mocks.ts rename to packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/export/collect_exported_objects.test.mocks.ts diff --git a/src/core/server/saved_objects/export/collect_exported_objects.test.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/export/collect_exported_objects.test.ts similarity index 99% rename from src/core/server/saved_objects/export/collect_exported_objects.test.ts rename to packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/export/collect_exported_objects.test.ts index 480a80e23cc97..04ea3f984b19b 100644 --- a/src/core/server/saved_objects/export/collect_exported_objects.test.ts +++ b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/export/collect_exported_objects.test.ts @@ -13,7 +13,7 @@ import type { SavedObjectsExportablePredicate, } from '@kbn/core-saved-objects-server'; import { applyExportTransformsMock } from './collect_exported_objects.test.mocks'; -import { savedObjectsClientMock } from '../../mocks'; +import { savedObjectsClientMock } from '@kbn/core-saved-objects-api-server-mocks'; import { loggerMock } from '@kbn/logging-mocks'; import { SavedObjectTypeRegistry } from '@kbn/core-saved-objects-base-server-internal'; import { collectExportedObjects, ExclusionReason } from './collect_exported_objects'; diff --git a/src/core/server/saved_objects/export/collect_exported_objects.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/export/collect_exported_objects.ts similarity index 100% rename from src/core/server/saved_objects/export/collect_exported_objects.ts rename to packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/export/collect_exported_objects.ts diff --git a/src/core/server/saved_objects/export/errors.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/export/errors.ts similarity index 100% rename from src/core/server/saved_objects/export/errors.ts rename to packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/export/errors.ts diff --git a/src/core/server/saved_objects/export/index.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/export/index.ts similarity index 100% rename from src/core/server/saved_objects/export/index.ts rename to packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/export/index.ts diff --git a/src/core/server/saved_objects/export/saved_objects_exporter.test.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/export/saved_objects_exporter.test.ts similarity index 99% rename from src/core/server/saved_objects/export/saved_objects_exporter.test.ts rename to packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/export/saved_objects_exporter.test.ts index 55ee7642388ba..614c9e3680acc 100644 --- a/src/core/server/saved_objects/export/saved_objects_exporter.test.ts +++ b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/export/saved_objects_exporter.test.ts @@ -10,7 +10,7 @@ import { httpServerMock } from '@kbn/core-http-server-mocks'; import type { SavedObject } from '@kbn/core-saved-objects-common'; import { SavedObjectTypeRegistry } from '@kbn/core-saved-objects-base-server-internal'; import { SavedObjectsExporter } from './saved_objects_exporter'; -import { savedObjectsClientMock } from '../service/saved_objects_client.mock'; +import { savedObjectsClientMock } from '@kbn/core-saved-objects-api-server-mocks'; import { loggerMock, MockedLogger } from '@kbn/logging-mocks'; import { Readable } from 'stream'; import { createPromiseFromStreams, createConcatStream } from '@kbn/utils'; diff --git a/src/core/server/saved_objects/export/saved_objects_exporter.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/export/saved_objects_exporter.ts similarity index 100% rename from src/core/server/saved_objects/export/saved_objects_exporter.ts rename to packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/export/saved_objects_exporter.ts diff --git a/src/core/server/saved_objects/export/sort_objects.test.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/export/sort_objects.test.ts similarity index 100% rename from src/core/server/saved_objects/export/sort_objects.test.ts rename to packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/export/sort_objects.test.ts diff --git a/src/core/server/saved_objects/export/sort_objects.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/export/sort_objects.ts similarity index 100% rename from src/core/server/saved_objects/export/sort_objects.ts rename to packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/export/sort_objects.ts diff --git a/src/core/server/saved_objects/export/utils.test.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/export/utils.test.ts similarity index 100% rename from src/core/server/saved_objects/export/utils.test.ts rename to packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/export/utils.test.ts diff --git a/src/core/server/saved_objects/export/utils.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/export/utils.ts similarity index 100% rename from src/core/server/saved_objects/export/utils.ts rename to packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/export/utils.ts diff --git a/src/core/server/saved_objects/import/errors.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/errors.ts similarity index 100% rename from src/core/server/saved_objects/import/errors.ts rename to packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/errors.ts diff --git a/src/core/server/saved_objects/import/import_saved_objects.test.mock.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/import_saved_objects.test.mock.ts similarity index 100% rename from src/core/server/saved_objects/import/import_saved_objects.test.mock.ts rename to packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/import_saved_objects.test.mock.ts diff --git a/src/core/server/saved_objects/import/import_saved_objects.test.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/import_saved_objects.test.ts similarity index 99% rename from src/core/server/saved_objects/import/import_saved_objects.test.ts rename to packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/import_saved_objects.test.ts index 9a086537c4761..b44020e1774be 100644 --- a/src/core/server/saved_objects/import/import_saved_objects.test.ts +++ b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/import_saved_objects.test.ts @@ -31,7 +31,7 @@ import type { SavedObjectsImportHook, } from '@kbn/core-saved-objects-server'; import { typeRegistryMock } from '@kbn/core-saved-objects-base-server-mocks'; -import { savedObjectsClientMock } from '../../mocks'; +import { savedObjectsClientMock } from '@kbn/core-saved-objects-api-server-mocks'; import { importSavedObjectsFromStream, ImportSavedObjectsOptions } from './import_saved_objects'; import type { ImportStateMap } from './lib'; diff --git a/src/core/server/saved_objects/import/import_saved_objects.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/import_saved_objects.ts similarity index 100% rename from src/core/server/saved_objects/import/import_saved_objects.ts rename to packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/import_saved_objects.ts diff --git a/src/core/server/saved_objects/import/index.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/index.ts similarity index 100% rename from src/core/server/saved_objects/import/index.ts rename to packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/index.ts diff --git a/src/core/server/saved_objects/import/lib/check_conflicts.test.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/check_conflicts.test.ts similarity index 98% rename from src/core/server/saved_objects/import/lib/check_conflicts.test.ts rename to packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/check_conflicts.test.ts index 35be4e245086c..8c58af772b882 100644 --- a/src/core/server/saved_objects/import/lib/check_conflicts.test.ts +++ b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/check_conflicts.test.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { savedObjectsClientMock } from '../../../mocks'; +import { savedObjectsClientMock } from '@kbn/core-saved-objects-api-server-mocks'; import type { SavedObject, SavedObjectReference, diff --git a/src/core/server/saved_objects/import/lib/check_conflicts.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/check_conflicts.ts similarity index 100% rename from src/core/server/saved_objects/import/lib/check_conflicts.ts rename to packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/check_conflicts.ts diff --git a/src/core/server/saved_objects/import/lib/check_origin_conflicts.test.mock.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/check_origin_conflicts.test.mock.ts similarity index 100% rename from src/core/server/saved_objects/import/lib/check_origin_conflicts.test.mock.ts rename to packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/check_origin_conflicts.test.mock.ts diff --git a/src/core/server/saved_objects/import/lib/check_origin_conflicts.test.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/check_origin_conflicts.test.ts similarity index 99% rename from src/core/server/saved_objects/import/lib/check_origin_conflicts.test.ts rename to packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/check_origin_conflicts.test.ts index 756214e2ddc03..225db282b31ee 100644 --- a/src/core/server/saved_objects/import/lib/check_origin_conflicts.test.ts +++ b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/check_origin_conflicts.test.ts @@ -17,8 +17,8 @@ import type { import type { SavedObjectsClientContract } from '@kbn/core-saved-objects-api-server'; import type { ISavedObjectTypeRegistry } from '@kbn/core-saved-objects-server'; import { typeRegistryMock } from '@kbn/core-saved-objects-base-server-mocks'; +import { savedObjectsClientMock } from '@kbn/core-saved-objects-api-server-mocks'; import { checkOriginConflicts } from './check_origin_conflicts'; -import { savedObjectsClientMock } from '../../../mocks'; import type { ImportStateMap } from './types'; jest.mock('uuid', () => ({ diff --git a/src/core/server/saved_objects/import/lib/check_origin_conflicts.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/check_origin_conflicts.ts similarity index 99% rename from src/core/server/saved_objects/import/lib/check_origin_conflicts.ts rename to packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/check_origin_conflicts.ts index 852b10c4a9a69..079c5c22191ed 100644 --- a/src/core/server/saved_objects/import/lib/check_origin_conflicts.ts +++ b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/check_origin_conflicts.ts @@ -15,7 +15,7 @@ import type { } from '@kbn/core-saved-objects-common'; import type { SavedObjectsClientContract } from '@kbn/core-saved-objects-api-server'; import type { ISavedObjectTypeRegistry } from '@kbn/core-saved-objects-server'; -import { getObjectKey } from '../../service/lib/internal_utils'; +import { getObjectKey } from '@kbn/core-saved-objects-base-server-internal'; import type { ImportStateMap } from './types'; import { createOriginQuery } from './utils'; diff --git a/src/core/server/saved_objects/import/lib/check_reference_origins.test.mock.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/check_reference_origins.test.mock.ts similarity index 100% rename from src/core/server/saved_objects/import/lib/check_reference_origins.test.mock.ts rename to packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/check_reference_origins.test.mock.ts diff --git a/src/core/server/saved_objects/import/lib/check_reference_origins.test.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/check_reference_origins.test.ts similarity index 98% rename from src/core/server/saved_objects/import/lib/check_reference_origins.test.ts rename to packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/check_reference_origins.test.ts index fce677ec6ea46..37a9aa96dd52f 100644 --- a/src/core/server/saved_objects/import/lib/check_reference_origins.test.ts +++ b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/check_reference_origins.test.ts @@ -14,7 +14,7 @@ import type { } from '@kbn/core-saved-objects-api-server'; import type { ISavedObjectTypeRegistry } from '@kbn/core-saved-objects-server'; import { checkReferenceOrigins, CheckReferenceOriginsParams } from './check_reference_origins'; -import { savedObjectsClientMock } from '../../../mocks'; +import { savedObjectsClientMock } from '@kbn/core-saved-objects-api-server-mocks'; import { typeRegistryMock } from '@kbn/core-saved-objects-base-server-mocks'; import type { ImportStateMap } from './types'; diff --git a/src/core/server/saved_objects/import/lib/check_reference_origins.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/check_reference_origins.ts similarity index 97% rename from src/core/server/saved_objects/import/lib/check_reference_origins.ts rename to packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/check_reference_origins.ts index c1d5da0db430b..65a0f9fd432f2 100644 --- a/src/core/server/saved_objects/import/lib/check_reference_origins.ts +++ b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/check_reference_origins.ts @@ -9,8 +9,8 @@ import pMap from 'p-map'; import type { SavedObjectsClientContract } from '@kbn/core-saved-objects-api-server'; import type { ISavedObjectTypeRegistry } from '@kbn/core-saved-objects-server'; +import { getObjectKey, parseObjectKey } from '@kbn/core-saved-objects-base-server-internal'; import type { ImportStateMap, ImportStateValue } from './types'; -import { getObjectKey, parseObjectKey } from '../../service/lib/internal_utils'; import { createOriginQuery } from './utils'; export interface CheckReferenceOriginsParams { diff --git a/src/core/server/saved_objects/import/lib/collect_saved_objects.test.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/collect_saved_objects.test.ts similarity index 100% rename from src/core/server/saved_objects/import/lib/collect_saved_objects.test.ts rename to packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/collect_saved_objects.test.ts diff --git a/src/core/server/saved_objects/import/lib/collect_saved_objects.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/collect_saved_objects.ts similarity index 100% rename from src/core/server/saved_objects/import/lib/collect_saved_objects.ts rename to packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/collect_saved_objects.ts diff --git a/src/core/server/saved_objects/import/lib/create_limit_stream.test.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/create_limit_stream.test.ts similarity index 100% rename from src/core/server/saved_objects/import/lib/create_limit_stream.test.ts rename to packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/create_limit_stream.test.ts diff --git a/src/core/server/saved_objects/import/lib/create_limit_stream.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/create_limit_stream.ts similarity index 100% rename from src/core/server/saved_objects/import/lib/create_limit_stream.ts rename to packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/create_limit_stream.ts diff --git a/src/core/server/saved_objects/import/lib/create_objects_filter.test.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/create_objects_filter.test.ts similarity index 100% rename from src/core/server/saved_objects/import/lib/create_objects_filter.test.ts rename to packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/create_objects_filter.test.ts diff --git a/src/core/server/saved_objects/import/lib/create_objects_filter.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/create_objects_filter.ts similarity index 100% rename from src/core/server/saved_objects/import/lib/create_objects_filter.ts rename to packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/create_objects_filter.ts diff --git a/src/core/server/saved_objects/import/lib/create_saved_objects.test.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/create_saved_objects.test.ts similarity index 99% rename from src/core/server/saved_objects/import/lib/create_saved_objects.test.ts rename to packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/create_saved_objects.test.ts index 363d2bee5899e..907532bcc8fbb 100644 --- a/src/core/server/saved_objects/import/lib/create_saved_objects.test.ts +++ b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/create_saved_objects.test.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { savedObjectsClientMock } from '../../../mocks'; +import { savedObjectsClientMock } from '@kbn/core-saved-objects-api-server-mocks'; import type { SavedObject, SavedObjectsImportFailure } from '@kbn/core-saved-objects-common'; import { SavedObjectsClientContract } from '@kbn/core-saved-objects-api-server'; import { SavedObjectsErrorHelpers } from '@kbn/core-saved-objects-utils-server'; diff --git a/src/core/server/saved_objects/import/lib/create_saved_objects.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/create_saved_objects.ts similarity index 100% rename from src/core/server/saved_objects/import/lib/create_saved_objects.ts rename to packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/create_saved_objects.ts diff --git a/src/core/server/saved_objects/import/lib/execute_import_hooks.test.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/execute_import_hooks.test.ts similarity index 100% rename from src/core/server/saved_objects/import/lib/execute_import_hooks.test.ts rename to packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/execute_import_hooks.test.ts diff --git a/src/core/server/saved_objects/import/lib/execute_import_hooks.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/execute_import_hooks.ts similarity index 100% rename from src/core/server/saved_objects/import/lib/execute_import_hooks.ts rename to packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/execute_import_hooks.ts diff --git a/src/core/server/saved_objects/import/lib/extract_errors.test.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/extract_errors.test.ts similarity index 100% rename from src/core/server/saved_objects/import/lib/extract_errors.test.ts rename to packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/extract_errors.test.ts diff --git a/src/core/server/saved_objects/import/lib/extract_errors.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/extract_errors.ts similarity index 100% rename from src/core/server/saved_objects/import/lib/extract_errors.ts rename to packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/extract_errors.ts diff --git a/src/core/server/saved_objects/import/lib/get_import_state_map_for_retries.test.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/get_import_state_map_for_retries.test.ts similarity index 100% rename from src/core/server/saved_objects/import/lib/get_import_state_map_for_retries.test.ts rename to packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/get_import_state_map_for_retries.test.ts diff --git a/src/core/server/saved_objects/import/lib/get_import_state_map_for_retries.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/get_import_state_map_for_retries.ts similarity index 100% rename from src/core/server/saved_objects/import/lib/get_import_state_map_for_retries.ts rename to packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/get_import_state_map_for_retries.ts diff --git a/src/core/server/saved_objects/import/lib/get_non_unique_entries.test.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/get_non_unique_entries.test.ts similarity index 100% rename from src/core/server/saved_objects/import/lib/get_non_unique_entries.test.ts rename to packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/get_non_unique_entries.test.ts diff --git a/src/core/server/saved_objects/import/lib/get_non_unique_entries.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/get_non_unique_entries.ts similarity index 100% rename from src/core/server/saved_objects/import/lib/get_non_unique_entries.ts rename to packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/get_non_unique_entries.ts diff --git a/src/core/server/saved_objects/import/lib/index.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/index.ts similarity index 100% rename from src/core/server/saved_objects/import/lib/index.ts rename to packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/index.ts diff --git a/src/core/server/saved_objects/import/lib/regenerate_ids.test.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/regenerate_ids.test.ts similarity index 100% rename from src/core/server/saved_objects/import/lib/regenerate_ids.test.ts rename to packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/regenerate_ids.test.ts diff --git a/src/core/server/saved_objects/import/lib/regenerate_ids.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/regenerate_ids.ts similarity index 100% rename from src/core/server/saved_objects/import/lib/regenerate_ids.ts rename to packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/regenerate_ids.ts diff --git a/src/core/server/saved_objects/import/lib/split_overwrites.test.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/split_overwrites.test.ts similarity index 100% rename from src/core/server/saved_objects/import/lib/split_overwrites.test.ts rename to packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/split_overwrites.test.ts diff --git a/src/core/server/saved_objects/import/lib/split_overwrites.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/split_overwrites.ts similarity index 100% rename from src/core/server/saved_objects/import/lib/split_overwrites.ts rename to packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/split_overwrites.ts diff --git a/src/core/server/saved_objects/import/lib/types.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/types.ts similarity index 100% rename from src/core/server/saved_objects/import/lib/types.ts rename to packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/types.ts diff --git a/src/core/server/saved_objects/import/lib/utils.test.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/utils.test.ts similarity index 100% rename from src/core/server/saved_objects/import/lib/utils.test.ts rename to packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/utils.test.ts diff --git a/src/core/server/saved_objects/import/lib/utils.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/utils.ts similarity index 100% rename from src/core/server/saved_objects/import/lib/utils.ts rename to packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/utils.ts diff --git a/src/core/server/saved_objects/import/lib/validate_references.test.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/validate_references.test.ts similarity index 99% rename from src/core/server/saved_objects/import/lib/validate_references.test.ts rename to packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/validate_references.test.ts index 2a8095ef78ce8..ceced695b2870 100644 --- a/src/core/server/saved_objects/import/lib/validate_references.test.ts +++ b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/validate_references.test.ts @@ -9,7 +9,7 @@ import { SavedObjectsErrorHelpers } from '@kbn/core-saved-objects-utils-server'; import type { ValidateReferencesParams } from './validate_references'; import { validateReferences } from './validate_references'; -import { savedObjectsClientMock } from '../../../mocks'; +import { savedObjectsClientMock } from '@kbn/core-saved-objects-api-server-mocks'; function setup({ objects = [], diff --git a/src/core/server/saved_objects/import/lib/validate_references.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/validate_references.ts similarity index 100% rename from src/core/server/saved_objects/import/lib/validate_references.ts rename to packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/validate_references.ts diff --git a/src/core/server/saved_objects/import/lib/validate_retries.test.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/validate_retries.test.ts similarity index 100% rename from src/core/server/saved_objects/import/lib/validate_retries.test.ts rename to packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/validate_retries.test.ts diff --git a/src/core/server/saved_objects/import/lib/validate_retries.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/validate_retries.ts similarity index 100% rename from src/core/server/saved_objects/import/lib/validate_retries.ts rename to packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/validate_retries.ts diff --git a/src/core/server/saved_objects/import/resolve_import_errors.test.mock.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/resolve_import_errors.test.mock.ts similarity index 100% rename from src/core/server/saved_objects/import/resolve_import_errors.test.mock.ts rename to packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/resolve_import_errors.test.mock.ts diff --git a/src/core/server/saved_objects/import/resolve_import_errors.test.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/resolve_import_errors.test.ts similarity index 99% rename from src/core/server/saved_objects/import/resolve_import_errors.test.ts rename to packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/resolve_import_errors.test.ts index 288e58aabb4c2..ed93301a45813 100644 --- a/src/core/server/saved_objects/import/resolve_import_errors.test.ts +++ b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/resolve_import_errors.test.ts @@ -37,7 +37,7 @@ import type { SavedObjectsImportHook, } from '@kbn/core-saved-objects-server'; import { typeRegistryMock } from '@kbn/core-saved-objects-base-server-mocks'; -import { savedObjectsClientMock } from '../../mocks'; +import { savedObjectsClientMock } from '@kbn/core-saved-objects-api-server-mocks'; import { resolveSavedObjectsImportErrors, ResolveSavedObjectsImportErrorsOptions, diff --git a/src/core/server/saved_objects/import/resolve_import_errors.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/resolve_import_errors.ts similarity index 100% rename from src/core/server/saved_objects/import/resolve_import_errors.ts rename to packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/resolve_import_errors.ts diff --git a/src/core/server/saved_objects/import/saved_objects_importer.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/saved_objects_importer.ts similarity index 100% rename from src/core/server/saved_objects/import/saved_objects_importer.ts rename to packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/saved_objects_importer.ts diff --git a/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/index.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/index.ts new file mode 100644 index 0000000000000..8f22bad9f10f6 --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/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 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 or the Server + * Side Public License, v 1. + */ + +export { SavedObjectsImporter, SavedObjectsImportError } from './import'; +export { SavedObjectsExporter, SavedObjectsExportError } from './export'; diff --git a/packages/core/saved-objects/core-saved-objects-import-export-server-internal/tsconfig.json b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/tsconfig.json new file mode 100644 index 0000000000000..ff8b3da96b4db --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/tsconfig.json @@ -0,0 +1,18 @@ +{ + "extends": "../../../../tsconfig.bazel.json", + "compilerOptions": { + "declaration": true, + "declarationMap": true, + "emitDeclarationOnly": true, + "outDir": "target_types", + "rootDir": ".", + "stripInternal": false, + "types": [ + "jest", + "node" + ] + }, + "include": [ + "**/*.ts", + ] +} diff --git a/packages/core/saved-objects/core-saved-objects-import-export-server-mocks/BUILD.bazel b/packages/core/saved-objects/core-saved-objects-import-export-server-mocks/BUILD.bazel new file mode 100644 index 0000000000000..1eba980837e31 --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-import-export-server-mocks/BUILD.bazel @@ -0,0 +1,106 @@ +load("@npm//@bazel/typescript:index.bzl", "ts_config") +load("@build_bazel_rules_nodejs//:index.bzl", "js_library") +load("//src/dev/bazel:index.bzl", "jsts_transpiler", "pkg_npm", "pkg_npm_types", "ts_project") + +PKG_DIRNAME = "core-saved-objects-import-export-server-mocks" +PKG_REQUIRE_NAME = "@kbn/core-saved-objects-import-export-server-mocks" + +SOURCE_FILES = glob( + [ + "**/*.ts", + ], + exclude = [ + "**/*.config.js", + "**/*.test.*", + "**/*.stories.*", + "**/__snapshots__", + "**/integration_tests", + "**/mocks", + "**/scripts", + "**/storybook", + "**/test_fixtures", + "**/test_helpers", + ], +) + +SRCS = SOURCE_FILES + +filegroup( + name = "srcs", + srcs = SRCS, +) + +NPM_MODULE_EXTRA_FILES = [ + "package.json", +] + +RUNTIME_DEPS = [ +] + +TYPES_DEPS = [ + "@npm//@types/node", + "@npm//@types/jest", + "//packages/core/saved-objects/core-saved-objects-server:npm_module_types", +] + +jsts_transpiler( + name = "target_node", + srcs = SRCS, + build_pkg_name = package_name(), +) + +ts_config( + name = "tsconfig", + src = "tsconfig.json", + deps = [ + "//:tsconfig.base.json", + "//:tsconfig.bazel.json", + ], +) + +ts_project( + name = "tsc_types", + args = ['--pretty'], + srcs = SRCS, + deps = TYPES_DEPS, + declaration = True, + declaration_map = True, + emit_declaration_only = True, + out_dir = "target_types", + root_dir = ".", + tsconfig = ":tsconfig", +) + +js_library( + name = PKG_DIRNAME, + srcs = NPM_MODULE_EXTRA_FILES, + deps = RUNTIME_DEPS + [":target_node"], + package_name = PKG_REQUIRE_NAME, + visibility = ["//visibility:public"], +) + +pkg_npm( + name = "npm_module", + deps = [":" + PKG_DIRNAME], +) + +filegroup( + name = "build", + srcs = [":npm_module"], + visibility = ["//visibility:public"], +) + +pkg_npm_types( + name = "npm_module_types", + srcs = SRCS, + deps = [":tsc_types"], + package_name = PKG_REQUIRE_NAME, + tsconfig = ":tsconfig", + visibility = ["//visibility:public"], +) + +filegroup( + name = "build_types", + srcs = [":npm_module_types"], + visibility = ["//visibility:public"], +) diff --git a/packages/core/saved-objects/core-saved-objects-import-export-server-mocks/README.md b/packages/core/saved-objects/core-saved-objects-import-export-server-mocks/README.md new file mode 100644 index 0000000000000..3646f0bf25985 --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-import-export-server-mocks/README.md @@ -0,0 +1,5 @@ +# @kbn/core-saved-objects-import-export-server-mocks + +This package contains the mocks for core's server-side savedObjects import/export feature. +- savedObjectsExporterMock +- savedObjectsImporterMock \ No newline at end of file diff --git a/packages/core/saved-objects/core-saved-objects-import-export-server-mocks/index.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-mocks/index.ts new file mode 100644 index 0000000000000..2c3d48d7f0c7a --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-import-export-server-mocks/index.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 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 or the Server + * Side Public License, v 1. + */ + +export { savedObjectsExporterMock, savedObjectsImporterMock } from './src'; diff --git a/packages/core/saved-objects/core-saved-objects-import-export-server-mocks/jest.config.js b/packages/core/saved-objects/core-saved-objects-import-export-server-mocks/jest.config.js new file mode 100644 index 0000000000000..07df0b670a66f --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-import-export-server-mocks/jest.config.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 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 or the Server + * Side Public License, v 1. + */ + +module.exports = { + preset: '@kbn/test/jest_node', + rootDir: '../../../..', + roots: ['/packages/core/saved-objects/core-saved-objects-import-export-server-mocks'], +}; diff --git a/packages/core/saved-objects/core-saved-objects-import-export-server-mocks/package.json b/packages/core/saved-objects/core-saved-objects-import-export-server-mocks/package.json new file mode 100644 index 0000000000000..e043ddc547020 --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-import-export-server-mocks/package.json @@ -0,0 +1,8 @@ +{ + "name": "@kbn/core-saved-objects-import-export-server-mocks", + "private": true, + "version": "1.0.0", + "main": "./target_node/index.js", + "author": "Kibana Core", + "license": "SSPL-1.0 OR Elastic License 2.0" +} diff --git a/packages/core/saved-objects/core-saved-objects-import-export-server-mocks/src/index.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-mocks/src/index.ts new file mode 100644 index 0000000000000..6893dccdebbc0 --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-import-export-server-mocks/src/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 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 or the Server + * Side Public License, v 1. + */ + +export { savedObjectsImporterMock } from './saved_objects_importer.mock'; +export { savedObjectsExporterMock } from './saved_objects_exporter.mock'; diff --git a/src/core/server/saved_objects/export/saved_objects_exporter.mock.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-mocks/src/saved_objects_exporter.mock.ts similarity index 100% rename from src/core/server/saved_objects/export/saved_objects_exporter.mock.ts rename to packages/core/saved-objects/core-saved-objects-import-export-server-mocks/src/saved_objects_exporter.mock.ts diff --git a/src/core/server/saved_objects/import/saved_objects_importer.mock.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-mocks/src/saved_objects_importer.mock.ts similarity index 100% rename from src/core/server/saved_objects/import/saved_objects_importer.mock.ts rename to packages/core/saved-objects/core-saved-objects-import-export-server-mocks/src/saved_objects_importer.mock.ts diff --git a/packages/core/saved-objects/core-saved-objects-import-export-server-mocks/tsconfig.json b/packages/core/saved-objects/core-saved-objects-import-export-server-mocks/tsconfig.json new file mode 100644 index 0000000000000..ff8b3da96b4db --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-import-export-server-mocks/tsconfig.json @@ -0,0 +1,18 @@ +{ + "extends": "../../../../tsconfig.bazel.json", + "compilerOptions": { + "declaration": true, + "declarationMap": true, + "emitDeclarationOnly": true, + "outDir": "target_types", + "rootDir": ".", + "stripInternal": false, + "types": [ + "jest", + "node" + ] + }, + "include": [ + "**/*.ts", + ] +} diff --git a/packages/core/saved-objects/core-saved-objects-migration-server-internal/BUILD.bazel b/packages/core/saved-objects/core-saved-objects-migration-server-internal/BUILD.bazel new file mode 100644 index 0000000000000..cb6e6dde51a28 --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-migration-server-internal/BUILD.bazel @@ -0,0 +1,134 @@ +load("@npm//@bazel/typescript:index.bzl", "ts_config") +load("@build_bazel_rules_nodejs//:index.bzl", "js_library") +load("//src/dev/bazel:index.bzl", "jsts_transpiler", "pkg_npm", "pkg_npm_types", "ts_project") + +PKG_DIRNAME = "core-saved-objects-migration-server-internal" +PKG_REQUIRE_NAME = "@kbn/core-saved-objects-migration-server-internal" + +SOURCE_FILES = glob( + [ + "**/*.ts", + ], + exclude = [ + "**/*.config.js", + "**/*.mock.*", + "**/*.test.*", + "**/*.stories.*", + "**/__snapshots__", + "**/integration_tests", + "**/mocks", + "**/scripts", + "**/storybook", + "**/test_fixtures", + "**/test_helpers", + ], +) + +SRCS = SOURCE_FILES + +filegroup( + name = "srcs", + srcs = SRCS, +) + +NPM_MODULE_EXTRA_FILES = [ + "package.json", +] + +RUNTIME_DEPS = [ + "@npm//uuid", + "@npm//semver", + "@npm//fp-ts", + "@npm//lodash", + "@npm//@hapi/boom", + "@npm//@elastic/elasticsearch", + "//packages/kbn-std", + "//packages/core/elasticsearch/core-elasticsearch-client-server-internal", + ### test dependencies + "//packages/core/elasticsearch/core-elasticsearch-server-mocks", + "//packages/core/elasticsearch/core-elasticsearch-client-server-mocks", + "//packages/core/logging/core-logging-server-mocks", + +] + +TYPES_DEPS = [ + "@npm//@types/node", + "@npm//@types/jest", + "@npm//@types/uuid", + "@npm//@types/semver", + "@npm//fp-ts", + "@npm//lodash", + "@npm//@hapi/boom", + "@npm//@elastic/elasticsearch", + "//packages/kbn-logging:npm_module_types", + "//packages/kbn-std:npm_module_types", + "//packages/core/doc-links/core-doc-links-server:npm_module_types", + "//packages/core/elasticsearch/core-elasticsearch-server:npm_module_types", + "//packages/core/elasticsearch/core-elasticsearch-client-server-internal:npm_module_types", + "//packages/core/saved-objects/core-saved-objects-common:npm_module_types", + "//packages/core/saved-objects/core-saved-objects-server:npm_module_types", + "//packages/core/saved-objects/core-saved-objects-utils-server:npm_module_types", + "//packages/core/saved-objects/core-saved-objects-base-server-internal:npm_module_types", +] + +jsts_transpiler( + name = "target_node", + srcs = SRCS, + build_pkg_name = package_name(), +) + +ts_config( + name = "tsconfig", + src = "tsconfig.json", + deps = [ + "//:tsconfig.base.json", + "//:tsconfig.bazel.json", + ], +) + +ts_project( + name = "tsc_types", + args = ['--pretty'], + srcs = SRCS, + deps = TYPES_DEPS, + declaration = True, + declaration_map = True, + emit_declaration_only = True, + out_dir = "target_types", + root_dir = ".", + tsconfig = ":tsconfig", +) + +js_library( + name = PKG_DIRNAME, + srcs = NPM_MODULE_EXTRA_FILES, + deps = RUNTIME_DEPS + [":target_node"], + package_name = PKG_REQUIRE_NAME, + visibility = ["//visibility:public"], +) + +pkg_npm( + name = "npm_module", + deps = [":" + PKG_DIRNAME], +) + +filegroup( + name = "build", + srcs = [":npm_module"], + visibility = ["//visibility:public"], +) + +pkg_npm_types( + name = "npm_module_types", + srcs = SRCS, + deps = [":tsc_types"], + package_name = PKG_REQUIRE_NAME, + tsconfig = ":tsconfig", + visibility = ["//visibility:public"], +) + +filegroup( + name = "build_types", + srcs = [":npm_module_types"], + visibility = ["//visibility:public"], +) diff --git a/packages/core/saved-objects/core-saved-objects-migration-server-internal/README.md b/packages/core/saved-objects/core-saved-objects-migration-server-internal/README.md new file mode 100644 index 0000000000000..dfd470d12207a --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-migration-server-internal/README.md @@ -0,0 +1,3 @@ +# @kbn/core-saved-objects-migration-server-internal + +This package contains the internal implementation of core's server-side savedObjects migration feature. diff --git a/packages/core/saved-objects/core-saved-objects-migration-server-internal/index.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/index.ts new file mode 100644 index 0000000000000..cedd5dc369826 --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-migration-server-internal/index.ts @@ -0,0 +1,60 @@ +/* + * 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 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 or the Server + * Side Public License, v 1. + */ + +export { KibanaMigrator, buildActiveMappings, mergeTypes } from './src'; +export type { KibanaMigratorOptions } from './src'; +export { getAggregatedTypesDocuments } from './src/actions/check_for_unknown_docs'; +export { addExcludedTypesToBoolQuery } from './src/model/helpers'; + +// these are only used for integration tests +export { + bulkOverwriteTransformedDocuments, + closePit, + createIndex, + openPit, + calculateExcludeFilters, + checkForUnknownDocs, + waitForIndexStatus, + initAction, + cloneIndex, + waitForTask, + updateAndPickupMappings, + updateAliases, + transformDocs, + setWriteBlock, + searchForOutdatedDocuments, + removeWriteBlock, + reindex, + readWithPit, + refreshIndex, + pickupUpdatedMappings, + fetchIndices, + waitForReindexTask, + waitForPickupUpdatedMappingsTask, +} from './src/actions'; +export type { + OpenPitResponse, + ReadWithPit, + SearchResponse, + ReindexResponse, + UpdateByQueryResponse, + UpdateAndPickupMappingsResponse, +} from './src/actions'; +export { + isClusterShardLimitExceeded, + isIncompatibleMappingException, + isWriteBlockException, + isIndexNotFoundException, +} from './src/actions/es_errors'; +export { deterministicallyRegenerateObjectId } from './src/core/document_migrator'; +export { + REMOVED_TYPES, + type DocumentsTransformFailed, + type DocumentsTransformSuccess, +} from './src/core'; +export { MIGRATION_CLIENT_OPTIONS } from './src/run_resilient_migrator'; diff --git a/packages/core/saved-objects/core-saved-objects-migration-server-internal/jest.config.js b/packages/core/saved-objects/core-saved-objects-migration-server-internal/jest.config.js new file mode 100644 index 0000000000000..2add8c2ce1947 --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-migration-server-internal/jest.config.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 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 or the Server + * Side Public License, v 1. + */ + +module.exports = { + preset: '@kbn/test/jest_node', + rootDir: '../../../..', + roots: ['/packages/core/saved-objects/core-saved-objects-migration-server-internal'], +}; diff --git a/packages/core/saved-objects/core-saved-objects-migration-server-internal/package.json b/packages/core/saved-objects/core-saved-objects-migration-server-internal/package.json new file mode 100644 index 0000000000000..d6f11a4e41824 --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-migration-server-internal/package.json @@ -0,0 +1,8 @@ +{ + "name": "@kbn/core-saved-objects-migration-server-internal", + "private": true, + "version": "1.0.0", + "main": "./target_node/index.js", + "author": "Kibana Core", + "license": "SSPL-1.0 OR Elastic License 2.0" +} diff --git a/src/core/server/saved_objects/migrations/README.md b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/README.md similarity index 100% rename from src/core/server/saved_objects/migrations/README.md rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/README.md diff --git a/src/core/server/saved_objects/migrations/__snapshots__/kibana_migrator.test.ts.snap b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/__snapshots__/kibana_migrator.test.ts.snap similarity index 100% rename from src/core/server/saved_objects/migrations/__snapshots__/kibana_migrator.test.ts.snap rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/__snapshots__/kibana_migrator.test.ts.snap diff --git a/src/core/server/saved_objects/migrations/__snapshots__/migrations_state_action_machine.test.ts.snap b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/__snapshots__/migrations_state_action_machine.test.ts.snap similarity index 100% rename from src/core/server/saved_objects/migrations/__snapshots__/migrations_state_action_machine.test.ts.snap rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/__snapshots__/migrations_state_action_machine.test.ts.snap diff --git a/src/core/server/saved_objects/migrations/actions/bulk_overwrite_transformed_documents.test.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/bulk_overwrite_transformed_documents.test.ts similarity index 100% rename from src/core/server/saved_objects/migrations/actions/bulk_overwrite_transformed_documents.test.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/bulk_overwrite_transformed_documents.test.ts diff --git a/src/core/server/saved_objects/migrations/actions/bulk_overwrite_transformed_documents.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/bulk_overwrite_transformed_documents.ts similarity index 100% rename from src/core/server/saved_objects/migrations/actions/bulk_overwrite_transformed_documents.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/bulk_overwrite_transformed_documents.ts diff --git a/src/core/server/saved_objects/migrations/actions/calculate_exclude_filters.test.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/calculate_exclude_filters.test.ts similarity index 100% rename from src/core/server/saved_objects/migrations/actions/calculate_exclude_filters.test.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/calculate_exclude_filters.test.ts diff --git a/src/core/server/saved_objects/migrations/actions/calculate_exclude_filters.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/calculate_exclude_filters.ts similarity index 100% rename from src/core/server/saved_objects/migrations/actions/calculate_exclude_filters.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/calculate_exclude_filters.ts diff --git a/src/core/server/saved_objects/migrations/actions/catch_retryable_es_client_errors.test.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/catch_retryable_es_client_errors.test.ts similarity index 100% rename from src/core/server/saved_objects/migrations/actions/catch_retryable_es_client_errors.test.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/catch_retryable_es_client_errors.test.ts diff --git a/src/core/server/saved_objects/migrations/actions/catch_retryable_es_client_errors.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/catch_retryable_es_client_errors.ts similarity index 100% rename from src/core/server/saved_objects/migrations/actions/catch_retryable_es_client_errors.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/catch_retryable_es_client_errors.ts diff --git a/src/core/server/saved_objects/migrations/actions/check_for_unknown_docs.mocks.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/check_for_unknown_docs.mocks.ts similarity index 100% rename from src/core/server/saved_objects/migrations/actions/check_for_unknown_docs.mocks.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/check_for_unknown_docs.mocks.ts diff --git a/src/core/server/saved_objects/migrations/actions/check_for_unknown_docs.test.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/check_for_unknown_docs.test.ts similarity index 100% rename from src/core/server/saved_objects/migrations/actions/check_for_unknown_docs.test.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/check_for_unknown_docs.test.ts diff --git a/src/core/server/saved_objects/migrations/actions/check_for_unknown_docs.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/check_for_unknown_docs.ts similarity index 100% rename from src/core/server/saved_objects/migrations/actions/check_for_unknown_docs.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/check_for_unknown_docs.ts diff --git a/src/core/server/saved_objects/migrations/actions/clone_index.test.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/clone_index.test.ts similarity index 100% rename from src/core/server/saved_objects/migrations/actions/clone_index.test.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/clone_index.test.ts diff --git a/src/core/server/saved_objects/migrations/actions/clone_index.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/clone_index.ts similarity index 100% rename from src/core/server/saved_objects/migrations/actions/clone_index.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/clone_index.ts index e95f969f4ad82..0e07a68c1ec39 100644 --- a/src/core/server/saved_objects/migrations/actions/clone_index.ts +++ b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/clone_index.ts @@ -8,8 +8,8 @@ import * as Either from 'fp-ts/lib/Either'; import * as TaskEither from 'fp-ts/lib/TaskEither'; -import { errors as EsErrors } from '@elastic/elasticsearch'; import { pipe } from 'fp-ts/lib/pipeable'; +import { errors as EsErrors } from '@elastic/elasticsearch'; import type { ElasticsearchClient } from '@kbn/core-elasticsearch-server'; import { catchRetryableEsClientErrors, diff --git a/src/core/server/saved_objects/migrations/actions/close_pit.test.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/close_pit.test.ts similarity index 100% rename from src/core/server/saved_objects/migrations/actions/close_pit.test.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/close_pit.test.ts diff --git a/src/core/server/saved_objects/migrations/actions/close_pit.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/close_pit.ts similarity index 100% rename from src/core/server/saved_objects/migrations/actions/close_pit.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/close_pit.ts diff --git a/src/core/server/saved_objects/migrations/actions/constants.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/constants.ts similarity index 100% rename from src/core/server/saved_objects/migrations/actions/constants.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/constants.ts diff --git a/src/core/server/saved_objects/migrations/actions/create_index.test.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/create_index.test.ts similarity index 100% rename from src/core/server/saved_objects/migrations/actions/create_index.test.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/create_index.test.ts diff --git a/src/core/server/saved_objects/migrations/actions/create_index.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/create_index.ts similarity index 100% rename from src/core/server/saved_objects/migrations/actions/create_index.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/create_index.ts diff --git a/src/core/server/saved_objects/migrations/actions/es_errors.test.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/es_errors.test.ts similarity index 100% rename from src/core/server/saved_objects/migrations/actions/es_errors.test.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/es_errors.test.ts diff --git a/src/core/server/saved_objects/migrations/actions/es_errors.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/es_errors.ts similarity index 100% rename from src/core/server/saved_objects/migrations/actions/es_errors.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/es_errors.ts diff --git a/src/core/server/saved_objects/migrations/actions/fetch_indices.test.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/fetch_indices.test.ts similarity index 100% rename from src/core/server/saved_objects/migrations/actions/fetch_indices.test.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/fetch_indices.test.ts diff --git a/src/core/server/saved_objects/migrations/actions/fetch_indices.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/fetch_indices.ts similarity index 100% rename from src/core/server/saved_objects/migrations/actions/fetch_indices.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/fetch_indices.ts diff --git a/src/core/server/saved_objects/migrations/actions/index.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/index.ts similarity index 100% rename from src/core/server/saved_objects/migrations/actions/index.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/index.ts diff --git a/src/core/server/saved_objects/migrations/actions/initialize_action.test.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/initialize_action.test.ts similarity index 100% rename from src/core/server/saved_objects/migrations/actions/initialize_action.test.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/initialize_action.test.ts diff --git a/src/core/server/saved_objects/migrations/actions/initialize_action.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/initialize_action.ts similarity index 100% rename from src/core/server/saved_objects/migrations/actions/initialize_action.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/initialize_action.ts diff --git a/src/core/server/saved_objects/migrations/actions/open_pit.test.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/open_pit.test.ts similarity index 100% rename from src/core/server/saved_objects/migrations/actions/open_pit.test.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/open_pit.test.ts diff --git a/src/core/server/saved_objects/migrations/actions/open_pit.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/open_pit.ts similarity index 100% rename from src/core/server/saved_objects/migrations/actions/open_pit.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/open_pit.ts diff --git a/src/core/server/saved_objects/migrations/actions/pickup_updated_mappings.test.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/pickup_updated_mappings.test.ts similarity index 100% rename from src/core/server/saved_objects/migrations/actions/pickup_updated_mappings.test.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/pickup_updated_mappings.test.ts diff --git a/src/core/server/saved_objects/migrations/actions/pickup_updated_mappings.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/pickup_updated_mappings.ts similarity index 100% rename from src/core/server/saved_objects/migrations/actions/pickup_updated_mappings.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/pickup_updated_mappings.ts diff --git a/src/core/server/saved_objects/migrations/actions/read_with_pit.test.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/read_with_pit.test.ts similarity index 100% rename from src/core/server/saved_objects/migrations/actions/read_with_pit.test.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/read_with_pit.test.ts diff --git a/src/core/server/saved_objects/migrations/actions/read_with_pit.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/read_with_pit.ts similarity index 100% rename from src/core/server/saved_objects/migrations/actions/read_with_pit.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/read_with_pit.ts diff --git a/src/core/server/saved_objects/migrations/actions/refresh_index.test.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/refresh_index.test.ts similarity index 100% rename from src/core/server/saved_objects/migrations/actions/refresh_index.test.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/refresh_index.test.ts diff --git a/src/core/server/saved_objects/migrations/actions/refresh_index.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/refresh_index.ts similarity index 100% rename from src/core/server/saved_objects/migrations/actions/refresh_index.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/refresh_index.ts diff --git a/src/core/server/saved_objects/migrations/actions/reindex.test.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/reindex.test.ts similarity index 100% rename from src/core/server/saved_objects/migrations/actions/reindex.test.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/reindex.test.ts diff --git a/src/core/server/saved_objects/migrations/actions/reindex.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/reindex.ts similarity index 100% rename from src/core/server/saved_objects/migrations/actions/reindex.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/reindex.ts diff --git a/src/core/server/saved_objects/migrations/actions/remove_write_block.test.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/remove_write_block.test.ts similarity index 100% rename from src/core/server/saved_objects/migrations/actions/remove_write_block.test.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/remove_write_block.test.ts diff --git a/src/core/server/saved_objects/migrations/actions/remove_write_block.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/remove_write_block.ts similarity index 100% rename from src/core/server/saved_objects/migrations/actions/remove_write_block.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/remove_write_block.ts diff --git a/src/core/server/saved_objects/migrations/actions/search_for_outdated_documents.test.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/search_for_outdated_documents.test.ts similarity index 100% rename from src/core/server/saved_objects/migrations/actions/search_for_outdated_documents.test.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/search_for_outdated_documents.test.ts diff --git a/src/core/server/saved_objects/migrations/actions/search_for_outdated_documents.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/search_for_outdated_documents.ts similarity index 100% rename from src/core/server/saved_objects/migrations/actions/search_for_outdated_documents.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/search_for_outdated_documents.ts diff --git a/src/core/server/saved_objects/migrations/actions/set_write_block.test.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/set_write_block.test.ts similarity index 100% rename from src/core/server/saved_objects/migrations/actions/set_write_block.test.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/set_write_block.test.ts diff --git a/src/core/server/saved_objects/migrations/actions/set_write_block.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/set_write_block.ts similarity index 100% rename from src/core/server/saved_objects/migrations/actions/set_write_block.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/set_write_block.ts diff --git a/src/core/server/saved_objects/migrations/actions/transform_docs.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/transform_docs.ts similarity index 100% rename from src/core/server/saved_objects/migrations/actions/transform_docs.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/transform_docs.ts diff --git a/src/core/server/saved_objects/migrations/actions/update_aliases.test.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/update_aliases.test.ts similarity index 100% rename from src/core/server/saved_objects/migrations/actions/update_aliases.test.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/update_aliases.test.ts diff --git a/src/core/server/saved_objects/migrations/actions/update_aliases.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/update_aliases.ts similarity index 100% rename from src/core/server/saved_objects/migrations/actions/update_aliases.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/update_aliases.ts diff --git a/src/core/server/saved_objects/migrations/actions/update_and_pickup_mappings.test.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/update_and_pickup_mappings.test.ts similarity index 100% rename from src/core/server/saved_objects/migrations/actions/update_and_pickup_mappings.test.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/update_and_pickup_mappings.test.ts diff --git a/src/core/server/saved_objects/migrations/actions/update_and_pickup_mappings.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/update_and_pickup_mappings.ts similarity index 100% rename from src/core/server/saved_objects/migrations/actions/update_and_pickup_mappings.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/update_and_pickup_mappings.ts diff --git a/src/core/server/saved_objects/migrations/actions/wait_for_index_status.test.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/wait_for_index_status.test.ts similarity index 100% rename from src/core/server/saved_objects/migrations/actions/wait_for_index_status.test.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/wait_for_index_status.test.ts diff --git a/src/core/server/saved_objects/migrations/actions/wait_for_index_status.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/wait_for_index_status.ts similarity index 100% rename from src/core/server/saved_objects/migrations/actions/wait_for_index_status.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/wait_for_index_status.ts diff --git a/src/core/server/saved_objects/migrations/actions/wait_for_pickup_updated_mappings_task.test.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/wait_for_pickup_updated_mappings_task.test.ts similarity index 100% rename from src/core/server/saved_objects/migrations/actions/wait_for_pickup_updated_mappings_task.test.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/wait_for_pickup_updated_mappings_task.test.ts diff --git a/src/core/server/saved_objects/migrations/actions/wait_for_pickup_updated_mappings_task.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/wait_for_pickup_updated_mappings_task.ts similarity index 100% rename from src/core/server/saved_objects/migrations/actions/wait_for_pickup_updated_mappings_task.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/wait_for_pickup_updated_mappings_task.ts diff --git a/src/core/server/saved_objects/migrations/actions/wait_for_reindex_task.test.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/wait_for_reindex_task.test.ts similarity index 100% rename from src/core/server/saved_objects/migrations/actions/wait_for_reindex_task.test.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/wait_for_reindex_task.test.ts diff --git a/src/core/server/saved_objects/migrations/actions/wait_for_reindex_task.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/wait_for_reindex_task.ts similarity index 100% rename from src/core/server/saved_objects/migrations/actions/wait_for_reindex_task.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/wait_for_reindex_task.ts diff --git a/src/core/server/saved_objects/migrations/actions/wait_for_task.test.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/wait_for_task.test.ts similarity index 100% rename from src/core/server/saved_objects/migrations/actions/wait_for_task.test.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/wait_for_task.test.ts diff --git a/src/core/server/saved_objects/migrations/actions/wait_for_task.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/wait_for_task.ts similarity index 100% rename from src/core/server/saved_objects/migrations/actions/wait_for_task.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/actions/wait_for_task.ts diff --git a/src/core/server/saved_objects/migrations/core/__snapshots__/build_active_mappings.test.ts.snap b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/core/__snapshots__/build_active_mappings.test.ts.snap similarity index 100% rename from src/core/server/saved_objects/migrations/core/__snapshots__/build_active_mappings.test.ts.snap rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/core/__snapshots__/build_active_mappings.test.ts.snap diff --git a/src/core/server/saved_objects/migrations/core/build_active_mappings.test.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/core/build_active_mappings.test.ts similarity index 100% rename from src/core/server/saved_objects/migrations/core/build_active_mappings.test.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/core/build_active_mappings.test.ts diff --git a/src/core/server/saved_objects/migrations/core/build_active_mappings.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/core/build_active_mappings.ts similarity index 100% rename from src/core/server/saved_objects/migrations/core/build_active_mappings.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/core/build_active_mappings.ts diff --git a/src/core/server/saved_objects/migrations/core/build_index_map.test.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/core/build_index_map.test.ts similarity index 100% rename from src/core/server/saved_objects/migrations/core/build_index_map.test.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/core/build_index_map.test.ts diff --git a/src/core/server/saved_objects/migrations/core/build_index_map.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/core/build_index_map.ts similarity index 100% rename from src/core/server/saved_objects/migrations/core/build_index_map.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/core/build_index_map.ts diff --git a/src/core/server/saved_objects/migrations/core/disable_unknown_type_mapping_fields.test.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/core/disable_unknown_type_mapping_fields.test.ts similarity index 100% rename from src/core/server/saved_objects/migrations/core/disable_unknown_type_mapping_fields.test.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/core/disable_unknown_type_mapping_fields.test.ts diff --git a/src/core/server/saved_objects/migrations/core/disable_unknown_type_mapping_fields.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/core/disable_unknown_type_mapping_fields.ts similarity index 100% rename from src/core/server/saved_objects/migrations/core/disable_unknown_type_mapping_fields.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/core/disable_unknown_type_mapping_fields.ts diff --git a/src/core/server/saved_objects/migrations/core/document_migrator.test.mock.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/core/document_migrator.test.mock.ts similarity index 100% rename from src/core/server/saved_objects/migrations/core/document_migrator.test.mock.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/core/document_migrator.test.mock.ts diff --git a/src/core/server/saved_objects/migrations/core/document_migrator.test.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/core/document_migrator.test.ts similarity index 100% rename from src/core/server/saved_objects/migrations/core/document_migrator.test.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/core/document_migrator.test.ts diff --git a/src/core/server/saved_objects/migrations/core/document_migrator.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/core/document_migrator.ts similarity index 100% rename from src/core/server/saved_objects/migrations/core/document_migrator.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/core/document_migrator.ts diff --git a/src/core/server/saved_objects/migrations/core/index.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/core/index.ts similarity index 93% rename from src/core/server/saved_objects/migrations/core/index.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/core/index.ts index b96f9ae98d8c7..8e4ac2d0e54c8 100644 --- a/src/core/server/saved_objects/migrations/core/index.ts +++ b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/core/index.ts @@ -17,4 +17,3 @@ export type { TransformErrorObjects, } from './migrate_raw_docs'; export { disableUnknownTypeMappingFields } from './disable_unknown_type_mapping_fields'; -export type { MigrationResult, MigrationStatus } from './types'; diff --git a/src/core/server/saved_objects/migrations/core/migrate_raw_docs.test.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/core/migrate_raw_docs.test.ts similarity index 100% rename from src/core/server/saved_objects/migrations/core/migrate_raw_docs.test.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/core/migrate_raw_docs.test.ts diff --git a/src/core/server/saved_objects/migrations/core/migrate_raw_docs.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/core/migrate_raw_docs.ts similarity index 100% rename from src/core/server/saved_objects/migrations/core/migrate_raw_docs.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/core/migrate_raw_docs.ts diff --git a/src/core/server/saved_objects/migrations/core/migration_logger.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/core/migration_logger.ts similarity index 100% rename from src/core/server/saved_objects/migrations/core/migration_logger.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/core/migration_logger.ts diff --git a/src/core/server/saved_objects/migrations/core/transform_saved_object_document_error.test.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/core/transform_saved_object_document_error.test.ts similarity index 100% rename from src/core/server/saved_objects/migrations/core/transform_saved_object_document_error.test.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/core/transform_saved_object_document_error.test.ts diff --git a/src/core/server/saved_objects/migrations/core/transform_saved_object_document_error.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/core/transform_saved_object_document_error.ts similarity index 100% rename from src/core/server/saved_objects/migrations/core/transform_saved_object_document_error.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/core/transform_saved_object_document_error.ts diff --git a/src/core/server/saved_objects/migrations/core/unused_types.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/core/unused_types.ts similarity index 100% rename from src/core/server/saved_objects/migrations/core/unused_types.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/core/unused_types.ts diff --git a/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/index.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/index.ts new file mode 100644 index 0000000000000..817a284468c1f --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/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 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 or the Server + * Side Public License, v 1. + */ + +export { KibanaMigrator, mergeTypes } from './kibana_migrator'; +export type { KibanaMigratorOptions } from './kibana_migrator'; +export { buildActiveMappings } from './core'; diff --git a/src/core/server/saved_objects/migrations/initial_state.test.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/initial_state.test.ts similarity index 99% rename from src/core/server/saved_objects/migrations/initial_state.test.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/initial_state.test.ts index 6d49b17d4fa80..2b0e9a7c7f1a4 100644 --- a/src/core/server/saved_objects/migrations/initial_state.test.ts +++ b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/initial_state.test.ts @@ -14,7 +14,7 @@ import { type SavedObjectsMigrationConfigType, SavedObjectTypeRegistry, } from '@kbn/core-saved-objects-base-server-internal'; -import { loggingSystemMock } from '../../mocks'; +import { loggingSystemMock } from '@kbn/core-logging-server-mocks'; import { createInitialState } from './initial_state'; const mockLogger = loggingSystemMock.create(); diff --git a/src/core/server/saved_objects/migrations/initial_state.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/initial_state.ts similarity index 100% rename from src/core/server/saved_objects/migrations/initial_state.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/initial_state.ts diff --git a/src/core/server/saved_objects/migrations/kibana_migrator.test.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/kibana_migrator.test.ts similarity index 100% rename from src/core/server/saved_objects/migrations/kibana_migrator.test.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/kibana_migrator.test.ts diff --git a/src/core/server/saved_objects/migrations/kibana_migrator.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/kibana_migrator.ts similarity index 78% rename from src/core/server/saved_objects/migrations/kibana_migrator.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/kibana_migrator.ts index 2a8f9a9c3ee0f..1d8d766d8ac88 100644 --- a/src/core/server/saved_objects/migrations/kibana_migrator.ts +++ b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/kibana_migrator.ts @@ -27,8 +27,11 @@ import { type IndexMapping, type SavedObjectsTypeMappingDefinitions, type SavedObjectsMigrationConfigType, + type IKibanaMigrator, + type KibanaMigratorStatus, + type MigrationResult, } from '@kbn/core-saved-objects-base-server-internal'; -import { buildActiveMappings, MigrationResult, MigrationStatus } from './core'; +import { buildActiveMappings } from './core'; import { DocumentMigrator, VersionedTransformer } from './core/document_migrator'; import { createIndexMap } from './core/build_index_map'; import { runResilientMigrator } from './run_resilient_migrator'; @@ -44,18 +47,10 @@ export interface KibanaMigratorOptions { docLinks: DocLinksServiceStart; } -export type IKibanaMigrator = Pick; - -export interface KibanaMigratorStatus { - status: MigrationStatus; - result?: MigrationResult[]; - waitingIndex?: string; -} - /** * Manages the shape of mappings and documents in the Kibana index. */ -export class KibanaMigrator { +export class KibanaMigrator implements IKibanaMigrator { private readonly client: ElasticsearchClient; private readonly documentMigrator: VersionedTransformer; private readonly kibanaIndex: string; @@ -69,9 +64,10 @@ export class KibanaMigrator { }); private readonly activeMappings: IndexMapping; private readonly soMigrationsConfig: SavedObjectsMigrationConfigType; - public readonly kibanaVersion: string; private readonly docLinks: DocLinksServiceStart; + public readonly kibanaVersion: string; + /** * Creates an instance of KibanaMigrator. */ @@ -103,24 +99,6 @@ export class KibanaMigrator { this.docLinks = docLinks; } - /** - * Migrates the mappings and documents in the Kibana index. By default, this will run only - * once and subsequent calls will return the result of the original call. - * - * @param rerun - If true, method will run a new migration when called again instead of - * returning the result of the initial migration. This should only be used when factors external - * to Kibana itself alter the kibana index causing the saved objects mappings or data to change - * after the Kibana server performed the initial migration. - * - * @remarks When the `rerun` parameter is set to true, no checks are performed to ensure that no migration - * is currently running. Chained or concurrent calls to `runMigrations({ rerun: true })` can lead to - * multiple migrations running at the same time. When calling with this parameter, it's expected that the calling - * code should ensure that the initial call resolves before calling the function again. - * - * @returns - A promise which resolves once all migrations have been applied. - * The promise resolves with an array of migration statuses, one for each - * elasticsearch index which was migrated. - */ public runMigrations({ rerun = false }: { rerun?: boolean } = {}): Promise { if (this.migrationResult === undefined || rerun) { // Reruns are only used by CI / EsArchiver. Publishing status updates on reruns results in slowing down CI @@ -192,20 +170,10 @@ export class KibanaMigrator { return Promise.all(migrators.map((migrator) => migrator.migrate())); } - /** - * Gets all the index mappings defined by Kibana's enabled plugins. - * - */ public getActiveMappings(): IndexMapping { return this.activeMappings; } - /** - * Migrates an individual doc to the latest version, as defined by the plugin migrations. - * - * @param doc - The saved object to migrate - * @returns `doc` with all registered migrations applied. - */ public migrateDocument(doc: SavedObjectUnsanitizedDoc): SavedObjectUnsanitizedDoc { return this.documentMigrator.migrate(doc); } diff --git a/src/core/server/saved_objects/migrations/migrations_state_action_machine.test.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/migrations_state_action_machine.test.ts similarity index 99% rename from src/core/server/saved_objects/migrations/migrations_state_action_machine.test.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/migrations_state_action_machine.test.ts index 1c4644fb43325..55b0a53d8f807 100644 --- a/src/core/server/saved_objects/migrations/migrations_state_action_machine.test.ts +++ b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/migrations_state_action_machine.test.ts @@ -12,7 +12,7 @@ import { docLinksServiceMock } from '@kbn/core-doc-links-server-mocks'; import { loggingSystemMock } from '@kbn/core-logging-server-mocks'; import { LoggerAdapter } from '@kbn/core-logging-server-internal'; import { typeRegistryMock } from '@kbn/core-saved-objects-base-server-mocks'; -import { elasticsearchServiceMock } from '../../mocks'; +import { elasticsearchServiceMock } from '@kbn/core-elasticsearch-server-mocks'; import * as Either from 'fp-ts/lib/Either'; import * as Option from 'fp-ts/lib/Option'; import { errors } from '@elastic/elasticsearch'; diff --git a/src/core/server/saved_objects/migrations/migrations_state_action_machine.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/migrations_state_action_machine.ts similarity index 100% rename from src/core/server/saved_objects/migrations/migrations_state_action_machine.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/migrations_state_action_machine.ts diff --git a/src/core/server/saved_objects/migrations/migrations_state_machine_cleanup.mocks.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/migrations_state_machine_cleanup.mocks.ts similarity index 100% rename from src/core/server/saved_objects/migrations/migrations_state_machine_cleanup.mocks.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/migrations_state_machine_cleanup.mocks.ts diff --git a/src/core/server/saved_objects/migrations/migrations_state_machine_cleanup.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/migrations_state_machine_cleanup.ts similarity index 100% rename from src/core/server/saved_objects/migrations/migrations_state_machine_cleanup.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/migrations_state_machine_cleanup.ts diff --git a/src/core/server/saved_objects/migrations/model/create_batches.test.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/model/create_batches.test.ts similarity index 100% rename from src/core/server/saved_objects/migrations/model/create_batches.test.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/model/create_batches.test.ts diff --git a/src/core/server/saved_objects/migrations/model/create_batches.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/model/create_batches.ts similarity index 100% rename from src/core/server/saved_objects/migrations/model/create_batches.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/model/create_batches.ts diff --git a/src/core/server/saved_objects/migrations/model/extract_errors.test.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/model/extract_errors.test.ts similarity index 100% rename from src/core/server/saved_objects/migrations/model/extract_errors.test.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/model/extract_errors.test.ts diff --git a/src/core/server/saved_objects/migrations/model/extract_errors.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/model/extract_errors.ts similarity index 100% rename from src/core/server/saved_objects/migrations/model/extract_errors.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/model/extract_errors.ts diff --git a/src/core/server/saved_objects/migrations/model/helpers.test.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/model/helpers.test.ts similarity index 100% rename from src/core/server/saved_objects/migrations/model/helpers.test.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/model/helpers.test.ts diff --git a/src/core/server/saved_objects/migrations/model/helpers.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/model/helpers.ts similarity index 100% rename from src/core/server/saved_objects/migrations/model/helpers.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/model/helpers.ts diff --git a/src/core/server/saved_objects/migrations/model/index.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/model/index.ts similarity index 100% rename from src/core/server/saved_objects/migrations/model/index.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/model/index.ts diff --git a/src/core/server/saved_objects/migrations/model/model.test.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/model/model.test.ts similarity index 100% rename from src/core/server/saved_objects/migrations/model/model.test.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/model/model.test.ts diff --git a/src/core/server/saved_objects/migrations/model/model.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/model/model.ts similarity index 100% rename from src/core/server/saved_objects/migrations/model/model.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/model/model.ts diff --git a/src/core/server/saved_objects/migrations/model/progress.test.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/model/progress.test.ts similarity index 100% rename from src/core/server/saved_objects/migrations/model/progress.test.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/model/progress.test.ts diff --git a/src/core/server/saved_objects/migrations/model/progress.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/model/progress.ts similarity index 100% rename from src/core/server/saved_objects/migrations/model/progress.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/model/progress.ts diff --git a/src/core/server/saved_objects/migrations/model/retry_state.test.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/model/retry_state.test.ts similarity index 100% rename from src/core/server/saved_objects/migrations/model/retry_state.test.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/model/retry_state.test.ts diff --git a/src/core/server/saved_objects/migrations/model/retry_state.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/model/retry_state.ts similarity index 100% rename from src/core/server/saved_objects/migrations/model/retry_state.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/model/retry_state.ts diff --git a/src/core/server/saved_objects/migrations/model/types.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/model/types.ts similarity index 100% rename from src/core/server/saved_objects/migrations/model/types.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/model/types.ts diff --git a/src/core/server/saved_objects/migrations/next.test.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/next.test.ts similarity index 100% rename from src/core/server/saved_objects/migrations/next.test.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/next.test.ts diff --git a/src/core/server/saved_objects/migrations/next.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/next.ts similarity index 100% rename from src/core/server/saved_objects/migrations/next.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/next.ts diff --git a/src/core/server/saved_objects/migrations/run_resilient_migrator.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/run_resilient_migrator.ts similarity index 98% rename from src/core/server/saved_objects/migrations/run_resilient_migrator.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/run_resilient_migrator.ts index 6a6153b997146..47fe92ad82c54 100644 --- a/src/core/server/saved_objects/migrations/run_resilient_migrator.ts +++ b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/run_resilient_migrator.ts @@ -14,9 +14,9 @@ import type { ISavedObjectTypeRegistry } from '@kbn/core-saved-objects-server'; import type { IndexMapping, SavedObjectsMigrationConfigType, + MigrationResult, } from '@kbn/core-saved-objects-base-server-internal'; import type { TransformRawDocs } from './types'; -import { MigrationResult } from './core'; import { next } from './next'; import { model } from './model'; import { createInitialState } from './initial_state'; diff --git a/src/core/server/saved_objects/migrations/state.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/state.ts similarity index 100% rename from src/core/server/saved_objects/migrations/state.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/state.ts diff --git a/src/core/server/saved_objects/migrations/state_action_machine.test.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/state_action_machine.test.ts similarity index 100% rename from src/core/server/saved_objects/migrations/state_action_machine.test.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/state_action_machine.test.ts diff --git a/src/core/server/saved_objects/migrations/state_action_machine.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/state_action_machine.ts similarity index 100% rename from src/core/server/saved_objects/migrations/state_action_machine.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/state_action_machine.ts diff --git a/src/core/server/saved_objects/migrations/types.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/types.ts similarity index 94% rename from src/core/server/saved_objects/migrations/types.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-internal/src/types.ts index baa39f5dbb82d..cf7c74c305f2b 100644 --- a/src/core/server/saved_objects/migrations/types.ts +++ b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/types.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import * as TaskEither from 'fp-ts/TaskEither'; +import * as TaskEither from 'fp-ts/lib/TaskEither'; import type { SavedObjectsRawDoc } from '@kbn/core-saved-objects-server'; import { DocumentsTransformFailed, DocumentsTransformSuccess } from './core'; diff --git a/packages/core/saved-objects/core-saved-objects-migration-server-internal/tsconfig.json b/packages/core/saved-objects/core-saved-objects-migration-server-internal/tsconfig.json new file mode 100644 index 0000000000000..ff8b3da96b4db --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-migration-server-internal/tsconfig.json @@ -0,0 +1,18 @@ +{ + "extends": "../../../../tsconfig.bazel.json", + "compilerOptions": { + "declaration": true, + "declarationMap": true, + "emitDeclarationOnly": true, + "outDir": "target_types", + "rootDir": ".", + "stripInternal": false, + "types": [ + "jest", + "node" + ] + }, + "include": [ + "**/*.ts", + ] +} diff --git a/packages/core/saved-objects/core-saved-objects-migration-server-mocks/BUILD.bazel b/packages/core/saved-objects/core-saved-objects-migration-server-mocks/BUILD.bazel new file mode 100644 index 0000000000000..1bb04039073b2 --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-migration-server-mocks/BUILD.bazel @@ -0,0 +1,111 @@ +load("@npm//@bazel/typescript:index.bzl", "ts_config") +load("@build_bazel_rules_nodejs//:index.bzl", "js_library") +load("//src/dev/bazel:index.bzl", "jsts_transpiler", "pkg_npm", "pkg_npm_types", "ts_project") + +PKG_DIRNAME = "core-saved-objects-migration-server-mocks" +PKG_REQUIRE_NAME = "@kbn/core-saved-objects-migration-server-mocks" + +SOURCE_FILES = glob( + [ + "**/*.ts", + ], + exclude = [ + "**/*.config.js", + "**/*.test.*", + "**/*.stories.*", + "**/__snapshots__", + "**/integration_tests", + "**/mocks", + "**/scripts", + "**/storybook", + "**/test_fixtures", + "**/test_helpers", + ], +) + +SRCS = SOURCE_FILES + +filegroup( + name = "srcs", + srcs = SRCS, +) + +NPM_MODULE_EXTRA_FILES = [ + "package.json", +] + +RUNTIME_DEPS = [ + "@npm//rxjs", + "//packages/core/saved-objects/core-saved-objects-migration-server-internal", +] + +TYPES_DEPS = [ + "@npm//@types/node", + "@npm//@types/jest", + "@npm//rxjs", + "//packages/core/saved-objects/core-saved-objects-server:npm_module_types", + "//packages/core/saved-objects/core-saved-objects-base-server-internal:npm_module_types", + "//packages/core/saved-objects/core-saved-objects-migration-server-internal:npm_module_types", +] + +jsts_transpiler( + name = "target_node", + srcs = SRCS, + build_pkg_name = package_name(), +) + +ts_config( + name = "tsconfig", + src = "tsconfig.json", + deps = [ + "//:tsconfig.base.json", + "//:tsconfig.bazel.json", + ], +) + +ts_project( + name = "tsc_types", + args = ['--pretty'], + srcs = SRCS, + deps = TYPES_DEPS, + declaration = True, + declaration_map = True, + emit_declaration_only = True, + out_dir = "target_types", + root_dir = ".", + tsconfig = ":tsconfig", +) + +js_library( + name = PKG_DIRNAME, + srcs = NPM_MODULE_EXTRA_FILES, + deps = RUNTIME_DEPS + [":target_node"], + package_name = PKG_REQUIRE_NAME, + visibility = ["//visibility:public"], +) + +pkg_npm( + name = "npm_module", + deps = [":" + PKG_DIRNAME], +) + +filegroup( + name = "build", + srcs = [":npm_module"], + visibility = ["//visibility:public"], +) + +pkg_npm_types( + name = "npm_module_types", + srcs = SRCS, + deps = [":tsc_types"], + package_name = PKG_REQUIRE_NAME, + tsconfig = ":tsconfig", + visibility = ["//visibility:public"], +) + +filegroup( + name = "build_types", + srcs = [":npm_module_types"], + visibility = ["//visibility:public"], +) diff --git a/packages/core/saved-objects/core-saved-objects-migration-server-mocks/README.md b/packages/core/saved-objects/core-saved-objects-migration-server-mocks/README.md new file mode 100644 index 0000000000000..d52e60997969a --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-migration-server-mocks/README.md @@ -0,0 +1,8 @@ +# @kbn/core-saved-objects-migration-server-mocks + +This package contains mocks for core's server-side savedObjects migration feature. +- mockKibanaMigrator +- migrationMocks + +Note: the package is supposed to only be needed for core's internal testing, as all the mocks are for internal +Core components that are not publicly exposed. \ No newline at end of file diff --git a/packages/core/saved-objects/core-saved-objects-migration-server-mocks/index.ts b/packages/core/saved-objects/core-saved-objects-migration-server-mocks/index.ts new file mode 100644 index 0000000000000..4a37278a0e954 --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-migration-server-mocks/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 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 or the Server + * Side Public License, v 1. + */ + +export { + mockKibanaMigrator, + migrationMocks, + createSavedObjectsMigrationLoggerMock, + retryAsync, +} from './src'; diff --git a/packages/core/saved-objects/core-saved-objects-migration-server-mocks/jest.config.js b/packages/core/saved-objects/core-saved-objects-migration-server-mocks/jest.config.js new file mode 100644 index 0000000000000..4c6f7fb049390 --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-migration-server-mocks/jest.config.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 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 or the Server + * Side Public License, v 1. + */ + +module.exports = { + preset: '@kbn/test/jest_node', + rootDir: '../../../..', + roots: ['/packages/core/saved-objects/core-saved-objects-migration-server-mocks'], +}; diff --git a/packages/core/saved-objects/core-saved-objects-migration-server-mocks/package.json b/packages/core/saved-objects/core-saved-objects-migration-server-mocks/package.json new file mode 100644 index 0000000000000..2a4723650d990 --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-migration-server-mocks/package.json @@ -0,0 +1,8 @@ +{ + "name": "@kbn/core-saved-objects-migration-server-mocks", + "private": true, + "version": "1.0.0", + "main": "./target_node/index.js", + "author": "Kibana Core", + "license": "SSPL-1.0 OR Elastic License 2.0" +} diff --git a/src/core/server/saved_objects/migrations/test_helpers/retry.test.ts b/packages/core/saved-objects/core-saved-objects-migration-server-mocks/src/helpers/retry.test.ts similarity index 100% rename from src/core/server/saved_objects/migrations/test_helpers/retry.test.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-mocks/src/helpers/retry.test.ts diff --git a/src/core/server/saved_objects/migrations/test_helpers/retry_async.ts b/packages/core/saved-objects/core-saved-objects-migration-server-mocks/src/helpers/retry_async.ts similarity index 100% rename from src/core/server/saved_objects/migrations/test_helpers/retry_async.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-mocks/src/helpers/retry_async.ts diff --git a/packages/core/saved-objects/core-saved-objects-migration-server-mocks/src/index.ts b/packages/core/saved-objects/core-saved-objects-migration-server-mocks/src/index.ts new file mode 100644 index 0000000000000..12706b2c5f4e6 --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-migration-server-mocks/src/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 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 or the Server + * Side Public License, v 1. + */ + +export { mockKibanaMigrator } from './kibana_migrator.mock'; +export { migrationMocks, createSavedObjectsMigrationLoggerMock } from './migration.mocks'; +export { retryAsync } from './helpers/retry_async'; diff --git a/src/core/server/saved_objects/migrations/kibana_migrator.mock.ts b/packages/core/saved-objects/core-saved-objects-migration-server-mocks/src/kibana_migrator.mock.ts similarity index 88% rename from src/core/server/saved_objects/migrations/kibana_migrator.mock.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-mocks/src/kibana_migrator.mock.ts index 5fdf4bb26c3b0..e7df2a0363a26 100644 --- a/src/core/server/saved_objects/migrations/kibana_migrator.mock.ts +++ b/packages/core/saved-objects/core-saved-objects-migration-server-mocks/src/kibana_migrator.mock.ts @@ -6,12 +6,13 @@ * Side Public License, v 1. */ -import { IKibanaMigrator, KibanaMigratorStatus } from './kibana_migrator'; -import { buildActiveMappings } from './core'; - -const { mergeTypes } = jest.requireActual('./kibana_migrator'); -import type { SavedObjectsType } from '@kbn/core-saved-objects-server'; import { BehaviorSubject } from 'rxjs'; +import type { SavedObjectsType } from '@kbn/core-saved-objects-server'; +import type { + IKibanaMigrator, + KibanaMigratorStatus, +} from '@kbn/core-saved-objects-base-server-internal'; +import { buildActiveMappings, mergeTypes } from '@kbn/core-saved-objects-migration-server-internal'; const defaultSavedObjectTypes: SavedObjectsType[] = [ { diff --git a/src/core/server/saved_objects/migrations/mocks.ts b/packages/core/saved-objects/core-saved-objects-migration-server-mocks/src/migration.mocks.ts similarity index 100% rename from src/core/server/saved_objects/migrations/mocks.ts rename to packages/core/saved-objects/core-saved-objects-migration-server-mocks/src/migration.mocks.ts diff --git a/packages/core/saved-objects/core-saved-objects-migration-server-mocks/tsconfig.json b/packages/core/saved-objects/core-saved-objects-migration-server-mocks/tsconfig.json new file mode 100644 index 0000000000000..ff8b3da96b4db --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-migration-server-mocks/tsconfig.json @@ -0,0 +1,18 @@ +{ + "extends": "../../../../tsconfig.bazel.json", + "compilerOptions": { + "declaration": true, + "declarationMap": true, + "emitDeclarationOnly": true, + "outDir": "target_types", + "rootDir": ".", + "stripInternal": false, + "types": [ + "jest", + "node" + ] + }, + "include": [ + "**/*.ts", + ] +} diff --git a/packages/core/saved-objects/core-saved-objects-server-internal/BUILD.bazel b/packages/core/saved-objects/core-saved-objects-server-internal/BUILD.bazel new file mode 100644 index 0000000000000..5c5474ce0737a --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-server-internal/BUILD.bazel @@ -0,0 +1,130 @@ +load("@npm//@bazel/typescript:index.bzl", "ts_config") +load("@build_bazel_rules_nodejs//:index.bzl", "js_library") +load("//src/dev/bazel:index.bzl", "jsts_transpiler", "pkg_npm", "pkg_npm_types", "ts_project") + +PKG_DIRNAME = "core-saved-objects-server-internal" +PKG_REQUIRE_NAME = "@kbn/core-saved-objects-server-internal" + +SOURCE_FILES = glob( + [ + "**/*.ts", + ], + exclude = [ + "**/*.config.js", + "**/*.mock.*", + "**/*.test.*", + "**/*.stories.*", + "**/__snapshots__", + "**/integration_tests", + "**/mocks", + "**/scripts", + "**/storybook", + "**/test_fixtures", + "**/test_helpers", + ], +) + +SRCS = SOURCE_FILES + +filegroup( + name = "srcs", + srcs = SRCS, +) + +NPM_MODULE_EXTRA_FILES = [ + "package.json", +] + +RUNTIME_DEPS = [ + "@npm//json-stable-stringify", + "//packages/kbn-config-schema", + "//packages/core/base/core-base-common", + "//packages/core/saved-objects/core-saved-objects-base-server-internal", + "//packages/core/saved-objects/core-saved-objects-api-server-internal", + "//packages/core/saved-objects/core-saved-objects-migration-server-internal", + "//packages/core/saved-objects/core-saved-objects-import-export-server-internal", +] + +TYPES_DEPS = [ + "@npm//@types/node", + "@npm//@types/jest", + "@npm//@types/json-stable-stringify", + "//packages/kbn-config-schema:npm_module_types", + "//packages/kbn-logging:npm_module_types", + "//packages/core/base/core-base-common:npm_module_types", + "//packages/core/deprecations/core-deprecations-common:npm_module_types", + "//packages/core/http/core-http-server:npm_module_types", + "//packages/core/http/core-http-server-internal:npm_module_types", + "//packages/core/elasticsearch/core-elasticsearch-server:npm_module_types", + "//packages/core/saved-objects/core-saved-objects-common:npm_module_types", + "//packages/core/saved-objects/core-saved-objects-server:npm_module_types", + "//packages/core/saved-objects/core-saved-objects-api-server:npm_module_types", + "//packages/core/saved-objects/core-saved-objects-api-server-internal:npm_module_types", + "//packages/core/saved-objects/core-saved-objects-base-server-internal:npm_module_types", + "//packages/core/saved-objects/core-saved-objects-migration-server-internal:npm_module_types", + "//packages/core/saved-objects/core-saved-objects-import-export-server-internal:npm_module_types", + "//packages/core/usage-data/core-usage-data-base-server-internal:npm_module_types", + "//packages/core/deprecations/core-deprecations-server:npm_module_types", +] + +jsts_transpiler( + name = "target_node", + srcs = SRCS, + build_pkg_name = package_name(), +) + +ts_config( + name = "tsconfig", + src = "tsconfig.json", + deps = [ + "//:tsconfig.base.json", + "//:tsconfig.bazel.json", + ], +) + +ts_project( + name = "tsc_types", + args = ['--pretty'], + srcs = SRCS, + deps = TYPES_DEPS, + declaration = True, + declaration_map = True, + emit_declaration_only = True, + out_dir = "target_types", + root_dir = ".", + tsconfig = ":tsconfig", +) + +js_library( + name = PKG_DIRNAME, + srcs = NPM_MODULE_EXTRA_FILES, + deps = RUNTIME_DEPS + [":target_node"], + package_name = PKG_REQUIRE_NAME, + visibility = ["//visibility:public"], +) + +pkg_npm( + name = "npm_module", + deps = [":" + PKG_DIRNAME], +) + +filegroup( + name = "build", + srcs = [":npm_module"], + visibility = ["//visibility:public"], +) + +pkg_npm_types( + name = "npm_module_types", + srcs = SRCS, + deps = [":tsc_types"], + package_name = PKG_REQUIRE_NAME, + tsconfig = ":tsconfig", + visibility = ["//visibility:public"], +) + +filegroup( + name = "build_types", + srcs = [":npm_module_types"], + visibility = ["//visibility:public"], +) diff --git a/packages/core/saved-objects/core-saved-objects-server-internal/README.md b/packages/core/saved-objects/core-saved-objects-server-internal/README.md new file mode 100644 index 0000000000000..a57faf8b93700 --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-server-internal/README.md @@ -0,0 +1,3 @@ +# @kbn/core-saved-objects-server-internal + +This package contains the internal implementation of core's server-side savedObjects service. diff --git a/packages/core/saved-objects/core-saved-objects-server-internal/index.ts b/packages/core/saved-objects/core-saved-objects-server-internal/index.ts new file mode 100644 index 0000000000000..caeb029e037f7 --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-server-internal/index.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 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 or the Server + * Side Public License, v 1. + */ + +export { SavedObjectsService, CoreSavedObjectsRouteHandlerContext } from './src'; +export type { + InternalSavedObjectsServiceStart, + InternalSavedObjectsServiceSetup, + InternalSavedObjectsRequestHandlerContext, + InternalSavedObjectRouter, +} from './src'; + +// only used by integration tests +export { registerDeleteUnknownTypesRoute } from './src/routes/deprecations'; +export { registerLegacyExportRoute } from './src/routes/legacy_import_export/export'; +export { registerLegacyImportRoute } from './src/routes/legacy_import_export/import'; +export { registerBulkCreateRoute } from './src/routes/bulk_create'; +export { registerBulkGetRoute } from './src/routes/bulk_get'; +export { registerBulkResolveRoute } from './src/routes/bulk_resolve'; +export { registerBulkUpdateRoute } from './src/routes/bulk_update'; +export { registerCreateRoute } from './src/routes/create'; +export { registerDeleteRoute } from './src/routes/delete'; +export { registerExportRoute } from './src/routes/export'; +export { registerFindRoute } from './src/routes/find'; +export { registerGetRoute } from './src/routes/get'; +export { registerImportRoute } from './src/routes/import'; +export { registerMigrateRoute } from './src/routes/migrate'; +export { registerResolveRoute } from './src/routes/resolve'; +export { registerResolveImportErrorsRoute } from './src/routes/resolve_import_errors'; +export { registerUpdateRoute } from './src/routes/update'; diff --git a/packages/core/saved-objects/core-saved-objects-server-internal/jest.config.js b/packages/core/saved-objects/core-saved-objects-server-internal/jest.config.js new file mode 100644 index 0000000000000..7ef3739869d86 --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-server-internal/jest.config.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 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 or the Server + * Side Public License, v 1. + */ + +module.exports = { + preset: '@kbn/test/jest_node', + rootDir: '../../../..', + roots: ['/packages/core/saved-objects/core-saved-objects-server-internal'], +}; diff --git a/packages/core/saved-objects/core-saved-objects-server-internal/package.json b/packages/core/saved-objects/core-saved-objects-server-internal/package.json new file mode 100644 index 0000000000000..cd52a32958cc9 --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-server-internal/package.json @@ -0,0 +1,8 @@ +{ + "name": "@kbn/core-saved-objects-server-internal", + "private": true, + "version": "1.0.0", + "main": "./target_node/index.js", + "author": "Kibana Core", + "license": "SSPL-1.0 OR Elastic License 2.0" +} diff --git a/src/core/server/saved_objects/deprecations/deprecation_factory.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/deprecations/deprecation_factory.ts similarity index 93% rename from src/core/server/saved_objects/deprecations/deprecation_factory.ts rename to packages/core/saved-objects/core-saved-objects-server-internal/src/deprecations/deprecation_factory.ts index d330577151a52..3a363ea5a4c20 100644 --- a/src/core/server/saved_objects/deprecations/deprecation_factory.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/deprecations/deprecation_factory.ts @@ -8,7 +8,7 @@ import type { ISavedObjectTypeRegistry } from '@kbn/core-saved-objects-server'; import type { SavedObjectConfig } from '@kbn/core-saved-objects-base-server-internal'; -import type { RegisterDeprecationsConfig } from '../../deprecations'; +import type { RegisterDeprecationsConfig } from '@kbn/core-deprecations-server'; import { getUnknownTypesDeprecations } from './unknown_object_types'; interface GetDeprecationProviderOptions { diff --git a/src/core/server/saved_objects/deprecations/index.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/deprecations/index.ts similarity index 100% rename from src/core/server/saved_objects/deprecations/index.ts rename to packages/core/saved-objects/core-saved-objects-server-internal/src/deprecations/index.ts diff --git a/packages/core/saved-objects/core-saved-objects-server-internal/src/deprecations/unknown_object_types.test.mocks.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/deprecations/unknown_object_types.test.mocks.ts new file mode 100644 index 0000000000000..d49c300680c09 --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/deprecations/unknown_object_types.test.mocks.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 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 or the Server + * Side Public License, v 1. + */ + +export const getIndexForTypeMock = jest.fn(); + +jest.doMock('@kbn/core-saved-objects-base-server-internal', () => { + const actual = jest.requireActual('@kbn/core-saved-objects-base-server-internal'); + return { + ...actual, + getIndexForType: getIndexForTypeMock, + }; +}); diff --git a/src/core/server/saved_objects/deprecations/unknown_object_types.test.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/deprecations/unknown_object_types.test.ts similarity index 85% rename from src/core/server/saved_objects/deprecations/unknown_object_types.test.ts rename to packages/core/saved-objects/core-saved-objects-server-internal/src/deprecations/unknown_object_types.test.ts index 7e02f3343050d..2199a7fb32b5e 100644 --- a/src/core/server/saved_objects/deprecations/unknown_object_types.test.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/deprecations/unknown_object_types.test.ts @@ -8,11 +8,42 @@ import { getIndexForTypeMock } from './unknown_object_types.test.mocks'; +import type { SearchResponse } from '@elastic/elasticsearch/lib/api/types'; import { deleteUnknownTypeObjects, getUnknownTypesDeprecations } from './unknown_object_types'; import { typeRegistryMock } from '@kbn/core-saved-objects-base-server-mocks'; import { elasticsearchClientMock } from '@kbn/core-elasticsearch-client-server-mocks'; -import { SavedObjectsType } from '../..'; -import { createAggregateTypesSearchResponse } from '../migrations/actions/check_for_unknown_docs.mocks'; +import type { SavedObjectsType } from '@kbn/core-saved-objects-server'; + +const createAggregateTypesSearchResponse = ( + typesIds: Record = {} +): SearchResponse => { + return { + took: 0, + timed_out: false, + _shards: { + total: 1, + successful: 1, + skipped: 0, + failed: 0, + }, + hits: { + total: { + value: Object.keys(typesIds).length, + relation: 'eq', + }, + max_score: null, + hits: [], + }, + aggregations: { + typesAggregation: { + buckets: Object.entries(typesIds).map(([type, ids]) => ({ + key: type, + docs: { hits: { hits: ids.map((_id) => ({ _id })) } }, + })), + }, + }, + }; +}; describe('unknown saved object types deprecation', () => { const kibanaVersion = '8.0.0'; diff --git a/src/core/server/saved_objects/deprecations/unknown_object_types.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/deprecations/unknown_object_types.ts similarity index 95% rename from src/core/server/saved_objects/deprecations/unknown_object_types.ts rename to packages/core/saved-objects/core-saved-objects-server-internal/src/deprecations/unknown_object_types.ts index fd636e0107cdb..2149fd6cfaefd 100644 --- a/src/core/server/saved_objects/deprecations/unknown_object_types.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/deprecations/unknown_object_types.ts @@ -10,9 +10,11 @@ import { i18n } from '@kbn/i18n'; import type { DeprecationsDetails } from '@kbn/core-deprecations-common'; import type { IScopedClusterClient } from '@kbn/core-elasticsearch-server'; import type { ISavedObjectTypeRegistry } from '@kbn/core-saved-objects-server'; -import { getAggregatedTypesDocuments } from '../migrations/actions/check_for_unknown_docs'; -import { addExcludedTypesToBoolQuery } from '../migrations/model/helpers'; -import { getIndexForType } from '../service/lib'; +import { getIndexForType } from '@kbn/core-saved-objects-base-server-internal'; +import { + getAggregatedTypesDocuments, + addExcludedTypesToBoolQuery, +} from '@kbn/core-saved-objects-migration-server-internal'; interface UnknownTypesDeprecationOptions { typeRegistry: ISavedObjectTypeRegistry; diff --git a/src/core/server/saved_objects/index.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/index.ts similarity index 74% rename from src/core/server/saved_objects/index.ts rename to packages/core/saved-objects/core-saved-objects-server-internal/src/index.ts index 4ccc4f1bcdb30..d655be11f2642 100644 --- a/src/core/server/saved_objects/index.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/index.ts @@ -6,19 +6,13 @@ * Side Public License, v 1. */ -export * from './service'; - -export { SavedObjectsImporter } from './import'; - -export type { SavedObjectsImportError } from './import'; - -export type { SavedObjectsExporter, SavedObjectsExportError } from './export'; - export { SavedObjectsService } from './saved_objects_service'; - export type { InternalSavedObjectsServiceStart, InternalSavedObjectsServiceSetup, } from './saved_objects_service'; - export { CoreSavedObjectsRouteHandlerContext } from './saved_objects_route_handler_context'; +export type { + InternalSavedObjectsRequestHandlerContext, + InternalSavedObjectRouter, +} from './internal_types'; diff --git a/src/core/server/saved_objects/internal_types.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/internal_types.ts similarity index 100% rename from src/core/server/saved_objects/internal_types.ts rename to packages/core/saved-objects/core-saved-objects-server-internal/src/internal_types.ts diff --git a/packages/core/saved-objects/core-saved-objects-server-internal/src/mocks/internal_mocks.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/mocks/internal_mocks.ts new file mode 100644 index 0000000000000..db000cffc9e2a --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/mocks/internal_mocks.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 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 or the Server + * Side Public License, v 1. + */ + +import type { + DeprecationsServiceSetup, + DeprecationRegistryProvider, +} from '@kbn/core-deprecations-server'; +import type { InternalCoreUsageDataSetup } from '@kbn/core-usage-data-base-server-internal'; + +export const createDeprecationsSetupMock = () => { + const setupContract: jest.Mocked = { + registerDeprecations: jest.fn(), + }; + + return setupContract; +}; + +export const createDeprecationRegistryProviderMock = () => { + const internalSetupContract: jest.Mocked = { + getRegistry: jest.fn(), + }; + + internalSetupContract.getRegistry.mockReturnValue(createDeprecationsSetupMock()); + return internalSetupContract; +}; + +export const createCoreUsageDataSetupMock = () => { + const setupContract: jest.Mocked = { + registerType: jest.fn(), + getClient: jest.fn(), + registerUsageCounter: jest.fn(), + incrementUsageCounter: jest.fn(), + }; + return setupContract; +}; diff --git a/src/core/server/saved_objects/object_types/index.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/object_types/index.ts similarity index 100% rename from src/core/server/saved_objects/object_types/index.ts rename to packages/core/saved-objects/core-saved-objects-server-internal/src/object_types/index.ts diff --git a/src/core/server/saved_objects/object_types/registration.test.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/object_types/registration.test.ts similarity index 100% rename from src/core/server/saved_objects/object_types/registration.test.ts rename to packages/core/saved-objects/core-saved-objects-server-internal/src/object_types/registration.test.ts diff --git a/src/core/server/saved_objects/object_types/registration.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/object_types/registration.ts similarity index 100% rename from src/core/server/saved_objects/object_types/registration.ts rename to packages/core/saved-objects/core-saved-objects-server-internal/src/object_types/registration.ts diff --git a/src/core/server/saved_objects/routes/bulk_create.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_create.ts similarity index 95% rename from src/core/server/saved_objects/routes/bulk_create.ts rename to packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_create.ts index 6a671c830ca69..4192e800e51d2 100644 --- a/src/core/server/saved_objects/routes/bulk_create.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_create.ts @@ -7,7 +7,7 @@ */ import { schema } from '@kbn/config-schema'; -import { InternalCoreUsageDataSetup } from '../../core_usage_data'; +import type { InternalCoreUsageDataSetup } from '@kbn/core-usage-data-base-server-internal'; import type { InternalSavedObjectRouter } from '../internal_types'; import { catchAndReturnBoomErrors } from './utils'; diff --git a/src/core/server/saved_objects/routes/bulk_get.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_get.ts similarity index 94% rename from src/core/server/saved_objects/routes/bulk_get.ts rename to packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_get.ts index ba485c832ca65..ec8d7a1c84205 100644 --- a/src/core/server/saved_objects/routes/bulk_get.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_get.ts @@ -7,7 +7,7 @@ */ import { schema } from '@kbn/config-schema'; -import { InternalCoreUsageDataSetup } from '../../core_usage_data'; +import type { InternalCoreUsageDataSetup } from '@kbn/core-usage-data-base-server-internal'; import type { InternalSavedObjectRouter } from '../internal_types'; import { catchAndReturnBoomErrors } from './utils'; diff --git a/src/core/server/saved_objects/routes/bulk_resolve.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_resolve.ts similarity index 93% rename from src/core/server/saved_objects/routes/bulk_resolve.ts rename to packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_resolve.ts index e689e243ebc95..8947719bd2ab5 100644 --- a/src/core/server/saved_objects/routes/bulk_resolve.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_resolve.ts @@ -7,7 +7,7 @@ */ import { schema } from '@kbn/config-schema'; -import { InternalCoreUsageDataSetup } from '../../core_usage_data'; +import type { InternalCoreUsageDataSetup } from '@kbn/core-usage-data-base-server-internal'; import type { InternalSavedObjectRouter } from '../internal_types'; import { catchAndReturnBoomErrors } from './utils'; diff --git a/src/core/server/saved_objects/routes/bulk_update.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_update.ts similarity index 95% rename from src/core/server/saved_objects/routes/bulk_update.ts rename to packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_update.ts index 2edfa23ed8786..dbe60203afddf 100644 --- a/src/core/server/saved_objects/routes/bulk_update.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_update.ts @@ -7,7 +7,7 @@ */ import { schema } from '@kbn/config-schema'; -import { InternalCoreUsageDataSetup } from '../../core_usage_data'; +import type { InternalCoreUsageDataSetup } from '@kbn/core-usage-data-base-server-internal'; import type { InternalSavedObjectRouter } from '../internal_types'; import { catchAndReturnBoomErrors } from './utils'; diff --git a/src/core/server/saved_objects/routes/create.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/create.ts similarity index 96% rename from src/core/server/saved_objects/routes/create.ts rename to packages/core/saved-objects/core-saved-objects-server-internal/src/routes/create.ts index 282cbafc0b2f5..2ef810ebebed7 100644 --- a/src/core/server/saved_objects/routes/create.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/create.ts @@ -7,7 +7,7 @@ */ import { schema } from '@kbn/config-schema'; -import { InternalCoreUsageDataSetup } from '../../core_usage_data'; +import type { InternalCoreUsageDataSetup } from '@kbn/core-usage-data-base-server-internal'; import type { InternalSavedObjectRouter } from '../internal_types'; import { catchAndReturnBoomErrors } from './utils'; diff --git a/src/core/server/saved_objects/routes/delete.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/delete.ts similarity index 94% rename from src/core/server/saved_objects/routes/delete.ts rename to packages/core/saved-objects/core-saved-objects-server-internal/src/routes/delete.ts index 7410a237d39f7..bfef6deb885ef 100644 --- a/src/core/server/saved_objects/routes/delete.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/delete.ts @@ -7,7 +7,7 @@ */ import { schema } from '@kbn/config-schema'; -import { InternalCoreUsageDataSetup } from '../../core_usage_data'; +import type { InternalCoreUsageDataSetup } from '@kbn/core-usage-data-base-server-internal'; import type { InternalSavedObjectRouter } from '../internal_types'; import { catchAndReturnBoomErrors } from './utils'; diff --git a/src/core/server/saved_objects/routes/deprecations/delete_unknown_types.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/deprecations/delete_unknown_types.ts similarity index 100% rename from src/core/server/saved_objects/routes/deprecations/delete_unknown_types.ts rename to packages/core/saved-objects/core-saved-objects-server-internal/src/routes/deprecations/delete_unknown_types.ts diff --git a/src/core/server/saved_objects/routes/deprecations/index.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/deprecations/index.ts similarity index 100% rename from src/core/server/saved_objects/routes/deprecations/index.ts rename to packages/core/saved-objects/core-saved-objects-server-internal/src/routes/deprecations/index.ts diff --git a/src/core/server/saved_objects/routes/export.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/export.ts similarity index 97% rename from src/core/server/saved_objects/routes/export.ts rename to packages/core/saved-objects/core-saved-objects-server-internal/src/routes/export.ts index 0ab75a3c7101d..1d8a55b9e3fdc 100644 --- a/src/core/server/saved_objects/routes/export.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/export.ts @@ -16,8 +16,8 @@ import type { SavedObjectsExportByObjectOptions, } from '@kbn/core-saved-objects-server'; import type { SavedObjectConfig } from '@kbn/core-saved-objects-base-server-internal'; -import { InternalCoreUsageDataSetup } from '../../core_usage_data'; -import { SavedObjectsExportError } from '../export'; +import { SavedObjectsExportError } from '@kbn/core-saved-objects-import-export-server-internal'; +import type { InternalCoreUsageDataSetup } from '@kbn/core-usage-data-base-server-internal'; import type { InternalSavedObjectRouter } from '../internal_types'; import { validateTypes, validateObjects, catchAndReturnBoomErrors } from './utils'; diff --git a/src/core/server/saved_objects/routes/find.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/find.ts similarity index 97% rename from src/core/server/saved_objects/routes/find.ts rename to packages/core/saved-objects/core-saved-objects-server-internal/src/routes/find.ts index 7ebfef5be7c39..4587cb1ebeb09 100644 --- a/src/core/server/saved_objects/routes/find.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/find.ts @@ -7,7 +7,7 @@ */ import { schema } from '@kbn/config-schema'; -import { InternalCoreUsageDataSetup } from '../../core_usage_data'; +import type { InternalCoreUsageDataSetup } from '@kbn/core-usage-data-base-server-internal'; import type { InternalSavedObjectRouter } from '../internal_types'; import { catchAndReturnBoomErrors } from './utils'; diff --git a/src/core/server/saved_objects/routes/get.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/get.ts similarity index 93% rename from src/core/server/saved_objects/routes/get.ts rename to packages/core/saved-objects/core-saved-objects-server-internal/src/routes/get.ts index e7a2a779c4037..dbe2c1a4d9d8d 100644 --- a/src/core/server/saved_objects/routes/get.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/get.ts @@ -7,7 +7,7 @@ */ import { schema } from '@kbn/config-schema'; -import { InternalCoreUsageDataSetup } from '../../core_usage_data'; +import type { InternalCoreUsageDataSetup } from '@kbn/core-usage-data-base-server-internal'; import type { InternalSavedObjectRouter } from '../internal_types'; import { catchAndReturnBoomErrors } from './utils'; diff --git a/src/core/server/saved_objects/routes/import.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/import.ts similarity index 94% rename from src/core/server/saved_objects/routes/import.ts rename to packages/core/saved-objects/core-saved-objects-server-internal/src/routes/import.ts index 717cc50a13e60..8e8722ae588c0 100644 --- a/src/core/server/saved_objects/routes/import.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/import.ts @@ -10,8 +10,8 @@ import { Readable } from 'stream'; import { extname } from 'path'; import { schema } from '@kbn/config-schema'; import type { SavedObjectConfig } from '@kbn/core-saved-objects-base-server-internal'; -import { InternalCoreUsageDataSetup } from '../../core_usage_data'; -import { SavedObjectsImportError } from '../import'; +import { SavedObjectsImportError } from '@kbn/core-saved-objects-import-export-server-internal'; +import type { InternalCoreUsageDataSetup } from '@kbn/core-usage-data-base-server-internal'; import type { InternalSavedObjectRouter } from '../internal_types'; import { catchAndReturnBoomErrors, createSavedObjectsStreamFromNdJson } from './utils'; diff --git a/src/core/server/saved_objects/routes/index.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/index.ts similarity index 94% rename from src/core/server/saved_objects/routes/index.ts rename to packages/core/saved-objects/core-saved-objects-server-internal/src/routes/index.ts index f49c604a37c0c..528793e8539bd 100644 --- a/src/core/server/saved_objects/routes/index.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/index.ts @@ -8,9 +8,11 @@ import type { Logger } from '@kbn/logging'; import type { InternalHttpServiceSetup } from '@kbn/core-http-server-internal'; -import type { SavedObjectConfig } from '@kbn/core-saved-objects-base-server-internal'; -import { InternalCoreUsageDataSetup } from '../../core_usage_data'; -import { IKibanaMigrator } from '../migrations'; +import type { + SavedObjectConfig, + IKibanaMigrator, +} from '@kbn/core-saved-objects-base-server-internal'; +import type { InternalCoreUsageDataSetup } from '@kbn/core-usage-data-base-server-internal'; import type { InternalSavedObjectsRequestHandlerContext } from '../internal_types'; import { registerGetRoute } from './get'; import { registerResolveRoute } from './resolve'; diff --git a/src/core/server/saved_objects/routes/legacy_import_export/export.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/legacy_import_export/export.ts similarity index 95% rename from src/core/server/saved_objects/routes/legacy_import_export/export.ts rename to packages/core/saved-objects/core-saved-objects-server-internal/src/routes/legacy_import_export/export.ts index 9073090de8fe7..3ccbee914e8b1 100644 --- a/src/core/server/saved_objects/routes/legacy_import_export/export.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/legacy_import_export/export.ts @@ -9,7 +9,7 @@ import moment from 'moment'; import { schema } from '@kbn/config-schema'; import type { Logger } from '@kbn/logging'; -import { InternalCoreUsageDataSetup } from '../../../core_usage_data'; +import type { InternalCoreUsageDataSetup } from '@kbn/core-usage-data-base-server-internal'; import type { InternalSavedObjectRouter } from '../../internal_types'; import { exportDashboards } from './lib'; diff --git a/src/core/server/saved_objects/routes/legacy_import_export/import.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/legacy_import_export/import.ts similarity index 93% rename from src/core/server/saved_objects/routes/legacy_import_export/import.ts rename to packages/core/saved-objects/core-saved-objects-server-internal/src/routes/legacy_import_export/import.ts index d4a13b2973964..44ee99aa2c970 100644 --- a/src/core/server/saved_objects/routes/legacy_import_export/import.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/legacy_import_export/import.ts @@ -8,8 +8,8 @@ import { schema } from '@kbn/config-schema'; import type { Logger } from '@kbn/logging'; -import type { SavedObject } from '../../..'; -import { InternalCoreUsageDataSetup } from '../../../core_usage_data'; +import type { SavedObject } from '@kbn/core-saved-objects-common'; +import type { InternalCoreUsageDataSetup } from '@kbn/core-usage-data-base-server-internal'; import type { InternalSavedObjectRouter } from '../../internal_types'; import { importDashboards } from './lib'; diff --git a/src/core/server/saved_objects/routes/legacy_import_export/lib/collect_references_deep.test.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/legacy_import_export/lib/collect_references_deep.test.ts similarity index 98% rename from src/core/server/saved_objects/routes/legacy_import_export/lib/collect_references_deep.test.ts rename to packages/core/saved-objects/core-saved-objects-server-internal/src/routes/legacy_import_export/lib/collect_references_deep.test.ts index 257fa594d2bc7..4470983fafc62 100644 --- a/src/core/server/saved_objects/routes/legacy_import_export/lib/collect_references_deep.test.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/legacy_import_export/lib/collect_references_deep.test.ts @@ -7,7 +7,7 @@ */ import type { SavedObject, SavedObjectAttributes } from '@kbn/core-saved-objects-common'; -import { savedObjectsClientMock } from '../../../../mocks'; +import { savedObjectsClientMock } from '@kbn/core-saved-objects-api-server-mocks'; import { collectReferencesDeep } from './collect_references_deep'; const data: Array> = [ diff --git a/src/core/server/saved_objects/routes/legacy_import_export/lib/collect_references_deep.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/legacy_import_export/lib/collect_references_deep.ts similarity index 89% rename from src/core/server/saved_objects/routes/legacy_import_export/lib/collect_references_deep.ts rename to packages/core/saved-objects/core-saved-objects-server-internal/src/routes/legacy_import_export/lib/collect_references_deep.ts index a02fc37e4b863..0c193f618624d 100644 --- a/src/core/server/saved_objects/routes/legacy_import_export/lib/collect_references_deep.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/legacy_import_export/lib/collect_references_deep.ts @@ -6,7 +6,8 @@ * Side Public License, v 1. */ -import { SavedObject, SavedObjectsClientContract } from '../../../..'; +import type { SavedObject } from '@kbn/core-saved-objects-common'; +import type { SavedObjectsClientContract } from '@kbn/core-saved-objects-api-server'; const MAX_BULK_GET_SIZE = 10000; diff --git a/src/core/server/saved_objects/routes/legacy_import_export/lib/export_dashboards.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/legacy_import_export/lib/export_dashboards.ts similarity index 90% rename from src/core/server/saved_objects/routes/legacy_import_export/lib/export_dashboards.ts rename to packages/core/saved-objects/core-saved-objects-server-internal/src/routes/legacy_import_export/lib/export_dashboards.ts index 9d0ed7889cdc7..8b069ee31f91a 100644 --- a/src/core/server/saved_objects/routes/legacy_import_export/lib/export_dashboards.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/legacy_import_export/lib/export_dashboards.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { SavedObjectsClientContract } from '../../../..'; +import type { SavedObjectsClientContract } from '@kbn/core-saved-objects-api-server'; import { collectReferencesDeep } from './collect_references_deep'; export async function exportDashboards( diff --git a/src/core/server/saved_objects/routes/legacy_import_export/lib/import_dashboards.test.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/legacy_import_export/lib/import_dashboards.test.ts similarity index 94% rename from src/core/server/saved_objects/routes/legacy_import_export/lib/import_dashboards.test.ts rename to packages/core/saved-objects/core-saved-objects-server-internal/src/routes/legacy_import_export/lib/import_dashboards.test.ts index 3d23fb1b9022c..87452664ac517 100644 --- a/src/core/server/saved_objects/routes/legacy_import_export/lib/import_dashboards.test.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/legacy_import_export/lib/import_dashboards.test.ts @@ -6,8 +6,8 @@ * Side Public License, v 1. */ -import { savedObjectsClientMock } from '../../../../mocks'; -import { SavedObject } from '../../../..'; +import type { SavedObject } from '@kbn/core-saved-objects-common'; +import { savedObjectsClientMock } from '@kbn/core-saved-objects-api-server-mocks'; import { importDashboards } from './import_dashboards'; describe('importDashboards(req)', () => { diff --git a/src/core/server/saved_objects/routes/legacy_import_export/lib/import_dashboards.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/legacy_import_export/lib/import_dashboards.ts similarity index 89% rename from src/core/server/saved_objects/routes/legacy_import_export/lib/import_dashboards.ts rename to packages/core/saved-objects/core-saved-objects-server-internal/src/routes/legacy_import_export/lib/import_dashboards.ts index 11192cc0ad2f4..51a63f23322bf 100644 --- a/src/core/server/saved_objects/routes/legacy_import_export/lib/import_dashboards.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/legacy_import_export/lib/import_dashboards.ts @@ -6,7 +6,8 @@ * Side Public License, v 1. */ -import { SavedObject, SavedObjectsClientContract } from '../../../..'; +import type { SavedObject } from '@kbn/core-saved-objects-common'; +import type { SavedObjectsClientContract } from '@kbn/core-saved-objects-api-server'; export async function importDashboards( savedObjectsClient: SavedObjectsClientContract, diff --git a/src/core/server/saved_objects/routes/legacy_import_export/lib/index.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/legacy_import_export/lib/index.ts similarity index 100% rename from src/core/server/saved_objects/routes/legacy_import_export/lib/index.ts rename to packages/core/saved-objects/core-saved-objects-server-internal/src/routes/legacy_import_export/lib/index.ts diff --git a/src/core/server/saved_objects/routes/migrate.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/migrate.ts similarity index 92% rename from src/core/server/saved_objects/routes/migrate.ts rename to packages/core/saved-objects/core-saved-objects-server-internal/src/routes/migrate.ts index 05579855cbfc3..2222b17c4e6f9 100644 --- a/src/core/server/saved_objects/routes/migrate.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/migrate.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { IKibanaMigrator } from '../migrations'; +import type { IKibanaMigrator } from '@kbn/core-saved-objects-base-server-internal'; import type { InternalSavedObjectRouter } from '../internal_types'; import { catchAndReturnBoomErrors } from './utils'; diff --git a/src/core/server/saved_objects/routes/resolve.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/resolve.ts similarity index 93% rename from src/core/server/saved_objects/routes/resolve.ts rename to packages/core/saved-objects/core-saved-objects-server-internal/src/routes/resolve.ts index b0a7153e8d226..a1804c1fa3176 100644 --- a/src/core/server/saved_objects/routes/resolve.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/resolve.ts @@ -7,7 +7,7 @@ */ import { schema } from '@kbn/config-schema'; -import { InternalCoreUsageDataSetup } from '../../core_usage_data'; +import type { InternalCoreUsageDataSetup } from '@kbn/core-usage-data-base-server-internal'; import type { InternalSavedObjectRouter } from '../internal_types'; interface RouteDependencies { diff --git a/src/core/server/saved_objects/routes/resolve_import_errors.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/resolve_import_errors.ts similarity index 95% rename from src/core/server/saved_objects/routes/resolve_import_errors.ts rename to packages/core/saved-objects/core-saved-objects-server-internal/src/routes/resolve_import_errors.ts index ed919693e1b86..26380bd2aea84 100644 --- a/src/core/server/saved_objects/routes/resolve_import_errors.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/resolve_import_errors.ts @@ -11,8 +11,8 @@ import { Readable } from 'stream'; import { chain } from 'lodash'; import { schema } from '@kbn/config-schema'; import type { SavedObjectConfig } from '@kbn/core-saved-objects-base-server-internal'; -import { InternalCoreUsageDataSetup } from '../../core_usage_data'; -import { SavedObjectsImportError } from '../import'; +import { SavedObjectsImportError } from '@kbn/core-saved-objects-import-export-server-internal'; +import type { InternalCoreUsageDataSetup } from '@kbn/core-usage-data-base-server-internal'; import type { InternalSavedObjectRouter } from '../internal_types'; import { catchAndReturnBoomErrors, createSavedObjectsStreamFromNdJson } from './utils'; diff --git a/src/core/server/saved_objects/routes/update.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/update.ts similarity index 95% rename from src/core/server/saved_objects/routes/update.ts rename to packages/core/saved-objects/core-saved-objects-server-internal/src/routes/update.ts index 0d9e4b9cdcf46..463b5465b53a0 100644 --- a/src/core/server/saved_objects/routes/update.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/update.ts @@ -8,7 +8,7 @@ import { schema } from '@kbn/config-schema'; import type { SavedObjectsUpdateOptions } from '@kbn/core-saved-objects-api-server'; -import { InternalCoreUsageDataSetup } from '../../core_usage_data'; +import type { InternalCoreUsageDataSetup } from '@kbn/core-usage-data-base-server-internal'; import type { InternalSavedObjectRouter } from '../internal_types'; import { catchAndReturnBoomErrors } from './utils'; diff --git a/src/core/server/saved_objects/routes/utils.test.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/utils.test.ts similarity index 100% rename from src/core/server/saved_objects/routes/utils.test.ts rename to packages/core/saved-objects/core-saved-objects-server-internal/src/routes/utils.test.ts diff --git a/src/core/server/saved_objects/routes/utils.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/utils.ts similarity index 92% rename from src/core/server/saved_objects/routes/utils.ts rename to packages/core/saved-objects/core-saved-objects-server-internal/src/routes/utils.ts index 54a15f599c307..463d59baf6207 100644 --- a/src/core/server/saved_objects/routes/utils.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/utils.ts @@ -16,7 +16,9 @@ import { createConcatStream, } from '@kbn/utils'; import Boom from '@hapi/boom'; -import { RequestHandlerWrapper, SavedObject, SavedObjectsExportResultDetails } from '../..'; +import type { RequestHandlerWrapper } from '@kbn/core-http-server'; +import type { SavedObject } from '@kbn/core-saved-objects-common'; +import type { SavedObjectsExportResultDetails } from '@kbn/core-saved-objects-server'; export async function createSavedObjectsStreamFromNdJson(ndJsonStream: Readable) { const savedObjects = await createPromiseFromStreams([ diff --git a/src/core/server/saved_objects/saved_objects_route_handler_context.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/saved_objects_route_handler_context.ts similarity index 100% rename from src/core/server/saved_objects/saved_objects_route_handler_context.ts rename to packages/core/saved-objects/core-saved-objects-server-internal/src/saved_objects_route_handler_context.ts diff --git a/src/core/server/saved_objects/saved_objects_service.test.mocks.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/saved_objects_service.test.mocks.ts similarity index 55% rename from src/core/server/saved_objects/saved_objects_service.test.mocks.ts rename to packages/core/saved-objects/core-saved-objects-server-internal/src/saved_objects_service.test.mocks.ts index 4b66f5865def5..54090e9fb1b18 100644 --- a/src/core/server/saved_objects/saved_objects_service.test.mocks.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/saved_objects_service.test.mocks.ts @@ -6,20 +6,36 @@ * Side Public License, v 1. */ -import { mockKibanaMigrator } from './migrations/kibana_migrator.mock'; -import { savedObjectsClientProviderMock } from './service/lib/scoped_client_provider.mock'; +import { mockKibanaMigrator } from '@kbn/core-saved-objects-migration-server-mocks'; +import { + savedObjectsClientProviderMock, + savedObjectsRepositoryMock, +} from '@kbn/core-saved-objects-api-server-mocks'; import { typeRegistryMock } from '@kbn/core-saved-objects-base-server-mocks'; export const migratorInstanceMock = mockKibanaMigrator.create(); export const KibanaMigratorMock = jest.fn().mockImplementation(() => migratorInstanceMock); -jest.doMock('./migrations/kibana_migrator', () => ({ - KibanaMigrator: KibanaMigratorMock, -})); +jest.doMock('@kbn/core-saved-objects-migration-server-internal', () => { + const actual = jest.requireActual('@kbn/core-saved-objects-migration-server-internal'); + return { + ...actual, + KibanaMigrator: KibanaMigratorMock, + }; +}); export const clientProviderInstanceMock = savedObjectsClientProviderMock.create(); -jest.doMock('./service/lib/scoped_client_provider', () => ({ - SavedObjectsClientProvider: jest.fn().mockImplementation(() => clientProviderInstanceMock), -})); +export const repositoryMock = savedObjectsRepositoryMock.create(); + +jest.doMock('@kbn/core-saved-objects-api-server-internal', () => { + const actual = jest.requireActual('@kbn/core-saved-objects-api-server-internal'); + return { + ...actual, + SavedObjectsRepository: { + createRepository: jest.fn().mockImplementation(() => repositoryMock), + }, + SavedObjectsClientProvider: jest.fn().mockImplementation(() => clientProviderInstanceMock), + }; +}); export const typeRegistryInstanceMock = typeRegistryMock.create(); jest.doMock('@kbn/core-saved-objects-base-server-internal', () => { diff --git a/src/core/server/saved_objects/saved_objects_service.test.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/saved_objects_service.test.ts similarity index 96% rename from src/core/server/saved_objects/saved_objects_service.test.ts rename to packages/core/saved-objects/core-saved-objects-server-internal/src/saved_objects_service.test.ts index a862aa1e039e8..e906f119a6575 100644 --- a/src/core/server/saved_objects/saved_objects_service.test.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/saved_objects_service.test.ts @@ -26,26 +26,30 @@ import { docLinksServiceMock } from '@kbn/core-doc-links-server-mocks'; import { mockCoreContext } from '@kbn/core-base-server-mocks'; import { httpServiceMock, httpServerMock } from '@kbn/core-http-server-mocks'; import type { SavedObjectsClientFactoryProvider } from '@kbn/core-saved-objects-server'; +import { configServiceMock } from '@kbn/config-mocks'; +import type { NodesVersionCompatibility } from '@kbn/core-elasticsearch-server-internal'; +import { SavedObjectsRepository } from '@kbn/core-saved-objects-api-server-internal'; +import { elasticsearchServiceMock } from '@kbn/core-elasticsearch-server-mocks'; import { SavedObjectsService } from './saved_objects_service'; -import { configServiceMock } from '../mocks'; -import { elasticsearchServiceMock } from '@kbn/core-elasticsearch-server-mocks'; -import { coreUsageDataServiceMock } from '../core_usage_data/core_usage_data_service.mock'; -import { deprecationsServiceMock } from '../deprecations/deprecations_service.mock'; -import type { NodesVersionCompatibility } from '@kbn/core-elasticsearch-server-internal'; -import { SavedObjectsRepository } from './service/lib/repository'; + +import { + createDeprecationsSetupMock, + createDeprecationRegistryProviderMock, + createCoreUsageDataSetupMock, +} from './mocks/internal_mocks'; + import { registerCoreObjectTypes } from './object_types'; import { getSavedObjectsDeprecationsProvider } from './deprecations'; -jest.mock('./service/lib/repository'); jest.mock('./object_types'); jest.mock('./deprecations'); describe('SavedObjectsService', () => { - let deprecationsSetup: ReturnType; + let deprecationsSetup: ReturnType; beforeEach(() => { - deprecationsSetup = deprecationsServiceMock.createInternalSetupContract(); + deprecationsSetup = createDeprecationRegistryProviderMock(); }); const createCoreContext = ({ @@ -71,7 +75,7 @@ describe('SavedObjectsService', () => { http: httpServiceMock.createInternalSetupContract(), elasticsearch: elasticsearchMock, deprecations: deprecationsSetup, - coreUsageData: coreUsageDataServiceMock.createSetupContract(), + coreUsageData: createCoreUsageDataSetupMock(), }; }; @@ -102,7 +106,7 @@ describe('SavedObjectsService', () => { const coreContext = createCoreContext(); const soService = new SavedObjectsService(coreContext); - const mockRegistry = deprecationsServiceMock.createSetupContract(); + const mockRegistry = createDeprecationsSetupMock(); deprecationsSetup.getRegistry.mockReturnValue(mockRegistry); const deprecations = Symbol('deprecations'); diff --git a/src/core/server/saved_objects/saved_objects_service.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/saved_objects_service.ts similarity index 94% rename from src/core/server/saved_objects/saved_objects_service.ts rename to packages/core/saved-objects/core-saved-objects-server-internal/src/saved_objects_service.ts index 542a13e3a4cc0..c158bb758f624 100644 --- a/src/core/server/saved_objects/saved_objects_service.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/saved_objects_service.ts @@ -9,6 +9,7 @@ import { Subject, Observable, firstValueFrom } from 'rxjs'; import { filter, take, switchMap } from 'rxjs/operators'; import type { Logger } from '@kbn/logging'; +import type { ServiceStatus } from '@kbn/core-base-common'; import type { CoreContext, CoreService } from '@kbn/core-base-server-internal'; import type { DocLinksServiceStart } from '@kbn/core-doc-links-server'; import type { KibanaRequest } from '@kbn/core-http-server'; @@ -33,16 +34,21 @@ import { SavedObjectTypeRegistry, type SavedObjectsConfigType, type SavedObjectsMigrationConfigType, + type IKibanaMigrator, } from '@kbn/core-saved-objects-base-server-internal'; -import { SavedObjectsClient, SavedObjectsClientProvider } from './service'; -import { KibanaMigrator, IKibanaMigrator } from './migrations'; -import { InternalCoreUsageDataSetup } from '../core_usage_data'; -import { InternalDeprecationsServiceSetup } from '../deprecations'; -import { SavedObjectsRepository } from './service/lib/repository'; -import { SavedObjectsExporter } from './export'; -import { SavedObjectsImporter } from './import'; +import { + SavedObjectsClient, + SavedObjectsClientProvider, +} from '@kbn/core-saved-objects-api-server-internal'; +import { KibanaMigrator } from '@kbn/core-saved-objects-migration-server-internal'; +import { SavedObjectsRepository } from '@kbn/core-saved-objects-api-server-internal'; +import { + SavedObjectsExporter, + SavedObjectsImporter, +} from '@kbn/core-saved-objects-import-export-server-internal'; +import type { InternalCoreUsageDataSetup } from '@kbn/core-usage-data-base-server-internal'; +import type { DeprecationRegistryProvider } from '@kbn/core-deprecations-server'; import { registerRoutes } from './routes'; -import { ServiceStatus } from '../status'; import { calculateStatus$ } from './status'; import { registerCoreObjectTypes } from './object_types'; import { getSavedObjectsDeprecationsProvider } from './deprecations'; @@ -65,7 +71,7 @@ export interface SavedObjectsSetupDeps { http: InternalHttpServiceSetup; elasticsearch: InternalElasticsearchServiceSetup; coreUsageData: InternalCoreUsageDataSetup; - deprecations: InternalDeprecationsServiceSetup; + deprecations: DeprecationRegistryProvider; } interface WrappedClientFactoryWrapper { diff --git a/src/core/server/saved_objects/status.test.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/status.test.ts similarity index 98% rename from src/core/server/saved_objects/status.test.ts rename to packages/core/saved-objects/core-saved-objects-server-internal/src/status.test.ts index c830383c6eb60..3565ab406feb3 100644 --- a/src/core/server/saved_objects/status.test.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/status.test.ts @@ -7,7 +7,7 @@ */ import { of, Observable } from 'rxjs'; -import { ServiceStatus, ServiceStatusLevels } from '../status'; +import { type ServiceStatus, ServiceStatusLevels } from '@kbn/core-base-common'; import { calculateStatus$ } from './status'; import { take } from 'rxjs/operators'; diff --git a/src/core/server/saved_objects/status.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/status.ts similarity index 94% rename from src/core/server/saved_objects/status.ts rename to packages/core/saved-objects/core-saved-objects-server-internal/src/status.ts index 03f429dce62be..65c7b21874881 100644 --- a/src/core/server/saved_objects/status.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/status.ts @@ -8,9 +8,9 @@ import { Observable, combineLatest } from 'rxjs'; import { startWith, map } from 'rxjs/operators'; +import { type ServiceStatus, ServiceStatusLevels } from '@kbn/core-base-common'; import type { SavedObjectStatusMeta } from '@kbn/core-saved-objects-server'; -import { ServiceStatus, ServiceStatusLevels } from '../status'; -import { KibanaMigratorStatus } from './migrations'; +import type { KibanaMigratorStatus } from '@kbn/core-saved-objects-base-server-internal'; export const calculateStatus$ = ( rawMigratorStatus$: Observable, diff --git a/packages/core/saved-objects/core-saved-objects-server-internal/tsconfig.json b/packages/core/saved-objects/core-saved-objects-server-internal/tsconfig.json new file mode 100644 index 0000000000000..ff8b3da96b4db --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-server-internal/tsconfig.json @@ -0,0 +1,18 @@ +{ + "extends": "../../../../tsconfig.bazel.json", + "compilerOptions": { + "declaration": true, + "declarationMap": true, + "emitDeclarationOnly": true, + "outDir": "target_types", + "rootDir": ".", + "stripInternal": false, + "types": [ + "jest", + "node" + ] + }, + "include": [ + "**/*.ts", + ] +} diff --git a/packages/core/saved-objects/core-saved-objects-server-mocks/BUILD.bazel b/packages/core/saved-objects/core-saved-objects-server-mocks/BUILD.bazel new file mode 100644 index 0000000000000..2720f07e77aa9 --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-server-mocks/BUILD.bazel @@ -0,0 +1,120 @@ +load("@npm//@bazel/typescript:index.bzl", "ts_config") +load("@build_bazel_rules_nodejs//:index.bzl", "js_library") +load("//src/dev/bazel:index.bzl", "jsts_transpiler", "pkg_npm", "pkg_npm_types", "ts_project") + +PKG_DIRNAME = "core-saved-objects-server-mocks" +PKG_REQUIRE_NAME = "@kbn/core-saved-objects-server-mocks" + +SOURCE_FILES = glob( + [ + "**/*.ts", + ], + exclude = [ + "**/*.config.js", + "**/*.test.*", + "**/*.stories.*", + "**/__snapshots__", + "**/integration_tests", + "**/mocks", + "**/scripts", + "**/storybook", + "**/test_fixtures", + "**/test_helpers", + ], +) + +SRCS = SOURCE_FILES + +filegroup( + name = "srcs", + srcs = SRCS, +) + +NPM_MODULE_EXTRA_FILES = [ + "package.json", +] + +RUNTIME_DEPS = [ + "@npm//rxjs", + "//packages/core/base/core-base-common", + "//packages/core/saved-objects/core-saved-objects-api-server-mocks", + "//packages/core/saved-objects/core-saved-objects-base-server-mocks", + "//packages/core/saved-objects/core-saved-objects-import-export-server-mocks", + "//packages/core/saved-objects/core-saved-objects-migration-server-mocks", +] + +TYPES_DEPS = [ + "@npm//@types/node", + "@npm//@types/jest", + "@npm//rxjs", + "//packages/kbn-utility-types:npm_module_types", + "//packages/core/base/core-base-common:npm_module_types", + "//packages/core/saved-objects/core-saved-objects-server:npm_module_types", + "//packages/core/saved-objects/core-saved-objects-server-internal:npm_module_types", + "//packages/core/saved-objects/core-saved-objects-api-server-mocks:npm_module_types", + "//packages/core/saved-objects/core-saved-objects-base-server-mocks:npm_module_types", + "//packages/core/saved-objects/core-saved-objects-import-export-server-mocks:npm_module_types", + "//packages/core/saved-objects/core-saved-objects-migration-server-mocks:npm_module_types", +] + +jsts_transpiler( + name = "target_node", + srcs = SRCS, + build_pkg_name = package_name(), +) + +ts_config( + name = "tsconfig", + src = "tsconfig.json", + deps = [ + "//:tsconfig.base.json", + "//:tsconfig.bazel.json", + ], +) + +ts_project( + name = "tsc_types", + args = ['--pretty'], + srcs = SRCS, + deps = TYPES_DEPS, + declaration = True, + declaration_map = True, + emit_declaration_only = True, + out_dir = "target_types", + root_dir = ".", + tsconfig = ":tsconfig", +) + +js_library( + name = PKG_DIRNAME, + srcs = NPM_MODULE_EXTRA_FILES, + deps = RUNTIME_DEPS + [":target_node"], + package_name = PKG_REQUIRE_NAME, + visibility = ["//visibility:public"], +) + +pkg_npm( + name = "npm_module", + deps = [":" + PKG_DIRNAME], +) + +filegroup( + name = "build", + srcs = [":npm_module"], + visibility = ["//visibility:public"], +) + +pkg_npm_types( + name = "npm_module_types", + srcs = SRCS, + deps = [":tsc_types"], + package_name = PKG_REQUIRE_NAME, + tsconfig = ":tsconfig", + visibility = ["//visibility:public"], +) + +filegroup( + name = "build_types", + srcs = [":npm_module_types"], + visibility = ["//visibility:public"], +) diff --git a/packages/core/saved-objects/core-saved-objects-server-mocks/README.md b/packages/core/saved-objects/core-saved-objects-server-mocks/README.md new file mode 100644 index 0000000000000..9b00d3abd25e5 --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-server-mocks/README.md @@ -0,0 +1,5 @@ +# @kbn/core-saved-objects-server-mocks + +This package contains the mocks for core's server-side savedObjects service. +- savedObjectsServiceMock + diff --git a/packages/core/saved-objects/core-saved-objects-server-mocks/index.ts b/packages/core/saved-objects/core-saved-objects-server-mocks/index.ts new file mode 100644 index 0000000000000..c130553aba7c9 --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-server-mocks/index.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 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 or the Server + * Side Public License, v 1. + */ + +export { savedObjectsServiceMock } from './src'; diff --git a/packages/core/saved-objects/core-saved-objects-server-mocks/jest.config.js b/packages/core/saved-objects/core-saved-objects-server-mocks/jest.config.js new file mode 100644 index 0000000000000..95cc344bb33a0 --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-server-mocks/jest.config.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 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 or the Server + * Side Public License, v 1. + */ + +module.exports = { + preset: '@kbn/test/jest_node', + rootDir: '../../../..', + roots: ['/packages/core/saved-objects/core-saved-objects-server-mocks'], +}; diff --git a/packages/core/saved-objects/core-saved-objects-server-mocks/package.json b/packages/core/saved-objects/core-saved-objects-server-mocks/package.json new file mode 100644 index 0000000000000..1bbda68c5d8e4 --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-server-mocks/package.json @@ -0,0 +1,8 @@ +{ + "name": "@kbn/core-saved-objects-server-mocks", + "private": true, + "version": "1.0.0", + "main": "./target_node/index.js", + "author": "Kibana Core", + "license": "SSPL-1.0 OR Elastic License 2.0" +} diff --git a/packages/core/saved-objects/core-saved-objects-server-mocks/src/index.ts b/packages/core/saved-objects/core-saved-objects-server-mocks/src/index.ts new file mode 100644 index 0000000000000..eb6cf3d8deec8 --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-server-mocks/src/index.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 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 or the Server + * Side Public License, v 1. + */ + +export { savedObjectsServiceMock } from './saved_objects_service.mock'; diff --git a/src/core/server/saved_objects/saved_objects_service.mock.ts b/packages/core/saved-objects/core-saved-objects-server-mocks/src/saved_objects_service.mock.ts similarity index 89% rename from src/core/server/saved_objects/saved_objects_service.mock.ts rename to packages/core/saved-objects/core-saved-objects-server-mocks/src/saved_objects_service.mock.ts index f1a1ce6c091b6..3b06cc2c6f3c9 100644 --- a/src/core/server/saved_objects/saved_objects_service.mock.ts +++ b/packages/core/saved-objects/core-saved-objects-server-mocks/src/saved_objects_service.mock.ts @@ -8,6 +8,7 @@ import { BehaviorSubject } from 'rxjs'; import type { PublicMethodsOf } from '@kbn/utility-types'; +import { ServiceStatusLevels } from '@kbn/core-base-common'; import type { SavedObjectsServiceSetup, SavedObjectsServiceStart, @@ -17,15 +18,17 @@ import type { SavedObjectsService, InternalSavedObjectsServiceSetup, InternalSavedObjectsServiceStart, -} from './saved_objects_service'; - -import { savedObjectsRepositoryMock } from './service/lib/repository.mock'; -import { savedObjectsClientMock } from './service/saved_objects_client.mock'; +} from '@kbn/core-saved-objects-server-internal'; +import { + savedObjectsRepositoryMock, + savedObjectsClientMock, +} from '@kbn/core-saved-objects-api-server-mocks'; import { typeRegistryMock, serializerMock } from '@kbn/core-saved-objects-base-server-mocks'; -import { savedObjectsExporterMock } from './export/saved_objects_exporter.mock'; -import { savedObjectsImporterMock } from './import/saved_objects_importer.mock'; -import { migrationMocks } from './migrations/mocks'; -import { ServiceStatusLevels } from '../status'; +import { + savedObjectsExporterMock, + savedObjectsImporterMock, +} from '@kbn/core-saved-objects-import-export-server-mocks'; +import { migrationMocks } from '@kbn/core-saved-objects-migration-server-mocks'; type SavedObjectsServiceContract = PublicMethodsOf; diff --git a/packages/core/saved-objects/core-saved-objects-server-mocks/tsconfig.json b/packages/core/saved-objects/core-saved-objects-server-mocks/tsconfig.json new file mode 100644 index 0000000000000..ff8b3da96b4db --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-server-mocks/tsconfig.json @@ -0,0 +1,18 @@ +{ + "extends": "../../../../tsconfig.bazel.json", + "compilerOptions": { + "declaration": true, + "declarationMap": true, + "emitDeclarationOnly": true, + "outDir": "target_types", + "rootDir": ".", + "stripInternal": false, + "types": [ + "jest", + "node" + ] + }, + "include": [ + "**/*.ts", + ] +} diff --git a/packages/core/saved-objects/core-saved-objects-utils-server/package.json b/packages/core/saved-objects/core-saved-objects-utils-server/package.json index 13220da373261..eb223e7f49ebb 100644 --- a/packages/core/saved-objects/core-saved-objects-utils-server/package.json +++ b/packages/core/saved-objects/core-saved-objects-utils-server/package.json @@ -3,5 +3,6 @@ "private": true, "version": "1.0.0", "main": "./target_node/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/usage-data/core-usage-data-base-server-internal/BUILD.bazel b/packages/core/usage-data/core-usage-data-base-server-internal/BUILD.bazel new file mode 100644 index 0000000000000..62219c02bc49e --- /dev/null +++ b/packages/core/usage-data/core-usage-data-base-server-internal/BUILD.bazel @@ -0,0 +1,109 @@ +load("@npm//@bazel/typescript:index.bzl", "ts_config") +load("@build_bazel_rules_nodejs//:index.bzl", "js_library") +load("//src/dev/bazel:index.bzl", "jsts_transpiler", "pkg_npm", "pkg_npm_types", "ts_project") + +PKG_DIRNAME = "core-usage-data-base-server-internal" +PKG_REQUIRE_NAME = "@kbn/core-usage-data-base-server-internal" + +SOURCE_FILES = glob( + [ + "**/*.ts", + ], + exclude = [ + "**/*.config.js", + "**/*.mock.*", + "**/*.test.*", + "**/*.stories.*", + "**/__snapshots__", + "**/integration_tests", + "**/mocks", + "**/scripts", + "**/storybook", + "**/test_fixtures", + "**/test_helpers", + ], +) + +SRCS = SOURCE_FILES + +filegroup( + name = "srcs", + srcs = SRCS, +) + +NPM_MODULE_EXTRA_FILES = [ + "package.json", +] + +RUNTIME_DEPS = [ +] + +TYPES_DEPS = [ + "@npm//@types/node", + "@npm//@types/jest", + "//packages/core/http/core-http-server:npm_module_types", + "//packages/core/usage-data/core-usage-data-server:npm_module_types", + "//packages/core/saved-objects/core-saved-objects-server:npm_module_types", +] + +jsts_transpiler( + name = "target_node", + srcs = SRCS, + build_pkg_name = package_name(), +) + +ts_config( + name = "tsconfig", + src = "tsconfig.json", + deps = [ + "//:tsconfig.base.json", + "//:tsconfig.bazel.json", + ], +) + +ts_project( + name = "tsc_types", + args = ['--pretty'], + srcs = SRCS, + deps = TYPES_DEPS, + declaration = True, + declaration_map = True, + emit_declaration_only = True, + out_dir = "target_types", + root_dir = ".", + tsconfig = ":tsconfig", +) + +js_library( + name = PKG_DIRNAME, + srcs = NPM_MODULE_EXTRA_FILES, + deps = RUNTIME_DEPS + [":target_node"], + package_name = PKG_REQUIRE_NAME, + visibility = ["//visibility:public"], +) + +pkg_npm( + name = "npm_module", + deps = [":" + PKG_DIRNAME], +) + +filegroup( + name = "build", + srcs = [":npm_module"], + visibility = ["//visibility:public"], +) + +pkg_npm_types( + name = "npm_module_types", + srcs = SRCS, + deps = [":tsc_types"], + package_name = PKG_REQUIRE_NAME, + tsconfig = ":tsconfig", + visibility = ["//visibility:public"], +) + +filegroup( + name = "build_types", + srcs = [":npm_module_types"], + visibility = ["//visibility:public"], +) diff --git a/packages/core/usage-data/core-usage-data-base-server-internal/README.md b/packages/core/usage-data/core-usage-data-base-server-internal/README.md new file mode 100644 index 0000000000000..f450b220596c3 --- /dev/null +++ b/packages/core/usage-data/core-usage-data-base-server-internal/README.md @@ -0,0 +1,6 @@ +# @kbn/core-usage-data-base-server-internal + +This package contains internal base types and constants for Core's server-side `usage-data` domain that are used +across some other domains. + +The purpose of the package is mostly to break the cyclic dependency between the `core-usage-data` and `savedObjects` services. \ No newline at end of file diff --git a/packages/core/usage-data/core-usage-data-base-server-internal/index.ts b/packages/core/usage-data/core-usage-data-base-server-internal/index.ts new file mode 100644 index 0000000000000..cfba715ed2555 --- /dev/null +++ b/packages/core/usage-data/core-usage-data-base-server-internal/index.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 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 or the Server + * Side Public License, v 1. + */ + +export { + CORE_USAGE_STATS_TYPE, + CORE_USAGE_STATS_ID, + REPOSITORY_RESOLVE_OUTCOME_STATS, +} from './src'; +export type { + InternalCoreUsageDataSetup, + ICoreUsageStatsClient, + BaseIncrementOptions, + IncrementSavedObjectsImportOptions, + IncrementSavedObjectsResolveImportErrorsOptions, + IncrementSavedObjectsExportOptions, +} from './src'; diff --git a/packages/core/usage-data/core-usage-data-base-server-internal/jest.config.js b/packages/core/usage-data/core-usage-data-base-server-internal/jest.config.js new file mode 100644 index 0000000000000..60d4c422fc0ee --- /dev/null +++ b/packages/core/usage-data/core-usage-data-base-server-internal/jest.config.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 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 or the Server + * Side Public License, v 1. + */ + +module.exports = { + preset: '@kbn/test/jest_node', + rootDir: '../../../..', + roots: ['/packages/core/usage-data/core-usage-data-base-server-internal'], +}; diff --git a/packages/core/usage-data/core-usage-data-base-server-internal/package.json b/packages/core/usage-data/core-usage-data-base-server-internal/package.json new file mode 100644 index 0000000000000..837a01d45b384 --- /dev/null +++ b/packages/core/usage-data/core-usage-data-base-server-internal/package.json @@ -0,0 +1,8 @@ +{ + "name": "@kbn/core-usage-data-base-server-internal", + "private": true, + "version": "1.0.0", + "main": "./target_node/index.js", + "author": "Kibana Core", + "license": "SSPL-1.0 OR Elastic License 2.0" +} diff --git a/packages/core/usage-data/core-usage-data-base-server-internal/src/constants.ts b/packages/core/usage-data/core-usage-data-base-server-internal/src/constants.ts new file mode 100644 index 0000000000000..90914c7bb2c3e --- /dev/null +++ b/packages/core/usage-data/core-usage-data-base-server-internal/src/constants.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 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 or the Server + * Side Public License, v 1. + */ + +/** @internal */ +export const CORE_USAGE_STATS_TYPE = 'core-usage-stats'; + +/** @internal */ +export const CORE_USAGE_STATS_ID = 'core-usage-stats'; + +/** @internal */ +export const REPOSITORY_RESOLVE_OUTCOME_STATS = { + EXACT_MATCH: 'savedObjectsRepository.resolvedOutcome.exactMatch', + ALIAS_MATCH: 'savedObjectsRepository.resolvedOutcome.aliasMatch', + CONFLICT: 'savedObjectsRepository.resolvedOutcome.conflict', + NOT_FOUND: 'savedObjectsRepository.resolvedOutcome.notFound', + TOTAL: 'savedObjectsRepository.resolvedOutcome.total', +}; diff --git a/packages/core/usage-data/core-usage-data-base-server-internal/src/index.ts b/packages/core/usage-data/core-usage-data-base-server-internal/src/index.ts new file mode 100644 index 0000000000000..a078705c574a8 --- /dev/null +++ b/packages/core/usage-data/core-usage-data-base-server-internal/src/index.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 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 or the Server + * Side Public License, v 1. + */ + +export { + CORE_USAGE_STATS_TYPE, + CORE_USAGE_STATS_ID, + REPOSITORY_RESOLVE_OUTCOME_STATS, +} from './constants'; +export type { + ICoreUsageStatsClient, + BaseIncrementOptions, + IncrementSavedObjectsImportOptions, + IncrementSavedObjectsExportOptions, + IncrementSavedObjectsResolveImportErrorsOptions, +} from './usage_stats_client'; +export type { InternalCoreUsageDataSetup } from './internal_contract'; diff --git a/packages/core/usage-data/core-usage-data-base-server-internal/src/internal_contract.ts b/packages/core/usage-data/core-usage-data-base-server-internal/src/internal_contract.ts new file mode 100644 index 0000000000000..48407068b665a --- /dev/null +++ b/packages/core/usage-data/core-usage-data-base-server-internal/src/internal_contract.ts @@ -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 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 or the Server + * Side Public License, v 1. + */ + +import type { ISavedObjectTypeRegistry, SavedObjectsType } from '@kbn/core-saved-objects-server'; +import type { CoreUsageDataSetup, CoreIncrementUsageCounter } from '@kbn/core-usage-data-server'; +import type { ICoreUsageStatsClient } from './usage_stats_client'; + +type SavedObjectTypeRegistry = ISavedObjectTypeRegistry & { + registerType(type: SavedObjectsType): void; +}; + +/** @internal */ +export interface InternalCoreUsageDataSetup extends CoreUsageDataSetup { + registerType(typeRegistry: SavedObjectTypeRegistry): void; + + getClient(): ICoreUsageStatsClient; + + /** @internal {@link CoreIncrementUsageCounter} **/ + incrementUsageCounter: CoreIncrementUsageCounter; +} diff --git a/packages/core/usage-data/core-usage-data-base-server-internal/src/usage_stats_client.ts b/packages/core/usage-data/core-usage-data-base-server-internal/src/usage_stats_client.ts new file mode 100644 index 0000000000000..3a603ebfdf5f0 --- /dev/null +++ b/packages/core/usage-data/core-usage-data-base-server-internal/src/usage_stats_client.ts @@ -0,0 +1,69 @@ +/* + * 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 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 or the Server + * Side Public License, v 1. + */ + +import type { KibanaRequest } from '@kbn/core-http-server'; +import type { CoreUsageStats } from '@kbn/core-usage-data-server'; + +/** @internal */ +export interface BaseIncrementOptions { + request: KibanaRequest; +} + +/** @internal */ +export type IncrementSavedObjectsImportOptions = BaseIncrementOptions & { + overwrite: boolean; + createNewCopies: boolean; +}; + +/** @internal */ +export type IncrementSavedObjectsResolveImportErrorsOptions = BaseIncrementOptions & { + createNewCopies: boolean; +}; + +/** @internal */ +export type IncrementSavedObjectsExportOptions = BaseIncrementOptions & { + types?: string[]; + supportedTypes: string[]; +}; + +/** @internal */ +export interface ICoreUsageStatsClient { + getUsageStats(): Promise; + + incrementSavedObjectsBulkCreate(options: BaseIncrementOptions): Promise; + + incrementSavedObjectsBulkGet(options: BaseIncrementOptions): Promise; + + incrementSavedObjectsBulkResolve(options: BaseIncrementOptions): Promise; + + incrementSavedObjectsBulkUpdate(options: BaseIncrementOptions): Promise; + + incrementSavedObjectsCreate(options: BaseIncrementOptions): Promise; + + incrementSavedObjectsDelete(options: BaseIncrementOptions): Promise; + + incrementSavedObjectsFind(options: BaseIncrementOptions): Promise; + + incrementSavedObjectsGet(options: BaseIncrementOptions): Promise; + + incrementSavedObjectsResolve(options: BaseIncrementOptions): Promise; + + incrementSavedObjectsUpdate(options: BaseIncrementOptions): Promise; + + incrementSavedObjectsImport(options: IncrementSavedObjectsImportOptions): Promise; + + incrementSavedObjectsResolveImportErrors( + options: IncrementSavedObjectsResolveImportErrorsOptions + ): Promise; + + incrementSavedObjectsExport(options: IncrementSavedObjectsExportOptions): Promise; + + incrementLegacyDashboardsImport(options: BaseIncrementOptions): Promise; + + incrementLegacyDashboardsExport(options: BaseIncrementOptions): Promise; +} diff --git a/packages/core/usage-data/core-usage-data-base-server-internal/tsconfig.json b/packages/core/usage-data/core-usage-data-base-server-internal/tsconfig.json new file mode 100644 index 0000000000000..ff8b3da96b4db --- /dev/null +++ b/packages/core/usage-data/core-usage-data-base-server-internal/tsconfig.json @@ -0,0 +1,18 @@ +{ + "extends": "../../../../tsconfig.bazel.json", + "compilerOptions": { + "declaration": true, + "declarationMap": true, + "emitDeclarationOnly": true, + "outDir": "target_types", + "rootDir": ".", + "stripInternal": false, + "types": [ + "jest", + "node" + ] + }, + "include": [ + "**/*.ts", + ] +} diff --git a/packages/core/usage-data/core-usage-data-server/BUILD.bazel b/packages/core/usage-data/core-usage-data-server/BUILD.bazel new file mode 100644 index 0000000000000..1e349174279ef --- /dev/null +++ b/packages/core/usage-data/core-usage-data-server/BUILD.bazel @@ -0,0 +1,106 @@ +load("@npm//@bazel/typescript:index.bzl", "ts_config") +load("@build_bazel_rules_nodejs//:index.bzl", "js_library") +load("//src/dev/bazel:index.bzl", "jsts_transpiler", "pkg_npm", "pkg_npm_types", "ts_project") + +PKG_DIRNAME = "core-usage-data-server" +PKG_REQUIRE_NAME = "@kbn/core-usage-data-server" + +SOURCE_FILES = glob( + [ + "**/*.ts", + ], + exclude = [ + "**/*.config.js", + "**/*.mock.*", + "**/*.test.*", + "**/*.stories.*", + "**/__snapshots__", + "**/integration_tests", + "**/mocks", + "**/scripts", + "**/storybook", + "**/test_fixtures", + "**/test_helpers", + ], +) + +SRCS = SOURCE_FILES + +filegroup( + name = "srcs", + srcs = SRCS, +) + +NPM_MODULE_EXTRA_FILES = [ + "package.json", +] + +RUNTIME_DEPS = [ +] + +TYPES_DEPS = [ + "@npm//@types/node", + "@npm//@types/jest", +] + +jsts_transpiler( + name = "target_node", + srcs = SRCS, + build_pkg_name = package_name(), +) + +ts_config( + name = "tsconfig", + src = "tsconfig.json", + deps = [ + "//:tsconfig.base.json", + "//:tsconfig.bazel.json", + ], +) + +ts_project( + name = "tsc_types", + args = ['--pretty'], + srcs = SRCS, + deps = TYPES_DEPS, + declaration = True, + declaration_map = True, + emit_declaration_only = True, + out_dir = "target_types", + root_dir = ".", + tsconfig = ":tsconfig", +) + +js_library( + name = PKG_DIRNAME, + srcs = NPM_MODULE_EXTRA_FILES, + deps = RUNTIME_DEPS + [":target_node"], + package_name = PKG_REQUIRE_NAME, + visibility = ["//visibility:public"], +) + +pkg_npm( + name = "npm_module", + deps = [":" + PKG_DIRNAME], +) + +filegroup( + name = "build", + srcs = [":npm_module"], + visibility = ["//visibility:public"], +) + +pkg_npm_types( + name = "npm_module_types", + srcs = SRCS, + deps = [":tsc_types"], + package_name = PKG_REQUIRE_NAME, + tsconfig = ":tsconfig", + visibility = ["//visibility:public"], +) + +filegroup( + name = "build_types", + srcs = [":npm_module_types"], + visibility = ["//visibility:public"], +) diff --git a/packages/core/usage-data/core-usage-data-server/README.md b/packages/core/usage-data/core-usage-data-server/README.md new file mode 100644 index 0000000000000..049065b0e04eb --- /dev/null +++ b/packages/core/usage-data/core-usage-data-server/README.md @@ -0,0 +1,3 @@ +# @kbn/core-usage-data-server + +This package contains public types for Core's server-side `usage-data` domain. diff --git a/packages/core/usage-data/core-usage-data-server/index.ts b/packages/core/usage-data/core-usage-data-server/index.ts new file mode 100644 index 0000000000000..6c14ff3d11564 --- /dev/null +++ b/packages/core/usage-data/core-usage-data-server/index.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 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 or the Server + * Side Public License, v 1. + */ + +export type { + CoreUsageDataSetup, + CoreUsageDataStart, + CoreUsageCounter, + CoreIncrementUsageCounter, + ConfigUsageData, + CoreEnvironmentUsageData, + CoreIncrementCounterParams, + CoreUsageData, + CoreConfigUsageData, + CoreServicesUsageData, + CoreUsageStats, +} from './src'; diff --git a/packages/core/usage-data/core-usage-data-server/jest.config.js b/packages/core/usage-data/core-usage-data-server/jest.config.js new file mode 100644 index 0000000000000..9e9c85037852b --- /dev/null +++ b/packages/core/usage-data/core-usage-data-server/jest.config.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 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 or the Server + * Side Public License, v 1. + */ + +module.exports = { + preset: '@kbn/test/jest_node', + rootDir: '../../../..', + roots: ['/packages/core/usage-data/core-usage-data-server'], +}; diff --git a/packages/core/usage-data/core-usage-data-server/package.json b/packages/core/usage-data/core-usage-data-server/package.json new file mode 100644 index 0000000000000..e271128d733c7 --- /dev/null +++ b/packages/core/usage-data/core-usage-data-server/package.json @@ -0,0 +1,8 @@ +{ + "name": "@kbn/core-usage-data-server", + "private": true, + "version": "1.0.0", + "main": "./target_node/index.js", + "author": "Kibana Core", + "license": "SSPL-1.0 OR Elastic License 2.0" +} diff --git a/packages/core/usage-data/core-usage-data-server/src/core_usage_data.ts b/packages/core/usage-data/core-usage-data-server/src/core_usage_data.ts new file mode 100644 index 0000000000000..685a86390a6bd --- /dev/null +++ b/packages/core/usage-data/core-usage-data-server/src/core_usage_data.ts @@ -0,0 +1,148 @@ +/* + * 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 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 or the Server + * Side Public License, v 1. + */ + +/** + * Usage data from Core services + * @public + */ +export interface CoreServicesUsageData { + savedObjects: { + // scripts/telemetry_check.js does not support parsing Array<{...}> types + // so we have to disable eslint here and use {...}[] + // eslint-disable-next-line @typescript-eslint/array-type + indices: { + alias: string; + docsCount: number; + docsDeleted: number; + storeSizeBytes: number; + primaryStoreSizeBytes: number; + savedObjectsDocsCount: number; + }[]; + legacyUrlAliases: { + activeCount: number; + inactiveCount: number; + disabledCount: number; + totalCount: number; + }; + }; +} + +/** + * Usage data on this Kibana node's runtime environment. + * @public + */ +export interface CoreEnvironmentUsageData { + memory: { + heapTotalBytes: number; + heapUsedBytes: number; + /** V8 heap size limit */ + heapSizeLimit: number; + }; +} + +/** + * Usage data on this cluster's configuration of Core features + * @public + */ +export interface CoreConfigUsageData { + elasticsearch: { + sniffOnStart: boolean; + sniffIntervalMs?: number; + sniffOnConnectionFault: boolean; + numberOfHostsConfigured: number; + requestHeadersWhitelistConfigured: boolean; + customHeadersConfigured: boolean; + shardTimeoutMs: number; + requestTimeoutMs: number; + pingTimeoutMs: number; + logQueries: boolean; + ssl: { + verificationMode: 'none' | 'certificate' | 'full'; + certificateAuthoritiesConfigured: boolean; + certificateConfigured: boolean; + keyConfigured: boolean; + keystoreConfigured: boolean; + truststoreConfigured: boolean; + alwaysPresentCertificate: boolean; + }; + apiVersion: string; + healthCheckDelayMs: number; + principal: + | 'elastic_user' + | 'kibana_user' + | 'kibana_system_user' + | 'other_user' + | 'kibana_service_account' + | 'unknown'; + }; + + http: { + basePathConfigured: boolean; + maxPayloadInBytes: number; + rewriteBasePath: boolean; + keepaliveTimeout: number; + socketTimeout: number; + compression: { + enabled: boolean; + referrerWhitelistConfigured: boolean; + }; + xsrf: { + disableProtection: boolean; + allowlistConfigured: boolean; + }; + requestId: { + allowFromAnyIp: boolean; + ipAllowlistConfigured: boolean; + }; + ssl: { + certificateAuthoritiesConfigured: boolean; + certificateConfigured: boolean; + cipherSuites: string[]; + keyConfigured: boolean; + keystoreConfigured: boolean; + truststoreConfigured: boolean; + redirectHttpFromPortConfigured: boolean; + supportedProtocols: string[]; + clientAuthentication: 'none' | 'optional' | 'required'; + }; + securityResponseHeaders: { + strictTransportSecurity: string; + xContentTypeOptions: string; + referrerPolicy: string; + permissionsPolicyConfigured: boolean; + disableEmbedding: boolean; + }; + }; + + logging: { + appendersTypesUsed: string[]; + loggersConfiguredCount: number; + }; + + // plugins: { + // /** list of built-in plugins that are disabled */ + // firstPartyDisabled: string[]; + // /** list of third-party plugins that are installed and enabled */ + // thirdParty: string[]; + // }; + + savedObjects: { + customIndex: boolean; + maxImportPayloadBytes: number; + maxImportExportSize: number; + }; + + // uiSettings: { + // overridesCount: number; + // }; + + deprecatedKeys: { + set: string[]; + unset: string[]; + }; +} diff --git a/packages/core/usage-data/core-usage-data-server/src/core_usage_stats.ts b/packages/core/usage-data/core-usage-data-server/src/core_usage_stats.ts new file mode 100644 index 0000000000000..aef5b657fb6f7 --- /dev/null +++ b/packages/core/usage-data/core-usage-data-server/src/core_usage_stats.ts @@ -0,0 +1,138 @@ +/* + * 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 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 or the Server + * Side Public License, v 1. + */ + +/** + * @public + * + * CoreUsageStats are collected over time while Kibana is running. This is related to CoreUsageData, which is a superset of this that also + * includes point-in-time configuration information. + * */ +export interface CoreUsageStats { + // Saved Objects Client APIs + 'apiCalls.savedObjectsBulkCreate.total'?: number; + 'apiCalls.savedObjectsBulkCreate.namespace.default.total'?: number; + 'apiCalls.savedObjectsBulkCreate.namespace.default.kibanaRequest.yes'?: number; + 'apiCalls.savedObjectsBulkCreate.namespace.default.kibanaRequest.no'?: number; + 'apiCalls.savedObjectsBulkCreate.namespace.custom.total'?: number; + 'apiCalls.savedObjectsBulkCreate.namespace.custom.kibanaRequest.yes'?: number; + 'apiCalls.savedObjectsBulkCreate.namespace.custom.kibanaRequest.no'?: number; + 'apiCalls.savedObjectsBulkGet.total'?: number; + 'apiCalls.savedObjectsBulkGet.namespace.default.total'?: number; + 'apiCalls.savedObjectsBulkGet.namespace.default.kibanaRequest.yes'?: number; + 'apiCalls.savedObjectsBulkGet.namespace.default.kibanaRequest.no'?: number; + 'apiCalls.savedObjectsBulkGet.namespace.custom.total'?: number; + 'apiCalls.savedObjectsBulkGet.namespace.custom.kibanaRequest.yes'?: number; + 'apiCalls.savedObjectsBulkGet.namespace.custom.kibanaRequest.no'?: number; + 'apiCalls.savedObjectsBulkResolve.total'?: number; + 'apiCalls.savedObjectsBulkResolve.namespace.default.total'?: number; + 'apiCalls.savedObjectsBulkResolve.namespace.default.kibanaRequest.yes'?: number; + 'apiCalls.savedObjectsBulkResolve.namespace.default.kibanaRequest.no'?: number; + 'apiCalls.savedObjectsBulkResolve.namespace.custom.total'?: number; + 'apiCalls.savedObjectsBulkResolve.namespace.custom.kibanaRequest.yes'?: number; + 'apiCalls.savedObjectsBulkResolve.namespace.custom.kibanaRequest.no'?: number; + 'apiCalls.savedObjectsBulkUpdate.total'?: number; + 'apiCalls.savedObjectsBulkUpdate.namespace.default.total'?: number; + 'apiCalls.savedObjectsBulkUpdate.namespace.default.kibanaRequest.yes'?: number; + 'apiCalls.savedObjectsBulkUpdate.namespace.default.kibanaRequest.no'?: number; + 'apiCalls.savedObjectsBulkUpdate.namespace.custom.total'?: number; + 'apiCalls.savedObjectsBulkUpdate.namespace.custom.kibanaRequest.yes'?: number; + 'apiCalls.savedObjectsBulkUpdate.namespace.custom.kibanaRequest.no'?: number; + 'apiCalls.savedObjectsCreate.total'?: number; + 'apiCalls.savedObjectsCreate.namespace.default.total'?: number; + 'apiCalls.savedObjectsCreate.namespace.default.kibanaRequest.yes'?: number; + 'apiCalls.savedObjectsCreate.namespace.default.kibanaRequest.no'?: number; + 'apiCalls.savedObjectsCreate.namespace.custom.total'?: number; + 'apiCalls.savedObjectsCreate.namespace.custom.kibanaRequest.yes'?: number; + 'apiCalls.savedObjectsCreate.namespace.custom.kibanaRequest.no'?: number; + 'apiCalls.savedObjectsDelete.total'?: number; + 'apiCalls.savedObjectsDelete.namespace.default.total'?: number; + 'apiCalls.savedObjectsDelete.namespace.default.kibanaRequest.yes'?: number; + 'apiCalls.savedObjectsDelete.namespace.default.kibanaRequest.no'?: number; + 'apiCalls.savedObjectsDelete.namespace.custom.total'?: number; + 'apiCalls.savedObjectsDelete.namespace.custom.kibanaRequest.yes'?: number; + 'apiCalls.savedObjectsDelete.namespace.custom.kibanaRequest.no'?: number; + 'apiCalls.savedObjectsFind.total'?: number; + 'apiCalls.savedObjectsFind.namespace.default.total'?: number; + 'apiCalls.savedObjectsFind.namespace.default.kibanaRequest.yes'?: number; + 'apiCalls.savedObjectsFind.namespace.default.kibanaRequest.no'?: number; + 'apiCalls.savedObjectsFind.namespace.custom.total'?: number; + 'apiCalls.savedObjectsFind.namespace.custom.kibanaRequest.yes'?: number; + 'apiCalls.savedObjectsFind.namespace.custom.kibanaRequest.no'?: number; + 'apiCalls.savedObjectsGet.total'?: number; + 'apiCalls.savedObjectsGet.namespace.default.total'?: number; + 'apiCalls.savedObjectsGet.namespace.default.kibanaRequest.yes'?: number; + 'apiCalls.savedObjectsGet.namespace.default.kibanaRequest.no'?: number; + 'apiCalls.savedObjectsGet.namespace.custom.total'?: number; + 'apiCalls.savedObjectsGet.namespace.custom.kibanaRequest.yes'?: number; + 'apiCalls.savedObjectsGet.namespace.custom.kibanaRequest.no'?: number; + 'apiCalls.savedObjectsResolve.total'?: number; + 'apiCalls.savedObjectsResolve.namespace.default.total'?: number; + 'apiCalls.savedObjectsResolve.namespace.default.kibanaRequest.yes'?: number; + 'apiCalls.savedObjectsResolve.namespace.default.kibanaRequest.no'?: number; + 'apiCalls.savedObjectsResolve.namespace.custom.total'?: number; + 'apiCalls.savedObjectsResolve.namespace.custom.kibanaRequest.yes'?: number; + 'apiCalls.savedObjectsResolve.namespace.custom.kibanaRequest.no'?: number; + 'apiCalls.savedObjectsUpdate.total'?: number; + 'apiCalls.savedObjectsUpdate.namespace.default.total'?: number; + 'apiCalls.savedObjectsUpdate.namespace.default.kibanaRequest.yes'?: number; + 'apiCalls.savedObjectsUpdate.namespace.default.kibanaRequest.no'?: number; + 'apiCalls.savedObjectsUpdate.namespace.custom.total'?: number; + 'apiCalls.savedObjectsUpdate.namespace.custom.kibanaRequest.yes'?: number; + 'apiCalls.savedObjectsUpdate.namespace.custom.kibanaRequest.no'?: number; + // Saved Objects Management APIs + 'apiCalls.savedObjectsImport.total'?: number; + 'apiCalls.savedObjectsImport.namespace.default.total'?: number; + 'apiCalls.savedObjectsImport.namespace.default.kibanaRequest.yes'?: number; + 'apiCalls.savedObjectsImport.namespace.default.kibanaRequest.no'?: number; + 'apiCalls.savedObjectsImport.namespace.custom.total'?: number; + 'apiCalls.savedObjectsImport.namespace.custom.kibanaRequest.yes'?: number; + 'apiCalls.savedObjectsImport.namespace.custom.kibanaRequest.no'?: number; + 'apiCalls.savedObjectsImport.createNewCopiesEnabled.yes'?: number; + 'apiCalls.savedObjectsImport.createNewCopiesEnabled.no'?: number; + 'apiCalls.savedObjectsImport.overwriteEnabled.yes'?: number; + 'apiCalls.savedObjectsImport.overwriteEnabled.no'?: number; + 'apiCalls.savedObjectsResolveImportErrors.total'?: number; + 'apiCalls.savedObjectsResolveImportErrors.namespace.default.total'?: number; + 'apiCalls.savedObjectsResolveImportErrors.namespace.default.kibanaRequest.yes'?: number; + 'apiCalls.savedObjectsResolveImportErrors.namespace.default.kibanaRequest.no'?: number; + 'apiCalls.savedObjectsResolveImportErrors.namespace.custom.total'?: number; + 'apiCalls.savedObjectsResolveImportErrors.namespace.custom.kibanaRequest.yes'?: number; + 'apiCalls.savedObjectsResolveImportErrors.namespace.custom.kibanaRequest.no'?: number; + 'apiCalls.savedObjectsResolveImportErrors.createNewCopiesEnabled.yes'?: number; + 'apiCalls.savedObjectsResolveImportErrors.createNewCopiesEnabled.no'?: number; + 'apiCalls.savedObjectsExport.total'?: number; + 'apiCalls.savedObjectsExport.namespace.default.total'?: number; + 'apiCalls.savedObjectsExport.namespace.default.kibanaRequest.yes'?: number; + 'apiCalls.savedObjectsExport.namespace.default.kibanaRequest.no'?: number; + 'apiCalls.savedObjectsExport.namespace.custom.total'?: number; + 'apiCalls.savedObjectsExport.namespace.custom.kibanaRequest.yes'?: number; + 'apiCalls.savedObjectsExport.namespace.custom.kibanaRequest.no'?: number; + 'apiCalls.savedObjectsExport.allTypesSelected.yes'?: number; + 'apiCalls.savedObjectsExport.allTypesSelected.no'?: number; + // Legacy Dashboard Import/Export API + 'apiCalls.legacyDashboardExport.total'?: number; + 'apiCalls.legacyDashboardExport.namespace.default.total'?: number; + 'apiCalls.legacyDashboardExport.namespace.default.kibanaRequest.yes'?: number; + 'apiCalls.legacyDashboardExport.namespace.default.kibanaRequest.no'?: number; + 'apiCalls.legacyDashboardExport.namespace.custom.total'?: number; + 'apiCalls.legacyDashboardExport.namespace.custom.kibanaRequest.yes'?: number; + 'apiCalls.legacyDashboardExport.namespace.custom.kibanaRequest.no'?: number; + 'apiCalls.legacyDashboardImport.total'?: number; + 'apiCalls.legacyDashboardImport.namespace.default.total'?: number; + 'apiCalls.legacyDashboardImport.namespace.default.kibanaRequest.yes'?: number; + 'apiCalls.legacyDashboardImport.namespace.default.kibanaRequest.no'?: number; + 'apiCalls.legacyDashboardImport.namespace.custom.total'?: number; + 'apiCalls.legacyDashboardImport.namespace.custom.kibanaRequest.yes'?: number; + 'apiCalls.legacyDashboardImport.namespace.custom.kibanaRequest.no'?: number; + // Saved Objects Repository counters + 'savedObjectsRepository.resolvedOutcome.exactMatch'?: number; + 'savedObjectsRepository.resolvedOutcome.aliasMatch'?: number; + 'savedObjectsRepository.resolvedOutcome.conflict'?: number; + 'savedObjectsRepository.resolvedOutcome.notFound'?: number; + 'savedObjectsRepository.resolvedOutcome.total'?: number; +} diff --git a/packages/core/usage-data/core-usage-data-server/src/index.ts b/packages/core/usage-data/core-usage-data-server/src/index.ts new file mode 100644 index 0000000000000..92bda0c83491a --- /dev/null +++ b/packages/core/usage-data/core-usage-data-server/src/index.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 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 or the Server + * Side Public License, v 1. + */ + +export type { + CoreServicesUsageData, + CoreEnvironmentUsageData, + CoreConfigUsageData, +} from './core_usage_data'; +export type { CoreUsageStats } from './core_usage_stats'; +export type { + CoreUsageDataSetup, + CoreUsageCounter, + CoreIncrementUsageCounter, + CoreIncrementCounterParams, +} from './setup_contract'; +export type { CoreUsageData, ConfigUsageData, CoreUsageDataStart } from './start_contract'; diff --git a/packages/core/usage-data/core-usage-data-server/src/setup_contract.ts b/packages/core/usage-data/core-usage-data-server/src/setup_contract.ts new file mode 100644 index 0000000000000..2acf70f323eff --- /dev/null +++ b/packages/core/usage-data/core-usage-data-server/src/setup_contract.ts @@ -0,0 +1,50 @@ +/* + * 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 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 or the Server + * Side Public License, v 1. + */ + +/** + * Internal API for registering the Usage Tracker used for Core's usage data payload. + * + * @note This API should never be used to drive application logic and is only + * intended for telemetry purposes. + * + * @public + */ +export interface CoreUsageDataSetup { + /** + * API for a usage tracker plugin to inject the {@link CoreUsageCounter} to use + * when tracking events. + */ + registerUsageCounter: (usageCounter: CoreUsageCounter) => void; +} + +/** + * @public + * API to track whenever an event occurs, so the core can report them. + */ +export interface CoreUsageCounter { + /** @internal {@link CoreIncrementUsageCounter} **/ + incrementCounter: CoreIncrementUsageCounter; +} + +/** + * @public Details about the counter to be incremented + */ +export interface CoreIncrementCounterParams { + /** The name of the counter **/ + counterName: string; + /** The counter type ("count" by default) **/ + counterType?: string; + /** Increment the counter by this number (1 if not specified) **/ + incrementBy?: number; +} + +/** + * @public + * Method to call whenever an event occurs, so the counter can be increased. + */ +export type CoreIncrementUsageCounter = (params: CoreIncrementCounterParams) => void; diff --git a/packages/core/usage-data/core-usage-data-server/src/start_contract.ts b/packages/core/usage-data/core-usage-data-server/src/start_contract.ts new file mode 100644 index 0000000000000..bede0df2c5753 --- /dev/null +++ b/packages/core/usage-data/core-usage-data-server/src/start_contract.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 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 or the Server + * Side Public License, v 1. + */ + +import type { CoreUsageStats } from './core_usage_stats'; +import type { + CoreConfigUsageData, + CoreEnvironmentUsageData, + CoreServicesUsageData, +} from './core_usage_data'; + +/** + * Internal API for getting Core's usage data payload. + * + * @note This API should never be used to drive application logic and is only + * intended for telemetry purposes. + * + * @public + */ +export interface CoreUsageDataStart { + /** + * Internal API for getting Core's usage data payload. + * + * @note This API should never be used to drive application logic and is only + * intended for telemetry purposes. + * + * @internal + * */ + getCoreUsageData(): Promise; + + getConfigsUsageData(): Promise; +} + +/** + * Type describing Core's usage data payload + * @public + */ +export interface CoreUsageData extends CoreUsageStats { + config: CoreConfigUsageData; + services: CoreServicesUsageData; + environment: CoreEnvironmentUsageData; +} + +/** + * Type describing Core's usage data payload + * @public + */ +export type ConfigUsageData = Record; diff --git a/packages/core/usage-data/core-usage-data-server/tsconfig.json b/packages/core/usage-data/core-usage-data-server/tsconfig.json new file mode 100644 index 0000000000000..ff8b3da96b4db --- /dev/null +++ b/packages/core/usage-data/core-usage-data-server/tsconfig.json @@ -0,0 +1,18 @@ +{ + "extends": "../../../../tsconfig.bazel.json", + "compilerOptions": { + "declaration": true, + "declarationMap": true, + "emitDeclarationOnly": true, + "outDir": "target_types", + "rootDir": ".", + "stripInternal": false, + "types": [ + "jest", + "node" + ] + }, + "include": [ + "**/*.ts", + ] +} diff --git a/src/core/server/core_route_handler_context.ts b/src/core/server/core_route_handler_context.ts index d0285469b664f..50844d0ccfcd9 100644 --- a/src/core/server/core_route_handler_context.ts +++ b/src/core/server/core_route_handler_context.ts @@ -10,7 +10,7 @@ import type { KibanaRequest } from '@kbn/core-http-server'; import type { ElasticsearchRequestHandlerContext } from '@kbn/core-elasticsearch-server'; import { CoreElasticsearchRouteHandlerContext } from '@kbn/core-elasticsearch-server-internal'; import type { SavedObjectsRequestHandlerContext } from '@kbn/core-saved-objects-server'; -import { CoreSavedObjectsRouteHandlerContext } from './saved_objects'; +import { CoreSavedObjectsRouteHandlerContext } from '@kbn/core-saved-objects-server-internal'; import { CoreUiSettingsRouteHandlerContext, UiSettingsRequestHandlerContext } from './ui_settings'; import { CoreDeprecationsRouteHandlerContext, diff --git a/src/core/server/core_usage_data/core_usage_data_service.mock.ts b/src/core/server/core_usage_data/core_usage_data_service.mock.ts index fd8f219fb2d55..7c887e4a93948 100644 --- a/src/core/server/core_usage_data/core_usage_data_service.mock.ts +++ b/src/core/server/core_usage_data/core_usage_data_service.mock.ts @@ -6,11 +6,12 @@ * Side Public License, v 1. */ -import { PublicMethodsOf } from '@kbn/utility-types'; import { BehaviorSubject } from 'rxjs'; +import type { PublicMethodsOf } from '@kbn/utility-types'; +import type { CoreUsageData, CoreUsageDataStart } from '@kbn/core-usage-data-server'; +import type { InternalCoreUsageDataSetup } from '@kbn/core-usage-data-base-server-internal'; import { CoreUsageDataService } from './core_usage_data_service'; import { coreUsageStatsClientMock } from './core_usage_stats_client.mock'; -import { CoreUsageData, InternalCoreUsageDataSetup, CoreUsageDataStart } from './types'; const createSetupContractMock = (usageStatsClient = coreUsageStatsClientMock.create()) => { const setupContract: jest.Mocked = { diff --git a/src/core/server/core_usage_data/core_usage_data_service.test.ts b/src/core/server/core_usage_data/core_usage_data_service.test.ts index 5ac2863745ee7..4d4f0507a1e5c 100644 --- a/src/core/server/core_usage_data/core_usage_data_service.test.ts +++ b/src/core/server/core_usage_data/core_usage_data_service.test.ts @@ -21,12 +21,12 @@ import { config as RawHttpConfig } from '@kbn/core-http-server-internal'; import { savedObjectsConfig as RawSavedObjectsConfig } from '@kbn/core-saved-objects-base-server-internal'; import { httpServiceMock } from '@kbn/core-http-server-mocks'; import { metricsServiceMock } from '@kbn/core-metrics-server-mocks'; -import { savedObjectsServiceMock } from '../saved_objects/saved_objects_service.mock'; +import { savedObjectsServiceMock } from '@kbn/core-saved-objects-server-mocks'; import { CoreUsageDataService } from './core_usage_data_service'; import { elasticsearchServiceMock } from '@kbn/core-elasticsearch-server-mocks'; import { typeRegistryMock } from '@kbn/core-saved-objects-base-server-mocks'; -import { CORE_USAGE_STATS_TYPE } from './constants'; +import { CORE_USAGE_STATS_TYPE } from '@kbn/core-usage-data-base-server-internal'; import { CoreUsageStatsClient } from './core_usage_stats_client'; describe('CoreUsageDataService', () => { diff --git a/src/core/server/core_usage_data/core_usage_data_service.ts b/src/core/server/core_usage_data/core_usage_data_service.ts index c5f2335e333e4..da0393d937663 100644 --- a/src/core/server/core_usage_data/core_usage_data_service.ts +++ b/src/core/server/core_usage_data/core_usage_data_service.ts @@ -27,21 +27,24 @@ import { LEGACY_URL_ALIAS_TYPE, type SavedObjectsConfigType, } from '@kbn/core-saved-objects-base-server-internal'; - -import { SavedObjectsServiceStart, SavedObjectTypeRegistry } from '..'; import type { CoreServicesUsageData, CoreUsageData, CoreUsageDataStart, - InternalCoreUsageDataSetup, + CoreIncrementUsageCounter, ConfigUsageData, CoreConfigUsageData, -} from './types'; +} from '@kbn/core-usage-data-server'; +import { + CORE_USAGE_STATS_TYPE, + type InternalCoreUsageDataSetup, +} from '@kbn/core-usage-data-base-server-internal'; +import type { SavedObjectTypeRegistry } from '@kbn/core-saved-objects-base-server-internal'; +import type { SavedObjectsServiceStart } from '@kbn/core-saved-objects-server'; + import { isConfigured } from './is_configured'; import { coreUsageStatsType } from './core_usage_stats'; -import { CORE_USAGE_STATS_TYPE } from './constants'; import { CoreUsageStatsClient } from './core_usage_stats_client'; -import { CoreIncrementUsageCounter } from './types'; export type ExposedConfigsToUsage = Map>; diff --git a/src/core/server/core_usage_data/core_usage_stats.ts b/src/core/server/core_usage_data/core_usage_stats.ts index 12d1b8c2e3af5..8b4ac4ffc25db 100644 --- a/src/core/server/core_usage_data/core_usage_stats.ts +++ b/src/core/server/core_usage_data/core_usage_stats.ts @@ -7,7 +7,7 @@ */ import type { SavedObjectsType } from '@kbn/core-saved-objects-server'; -import { CORE_USAGE_STATS_TYPE } from './constants'; +import { CORE_USAGE_STATS_TYPE } from '@kbn/core-usage-data-base-server-internal'; import { migrateTo7141 } from './migrations'; /** @internal */ diff --git a/src/core/server/core_usage_data/core_usage_stats_client.test.ts b/src/core/server/core_usage_data/core_usage_stats_client.test.ts index 9a6984f6b5785..a06a239217601 100644 --- a/src/core/server/core_usage_data/core_usage_stats_client.test.ts +++ b/src/core/server/core_usage_data/core_usage_stats_client.test.ts @@ -7,12 +7,15 @@ */ import { httpServerMock, httpServiceMock, savedObjectsRepositoryMock } from '../mocks'; -import { CORE_USAGE_STATS_TYPE, CORE_USAGE_STATS_ID } from './constants'; import { + CORE_USAGE_STATS_TYPE, + CORE_USAGE_STATS_ID, BaseIncrementOptions, IncrementSavedObjectsImportOptions, IncrementSavedObjectsResolveImportErrorsOptions, IncrementSavedObjectsExportOptions, +} from '@kbn/core-usage-data-base-server-internal'; +import { BULK_CREATE_STATS_PREFIX, BULK_GET_STATS_PREFIX, BULK_UPDATE_STATS_PREFIX, diff --git a/src/core/server/core_usage_data/core_usage_stats_client.ts b/src/core/server/core_usage_data/core_usage_stats_client.ts index c14776ff7ed81..f7c5709afa52d 100644 --- a/src/core/server/core_usage_data/core_usage_stats_client.ts +++ b/src/core/server/core_usage_data/core_usage_stats_client.ts @@ -7,31 +7,18 @@ */ import { DEFAULT_NAMESPACE_STRING } from '@kbn/core-saved-objects-utils-server'; -import { CORE_USAGE_STATS_TYPE, CORE_USAGE_STATS_ID } from './constants'; -import { CoreUsageStats } from './types'; +import type { CoreUsageStats } from '@kbn/core-usage-data-server'; import { - ISavedObjectsRepository, - SavedObjectsImportOptions, - SavedObjectsResolveImportErrorsOptions, - KibanaRequest, - IBasePath, -} from '..'; - -/** @internal */ -export interface BaseIncrementOptions { - request: KibanaRequest; -} -/** @internal */ -export type IncrementSavedObjectsImportOptions = BaseIncrementOptions & - Pick; -/** @internal */ -export type IncrementSavedObjectsResolveImportErrorsOptions = BaseIncrementOptions & - Pick; -/** @internal */ -export type IncrementSavedObjectsExportOptions = BaseIncrementOptions & { - types?: string[]; - supportedTypes: string[]; -}; + type ICoreUsageStatsClient, + type BaseIncrementOptions, + type IncrementSavedObjectsImportOptions, + type IncrementSavedObjectsResolveImportErrorsOptions, + type IncrementSavedObjectsExportOptions, + CORE_USAGE_STATS_TYPE, + CORE_USAGE_STATS_ID, + REPOSITORY_RESOLVE_OUTCOME_STATS, +} from '@kbn/core-usage-data-base-server-internal'; +import { ISavedObjectsRepository, KibanaRequest, IBasePath } from '..'; export const BULK_CREATE_STATS_PREFIX = 'apiCalls.savedObjectsBulkCreate'; export const BULK_GET_STATS_PREFIX = 'apiCalls.savedObjectsBulkGet'; @@ -49,13 +36,6 @@ export const EXPORT_STATS_PREFIX = 'apiCalls.savedObjectsExport'; export const LEGACY_DASHBOARDS_IMPORT_STATS_PREFIX = 'apiCalls.legacyDashboardImport'; export const LEGACY_DASHBOARDS_EXPORT_STATS_PREFIX = 'apiCalls.legacyDashboardExport'; -export const REPOSITORY_RESOLVE_OUTCOME_STATS = { - EXACT_MATCH: 'savedObjectsRepository.resolvedOutcome.exactMatch', - ALIAS_MATCH: 'savedObjectsRepository.resolvedOutcome.aliasMatch', - CONFLICT: 'savedObjectsRepository.resolvedOutcome.conflict', - NOT_FOUND: 'savedObjectsRepository.resolvedOutcome.notFound', - TOTAL: 'savedObjectsRepository.resolvedOutcome.total', -}; const ALL_COUNTER_FIELDS = [ // Saved Objects Client APIs ...getFieldsForCounter(BULK_CREATE_STATS_PREFIX), @@ -92,7 +72,7 @@ const ALL_COUNTER_FIELDS = [ const SPACE_CONTEXT_REGEX = /^\/s\/([a-z0-9_\-]+)/; /** @internal */ -export class CoreUsageStatsClient { +export class CoreUsageStatsClient implements ICoreUsageStatsClient { constructor( private readonly debugLogger: (message: string) => void, private readonly basePath: IBasePath, diff --git a/src/core/server/core_usage_data/index.ts b/src/core/server/core_usage_data/index.ts index 186ad95cbdca2..227edb779e513 100644 --- a/src/core/server/core_usage_data/index.ts +++ b/src/core/server/core_usage_data/index.ts @@ -6,28 +6,30 @@ * Side Public License, v 1. */ -export { CORE_USAGE_STATS_TYPE, CORE_USAGE_STATS_ID } from './constants'; -export type { - InternalCoreUsageDataSetup, - ConfigUsageData, - CoreUsageDataStart, - CoreUsageDataSetup, - CoreUsageCounter, - CoreIncrementUsageCounter, - CoreIncrementCounterParams, -} from './types'; +export { + CORE_USAGE_STATS_TYPE, + CORE_USAGE_STATS_ID, + REPOSITORY_RESOLVE_OUTCOME_STATS, + type InternalCoreUsageDataSetup, +} from '@kbn/core-usage-data-base-server-internal'; export { CoreUsageDataService } from './core_usage_data_service'; -export { CoreUsageStatsClient, REPOSITORY_RESOLVE_OUTCOME_STATS } from './core_usage_stats_client'; +export { CoreUsageStatsClient } from './core_usage_stats_client'; // Because of #79265 we need to explicitly import, then export these types for // scripts/telemetry_check.js to work as expected -import { +import type { CoreUsageStats, CoreUsageData, CoreConfigUsageData, CoreEnvironmentUsageData, CoreServicesUsageData, -} from './types'; + ConfigUsageData, + CoreUsageDataStart, + CoreUsageDataSetup, + CoreUsageCounter, + CoreIncrementUsageCounter, + CoreIncrementCounterParams, +} from '@kbn/core-usage-data-server'; export type { CoreUsageStats, @@ -35,4 +37,10 @@ export type { CoreConfigUsageData, CoreEnvironmentUsageData, CoreServicesUsageData, + ConfigUsageData, + CoreUsageDataStart, + CoreUsageDataSetup, + CoreUsageCounter, + CoreIncrementUsageCounter, + CoreIncrementCounterParams, }; diff --git a/src/core/server/core_usage_data/migrations.test.ts b/src/core/server/core_usage_data/migrations.test.ts index 9139280a9effa..63d89c9aaef0c 100644 --- a/src/core/server/core_usage_data/migrations.test.ts +++ b/src/core/server/core_usage_data/migrations.test.ts @@ -7,8 +7,8 @@ */ import type { SavedObjectUnsanitizedDoc } from '@kbn/core-saved-objects-server'; +import type { CoreUsageStats } from '@kbn/core-usage-data-server'; import { migrateTo7141 } from './migrations'; -import type { CoreUsageStats } from './types'; const type = 'obj-type'; const id = 'obj-id'; diff --git a/src/core/server/core_usage_data/migrations.ts b/src/core/server/core_usage_data/migrations.ts index bb7ae49e0be48..35d9f5806cc81 100644 --- a/src/core/server/core_usage_data/migrations.ts +++ b/src/core/server/core_usage_data/migrations.ts @@ -8,7 +8,7 @@ import { cloneDeep } from 'lodash'; import type { SavedObjectUnsanitizedDoc } from '@kbn/core-saved-objects-server'; -import type { CoreUsageStats } from './types'; +import type { CoreUsageStats } from '@kbn/core-usage-data-server'; export const migrateTo7141 = (doc: SavedObjectUnsanitizedDoc) => { try { diff --git a/src/core/server/deprecations/deprecations_factory.test.ts b/src/core/server/deprecations/deprecations_factory.test.ts index 3ae83a1886e5c..516af545916ce 100644 --- a/src/core/server/deprecations/deprecations_factory.test.ts +++ b/src/core/server/deprecations/deprecations_factory.test.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import type { GetDeprecationsContext } from './types'; +import type { GetDeprecationsContext } from '@kbn/core-deprecations-server'; import { DeprecationsFactory, DeprecationsFactoryConfig } from './deprecations_factory'; import { loggerMock } from '@kbn/logging-mocks'; import type { DeprecationsDetails } from '@kbn/core-deprecations-common'; diff --git a/src/core/server/deprecations/deprecations_factory.ts b/src/core/server/deprecations/deprecations_factory.ts index 514817ed1c12a..4e02f318a4c86 100644 --- a/src/core/server/deprecations/deprecations_factory.ts +++ b/src/core/server/deprecations/deprecations_factory.ts @@ -9,8 +9,8 @@ import { i18n } from '@kbn/i18n'; import type { Logger } from '@kbn/logging'; import type { DomainDeprecationDetails, DeprecationsDetails } from '@kbn/core-deprecations-common'; +import type { GetDeprecationsContext } from '@kbn/core-deprecations-server'; import { DeprecationsRegistry } from './deprecations_registry'; -import type { GetDeprecationsContext } from './types'; export interface DeprecationsFactoryDeps { logger: Logger; diff --git a/src/core/server/deprecations/deprecations_registry.mock.ts b/src/core/server/deprecations/deprecations_registry.mock.ts index 65433f5eca5cb..22ffff877ddc5 100644 --- a/src/core/server/deprecations/deprecations_registry.mock.ts +++ b/src/core/server/deprecations/deprecations_registry.mock.ts @@ -8,9 +8,9 @@ import type { PublicMethodsOf } from '@kbn/utility-types'; import { elasticsearchClientMock } from '@kbn/core-elasticsearch-client-server-mocks'; +import type { GetDeprecationsContext } from '@kbn/core-deprecations-server'; +import { savedObjectsClientMock } from '@kbn/core-saved-objects-api-server-mocks'; import type { DeprecationsRegistry } from './deprecations_registry'; -import type { GetDeprecationsContext } from './types'; -import { savedObjectsClientMock } from '../saved_objects/service/saved_objects_client.mock'; type DeprecationsRegistryContract = PublicMethodsOf; diff --git a/src/core/server/deprecations/deprecations_registry.test.ts b/src/core/server/deprecations/deprecations_registry.test.ts index 0f7e2704d934a..435487bf4db6d 100644 --- a/src/core/server/deprecations/deprecations_registry.test.ts +++ b/src/core/server/deprecations/deprecations_registry.test.ts @@ -7,7 +7,10 @@ */ /* eslint-disable dot-notation */ -import type { RegisterDeprecationsConfig, GetDeprecationsContext } from './types'; +import type { + RegisterDeprecationsConfig, + GetDeprecationsContext, +} from '@kbn/core-deprecations-server'; import { DeprecationsRegistry } from './deprecations_registry'; describe('DeprecationsRegistry', () => { diff --git a/src/core/server/deprecations/deprecations_registry.ts b/src/core/server/deprecations/deprecations_registry.ts index 6e59504d0d1d7..4810d000b5820 100644 --- a/src/core/server/deprecations/deprecations_registry.ts +++ b/src/core/server/deprecations/deprecations_registry.ts @@ -8,7 +8,11 @@ import { withTimeout, isPromise } from '@kbn/std'; import type { DeprecationsDetails } from '@kbn/core-deprecations-common'; -import type { RegisterDeprecationsConfig, GetDeprecationsContext } from './types'; +import type { + RegisterDeprecationsConfig, + GetDeprecationsContext, +} from '@kbn/core-deprecations-server'; + const MsInSec = 1000; export class DeprecationsRegistry { diff --git a/src/core/server/deprecations/deprecations_route_handler_context.ts b/src/core/server/deprecations/deprecations_route_handler_context.ts index bd19023a1ec78..f3bb17dd720a5 100644 --- a/src/core/server/deprecations/deprecations_route_handler_context.ts +++ b/src/core/server/deprecations/deprecations_route_handler_context.ts @@ -7,7 +7,7 @@ */ import type { CoreElasticsearchRouteHandlerContext } from '@kbn/core-elasticsearch-server-internal'; -import type { CoreSavedObjectsRouteHandlerContext } from '../saved_objects'; +import type { CoreSavedObjectsRouteHandlerContext } from '@kbn/core-saved-objects-server-internal'; import type { DeprecationsClient, InternalDeprecationsServiceStart } from './deprecations_service'; /** diff --git a/src/core/server/deprecations/deprecations_service.mock.ts b/src/core/server/deprecations/deprecations_service.mock.ts index c274c4409cce2..a3be83dfc138a 100644 --- a/src/core/server/deprecations/deprecations_service.mock.ts +++ b/src/core/server/deprecations/deprecations_service.mock.ts @@ -7,13 +7,14 @@ */ import type { PublicMethodsOf } from '@kbn/utility-types'; +import type { DeprecationsServiceSetup } from '@kbn/core-deprecations-server'; import { DeprecationsService, InternalDeprecationsServiceSetup, - DeprecationsServiceSetup, InternalDeprecationsServiceStart, DeprecationsClient, } from './deprecations_service'; + type DeprecationsServiceContract = PublicMethodsOf; const createSetupContractMock = () => { diff --git a/src/core/server/deprecations/deprecations_service.ts b/src/core/server/deprecations/deprecations_service.ts index 0fbc6a2940133..5ed25bee4c3d9 100644 --- a/src/core/server/deprecations/deprecations_service.ts +++ b/src/core/server/deprecations/deprecations_service.ts @@ -14,89 +14,14 @@ import type { DomainDeprecationDetails } from '@kbn/core-deprecations-common'; import type { InternalHttpServiceSetup } from '@kbn/core-http-server-internal'; import type { IScopedClusterClient } from '@kbn/core-elasticsearch-server'; import type { SavedObjectsClientContract } from '@kbn/core-saved-objects-api-server'; +import type { + DeprecationsServiceSetup, + DeprecationRegistryProvider, +} from '@kbn/core-deprecations-server'; import { DeprecationsFactory } from './deprecations_factory'; -import { RegisterDeprecationsConfig } from './types'; import { registerRoutes } from './routes'; import { config as deprecationConfig, DeprecationConfigType } from './deprecation_config'; -/** - * The deprecations service provides a way for the Kibana platform to communicate deprecated - * features and configs with its users. These deprecations are only communicated - * if the deployment is using these features. Allowing for a user tailored experience - * for upgrading the stack version. - * - * The Deprecation service is consumed by the upgrade assistant to assist with the upgrade - * experience. - * - * If a deprecated feature can be resolved without manual user intervention. - * Using correctiveActions.api allows the Upgrade Assistant to use this api to correct the - * deprecation upon a user trigger. - * - * @example - * ```ts - * import { DeprecationsDetails, GetDeprecationsContext, CoreSetup } from 'src/core/server'; - * import { i18n } from '@kbn/i18n'; - * - * async function getDeprecations({ esClient, savedObjectsClient }: GetDeprecationsContext): Promise { - * const deprecations: DeprecationsDetails[] = []; - * const count = await getFooCount(savedObjectsClient); - * if (count > 0) { - * deprecations.push({ - * title: i18n.translate('xpack.foo.deprecations.title', { - * defaultMessage: `Foo's are deprecated` - * }), - * message: i18n.translate('xpack.foo.deprecations.message', { - * defaultMessage: `You have {count} Foo's. Migrate your Foo's to a dashboard to continue using them.`, - * values: { count }, - * }), - * documentationUrl: - * 'https://www.elastic.co/guide/en/kibana/current/foo.html', - * level: 'warning', - * correctiveActions: { - * manualSteps: [ - * i18n.translate('xpack.foo.deprecations.manualStepOneMessage', { - * defaultMessage: 'Navigate to the Kibana Dashboard and click "Create dashboard".', - * }), - * i18n.translate('xpack.foo.deprecations.manualStepTwoMessage', { - * defaultMessage: 'Select Foo from the "New Visualization" window.', - * }), - * ], - * api: { - * path: '/internal/security/users/test_dashboard_user', - * method: 'POST', - * body: { - * username: 'test_dashboard_user', - * roles: [ - * "machine_learning_user", - * "enrich_user", - * "kibana_admin" - * ], - * full_name: "Alison Goryachev", - * email: "alisongoryachev@gmail.com", - * metadata: {}, - * enabled: true - * } - * }, - * }, - * }); - * } - * return deprecations; - * } - * - * - * export class Plugin() { - * setup: (core: CoreSetup) => { - * core.deprecations.registerDeprecations({ getDeprecations }); - * } - * } - * ``` - * - * @public - */ -export interface DeprecationsServiceSetup { - registerDeprecations: (deprecationContext: RegisterDeprecationsConfig) => void; -} - /** * Server-side client that provides access to fetch all Kibana deprecations * @@ -118,9 +43,7 @@ export interface InternalDeprecationsServiceStart { } /** @internal */ -export interface InternalDeprecationsServiceSetup { - getRegistry: (domainId: string) => DeprecationsServiceSetup; -} +export type InternalDeprecationsServiceSetup = DeprecationRegistryProvider; /** @internal */ export interface DeprecationsSetupDeps { diff --git a/src/core/server/deprecations/index.ts b/src/core/server/deprecations/index.ts index db6fe8193867d..623a343a6aa88 100644 --- a/src/core/server/deprecations/index.ts +++ b/src/core/server/deprecations/index.ts @@ -6,10 +6,13 @@ * Side Public License, v 1. */ -export type { GetDeprecationsContext, RegisterDeprecationsConfig } from './types'; - export type { DeprecationsServiceSetup, + GetDeprecationsContext, + RegisterDeprecationsConfig, +} from '@kbn/core-deprecations-server'; + +export type { InternalDeprecationsServiceSetup, InternalDeprecationsServiceStart, DeprecationsClient, diff --git a/src/core/server/deprecations/types.ts b/src/core/server/deprecations/types.ts deleted file mode 100644 index d0cf2261728e9..0000000000000 --- a/src/core/server/deprecations/types.ts +++ /dev/null @@ -1,27 +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 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 or the Server - * Side Public License, v 1. - */ - -import type { MaybePromise } from '@kbn/utility-types'; -import type { DeprecationsDetails } from '@kbn/core-deprecations-common'; -import type { IScopedClusterClient } from '@kbn/core-elasticsearch-server'; -import type { SavedObjectsClientContract } from '@kbn/core-saved-objects-api-server'; - -/** - * @public - */ -export interface RegisterDeprecationsConfig { - getDeprecations: (context: GetDeprecationsContext) => MaybePromise; -} - -/** - * @public - */ -export interface GetDeprecationsContext { - esClient: IScopedClusterClient; - savedObjectsClient: SavedObjectsClientContract; -} diff --git a/src/core/server/index.ts b/src/core/server/index.ts index 3327340c91a8c..98fd84e6fc70f 100644 --- a/src/core/server/index.ts +++ b/src/core/server/index.ts @@ -394,15 +394,12 @@ export { mergeSavedObjectMigrationMaps, } from '@kbn/core-saved-objects-utils-server'; export { SavedObjectTypeRegistry } from '@kbn/core-saved-objects-base-server-internal'; - +export type { SavedObjectsRepository } from '@kbn/core-saved-objects-api-server-internal'; +export { SavedObjectsClient } from '@kbn/core-saved-objects-api-server-internal'; export type { - SavedObjectsRepository, - SavedObjectsExporter, SavedObjectsExportError, - SavedObjectsImporter, SavedObjectsImportError, -} from './saved_objects'; -export { SavedObjectsClient } from './saved_objects'; +} from '@kbn/core-saved-objects-import-export-server-internal'; export type { IUiSettingsClient, diff --git a/src/core/server/integration_tests/saved_objects/migrations/actions/actions.test.ts b/src/core/server/integration_tests/saved_objects/migrations/actions/actions.test.ts index a656b0bdd10e5..fc3185c71b8a4 100644 --- a/src/core/server/integration_tests/saved_objects/migrations/actions/actions.test.ts +++ b/src/core/server/integration_tests/saved_objects/migrations/actions/actions.test.ts @@ -39,12 +39,10 @@ import { waitForIndexStatus, initAction, cloneIndex, -} from '../../../../saved_objects/migrations/actions'; -import type { - DocumentsTransformFailed, - DocumentsTransformSuccess, -} from '../../../../saved_objects/migrations/core'; -import { MIGRATION_CLIENT_OPTIONS } from '../../../../saved_objects/migrations/run_resilient_migrator'; + type DocumentsTransformFailed, + type DocumentsTransformSuccess, + MIGRATION_CLIENT_OPTIONS, +} from '@kbn/core-saved-objects-migration-server-internal'; const { startES } = kbnTestServer.createTestServers({ adjustTimeout: (t: number) => jest.setTimeout(t), diff --git a/src/core/server/integration_tests/saved_objects/migrations/actions/es_errors.test.ts b/src/core/server/integration_tests/saved_objects/migrations/actions/es_errors.test.ts index dab9067e93efb..749be45b35cb7 100644 --- a/src/core/server/integration_tests/saved_objects/migrations/actions/es_errors.test.ts +++ b/src/core/server/integration_tests/saved_objects/migrations/actions/es_errors.test.ts @@ -13,9 +13,9 @@ import { Root } from '../../../../root'; import { isWriteBlockException, isClusterShardLimitExceeded, -} from '../../../../saved_objects/migrations/actions/es_errors'; -import { createIndex } from '../../../../saved_objects/migrations/actions/create_index'; -import { setWriteBlock } from '../../../../saved_objects/migrations/actions/set_write_block'; + createIndex, + setWriteBlock, +} from '@kbn/core-saved-objects-migration-server-internal'; const { startES } = kbnTestServer.createTestServers({ adjustTimeout: (t: number) => jest.setTimeout(t), diff --git a/src/core/server/integration_tests/saved_objects/migrations/batch_size_bytes.test.ts b/src/core/server/integration_tests/saved_objects/migrations/batch_size_bytes.test.ts index 1b903ea864890..41733b5419a40 100644 --- a/src/core/server/integration_tests/saved_objects/migrations/batch_size_bytes.test.ts +++ b/src/core/server/integration_tests/saved_objects/migrations/batch_size_bytes.test.ts @@ -16,7 +16,7 @@ import { Env } from '@kbn/config'; import { REPO_ROOT } from '@kbn/utils'; import { getEnvOptions } from '@kbn/config-mocks'; import { LogRecord } from '@kbn/logging'; -import { retryAsync } from '../../../saved_objects/migrations/test_helpers/retry_async'; +import { retryAsync } from '@kbn/core-saved-objects-migration-server-mocks'; const kibanaVersion = Env.createDefault(REPO_ROOT, getEnvOptions()).packageInfo.version; const targetIndex = `.kibana_${kibanaVersion}_001`; diff --git a/src/core/server/integration_tests/saved_objects/migrations/batch_size_bytes_exceeds_es_content_length.test.ts b/src/core/server/integration_tests/saved_objects/migrations/batch_size_bytes_exceeds_es_content_length.test.ts index 670660509f7a8..a81ca34b23fdd 100644 --- a/src/core/server/integration_tests/saved_objects/migrations/batch_size_bytes_exceeds_es_content_length.test.ts +++ b/src/core/server/integration_tests/saved_objects/migrations/batch_size_bytes_exceeds_es_content_length.test.ts @@ -10,8 +10,8 @@ import Path from 'path'; import fs from 'fs/promises'; import JSON5 from 'json5'; import * as kbnTestServer from '../../../../test_helpers/kbn_server'; +import { retryAsync } from '@kbn/core-saved-objects-migration-server-mocks'; import { Root } from '../../../root'; -import { retryAsync } from '../../../saved_objects/migrations/test_helpers/retry_async'; const logFilePath = Path.join(__dirname, 'batch_size_bytes_exceeds_es_content_length.log'); diff --git a/src/core/server/integration_tests/saved_objects/migrations/collects_corrupt_docs.test.ts b/src/core/server/integration_tests/saved_objects/migrations/collects_corrupt_docs.test.ts index 09c0373d235ed..30f9bd2e30b84 100644 --- a/src/core/server/integration_tests/saved_objects/migrations/collects_corrupt_docs.test.ts +++ b/src/core/server/integration_tests/saved_objects/migrations/collects_corrupt_docs.test.ts @@ -90,7 +90,7 @@ describe('migration v2 with corrupt saved object documents', () => { await root.start(); expect(true).toEqual(false); } catch (err) { - const errorMessage = err.message; + const errorMessage = err.message as string; const errorLines = errorMessage.split('\n'); const errorMessageWithoutStack = errorLines .filter((line: string) => !line.includes(' at ')) @@ -117,7 +117,7 @@ describe('migration v2 with corrupt saved object documents', () => { }, { mode: 'contain', - value: 'at transform', + value: 'at tryTransformDoc', }, { mode: 'equal', @@ -129,7 +129,7 @@ describe('migration v2 with corrupt saved object documents', () => { }, { mode: 'contain', - value: 'at migrationFn', + value: 'at 7.14.0', }, { mode: 'equal', @@ -137,7 +137,7 @@ describe('migration v2 with corrupt saved object documents', () => { }, { mode: 'contain', - value: 'at transform', + value: 'at tryTransformDoc', }, { mode: 'equal', @@ -149,7 +149,7 @@ describe('migration v2 with corrupt saved object documents', () => { }, { mode: 'contain', - value: 'at migrationFn', + value: 'at 7.14.0', }, ]); } diff --git a/src/core/server/integration_tests/saved_objects/migrations/incompatible_cluster_routing_allocation.test.ts b/src/core/server/integration_tests/saved_objects/migrations/incompatible_cluster_routing_allocation.test.ts index 95f6445812d81..c4dc0d5623b15 100644 --- a/src/core/server/integration_tests/saved_objects/migrations/incompatible_cluster_routing_allocation.test.ts +++ b/src/core/server/integration_tests/saved_objects/migrations/incompatible_cluster_routing_allocation.test.ts @@ -14,7 +14,7 @@ import { Root } from '../../../root'; import type { ElasticsearchClient } from '@kbn/core-elasticsearch-server'; import { LogRecord } from '@kbn/logging'; import { getDocVersion } from './test_utils'; -import { retryAsync } from '../../../saved_objects/migrations/test_helpers/retry_async'; +import { retryAsync } from '@kbn/core-saved-objects-migration-server-mocks'; const logFilePath = Path.join(__dirname, 'incompatible_cluster_routing_allocation.log'); const docVersion = getDocVersion(); diff --git a/src/core/server/integration_tests/saved_objects/migrations/rewriting_id.test.ts b/src/core/server/integration_tests/saved_objects/migrations/rewriting_id.test.ts index 4cfbe4d9bd1dd..0607787cacb14 100644 --- a/src/core/server/integration_tests/saved_objects/migrations/rewriting_id.test.ts +++ b/src/core/server/integration_tests/saved_objects/migrations/rewriting_id.test.ts @@ -13,7 +13,7 @@ import { kibanaPackageJson as pkg } from '@kbn/utils'; import * as kbnTestServer from '../../../../test_helpers/kbn_server'; import type { ElasticsearchClient } from '@kbn/core-elasticsearch-server'; import { Root } from '../../../root'; -import { deterministicallyRegenerateObjectId } from '../../../saved_objects/migrations/core/document_migrator'; +import { deterministicallyRegenerateObjectId } from '@kbn/core-saved-objects-migration-server-internal'; const logFilePath = Path.join(__dirname, 'rewriting_id.log'); diff --git a/src/core/server/integration_tests/saved_objects/migrations/type_registrations.test.ts b/src/core/server/integration_tests/saved_objects/migrations/type_registrations.test.ts index b71529d2ff1a9..93e3bd913dedc 100644 --- a/src/core/server/integration_tests/saved_objects/migrations/type_registrations.test.ts +++ b/src/core/server/integration_tests/saved_objects/migrations/type_registrations.test.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { REMOVED_TYPES } from '../../../saved_objects/migrations/core'; +import { REMOVED_TYPES } from '@kbn/core-saved-objects-migration-server-internal'; import * as kbnTestServer from '../../../../test_helpers/kbn_server'; // Types should NEVER be removed from this array diff --git a/src/core/server/integration_tests/saved_objects/routes/bulk_create.test.ts b/src/core/server/integration_tests/saved_objects/routes/bulk_create.test.ts index 899cf114f6869..03b4eca6e3a59 100644 --- a/src/core/server/integration_tests/saved_objects/routes/bulk_create.test.ts +++ b/src/core/server/integration_tests/saved_objects/routes/bulk_create.test.ts @@ -7,13 +7,15 @@ */ import supertest from 'supertest'; -import { registerBulkCreateRoute } from '../../../saved_objects/routes/bulk_create'; import { savedObjectsClientMock } from '../../../mocks'; import { CoreUsageStatsClient } from '../../../core_usage_data'; import { coreUsageStatsClientMock } from '../../../core_usage_data/core_usage_stats_client.mock'; import { coreUsageDataServiceMock } from '../../../core_usage_data/core_usage_data_service.mock'; -import { setupServer } from '../../../saved_objects/routes/test_utils'; -import type { InternalSavedObjectsRequestHandlerContext } from '../../../saved_objects/internal_types'; +import { setupServer } from './test_utils'; +import { + registerBulkCreateRoute, + type InternalSavedObjectsRequestHandlerContext, +} from '@kbn/core-saved-objects-server-internal'; type SetupServerReturn = Awaited>; diff --git a/src/core/server/integration_tests/saved_objects/routes/bulk_get.test.ts b/src/core/server/integration_tests/saved_objects/routes/bulk_get.test.ts index 6c903ff672b3d..aeaee514e21fc 100644 --- a/src/core/server/integration_tests/saved_objects/routes/bulk_get.test.ts +++ b/src/core/server/integration_tests/saved_objects/routes/bulk_get.test.ts @@ -7,13 +7,15 @@ */ import supertest from 'supertest'; -import { registerBulkGetRoute } from '../../../saved_objects/routes/bulk_get'; import { savedObjectsClientMock } from '../../../mocks'; import { CoreUsageStatsClient } from '../../../core_usage_data'; import { coreUsageStatsClientMock } from '../../../core_usage_data/core_usage_stats_client.mock'; import { coreUsageDataServiceMock } from '../../../core_usage_data/core_usage_data_service.mock'; -import { setupServer } from '../../../saved_objects/routes/test_utils'; -import type { InternalSavedObjectsRequestHandlerContext } from '../../../saved_objects/internal_types'; +import { setupServer } from './test_utils'; +import { + registerBulkGetRoute, + type InternalSavedObjectsRequestHandlerContext, +} from '@kbn/core-saved-objects-server-internal'; type SetupServerReturn = Awaited>; diff --git a/src/core/server/integration_tests/saved_objects/routes/bulk_resolve.test.ts b/src/core/server/integration_tests/saved_objects/routes/bulk_resolve.test.ts index 0c51e58f713b6..07d053ec8f6e0 100644 --- a/src/core/server/integration_tests/saved_objects/routes/bulk_resolve.test.ts +++ b/src/core/server/integration_tests/saved_objects/routes/bulk_resolve.test.ts @@ -7,13 +7,15 @@ */ import supertest from 'supertest'; -import { registerBulkResolveRoute } from '../../../saved_objects/routes/bulk_resolve'; import { savedObjectsClientMock } from '../../../mocks'; import { CoreUsageStatsClient } from '../../../core_usage_data'; import { coreUsageStatsClientMock } from '../../../core_usage_data/core_usage_stats_client.mock'; import { coreUsageDataServiceMock } from '../../../core_usage_data/core_usage_data_service.mock'; -import { setupServer } from '../../../saved_objects/routes/test_utils'; -import type { InternalSavedObjectsRequestHandlerContext } from '../../../saved_objects/internal_types'; +import { setupServer } from './test_utils'; +import { + registerBulkResolveRoute, + type InternalSavedObjectsRequestHandlerContext, +} from '@kbn/core-saved-objects-server-internal'; type SetupServerReturn = Awaited>; diff --git a/src/core/server/integration_tests/saved_objects/routes/bulk_update.test.ts b/src/core/server/integration_tests/saved_objects/routes/bulk_update.test.ts index 45aedf8544dfa..cd6ae064ae9e0 100644 --- a/src/core/server/integration_tests/saved_objects/routes/bulk_update.test.ts +++ b/src/core/server/integration_tests/saved_objects/routes/bulk_update.test.ts @@ -7,13 +7,15 @@ */ import supertest from 'supertest'; -import { registerBulkUpdateRoute } from '../../../saved_objects/routes/bulk_update'; import { savedObjectsClientMock } from '../../../mocks'; import { CoreUsageStatsClient } from '../../../core_usage_data'; import { coreUsageStatsClientMock } from '../../../core_usage_data/core_usage_stats_client.mock'; import { coreUsageDataServiceMock } from '../../../core_usage_data/core_usage_data_service.mock'; -import { setupServer } from '../../../saved_objects/routes/test_utils'; -import type { InternalSavedObjectsRequestHandlerContext } from '../../../saved_objects/internal_types'; +import { setupServer } from './test_utils'; +import { + registerBulkUpdateRoute, + type InternalSavedObjectsRequestHandlerContext, +} from '@kbn/core-saved-objects-server-internal'; type SetupServerReturn = Awaited>; diff --git a/src/core/server/integration_tests/saved_objects/routes/create.test.ts b/src/core/server/integration_tests/saved_objects/routes/create.test.ts index bdaca61ee23e4..9f002d9043374 100644 --- a/src/core/server/integration_tests/saved_objects/routes/create.test.ts +++ b/src/core/server/integration_tests/saved_objects/routes/create.test.ts @@ -7,13 +7,15 @@ */ import supertest from 'supertest'; -import { registerCreateRoute } from '../../../saved_objects/routes/create'; -import { savedObjectsClientMock } from '../../../saved_objects/service/saved_objects_client.mock'; +import { savedObjectsClientMock } from '@kbn/core-saved-objects-api-server-mocks'; import { CoreUsageStatsClient } from '../../../core_usage_data'; import { coreUsageStatsClientMock } from '../../../core_usage_data/core_usage_stats_client.mock'; import { coreUsageDataServiceMock } from '../../../core_usage_data/core_usage_data_service.mock'; -import { setupServer } from '../../../saved_objects/routes/test_utils'; -import type { InternalSavedObjectsRequestHandlerContext } from '../../../saved_objects/internal_types'; +import { setupServer } from './test_utils'; +import { + registerCreateRoute, + type InternalSavedObjectsRequestHandlerContext, +} from '@kbn/core-saved-objects-server-internal'; type SetupServerReturn = Awaited>; diff --git a/src/core/server/integration_tests/saved_objects/routes/delete.test.ts b/src/core/server/integration_tests/saved_objects/routes/delete.test.ts index 41f7fd06556f9..9d4b9ce5e27b8 100644 --- a/src/core/server/integration_tests/saved_objects/routes/delete.test.ts +++ b/src/core/server/integration_tests/saved_objects/routes/delete.test.ts @@ -7,13 +7,15 @@ */ import supertest from 'supertest'; -import { registerDeleteRoute } from '../../../saved_objects/routes/delete'; import { savedObjectsClientMock } from '../../../mocks'; import { CoreUsageStatsClient } from '../../../core_usage_data'; import { coreUsageStatsClientMock } from '../../../core_usage_data/core_usage_stats_client.mock'; import { coreUsageDataServiceMock } from '../../../core_usage_data/core_usage_data_service.mock'; -import { setupServer } from '../../../saved_objects/routes/test_utils'; -import type { InternalSavedObjectsRequestHandlerContext } from '../../../saved_objects/internal_types'; +import { setupServer } from './test_utils'; +import { + registerDeleteRoute, + type InternalSavedObjectsRequestHandlerContext, +} from '@kbn/core-saved-objects-server-internal'; type SetupServerReturn = Awaited>; diff --git a/src/core/server/integration_tests/saved_objects/routes/delete_unknown_types.test.ts b/src/core/server/integration_tests/saved_objects/routes/delete_unknown_types.test.ts index b4a215169a376..7ff8cfbcaf492 100644 --- a/src/core/server/integration_tests/saved_objects/routes/delete_unknown_types.test.ts +++ b/src/core/server/integration_tests/saved_objects/routes/delete_unknown_types.test.ts @@ -9,10 +9,12 @@ import supertest from 'supertest'; import { elasticsearchServiceMock } from '@kbn/core-elasticsearch-server-mocks'; import { typeRegistryMock } from '@kbn/core-saved-objects-base-server-mocks'; -import { registerDeleteUnknownTypesRoute } from '../../../saved_objects/routes/deprecations'; -import { setupServer } from '../../../saved_objects/routes/test_utils'; +import { setupServer } from './test_utils'; import { SavedObjectsType } from '../../..'; -import type { InternalSavedObjectsRequestHandlerContext } from '../../../saved_objects/internal_types'; +import { + registerDeleteUnknownTypesRoute, + type InternalSavedObjectsRequestHandlerContext, +} from '@kbn/core-saved-objects-server-internal'; type SetupServerReturn = Awaited>; diff --git a/src/core/server/integration_tests/saved_objects/routes/export.test.ts b/src/core/server/integration_tests/saved_objects/routes/export.test.ts index b107d1266fe3c..45c1d42ba7cbc 100644 --- a/src/core/server/integration_tests/saved_objects/routes/export.test.ts +++ b/src/core/server/integration_tests/saved_objects/routes/export.test.ts @@ -6,20 +6,18 @@ * Side Public License, v 1. */ -jest.mock('../../../saved_objects/export', () => ({ - exportSavedObjectsToStream: jest.fn(), -})); - import supertest from 'supertest'; import { createListStream } from '@kbn/utils'; import { CoreUsageStatsClient } from '../../../core_usage_data'; import { coreUsageStatsClientMock } from '../../../core_usage_data/core_usage_stats_client.mock'; import { coreUsageDataServiceMock } from '../../../core_usage_data/core_usage_data_service.mock'; -import { savedObjectsExporterMock } from '../../../saved_objects/export/saved_objects_exporter.mock'; +import { savedObjectsExporterMock } from '@kbn/core-saved-objects-import-export-server-mocks'; import type { SavedObjectConfig } from '@kbn/core-saved-objects-base-server-internal'; -import { registerExportRoute } from '../../../saved_objects/routes/export'; -import { setupServer, createExportableType } from '../../../saved_objects/routes/test_utils'; -import type { InternalSavedObjectsRequestHandlerContext } from '../../../saved_objects/internal_types'; +import { setupServer, createExportableType } from './test_utils'; +import { + registerExportRoute, + type InternalSavedObjectsRequestHandlerContext, +} from '@kbn/core-saved-objects-server-internal'; type SetupServerReturn = Awaited>; const allowedTypes = ['index-pattern', 'search']; diff --git a/src/core/server/integration_tests/saved_objects/routes/find.test.ts b/src/core/server/integration_tests/saved_objects/routes/find.test.ts index 41ec6c26041d4..249222f6dc86b 100644 --- a/src/core/server/integration_tests/saved_objects/routes/find.test.ts +++ b/src/core/server/integration_tests/saved_objects/routes/find.test.ts @@ -9,13 +9,15 @@ import supertest from 'supertest'; import querystring from 'querystring'; -import { registerFindRoute } from '../../../saved_objects/routes/find'; import { savedObjectsClientMock } from '../../../mocks'; import { CoreUsageStatsClient } from '../../../core_usage_data'; import { coreUsageStatsClientMock } from '../../../core_usage_data/core_usage_stats_client.mock'; import { coreUsageDataServiceMock } from '../../../core_usage_data/core_usage_data_service.mock'; -import { setupServer } from '../../../saved_objects/routes/test_utils'; -import type { InternalSavedObjectsRequestHandlerContext } from '../../../saved_objects/internal_types'; +import { setupServer } from './test_utils'; +import { + registerFindRoute, + type InternalSavedObjectsRequestHandlerContext, +} from '@kbn/core-saved-objects-server-internal'; type SetupServerReturn = Awaited>; diff --git a/src/core/server/integration_tests/saved_objects/routes/get.test.ts b/src/core/server/integration_tests/saved_objects/routes/get.test.ts index 264919a9d96b3..d07749be57e9f 100644 --- a/src/core/server/integration_tests/saved_objects/routes/get.test.ts +++ b/src/core/server/integration_tests/saved_objects/routes/get.test.ts @@ -7,17 +7,19 @@ */ import supertest from 'supertest'; -import { registerGetRoute } from '../../../saved_objects/routes/get'; import { ContextService } from '@kbn/core-http-context-server-internal'; import type { HttpService, InternalHttpServiceSetup } from '@kbn/core-http-server-internal'; import { createHttpServer, createCoreContext } from '@kbn/core-http-server-mocks'; -import { savedObjectsClientMock } from '../../../saved_objects/service/saved_objects_client.mock'; +import { savedObjectsClientMock } from '@kbn/core-saved-objects-api-server-mocks'; import type { CoreUsageStatsClient } from '../../../core_usage_data'; import { executionContextServiceMock } from '@kbn/core-execution-context-server-mocks'; import { coreUsageStatsClientMock } from '../../../core_usage_data/core_usage_stats_client.mock'; import { coreUsageDataServiceMock } from '../../../core_usage_data/core_usage_data_service.mock'; import { contextServiceMock, coreMock } from '../../../mocks'; -import type { InternalSavedObjectsRequestHandlerContext } from '../../../saved_objects/internal_types'; +import { + registerGetRoute, + type InternalSavedObjectsRequestHandlerContext, +} from '@kbn/core-saved-objects-server-internal'; const coreId = Symbol('core'); diff --git a/src/core/server/integration_tests/saved_objects/routes/import.test.ts b/src/core/server/integration_tests/saved_objects/routes/import.test.ts index ec6a483e8ae1f..d6c9f9ab7edbc 100644 --- a/src/core/server/integration_tests/saved_objects/routes/import.test.ts +++ b/src/core/server/integration_tests/saved_objects/routes/import.test.ts @@ -10,15 +10,17 @@ jest.mock('uuid'); import supertest from 'supertest'; import { SavedObjectsErrorHelpers } from '@kbn/core-saved-objects-utils-server'; -import { registerImportRoute } from '../../../saved_objects/routes/import'; import { savedObjectsClientMock } from '../../../mocks'; import { CoreUsageStatsClient } from '../../../core_usage_data'; import { coreUsageStatsClientMock } from '../../../core_usage_data/core_usage_stats_client.mock'; import { coreUsageDataServiceMock } from '../../../core_usage_data/core_usage_data_service.mock'; import { SavedObjectConfig } from '@kbn/core-saved-objects-base-server-internal'; -import { setupServer, createExportableType } from '../../../saved_objects/routes/test_utils'; -import { SavedObjectsImporter } from '../../../saved_objects'; -import type { InternalSavedObjectsRequestHandlerContext } from '../../../saved_objects/internal_types'; +import { SavedObjectsImporter } from '@kbn/core-saved-objects-import-export-server-internal'; +import { + registerImportRoute, + type InternalSavedObjectsRequestHandlerContext, +} from '@kbn/core-saved-objects-server-internal'; +import { setupServer, createExportableType } from './test_utils'; type SetupServerReturn = Awaited>; diff --git a/src/core/server/integration_tests/saved_objects/routes/legacy_import_export/export.test.ts b/src/core/server/integration_tests/saved_objects/routes/legacy_import_export/export.test.ts index 22facc0f3235c..f648238d21b7a 100644 --- a/src/core/server/integration_tests/saved_objects/routes/legacy_import_export/export.test.ts +++ b/src/core/server/integration_tests/saved_objects/routes/legacy_import_export/export.test.ts @@ -27,18 +27,17 @@ const exportObjects = [ }, ]; -jest.mock('../../../../saved_objects/routes/legacy_import_export/lib/export_dashboards', () => ({ - exportDashboards: jest.fn().mockResolvedValue({ version: 'mockversion', objects: exportObjects }), -})); - import supertest from 'supertest'; import { CoreUsageStatsClient } from '../../../../core_usage_data'; import { coreUsageStatsClientMock } from '../../../../core_usage_data/core_usage_stats_client.mock'; import { coreUsageDataServiceMock } from '../../../../core_usage_data/core_usage_data_service.mock'; -import { registerLegacyExportRoute } from '../../../../saved_objects/routes/legacy_import_export/export'; -import { setupServer } from '../../../../saved_objects/routes/test_utils'; +import { setupServer } from '../test_utils'; import { loggerMock } from '@kbn/logging-mocks'; -import type { InternalSavedObjectsRequestHandlerContext } from '../../../../saved_objects/internal_types'; +import { SavedObjectsBulkResponse } from '@kbn/core-saved-objects-api-server'; +import { + registerLegacyExportRoute, + type InternalSavedObjectsRequestHandlerContext, +} from '@kbn/core-saved-objects-server-internal'; type SetupServerReturn = Awaited>; let coreUsageStatsClient: jest.Mocked; @@ -46,9 +45,10 @@ let coreUsageStatsClient: jest.Mocked; describe('POST /api/dashboards/export', () => { let server: SetupServerReturn['server']; let httpSetup: SetupServerReturn['httpSetup']; + let handlerContext: SetupServerReturn['handlerContext']; beforeEach(async () => { - ({ server, httpSetup } = await setupServer()); + ({ server, httpSetup, handlerContext } = await setupServer()); const router = httpSetup.createRouter(''); @@ -56,11 +56,19 @@ describe('POST /api/dashboards/export', () => { coreUsageStatsClient.incrementLegacyDashboardsExport.mockRejectedValue(new Error('Oh no!')); // intentionally throw this error, which is swallowed, so we can assert that the operation does not fail const coreUsageData = coreUsageDataServiceMock.createSetupContract(coreUsageStatsClient); registerLegacyExportRoute(router, { - kibanaVersion: '7.14.0', + kibanaVersion: 'mockversion', coreUsageData, logger: loggerMock.create(), }); + handlerContext.savedObjects.client.bulkGet + .mockResolvedValueOnce({ + saved_objects: exportObjects, + } as SavedObjectsBulkResponse) + .mockResolvedValueOnce({ + saved_objects: [], + } as SavedObjectsBulkResponse); + await server.start(); }); diff --git a/src/core/server/integration_tests/saved_objects/routes/legacy_import_export/import.test.ts b/src/core/server/integration_tests/saved_objects/routes/legacy_import_export/import.test.ts index d508d4c048bfb..82d26714c0f90 100644 --- a/src/core/server/integration_tests/saved_objects/routes/legacy_import_export/import.test.ts +++ b/src/core/server/integration_tests/saved_objects/routes/legacy_import_export/import.test.ts @@ -27,18 +27,17 @@ const importObjects = [ }, ]; -jest.mock('../../../../saved_objects/routes/legacy_import_export/lib/import_dashboards', () => ({ - importDashboards: jest.fn().mockResolvedValue({ objects: importObjects }), -})); - import supertest from 'supertest'; import { CoreUsageStatsClient } from '../../../../core_usage_data'; import { coreUsageStatsClientMock } from '../../../../core_usage_data/core_usage_stats_client.mock'; import { coreUsageDataServiceMock } from '../../../../core_usage_data/core_usage_data_service.mock'; -import { registerLegacyImportRoute } from '../../../../saved_objects/routes/legacy_import_export/import'; -import { setupServer } from '../../../../saved_objects/routes/test_utils'; +import { setupServer } from '../test_utils'; import { loggerMock } from '@kbn/logging-mocks'; -import type { InternalSavedObjectsRequestHandlerContext } from '../../../../saved_objects/internal_types'; +import { SavedObjectsBulkResponse } from '@kbn/core-saved-objects-api-server'; +import { + registerLegacyImportRoute, + type InternalSavedObjectsRequestHandlerContext, +} from '@kbn/core-saved-objects-server-internal'; type SetupServerReturn = Awaited>; let coreUsageStatsClient: jest.Mocked; @@ -46,9 +45,10 @@ let coreUsageStatsClient: jest.Mocked; describe('POST /api/dashboards/import', () => { let server: SetupServerReturn['server']; let httpSetup: SetupServerReturn['httpSetup']; + let handlerContext: SetupServerReturn['handlerContext']; beforeEach(async () => { - ({ server, httpSetup } = await setupServer()); + ({ server, httpSetup, handlerContext } = await setupServer()); const router = httpSetup.createRouter(''); @@ -61,6 +61,10 @@ describe('POST /api/dashboards/import', () => { logger: loggerMock.create(), }); + handlerContext.savedObjects.client.bulkCreate.mockResolvedValueOnce({ + saved_objects: importObjects, + } as SavedObjectsBulkResponse); + await server.start(); }); diff --git a/src/core/server/integration_tests/saved_objects/routes/migrate.test.mocks.ts b/src/core/server/integration_tests/saved_objects/routes/migrate.test.mocks.ts index 7f5f03ecfbc0c..7ab5130395b74 100644 --- a/src/core/server/integration_tests/saved_objects/routes/migrate.test.mocks.ts +++ b/src/core/server/integration_tests/saved_objects/routes/migrate.test.mocks.ts @@ -6,10 +6,14 @@ * Side Public License, v 1. */ -import { mockKibanaMigrator } from '../../../saved_objects/migrations/kibana_migrator.mock'; +import { mockKibanaMigrator } from '@kbn/core-saved-objects-migration-server-mocks'; export const migratorInstanceMock = mockKibanaMigrator.create(); export const KibanaMigratorMock = jest.fn().mockImplementation(() => migratorInstanceMock); -jest.doMock('../../../saved_objects/migrations/kibana_migrator', () => ({ - KibanaMigrator: KibanaMigratorMock, -})); +jest.doMock('@kbn/core-saved-objects-migration-server-internal', () => { + const actual = jest.requireActual('@kbn/core-saved-objects-migration-server-internal'); + return { + ...actual, + KibanaMigrator: KibanaMigratorMock, + }; +}); diff --git a/src/core/server/integration_tests/saved_objects/routes/resolve.test.ts b/src/core/server/integration_tests/saved_objects/routes/resolve.test.ts index 8ae3635a8b6ea..dbcf1cbd7a6d7 100644 --- a/src/core/server/integration_tests/saved_objects/routes/resolve.test.ts +++ b/src/core/server/integration_tests/saved_objects/routes/resolve.test.ts @@ -10,14 +10,16 @@ import supertest from 'supertest'; import { ContextService } from '@kbn/core-http-context-server-internal'; import type { HttpService, InternalHttpServiceSetup } from '@kbn/core-http-server-internal'; import { createHttpServer, createCoreContext } from '@kbn/core-http-server-mocks'; -import { registerResolveRoute } from '../../../saved_objects/routes/resolve'; -import { savedObjectsClientMock } from '../../../saved_objects/service/saved_objects_client.mock'; +import { savedObjectsClientMock } from '@kbn/core-saved-objects-api-server-mocks'; import { CoreUsageStatsClient } from '../../../core_usage_data'; import { coreUsageStatsClientMock } from '../../../core_usage_data/core_usage_stats_client.mock'; import { coreUsageDataServiceMock } from '../../../core_usage_data/core_usage_data_service.mock'; import { executionContextServiceMock } from '@kbn/core-execution-context-server-mocks'; import { contextServiceMock, coreMock } from '../../../mocks'; -import type { InternalSavedObjectsRequestHandlerContext } from '../../../saved_objects/internal_types'; +import { + registerResolveRoute, + type InternalSavedObjectsRequestHandlerContext, +} from '@kbn/core-saved-objects-server-internal'; const coreId = Symbol('core'); diff --git a/src/core/server/integration_tests/saved_objects/routes/resolve_import_errors.test.ts b/src/core/server/integration_tests/saved_objects/routes/resolve_import_errors.test.ts index 5d26fde36fae4..e263399c2d675 100644 --- a/src/core/server/integration_tests/saved_objects/routes/resolve_import_errors.test.ts +++ b/src/core/server/integration_tests/saved_objects/routes/resolve_import_errors.test.ts @@ -9,15 +9,17 @@ jest.mock('uuid'); import supertest from 'supertest'; -import { registerResolveImportErrorsRoute } from '../../../saved_objects/routes/resolve_import_errors'; import { savedObjectsClientMock } from '../../../mocks'; import { CoreUsageStatsClient } from '../../../core_usage_data'; import { coreUsageStatsClientMock } from '../../../core_usage_data/core_usage_stats_client.mock'; import { coreUsageDataServiceMock } from '../../../core_usage_data/core_usage_data_service.mock'; -import { setupServer, createExportableType } from '../../../saved_objects/routes/test_utils'; +import { setupServer, createExportableType } from './test_utils'; import { SavedObjectConfig } from '@kbn/core-saved-objects-base-server-internal'; -import { SavedObjectsImporter } from '../../../saved_objects/import'; -import type { InternalSavedObjectsRequestHandlerContext } from '../../../saved_objects/internal_types'; +import { SavedObjectsImporter } from '@kbn/core-saved-objects-import-export-server-internal'; +import { + registerResolveImportErrorsRoute, + type InternalSavedObjectsRequestHandlerContext, +} from '@kbn/core-saved-objects-server-internal'; type SetupServerReturn = Awaited>; diff --git a/src/core/server/saved_objects/routes/test_utils.ts b/src/core/server/integration_tests/saved_objects/routes/test_utils.ts similarity index 83% rename from src/core/server/saved_objects/routes/test_utils.ts rename to src/core/server/integration_tests/saved_objects/routes/test_utils.ts index 8f94837b081a3..89fb671aae377 100644 --- a/src/core/server/saved_objects/routes/test_utils.ts +++ b/src/core/server/integration_tests/saved_objects/routes/test_utils.ts @@ -10,8 +10,7 @@ import { executionContextServiceMock } from '@kbn/core-execution-context-server- import { ContextService } from '@kbn/core-http-context-server-internal'; import { createHttpServer, createCoreContext } from '@kbn/core-http-server-mocks'; import type { SavedObjectsType } from '@kbn/core-saved-objects-server'; -import { contextServiceMock, coreMock } from '../../mocks'; -import type { InternalSavedObjectsRequestHandlerContext } from '../internal_types'; +import { contextServiceMock, coreMock } from '../../../mocks'; const defaultCoreId = Symbol('core'); @@ -27,13 +26,9 @@ export const setupServer = async (coreId: symbol = defaultCoreId) => { }); const handlerContext = coreMock.createRequestHandlerContext(); - httpSetup.registerRouteHandlerContext( - coreId, - 'core', - (ctx, req, res) => { - return handlerContext; - } - ); + httpSetup.registerRouteHandlerContext(coreId, 'core', (ctx, req, res) => { + return handlerContext; + }); return { server, diff --git a/src/core/server/integration_tests/saved_objects/routes/update.test.ts b/src/core/server/integration_tests/saved_objects/routes/update.test.ts index d0b950093239f..3caca07d7570e 100644 --- a/src/core/server/integration_tests/saved_objects/routes/update.test.ts +++ b/src/core/server/integration_tests/saved_objects/routes/update.test.ts @@ -7,13 +7,15 @@ */ import supertest from 'supertest'; -import { registerUpdateRoute } from '../../../saved_objects/routes/update'; import { savedObjectsClientMock } from '../../../mocks'; import { CoreUsageStatsClient } from '../../../core_usage_data'; import { coreUsageStatsClientMock } from '../../../core_usage_data/core_usage_stats_client.mock'; import { coreUsageDataServiceMock } from '../../../core_usage_data/core_usage_data_service.mock'; -import { setupServer } from '../../../saved_objects/routes/test_utils'; -import type { InternalSavedObjectsRequestHandlerContext } from '../../../saved_objects/internal_types'; +import { setupServer } from './test_utils'; +import { + registerUpdateRoute, + type InternalSavedObjectsRequestHandlerContext, +} from '@kbn/core-saved-objects-server-internal'; type SetupServerReturn = Awaited>; diff --git a/src/core/server/internal_types.ts b/src/core/server/internal_types.ts index f37ad2e3a4504..6df001934f090 100644 --- a/src/core/server/internal_types.ts +++ b/src/core/server/internal_types.ts @@ -44,7 +44,7 @@ import type { CapabilitiesSetup, CapabilitiesStart } from '@kbn/core-capabilitie import { InternalSavedObjectsServiceSetup, InternalSavedObjectsServiceStart, -} from './saved_objects'; +} from '@kbn/core-saved-objects-server-internal'; import { InternalUiSettingsServicePreboot, InternalUiSettingsServiceSetup, diff --git a/src/core/server/mocks.ts b/src/core/server/mocks.ts index e2ae9a96b716d..ebc5d92be84b0 100644 --- a/src/core/server/mocks.ts +++ b/src/core/server/mocks.ts @@ -24,6 +24,8 @@ import { elasticsearchServiceMock } from '@kbn/core-elasticsearch-server-mocks'; import { metricsServiceMock } from '@kbn/core-metrics-server-mocks'; import { capabilitiesServiceMock } from '@kbn/core-capabilities-server-mocks'; import { typeRegistryMock as savedObjectsTypeRegistryMock } from '@kbn/core-saved-objects-base-server-mocks'; +import { savedObjectsServiceMock } from '@kbn/core-saved-objects-server-mocks'; +import { savedObjectsClientMock } from '@kbn/core-saved-objects-api-server-mocks'; import type { PluginInitializerContext, CoreSetup, @@ -33,8 +35,6 @@ import type { RequestHandlerContext, } from '.'; import { httpResourcesMock } from './http_resources/http_resources_service.mock'; -import { savedObjectsServiceMock } from './saved_objects/saved_objects_service.mock'; -import { savedObjectsClientMock } from './saved_objects/service/saved_objects_client.mock'; import { renderingMock } from './rendering/rendering_service.mock'; import { uiSettingsServiceMock } from './ui_settings/ui_settings_service.mock'; import { SharedGlobalConfig } from './plugins'; @@ -49,10 +49,12 @@ export { httpServerMock, sessionStorageMock, httpServiceMock } from '@kbn/core-h export { elasticsearchServiceMock } from '@kbn/core-elasticsearch-server-mocks'; export { typeRegistryMock as savedObjectsTypeRegistryMock } from '@kbn/core-saved-objects-base-server-mocks'; export { httpResourcesMock } from './http_resources/http_resources_service.mock'; -export { savedObjectsRepositoryMock } from './saved_objects/service/lib/repository.mock'; -export { savedObjectsServiceMock } from './saved_objects/saved_objects_service.mock'; -export { savedObjectsClientMock } from './saved_objects/service/saved_objects_client.mock'; -export { migrationMocks } from './saved_objects/migrations/mocks'; +export { savedObjectsServiceMock } from '@kbn/core-saved-objects-server-mocks'; +export { + savedObjectsClientMock, + savedObjectsRepositoryMock, +} from '@kbn/core-saved-objects-api-server-mocks'; +export { migrationMocks } from '@kbn/core-saved-objects-migration-server-mocks'; export { uiSettingsServiceMock } from './ui_settings/ui_settings_service.mock'; export { metricsServiceMock } from '@kbn/core-metrics-server-mocks'; export { renderingMock } from './rendering/rendering_service.mock'; diff --git a/src/core/server/saved_objects/migrations/core/types.ts b/src/core/server/saved_objects/migrations/core/types.ts deleted file mode 100644 index 61985d8f10996..0000000000000 --- a/src/core/server/saved_objects/migrations/core/types.ts +++ /dev/null @@ -1,23 +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 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 or the Server - * Side Public License, v 1. - */ - -export type MigrationStatus = - | 'waiting_to_start' - | 'waiting_for_other_nodes' - | 'running' - | 'completed'; - -export type MigrationResult = - | { status: 'skipped' } - | { status: 'patched' } - | { - status: 'migrated'; - destIndex: string; - sourceIndex: string; - elapsedMs: number; - }; diff --git a/src/core/server/server.test.mocks.ts b/src/core/server/server.test.mocks.ts index bd79d33d6d24e..35512c0918620 100644 --- a/src/core/server/server.test.mocks.ts +++ b/src/core/server/server.test.mocks.ts @@ -37,10 +37,10 @@ jest.doMock('@kbn/config', () => ({ ConfigService: jest.fn(() => mockConfigService), })); -import { savedObjectsServiceMock } from './saved_objects/saved_objects_service.mock'; +import { savedObjectsServiceMock } from '@kbn/core-saved-objects-server-mocks'; export const mockSavedObjectsService = savedObjectsServiceMock.create(); -jest.doMock('./saved_objects/saved_objects_service', () => ({ +jest.doMock('@kbn/core-saved-objects-server-internal', () => ({ SavedObjectsService: jest.fn(() => mockSavedObjectsService), })); diff --git a/src/core/server/server.ts b/src/core/server/server.ts index 82705f2428e5c..b73cd8fc99753 100644 --- a/src/core/server/server.ts +++ b/src/core/server/server.ts @@ -49,15 +49,15 @@ import { savedObjectsConfig, savedObjectsMigrationConfig, } from '@kbn/core-saved-objects-base-server-internal'; +import { SavedObjectsService } from '@kbn/core-saved-objects-server-internal'; import { CoreApp } from './core_app'; import { I18nService } from './i18n'; import { HttpResourcesService } from './http_resources'; import { RenderingService } from './rendering'; import { UiSettingsService } from './ui_settings'; import { PluginsService, config as pluginsConfig } from './plugins'; -import { SavedObjectsService } from './saved_objects'; -// do not try to shorten the import to `./status`, it will break server test mocking +// do not try to shorten the import to `./status`, it will break server test mocking import { StatusService } from './status/status_service'; import { config as uiSettingsConfig } from './ui_settings'; import { config as statusConfig } from './status'; diff --git a/src/core/server/status/routes/status.ts b/src/core/server/status/routes/status.ts index 1528a8ef8fda2..5033f2e9beace 100644 --- a/src/core/server/status/routes/status.ts +++ b/src/core/server/status/routes/status.ts @@ -13,7 +13,7 @@ import { PackageInfo } from '@kbn/config'; import type { PluginName } from '@kbn/core-base-common'; import type { IRouter } from '@kbn/core-http-server'; import type { MetricsServiceSetup } from '@kbn/core-metrics-server'; -import type { CoreIncrementUsageCounter } from '../../core_usage_data/types'; +import type { CoreIncrementUsageCounter } from '@kbn/core-usage-data-server'; import { ServiceStatus, CoreStatus, ServiceStatusLevels } from '../types'; import { calculateLegacyStatus, LegacyStatusInfo } from '../legacy_status'; import { StatusResponse } from '../../../types/status'; diff --git a/src/core/server/status/status_service.ts b/src/core/server/status/status_service.ts index 864348ec78aa3..02f66740eb781 100644 --- a/src/core/server/status/status_service.ts +++ b/src/core/server/status/status_service.ts @@ -27,7 +27,7 @@ import type { InternalEnvironmentServiceSetup } from '@kbn/core-environment-serv import type { InternalHttpServiceSetup } from '@kbn/core-http-server-internal'; import type { InternalElasticsearchServiceSetup } from '@kbn/core-elasticsearch-server-internal'; import type { InternalMetricsServiceSetup } from '@kbn/core-metrics-server-internal'; -import { InternalSavedObjectsServiceSetup } from '../saved_objects'; +import type { InternalSavedObjectsServiceSetup } from '@kbn/core-saved-objects-server-internal'; import { registerStatusRoute } from './routes'; import type { InternalCoreUsageDataSetup } from '../core_usage_data'; diff --git a/src/core/server/test_utils.ts b/src/core/server/test_utils.ts index 219ed320e4011..c96e168e16291 100644 --- a/src/core/server/test_utils.ts +++ b/src/core/server/test_utils.ts @@ -8,7 +8,7 @@ export { createHttpServer } from '@kbn/core-http-server-mocks'; export { ServiceStatusLevelSnapshotSerializer } from './status/test_utils'; -export { setupServer } from './saved_objects/routes/test_utils'; +export { setupServer } from './integration_tests/saved_objects/routes/test_utils'; export { getDeprecationsFor, getDeprecationsForGlobalSettings, diff --git a/src/core/server/ui_settings/create_or_upgrade_saved_config/create_or_upgrade_saved_config.test.ts b/src/core/server/ui_settings/create_or_upgrade_saved_config/create_or_upgrade_saved_config.test.ts index 6102ff6f7b1be..eb47729070501 100644 --- a/src/core/server/ui_settings/create_or_upgrade_saved_config/create_or_upgrade_saved_config.test.ts +++ b/src/core/server/ui_settings/create_or_upgrade_saved_config/create_or_upgrade_saved_config.test.ts @@ -11,7 +11,7 @@ import { mockGetUpgradeableConfig, } from './create_or_upgrade_saved_config.test.mock'; import { SavedObjectsErrorHelpers } from '@kbn/core-saved-objects-utils-server'; -import { savedObjectsClientMock } from '../../saved_objects/service/saved_objects_client.mock'; +import { savedObjectsClientMock } from '@kbn/core-saved-objects-api-server-mocks'; import { loggingSystemMock } from '@kbn/core-logging-server-mocks'; import { createOrUpgradeSavedConfig } from './create_or_upgrade_saved_config'; diff --git a/src/core/server/ui_settings/create_or_upgrade_saved_config/get_upgradeable_config.test.ts b/src/core/server/ui_settings/create_or_upgrade_saved_config/get_upgradeable_config.test.ts index b3f7b9f2fd55a..26992ad33df46 100644 --- a/src/core/server/ui_settings/create_or_upgrade_saved_config/get_upgradeable_config.test.ts +++ b/src/core/server/ui_settings/create_or_upgrade_saved_config/get_upgradeable_config.test.ts @@ -7,8 +7,8 @@ */ import type { SavedObjectsFindResponse } from '@kbn/core-saved-objects-api-server'; +import { savedObjectsClientMock } from '@kbn/core-saved-objects-api-server-mocks'; import { getUpgradeableConfig } from './get_upgradeable_config'; -import { savedObjectsClientMock } from '../../saved_objects/service/saved_objects_client.mock'; describe('getUpgradeableConfig', () => { it('finds saved objects with type "config"', async () => { diff --git a/src/core/server/ui_settings/ui_settings_client.test.ts b/src/core/server/ui_settings/ui_settings_client.test.ts index 1f2cab3f44c03..0467897d2fde6 100644 --- a/src/core/server/ui_settings/ui_settings_client.test.ts +++ b/src/core/server/ui_settings/ui_settings_client.test.ts @@ -12,8 +12,8 @@ import { schema } from '@kbn/config-schema'; import { loggingSystemMock } from '@kbn/core-logging-server-mocks'; import { mockCreateOrUpgradeSavedConfig } from './ui_settings_client.test.mock'; -import { SavedObjectsClient } from '../saved_objects'; -import { savedObjectsClientMock } from '../saved_objects/service/saved_objects_client.mock'; +import { SavedObjectsClient } from '@kbn/core-saved-objects-api-server-internal'; +import { savedObjectsClientMock } from '@kbn/core-saved-objects-api-server-mocks'; import { UiSettingsClient } from './ui_settings_client'; import { CannotOverrideError } from './ui_settings_errors'; diff --git a/src/core/server/ui_settings/ui_settings_route_handler_context.ts b/src/core/server/ui_settings/ui_settings_route_handler_context.ts index a975f0faad6ef..09a6aa4c43d64 100644 --- a/src/core/server/ui_settings/ui_settings_route_handler_context.ts +++ b/src/core/server/ui_settings/ui_settings_route_handler_context.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import type { CoreSavedObjectsRouteHandlerContext } from '../saved_objects'; +import type { CoreSavedObjectsRouteHandlerContext } from '@kbn/core-saved-objects-server-internal'; import type { IUiSettingsClient, InternalUiSettingsServiceStart } from './types'; /** diff --git a/src/core/server/ui_settings/ui_settings_service.test.ts b/src/core/server/ui_settings/ui_settings_service.test.ts index 64ba0880816e0..2cfee201609d1 100644 --- a/src/core/server/ui_settings/ui_settings_service.test.ts +++ b/src/core/server/ui_settings/ui_settings_service.test.ts @@ -17,8 +17,8 @@ import { getCoreSettingsMock, } from './ui_settings_service.test.mock'; import { UiSettingsService, SetupDeps } from './ui_settings_service'; -import { savedObjectsClientMock } from '../mocks'; -import { savedObjectsServiceMock } from '../saved_objects/saved_objects_service.mock'; +import { savedObjectsClientMock } from '@kbn/core-saved-objects-api-server-mocks'; +import { savedObjectsServiceMock } from '@kbn/core-saved-objects-server-mocks'; import { uiSettingsType } from './saved_objects'; import { UiSettingsDefaultsClient } from './ui_settings_defaults_client'; diff --git a/src/core/server/ui_settings/ui_settings_service.ts b/src/core/server/ui_settings/ui_settings_service.ts index 3b7bc2b27a3ea..04f22e51828c1 100644 --- a/src/core/server/ui_settings/ui_settings_service.ts +++ b/src/core/server/ui_settings/ui_settings_service.ts @@ -13,7 +13,7 @@ import type { Logger } from '@kbn/logging'; import type { CoreContext, CoreService } from '@kbn/core-base-server-internal'; import type { InternalHttpServiceSetup } from '@kbn/core-http-server-internal'; import type { SavedObjectsClientContract } from '@kbn/core-saved-objects-api-server'; -import { InternalSavedObjectsServiceSetup } from '../saved_objects'; +import { InternalSavedObjectsServiceSetup } from '@kbn/core-saved-objects-server-internal'; import { UiSettingsConfigType, config as uiConfigDefinition } from './ui_settings_config'; import { UiSettingsClient } from './ui_settings_client'; import { diff --git a/src/plugins/kibana_usage_collection/server/collectors/core/core_usage_collector.ts b/src/plugins/kibana_usage_collection/server/collectors/core/core_usage_collector.ts index 9e0d7cfc8e8ba..ce8e27f318cfd 100644 --- a/src/plugins/kibana_usage_collection/server/collectors/core/core_usage_collector.ts +++ b/src/plugins/kibana_usage_collection/server/collectors/core/core_usage_collector.ts @@ -7,7 +7,8 @@ */ import { UsageCollectionSetup } from '@kbn/usage-collection-plugin/server'; -import { CoreUsageData, CoreUsageDataStart } from '@kbn/core/server'; +import { CoreUsageDataStart } from '@kbn/core/server'; +import { CoreUsageData } from './core_usage_data'; export function getCoreUsageCollector( usageCollection: UsageCollectionSetup, diff --git a/src/core/server/core_usage_data/types.ts b/src/plugins/kibana_usage_collection/server/collectors/core/core_usage_data.ts similarity index 81% rename from src/core/server/core_usage_data/types.ts rename to src/plugins/kibana_usage_collection/server/collectors/core/core_usage_data.ts index 0b09444da493d..36aac8ec0511a 100644 --- a/src/core/server/core_usage_data/types.ts +++ b/src/plugins/kibana_usage_collection/server/collectors/core/core_usage_data.ts @@ -6,15 +6,15 @@ * Side Public License, v 1. */ -import { CoreUsageStatsClient } from './core_usage_stats_client'; -import { ISavedObjectTypeRegistry, SavedObjectTypeRegistry } from '..'; +// duplicate of the types from @kbn/core-usage-data-server +// required until https://github.com/elastic/kibana/issues/139389 is addressed + +export interface CoreUsageData extends CoreUsageStats { + config: CoreConfigUsageData; + services: CoreServicesUsageData; + environment: CoreEnvironmentUsageData; +} -/** - * @internal - * - * CoreUsageStats are collected over time while Kibana is running. This is related to CoreUsageData, which is a superset of this that also - * includes point-in-time configuration information. - * */ export interface CoreUsageStats { // Saved Objects Client APIs 'apiCalls.savedObjectsBulkCreate.total'?: number; @@ -140,32 +140,6 @@ export interface CoreUsageStats { 'savedObjectsRepository.resolvedOutcome.total'?: number; } -/** - * Type describing Core's usage data payload - * @internal - */ -export interface CoreUsageData extends CoreUsageStats { - config: CoreConfigUsageData; - services: CoreServicesUsageData; - environment: CoreEnvironmentUsageData; -} - -/** - * Type describing Core's usage data payload - * @internal - */ -export type ConfigUsageData = Record; - -/** - * Type describing Core's usage data payload - * @internal - */ -export type ExposedConfigsToUsage = Map>; - -/** - * Usage data from Core services - * @internal - */ export interface CoreServicesUsageData { savedObjects: { // scripts/telemetry_check.js does not support parsing Array<{...}> types @@ -190,7 +164,7 @@ export interface CoreServicesUsageData { /** * Usage data on this Kibana node's runtime environment. - * @internal + * @public */ export interface CoreEnvironmentUsageData { memory: { @@ -203,7 +177,7 @@ export interface CoreEnvironmentUsageData { /** * Usage data on this cluster's configuration of Core features - * @internal + * @public */ export interface CoreConfigUsageData { elasticsearch: { @@ -302,79 +276,3 @@ export interface CoreConfigUsageData { unset: string[]; }; } - -/** - * @internal Details about the counter to be incremented - */ -export interface CoreIncrementCounterParams { - /** The name of the counter **/ - counterName: string; - /** The counter type ("count" by default) **/ - counterType?: string; - /** Increment the counter by this number (1 if not specified) **/ - incrementBy?: number; -} - -/** - * @internal - * Method to call whenever an event occurs, so the counter can be increased. - */ -export type CoreIncrementUsageCounter = (params: CoreIncrementCounterParams) => void; - -/** - * @internal - * API to track whenever an event occurs, so the core can report them. - */ -export interface CoreUsageCounter { - /** @internal {@link CoreIncrementUsageCounter} **/ - incrementCounter: CoreIncrementUsageCounter; -} - -/** @internal */ -export interface InternalCoreUsageDataSetup extends CoreUsageDataSetup { - registerType( - typeRegistry: ISavedObjectTypeRegistry & Pick - ): void; - getClient(): CoreUsageStatsClient; - - /** @internal {@link CoreIncrementUsageCounter} **/ - incrementUsageCounter: CoreIncrementUsageCounter; -} - -/** - * Internal API for registering the Usage Tracker used for Core's usage data payload. - * - * @note This API should never be used to drive application logic and is only - * intended for telemetry purposes. - * - * @internal - */ -export interface CoreUsageDataSetup { - /** - * @internal - * API for a usage tracker plugin to inject the {@link CoreUsageCounter} to use - * when tracking events. - */ - registerUsageCounter: (usageCounter: CoreUsageCounter) => void; -} - -/** - * Internal API for getting Core's usage data payload. - * - * @note This API should never be used to drive application logic and is only - * intended for telemetry purposes. - * - * @internal - */ -export interface CoreUsageDataStart { - /** - * Internal API for getting Core's usage data payload. - * - * @note This API should never be used to drive application logic and is only - * intended for telemetry purposes. - * - * @internal - * */ - getCoreUsageData(): Promise; - getConfigsUsageData(): Promise; -} diff --git a/x-pack/plugins/fleet/server/services/epm/elasticsearch/transform/remove.test.ts b/x-pack/plugins/fleet/server/services/epm/elasticsearch/transform/remove.test.ts index 41c25c6d4fd66..c7effcc47f993 100644 --- a/x-pack/plugins/fleet/server/services/epm/elasticsearch/transform/remove.test.ts +++ b/x-pack/plugins/fleet/server/services/epm/elasticsearch/transform/remove.test.ts @@ -7,7 +7,7 @@ import type { SavedObjectsClientContract } from '@kbn/core/server'; -import { savedObjectsClientMock } from '@kbn/core/server/saved_objects/service/saved_objects_client.mock'; +import { savedObjectsClientMock } from '@kbn/core/server/mocks'; import type { EsAssetReference } from '../../../../../common/types/models'; diff --git a/x-pack/plugins/fleet/server/services/epm/elasticsearch/transform/transform.test.ts b/x-pack/plugins/fleet/server/services/epm/elasticsearch/transform/transform.test.ts index 574d7f2627b42..1b8c347ad07d5 100644 --- a/x-pack/plugins/fleet/server/services/epm/elasticsearch/transform/transform.test.ts +++ b/x-pack/plugins/fleet/server/services/epm/elasticsearch/transform/transform.test.ts @@ -22,7 +22,7 @@ import { errors } from '@elastic/elasticsearch'; import type { SavedObject, SavedObjectsClientContract } from '@kbn/core/server'; import { loggerMock } from '@kbn/logging-mocks'; -import { savedObjectsClientMock } from '@kbn/core/server/saved_objects/service/saved_objects_client.mock'; +import { savedObjectsClientMock } from '@kbn/core/server/mocks'; import { elasticsearchClientMock } from '@kbn/core-elasticsearch-client-server-mocks'; import { getInstallation, getInstallationObject } from '../../packages'; diff --git a/x-pack/plugins/fleet/server/services/epm/kibana/assets/install.ts b/x-pack/plugins/fleet/server/services/epm/kibana/assets/install.ts index b4a9564e1199e..62b6083769866 100644 --- a/x-pack/plugins/fleet/server/services/epm/kibana/assets/install.ts +++ b/x-pack/plugins/fleet/server/services/epm/kibana/assets/install.ts @@ -11,7 +11,7 @@ import type { SavedObject, SavedObjectsBulkCreateObject, SavedObjectsClientContract, - SavedObjectsImporter, + ISavedObjectsImporter, Logger, } from '@kbn/core/server'; import type { SavedObjectsImportSuccess, SavedObjectsImportFailure } from '@kbn/core/server/types'; @@ -33,7 +33,7 @@ import { withPackageSpan } from '../../packages/utils'; import { tagKibanaAssets } from './tag_assets'; -type SavedObjectsImporterContract = Pick; +type SavedObjectsImporterContract = Pick; const formatImportErrorsForLog = (errors: SavedObjectsImportFailure[]) => JSON.stringify( errors.map(({ type, id, error }) => ({ type, id, error })) // discard other fields @@ -143,7 +143,7 @@ export async function installKibanaAssetsAndReferences({ installedPkg, }: { savedObjectsClient: SavedObjectsClientContract; - savedObjectsImporter: Pick; + savedObjectsImporter: Pick; savedObjectTagAssignmentService: IAssignmentService; savedObjectTagClient: ITagsClient; logger: Logger; diff --git a/x-pack/plugins/fleet/server/services/epm/packages/_install_package.ts b/x-pack/plugins/fleet/server/services/epm/packages/_install_package.ts index 00eb71e918bd2..8168bb05e53a4 100644 --- a/x-pack/plugins/fleet/server/services/epm/packages/_install_package.ts +++ b/x-pack/plugins/fleet/server/services/epm/packages/_install_package.ts @@ -10,7 +10,7 @@ import type { Logger, SavedObject, SavedObjectsClientContract, - SavedObjectsImporter, + ISavedObjectsImporter, } from '@kbn/core/server'; import { SavedObjectsErrorHelpers } from '@kbn/core/server'; @@ -71,7 +71,7 @@ export async function _installPackage({ verificationResult, }: { savedObjectsClient: SavedObjectsClientContract; - savedObjectsImporter: Pick; + savedObjectsImporter: Pick; savedObjectTagAssignmentService: IAssignmentService; savedObjectTagClient: ITagsClient; esClient: ElasticsearchClient; diff --git a/x-pack/plugins/monitoring/server/alerts/license_expiration_rule.test.ts b/x-pack/plugins/monitoring/server/alerts/license_expiration_rule.test.ts index c7bc493cab80a..c60ebf0de2966 100644 --- a/x-pack/plugins/monitoring/server/alerts/license_expiration_rule.test.ts +++ b/x-pack/plugins/monitoring/server/alerts/license_expiration_rule.test.ts @@ -21,9 +21,11 @@ jest.mock('../lib/alerts/fetch_clusters', () => ({ fetchClusters: jest.fn(), })); jest.mock('moment', () => { - const moment = function () {}; - moment.duration = () => ({ humanize: () => 'HUMANIZED_DURATION' }); - return moment; + const actual = jest.requireActual('moment'); + return { + ...actual, + duration: () => ({ humanize: () => 'HUMANIZED_DURATION' }), + }; }); jest.mock('../static_globals', () => ({ @@ -69,6 +71,7 @@ describe('LicenseExpirationRule', () => { describe('execute', () => { function FakeDate() {} + FakeDate.prototype.valueOf = () => 1; const clusterUuid = 'abc123'; diff --git a/yarn.lock b/yarn.lock index a65095864346e..9a45cbf559f96 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2815,6 +2815,10 @@ version "0.0.0" uid "" +"@kbn/core-deprecations-server@link:bazel-bin/packages/core/deprecations/core-deprecations-server": + version "0.0.0" + uid "" + "@kbn/core-doc-links-browser-internal@link:bazel-bin/packages/core/doc-links/core-doc-links-browser-internal": version "0.0.0" uid "" @@ -3083,6 +3087,14 @@ version "0.0.0" uid "" +"@kbn/core-saved-objects-api-server-internal@link:bazel-bin/packages/core/saved-objects/core-saved-objects-api-server-internal": + version "0.0.0" + uid "" + +"@kbn/core-saved-objects-api-server-mocks@link:bazel-bin/packages/core/saved-objects/core-saved-objects-api-server-mocks": + version "0.0.0" + uid "" + "@kbn/core-saved-objects-api-server@link:bazel-bin/packages/core/saved-objects/core-saved-objects-api-server": version "0.0.0" uid "" @@ -3111,6 +3123,30 @@ version "0.0.0" uid "" +"@kbn/core-saved-objects-import-export-server-internal@link:bazel-bin/packages/core/saved-objects/core-saved-objects-import-export-server-internal": + version "0.0.0" + uid "" + +"@kbn/core-saved-objects-import-export-server-mocks@link:bazel-bin/packages/core/saved-objects/core-saved-objects-import-export-server-mocks": + version "0.0.0" + uid "" + +"@kbn/core-saved-objects-migration-server-internal@link:bazel-bin/packages/core/saved-objects/core-saved-objects-migration-server-internal": + version "0.0.0" + uid "" + +"@kbn/core-saved-objects-migration-server-mocks@link:bazel-bin/packages/core/saved-objects/core-saved-objects-migration-server-mocks": + version "0.0.0" + uid "" + +"@kbn/core-saved-objects-server-internal@link:bazel-bin/packages/core/saved-objects/core-saved-objects-server-internal": + version "0.0.0" + uid "" + +"@kbn/core-saved-objects-server-mocks@link:bazel-bin/packages/core/saved-objects/core-saved-objects-server-mocks": + version "0.0.0" + uid "" + "@kbn/core-saved-objects-server@link:bazel-bin/packages/core/saved-objects/core-saved-objects-server": version "0.0.0" uid "" @@ -3155,6 +3191,14 @@ version "0.0.0" uid "" +"@kbn/core-usage-data-base-server-internal@link:bazel-bin/packages/core/usage-data/core-usage-data-base-server-internal": + version "0.0.0" + uid "" + +"@kbn/core-usage-data-server@link:bazel-bin/packages/core/usage-data/core-usage-data-server": + version "0.0.0" + uid "" + "@kbn/crypto-browser@link:bazel-bin/packages/kbn-crypto-browser": version "0.0.0" uid "" @@ -6793,6 +6837,10 @@ version "0.0.0" uid "" +"@types/kbn__core-deprecations-server@link:bazel-bin/packages/core/deprecations/core-deprecations-server/npm_module_types": + version "0.0.0" + uid "" + "@types/kbn__core-doc-links-browser-internal@link:bazel-bin/packages/core/doc-links/core-doc-links-browser-internal/npm_module_types": version "0.0.0" uid "" @@ -7065,6 +7113,14 @@ version "0.0.0" uid "" +"@types/kbn__core-saved-objects-api-server-internal@link:bazel-bin/packages/core/saved-objects/core-saved-objects-api-server-internal/npm_module_types": + version "0.0.0" + uid "" + +"@types/kbn__core-saved-objects-api-server-mocks@link:bazel-bin/packages/core/saved-objects/core-saved-objects-api-server-mocks/npm_module_types": + version "0.0.0" + uid "" + "@types/kbn__core-saved-objects-api-server@link:bazel-bin/packages/core/saved-objects/core-saved-objects-api-server/npm_module_types": version "0.0.0" uid "" @@ -7093,6 +7149,30 @@ version "0.0.0" uid "" +"@types/kbn__core-saved-objects-import-export-server-internal@link:bazel-bin/packages/core/saved-objects/core-saved-objects-import-export-server-internal/npm_module_types": + version "0.0.0" + uid "" + +"@types/kbn__core-saved-objects-import-export-server-mocks@link:bazel-bin/packages/core/saved-objects/core-saved-objects-import-export-server-mocks/npm_module_types": + version "0.0.0" + uid "" + +"@types/kbn__core-saved-objects-migration-server-internal@link:bazel-bin/packages/core/saved-objects/core-saved-objects-migration-server-internal/npm_module_types": + version "0.0.0" + uid "" + +"@types/kbn__core-saved-objects-migration-server-mocks@link:bazel-bin/packages/core/saved-objects/core-saved-objects-migration-server-mocks/npm_module_types": + version "0.0.0" + uid "" + +"@types/kbn__core-saved-objects-server-internal@link:bazel-bin/packages/core/saved-objects/core-saved-objects-server-internal/npm_module_types": + version "0.0.0" + uid "" + +"@types/kbn__core-saved-objects-server-mocks@link:bazel-bin/packages/core/saved-objects/core-saved-objects-server-mocks/npm_module_types": + version "0.0.0" + uid "" + "@types/kbn__core-saved-objects-server@link:bazel-bin/packages/core/saved-objects/core-saved-objects-server/npm_module_types": version "0.0.0" uid "" @@ -7141,6 +7221,14 @@ version "0.0.0" uid "" +"@types/kbn__core-usage-data-base-server-internal@link:bazel-bin/packages/core/usage-data/core-usage-data-base-server-internal/npm_module_types": + version "0.0.0" + uid "" + +"@types/kbn__core-usage-data-server@link:bazel-bin/packages/core/usage-data/core-usage-data-server/npm_module_types": + version "0.0.0" + uid "" + "@types/kbn__crypto-browser@link:bazel-bin/packages/kbn-crypto-browser/npm_module_types": version "0.0.0" uid "" From 1a82f0d8755ffd1e651397839af4c6f0d910aa51 Mon Sep 17 00:00:00 2001 From: Carlos Crespo Date: Fri, 26 Aug 2022 13:02:53 +0200 Subject: [PATCH 15/28] [Stack Monitoring] Add log-* index pattern support on SM UI (#139121) * Add log-* index pattern support on SM UI * logs query fix * remove datastream dedicated filter * [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix' * remove comment * renaming filebeat leftovers to logs * extract elasticsearch logs filter * [CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix' * update filter * typo Co-authored-by: klacabane Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../common/types/{filebeat.ts => logs.ts} | 6 +- .../lib/cluster/get_clusters_from_request.ts | 12 +- .../lib/cluster/get_index_patterns.test.ts | 228 +++++++++++++----- .../server/lib/cluster/get_index_patterns.ts | 92 ++++--- .../server/lib/logs/detect_reason.ts | 44 ++-- .../server/lib/logs/get_log_types.ts | 22 +- .../monitoring/server/lib/logs/get_logs.ts | 34 +-- .../server/lib/logs/init_infra_source.ts | 13 +- .../monitoring/server/lib/logs/logs_filter.ts | 12 + .../server/routes/api/v1/cluster/cluster.ts | 8 +- .../server/routes/api/v1/cluster/clusters.ts | 9 +- .../api/v1/elasticsearch/index_detail.ts | 15 +- .../api/v1/elasticsearch/node_detail.ts | 16 +- .../routes/api/v1/elasticsearch/overview.ts | 15 +- 14 files changed, 330 insertions(+), 196 deletions(-) rename x-pack/plugins/monitoring/common/types/{filebeat.ts => logs.ts} (85%) create mode 100644 x-pack/plugins/monitoring/server/lib/logs/logs_filter.ts diff --git a/x-pack/plugins/monitoring/common/types/filebeat.ts b/x-pack/plugins/monitoring/common/types/logs.ts similarity index 85% rename from x-pack/plugins/monitoring/common/types/filebeat.ts rename to x-pack/plugins/monitoring/common/types/logs.ts index 29c1af8a3a701..e3afa67cba3f1 100644 --- a/x-pack/plugins/monitoring/common/types/filebeat.ts +++ b/x-pack/plugins/monitoring/common/types/logs.ts @@ -5,9 +5,9 @@ * 2.0. */ -export interface FilebeatResponse { +export interface LogsResponse { hits?: { - hits: FilebeatResponseHit[]; + hits: LogsResponseHit[]; total: { value: number; }; @@ -15,7 +15,7 @@ export interface FilebeatResponse { aggregations?: any; } -export interface FilebeatResponseHit { +export interface LogsResponseHit { _source: { message?: string; log?: { diff --git a/x-pack/plugins/monitoring/server/lib/cluster/get_clusters_from_request.ts b/x-pack/plugins/monitoring/server/lib/cluster/get_clusters_from_request.ts index dd69669405098..f47cee9175e2b 100644 --- a/x-pack/plugins/monitoring/server/lib/cluster/get_clusters_from_request.ts +++ b/x-pack/plugins/monitoring/server/lib/cluster/get_clusters_from_request.ts @@ -40,13 +40,14 @@ import { isInCodePath } from './is_in_code_path'; import { LegacyRequest, Cluster } from '../../types'; import { RulesByType } from '../../../common/types/alerts'; import { getClusterRuleDataForClusters, getInstanceRuleDataForClusters } from '../kibana/rules'; +import { Globals } from '../../static_globals'; +import { getNewIndexPatterns } from './get_index_patterns'; /** * Get all clusters or the cluster associated with {@code clusterUuid} when it is defined. */ export async function getClustersFromRequest( req: LegacyRequest, - indexPatterns: { [x: string]: string }, { clusterUuid, start, @@ -54,7 +55,12 @@ export async function getClustersFromRequest( codePaths, }: { clusterUuid?: string; start?: number; end?: number; codePaths: string[] } ) { - const { filebeatIndexPattern } = indexPatterns; + const logsIndexPattern = getNewIndexPatterns({ + config: Globals.app.config, + type: 'logs', + moduleType: 'elasticsearch', + ccs: CCS_REMOTE_PATTERN, + }); const isStandaloneCluster = clusterUuid === STANDALONE_CLUSTER_CLUSTER_UUID; @@ -100,7 +106,7 @@ export async function getClustersFromRequest( cluster.logs = start && end && isInCodePath(codePaths, [CODE_PATH_LOGS]) - ? await getLogTypes(req, filebeatIndexPattern, { + ? await getLogTypes(req, logsIndexPattern, { clusterUuid: get(cluster, 'elasticsearch.cluster.id', cluster.cluster_uuid), start, end, diff --git a/x-pack/plugins/monitoring/server/lib/cluster/get_index_patterns.test.ts b/x-pack/plugins/monitoring/server/lib/cluster/get_index_patterns.test.ts index 015bdd4c65ccf..60a03b3f3bcbd 100644 --- a/x-pack/plugins/monitoring/server/lib/cluster/get_index_patterns.test.ts +++ b/x-pack/plugins/monitoring/server/lib/cluster/get_index_patterns.test.ts @@ -5,6 +5,7 @@ * 2.0. */ +import { DS_INDEX_PATTERN_TYPES } from '../../../common/constants'; import { MonitoringConfig } from '../..'; import { getNewIndexPatterns } from './get_index_patterns'; @@ -14,89 +15,182 @@ const getConfigWithCcs = (ccsEnabled: boolean) => { ccs: { enabled: ccsEnabled, }, + logs: { + index: 'filebeat-*', + }, }, } as MonitoringConfig; }; +type TestTuple = [DS_INDEX_PATTERN_TYPES | undefined, string]; describe('getNewIndexPatterns', () => { beforeEach(() => { jest.resetModules(); }); - it('returns local elasticsearch index patterns when ccs is enabled (default true) and no ccs payload', () => { - const indexPatterns = getNewIndexPatterns({ - config: getConfigWithCcs(true), - moduleType: 'elasticsearch', - }); - expect(indexPatterns).toBe('.monitoring-es-*,metrics-elasticsearch.*-*'); - }); - it('returns ecs only elasticsearch index patterns when specifying ecsLegacyOnly: true', () => { - const indexPatterns = getNewIndexPatterns({ - config: getConfigWithCcs(true), - moduleType: 'elasticsearch', - ecsLegacyOnly: true, - }); - expect(indexPatterns).toBe('.monitoring-es-8-*,metrics-elasticsearch.*-*'); - }); - it('returns local kibana index patterns when ccs is enabled with no ccs payload', () => { - const indexPatterns = getNewIndexPatterns({ - config: getConfigWithCcs(true), - moduleType: 'kibana', - }); - expect(indexPatterns).toBe('.monitoring-kibana-*,metrics-kibana.*-*'); - }); - it('returns logstash index patterns when ccs is enabled and no ccs payload', () => { - const indexPatterns = getNewIndexPatterns({ - config: getConfigWithCcs(true), - moduleType: 'logstash', - }); - expect(indexPatterns).toBe('.monitoring-logstash-*,metrics-logstash.*-*'); - }); - it('returns beats index patterns when ccs is enabled and no ccs payload', () => { - const indexPatterns = getNewIndexPatterns({ - config: getConfigWithCcs(true), - moduleType: 'beats', - }); - expect(indexPatterns).toBe('.monitoring-beats-*,metrics-beats.*-*'); - }); - it('returns elasticsearch index patterns with dataset', () => { + it.each([ + [undefined, '.monitoring-es-*,metrics-elasticsearch.*-*'], + ['metrics', '.monitoring-es-*,metrics-elasticsearch.*-*'], + ['logs', 'filebeat-*,logs-elasticsearch.*-*'], + ])( + 'returns local elasticsearch index patterns when ccs is enabled (default true) and no ccs payload and type %s', + (type, expected) => { + const indexPatterns = getNewIndexPatterns({ + type, + config: getConfigWithCcs(true), + moduleType: 'elasticsearch', + }); + expect(indexPatterns).toBe(expected); + } + ); + it.each([ + [undefined, '.monitoring-es-8-*,metrics-elasticsearch.*-*'], + ['metrics', '.monitoring-es-8-*,metrics-elasticsearch.*-*'], + ['logs', 'filebeat-*,logs-elasticsearch.*-*'], + ])( + 'returns ecs only elasticsearch index patterns when specifying ecsLegacyOnly: true and type %s', + (type, expected) => { + const indexPatterns = getNewIndexPatterns({ + type, + config: getConfigWithCcs(true), + moduleType: 'elasticsearch', + ecsLegacyOnly: true, + }); + expect(indexPatterns).toBe(expected); + } + ); + it.each([ + [undefined, '.monitoring-kibana-*,metrics-kibana.*-*'], + ['metrics', '.monitoring-kibana-*,metrics-kibana.*-*'], + ['logs', 'filebeat-*,logs-kibana.*-*'], + ])( + 'returns local kibana index patterns when ccs is enabled with no ccs payload and type %s', + (type, expected) => { + const indexPatterns = getNewIndexPatterns({ + type, + config: getConfigWithCcs(true), + moduleType: 'kibana', + }); + expect(indexPatterns).toBe(expected); + } + ); + it.each([ + [undefined, '.monitoring-logstash-*,metrics-logstash.*-*'], + ['metrics', '.monitoring-logstash-*,metrics-logstash.*-*'], + ['logs', 'filebeat-*,logs-logstash.*-*'], + ])( + 'returns logstash index patterns when ccs is enabled and no ccs payload and type %s', + (type, expected) => { + const indexPatterns = getNewIndexPatterns({ + type, + config: getConfigWithCcs(true), + moduleType: 'logstash', + }); + expect(indexPatterns).toBe(expected); + } + ); + it.each([ + [undefined, '.monitoring-beats-*,metrics-beats.*-*'], + ['metrics', '.monitoring-beats-*,metrics-beats.*-*'], + ['logs', 'filebeat-*,logs-beats.*-*'], + ])( + 'returns beats index patterns when ccs is enabled and no ccs payload and type %s', + (type, expected) => { + const indexPatterns = getNewIndexPatterns({ + type, + config: getConfigWithCcs(true), + moduleType: 'beats', + }); + expect(indexPatterns).toBe(expected); + } + ); + it.each([ + [undefined, '.monitoring-es-*,metrics-elasticsearch.cluster_stats-*'], + ['metrics', '.monitoring-es-*,metrics-elasticsearch.cluster_stats-*'], + ['logs', 'filebeat-*,logs-elasticsearch.cluster_stats-*'], + ])('returns elasticsearch index patterns with dataset and type %s', (type, expected) => { const indexPatterns = getNewIndexPatterns({ + type, config: getConfigWithCcs(true), moduleType: 'elasticsearch', dataset: 'cluster_stats', }); - expect(indexPatterns).toBe('.monitoring-es-*,metrics-elasticsearch.cluster_stats-*'); - }); - it('returns elasticsearch index patterns without ccs prefixes when ccs is disabled', () => { - const indexPatterns = getNewIndexPatterns({ - config: getConfigWithCcs(false), - moduleType: 'elasticsearch', - }); - expect(indexPatterns).toBe('.monitoring-es-*,metrics-elasticsearch.*-*'); + expect(indexPatterns).toBe(expected); }); - it('returns elasticsearch index patterns without ccs prefixes when ccs is disabled but ccs request payload has a value', () => { + it.each([ + [undefined, '.monitoring-es-*,metrics-elasticsearch.*-*'], + ['metrics', '.monitoring-es-*,metrics-elasticsearch.*-*'], + ['logs', 'filebeat-*,logs-elasticsearch.*-*'], + ])( + 'returns elasticsearch index patterns without ccs prefixes when ccs is disabled and type %s', + (type, expected) => { + const indexPatterns = getNewIndexPatterns({ + type, + config: getConfigWithCcs(false), + moduleType: 'elasticsearch', + }); + expect(indexPatterns).toBe(expected); + } + ); + it.each([ + [undefined, '.monitoring-es-*,metrics-elasticsearch.*-*'], + ['metrics', '.monitoring-es-*,metrics-elasticsearch.*-*'], + ['logs', 'filebeat-*,logs-elasticsearch.*-*'], + ])( + 'returns elasticsearch index patterns without ccs prefixes when ccs is disabled but ccs request payload has a value and type %s', + (type, expected) => { + const indexPatterns = getNewIndexPatterns({ + type, + config: getConfigWithCcs(false), + ccs: 'myccs', + moduleType: 'elasticsearch', + }); + expect(indexPatterns).toBe(expected); + } + ); + it.each([ + [undefined, 'myccs:.monitoring-es-*,myccs:metrics-elasticsearch.*-*'], + ['metrics', 'myccs:.monitoring-es-*,myccs:metrics-elasticsearch.*-*'], + ['logs', 'myccs:filebeat-*,myccs:logs-elasticsearch.*-*'], + ])( + 'returns elasticsearch index patterns with custom ccs prefixes when ccs is enabled and ccs request payload has a value and type %s', + (type, expected) => { + const indexPatterns = getNewIndexPatterns({ + type, + config: getConfigWithCcs(true), + ccs: 'myccs', + moduleType: 'elasticsearch', + }); + expect(indexPatterns).toBe(expected); + } + ); + it.each([ + [ + undefined, + '*:.monitoring-es-*,.monitoring-es-*,*:metrics-elasticsearch.*-*,metrics-elasticsearch.*-*', + ], + [ + 'metrics', + '*:.monitoring-es-*,.monitoring-es-*,*:metrics-elasticsearch.*-*,metrics-elasticsearch.*-*', + ], + ['logs', '*:filebeat-*,filebeat-*,*:logs-elasticsearch.*-*,logs-elasticsearch.*-*'], + ])( + 'returns elasticsearch index patterns with ccs prefixes and local index patterns when ccs is enabled and ccs request payload value is * and type %s', + (type, expected) => { + const indexPatterns = getNewIndexPatterns({ + type, + config: getConfigWithCcs(true), + ccs: '*', + moduleType: 'elasticsearch', + }); + expect(indexPatterns).toBe(expected); + } + ); + + it('returns logs-* index patterns without dataset and namespace', () => { const indexPatterns = getNewIndexPatterns({ + type: 'logs', config: getConfigWithCcs(false), - ccs: 'myccs', - moduleType: 'elasticsearch', - }); - expect(indexPatterns).toBe('.monitoring-es-*,metrics-elasticsearch.*-*'); - }); - it('returns elasticsearch index patterns with custom ccs prefixes when ccs is enabled and ccs request payload has a value', () => { - const indexPatterns = getNewIndexPatterns({ - config: getConfigWithCcs(true), - ccs: 'myccs', - moduleType: 'elasticsearch', - }); - expect(indexPatterns).toBe('myccs:.monitoring-es-*,myccs:metrics-elasticsearch.*-*'); - }); - it('returns elasticsearch index patterns with ccs prefixes and local index patterns when ccs is enabled and ccs request payload value is *', () => { - const indexPatterns = getNewIndexPatterns({ - config: getConfigWithCcs(true), - ccs: '*', - moduleType: 'elasticsearch', }); - expect(indexPatterns).toBe( - '*:.monitoring-es-*,.monitoring-es-*,*:metrics-elasticsearch.*-*,metrics-elasticsearch.*-*' - ); + expect(indexPatterns).toBe('filebeat-*,logs-*.*-*'); }); }); diff --git a/x-pack/plugins/monitoring/server/lib/cluster/get_index_patterns.ts b/x-pack/plugins/monitoring/server/lib/cluster/get_index_patterns.ts index 2ebf4fe6b480e..1b7668c585089 100644 --- a/x-pack/plugins/monitoring/server/lib/cluster/get_index_patterns.ts +++ b/x-pack/plugins/monitoring/server/lib/cluster/get_index_patterns.ts @@ -13,7 +13,7 @@ import { INDEX_PATTERN_LOGSTASH, INDEX_PATTERN_BEATS, INDEX_ALERTS, - DS_INDEX_PATTERN_TYPES, + DS_INDEX_PATTERN_LOGS, DS_INDEX_PATTERN_METRICS, INDEX_PATTERN_TYPES, INDEX_PATTERN_ENTERPRISE_SEARCH, @@ -21,6 +21,28 @@ import { } from '../../../common/constants'; import { MonitoringConfig } from '../../config'; +interface CommonIndexPatternArgs { + config: MonitoringConfig; + moduleType?: INDEX_PATTERN_TYPES; + dataset?: string; + namespace?: string; + ccs?: string; + ecsLegacyOnly?: boolean; +} + +// moduleType is mandatory when type is not informed or when type=metrics +interface MetricIndexPatternArgs extends CommonIndexPatternArgs { + type?: typeof DS_INDEX_PATTERN_METRICS; + moduleType: INDEX_PATTERN_TYPES; +} + +// moduleType is optional when type=logs +interface LogsIndexPatternArgs extends CommonIndexPatternArgs { + type: typeof DS_INDEX_PATTERN_LOGS; +} + +type IndexPatternArgs = MetricIndexPatternArgs | LogsIndexPatternArgs; + export function getIndexPatterns( config: MonitoringConfig, additionalPatterns: Record = {}, @@ -61,7 +83,7 @@ export function getLegacyIndexPattern({ config, ccs, }: { - moduleType: INDEX_PATTERN_TYPES; + moduleType: INDEX_PATTERN_TYPES | 'filebeat'; ecsLegacyOnly?: boolean; config: MonitoringConfig; ccs?: string; @@ -84,6 +106,9 @@ export function getLegacyIndexPattern({ case 'enterprisesearch': indexPattern = INDEX_PATTERN_ENTERPRISE_SEARCH; break; + case 'filebeat': + indexPattern = config.ui.logs.index; + break; default: throw new Error(`invalid module type to create index pattern: ${moduleType}`); } @@ -94,44 +119,37 @@ export function getDsIndexPattern({ type = DS_INDEX_PATTERN_METRICS, moduleType, dataset, - namespace = '*', + namespace, config, ccs, -}: { - type?: string; - dataset?: string; - moduleType: INDEX_PATTERN_TYPES; - namespace?: string; - config: MonitoringConfig; - ccs?: string; -}): string { - let datasetsPattern = ''; - if (dataset) { - datasetsPattern = `${moduleType}.${dataset}`; - } else { - datasetsPattern = `${moduleType}.*`; - } - return prefixIndexPatternWithCcs(config, `${type}-${datasetsPattern}-${namespace}`, ccs); +}: CommonIndexPatternArgs & { type?: string }): string { + const datasetsPattern = `${moduleType ?? '*'}.${dataset ?? '*'}`; + return prefixIndexPatternWithCcs(config, `${type}-${datasetsPattern}-${namespace ?? '*'}`, ccs); } -export function getNewIndexPatterns({ - config, - moduleType, - type = DS_INDEX_PATTERN_METRICS, - dataset, - namespace = '*', - ccs, - ecsLegacyOnly, -}: { - config: MonitoringConfig; - moduleType: INDEX_PATTERN_TYPES; - type?: DS_INDEX_PATTERN_TYPES; - dataset?: string; - namespace?: string; - ccs?: string; - ecsLegacyOnly?: boolean; -}): string { - const legacyIndexPattern = getLegacyIndexPattern({ moduleType, ecsLegacyOnly, config, ccs }); - const dsIndexPattern = getDsIndexPattern({ type, moduleType, dataset, namespace, config, ccs }); +export function getNewIndexPatterns(indexPattern: IndexPatternArgs): string { + const legacyModuleType = isLogIndexPattern(indexPattern) ? 'filebeat' : indexPattern.moduleType; + const { config, ccs, dataset, ecsLegacyOnly, moduleType, namespace, type } = indexPattern; + + const legacyIndexPattern = getLegacyIndexPattern({ + moduleType: legacyModuleType, + ecsLegacyOnly, + config, + ccs, + }); + + const dsIndexPattern = getDsIndexPattern({ + type, + moduleType, + dataset, + namespace, + config, + ccs, + }); + return `${legacyIndexPattern},${dsIndexPattern}`; } + +const isLogIndexPattern = (args: IndexPatternArgs): args is LogsIndexPatternArgs => { + return (args as LogsIndexPatternArgs).type === 'logs'; +}; diff --git a/x-pack/plugins/monitoring/server/lib/logs/detect_reason.ts b/x-pack/plugins/monitoring/server/lib/logs/detect_reason.ts index e9b906af677e8..7863e49d858de 100644 --- a/x-pack/plugins/monitoring/server/lib/logs/detect_reason.ts +++ b/x-pack/plugins/monitoring/server/lib/logs/detect_reason.ts @@ -7,8 +7,9 @@ import { LegacyRequest } from '../../types'; import { createTimeFilter } from '../create_query'; +import { elasticsearchLogsFilter } from './logs_filter'; -export interface FilebeatIndexCheckOpts { +export interface LogsIndexCheckOpts { start: number; end: number; clusterUuid?: string; @@ -16,15 +17,14 @@ export interface FilebeatIndexCheckOpts { indexUuid?: string; } -async function doesFilebeatIndexExist( +async function doesLogsIndexExist( req: LegacyRequest, - filebeatIndexPattern: string, - { start, end, clusterUuid, nodeUuid, indexUuid }: FilebeatIndexCheckOpts + logsIndexPattern: string, + { start, end, clusterUuid, nodeUuid, indexUuid }: LogsIndexCheckOpts ) { const metric = { timestampField: '@timestamp' }; const filter = [createTimeFilter({ start, end, metric })]; - const typeFilter = { term: { 'service.type': 'elasticsearch' } }; const structuredLogsFilter = { exists: { field: 'elasticsearch.cluster' } }; const clusterFilter = { term: { 'elasticsearch.cluster.uuid': clusterUuid } }; const nodeFilter = { term: { 'elasticsearch.node.id': nodeUuid } }; @@ -41,7 +41,7 @@ async function doesFilebeatIndexExist( const typeExistsAtAnyTimeQuery = { query: { bool: { - filter: [typeFilter], + filter: [elasticsearchLogsFilter], }, }, }; @@ -49,7 +49,7 @@ async function doesFilebeatIndexExist( const typeExistsQuery = { query: { bool: { - filter: [...filter, typeFilter], + filter: [...filter, elasticsearchLogsFilter], }, }, }; @@ -57,7 +57,7 @@ async function doesFilebeatIndexExist( const usingStructuredLogsQuery = { query: { bool: { - filter: [...filter, typeFilter, structuredLogsFilter], + filter: [...filter, elasticsearchLogsFilter, structuredLogsFilter], }, }, }; @@ -65,7 +65,7 @@ async function doesFilebeatIndexExist( const clusterExistsQuery = { query: { bool: { - filter: [...filter, typeFilter, clusterFilter], + filter: [...filter, elasticsearchLogsFilter, clusterFilter], }, }, }; @@ -73,7 +73,7 @@ async function doesFilebeatIndexExist( const nodeExistsQuery = { query: { bool: { - filter: [...filter, typeFilter, clusterFilter, nodeFilter], + filter: [...filter, elasticsearchLogsFilter, clusterFilter, nodeFilter], }, }, }; @@ -81,7 +81,7 @@ async function doesFilebeatIndexExist( const indexExistsQuery = { query: { bool: { - filter: [...filter, typeFilter, clusterFilter, indexFilter], + filter: [...filter, elasticsearchLogsFilter, clusterFilter, indexFilter], }, }, }; @@ -91,28 +91,28 @@ async function doesFilebeatIndexExist( }; const body = [ - { index: filebeatIndexPattern }, + { index: logsIndexPattern }, { ...defaultParams }, - { index: filebeatIndexPattern }, + { index: logsIndexPattern }, { ...defaultParams, ...indexPatternExistsQuery }, - { index: filebeatIndexPattern }, + { index: logsIndexPattern }, { ...defaultParams, ...typeExistsAtAnyTimeQuery }, - { index: filebeatIndexPattern }, + { index: logsIndexPattern }, { ...defaultParams, ...typeExistsQuery }, - { index: filebeatIndexPattern }, + { index: logsIndexPattern }, { ...defaultParams, ...usingStructuredLogsQuery }, ]; if (clusterUuid) { - body.push(...[{ index: filebeatIndexPattern }, { ...defaultParams, ...clusterExistsQuery }]); + body.push(...[{ index: logsIndexPattern }, { ...defaultParams, ...clusterExistsQuery }]); } if (nodeUuid) { - body.push(...[{ index: filebeatIndexPattern }, { ...defaultParams, ...nodeExistsQuery }]); + body.push(...[{ index: logsIndexPattern }, { ...defaultParams, ...nodeExistsQuery }]); } if (indexUuid) { - body.push(...[{ index: filebeatIndexPattern }, { ...defaultParams, ...indexExistsQuery }]); + body.push(...[{ index: logsIndexPattern }, { ...defaultParams, ...indexExistsQuery }]); } const { callWithRequest } = req.server.plugins.elasticsearch.getCluster('monitoring'); @@ -144,8 +144,8 @@ async function doesFilebeatIndexExist( export async function detectReason( req: LegacyRequest, - filebeatIndexPattern: string, - opts: FilebeatIndexCheckOpts + logsIndexPattern: string, + opts: LogsIndexCheckOpts ) { - return await doesFilebeatIndexExist(req, filebeatIndexPattern, opts); + return await doesLogsIndexExist(req, logsIndexPattern, opts); } diff --git a/x-pack/plugins/monitoring/server/lib/logs/get_log_types.ts b/x-pack/plugins/monitoring/server/lib/logs/get_log_types.ts index 2346fdd6f4531..879069f2f565b 100644 --- a/x-pack/plugins/monitoring/server/lib/logs/get_log_types.ts +++ b/x-pack/plugins/monitoring/server/lib/logs/get_log_types.ts @@ -10,7 +10,8 @@ import { createTimeFilter, TimerangeFilter } from '../create_query'; import { detectReason } from './detect_reason'; import { detectReasonFromException } from './detect_reason_from_exception'; import { LegacyRequest } from '../../types'; -import { FilebeatResponse } from '../../../common/types/filebeat'; +import { LogsResponse } from '../../../common/types/logs'; +import { elasticsearchLogsFilter } from './logs_filter'; interface LogType { level?: string; @@ -18,9 +19,9 @@ interface LogType { } async function handleResponse( - response: FilebeatResponse, + response: LogsResponse, req: LegacyRequest, - filebeatIndexPattern: string, + logsIndexPattern: string, opts: { clusterUuid?: string; nodeUuid?: string; indexUuid?: string; start: number; end: number } ) { const result: { enabled: boolean; types: LogType[]; reason?: any } = { @@ -43,7 +44,7 @@ async function handleResponse( }; }); } else { - result.reason = await detectReason(req, filebeatIndexPattern, opts); + result.reason = await detectReason(req, logsIndexPattern, opts); } return result; @@ -51,7 +52,7 @@ async function handleResponse( export async function getLogTypes( req: LegacyRequest, - filebeatIndexPattern: string, + logsIndexPattern: string, { clusterUuid, nodeUuid, @@ -60,13 +61,14 @@ export async function getLogTypes( end, }: { clusterUuid?: string; nodeUuid?: string; indexUuid?: string; start: number; end: number } ) { - checkParam(filebeatIndexPattern, 'filebeatIndexPattern in logs/getLogTypes'); + checkParam(logsIndexPattern, 'logsIndexPattern in logs/getLogTypes'); const metric = { timestampField: '@timestamp' }; + const filter: Array<{ term: { [x: string]: string } } | TimerangeFilter | null> = [ - { term: { 'service.type': 'elasticsearch' } }, createTimeFilter({ start, end, metric }), ]; + if (clusterUuid) { filter.push({ term: { 'elasticsearch.cluster.uuid': clusterUuid } }); } @@ -78,7 +80,7 @@ export async function getLogTypes( } const params = { - index: filebeatIndexPattern, + index: logsIndexPattern, size: 0, filter_path: ['aggregations.levels.buckets', 'aggregations.types.buckets'], ignore_unavailable: true, @@ -86,7 +88,7 @@ export async function getLogTypes( sort: { '@timestamp': { order: 'desc', unmapped_type: 'long' } }, query: { bool: { - filter, + filter: [elasticsearchLogsFilter, ...filter], }, }, aggs: { @@ -113,7 +115,7 @@ export async function getLogTypes( }; try { const response = await callWithRequest(req, 'search', params); - result = await handleResponse(response, req, filebeatIndexPattern, { + result = await handleResponse(response, req, logsIndexPattern, { clusterUuid, nodeUuid, indexUuid, diff --git a/x-pack/plugins/monitoring/server/lib/logs/get_logs.ts b/x-pack/plugins/monitoring/server/lib/logs/get_logs.ts index c243414c3649e..5d49a7b50b063 100644 --- a/x-pack/plugins/monitoring/server/lib/logs/get_logs.ts +++ b/x-pack/plugins/monitoring/server/lib/logs/get_logs.ts @@ -7,13 +7,14 @@ import moment from 'moment'; import { checkParam } from '../error_missing_required'; -import { createTimeFilter } from '../create_query'; -import { detectReason, FilebeatIndexCheckOpts } from './detect_reason'; +import { createTimeFilter, TimerangeFilter } from '../create_query'; +import { detectReason, LogsIndexCheckOpts } from './detect_reason'; +import { elasticsearchLogsFilter } from './logs_filter'; import { formatUTCTimestampForTimezone } from '../format_timezone'; import { getTimezone } from '../get_timezone'; import { detectReasonFromException } from './detect_reason_from_exception'; import { LegacyRequest } from '../../types'; -import { FilebeatResponse } from '../../../common/types/filebeat'; +import { LogsResponse } from '../../../common/types/logs'; import { MonitoringConfig } from '../../config'; interface Log { @@ -27,10 +28,10 @@ interface Log { } async function handleResponse( - response: FilebeatResponse, + response: LogsResponse, req: LegacyRequest, - filebeatIndexPattern: string, - opts: FilebeatIndexCheckOpts + logsIndexPattern: string, + opts: LogsIndexCheckOpts ) { const result: { enabled: boolean; logs: Log[]; reason?: any } = { enabled: false, @@ -57,7 +58,7 @@ async function handleResponse( }; }); } else { - result.reason = await detectReason(req, filebeatIndexPattern, opts); + result.reason = await detectReason(req, logsIndexPattern, opts); } return result; @@ -66,16 +67,17 @@ async function handleResponse( export async function getLogs( config: MonitoringConfig, req: LegacyRequest, - filebeatIndexPattern: string, - { clusterUuid, nodeUuid, indexUuid, start, end }: FilebeatIndexCheckOpts + logsIndexPattern: string, + { clusterUuid, nodeUuid, indexUuid, start, end }: LogsIndexCheckOpts ) { - checkParam(filebeatIndexPattern, 'filebeatIndexPattern in logs/getLogs'); + checkParam(logsIndexPattern, 'logsIndexPattern in logs/getLogs'); const metric = { timestampField: '@timestamp' }; - const filter: any[] = [ - { term: { 'service.type': 'elasticsearch' } }, + + const filter: Array<{ term: { [x: string]: string } } | TimerangeFilter | null> = [ createTimeFilter({ start, end, metric }), ]; + if (clusterUuid) { filter.push({ term: { 'elasticsearch.cluster.uuid': clusterUuid } }); } @@ -87,7 +89,7 @@ export async function getLogs( } const params = { - index: filebeatIndexPattern, + index: logsIndexPattern, size: Math.min(50, config.ui.elasticsearch.logFetchCount), filter_path: [ 'hits.hits._source.message', @@ -103,7 +105,7 @@ export async function getLogs( sort: { '@timestamp': { order: 'desc', unmapped_type: 'long' } }, query: { bool: { - filter, + filter: [elasticsearchLogsFilter, ...filter], }, }, }, @@ -116,8 +118,8 @@ export async function getLogs( logs: [], }; try { - const response: FilebeatResponse = await callWithRequest(req, 'search', params); - result = await handleResponse(response, req, filebeatIndexPattern, { + const response: LogsResponse = await callWithRequest(req, 'search', params); + result = await handleResponse(response, req, logsIndexPattern, { clusterUuid, nodeUuid, indexUuid, diff --git a/x-pack/plugins/monitoring/server/lib/logs/init_infra_source.ts b/x-pack/plugins/monitoring/server/lib/logs/init_infra_source.ts index e599508269850..4f3dc9ada98a5 100644 --- a/x-pack/plugins/monitoring/server/lib/logs/init_infra_source.ts +++ b/x-pack/plugins/monitoring/server/lib/logs/init_infra_source.ts @@ -7,22 +7,23 @@ // @ts-ignore import { InfraPluginSetup } from '@kbn/infra-plugin/server'; -import { prefixIndexPatternWithCcs } from '../../../common/ccs_utils'; import { CCS_REMOTE_PATTERN, INFRA_SOURCE_ID } from '../../../common/constants'; import { MonitoringConfig } from '../../config'; +import { getNewIndexPatterns } from '../cluster/get_index_patterns'; export const initInfraSource = (config: MonitoringConfig, infraPlugin: InfraPluginSetup) => { if (infraPlugin) { - const filebeatIndexPattern = prefixIndexPatternWithCcs( + const logsIndexPattern = getNewIndexPatterns({ config, - config.ui.logs.index, - CCS_REMOTE_PATTERN - ); + type: 'logs', + ccs: CCS_REMOTE_PATTERN, + }); + infraPlugin.defineInternalSourceConfiguration(INFRA_SOURCE_ID, { name: 'Elastic Stack Logs', logIndices: { type: 'index_name', - indexName: filebeatIndexPattern, + indexName: logsIndexPattern, }, }); } diff --git a/x-pack/plugins/monitoring/server/lib/logs/logs_filter.ts b/x-pack/plugins/monitoring/server/lib/logs/logs_filter.ts new file mode 100644 index 0000000000000..bf4c83cc4699a --- /dev/null +++ b/x-pack/plugins/monitoring/server/lib/logs/logs_filter.ts @@ -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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export const elasticsearchLogsFilter = { + bool: { + should: [{ term: { 'service.type': 'elasticsearch' } }], + }, +}; diff --git a/x-pack/plugins/monitoring/server/routes/api/v1/cluster/cluster.ts b/x-pack/plugins/monitoring/server/routes/api/v1/cluster/cluster.ts index 6bd0a19d79c5f..864b2beec5b7b 100644 --- a/x-pack/plugins/monitoring/server/routes/api/v1/cluster/cluster.ts +++ b/x-pack/plugins/monitoring/server/routes/api/v1/cluster/cluster.ts @@ -12,7 +12,6 @@ import { } from '../../../../../common/http_api/cluster'; import { createValidationFunction } from '../../../../lib/create_route_validation_function'; import { getClustersFromRequest } from '../../../../lib/cluster/get_clusters_from_request'; -import { getIndexPatterns } from '../../../../lib/cluster/get_index_patterns'; import { handleError } from '../../../../lib/errors'; import { MonitoringCore } from '../../../../types'; @@ -32,11 +31,6 @@ export function clusterRoute(server: MonitoringCore) { body: validateBody, }, handler: async (req) => { - const config = server.config; - - const indexPatterns = getIndexPatterns(config, { - filebeatIndexPattern: config.ui.logs.index, - }); const options = { clusterUuid: req.params.clusterUuid, start: req.payload.timeRange.min, @@ -45,7 +39,7 @@ export function clusterRoute(server: MonitoringCore) { }; try { - const clusters = await getClustersFromRequest(req, indexPatterns, options); + const clusters = await getClustersFromRequest(req, options); return postClusterResponsePayloadRT.encode(clusters); } catch (err) { throw handleError(err, req); diff --git a/x-pack/plugins/monitoring/server/routes/api/v1/cluster/clusters.ts b/x-pack/plugins/monitoring/server/routes/api/v1/cluster/clusters.ts index 9591dda205487..1e5883360d09b 100644 --- a/x-pack/plugins/monitoring/server/routes/api/v1/cluster/clusters.ts +++ b/x-pack/plugins/monitoring/server/routes/api/v1/cluster/clusters.ts @@ -10,7 +10,6 @@ import { postClustersResponsePayloadRT, } from '../../../../../common/http_api/cluster'; import { getClustersFromRequest } from '../../../../lib/cluster/get_clusters_from_request'; -import { getIndexPatterns } from '../../../../lib/cluster/get_index_patterns'; import { createValidationFunction } from '../../../../lib/create_route_validation_function'; import { verifyMonitoringAuth } from '../../../../lib/elasticsearch/verify_monitoring_auth'; import { handleError } from '../../../../lib/errors'; @@ -32,17 +31,13 @@ export function clustersRoute(server: MonitoringCore) { body: validateBody, }, handler: async (req) => { - const config = server.config; - // NOTE using try/catch because checkMonitoringAuth is expected to throw // an error when current logged-in user doesn't have permission to read // the monitoring data. `try/catch` makes it a little more explicit. try { await verifyMonitoringAuth(req); - const indexPatterns = getIndexPatterns(config, { - filebeatIndexPattern: config.ui.logs.index, - }); - const clusters = await getClustersFromRequest(req, indexPatterns, { + + const clusters = await getClustersFromRequest(req, { codePaths: req.payload.codePaths, }); return postClustersResponsePayloadRT.encode(clusters); diff --git a/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/index_detail.ts b/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/index_detail.ts index 1d31064f71ebb..68d1e4ed041d4 100644 --- a/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/index_detail.ts +++ b/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/index_detail.ts @@ -6,7 +6,6 @@ */ import { get } from 'lodash'; -import { prefixIndexPatternWithCcs } from '../../../../../common/ccs_utils'; import { CCS_REMOTE_PATTERN } from '../../../../../common/constants'; import { postElasticsearchIndexDetailRequestParamsRT, @@ -14,6 +13,7 @@ import { postElasticsearchIndexDetailResponsePayloadRT, } from '../../../../../common/http_api/elasticsearch'; import { getClusterStats } from '../../../../lib/cluster/get_cluster_stats'; +import { getNewIndexPatterns } from '../../../../lib/cluster/get_index_patterns'; import { createValidationFunction } from '../../../../lib/create_route_validation_function'; import { getMetrics } from '../../../../lib/details/get_metrics'; import { getIndexSummary } from '../../../../lib/elasticsearch/indices'; @@ -43,11 +43,14 @@ export function esIndexRoute(server: MonitoringCore) { const indexUuid = req.params.id; const start = req.payload.timeRange.min; const end = req.payload.timeRange.max; - const filebeatIndexPattern = prefixIndexPatternWithCcs( + + const logsIndexPattern = getNewIndexPatterns({ config, - config.ui.logs.index, - CCS_REMOTE_PATTERN - ); + type: 'logs', + moduleType: 'elasticsearch', + ccs: CCS_REMOTE_PATTERN, + }); + const isAdvanced = req.payload.is_advanced; const metricSet = isAdvanced ? metricSetAdvanced : metricSetOverview; @@ -93,7 +96,7 @@ export function esIndexRoute(server: MonitoringCore) { }; const shards = await getShardAllocation(req, allocationOptions); - logs = await getLogs(config, req, filebeatIndexPattern, { + logs = await getLogs(config, req, logsIndexPattern, { clusterUuid, indexUuid, start, diff --git a/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/node_detail.ts b/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/node_detail.ts index 85ba1d1a2bb8e..072340df2879d 100644 --- a/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/node_detail.ts +++ b/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/node_detail.ts @@ -6,7 +6,7 @@ */ import { get } from 'lodash'; -import { prefixIndexPatternWithCcs } from '../../../../../common/ccs_utils'; + import { CCS_REMOTE_PATTERN } from '../../../../../common/constants'; import { postElasticsearchNodeDetailRequestParamsRT, @@ -14,6 +14,7 @@ import { postElasticsearchNodeDetailResponsePayloadRT, } from '../../../../../common/http_api/elasticsearch'; import { getClusterStats } from '../../../../lib/cluster/get_cluster_stats'; +import { getNewIndexPatterns } from '../../../../lib/cluster/get_index_patterns'; import { createValidationFunction } from '../../../../lib/create_route_validation_function'; import { getMetrics, @@ -47,11 +48,14 @@ export function esNodeRoute(server: MonitoringCore) { const nodeUuid = req.params.nodeUuid; const start = req.payload.timeRange.min; const end = req.payload.timeRange.max; - const filebeatIndexPattern = prefixIndexPatternWithCcs( + + const logsIndexPattern = getNewIndexPatterns({ config, - config.ui.logs.index, - CCS_REMOTE_PATTERN - ); + type: 'logs', + moduleType: 'elasticsearch', + ccs: CCS_REMOTE_PATTERN, + }); + const isAdvanced = req.payload.is_advanced; let metricSet: MetricDescriptor[]; @@ -127,7 +131,7 @@ export function esNodeRoute(server: MonitoringCore) { stateUuid, // for debugging/troubleshooting }; - logs = await getLogs(config, req, filebeatIndexPattern, { + logs = await getLogs(config, req, logsIndexPattern, { clusterUuid, nodeUuid, start, diff --git a/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/overview.ts b/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/overview.ts index 52410dd09f8df..01e4dda4e6a87 100644 --- a/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/overview.ts +++ b/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/overview.ts @@ -5,7 +5,6 @@ * 2.0. */ -import { prefixIndexPatternWithCcs } from '../../../../../common/ccs_utils'; import { CCS_REMOTE_PATTERN } from '../../../../../common/constants'; import { postElasticsearchOverviewRequestParamsRT, @@ -14,6 +13,7 @@ import { } from '../../../../../common/http_api/elasticsearch'; import { getClusterStats } from '../../../../lib/cluster/get_cluster_stats'; import { getClusterStatus } from '../../../../lib/cluster/get_cluster_status'; +import { getNewIndexPatterns } from '../../../../lib/cluster/get_index_patterns'; import { createValidationFunction } from '../../../../lib/create_route_validation_function'; import { getMetrics } from '../../../../lib/details/get_metrics'; import { getLastRecovery } from '../../../../lib/elasticsearch/get_last_recovery'; @@ -37,11 +37,14 @@ export function esOverviewRoute(server: MonitoringCore) { async handler(req) { const config = server.config; const clusterUuid = req.params.clusterUuid; - const filebeatIndexPattern = prefixIndexPatternWithCcs( + + const logsIndexPattern = getNewIndexPatterns({ config, - config.ui.logs.index, - CCS_REMOTE_PATTERN - ); + type: 'logs', + moduleType: 'elasticsearch', + ccs: CCS_REMOTE_PATTERN, + }); + const { min: start, max: end } = req.payload.timeRange; try { @@ -50,7 +53,7 @@ export function esOverviewRoute(server: MonitoringCore) { getMetrics(req, 'elasticsearch', metricSet), getLastRecovery(req, config.ui.max_bucket_size), // TODO this call is missing some items from the signature of `getLogs`, will need to resolve during TS conversion - getLogs(config, req, filebeatIndexPattern, { clusterUuid, start, end }), + getLogs(config, req, logsIndexPattern, { clusterUuid, start, end }), ]); const indicesUnassignedShardStats = await getIndicesUnassignedShardStats(req, clusterStats); From 09c6cc25deca99e058425ddd86a96544ebedab7d Mon Sep 17 00:00:00 2001 From: Jean-Louis Leysens Date: Fri, 26 Aug 2022 13:16:52 +0200 Subject: [PATCH 16/28] [Files] Add `cache-control` headers to file download response (#139375) * refactor test helpers for clarity * added header cache --- .../files/server/routes/common.test.ts | 23 ++++++++++++------- x-pack/plugins/files/server/routes/common.ts | 1 + 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/x-pack/plugins/files/server/routes/common.test.ts b/x-pack/plugins/files/server/routes/common.test.ts index cc22b0d8afb01..a8a1a5403c891 100644 --- a/x-pack/plugins/files/server/routes/common.test.ts +++ b/x-pack/plugins/files/server/routes/common.test.ts @@ -9,40 +9,47 @@ import type { File } from '../file'; import { getDownloadHeadersForFile } from './common'; describe('getDownloadHeadersForFile', () => { - function t({ cd, ct }: { cd: string; ct: string }) { + function expectHeaders({ + contentDisposition, + contentType, + }: { + contentDisposition: string; + contentType: string; + }) { return { - 'content-type': ct, - 'content-disposition': `attachment; filename="${cd}"`, + 'content-type': contentType, + 'content-disposition': `attachment; filename="${contentDisposition}"`, + 'cache-control': 'max-age=31536000, immutable', }; } const file = { data: { name: 'test', mimeType: undefined } } as unknown as File; test('no mime type and name from file object', () => { expect(getDownloadHeadersForFile(file, undefined)).toEqual( - t({ ct: 'application/octet-stream', cd: 'test' }) + expectHeaders({ contentType: 'application/octet-stream', contentDisposition: 'test' }) ); }); test('no mime type and name (without ext)', () => { expect(getDownloadHeadersForFile(file, 'myfile')).toEqual( - t({ ct: 'application/octet-stream', cd: 'myfile' }) + expectHeaders({ contentType: 'application/octet-stream', contentDisposition: 'myfile' }) ); }); test('no mime type and name (with ext)', () => { expect(getDownloadHeadersForFile(file, 'myfile.png')).toEqual( - t({ ct: 'image/png', cd: 'myfile.png' }) + expectHeaders({ contentType: 'image/png', contentDisposition: 'myfile.png' }) ); }); test('mime type and no name', () => { const fileWithMime = { data: { ...file.data, mimeType: 'application/pdf' } } as File; expect(getDownloadHeadersForFile(fileWithMime, undefined)).toEqual( - t({ ct: 'application/pdf', cd: 'test' }) + expectHeaders({ contentType: 'application/pdf', contentDisposition: 'test' }) ); }); test('mime type and name', () => { const fileWithMime = { data: { ...file.data, mimeType: 'application/pdf' } } as File; expect(getDownloadHeadersForFile(fileWithMime, 'a cool file.pdf')).toEqual( - t({ ct: 'application/pdf', cd: 'a cool file.pdf' }) + expectHeaders({ contentType: 'application/pdf', contentDisposition: 'a cool file.pdf' }) ); }); }); diff --git a/x-pack/plugins/files/server/routes/common.ts b/x-pack/plugins/files/server/routes/common.ts index f8a3a1965267b..8bfc7753efe3f 100644 --- a/x-pack/plugins/files/server/routes/common.ts +++ b/x-pack/plugins/files/server/routes/common.ts @@ -14,6 +14,7 @@ export function getDownloadHeadersForFile(file: File, fileName?: string): Respon (fileName && mime.getType(fileName)) ?? file.data.mimeType ?? 'application/octet-stream', // Note, this name can be overridden by the client if set via a "download" attribute on the HTML tag. 'content-disposition': `attachment; filename="${fileName || getDownloadedFileName(file)}"`, + 'cache-control': 'max-age=31536000, immutable', }; } From 16930a024668b831eb03252fba05085b2118cb80 Mon Sep 17 00:00:00 2001 From: Maxim Kholod Date: Fri, 26 Aug 2022 14:03:03 +0200 Subject: [PATCH 17/28] [TIP] make expand button color primamry when flyout is closed (#139482) * [TIP] make expand button color primamry when flyout is closed * [TIP] add isOpen prop to storybook --- .../open_indicator_flyout_button.stories.tsx | 6 ++++++ .../open_indicator_flyout_button.tsx | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/threat_intelligence/public/modules/indicators/components/open_indicator_flyout_button/open_indicator_flyout_button.stories.tsx b/x-pack/plugins/threat_intelligence/public/modules/indicators/components/open_indicator_flyout_button/open_indicator_flyout_button.stories.tsx index c5289adf51c21..c64e2c5ebc067 100644 --- a/x-pack/plugins/threat_intelligence/public/modules/indicators/components/open_indicator_flyout_button/open_indicator_flyout_button.stories.tsx +++ b/x-pack/plugins/threat_intelligence/public/modules/indicators/components/open_indicator_flyout_button/open_indicator_flyout_button.stories.tsx @@ -17,6 +17,12 @@ export default { title: 'OpenIndicatorFlyoutButton', argTypes: { onOpen: { action: 'onOpen' }, + isOpen: { + options: [true, false], + control: { + type: 'radio', + }, + }, }, }; diff --git a/x-pack/plugins/threat_intelligence/public/modules/indicators/components/open_indicator_flyout_button/open_indicator_flyout_button.tsx b/x-pack/plugins/threat_intelligence/public/modules/indicators/components/open_indicator_flyout_button/open_indicator_flyout_button.tsx index 869fc9c4c5b49..48900019265c7 100644 --- a/x-pack/plugins/threat_intelligence/public/modules/indicators/components/open_indicator_flyout_button/open_indicator_flyout_button.tsx +++ b/x-pack/plugins/threat_intelligence/public/modules/indicators/components/open_indicator_flyout_button/open_indicator_flyout_button.tsx @@ -46,7 +46,7 @@ export const OpenIndicatorFlyoutButton: VFC = ({ Date: Fri, 26 Aug 2022 13:24:19 +0100 Subject: [PATCH 18/28] Fix race condition when running validation (#139385) Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../static/forms/hook_form_lib/hooks/use_field.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/plugins/es_ui_shared/static/forms/hook_form_lib/hooks/use_field.ts b/src/plugins/es_ui_shared/static/forms/hook_form_lib/hooks/use_field.ts index 7ba06304b971b..206db21b50a0b 100644 --- a/src/plugins/es_ui_shared/static/forms/hook_form_lib/hooks/use_field.ts +++ b/src/plugins/es_ui_shared/static/forms/hook_form_lib/hooks/use_field.ts @@ -633,13 +633,6 @@ export const useField = ( setIsChangingValue(false); } }); - - return () => { - if (debounceTimeout.current) { - clearTimeout(debounceTimeout.current); - debounceTimeout.current = null; - } - }; }, [valueHasChanged, runValidationsOnValueChange]); // Value change: set "isModified" state @@ -676,6 +669,11 @@ export const useField = ( return () => { isMounted.current = false; + + if (debounceTimeout.current) { + clearTimeout(debounceTimeout.current); + debounceTimeout.current = null; + } }; }, []); From 5cb0c010727e0ef1c13b643a09701cc11331f43e Mon Sep 17 00:00:00 2001 From: Ersin Erdal <92688503+ersin-erdal@users.noreply.github.com> Date: Fri, 26 Aug 2022 14:37:17 +0200 Subject: [PATCH 19/28] Use "compatibility" rather than "availability" on connectors table (#139024) * Use compatibility rather than availability on connectors table * Replace Availability with Compatibility in create connector flyout. --- .../common/connector_feature_config.test.ts | 19 +- .../common/connector_feature_config.ts | 52 +- .../translations/translations/fr-FR.json | 2 - .../translations/translations/ja-JP.json | 2 - .../translations/translations/zh-CN.json | 2 - .../create_connector_flyout/header.tsx | 19 +- .../create_connector_flyout/index.test.tsx | 7 +- .../create_connector_flyout/index.tsx | 3 +- .../actions_connectors_list.test.tsx | 1052 +++++++++-------- .../components/actions_connectors_list.tsx | 30 +- .../triggers_actions_ui/public/types.ts | 2 +- 11 files changed, 655 insertions(+), 535 deletions(-) diff --git a/x-pack/plugins/actions/common/connector_feature_config.test.ts b/x-pack/plugins/actions/common/connector_feature_config.test.ts index 078a9110564d4..5aea0a7c72bd8 100644 --- a/x-pack/plugins/actions/common/connector_feature_config.test.ts +++ b/x-pack/plugins/actions/common/connector_feature_config.test.ts @@ -5,7 +5,11 @@ * 2.0. */ -import { areValidFeatures, getConnectorFeatureName } from './connector_feature_config'; +import { + areValidFeatures, + getConnectorCompatibility, + getConnectorFeatureName, +} from './connector_feature_config'; describe('areValidFeatures', () => { it('returns true when all inputs are valid features', () => { @@ -35,3 +39,16 @@ describe('getConnectorFeatureName', () => { expect(getConnectorFeatureName('foo')).toEqual('foo'); }); }); + +describe('getConnectorCompatibility', () => { + it('returns the compatibility list for valid feature ids', () => { + expect(getConnectorCompatibility(['alerting', 'cases', 'uptime', 'siem'])).toEqual([ + 'Alerting Rules', + 'Cases', + ]); + }); + + it('skips invalid feature ids', () => { + expect(getConnectorCompatibility(['foo', 'bar', 'cases'])).toEqual(['Cases']); + }); +}); diff --git a/x-pack/plugins/actions/common/connector_feature_config.ts b/x-pack/plugins/actions/common/connector_feature_config.ts index 2395bc59b4034..6e9adab5de5a8 100644 --- a/x-pack/plugins/actions/common/connector_feature_config.ts +++ b/x-pack/plugins/actions/common/connector_feature_config.ts @@ -18,6 +18,7 @@ interface ConnectorFeatureConfig { * This will be displayed to end-users, so a translatable string is advised for i18n. */ name: string; + compatibility: string; } export const AlertingConnectorFeatureId = 'alerting'; @@ -25,11 +26,26 @@ export const CasesConnectorFeatureId = 'cases'; export const UptimeConnectorFeatureId = 'uptime'; export const SecurityConnectorFeatureId = 'siem'; +const compatibilityAlertingRules = i18n.translate( + 'xpack.actions.availableConnectorFeatures.compatibility.alertingRules', + { + defaultMessage: 'Alerting Rules', + } +); + +const compatibilityCases = i18n.translate( + 'xpack.actions.availableConnectorFeatures.compatibility.cases', + { + defaultMessage: 'Cases', + } +); + export const AlertingConnectorFeature: ConnectorFeatureConfig = { id: AlertingConnectorFeatureId, name: i18n.translate('xpack.actions.availableConnectorFeatures.alerting', { defaultMessage: 'Alerting', }), + compatibility: compatibilityAlertingRules, }; export const CasesConnectorFeature: ConnectorFeatureConfig = { @@ -37,6 +53,7 @@ export const CasesConnectorFeature: ConnectorFeatureConfig = { name: i18n.translate('xpack.actions.availableConnectorFeatures.cases', { defaultMessage: 'Cases', }), + compatibility: compatibilityCases, }; export const UptimeConnectorFeature: ConnectorFeatureConfig = { @@ -44,6 +61,7 @@ export const UptimeConnectorFeature: ConnectorFeatureConfig = { name: i18n.translate('xpack.actions.availableConnectorFeatures.uptime', { defaultMessage: 'Uptime', }), + compatibility: compatibilityAlertingRules, }; export const SecuritySolutionFeature: ConnectorFeatureConfig = { @@ -51,23 +69,35 @@ export const SecuritySolutionFeature: ConnectorFeatureConfig = { name: i18n.translate('xpack.actions.availableConnectorFeatures.securitySolution', { defaultMessage: 'Security Solution', }), + compatibility: compatibilityAlertingRules, }; -const AllAvailableConnectorFeatures: ConnectorFeatureConfig[] = [ - AlertingConnectorFeature, - CasesConnectorFeature, - UptimeConnectorFeature, - SecuritySolutionFeature, -]; +const AllAvailableConnectorFeatures = { + [AlertingConnectorFeature.id]: AlertingConnectorFeature, + [CasesConnectorFeature.id]: CasesConnectorFeature, + [UptimeConnectorFeature.id]: UptimeConnectorFeature, + [SecuritySolutionFeature.id]: SecuritySolutionFeature, +}; export function areValidFeatures(ids: string[]) { - return ids.every( - (id: string) => - !!AllAvailableConnectorFeatures.find((config: ConnectorFeatureConfig) => config.id === id) - ); + return ids.every((id: string) => !!AllAvailableConnectorFeatures[id]); } export function getConnectorFeatureName(id: string) { - const featureConfig = AllAvailableConnectorFeatures.find((config) => config.id === id); + const featureConfig = AllAvailableConnectorFeatures[id]; return featureConfig ? featureConfig.name : id; } + +export function getConnectorCompatibility(featureIds?: string[]): string[] { + const compatibility = new Set(); + + if (featureIds && featureIds.length > 0) { + for (const featureId of featureIds) { + if (AllAvailableConnectorFeatures[featureId]) { + compatibility.add(AllAvailableConnectorFeatures[featureId].compatibility); + } + } + } + + return Array.from(compatibility); +} diff --git a/x-pack/plugins/translations/translations/fr-FR.json b/x-pack/plugins/translations/translations/fr-FR.json index 8d405c00cc551..6558334913435 100644 --- a/x-pack/plugins/translations/translations/fr-FR.json +++ b/x-pack/plugins/translations/translations/fr-FR.json @@ -32647,7 +32647,6 @@ "xpack.triggersActionsUI.sections.actionsConnectorsList.connectorsListTable.columns.actions.runConnectorDisabledDescription": "Impossible d'exécuter les connecteurs", "xpack.triggersActionsUI.sections.actionsConnectorsList.connectorsListTable.columns.actions.runConnectorName": "Exécuter", "xpack.triggersActionsUI.sections.actionsConnectorsList.connectorsListTable.columns.actionTypeTitle": "Type", - "xpack.triggersActionsUI.sections.actionsConnectorsList.connectorsListTable.columns.featureIdsTitle": "Disponibilité", "xpack.triggersActionsUI.sections.actionsConnectorsList.connectorsListTable.columns.fixButtonLabel": "Corriger", "xpack.triggersActionsUI.sections.actionsConnectorsList.connectorsListTable.columns.nameTitle": "Nom", "xpack.triggersActionsUI.sections.actionsConnectorsList.filters.actionTypeIdName": "Type", @@ -32675,7 +32674,6 @@ "xpack.triggersActionsUI.sections.addAction.casesWebhookAction.error.requiredUpdateMethodText": "La méthode de mise à jour du cas est requise.", "xpack.triggersActionsUI.sections.addAction.webhookAction.error.requiredAuthUserNameText": "Le nom d'utilisateur est requis.", "xpack.triggersActionsUI.sections.addAction.webhookAction.error.requiredMethodText": "La méthode est requise.", - "xpack.triggersActionsUI.sections.addConnectorForm.flyoutHeaderAvailability": "Disponibilité :", "xpack.triggersActionsUI.sections.addConnectorForm.selectConnectorFlyoutTitle": "Sélectionner un connecteur", "xpack.triggersActionsUI.sections.addConnectorForm.updateSuccessNotificationText": "Création de \"{connectorName}\" effectuée", "xpack.triggersActionsUI.sections.addModalConnectorForm.cancelButtonLabel": "Annuler", diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 92f7bb0888cda..5a6e17d82c29c 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -32622,7 +32622,6 @@ "xpack.triggersActionsUI.sections.actionsConnectorsList.connectorsListTable.columns.actions.runConnectorDisabledDescription": "コネクターを実行できません", "xpack.triggersActionsUI.sections.actionsConnectorsList.connectorsListTable.columns.actions.runConnectorName": "実行", "xpack.triggersActionsUI.sections.actionsConnectorsList.connectorsListTable.columns.actionTypeTitle": "型", - "xpack.triggersActionsUI.sections.actionsConnectorsList.connectorsListTable.columns.featureIdsTitle": "可用性", "xpack.triggersActionsUI.sections.actionsConnectorsList.connectorsListTable.columns.fixButtonLabel": "修正", "xpack.triggersActionsUI.sections.actionsConnectorsList.connectorsListTable.columns.nameTitle": "名前", "xpack.triggersActionsUI.sections.actionsConnectorsList.filters.actionTypeIdName": "型", @@ -32650,7 +32649,6 @@ "xpack.triggersActionsUI.sections.addAction.casesWebhookAction.error.requiredUpdateMethodText": "ケースメソッドの更新は必須です。", "xpack.triggersActionsUI.sections.addAction.webhookAction.error.requiredAuthUserNameText": "ユーザー名が必要です。", "xpack.triggersActionsUI.sections.addAction.webhookAction.error.requiredMethodText": "メソッドが必要です。", - "xpack.triggersActionsUI.sections.addConnectorForm.flyoutHeaderAvailability": "可用性:", "xpack.triggersActionsUI.sections.addConnectorForm.selectConnectorFlyoutTitle": "コネクターを選択", "xpack.triggersActionsUI.sections.addConnectorForm.updateSuccessNotificationText": "「{connectorName}」を作成しました", "xpack.triggersActionsUI.sections.addModalConnectorForm.cancelButtonLabel": "キャンセル", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index 4884259e023cb..107dcec2ce65b 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -32656,7 +32656,6 @@ "xpack.triggersActionsUI.sections.actionsConnectorsList.connectorsListTable.columns.actions.runConnectorDisabledDescription": "无法运行连接器", "xpack.triggersActionsUI.sections.actionsConnectorsList.connectorsListTable.columns.actions.runConnectorName": "运行", "xpack.triggersActionsUI.sections.actionsConnectorsList.connectorsListTable.columns.actionTypeTitle": "类型", - "xpack.triggersActionsUI.sections.actionsConnectorsList.connectorsListTable.columns.featureIdsTitle": "可用性", "xpack.triggersActionsUI.sections.actionsConnectorsList.connectorsListTable.columns.fixButtonLabel": "修复", "xpack.triggersActionsUI.sections.actionsConnectorsList.connectorsListTable.columns.nameTitle": "名称", "xpack.triggersActionsUI.sections.actionsConnectorsList.filters.actionTypeIdName": "类型", @@ -32684,7 +32683,6 @@ "xpack.triggersActionsUI.sections.addAction.casesWebhookAction.error.requiredUpdateMethodText": "“更新案例方法”必填。", "xpack.triggersActionsUI.sections.addAction.webhookAction.error.requiredAuthUserNameText": "“用户名”必填。", "xpack.triggersActionsUI.sections.addAction.webhookAction.error.requiredMethodText": "“方法”必填", - "xpack.triggersActionsUI.sections.addConnectorForm.flyoutHeaderAvailability": "可用性:", "xpack.triggersActionsUI.sections.addConnectorForm.selectConnectorFlyoutTitle": "选择连接器", "xpack.triggersActionsUI.sections.addConnectorForm.updateSuccessNotificationText": "已创建“{connectorName}”", "xpack.triggersActionsUI.sections.addModalConnectorForm.cancelButtonLabel": "取消", diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/create_connector_flyout/header.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/create_connector_flyout/header.tsx index 6369ec5a2dcbf..2c12431dc12cb 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/create_connector_flyout/header.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/create_connector_flyout/header.tsx @@ -19,14 +19,13 @@ import { EuiBetaBadge, } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n-react'; -import { getConnectorFeatureName } from '@kbn/actions-plugin/common'; import { betaBadgeProps } from '../beta_badge_props'; interface Props { icon?: IconType | null; actionTypeName?: string | null; actionTypeMessage?: string | null; - featureIds?: string[] | null; + compatibility?: string[] | null; isExperimental?: boolean; } @@ -34,7 +33,7 @@ const FlyoutHeaderComponent: React.FC = ({ icon, actionTypeName, actionTypeMessage, - featureIds, + compatibility, isExperimental, }) => { return ( @@ -74,23 +73,23 @@ const FlyoutHeaderComponent: React.FC = ({ {actionTypeMessage} - {featureIds && featureIds.length > 0 && ( + {compatibility && compatibility.length > 0 && ( <> {' '} - {featureIds.map((featureId: string) => ( - - {getConnectorFeatureName(featureId)} + {compatibility.map((compatibilityItem: string) => ( + + {compatibilityItem} ))} diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/create_connector_flyout/index.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/create_connector_flyout/index.test.tsx index 722667921ad26..f432f8fd6634c 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/create_connector_flyout/index.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/create_connector_flyout/index.test.tsx @@ -246,7 +246,7 @@ describe('CreateConnectorFlyout', () => { expect(getByText('Select a connector')).toBeInTheDocument(); }); - it('shows the feature id badges when the connector type is selected', async () => { + it('shows the compatibility badges when the connector type is selected', async () => { const { getByTestId, getByText } = appMockRenderer.render( { expect(getByTestId('test-connector-text-field')).toBeInTheDocument(); }); - expect(getByTestId('create-connector-flyout-header-availability')).toBeInTheDocument(); - expect(getByText('Alerting')).toBeInTheDocument(); - expect(getByText('Security Solution')).toBeInTheDocument(); + expect(getByTestId('create-connector-flyout-header-compatibility')).toBeInTheDocument(); + expect(getByText('Alerting Rules')).toBeInTheDocument(); }); it('shows the icon when the connector type is selected', async () => { diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/create_connector_flyout/index.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/create_connector_flyout/index.tsx index f34c5d4e6dc76..f25d86458632a 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/create_connector_flyout/index.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/create_connector_flyout/index.tsx @@ -8,6 +8,7 @@ import React, { memo, ReactNode, useCallback, useEffect, useRef, useState } from 'react'; import { EuiFlyout, EuiFlyoutBody } from '@elastic/eui'; +import { getConnectorCompatibility } from '@kbn/actions-plugin/common'; import { ActionConnector, ActionType, @@ -156,7 +157,7 @@ const CreateConnectorFlyoutComponent: React.FC = ({ icon={actionTypeModel?.iconClass} actionTypeName={actionType?.name} actionTypeMessage={actionTypeModel?.selectMessage} - featureIds={actionType?.supportedFeatureIds} + compatibility={getConnectorCompatibility(actionType?.supportedFeatureIds)} isExperimental={actionTypeModel?.isExperimental} /> { - let wrapper: ReactWrapper; +describe('actions_connectors_list', () => { + describe('component empty', () => { + let wrapper: ReactWrapper; - async function setup() { - loadAllActions.mockResolvedValueOnce([]); - loadActionTypes.mockResolvedValueOnce([ - { - id: 'test', - name: 'Test', - supportedFeatureIds: ['alerting'], - }, - { - id: 'test2', - name: 'Test2', - supportedFeatureIds: ['alerting'], - }, - ]); - actionTypeRegistry.has.mockReturnValue(true); - - const [ - { - application: { capabilities }, - }, - ] = await mocks.getStartServices(); - - // eslint-disable-next-line react-hooks/rules-of-hooks - useKibanaMock().services.actionTypeRegistry = actionTypeRegistry; - // eslint-disable-next-line react-hooks/rules-of-hooks - useKibanaMock().services.application.capabilities = { - ...capabilities, - actions: { - delete: true, - save: true, - show: true, - }, - }; - wrapper = mountWithIntl(); - - // Wait for active space to resolve before requesting the component to update - await act(async () => { - await nextTick(); - wrapper.update(); + async function setup() { + loadAllActions.mockResolvedValueOnce([]); + loadActionTypes.mockResolvedValueOnce([ + { + id: 'test', + name: 'Test', + supportedFeatureIds: ['alerting'], + }, + { + id: 'test2', + name: 'Test2', + supportedFeatureIds: ['alerting'], + }, + ]); + actionTypeRegistry.has.mockReturnValue(true); + + const [ + { + application: { capabilities }, + }, + ] = await mocks.getStartServices(); + + // eslint-disable-next-line react-hooks/rules-of-hooks + useKibanaMock().services.actionTypeRegistry = actionTypeRegistry; + // eslint-disable-next-line react-hooks/rules-of-hooks + useKibanaMock().services.application.capabilities = { + ...capabilities, + actions: { + delete: true, + save: true, + show: true, + }, + }; + wrapper = mountWithIntl(); + + // Wait for active space to resolve before requesting the component to update + await act(async () => { + await nextTick(); + wrapper.update(); + }); + } + + it('renders empty prompt', async () => { + await setup(); + expect( + wrapper.find('[data-test-subj="createFirstConnectorEmptyPrompt"]').find('EuiEmptyPrompt') + ).toHaveLength(1); + expect( + wrapper.find('[data-test-subj="createFirstActionButton"]').find('EuiButton') + ).toHaveLength(1); }); - } - - it('renders empty prompt', async () => { - await setup(); - expect( - wrapper.find('[data-test-subj="createFirstConnectorEmptyPrompt"]').find('EuiEmptyPrompt') - ).toHaveLength(1); - expect( - wrapper.find('[data-test-subj="createFirstActionButton"]').find('EuiButton') - ).toHaveLength(1); - }); - test('if click create button should render CreateConnectorFlyout', async () => { - await setup(); - wrapper.find('[data-test-subj="createFirstActionButton"]').first().simulate('click'); - expect(wrapper.find('[data-test-subj="create-connector-flyout"]').exists()).toBeTruthy(); + test('if click create button should render CreateConnectorFlyout', async () => { + await setup(); + wrapper.find('[data-test-subj="createFirstActionButton"]').first().simulate('click'); + expect(wrapper.find('[data-test-subj="create-connector-flyout"]').exists()).toBeTruthy(); + }); }); -}); - -describe('actions_connectors_list component with items', () => { - let wrapper: ReactWrapper; - async function setup(actionConnectors?: ActionConnector[]) { - loadAllActions.mockResolvedValueOnce( - actionConnectors ?? [ + describe('component with items', () => { + let wrapper: ReactWrapper; + + async function setup(actionConnectors?: ActionConnector[]) { + loadAllActions.mockResolvedValueOnce( + actionConnectors ?? [ + { + id: '1', + actionTypeId: 'test', + description: 'My test', + isPreconfigured: false, + isDeprecated: false, + referencedByCount: 1, + config: {}, + }, + { + id: '2', + actionTypeId: 'test2', + description: 'My test 2', + referencedByCount: 1, + isPreconfigured: false, + isDeprecated: false, + config: {}, + }, + { + id: '3', + actionTypeId: 'test2', + description: 'My preconfigured test 2', + isMissingSecrets: true, + referencedByCount: 1, + isPreconfigured: true, + isDeprecated: false, + config: {}, + }, + { + id: '4', + actionTypeId: 'nonexistent', + description: 'My invalid connector type', + referencedByCount: 1, + isPreconfigured: false, + isDeprecated: false, + config: {}, + }, + { + id: '5', + actionTypeId: 'test3', + description: 'action with all feature ids', + referencedByCount: 1, + isPreconfigured: false, + isDeprecated: false, + config: {}, + }, + { + id: '6', + actionTypeId: 'test4', + description: 'only cases', + referencedByCount: 1, + isPreconfigured: false, + isDeprecated: false, + config: {}, + }, + ] + ); + loadActionTypes.mockResolvedValueOnce([ { - id: '1', - actionTypeId: 'test', - description: 'My test', - isPreconfigured: false, - isDeprecated: false, - referencedByCount: 1, - config: {}, + id: 'test', + name: 'Test', + enabled: true, + supportedFeatureIds: ['alerting'], }, { - id: '2', - actionTypeId: 'test2', - description: 'My test 2', - referencedByCount: 1, - isPreconfigured: false, - isDeprecated: false, - config: {}, + id: 'test2', + name: 'Test2', + enabled: true, + supportedFeatureIds: ['alerting', 'cases'], }, { - id: '3', - actionTypeId: 'test2', - description: 'My preconfigured test 2', - isMissingSecrets: true, - referencedByCount: 1, - isPreconfigured: true, - isDeprecated: false, - config: {}, + id: 'test3', + name: 'Test3', + enabled: true, + supportedFeatureIds: ['alerting', 'cases', 'siem', 'uptime'], }, { - id: '4', - actionTypeId: 'nonexistent', - description: 'My invalid connector type', - referencedByCount: 1, - isPreconfigured: false, - isDeprecated: false, - config: {}, + id: 'test4', + name: 'Test4', + enabled: true, + supportedFeatureIds: ['cases'], }, - ] - ); - loadActionTypes.mockResolvedValueOnce([ - { - id: 'test', - name: 'Test', - enabled: true, - supportedFeatureIds: ['alerting'], - }, - { - id: 'test2', - name: 'Test2', - enabled: true, - supportedFeatureIds: ['alerting', 'cases'], - }, - ]); - - const [ - { - application: { capabilities }, - }, - ] = await mocks.getStartServices(); - - const mockedActionParamsFields = React.lazy(async () => ({ - default() { - return <>; - }, - })); - - actionTypeRegistry.get.mockReturnValue({ - id: 'test', - iconClass: 'test', - selectMessage: 'test', - validateParams: (): Promise> => { - const validationResult = { errors: {} }; - return Promise.resolve(validationResult); - }, - actionConnectorFields: null, - actionParamsFields: mockedActionParamsFields, - }); - // eslint-disable-next-line react-hooks/rules-of-hooks - useKibanaMock().services.actionTypeRegistry = actionTypeRegistry; - // eslint-disable-next-line react-hooks/rules-of-hooks - useKibanaMock().services.application.capabilities = { - ...capabilities, - actions: { - delete: true, - save: true, - show: true, - }, - }; - wrapper = mountWithIntl(); - - // Wait for active space to resolve before requesting the component to update - await act(async () => { - await nextTick(); - wrapper.update(); - }); - - expect(loadAllActions).toHaveBeenCalled(); - } + ]); - it('renders table of connectors', async () => { - await setup(); - expect(wrapper.find('EuiInMemoryTable')).toHaveLength(1); - expect(wrapper.find('EuiTableRow')).toHaveLength(4); + const [ + { + application: { capabilities }, + }, + ] = await mocks.getStartServices(); - const featureIdsBadges = wrapper.find( - 'EuiBadge[data-test-subj="connectorsTableCell-featureIds"]' - ); - expect(featureIdsBadges).toHaveLength(5); + const mockedActionParamsFields = React.lazy(async () => ({ + default() { + return <>; + }, + })); - expect(uniq(featureIdsBadges.map((badge) => badge.text()))).toEqual(['Alerting', 'Cases']); - }); + actionTypeRegistry.get.mockReturnValue({ + id: 'test', + iconClass: 'test', + selectMessage: 'test', + validateParams: (): Promise> => { + const validationResult = { errors: {} }; + return Promise.resolve(validationResult); + }, + actionConnectorFields: null, + actionParamsFields: mockedActionParamsFields, + }); + // eslint-disable-next-line react-hooks/rules-of-hooks + useKibanaMock().services.actionTypeRegistry = actionTypeRegistry; + // eslint-disable-next-line react-hooks/rules-of-hooks + useKibanaMock().services.application.capabilities = { + ...capabilities, + actions: { + delete: true, + save: true, + show: true, + }, + }; + wrapper = mountWithIntl(); + + // Wait for active space to resolve before requesting the component to update + await act(async () => { + await nextTick(); + wrapper.update(); + }); + + expect(loadAllActions).toHaveBeenCalled(); + } + + it('renders table of connectors', async () => { + await setup(); + expect(wrapper.find('EuiInMemoryTable')).toHaveLength(1); + expect(wrapper.find('EuiTableRow')).toHaveLength(6); + + expect( + wrapper + .find('tr[data-test-subj="connectors-row"]') + .at(0) + .find('div[data-test-subj="compatibility-content"]') + .text() + ).toBe('Alerting Rules'); + + expect( + wrapper + .find('tr[data-test-subj="connectors-row"]') + .at(1) + .find('div[data-test-subj="compatibility-content"]') + .text() + ).toBe('Alerting RulesCases'); + + expect( + wrapper + .find('tr[data-test-subj="connectors-row"]') + .at(2) + .find('div[data-test-subj="compatibility-content"]') + .text() + ).toBe('Alerting RulesCases'); + + expect( + wrapper + .find('tr[data-test-subj="connectors-row"]') + .at(3) + .find('div[data-test-subj="compatibility-content"]') + .text() + ).toBe(''); + + expect( + wrapper + .find('tr[data-test-subj="connectors-row"]') + .at(4) + .find('div[data-test-subj="compatibility-content"]') + .text() + ).toBe('Alerting RulesCases'); + + expect( + wrapper + .find('tr[data-test-subj="connectors-row"]') + .at(5) + .find('div[data-test-subj="compatibility-content"]') + .text() + ).toBe('Cases'); + }); - it('renders table with preconfigured connectors', async () => { - await setup(); - expect(wrapper.find('[data-test-subj="preConfiguredTitleMessage"]')).toHaveLength(2); - }); + it('renders table with preconfigured connectors', async () => { + await setup(); + expect(wrapper.find('[data-test-subj="preConfiguredTitleMessage"]')).toHaveLength(2); + }); - it('renders unknown connector type as disabled', async () => { - await setup(); - expect(wrapper.find('button[data-test-subj="edit4"]').getDOMNode()).toBeDisabled(); - expect( - wrapper.find('button[data-test-subj="deleteConnector"]').last().getDOMNode() - ).not.toBeDisabled(); - expect( - wrapper.find('button[data-test-subj="runConnector"]').last().getDOMNode() - ).toBeDisabled(); - }); + it('renders unknown connector type as disabled', async () => { + await setup(); + expect(wrapper.find('button[data-test-subj="edit4"]').getDOMNode()).toBeDisabled(); + expect( + wrapper.find('button[data-test-subj="deleteConnector"]').last().getDOMNode() + ).not.toBeDisabled(); + expect( + wrapper.find('button[data-test-subj="runConnector"]').last().getDOMNode() + ).toBeDisabled(); + }); - it('renders fix button when connector secrets is missing', async () => { - await setup(); - expect( - wrapper.find('button[data-test-subj="deleteConnector"]').last().getDOMNode() - ).not.toBeDisabled(); - expect( - wrapper.find('button[data-test-subj="fixConnectorButton"]').last().getDOMNode() - ).not.toBeDisabled(); - }); + it('renders fix button when connector secrets is missing', async () => { + await setup(); + expect( + wrapper.find('button[data-test-subj="deleteConnector"]').last().getDOMNode() + ).not.toBeDisabled(); + expect( + wrapper.find('button[data-test-subj="fixConnectorButton"]').last().getDOMNode() + ).not.toBeDisabled(); + }); - it('supports pagination', async () => { - await setup( - times(15, (index) => ({ - id: `connector${index}`, - actionTypeId: 'test', - name: `My test ${index}`, - secrets: {}, - description: `My test ${index}`, - isPreconfigured: false, - isDeprecated: false, - referencedByCount: 1, - config: {}, - })) - ); - expect(wrapper.find('[data-test-subj="actionsTable"]').first().prop('pagination')) - .toMatchInlineSnapshot(` + it('supports pagination', async () => { + await setup( + times(15, (index) => ({ + id: `connector${index}`, + actionTypeId: 'test', + name: `My test ${index}`, + secrets: {}, + description: `My test ${index}`, + isPreconfigured: false, + isDeprecated: false, + referencedByCount: 1, + config: {}, + })) + ); + expect(wrapper.find('[data-test-subj="actionsTable"]').first().prop('pagination')) + .toMatchInlineSnapshot(` Object { "initialPageIndex": 0, "pageIndex": 0, } `); - wrapper.find('[data-test-subj="pagination-button-1"]').first().simulate('click'); - expect(wrapper.find('[data-test-subj="actionsTable"]').first().prop('pagination')) - .toMatchInlineSnapshot(` + wrapper.find('[data-test-subj="pagination-button-1"]').first().simulate('click'); + expect(wrapper.find('[data-test-subj="actionsTable"]').first().prop('pagination')) + .toMatchInlineSnapshot(` Object { "initialPageIndex": 0, "pageIndex": 1, } `); - }); + }); - test('if select item for edit should render EditConnectorFlyout', async () => { - await setup(); - await wrapper.find('[data-test-subj="edit1"]').first().find('button').simulate('click'); - expect(wrapper.find('[data-test-subj="edit-connector-flyout"]').exists()).toBeTruthy(); - }); + test('if select item for edit should render EditConnectorFlyout', async () => { + await setup(); + await wrapper.find('[data-test-subj="edit1"]').first().find('button').simulate('click'); + expect(wrapper.find('[data-test-subj="edit-connector-flyout"]').exists()).toBeTruthy(); + }); - test('if delete item that is used in a rule should show a warning in the popup', async () => { - await setup(); - await wrapper.find('.euiButtonIcon').last().simulate('click'); - expect(wrapper.find('[data-test-subj="deleteConnectorsConfirmation"]').exists()).toBeTruthy(); - expect( - wrapper - .find('[data-test-subj="deleteConnectorsConfirmation"]') - .text() - .includes('This connector is used in a rule') - ); + test('if delete item that is used in a rule should show a warning in the popup', async () => { + await setup(); + await wrapper.find('.euiButtonIcon').last().simulate('click'); + expect(wrapper.find('[data-test-subj="deleteConnectorsConfirmation"]').exists()).toBeTruthy(); + expect( + wrapper + .find('[data-test-subj="deleteConnectorsConfirmation"]') + .text() + .includes('This connector is used in a rule') + ); + }); }); -}); -describe('actions_connectors_list component empty with show only capability', () => { - let wrapper: ReactWrapper; + describe('component empty with show only capability', () => { + let wrapper: ReactWrapper; - async function setup() { - loadAllActions.mockResolvedValueOnce([]); - loadActionTypes.mockResolvedValueOnce([ - { - id: 'test', - name: 'Test', - supportedFeatureIds: ['alerting'], - }, - { - id: 'test2', - name: 'Test2', - supportedFeatureIds: ['alerting'], - }, - ]); - const [ - { - application: { capabilities }, - }, - ] = await mocks.getStartServices(); - - // eslint-disable-next-line react-hooks/rules-of-hooks - useKibanaMock().services.actionTypeRegistry = actionTypeRegistry; - // eslint-disable-next-line react-hooks/rules-of-hooks - useKibanaMock().services.application.capabilities = { - ...capabilities, - actions: { - show: true, - save: false, - delete: false, - }, - }; - wrapper = mountWithIntl(); - - // Wait for active space to resolve before requesting the component to update - await act(async () => { - await nextTick(); - wrapper.update(); + async function setup() { + loadAllActions.mockResolvedValueOnce([]); + loadActionTypes.mockResolvedValueOnce([ + { + id: 'test', + name: 'Test', + supportedFeatureIds: ['alerting'], + }, + { + id: 'test2', + name: 'Test2', + supportedFeatureIds: ['alerting'], + }, + ]); + const [ + { + application: { capabilities }, + }, + ] = await mocks.getStartServices(); + + // eslint-disable-next-line react-hooks/rules-of-hooks + useKibanaMock().services.actionTypeRegistry = actionTypeRegistry; + // eslint-disable-next-line react-hooks/rules-of-hooks + useKibanaMock().services.application.capabilities = { + ...capabilities, + actions: { + show: true, + save: false, + delete: false, + }, + }; + wrapper = mountWithIntl(); + + // Wait for active space to resolve before requesting the component to update + await act(async () => { + await nextTick(); + wrapper.update(); + }); + } + + it('renders no permissions to create connector', async () => { + await setup(); + expect(wrapper.find('[defaultMessage="No permissions to create connectors"]')).toHaveLength( + 1 + ); + expect(wrapper.find('[data-test-subj="createActionButton"]')).toHaveLength(0); }); - } - - it('renders no permissions to create connector', async () => { - await setup(); - expect(wrapper.find('[defaultMessage="No permissions to create connectors"]')).toHaveLength(1); - expect(wrapper.find('[data-test-subj="createActionButton"]')).toHaveLength(0); }); -}); -describe('actions_connectors_list with show only capability', () => { - let wrapper: ReactWrapper; - - async function setup() { - loadAllActions.mockResolvedValueOnce([ - { - id: '1', - actionTypeId: 'test', - description: 'My test', - referencedByCount: 1, - config: {}, - }, - { - id: '2', - actionTypeId: 'test2', - description: 'My test 2', - referencedByCount: 1, - config: {}, - }, - ]); - loadActionTypes.mockResolvedValueOnce([ - { - id: 'test', - name: 'Test', - supportedFeatureIds: ['alerting'], - }, - { - id: 'test2', - name: 'Test2', - supportedFeatureIds: ['alerting'], - }, - ]); - const [ - { - application: { capabilities }, - }, - ] = await mocks.getStartServices(); - - // eslint-disable-next-line react-hooks/rules-of-hooks - useKibanaMock().services.application.capabilities = { - ...capabilities, - actions: { - show: true, - save: false, - delete: false, - }, - }; - // eslint-disable-next-line react-hooks/rules-of-hooks - useKibanaMock().services.actionTypeRegistry = actionTypeRegistry; - wrapper = mountWithIntl(); - - // Wait for active space to resolve before requesting the component to update - await act(async () => { - await nextTick(); - wrapper.update(); - }); - } - - it('renders table of connectors with delete button disabled', async () => { - await setup(); - expect(wrapper.find('EuiInMemoryTable')).toHaveLength(1); - expect(wrapper.find('EuiTableRow')).toHaveLength(2); - wrapper.find('EuiTableRow').forEach((elem) => { - const deleteButton = elem.find('[data-test-subj="deleteConnector"]').first(); - expect(deleteButton).toBeTruthy(); - expect(deleteButton.prop('isDisabled')).toBeTruthy(); + describe('with show only capability', () => { + let wrapper: ReactWrapper; + + async function setup() { + loadAllActions.mockResolvedValueOnce([ + { + id: '1', + actionTypeId: 'test', + description: 'My test', + referencedByCount: 1, + config: {}, + }, + { + id: '2', + actionTypeId: 'test2', + description: 'My test 2', + referencedByCount: 1, + config: {}, + }, + ]); + loadActionTypes.mockResolvedValueOnce([ + { + id: 'test', + name: 'Test', + supportedFeatureIds: ['alerting'], + }, + { + id: 'test2', + name: 'Test2', + supportedFeatureIds: ['alerting'], + }, + ]); + const [ + { + application: { capabilities }, + }, + ] = await mocks.getStartServices(); + + // eslint-disable-next-line react-hooks/rules-of-hooks + useKibanaMock().services.application.capabilities = { + ...capabilities, + actions: { + show: true, + save: false, + delete: false, + }, + }; + // eslint-disable-next-line react-hooks/rules-of-hooks + useKibanaMock().services.actionTypeRegistry = actionTypeRegistry; + wrapper = mountWithIntl(); + + // Wait for active space to resolve before requesting the component to update + await act(async () => { + await nextTick(); + wrapper.update(); + }); + } + + it('renders table of connectors with delete button disabled', async () => { + await setup(); + expect(wrapper.find('EuiInMemoryTable')).toHaveLength(1); + expect(wrapper.find('EuiTableRow')).toHaveLength(2); + wrapper.find('EuiTableRow').forEach((elem) => { + const deleteButton = elem.find('[data-test-subj="deleteConnector"]').first(); + expect(deleteButton).toBeTruthy(); + expect(deleteButton.prop('isDisabled')).toBeTruthy(); + }); }); }); -}); -describe('actions_connectors_list component with disabled items', () => { - let wrapper: ReactWrapper; - - async function setup() { - loadAllActions.mockResolvedValueOnce([ - { - id: '1', - actionTypeId: 'test', - description: 'My test', - referencedByCount: 1, - config: {}, - }, - { - id: '2', - actionTypeId: 'test2', - description: 'My test 2', - referencedByCount: 1, - config: {}, - }, - ]); - loadActionTypes.mockResolvedValueOnce([ - { - id: 'test', - name: 'Test', - enabled: false, - enabledInConfig: false, - enabledInLicense: true, - supportedFeatureIds: ['alerting'], - }, - { - id: 'test2', - name: 'Test2', - enabled: false, - enabledInConfig: true, - enabledInLicense: false, - supportedFeatureIds: ['alerting'], - }, - ]); - - const [ - { - application: { capabilities }, - }, - ] = await mocks.getStartServices(); - - // eslint-disable-next-line react-hooks/rules-of-hooks - useKibanaMock().services.application.capabilities = { - ...capabilities, - actions: { - show: true, - save: true, - delete: true, - }, - }; - // eslint-disable-next-line react-hooks/rules-of-hooks - useKibanaMock().services.actionTypeRegistry = actionTypeRegistry; - wrapper = mountWithIntl(); - - // Wait for active space to resolve before requesting the component to update - await act(async () => { - await nextTick(); - wrapper.update(); - }); + describe('component with disabled items', () => { + let wrapper: ReactWrapper; - expect(loadAllActions).toHaveBeenCalled(); - } - - it('renders table of connectors', async () => { - await setup(); - expect(wrapper.find('EuiInMemoryTable')).toHaveLength(1); - expect(wrapper.find('EuiTableRow')).toHaveLength(2); - expect(wrapper.find('EuiTableRow').at(0).prop('className')).toEqual( - 'actConnectorsList__tableRowDisabled' - ); - expect(wrapper.find('EuiTableRow').at(1).prop('className')).toEqual( - 'actConnectorsList__tableRowDisabled' - ); - }); -}); + async function setup() { + loadAllActions.mockResolvedValueOnce([ + { + id: '1', + actionTypeId: 'test', + description: 'My test', + referencedByCount: 1, + config: {}, + }, + { + id: '2', + actionTypeId: 'test2', + description: 'My test 2', + referencedByCount: 1, + config: {}, + }, + ]); + loadActionTypes.mockResolvedValueOnce([ + { + id: 'test', + name: 'Test', + enabled: false, + enabledInConfig: false, + enabledInLicense: true, + supportedFeatureIds: ['alerting'], + }, + { + id: 'test2', + name: 'Test2', + enabled: false, + enabledInConfig: true, + enabledInLicense: false, + supportedFeatureIds: ['alerting'], + }, + ]); -describe('actions_connectors_list component with deprecated connectors', () => { - let wrapper: ReactWrapper; - - async function setup() { - loadAllActions.mockResolvedValueOnce([ - { - id: '1', - actionTypeId: '.servicenow', - description: 'My test', - referencedByCount: 1, - config: { usesTableApi: true }, - isDeprecated: true, - }, - { - id: '2', - actionTypeId: '.servicenow-sir', - description: 'My test 2', - referencedByCount: 1, - config: { usesTableApi: true }, - isDeprecated: true, - }, - ]); - loadActionTypes.mockResolvedValueOnce([ - { - id: 'test', - name: '.servicenow', - enabled: false, - enabledInConfig: false, - enabledInLicense: true, - supportedFeatureIds: ['alerting'], - }, - { - id: 'test2', - name: '.servicenow-sir', - enabled: false, - enabledInConfig: true, - enabledInLicense: false, - supportedFeatureIds: ['alerting'], - }, - ]); - - const [ - { - application: { capabilities }, - }, - ] = await mocks.getStartServices(); - - // eslint-disable-next-line react-hooks/rules-of-hooks - useKibanaMock().services.application.capabilities = { - ...capabilities, - actions: { - show: true, - save: true, - delete: true, - }, - }; - // eslint-disable-next-line react-hooks/rules-of-hooks - useKibanaMock().services.actionTypeRegistry = actionTypeRegistry; - wrapper = mountWithIntl( - ({ eui: { euiSizeS: '15px' }, darkMode: true })}> - - - ); - - // Wait for active space to resolve before requesting the component to update - await act(async () => { - await nextTick(); - wrapper.update(); + const [ + { + application: { capabilities }, + }, + ] = await mocks.getStartServices(); + + // eslint-disable-next-line react-hooks/rules-of-hooks + useKibanaMock().services.application.capabilities = { + ...capabilities, + actions: { + show: true, + save: true, + delete: true, + }, + }; + // eslint-disable-next-line react-hooks/rules-of-hooks + useKibanaMock().services.actionTypeRegistry = actionTypeRegistry; + wrapper = mountWithIntl(); + + // Wait for active space to resolve before requesting the component to update + await act(async () => { + await nextTick(); + wrapper.update(); + }); + + expect(loadAllActions).toHaveBeenCalled(); + } + + it('renders table of connectors', async () => { + await setup(); + expect(wrapper.find('EuiInMemoryTable')).toHaveLength(1); + expect(wrapper.find('EuiTableRow')).toHaveLength(2); + expect(wrapper.find('EuiTableRow').at(0).prop('className')).toEqual( + 'actConnectorsList__tableRowDisabled' + ); + expect(wrapper.find('EuiTableRow').at(1).prop('className')).toEqual( + 'actConnectorsList__tableRowDisabled' + ); }); + }); + + describe('component with deprecated connectors', () => { + let wrapper: ReactWrapper; - expect(loadAllActions).toHaveBeenCalled(); - } + async function setup() { + loadAllActions.mockResolvedValueOnce([ + { + id: '1', + actionTypeId: '.servicenow', + description: 'My test', + referencedByCount: 1, + config: { usesTableApi: true }, + isDeprecated: true, + }, + { + id: '2', + actionTypeId: '.servicenow-sir', + description: 'My test 2', + referencedByCount: 1, + config: { usesTableApi: true }, + isDeprecated: true, + }, + ]); + loadActionTypes.mockResolvedValueOnce([ + { + id: 'test', + name: '.servicenow', + enabled: false, + enabledInConfig: false, + enabledInLicense: true, + supportedFeatureIds: ['alerting'], + }, + { + id: 'test2', + name: '.servicenow-sir', + enabled: false, + enabledInConfig: true, + enabledInLicense: false, + supportedFeatureIds: ['alerting'], + }, + ]); - it('shows the warning icon', async () => { - await setup(); - expect(wrapper.find('EuiInMemoryTable')).toHaveLength(1); - expect(wrapper.find('EuiTableRow')).toHaveLength(2); - expect(wrapper.find('.euiToolTipAnchor [aria-label="Warning"]').exists()).toBe(true); + const [ + { + application: { capabilities }, + }, + ] = await mocks.getStartServices(); + + // eslint-disable-next-line react-hooks/rules-of-hooks + useKibanaMock().services.application.capabilities = { + ...capabilities, + actions: { + show: true, + save: true, + delete: true, + }, + }; + // eslint-disable-next-line react-hooks/rules-of-hooks + useKibanaMock().services.actionTypeRegistry = actionTypeRegistry; + wrapper = mountWithIntl( + ({ eui: { euiSizeS: '15px' }, darkMode: true })}> + + + ); + + // Wait for active space to resolve before requesting the component to update + await act(async () => { + await nextTick(); + wrapper.update(); + }); + + expect(loadAllActions).toHaveBeenCalled(); + } + + it('shows the warning icon', async () => { + await setup(); + expect(wrapper.find('EuiInMemoryTable')).toHaveLength(1); + expect(wrapper.find('EuiTableRow')).toHaveLength(2); + expect(wrapper.find('.euiToolTipAnchor [aria-label="Warning"]').exists()).toBe(true); + }); }); }); diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/actions_connectors_list/components/actions_connectors_list.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/actions_connectors_list/components/actions_connectors_list.tsx index 5c58ac5dcff56..249f9f503fcf8 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/actions_connectors_list/components/actions_connectors_list.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/actions_connectors_list/components/actions_connectors_list.tsx @@ -27,7 +27,7 @@ import { i18n } from '@kbn/i18n'; import { omit } from 'lodash'; import { FormattedMessage } from '@kbn/i18n-react'; import { withTheme, EuiTheme } from '@kbn/kibana-react-plugin/common'; -import { getConnectorFeatureName } from '@kbn/actions-plugin/common'; +import { getConnectorCompatibility } from '@kbn/actions-plugin/common'; import { loadAllActions, loadActionTypes, deleteActions } from '../../../lib/action_connector_api'; import { hasDeleteActionsCapability, @@ -138,8 +138,8 @@ const ActionsConnectorsList: React.FunctionComponent = () => { actionType: actionTypesIndex[action.actionTypeId] ? actionTypesIndex[action.actionTypeId].name : action.actionTypeId, - featureIds: actionTypesIndex[action.actionTypeId] - ? actionTypesIndex[action.actionTypeId].supportedFeatureIds + compatibility: actionTypesIndex[action.actionTypeId] + ? getConnectorCompatibility(actionTypesIndex[action.actionTypeId].supportedFeatureIds) : [], }; }) @@ -272,22 +272,28 @@ const ActionsConnectorsList: React.FunctionComponent = () => { truncateText: true, }, { - field: 'featureIds', + field: 'compatibility', + 'data-test-subj': 'connectorsTableCell-compatibility', name: i18n.translate( - 'xpack.triggersActionsUI.sections.actionsConnectorsList.connectorsListTable.columns.featureIdsTitle', + 'xpack.triggersActionsUI.sections.actionsConnectorsList.connectorsListTable.columns.compatibility', { - defaultMessage: 'Availability', + defaultMessage: 'Compatibility', } ), sortable: false, truncateText: true, - render: (availability: string[]) => { + render: (compatibility: string[]) => { return ( - - {(availability ?? []).map((featureId: string) => ( - - - {getConnectorFeatureName(featureId)} + + {compatibility.map((compatibilityItem: string) => ( + + + {compatibilityItem} ))} diff --git a/x-pack/plugins/triggers_actions_ui/public/types.ts b/x-pack/plugins/triggers_actions_ui/public/types.ts index b6011b92de871..ac2a80212825b 100644 --- a/x-pack/plugins/triggers_actions_ui/public/types.ts +++ b/x-pack/plugins/triggers_actions_ui/public/types.ts @@ -246,7 +246,7 @@ export type ActionConnectorWithoutId< export type ActionConnectorTableItem = ActionConnector & { actionType: ActionType['name']; - featureIds: ActionType['supportedFeatureIds']; + compatibility: string[]; }; type AsActionVariables = { From a1e0b989ae318910869f0cf06a126f40d6c84039 Mon Sep 17 00:00:00 2001 From: Miriam <31922082+MiriamAparicio@users.noreply.github.com> Date: Fri, 26 Aug 2022 14:19:21 +0100 Subject: [PATCH 20/28] Remove sourcemap:write field from api keys creation (#139383) * Remove sourcemap:write field from api keys creation * Fix types --- x-pack/plugins/apm/common/privilege_type.ts | 2 -- .../settings/agent_keys/create_agent_key.tsx | 28 +------------------ .../translations/translations/fr-FR.json | 1 - .../translations/translations/ja-JP.json | 1 - .../translations/translations/zh-CN.json | 1 - .../common/authentication.ts | 2 +- .../settings/agent_keys/agent_keys.spec.ts | 6 +--- 7 files changed, 3 insertions(+), 38 deletions(-) diff --git a/x-pack/plugins/apm/common/privilege_type.ts b/x-pack/plugins/apm/common/privilege_type.ts index e5a67d2a807f0..161225da68480 100644 --- a/x-pack/plugins/apm/common/privilege_type.ts +++ b/x-pack/plugins/apm/common/privilege_type.ts @@ -8,14 +8,12 @@ import * as t from 'io-ts'; export const enum PrivilegeType { - SOURCEMAP = 'sourcemap:write', EVENT = 'event:write', AGENT_CONFIG = 'config_agent:read', } export const privilegesTypeRt = t.array( t.union([ - t.literal(PrivilegeType.SOURCEMAP), t.literal(PrivilegeType.EVENT), t.literal(PrivilegeType.AGENT_CONFIG), ]) diff --git a/x-pack/plugins/apm/public/components/app/settings/agent_keys/create_agent_key.tsx b/x-pack/plugins/apm/public/components/app/settings/agent_keys/create_agent_key.tsx index 1634706d330e2..684a7386f35e6 100644 --- a/x-pack/plugins/apm/public/components/app/settings/agent_keys/create_agent_key.tsx +++ b/x-pack/plugins/apm/public/components/app/settings/agent_keys/create_agent_key.tsx @@ -43,12 +43,11 @@ export function CreateAgentKeyFlyout({ onCancel, onSuccess, onError }: Props) { const [agentKeyBody, setAgentKeyBody] = useState({ name: '', - sourcemap: true, event: true, agentConfig: true, }); - const { name, sourcemap, event, agentConfig } = agentKeyBody; + const { name, event, agentConfig } = agentKeyBody; const currentUser = useCurrentUser(); @@ -73,10 +72,6 @@ export function CreateAgentKeyFlyout({ onCancel, onSuccess, onError }: Props) { try { const privileges: PrivilegeType[] = []; - if (sourcemap) { - privileges.push(PrivilegeType.SOURCEMAP); - } - if (event) { privileges.push(PrivilegeType.EVENT); } @@ -206,27 +201,6 @@ export function CreateAgentKeyFlyout({ onCancel, onSuccess, onError }: Props) { /> - - - setAgentKeyBody((state) => ({ - ...state, - sourcemap: !state.sourcemap, - })) - } - /> - - diff --git a/x-pack/plugins/translations/translations/fr-FR.json b/x-pack/plugins/translations/translations/fr-FR.json index 6558334913435..a1db17454109d 100644 --- a/x-pack/plugins/translations/translations/fr-FR.json +++ b/x-pack/plugins/translations/translations/fr-FR.json @@ -7374,7 +7374,6 @@ "xpack.apm.settings.agentKeys.createKeyFlyout.namePlaceholder": "Par exemple, apm-key", "xpack.apm.settings.agentKeys.createKeyFlyout.nameTitle": "Nom", "xpack.apm.settings.agentKeys.createKeyFlyout.privilegesFieldset": "Attribuer des privilèges", - "xpack.apm.settings.agentKeys.createKeyFlyout.sourcemaps": "Requis pour le téléchargement des cartes sources.", "xpack.apm.settings.agentKeys.createKeyFlyout.userTitle": "Utilisateur", "xpack.apm.settings.agentKeys.deleteConfirmModal.cancel": "Annuler", "xpack.apm.settings.agentKeys.deleteConfirmModal.delete": "Supprimer", diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 5a6e17d82c29c..9ec2c5ba026da 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -7363,7 +7363,6 @@ "xpack.apm.settings.agentKeys.createKeyFlyout.namePlaceholder": "例:apm-key", "xpack.apm.settings.agentKeys.createKeyFlyout.nameTitle": "名前", "xpack.apm.settings.agentKeys.createKeyFlyout.privilegesFieldset": "権限を割り当て", - "xpack.apm.settings.agentKeys.createKeyFlyout.sourcemaps": "ソースマップのアップロードに必要です。", "xpack.apm.settings.agentKeys.createKeyFlyout.userTitle": "ユーザー", "xpack.apm.settings.agentKeys.deleteConfirmModal.cancel": "キャンセル", "xpack.apm.settings.agentKeys.deleteConfirmModal.delete": "削除", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index 107dcec2ce65b..915e40765e5aa 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -7377,7 +7377,6 @@ "xpack.apm.settings.agentKeys.createKeyFlyout.namePlaceholder": "例如,apm-key", "xpack.apm.settings.agentKeys.createKeyFlyout.nameTitle": "名称", "xpack.apm.settings.agentKeys.createKeyFlyout.privilegesFieldset": "分配权限", - "xpack.apm.settings.agentKeys.createKeyFlyout.sourcemaps": "上传源地图所必需。", "xpack.apm.settings.agentKeys.createKeyFlyout.userTitle": "用户", "xpack.apm.settings.agentKeys.deleteConfirmModal.cancel": "取消", "xpack.apm.settings.agentKeys.deleteConfirmModal.delete": "删除", diff --git a/x-pack/test/apm_api_integration/common/authentication.ts b/x-pack/test/apm_api_integration/common/authentication.ts index 28dffac7f80ca..e975f6e147442 100644 --- a/x-pack/test/apm_api_integration/common/authentication.ts +++ b/x-pack/test/apm_api_integration/common/authentication.ts @@ -78,7 +78,7 @@ const customRoles = { applications: [ { application: 'apm', - privileges: [PrivilegeType.AGENT_CONFIG, PrivilegeType.EVENT, PrivilegeType.SOURCEMAP], + privileges: [PrivilegeType.AGENT_CONFIG, PrivilegeType.EVENT], resources: ['*'], }, ], diff --git a/x-pack/test/apm_api_integration/tests/settings/agent_keys/agent_keys.spec.ts b/x-pack/test/apm_api_integration/tests/settings/agent_keys/agent_keys.spec.ts index 2f607cecb75bb..c0d6500fd298c 100644 --- a/x-pack/test/apm_api_integration/tests/settings/agent_keys/agent_keys.spec.ts +++ b/x-pack/test/apm_api_integration/tests/settings/agent_keys/agent_keys.spec.ts @@ -17,11 +17,7 @@ export default function ApiTest({ getService }: FtrProviderContext) { const esClient = getService('es'); const agentKeyName = 'test'; - const allApplicationPrivileges = [ - PrivilegeType.AGENT_CONFIG, - PrivilegeType.EVENT, - PrivilegeType.SOURCEMAP, - ]; + const allApplicationPrivileges = [PrivilegeType.AGENT_CONFIG, PrivilegeType.EVENT]; async function createAgentKey(apiClient: ApmApiSupertest, privileges = allApplicationPrivileges) { return await apiClient({ From 62578bdcf4adc9c3ed798f399193efbb2a0539cf Mon Sep 17 00:00:00 2001 From: Dima Arnautov Date: Fri, 26 Aug 2022 15:25:51 +0200 Subject: [PATCH 21/28] [ML] Fix navigation for the Basic licence (#139469) * fix redirect to the data vis * update jest tests * remove window.location.href from the clone action * assert the redirect * update power user tests * use plugin id const, return promise reject --- x-pack/plugins/ml/public/application/app.tsx | 2 +- .../jobs/jobs_list/components/utils.js | 6 ++-- .../application/license/check_license.tsx | 8 +++-- .../license/ml_client_license.test.ts | 7 ++-- .../application/license/ml_client_license.ts | 35 +++++++++++-------- .../apps/ml/permissions/full_ml_access.ts | 7 +++- .../apps/ml/permissions/read_ml_access.ts | 7 +++- 7 files changed, 49 insertions(+), 23 deletions(-) diff --git a/x-pack/plugins/ml/public/application/app.tsx b/x-pack/plugins/ml/public/application/app.tsx index 53c50893bcdfb..8e9a7d67d10ac 100644 --- a/x-pack/plugins/ml/public/application/app.tsx +++ b/x-pack/plugins/ml/public/application/app.tsx @@ -146,7 +146,7 @@ export const renderApp = ( appMountParams.onAppLeave((actions) => actions.default()); - const mlLicense = setLicenseCache(deps.licensing, [ + const mlLicense = setLicenseCache(deps.licensing, coreStart.application, [ () => ReactDOM.render( , diff --git a/x-pack/plugins/ml/public/application/jobs/jobs_list/components/utils.js b/x-pack/plugins/ml/public/application/jobs/jobs_list/components/utils.js index 364cdd1be55db..430244c52e69c 100644 --- a/x-pack/plugins/ml/public/application/jobs/jobs_list/components/utils.js +++ b/x-pack/plugins/ml/public/application/jobs/jobs_list/components/utils.js @@ -13,7 +13,7 @@ import { getToastNotificationService, toastNotificationServiceProvider, } from '../../../services/toast_notification_service'; -import { getToastNotifications } from '../../../util/dependency_cache'; +import { getApplication, getToastNotifications } from '../../../util/dependency_cache'; import { ml } from '../../../services/ml_api_service'; import { stringMatch } from '../../../util/string_utils'; import { getDataViewNames } from '../../../util/index_utils'; @@ -22,6 +22,8 @@ import { JOB_ACTION } from '../../../../../common/constants/job_actions'; import { parseInterval } from '../../../../../common/util/parse_interval'; import { mlCalendarService } from '../../../services/calendar_service'; import { isPopulatedObject } from '@kbn/ml-is-populated-object'; +import { ML_PAGES } from '../../../../../common/constants/locator'; +import { PLUGIN_ID } from '../../../../../common/constants/app'; export function loadFullJob(jobId) { return new Promise((resolve, reject) => { @@ -287,7 +289,7 @@ export async function cloneJob(jobId) { ); } - window.location.href = '#/jobs/new_job'; + getApplication().navigateToApp(PLUGIN_ID, { path: ML_PAGES.ANOMALY_DETECTION_CREATE_JOB }); } catch (error) { getToastNotificationService().displayErrorToast( error, diff --git a/x-pack/plugins/ml/public/application/license/check_license.tsx b/x-pack/plugins/ml/public/application/license/check_license.tsx index 569746a1dab27..9436614effe3c 100644 --- a/x-pack/plugins/ml/public/application/license/check_license.tsx +++ b/x-pack/plugins/ml/public/application/license/check_license.tsx @@ -5,7 +5,8 @@ * 2.0. */ -import { LicensingPluginSetup } from '@kbn/licensing-plugin/public'; +import type { LicensingPluginSetup } from '@kbn/licensing-plugin/public'; +import type { CoreStart } from '@kbn/core/public'; import { MlLicense } from '../../../common/license'; import { MlClientLicense } from './ml_client_license'; @@ -16,13 +17,16 @@ let mlLicense: MlClientLicense | null = null; * * @export * @param {LicensingPluginSetup} licensingSetup + * @param application + * @param postInitFunctions * @returns {MlClientLicense} */ export function setLicenseCache( licensingSetup: LicensingPluginSetup, + application: CoreStart['application'], postInitFunctions?: Array<(lic: MlLicense) => void> ) { - mlLicense = new MlClientLicense(); + mlLicense = new MlClientLicense(application); mlLicense.setup(licensingSetup.license$, postInitFunctions); return mlLicense; } diff --git a/x-pack/plugins/ml/public/application/license/ml_client_license.test.ts b/x-pack/plugins/ml/public/application/license/ml_client_license.test.ts index 02a38f152a3ea..ea7aa5d1a4b99 100644 --- a/x-pack/plugins/ml/public/application/license/ml_client_license.test.ts +++ b/x-pack/plugins/ml/public/application/license/ml_client_license.test.ts @@ -9,10 +9,13 @@ import { Observable, Subject } from 'rxjs'; import { ILicense } from '@kbn/licensing-plugin/common/types'; import { MlClientLicense } from './ml_client_license'; +import { applicationServiceMock } from '@kbn/core/public/application/application_service.mock'; describe('MlClientLicense', () => { + const startApplicationContractMock = applicationServiceMock.createStartContract(); + test('should miss the license update when initialized without postInitFunction', () => { - const mlLicense = new MlClientLicense(); + const mlLicense = new MlClientLicense(startApplicationContractMock); // upon instantiation the full license doesn't get set expect(mlLicense.isFullLicense()).toBe(false); @@ -35,7 +38,7 @@ describe('MlClientLicense', () => { }); test('should not miss the license update when initialized with postInitFunction', (done) => { - const mlLicense = new MlClientLicense(); + const mlLicense = new MlClientLicense(startApplicationContractMock); // upon instantiation the full license doesn't get set expect(mlLicense.isFullLicense()).toBe(false); diff --git a/x-pack/plugins/ml/public/application/license/ml_client_license.ts b/x-pack/plugins/ml/public/application/license/ml_client_license.ts index 055ad7b641398..37488b8448aef 100644 --- a/x-pack/plugins/ml/public/application/license/ml_client_license.ts +++ b/x-pack/plugins/ml/public/application/license/ml_client_license.ts @@ -5,19 +5,36 @@ * 2.0. */ +import type { CoreStart } from '@kbn/core/public'; +import { ML_PAGES } from '../../../common/constants/locator'; import { MlLicense } from '../../../common/license'; import { showExpiredLicenseWarning } from './expired_warning'; +import { PLUGIN_ID } from '../../../common/constants/app'; export class MlClientLicense extends MlLicense { - fullLicenseResolver() { + constructor(private application: CoreStart['application']) { + super(); + } + + private redirectToKibana() { + this.application.navigateToApp('home'); + return Promise.reject(); + } + + private redirectToBasic() { + this.application.navigateToApp(PLUGIN_ID, { path: ML_PAGES.DATA_VISUALIZER }); + return Promise.reject(); + } + + fullLicenseResolver(): Promise { if (this.isMlEnabled() === false || this.isMinimumLicense() === false) { // ML is not enabled or the license isn't at least basic - return redirectToKibana(); + return this.redirectToKibana(); } if (this.isFullLicense() === false) { // ML is enabled, but only with a basic or gold license - return redirectToBasic(); + return this.redirectToBasic(); } // ML is enabled @@ -30,7 +47,7 @@ export class MlClientLicense extends MlLicense { basicLicenseResolver() { if (this.isMlEnabled() === false || this.isMinimumLicense() === false) { // ML is not enabled or the license isn't at least basic - return redirectToKibana(); + return this.redirectToKibana(); } // ML is enabled @@ -40,13 +57,3 @@ export class MlClientLicense extends MlLicense { return Promise.resolve(); } } - -function redirectToKibana() { - window.location.href = '/'; - return Promise.reject(); -} - -function redirectToBasic() { - window.location.href = '#/datavisualizer'; - return Promise.reject(); -} diff --git a/x-pack/test/functional_basic/apps/ml/permissions/full_ml_access.ts b/x-pack/test/functional_basic/apps/ml/permissions/full_ml_access.ts index b90b97ca87a57..0ff4eca82a5cf 100644 --- a/x-pack/test/functional_basic/apps/ml/permissions/full_ml_access.ts +++ b/x-pack/test/functional_basic/apps/ml/permissions/full_ml_access.ts @@ -5,13 +5,14 @@ * 2.0. */ +import expect from '@kbn/expect'; import { FtrProviderContext } from '../../../ftr_provider_context'; - import { USER } from '../../../../functional/services/ml/security_common'; export default function ({ getService }: FtrProviderContext) { const esArchiver = getService('esArchiver'); const ml = getService('ml'); + const browser = getService('browser'); const testUsers = [ { user: USER.ML_POWERUSER, discoverAvailable: true }, @@ -57,6 +58,10 @@ export default function ({ getService }: FtrProviderContext) { await ml.testExecution.logTestStep('should load the ML app'); await ml.navigation.navigateToMl(); + await ml.testExecution.logTestStep('should redirect to the "Data Visualizer" page'); + const browserURl = await browser.getCurrentUrl(); + expect(browserURl).to.contain('/ml/datavisualizer'); + await ml.testExecution.logTestStep('should display the disabled "Overview" tab'); await ml.navigation.assertOverviewTabEnabled(false); diff --git a/x-pack/test/functional_basic/apps/ml/permissions/read_ml_access.ts b/x-pack/test/functional_basic/apps/ml/permissions/read_ml_access.ts index fc293defceb86..c7a3f13d23ed7 100644 --- a/x-pack/test/functional_basic/apps/ml/permissions/read_ml_access.ts +++ b/x-pack/test/functional_basic/apps/ml/permissions/read_ml_access.ts @@ -5,13 +5,14 @@ * 2.0. */ +import expect from '@kbn/expect'; import { FtrProviderContext } from '../../../ftr_provider_context'; - import { USER } from '../../../../functional/services/ml/security_common'; export default function ({ getService }: FtrProviderContext) { const esArchiver = getService('esArchiver'); const ml = getService('ml'); + const browser = getService('browser'); const testUsers = [ { user: USER.ML_VIEWER, discoverAvailable: true }, @@ -57,6 +58,10 @@ export default function ({ getService }: FtrProviderContext) { await ml.testExecution.logTestStep('should load the ML app'); await ml.navigation.navigateToMl(); + await ml.testExecution.logTestStep('should redirect to the "Data Visualizer" page'); + const browserURl = await browser.getCurrentUrl(); + expect(browserURl).to.contain('/ml/datavisualizer'); + await ml.testExecution.logTestStep('should display the disabled "Overview" tab'); await ml.navigation.assertOverviewTabEnabled(false); From 6e3aa86de8256829f3021213a27e0014a3891421 Mon Sep 17 00:00:00 2001 From: Rodney Norris Date: Fri, 26 Aug 2022 08:54:18 -0500 Subject: [PATCH 22/28] default document card title to title key (#139439) Updated the document list for content to try and find a better title if we can find a title key (or name) on the result _source. This was done on the shared Result component to try and make it more accessible. Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../document_list/document_list.tsx | 8 +--- .../applications/shared/result/result.tsx | 11 ++++-- .../shared/result/result_metadata.test.ts | 27 +++++++++++++ .../shared/result/result_metadata.ts | 39 +++++++++++++++++++ .../applications/shared/result/types.ts | 1 + 5 files changed, 76 insertions(+), 10 deletions(-) create mode 100644 x-pack/plugins/enterprise_search/public/applications/shared/result/result_metadata.test.ts create mode 100644 x-pack/plugins/enterprise_search/public/applications/shared/result/result_metadata.ts diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/components/document_list/document_list.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/components/document_list/document_list.tsx index 43ed12f040d0c..1d34dc695b0e2 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/components/document_list/document_list.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/components/document_list/document_list.tsx @@ -28,6 +28,7 @@ import { import { i18n } from '@kbn/i18n'; import { Result } from '../../../../../shared/result/result'; +import { resultMetaData } from '../../../../../shared/result/result_metadata'; import { DocumentsLogic } from '../../documents_logic'; @@ -84,12 +85,7 @@ export const DocumentList: React.FC = () => { {results.map((result) => { return ( - + ); diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/result/result.tsx b/x-pack/plugins/enterprise_search/public/applications/shared/result/result.tsx index f350587494ebc..9b1b5c61a5b22 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/result/result.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/shared/result/result.tsx @@ -48,10 +48,13 @@ export const Result: React.FC = ({ metaData, fields }) => { diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/result/result_metadata.test.ts b/x-pack/plugins/enterprise_search/public/applications/shared/result/result_metadata.test.ts new file mode 100644 index 0000000000000..c93b2b1b7a72d --- /dev/null +++ b/x-pack/plugins/enterprise_search/public/applications/shared/result/result_metadata.test.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 { SearchHit } from '@elastic/elasticsearch/lib/api/types'; + +import { resultTitle } from './result_metadata'; + +const makeSearchHit = (source: undefined | unknown): SearchHit => + ({ + _source: source, + } as SearchHit); + +describe('resultTitle', () => { + it('returns result title if available', () => { + expect(resultTitle(makeSearchHit({ title: 'test 123' }))).toEqual('test 123'); + expect(resultTitle(makeSearchHit({ name: 'this is a name' }))).toEqual('this is a name'); + expect(resultTitle(makeSearchHit({ name: 'this is a name', title: 'test 123' }))).toEqual( + 'test 123' + ); + expect(resultTitle(makeSearchHit({ other: 'thing' }))).toEqual(undefined); + expect(resultTitle(makeSearchHit(undefined))).toEqual(undefined); + }); +}); diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/result/result_metadata.ts b/x-pack/plugins/enterprise_search/public/applications/shared/result/result_metadata.ts new file mode 100644 index 0000000000000..e6f114e061da1 --- /dev/null +++ b/x-pack/plugins/enterprise_search/public/applications/shared/result/result_metadata.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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { SearchHit } from '@elastic/elasticsearch/lib/api/types'; + +import { MetaDataProps } from './types'; + +const TITLE_KEYS = ['title', 'name']; + +const isRecord = (source: unknown | undefined): source is Record => { + return typeof source === 'object' && source !== null; +}; + +function hasStringKey, K extends PropertyKey>( + source: T, + key: K +): source is T & Record { + return typeof source[key] === 'string'; +} + +export const resultTitle = (result: SearchHit): string | undefined => { + if (isRecord(result._source)) { + for (const key of TITLE_KEYS) { + if (hasStringKey(result._source, key)) { + return result._source[key]; + } + } + } + return undefined; +}; + +export const resultMetaData = (result: SearchHit): MetaDataProps => ({ + id: result._id, + title: resultTitle(result), +}); diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/result/types.ts b/x-pack/plugins/enterprise_search/public/applications/shared/result/types.ts index 458f34528b5d3..55112d828c177 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/result/types.ts +++ b/x-pack/plugins/enterprise_search/public/applications/shared/result/types.ts @@ -10,6 +10,7 @@ import { IconType } from '@elastic/eui'; export interface MetaDataProps { id: string; onDocumentDelete?: Function; + title?: string; } export interface ResultFieldProps { From ea929a0eb80cd1cdfbd0f0fe8234cef1152ca1f0 Mon Sep 17 00:00:00 2001 From: Nav <13634519+navarone-feekery@users.noreply.github.com> Date: Fri, 26 Aug 2022 16:27:46 +0100 Subject: [PATCH 23/28] [Enterprise Search] Add connector crawler check (#139298) * Differentiate crawler connectors from regular connectors * Return crawler type when fetching connector-crawler index --- .../enterprise_search/common/constants.ts | 2 + .../enterprise_search/common/types/indices.ts | 10 +- .../__mocks__/search_indices.mock.ts | 37 +++++++ .../__mocks__/view_index.mock.ts | 47 +++++++- .../utils/indices.test.ts | 100 +++++++++++++++++- .../utils/indices.ts | 13 ++- .../server/lib/indices/fetch_index.test.ts | 38 ++++++- .../server/lib/indices/fetch_index.ts | 5 +- 8 files changed, 236 insertions(+), 16 deletions(-) diff --git a/x-pack/plugins/enterprise_search/common/constants.ts b/x-pack/plugins/enterprise_search/common/constants.ts index d762fa4960a61..7fed08fc8df65 100644 --- a/x-pack/plugins/enterprise_search/common/constants.ts +++ b/x-pack/plugins/enterprise_search/common/constants.ts @@ -98,3 +98,5 @@ export const ENTERPRISE_SEARCH_ELASTICSEARCH_URL = '/app/enterprise_search/elast export const WORKPLACE_SEARCH_URL = '/app/enterprise_search/workplace_search'; export const ENTERPRISE_SEARCH_DOCUMENTS_DEFAULT_DOC_COUNT = 25; + +export const ENTERPRISE_SEARCH_CONNECTOR_CRAWLER_SERVICE_TYPE = 'elastic-crawler'; diff --git a/x-pack/plugins/enterprise_search/common/types/indices.ts b/x-pack/plugins/enterprise_search/common/types/indices.ts index 08f4125ef8efa..d047ec9ba36d7 100644 --- a/x-pack/plugins/enterprise_search/common/types/indices.ts +++ b/x-pack/plugins/enterprise_search/common/types/indices.ts @@ -36,13 +36,11 @@ export interface ElasticsearchIndex { export interface ConnectorIndex extends ElasticsearchIndex { connector: Connector; } - export interface CrawlerIndex extends ElasticsearchIndex { crawler: Crawler; + connector?: Connector; } -export interface ConnectorIndex extends ElasticsearchIndex { - connector: Connector; -} + export interface ElasticsearchIndexWithPrivileges extends ElasticsearchIndex { alias: boolean; privileges: { @@ -51,8 +49,4 @@ export interface ElasticsearchIndexWithPrivileges extends ElasticsearchIndex { }; } -export interface CrawlerIndex extends ElasticsearchIndex { - crawler: Crawler; -} - export type ElasticsearchIndexWithIngestion = ElasticsearchIndex | ConnectorIndex | CrawlerIndex; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/__mocks__/search_indices.mock.ts b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/__mocks__/search_indices.mock.ts index e39ff051f962b..2416113e9a56c 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/__mocks__/search_indices.mock.ts +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/__mocks__/search_indices.mock.ts @@ -5,6 +5,8 @@ * 2.0. */ +import { ENTERPRISE_SEARCH_CONNECTOR_CRAWLER_SERVICE_TYPE } from '../../../../common/constants'; + import { ConnectorStatus, SyncStatus } from '../../../../common/types/connectors'; import { ElasticsearchIndexWithIngestion } from '../../../../common/types/indices'; @@ -68,4 +70,39 @@ export const indices: ElasticsearchIndexWithIngestion[] = [ store: { size_in_bytes: '8024' }, }, }, + { + connector: { + api_key_id: null, + configuration: { foo: { label: 'bar', value: 'barbar' } }, + id: '4', + index_name: 'connector-crawler', + language: 'en', + last_seen: null, + last_sync_error: null, + last_sync_status: SyncStatus.COMPLETED, + last_synced: null, + name: 'connector-crawler', + scheduling: { + enabled: false, + interval: '', + }, + service_type: ENTERPRISE_SEARCH_CONNECTOR_CRAWLER_SERVICE_TYPE, + status: ConnectorStatus.CONFIGURED, + sync_now: false, + }, + count: 1, + crawler: { + id: '5', + index_name: 'crawler', + }, + hidden: false, + name: 'connector-crawler', + total: { + docs: { + count: 1, + deleted: 0, + }, + store: { size_in_bytes: '8024' }, + }, + }, ]; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/__mocks__/view_index.mock.ts b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/__mocks__/view_index.mock.ts index bc226baa77f7f..1e84497bac8a1 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/__mocks__/view_index.mock.ts +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/__mocks__/view_index.mock.ts @@ -5,6 +5,8 @@ * 2.0. */ +import { ENTERPRISE_SEARCH_CONNECTOR_CRAWLER_SERVICE_TYPE } from '../../../../common/constants'; + import { SyncStatus, ConnectorStatus } from '../../../../common/types/connectors'; import { @@ -83,5 +85,48 @@ export const crawlerIndex: CrawlerViewIndex = { store: { size_in_bytes: '8024' }, }, }; +export const connectorCrawlerIndex: CrawlerViewIndex = { + connector: { + api_key_id: null, + configuration: { foo: { label: 'bar', value: 'barbar' } }, + id: '4', + index_name: 'connector-crawler', + language: 'en', + last_seen: null, + last_sync_error: null, + last_sync_status: SyncStatus.COMPLETED, + last_synced: null, + name: 'connector-crawler', + scheduling: { + enabled: false, + interval: '', + }, + service_type: ENTERPRISE_SEARCH_CONNECTOR_CRAWLER_SERVICE_TYPE, + status: ConnectorStatus.CONFIGURED, + sync_now: false, + }, + count: 1, + crawler: { + id: '5', + index_name: 'crawler', + }, + hidden: false, + ingestionMethod: IngestionMethod.CRAWLER, + ingestionStatus: IngestionStatus.INCOMPLETE, + lastUpdated: null, + name: 'connector-crawler', + total: { + docs: { + count: 1, + deleted: 0, + }, + store: { size_in_bytes: '8024' }, + }, +}; -export const elasticsearchViewIndices = [apiIndex, connectorIndex, crawlerIndex]; +export const elasticsearchViewIndices = [ + apiIndex, + connectorIndex, + crawlerIndex, + connectorCrawlerIndex, +]; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/utils/indices.test.ts b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/utils/indices.test.ts index e02f67964b764..ce6e443a25025 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/utils/indices.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/utils/indices.test.ts @@ -5,7 +5,12 @@ * 2.0. */ -import { connectorIndex, crawlerIndex, apiIndex } from '../__mocks__/view_index.mock'; +import { + connectorIndex, + crawlerIndex, + connectorCrawlerIndex, + apiIndex, +} from '../__mocks__/view_index.mock'; import moment from 'moment'; @@ -17,6 +22,12 @@ import { getIngestionStatus, getLastUpdated, indexToViewIndex, + isConnectorIndex, + isCrawlerIndex, + isApiIndex, + isConnectorViewIndex, + isCrawlerViewIndex, + isApiViewIndex, } from './indices'; describe('Indices util functions', () => { @@ -27,6 +38,9 @@ describe('Indices util functions', () => { it('should return correct ingestion method for crawler', () => { expect(getIngestionMethod(crawlerIndex)).toEqual(IngestionMethod.CRAWLER); }); + it('should return correct ingestion method for connector-crawler', () => { + expect(getIngestionMethod(connectorCrawlerIndex)).toEqual(IngestionMethod.CRAWLER); + }); it('should return correct ingestion method for API', () => { expect(getIngestionMethod(apiIndex)).toEqual(IngestionMethod.API); }); @@ -116,4 +130,88 @@ describe('Indices util functions', () => { }); }); }); + describe('isConnectorIndex', () => { + it('should return true for connector indices', () => { + expect(isConnectorIndex(connectorIndex)).toEqual(true); + }); + it('should return false for connector-crawler indices', () => { + expect(isConnectorIndex(connectorCrawlerIndex)).toEqual(false); + }); + it('should return false for crawler indices', () => { + expect(isConnectorIndex(crawlerIndex)).toEqual(false); + }); + it('should return false for API indices', () => { + expect(isConnectorIndex(apiIndex)).toEqual(false); + }); + }); + describe('isCrawlerIndex', () => { + it('should return true for crawler indices', () => { + expect(isCrawlerIndex(crawlerIndex)).toEqual(true); + }); + it('should return true for connector-crawler indices', () => { + expect(isCrawlerIndex(connectorCrawlerIndex)).toEqual(true); + }); + it('should return false for connector and API indices', () => { + expect(isCrawlerIndex(connectorIndex)).toEqual(false); + }); + it('should return false for API indices', () => { + expect(isCrawlerIndex(apiIndex)).toEqual(false); + }); + }); + describe('isApiIndex', () => { + it('should return true for API indices', () => { + expect(isApiIndex(apiIndex)).toEqual(true); + }); + it('should return false for crawler indices', () => { + expect(isApiIndex(crawlerIndex)).toEqual(false); + }); + it('should return false for connector-crawler indices', () => { + expect(isApiIndex(connectorCrawlerIndex)).toEqual(false); + }); + it('should return false for connector and API indices', () => { + expect(isApiIndex(connectorIndex)).toEqual(false); + }); + }); + describe('isConnectorViewIndex', () => { + it('should return true for connector indices', () => { + expect(isConnectorViewIndex(connectorIndex)).toEqual(true); + }); + it('should return false for connector-crawler indices', () => { + expect(isConnectorViewIndex(connectorCrawlerIndex)).toEqual(false); + }); + it('should return false for crawler indices', () => { + expect(isConnectorViewIndex(crawlerIndex)).toEqual(false); + }); + it('should return false for API indices', () => { + expect(isConnectorViewIndex(apiIndex)).toEqual(false); + }); + }); + describe('isCrawlerViewIndex', () => { + it('should return true for crawler indices', () => { + expect(isCrawlerViewIndex(crawlerIndex)).toEqual(true); + }); + it('should return true for connector-crawler indices', () => { + expect(isCrawlerViewIndex(connectorCrawlerIndex)).toEqual(true); + }); + it('should return false for connector and API indices', () => { + expect(isCrawlerViewIndex(connectorIndex)).toEqual(false); + }); + it('should return false for API indices', () => { + expect(isCrawlerViewIndex(apiIndex)).toEqual(false); + }); + }); + describe('isApiViewIndex', () => { + it('should return true for API indices', () => { + expect(isApiViewIndex(apiIndex)).toEqual(true); + }); + it('should return false for crawler indices', () => { + expect(isApiViewIndex(crawlerIndex)).toEqual(false); + }); + it('should return false for connector-crawler indices', () => { + expect(isApiViewIndex(connectorCrawlerIndex)).toEqual(false); + }); + it('should return false for connector and API indices', () => { + expect(isApiViewIndex(connectorIndex)).toEqual(false); + }); + }); }); diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/utils/indices.ts b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/utils/indices.ts index 30bf0fc2b5d51..9a17f7fe84f4d 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/utils/indices.ts +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/utils/indices.ts @@ -9,6 +9,7 @@ import moment from 'moment'; import { i18n } from '@kbn/i18n'; +import { ENTERPRISE_SEARCH_CONNECTOR_CRAWLER_SERVICE_TYPE } from '../../../../common/constants'; import { SyncStatus, ConnectorStatus } from '../../../../common/types/connectors'; import { ConnectorIndex, @@ -28,7 +29,11 @@ import { export function isConnectorIndex( index: ElasticsearchIndexWithIngestion | undefined ): index is ConnectorIndex { - return !!(index as ConnectorIndex)?.connector; + const connectorIndex = index as ConnectorIndex; + return ( + !!connectorIndex?.connector && + connectorIndex.connector.service_type !== ENTERPRISE_SEARCH_CONNECTOR_CRAWLER_SERVICE_TYPE + ); } export function isCrawlerIndex( @@ -45,7 +50,11 @@ export function isApiIndex(index: ElasticsearchIndexWithIngestion | undefined): } export function isConnectorViewIndex(index: ElasticsearchViewIndex): index is ConnectorViewIndex { - return !!(index as ConnectorViewIndex)?.connector; + const connectorViewIndex = index as ConnectorViewIndex; + return ( + !!connectorViewIndex?.connector && + connectorViewIndex.connector.service_type !== ENTERPRISE_SEARCH_CONNECTOR_CRAWLER_SERVICE_TYPE + ); } export function isCrawlerViewIndex(index: ElasticsearchViewIndex): index is CrawlerViewIndex { diff --git a/x-pack/plugins/enterprise_search/server/lib/indices/fetch_index.test.ts b/x-pack/plugins/enterprise_search/server/lib/indices/fetch_index.test.ts index 49384f564a988..c9b4979d79a84 100644 --- a/x-pack/plugins/enterprise_search/server/lib/indices/fetch_index.test.ts +++ b/x-pack/plugins/enterprise_search/server/lib/indices/fetch_index.test.ts @@ -8,6 +8,8 @@ import { ByteSizeValue } from '@kbn/config-schema'; import { IScopedClusterClient } from '@kbn/core/server'; +import { ENTERPRISE_SEARCH_CONNECTOR_CRAWLER_SERVICE_TYPE } from '../../../common/constants'; + import { fetchConnectorByIndexName } from '../connectors/fetch_connectors'; import { fetchCrawlerByIndexName } from '../crawler/fetch_crawlers'; @@ -103,13 +105,16 @@ describe('fetchIndex lib function', () => { }) ); (fetchConnectorByIndexName as jest.Mock).mockImplementationOnce(() => - Promise.resolve({ doc: 'doc' }) + Promise.resolve({ + doc: 'doc', + service_type: 'some-service-type', + }) ); mockClient.asCurrentUser.indices.stats.mockImplementation(() => Promise.resolve(statsResponse)); await expect( fetchIndex(mockClient as unknown as IScopedClusterClient, 'index_name') - ).resolves.toEqual({ ...result, connector: { doc: 'doc' } }); + ).resolves.toEqual({ ...result, connector: { doc: 'doc', service_type: 'some-service-type' } }); }); it('should return data and stats for index and crawler if crawler is present', async () => { @@ -137,6 +142,35 @@ describe('fetchIndex lib function', () => { }, }); }); + + it('should return data and stats for index and crawler if a crawler registered as a connector is present', async () => { + mockClient.asCurrentUser.indices.get.mockImplementation(() => + Promise.resolve({ + index_name: { aliases: [], data: 'full index' }, + }) + ); + (fetchCrawlerByIndexName as jest.Mock).mockImplementationOnce(() => + Promise.resolve({ + id: '1234', + }) + ); + (fetchConnectorByIndexName as jest.Mock).mockImplementationOnce(() => + Promise.resolve({ + doc: 'doc', + service_type: ENTERPRISE_SEARCH_CONNECTOR_CRAWLER_SERVICE_TYPE, + }) + ); + mockClient.asCurrentUser.indices.stats.mockImplementation(() => Promise.resolve(statsResponse)); + + await expect( + fetchIndex(mockClient as unknown as IScopedClusterClient, 'index_name') + ).resolves.toEqual({ + ...result, + connector: { doc: 'doc', service_type: ENTERPRISE_SEARCH_CONNECTOR_CRAWLER_SERVICE_TYPE }, + crawler: { id: '1234' }, + }); + }); + it('should throw a 404 error if the index cannot be fonud', async () => { mockClient.asCurrentUser.indices.get.mockImplementation(() => Promise.resolve({})); (fetchConnectorByIndexName as jest.Mock).mockImplementationOnce(() => diff --git a/x-pack/plugins/enterprise_search/server/lib/indices/fetch_index.ts b/x-pack/plugins/enterprise_search/server/lib/indices/fetch_index.ts index 1505d4501ac12..2414e19de1183 100644 --- a/x-pack/plugins/enterprise_search/server/lib/indices/fetch_index.ts +++ b/x-pack/plugins/enterprise_search/server/lib/indices/fetch_index.ts @@ -7,6 +7,7 @@ import { IScopedClusterClient } from '@kbn/core/server'; +import { ENTERPRISE_SEARCH_CONNECTOR_CRAWLER_SERVICE_TYPE } from '../../../common/constants'; import { ElasticsearchIndexWithIngestion } from '../../../common/types/indices'; import { fetchConnectorByIndexName } from '../connectors/fetch_connectors'; import { fetchCrawlerByIndexName } from '../crawler/fetch_crawlers'; @@ -33,7 +34,7 @@ export const fetchIndex = async ( }; const connector = await fetchConnectorByIndexName(client, index); - if (connector) { + if (connector && connector.service_type !== ENTERPRISE_SEARCH_CONNECTOR_CRAWLER_SERVICE_TYPE) { return { ...indexResult, connector, @@ -42,7 +43,7 @@ export const fetchIndex = async ( const crawler = await fetchCrawlerByIndexName(client, index); if (crawler) { - return { ...indexResult, crawler }; + return { ...indexResult, connector, crawler }; } return indexResult; From 0b8e2700fd6b26584ba1fd466c65b3ed39c3af00 Mon Sep 17 00:00:00 2001 From: Candace Park <56409205+parkiino@users.noreply.github.com> Date: Fri, 26 Aug 2022 11:55:13 -0400 Subject: [PATCH 24/28] [Security Solution][Responder] Improved UI for responder capabilities check (#138662) --- .../common/endpoint/constants.ts | 17 ++- .../use_does_endpoint_support_responder.ts | 17 --- .../responder_context_menu_item.tsx | 11 +- .../console/components/bad_argument.tsx | 42 +++---- .../console/components/command_list.tsx | 18 ++- .../handle_execute_command.test.tsx | 4 +- .../handle_execute_command.tsx | 3 +- .../console/components/validation_error.tsx | 65 +++++++++++ .../management/components/console/types.ts | 8 +- ...point_response_actions_console_commands.ts | 106 +++++++++++++++--- .../get_command_about_info.tsx | 39 +++++++ .../get_processes_action.test.tsx | 22 +++- .../isolate_action.test.tsx | 22 +++- .../kill_process_action.test.tsx | 22 +++- .../release_action.test.tsx | 22 +++- .../suspend_process_action.test.tsx | 22 +++- .../use_with_show_endpoint_responder.tsx | 5 +- .../view/hooks/use_endpoint_action_items.tsx | 8 -- .../pages/endpoint_hosts/view/index.test.tsx | 13 --- .../pages/endpoint_hosts/view/index.tsx | 2 +- 20 files changed, 353 insertions(+), 115 deletions(-) delete mode 100644 x-pack/plugins/security_solution/public/common/hooks/endpoint/use_does_endpoint_support_responder.ts create mode 100644 x-pack/plugins/security_solution/public/management/components/console/components/validation_error.tsx create mode 100644 x-pack/plugins/security_solution/public/management/components/endpoint_responder/get_command_about_info.tsx diff --git a/x-pack/plugins/security_solution/common/endpoint/constants.ts b/x-pack/plugins/security_solution/common/endpoint/constants.ts index 4b5adbbb8e216..8f0bd47c204cb 100644 --- a/x-pack/plugins/security_solution/common/endpoint/constants.ts +++ b/x-pack/plugins/security_solution/common/endpoint/constants.ts @@ -75,11 +75,24 @@ export const ENDPOINT_DEFAULT_PAGE = 0; export const ENDPOINT_DEFAULT_PAGE_SIZE = 10; /** - * The list of capabilities, reported by the endpoint in the metadata document, that are - * needed in order for the Responder UI to be accessible + * The list of possible capabilities, reported by the endpoint in the metadata document */ export const RESPONDER_CAPABILITIES = [ + 'isolation', 'kill_process', 'suspend_process', 'running_processes', ] as const; + +export type ResponderCapabilities = typeof RESPONDER_CAPABILITIES[number]; + +/** The list of possible responder command names **/ +export const RESPONDER_COMMANDS = [ + 'isolate', + 'release', + 'kill-process', + 'suspend-process', + 'processes', +] as const; + +export type ResponderCommands = typeof RESPONDER_COMMANDS[number]; diff --git a/x-pack/plugins/security_solution/public/common/hooks/endpoint/use_does_endpoint_support_responder.ts b/x-pack/plugins/security_solution/public/common/hooks/endpoint/use_does_endpoint_support_responder.ts deleted file mode 100644 index c7c2979186f29..0000000000000 --- a/x-pack/plugins/security_solution/public/common/hooks/endpoint/use_does_endpoint_support_responder.ts +++ /dev/null @@ -1,17 +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 { RESPONDER_CAPABILITIES } from '../../../../common/endpoint/constants'; -import type { HostMetadata, MaybeImmutable } from '../../../../common/endpoint/types'; - -export const useDoesEndpointSupportResponder = ( - endpointMetadata: MaybeImmutable | undefined -): boolean => { - return RESPONDER_CAPABILITIES.every((capability) => - endpointMetadata?.Endpoint.capabilities?.includes(capability) - ); -}; diff --git a/x-pack/plugins/security_solution/public/detections/components/endpoint_responder/responder_context_menu_item.tsx b/x-pack/plugins/security_solution/public/detections/components/endpoint_responder/responder_context_menu_item.tsx index ccab3a650b605..4f536f9372e28 100644 --- a/x-pack/plugins/security_solution/public/detections/components/endpoint_responder/responder_context_menu_item.tsx +++ b/x-pack/plugins/security_solution/public/detections/components/endpoint_responder/responder_context_menu_item.tsx @@ -12,8 +12,6 @@ import { FormattedMessage } from '@kbn/i18n-react'; import { i18n } from '@kbn/i18n'; import { useGetEndpointDetails, useWithShowEndpointResponder } from '../../../management/hooks'; import { HostStatus } from '../../../../common/endpoint/types'; -import { useDoesEndpointSupportResponder } from '../../../common/hooks/endpoint/use_does_endpoint_support_responder'; -import { UPGRADE_ENDPOINT_FOR_RESPONDER } from '../../../common/translations'; export const NOT_FROM_ENDPOINT_HOST_TOOLTIP = i18n.translate( 'xpack.securitySolution.endpoint.detections.takeAction.responseActionConsole.notSupportedTooltip', @@ -49,18 +47,11 @@ export const ResponderContextMenuItem = memo( error, } = useGetEndpointDetails(endpointId, { enabled: Boolean(endpointId) }); - const isResponderCapabilitiesEnabled = useDoesEndpointSupportResponder( - endpointHostInfo?.metadata - ); const [isDisabled, tooltip]: [disabled: boolean, tooltip: ReactNode] = useMemo(() => { if (!endpointId) { return [true, NOT_FROM_ENDPOINT_HOST_TOOLTIP]; } - if (endpointHostInfo && !isResponderCapabilitiesEnabled) { - return [true, UPGRADE_ENDPOINT_FOR_RESPONDER]; - } - // Still loading Endpoint host info if (isFetching) { return [true, LOADING_ENDPOINT_DATA_TOOLTIP]; @@ -82,7 +73,7 @@ export const ResponderContextMenuItem = memo( } return [false, undefined]; - }, [endpointHostInfo, endpointId, error, isFetching, isResponderCapabilitiesEnabled]); + }, [endpointHostInfo, endpointId, error, isFetching]); const handleResponseActionsClick = useCallback(() => { if (endpointHostInfo) showEndpointResponseActionsConsole(endpointHostInfo.metadata); diff --git a/x-pack/plugins/security_solution/public/management/components/console/components/bad_argument.tsx b/x-pack/plugins/security_solution/public/management/components/console/components/bad_argument.tsx index b6085ed5356c0..32d66bada9a9d 100644 --- a/x-pack/plugins/security_solution/public/management/components/console/components/bad_argument.tsx +++ b/x-pack/plugins/security_solution/public/management/components/console/components/bad_argument.tsx @@ -40,30 +40,24 @@ export const BadArgument = memo - <> -
{store.errorMessage}
- -
- -
-
- - - {`${command.commandDefinition.name} --help`} - ), - }} - /> - -
- +
{store.errorMessage}
+ + + + + {`${command.commandDefinition.name} --help`} + ), + }} + /> + ); } diff --git a/x-pack/plugins/security_solution/public/management/components/console/components/command_list.tsx b/x-pack/plugins/security_solution/public/management/components/console/components/command_list.tsx index d23b051e1c3b0..d1660b1ffe950 100644 --- a/x-pack/plugins/security_solution/public/management/components/console/components/command_list.tsx +++ b/x-pack/plugins/security_solution/public/management/components/console/components/command_list.tsx @@ -155,7 +155,7 @@ export const CommandList = memo(({ commands, display = 'defaul ( commandsByGroup: CommandDefinition[] ): Array<{ - [key: string]: { name: string; about: React.ElementType | string }; + [key: string]: { name: string; about: React.ReactNode | string }; }> => { if (commandsByGroup[0].helpGroupLabel === HELP_GROUPS.supporting.label) { return [...COMMON_ARGS, ...commandsByGroup].map((command) => ({ @@ -201,15 +201,23 @@ export const CommandList = memo(({ commands, display = 'defaul command.RenderComponent && ( diff --git a/x-pack/plugins/security_solution/public/management/components/console/components/console_state/state_update_handlers/handle_execute_command.test.tsx b/x-pack/plugins/security_solution/public/management/components/console/components/console_state/state_update_handlers/handle_execute_command.test.tsx index 10e1ac88af531..a29564214cca0 100644 --- a/x-pack/plugins/security_solution/public/management/components/console/components/console_state/state_update_handlers/handle_execute_command.test.tsx +++ b/x-pack/plugins/security_solution/public/management/components/console/components/console_state/state_update_handlers/handle_execute_command.test.tsx @@ -226,7 +226,7 @@ describe('When a Console command is entered by the user', () => { const cmd1Definition = commands.find((command) => command.name === 'cmd1'); if (!cmd1Definition) { - throw new Error('cmd1 defintion not fount'); + throw new Error('cmd1 defintion not found'); } cmd1Definition.validate = () => 'command is invalid'; @@ -235,7 +235,7 @@ describe('When a Console command is entered by the user', () => { enterCommand('cmd1'); await waitFor(() => { - expect(renderResult.getByTestId('test-badArgument-message').textContent).toEqual( + expect(renderResult.getByTestId('test-validationError-message').textContent).toEqual( 'command is invalid' ); }); diff --git a/x-pack/plugins/security_solution/public/management/components/console/components/console_state/state_update_handlers/handle_execute_command.tsx b/x-pack/plugins/security_solution/public/management/components/console/components/console_state/state_update_handlers/handle_execute_command.tsx index 3d727b2bcdace..7c2a9985cb741 100644 --- a/x-pack/plugins/security_solution/public/management/components/console/components/console_state/state_update_handlers/handle_execute_command.tsx +++ b/x-pack/plugins/security_solution/public/management/components/console/components/console_state/state_update_handlers/handle_execute_command.tsx @@ -25,6 +25,7 @@ import type { ParsedCommandInterface } from '../../../service/parsed_command_inp import { parseCommandInput } from '../../../service/parsed_command_input'; import { UnknownCommand } from '../../unknown_comand'; import { BadArgument } from '../../bad_argument'; +import { ValidationError } from '../../validation_error'; import type { Command, CommandDefinition, CommandExecutionComponentProps } from '../../../types'; const toCliArgumentOption = (argName: string) => `--${argName}`; @@ -449,7 +450,7 @@ export const handleExecuteCommand: ConsoleStoreReducer< return updateStateWithNewCommandHistoryItem( state, createCommandHistoryEntry( - cloneCommandDefinitionWithNewRenderComponent(command, BadArgument), + cloneCommandDefinitionWithNewRenderComponent(command, ValidationError), createCommandExecutionState({ errorMessage: validationResult, }), diff --git a/x-pack/plugins/security_solution/public/management/components/console/components/validation_error.tsx b/x-pack/plugins/security_solution/public/management/components/console/components/validation_error.tsx new file mode 100644 index 0000000000000..2b372fd6c8f55 --- /dev/null +++ b/x-pack/plugins/security_solution/public/management/components/console/components/validation_error.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 type { ReactNode } from 'react'; +import React, { memo, useEffect } from 'react'; +import { FormattedMessage } from '@kbn/i18n-react'; +import { EuiSpacer } from '@elastic/eui'; +import { UnsupportedMessageCallout } from './unsupported_message_callout'; +import type { CommandExecutionComponentProps } from '../types'; +import { CommandInputUsage } from './command_usage'; +import { useDataTestSubj } from '../hooks/state_selectors/use_data_test_subj'; +import { useTestIdGenerator } from '../../../hooks/use_test_id_generator'; +import { ConsoleCodeBlock } from './console_code_block'; + +/** + * Shows a validation error. The error message needs to be defined via the Command defintion's + * `validate` + */ +export const ValidationError = memo< + CommandExecutionComponentProps<{}, { errorMessage: ReactNode }> +>(({ command, setStatus, store }) => { + const getTestId = useTestIdGenerator(useDataTestSubj()); + + useEffect(() => { + setStatus('success'); + }, [setStatus]); + + return ( + + + + } + data-test-subj={getTestId('validationError')} + > +
{store.errorMessage}
+ + + + + {`${command.commandDefinition.name} --help`} + ), + }} + /> + +
+ ); +}); +ValidationError.displayName = 'ValidationError'; diff --git a/x-pack/plugins/security_solution/public/management/components/console/types.ts b/x-pack/plugins/security_solution/public/management/components/console/types.ts index f5ee45733f860..7275922663be6 100644 --- a/x-pack/plugins/security_solution/public/management/components/console/types.ts +++ b/x-pack/plugins/security_solution/public/management/components/console/types.ts @@ -7,7 +7,7 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ -import type { ComponentType } from 'react'; +import type { ComponentType, ReactNode } from 'react'; import type { CommonProps } from '@elastic/eui'; import type { CommandExecutionResultComponent } from './components/command_execution_result'; import type { CommandExecutionState } from './components/console_state/types'; @@ -35,7 +35,7 @@ export interface CommandArgs { export interface CommandDefinition { name: string; - about: ComponentType | string; + about: ReactNode; /** * The Component that will be used to render the Command */ @@ -53,6 +53,10 @@ export interface CommandDefinition { * the console's built in output. */ HelpComponent?: CommandExecutionComponent; + /** + * If defined, the button to add to the text bar will be disabled. + */ + helpDisabled?: boolean; /** * A store for any data needed when the command is executed. * The entire `CommandDefinition` is passed along to the component diff --git a/x-pack/plugins/security_solution/public/management/components/endpoint_responder/endpoint_response_actions_console_commands.ts b/x-pack/plugins/security_solution/public/management/components/endpoint_responder/endpoint_response_actions_console_commands.ts index 399c4add348ff..0891f2d3a8e62 100644 --- a/x-pack/plugins/security_solution/public/management/components/endpoint_responder/endpoint_response_actions_console_commands.ts +++ b/x-pack/plugins/security_solution/public/management/components/endpoint_responder/endpoint_response_actions_console_commands.ts @@ -6,7 +6,7 @@ */ import { i18n } from '@kbn/i18n'; -import type { CommandDefinition } from '../console'; +import type { Command, CommandDefinition } from '../console'; import { IsolateActionResult } from './isolate_action'; import { ReleaseActionResult } from './release_action'; import { KillProcessActionResult } from './kill_process_action'; @@ -14,6 +14,13 @@ import { SuspendProcessActionResult } from './suspend_process_action'; import { EndpointStatusActionResult } from './status_action'; import { GetProcessesActionResult } from './get_processes_action'; import type { ParsedArgData } from '../console/service/parsed_command_input'; +import type { ImmutableArray } from '../../../../common/endpoint/types'; +import { UPGRADE_ENDPOINT_FOR_RESPONDER } from '../../../common/translations'; +import type { + ResponderCapabilities, + ResponderCommands, +} from '../../../../common/endpoint/constants'; +import { getCommandAboutInfo } from './get_command_about_info'; const emptyArgumentValidator = (argData: ParsedArgData): true | string => { if (argData?.length > 0 && argData[0]?.trim().length > 0) { @@ -38,6 +45,27 @@ const pidValidator = (argData: ParsedArgData): true | string => { } }; +const commandToCapabilitiesMap = new Map([ + ['isolate', 'isolation'], + ['release', 'isolation'], + ['kill-process', 'kill_process'], + ['suspend-process', 'suspend_process'], + ['processes', 'running_processes'], +]); + +const capabilitiesValidator = (command: Command): true | string => { + const endpointCapabilities: ResponderCapabilities[] = command.commandDefinition.meta.capabilities; + const responderCapability = commandToCapabilitiesMap.get( + command.commandDefinition.name as ResponderCommands + ); + if (responderCapability) { + if (endpointCapabilities.includes(responderCapability)) { + return true; + } + } + return UPGRADE_ENDPOINT_FOR_RESPONDER; +}; + const HELP_GROUPS = Object.freeze({ responseActions: { position: 0, @@ -62,21 +90,37 @@ const COMMENT_ARG_ABOUT = i18n.translate( { defaultMessage: 'A comment to go along with the action' } ); -export const getEndpointResponseActionsConsoleCommands = ( - endpointAgentId: string -): CommandDefinition[] => { +export const getEndpointResponseActionsConsoleCommands = ({ + endpointAgentId, + endpointCapabilities, +}: { + endpointAgentId: string; + endpointCapabilities: ImmutableArray; +}): CommandDefinition[] => { + const doesEndpointSupportCommand = (commandName: ResponderCommands) => { + const responderCapability = commandToCapabilitiesMap.get(commandName); + if (responderCapability) { + return endpointCapabilities.includes(responderCapability); + } + return false; + }; return [ { name: 'isolate', - about: i18n.translate('xpack.securitySolution.endpointConsoleCommands.isolate.about', { - defaultMessage: 'Isolate the host', + about: getCommandAboutInfo({ + aboutInfo: i18n.translate('xpack.securitySolution.endpointConsoleCommands.isolate.about', { + defaultMessage: 'Isolate the host', + }), + isSupported: doesEndpointSupportCommand('isolate'), }), RenderComponent: IsolateActionResult, meta: { endpointId: endpointAgentId, + capabilities: endpointCapabilities, }, exampleUsage: 'isolate --comment "isolate this host"', exampleInstruction: ENTER_OR_ADD_COMMENT_ARG_INSTRUCTION, + validate: capabilitiesValidator, args: { comment: { required: false, @@ -87,18 +131,24 @@ export const getEndpointResponseActionsConsoleCommands = ( helpGroupLabel: HELP_GROUPS.responseActions.label, helpGroupPosition: HELP_GROUPS.responseActions.position, helpCommandPosition: 0, + helpDisabled: doesEndpointSupportCommand('isolate') === false, }, { name: 'release', - about: i18n.translate('xpack.securitySolution.endpointConsoleCommands.release.about', { - defaultMessage: 'Release the host', + about: getCommandAboutInfo({ + aboutInfo: i18n.translate('xpack.securitySolution.endpointConsoleCommands.release.about', { + defaultMessage: 'Release the host', + }), + isSupported: doesEndpointSupportCommand('release'), }), RenderComponent: ReleaseActionResult, meta: { endpointId: endpointAgentId, + capabilities: endpointCapabilities, }, exampleUsage: 'release --comment "release this host"', exampleInstruction: ENTER_OR_ADD_COMMENT_ARG_INSTRUCTION, + validate: capabilitiesValidator, args: { comment: { required: false, @@ -109,18 +159,27 @@ export const getEndpointResponseActionsConsoleCommands = ( helpGroupLabel: HELP_GROUPS.responseActions.label, helpGroupPosition: HELP_GROUPS.responseActions.position, helpCommandPosition: 1, + helpDisabled: doesEndpointSupportCommand('release') === false, }, { name: 'kill-process', - about: i18n.translate('xpack.securitySolution.endpointConsoleCommands.killProcess.about', { - defaultMessage: 'Kill/terminate a process', + about: getCommandAboutInfo({ + aboutInfo: i18n.translate( + 'xpack.securitySolution.endpointConsoleCommands.killProcess.about', + { + defaultMessage: 'Kill/terminate a process', + } + ), + isSupported: doesEndpointSupportCommand('kill-process'), }), RenderComponent: KillProcessActionResult, meta: { endpointId: endpointAgentId, + capabilities: endpointCapabilities, }, exampleUsage: 'kill-process --pid 123 --comment "kill this process"', exampleInstruction: ENTER_PID_OR_ENTITY_ID_INSTRUCTION, + validate: capabilitiesValidator, mustHaveArgs: true, args: { comment: { @@ -153,18 +212,27 @@ export const getEndpointResponseActionsConsoleCommands = ( helpGroupLabel: HELP_GROUPS.responseActions.label, helpGroupPosition: HELP_GROUPS.responseActions.position, helpCommandPosition: 4, + helpDisabled: doesEndpointSupportCommand('kill-process') === false, }, { name: 'suspend-process', - about: i18n.translate('xpack.securitySolution.endpointConsoleCommands.suspendProcess.about', { - defaultMessage: 'Temporarily suspend a process', + about: getCommandAboutInfo({ + aboutInfo: i18n.translate( + 'xpack.securitySolution.endpointConsoleCommands.suspendProcess.about', + { + defaultMessage: 'Temporarily suspend a process', + } + ), + isSupported: doesEndpointSupportCommand('suspend-process'), }), RenderComponent: SuspendProcessActionResult, meta: { endpointId: endpointAgentId, + capabilities: endpointCapabilities, }, exampleUsage: 'suspend-process --pid 123 --comment "suspend this process"', exampleInstruction: ENTER_PID_OR_ENTITY_ID_INSTRUCTION, + validate: capabilitiesValidator, mustHaveArgs: true, args: { comment: { @@ -200,6 +268,7 @@ export const getEndpointResponseActionsConsoleCommands = ( helpGroupLabel: HELP_GROUPS.responseActions.label, helpGroupPosition: HELP_GROUPS.responseActions.position, helpCommandPosition: 5, + helpDisabled: doesEndpointSupportCommand('suspend-process') === false, }, { name: 'status', @@ -216,15 +285,23 @@ export const getEndpointResponseActionsConsoleCommands = ( }, { name: 'processes', - about: i18n.translate('xpack.securitySolution.endpointConsoleCommands.processes.about', { - defaultMessage: 'Show all running processes', + about: getCommandAboutInfo({ + aboutInfo: i18n.translate( + 'xpack.securitySolution.endpointConsoleCommands.processes.about', + { + defaultMessage: 'Show all running processes', + } + ), + isSupported: doesEndpointSupportCommand('processes'), }), RenderComponent: GetProcessesActionResult, meta: { endpointId: endpointAgentId, + capabilities: endpointCapabilities, }, exampleUsage: 'processes --comment "get the processes"', exampleInstruction: ENTER_OR_ADD_COMMENT_ARG_INSTRUCTION, + validate: capabilitiesValidator, args: { comment: { required: false, @@ -235,6 +312,7 @@ export const getEndpointResponseActionsConsoleCommands = ( helpGroupLabel: HELP_GROUPS.responseActions.label, helpGroupPosition: HELP_GROUPS.responseActions.position, helpCommandPosition: 3, + helpDisabled: doesEndpointSupportCommand('processes') === false, }, ]; }; diff --git a/x-pack/plugins/security_solution/public/management/components/endpoint_responder/get_command_about_info.tsx b/x-pack/plugins/security_solution/public/management/components/endpoint_responder/get_command_about_info.tsx new file mode 100644 index 0000000000000..3a973defa2d0c --- /dev/null +++ b/x-pack/plugins/security_solution/public/management/components/endpoint_responder/get_command_about_info.tsx @@ -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; 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 { EuiIconTip } from '@elastic/eui'; + +const UNSUPPORTED_COMMAND_INFO = i18n.translate( + 'xpack.securitySolution.endpointConsoleCommands.suspendProcess.unsupportedCommandInfo', + { + defaultMessage: + 'This version of the Endpoint does not support this command. Upgrade your Agent in Fleet to use the latest response actions.', + } +); + +const DisabledTooltip = React.memo(() => { + return ; +}); +DisabledTooltip.displayName = 'DisabledTooltip'; + +export const getCommandAboutInfo = ({ + aboutInfo, + isSupported, +}: { + aboutInfo: string; + isSupported: boolean; +}) => { + return isSupported ? ( + aboutInfo + ) : ( + <> + {aboutInfo} + + ); +}; diff --git a/x-pack/plugins/security_solution/public/management/components/endpoint_responder/get_processes_action.test.tsx b/x-pack/plugins/security_solution/public/management/components/endpoint_responder/get_processes_action.test.tsx index 8977b1fb425a4..bb065a9392d43 100644 --- a/x-pack/plugins/security_solution/public/management/components/endpoint_responder/get_processes_action.test.tsx +++ b/x-pack/plugins/security_solution/public/management/components/endpoint_responder/get_processes_action.test.tsx @@ -16,9 +16,13 @@ import { getEndpointResponseActionsConsoleCommands } from './endpoint_response_a import { responseActionsHttpMocks } from '../../mocks/response_actions_http_mocks'; import { enterConsoleCommand } from '../console/mocks'; import { waitFor } from '@testing-library/react'; +import type { ResponderCapabilities } from '../../../../common/endpoint/constants'; +import { RESPONDER_CAPABILITIES } from '../../../../common/endpoint/constants'; describe('When using processes action from response actions console', () => { - let render: () => Promise>; + let render: ( + capabilities?: ResponderCapabilities[] + ) => Promise>; let renderResult: ReturnType; let apiMocks: ReturnType; let consoleManagerMockAccess: ReturnType< @@ -30,14 +34,17 @@ describe('When using processes action from response actions console', () => { apiMocks = responseActionsHttpMocks(mockedContext.coreStart.http); - render = async () => { + render = async (capabilities: ResponderCapabilities[] = [...RESPONDER_CAPABILITIES]) => { renderResult = mockedContext.render( { return { consoleProps: { 'data-test-subj': 'test', - commands: getEndpointResponseActionsConsoleCommands('a.b.c'), + commands: getEndpointResponseActionsConsoleCommands({ + endpointAgentId: 'a.b.c', + endpointCapabilities: [...capabilities], + }), }, }; }} @@ -53,6 +60,15 @@ describe('When using processes action from response actions console', () => { }; }); + it('should show an error if the `running_processes` capability is not present in the endpoint', async () => { + await render([]); + enterConsoleCommand(renderResult, 'processes'); + + expect(renderResult.getByTestId('test-validationError-message').textContent).toEqual( + 'The current version of the Agent does not support this feature. Upgrade your Agent through Fleet to use this feature and new response actions such as killing and suspending processes.' + ); + }); + it('should call `running-procs` api when command is entered', async () => { await render(); enterConsoleCommand(renderResult, 'processes'); diff --git a/x-pack/plugins/security_solution/public/management/components/endpoint_responder/isolate_action.test.tsx b/x-pack/plugins/security_solution/public/management/components/endpoint_responder/isolate_action.test.tsx index 7f84082c64622..32a067eed085b 100644 --- a/x-pack/plugins/security_solution/public/management/components/endpoint_responder/isolate_action.test.tsx +++ b/x-pack/plugins/security_solution/public/management/components/endpoint_responder/isolate_action.test.tsx @@ -17,9 +17,13 @@ import { responseActionsHttpMocks } from '../../mocks/response_actions_http_mock import { enterConsoleCommand } from '../console/mocks'; import { waitFor } from '@testing-library/react'; import { getDeferred } from '../mocks'; +import type { ResponderCapabilities } from '../../../../common/endpoint/constants'; +import { RESPONDER_CAPABILITIES } from '../../../../common/endpoint/constants'; describe('When using isolate action from response actions console', () => { - let render: () => Promise>; + let render: ( + capabilities?: ResponderCapabilities[] + ) => Promise>; let renderResult: ReturnType; let apiMocks: ReturnType; let consoleManagerMockAccess: ReturnType< @@ -31,14 +35,17 @@ describe('When using isolate action from response actions console', () => { apiMocks = responseActionsHttpMocks(mockedContext.coreStart.http); - render = async () => { + render = async (capabilities: ResponderCapabilities[] = [...RESPONDER_CAPABILITIES]) => { renderResult = mockedContext.render( { return { consoleProps: { 'data-test-subj': 'test', - commands: getEndpointResponseActionsConsoleCommands('a.b.c'), + commands: getEndpointResponseActionsConsoleCommands({ + endpointAgentId: 'a.b.c', + endpointCapabilities: [...capabilities], + }), }, }; }} @@ -54,6 +61,15 @@ describe('When using isolate action from response actions console', () => { }; }); + it('should show an error if the `isolation` capability is not present in the endpoint', async () => { + await render([]); + enterConsoleCommand(renderResult, 'isolate'); + + expect(renderResult.getByTestId('test-validationError-message').textContent).toEqual( + 'The current version of the Agent does not support this feature. Upgrade your Agent through Fleet to use this feature and new response actions such as killing and suspending processes.' + ); + }); + it('should call `isolate` api when command is entered', async () => { await render(); enterConsoleCommand(renderResult, 'isolate'); diff --git a/x-pack/plugins/security_solution/public/management/components/endpoint_responder/kill_process_action.test.tsx b/x-pack/plugins/security_solution/public/management/components/endpoint_responder/kill_process_action.test.tsx index f9c8eab8dcb7a..167c3feb554a7 100644 --- a/x-pack/plugins/security_solution/public/management/components/endpoint_responder/kill_process_action.test.tsx +++ b/x-pack/plugins/security_solution/public/management/components/endpoint_responder/kill_process_action.test.tsx @@ -16,9 +16,13 @@ import { getEndpointResponseActionsConsoleCommands } from './endpoint_response_a import { enterConsoleCommand } from '../console/mocks'; import { waitFor } from '@testing-library/react'; import { responseActionsHttpMocks } from '../../mocks/response_actions_http_mocks'; +import type { ResponderCapabilities } from '../../../../common/endpoint/constants'; +import { RESPONDER_CAPABILITIES } from '../../../../common/endpoint/constants'; describe('When using the kill-process action from response actions console', () => { - let render: () => Promise>; + let render: ( + capabilities?: ResponderCapabilities[] + ) => Promise>; let renderResult: ReturnType; let apiMocks: ReturnType; let consoleManagerMockAccess: ReturnType< @@ -30,14 +34,17 @@ describe('When using the kill-process action from response actions console', () apiMocks = responseActionsHttpMocks(mockedContext.coreStart.http); - render = async () => { + render = async (capabilities: ResponderCapabilities[] = [...RESPONDER_CAPABILITIES]) => { renderResult = mockedContext.render( { return { consoleProps: { 'data-test-subj': 'test', - commands: getEndpointResponseActionsConsoleCommands('a.b.c'), + commands: getEndpointResponseActionsConsoleCommands({ + endpointAgentId: 'a.b.c', + endpointCapabilities: [...capabilities], + }), }, }; }} @@ -53,6 +60,15 @@ describe('When using the kill-process action from response actions console', () }; }); + it('should show an error if the `kill_process` capability is not present in the endpoint', async () => { + await render([]); + enterConsoleCommand(renderResult, 'kill-process --pid 123'); + + expect(renderResult.getByTestId('test-validationError-message').textContent).toEqual( + 'The current version of the Agent does not support this feature. Upgrade your Agent through Fleet to use this feature and new response actions such as killing and suspending processes.' + ); + }); + it('should call `kill-process` api when command is entered', async () => { await render(); enterConsoleCommand(renderResult, 'kill-process --pid 123'); diff --git a/x-pack/plugins/security_solution/public/management/components/endpoint_responder/release_action.test.tsx b/x-pack/plugins/security_solution/public/management/components/endpoint_responder/release_action.test.tsx index 3ea1a36522ee6..e6764185ed8e7 100644 --- a/x-pack/plugins/security_solution/public/management/components/endpoint_responder/release_action.test.tsx +++ b/x-pack/plugins/security_solution/public/management/components/endpoint_responder/release_action.test.tsx @@ -17,9 +17,13 @@ import { enterConsoleCommand } from '../console/mocks'; import { waitFor } from '@testing-library/react'; import { responseActionsHttpMocks } from '../../mocks/response_actions_http_mocks'; import { getDeferred } from '../mocks'; +import type { ResponderCapabilities } from '../../../../common/endpoint/constants'; +import { RESPONDER_CAPABILITIES } from '../../../../common/endpoint/constants'; describe('When using the release action from response actions console', () => { - let render: () => Promise>; + let render: ( + capabilities?: ResponderCapabilities[] + ) => Promise>; let renderResult: ReturnType; let apiMocks: ReturnType; let consoleManagerMockAccess: ReturnType< @@ -31,14 +35,17 @@ describe('When using the release action from response actions console', () => { apiMocks = responseActionsHttpMocks(mockedContext.coreStart.http); - render = async () => { + render = async (capabilities: ResponderCapabilities[] = [...RESPONDER_CAPABILITIES]) => { renderResult = mockedContext.render( { return { consoleProps: { 'data-test-subj': 'test', - commands: getEndpointResponseActionsConsoleCommands('a.b.c'), + commands: getEndpointResponseActionsConsoleCommands({ + endpointAgentId: 'a.b.c', + endpointCapabilities: [...capabilities], + }), }, }; }} @@ -54,6 +61,15 @@ describe('When using the release action from response actions console', () => { }; }); + it('should show an error if the `isolation` capability is not present in the endpoint', async () => { + await render([]); + enterConsoleCommand(renderResult, 'release'); + + expect(renderResult.getByTestId('test-validationError-message').textContent).toEqual( + 'The current version of the Agent does not support this feature. Upgrade your Agent through Fleet to use this feature and new response actions such as killing and suspending processes.' + ); + }); + it('should call `release` api when command is entered', async () => { await render(); enterConsoleCommand(renderResult, 'release'); diff --git a/x-pack/plugins/security_solution/public/management/components/endpoint_responder/suspend_process_action.test.tsx b/x-pack/plugins/security_solution/public/management/components/endpoint_responder/suspend_process_action.test.tsx index e1ad7357d5963..4d12af721a02f 100644 --- a/x-pack/plugins/security_solution/public/management/components/endpoint_responder/suspend_process_action.test.tsx +++ b/x-pack/plugins/security_solution/public/management/components/endpoint_responder/suspend_process_action.test.tsx @@ -16,9 +16,13 @@ import { getEndpointResponseActionsConsoleCommands } from './endpoint_response_a import { enterConsoleCommand } from '../console/mocks'; import { waitFor } from '@testing-library/react'; import { responseActionsHttpMocks } from '../../mocks/response_actions_http_mocks'; +import type { ResponderCapabilities } from '../../../../common/endpoint/constants'; +import { RESPONDER_CAPABILITIES } from '../../../../common/endpoint/constants'; describe('When using the suspend-process action from response actions console', () => { - let render: () => Promise>; + let render: ( + capabilities?: ResponderCapabilities[] + ) => Promise>; let renderResult: ReturnType; let apiMocks: ReturnType; let consoleManagerMockAccess: ReturnType< @@ -30,14 +34,17 @@ describe('When using the suspend-process action from response actions console', apiMocks = responseActionsHttpMocks(mockedContext.coreStart.http); - render = async () => { + render = async (capabilities: ResponderCapabilities[] = [...RESPONDER_CAPABILITIES]) => { renderResult = mockedContext.render( { return { consoleProps: { 'data-test-subj': 'test', - commands: getEndpointResponseActionsConsoleCommands('a.b.c'), + commands: getEndpointResponseActionsConsoleCommands({ + endpointAgentId: 'a.b.c', + endpointCapabilities: [...capabilities], + }), }, }; }} @@ -53,6 +60,15 @@ describe('When using the suspend-process action from response actions console', }; }); + it('should show an error if the `suspend_process` capability is not present in the endpoint', async () => { + await render([]); + enterConsoleCommand(renderResult, 'suspend-process --pid 123'); + + expect(renderResult.getByTestId('test-validationError-message').textContent).toEqual( + 'The current version of the Agent does not support this feature. Upgrade your Agent through Fleet to use this feature and new response actions such as killing and suspending processes.' + ); + }); + it('should call `suspend-process` api when command is entered', async () => { await render(); enterConsoleCommand(renderResult, 'suspend-process --pid 123'); diff --git a/x-pack/plugins/security_solution/public/management/hooks/endpoint/use_with_show_endpoint_responder.tsx b/x-pack/plugins/security_solution/public/management/hooks/endpoint/use_with_show_endpoint_responder.tsx index 1d8808ca52d76..8c0236a42073d 100644 --- a/x-pack/plugins/security_solution/public/management/hooks/endpoint/use_with_show_endpoint_responder.tsx +++ b/x-pack/plugins/security_solution/public/management/hooks/endpoint/use_with_show_endpoint_responder.tsx @@ -48,7 +48,10 @@ export const useWithShowEndpointResponder = (): ShowEndpointResponseActionsConso endpoint: endpointMetadata, }, consoleProps: { - commands: getEndpointResponseActionsConsoleCommands(endpointAgentId), + commands: getEndpointResponseActionsConsoleCommands({ + endpointAgentId, + endpointCapabilities: endpointMetadata.Endpoint.capabilities ?? [], + }), 'data-test-subj': 'endpointResponseActionsConsole', TitleComponent: () => , }, diff --git a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/hooks/use_endpoint_action_items.tsx b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/hooks/use_endpoint_action_items.tsx index b3e1ce76480f3..3c9f81df4c525 100644 --- a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/hooks/use_endpoint_action_items.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/hooks/use_endpoint_action_items.tsx @@ -21,8 +21,6 @@ import type { ContextMenuItemNavByRouterProps } from '../../../../components/con import { isEndpointHostIsolated } from '../../../../../common/utils/validators'; import { useLicense } from '../../../../../common/hooks/use_license'; import { isIsolationSupported } from '../../../../../../common/endpoint/service/host_isolation/utils'; -import { useDoesEndpointSupportResponder } from '../../../../../common/hooks/endpoint/use_does_endpoint_support_responder'; -import { UPGRADE_ENDPOINT_FOR_RESPONDER } from '../../../../../common/translations'; interface Options { isEndpointList: boolean; @@ -45,7 +43,6 @@ export const useEndpointActionItems = ( 'responseActionsConsoleEnabled' ); const canAccessResponseConsole = useUserPrivileges().endpointPrivileges.canAccessResponseConsole; - const isResponderCapabilitiesEnabled = useDoesEndpointSupportResponder(endpointMetadata); return useMemo(() => { if (endpointMetadata) { @@ -128,7 +125,6 @@ export const useEndpointActionItems = ( 'data-test-subj': 'console', icon: 'console', key: 'consoleLink', - disabled: !isResponderCapabilitiesEnabled, onClick: (ev: React.MouseEvent) => { ev.preventDefault(); showEndpointResponseActionsConsole(endpointMetadata); @@ -139,9 +135,6 @@ export const useEndpointActionItems = ( defaultMessage="Respond" /> ), - toolTipContent: !isResponderCapabilitiesEnabled - ? UPGRADE_ENDPOINT_FOR_RESPONDER - : '', }, ] : []), @@ -264,6 +257,5 @@ export const useEndpointActionItems = ( isResponseActionsConsoleEnabled, showEndpointResponseActionsConsole, options?.isEndpointList, - isResponderCapabilitiesEnabled, ]); }; diff --git a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/index.test.tsx b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/index.test.tsx index 1d47f70227df3..bbee0e695a8dd 100644 --- a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/index.test.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/index.test.tsx @@ -1116,19 +1116,6 @@ describe('when on the endpoint list page', () => { expect(responderButton).not.toHaveAttribute('disabled'); }); - it('disables the Responder option and shows a tooltip when no processes capabilities are present in the endpoint', async () => { - const firstActionButton = (await renderResult.findAllByTestId('endpointTableRowActions'))[0]; - const secondActionButton = (await renderResult.findAllByTestId('endpointTableRowActions'))[1]; - - reactTestingLibrary.act(() => { - // close any open action menus - userEvent.click(firstActionButton); - userEvent.click(secondActionButton); - }); - const responderButton = await renderResult.findByTestId('console'); - expect(responderButton).toHaveAttribute('disabled'); - }); - it('navigates to the Actions log flyout', async () => { const actionsLink = await renderResult.findByTestId('actionsLink'); diff --git a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/index.tsx b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/index.tsx index 425b363c0c824..0eec45c67c11d 100644 --- a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/index.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/index.tsx @@ -323,7 +323,7 @@ export const EndpointList = () => { const setTableRowProps = useCallback((endpoint: HostInfo) => { return { - 'data-endpoint-Id': endpoint.metadata.agent.id, + 'data-endpoint-id': endpoint.metadata.agent.id, }; }, []); From 031c34e947f328c671892c820a617ff388f37a49 Mon Sep 17 00:00:00 2001 From: Lee Drengenberg Date: Fri, 26 Aug 2022 11:50:07 -0500 Subject: [PATCH 25/28] [DOCS] Update rule name to match query my* (#139563) --- docs/api/alerting/find_rules.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api/alerting/find_rules.asciidoc b/docs/api/alerting/find_rules.asciidoc index a3e374b641cc0..5c224ef1d07aa 100644 --- a/docs/api/alerting/find_rules.asciidoc +++ b/docs/api/alerting/find_rules.asciidoc @@ -121,7 +121,7 @@ The API returns the following: }, "actions": [], "tags": [], - "name": "test rule", + "name": "my test rule", "enabled": true, "throttle": null, "api_key_owner": "elastic", From 05d3d76c1e7ed9352f6c189b8fa3104a2b931144 Mon Sep 17 00:00:00 2001 From: Juan Pablo Djeredjian Date: Fri, 26 Aug 2022 18:53:06 +0200 Subject: [PATCH 26/28] [Security Solution][Detections] Fix selected rules count and clear selection label on bulk unselect rules with checkbox (#139461) Fixes: https://github.com/elastic/kibana/issues/136616 ## Summary ### Behaviour before fix Selected rules count doesn't update in the special case of a user having selected all rules via the "Select all XXX rules" bulk action button from the Utility bar, and later trying to unselect rules via the "Select/Unselect All rows" checkbox of the table. In this specific case, the selected rules label got stuck at "Selected XXX Rules" and the the "Select All XXX rules" bulk action button got stuck on "Clear selection". See video below for details: https://user-images.githubusercontent.com/5354282/186687704-c1a4a36b-6f49-4347-abf3-6cfc648b586e.mp4 ### Behaviour after fix If, after selection all rules with the bulk select all rules button, the user clicks on the "Select/Unselect All rows" checkbox of the table: - the selected rules label resets to "Selected 0 Rules" - the "bulk select all rules" button from the Utility bar switches back from its "Clear selection" state back to its "Select all XXX rules" state. https://user-images.githubusercontent.com/5354282/186687602-815ef9a0-53be-4476-a8bb-9edcc5df7db4.mov ## Other changes - Create constant for API route `/api/detection_engine/rules/_find` as `DETECTION_ENGINE_RULES_URL_FIND` and replaces its uses. ### Checklist Delete any items that are not applicable to this PR. - [x] 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)) ### For maintainers - [ ] This was checked for breaking API changes and was [labeled appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) --- .../security_solution/common/constants.ts | 1 + .../detection_rules/prebuilt_rules.spec.ts | 3 +- .../detection_rules/rules_selection.spec.ts | 78 +++++++++++++++++++ .../cypress/screens/alerts_detection_rules.ts | 3 + .../cypress/tasks/alerts_detection_rules.ts | 16 ++++ .../containers/detection_engine/rules/api.ts | 14 ++-- .../rules/all/rules_tables.tsx | 6 ++ .../routes/__mocks__/request_responses.ts | 3 +- .../routes/rules/find_rules_route.test.ts | 6 +- .../routes/rules/find_rules_route.ts | 4 +- 10 files changed, 119 insertions(+), 15 deletions(-) create mode 100644 x-pack/plugins/security_solution/cypress/integration/detection_rules/rules_selection.spec.ts diff --git a/x-pack/plugins/security_solution/common/constants.ts b/x-pack/plugins/security_solution/common/constants.ts index 459e13d9eacc7..e86e57e00ca34 100644 --- a/x-pack/plugins/security_solution/common/constants.ts +++ b/x-pack/plugins/security_solution/common/constants.ts @@ -263,6 +263,7 @@ export const DETECTION_ENGINE_PREPACKAGED_URL = export const DETECTION_ENGINE_PRIVILEGES_URL = `${DETECTION_ENGINE_URL}/privileges` as const; export const DETECTION_ENGINE_INDEX_URL = `${DETECTION_ENGINE_URL}/index` as const; +export const DETECTION_ENGINE_RULES_URL_FIND = `${DETECTION_ENGINE_RULES_URL}/_find` as const; export const DETECTION_ENGINE_TAGS_URL = `${DETECTION_ENGINE_URL}/tags` as const; export const DETECTION_ENGINE_PREPACKAGED_RULES_STATUS_URL = `${DETECTION_ENGINE_RULES_URL}/prepackaged/_status` as const; diff --git a/x-pack/plugins/security_solution/cypress/integration/detection_rules/prebuilt_rules.spec.ts b/x-pack/plugins/security_solution/cypress/integration/detection_rules/prebuilt_rules.spec.ts index ed5f5629985ae..cb7e8fbe98281 100644 --- a/x-pack/plugins/security_solution/cypress/integration/detection_rules/prebuilt_rules.spec.ts +++ b/x-pack/plugins/security_solution/cypress/integration/detection_rules/prebuilt_rules.spec.ts @@ -5,6 +5,7 @@ * 2.0. */ +import { DETECTION_ENGINE_RULES_URL_FIND } from '../../../common/constants'; import { rawRules } from '../../../server/lib/detection_engine/rules/prepackaged_rules'; import { COLLAPSED_ACTION_BTN, @@ -59,7 +60,7 @@ describe('Prebuilt rules', () => { changeRowsPerPageTo(rowsPerPage); - cy.request({ url: '/api/detection_engine/rules/_find' }).then(({ body }) => { + cy.request({ url: DETECTION_ENGINE_RULES_URL_FIND }).then(({ body }) => { // Assert the total number of loaded rules equals the expected number of in-memory rules expect(body.total).to.equal(rawRules.length); // Assert the table was refreshed with the rules returned by the API request diff --git a/x-pack/plugins/security_solution/cypress/integration/detection_rules/rules_selection.spec.ts b/x-pack/plugins/security_solution/cypress/integration/detection_rules/rules_selection.spec.ts new file mode 100644 index 0000000000000..28edde413d073 --- /dev/null +++ b/x-pack/plugins/security_solution/cypress/integration/detection_rules/rules_selection.spec.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 { totalNumberOfPrebuiltRules } from '../../objects/rule'; +import { + SELECTED_RULES_NUMBER_LABEL, + SELECT_ALL_RULES_BTN, + SELECT_ALL_RULES_ON_PAGE_CHECKBOX, +} from '../../screens/alerts_detection_rules'; +import { + loadPrebuiltDetectionRules, + selectNumberOfRules, + unselectNumberOfRules, + waitForPrebuiltDetectionRulesToBeLoaded, +} from '../../tasks/alerts_detection_rules'; +import { cleanKibana } from '../../tasks/common'; +import { login, visitWithoutDateRange } from '../../tasks/login'; +import { DETECTIONS_RULE_MANAGEMENT_URL } from '../../urls/navigation'; + +describe('Rules selection', () => { + beforeEach(() => { + cleanKibana(); + login(); + visitWithoutDateRange(DETECTIONS_RULE_MANAGEMENT_URL); + }); + + it('should correctly update the selection label when rules are individually selected and unselected', () => { + loadPrebuiltDetectionRules(); + waitForPrebuiltDetectionRulesToBeLoaded(); + + selectNumberOfRules(2); + + cy.get(SELECTED_RULES_NUMBER_LABEL).should('contain.text', '2'); + + unselectNumberOfRules(2); + + cy.get(SELECTED_RULES_NUMBER_LABEL).should('contain.text', '0'); + }); + + it('should correctly update the selection label when rules are bulk selected and then bulk un-selected', () => { + loadPrebuiltDetectionRules(); + waitForPrebuiltDetectionRulesToBeLoaded(); + + cy.get(SELECT_ALL_RULES_BTN).click(); + + cy.get(SELECTED_RULES_NUMBER_LABEL).should('contain.text', totalNumberOfPrebuiltRules); + + const bulkSelectButton = cy.get(SELECT_ALL_RULES_BTN); + + // Un-select all rules via the Bulk Selection button from the Utility bar + bulkSelectButton.click(); + + // Current selection should be 0 rules + cy.get(SELECTED_RULES_NUMBER_LABEL).should('contain.text', '0'); + // Bulk selection button should be back to displaying all rules + cy.get(SELECT_ALL_RULES_BTN).should('contain.text', totalNumberOfPrebuiltRules); + }); + + it('should correctly update the selection label when rules are bulk selected and then unselected via the table select all checkbox', () => { + loadPrebuiltDetectionRules(); + waitForPrebuiltDetectionRulesToBeLoaded(); + + cy.get(SELECT_ALL_RULES_BTN).click(); + + cy.get(SELECTED_RULES_NUMBER_LABEL).should('contain.text', totalNumberOfPrebuiltRules); + + // Un-select all rules via the Un-select All checkbox from the table + cy.get(SELECT_ALL_RULES_ON_PAGE_CHECKBOX).click(); + + // Current selection should be 0 rules + cy.get(SELECTED_RULES_NUMBER_LABEL).should('contain.text', '0'); + // Bulk selection button should be back to displaying all rules + cy.get(SELECT_ALL_RULES_BTN).should('contain.text', totalNumberOfPrebuiltRules); + }); +}); diff --git a/x-pack/plugins/security_solution/cypress/screens/alerts_detection_rules.ts b/x-pack/plugins/security_solution/cypress/screens/alerts_detection_rules.ts index 37f69755c653e..c34250690c337 100644 --- a/x-pack/plugins/security_solution/cypress/screens/alerts_detection_rules.ts +++ b/x-pack/plugins/security_solution/cypress/screens/alerts_detection_rules.ts @@ -90,6 +90,9 @@ export const rowsPerPageSelector = (count: number) => export const pageSelector = (pageNumber: number) => `[data-test-subj="pagination-button-${pageNumber - 1}"]`; +export const ruleCheckboxByIdSelector = (id: string) => + `[data-test-subj="checkboxSelectRow-${id}"]`; + export const SELECT_ALL_RULES_BTN = '[data-test-subj="selectAllRules"]'; export const RULES_EMPTY_PROMPT = '[data-test-subj="rulesEmptyPrompt"]'; diff --git a/x-pack/plugins/security_solution/cypress/tasks/alerts_detection_rules.ts b/x-pack/plugins/security_solution/cypress/tasks/alerts_detection_rules.ts index 40ab35a2d7b55..8011290e23bfb 100644 --- a/x-pack/plugins/security_solution/cypress/tasks/alerts_detection_rules.ts +++ b/x-pack/plugins/security_solution/cypress/tasks/alerts_detection_rules.ts @@ -201,6 +201,22 @@ export const selectNumberOfRules = (numberOfRules: number) => { } }; +/** + * Unselects a passed number of rules. To use together with selectNumberOfRules + * as this utility will expect and check the passed number of rules + * to have been previously checked. + * @param numberOfRules The number of rules to click/check + */ +export const unselectNumberOfRules = (numberOfRules: number) => { + for (let i = 0; i < numberOfRules; i++) { + cy.get(RULE_CHECKBOX) + .eq(i) + .should('be.checked') + .pipe(($el) => $el.trigger('click')) + .should('not.be.checked'); + } +}; + export const selectAllRules = () => { cy.get(SELECT_ALL_RULES_BTN).contains('Select all').click(); cy.get(SELECT_ALL_RULES_BTN).contains('Clear'); diff --git a/x-pack/plugins/security_solution/public/detections/containers/detection_engine/rules/api.ts b/x-pack/plugins/security_solution/public/detections/containers/detection_engine/rules/api.ts index dfee0f418d2d5..0e2f238aa527e 100644 --- a/x-pack/plugins/security_solution/public/detections/containers/detection_engine/rules/api.ts +++ b/x-pack/plugins/security_solution/public/detections/containers/detection_engine/rules/api.ts @@ -16,6 +16,7 @@ import { DETECTION_ENGINE_RULES_BULK_ACTION, DETECTION_ENGINE_RULES_PREVIEW, DETECTION_ENGINE_INSTALLED_INTEGRATIONS_URL, + DETECTION_ENGINE_RULES_URL_FIND, } from '../../../../../common/constants'; import type { BulkAction } from '../../../../../common/detection_engine/schemas/common'; import type { @@ -151,14 +152,11 @@ export const fetchRules = async ({ ...(filterString !== '' ? { filter: filterString } : {}), }; - return KibanaServices.get().http.fetch( - `${DETECTION_ENGINE_RULES_URL}/_find`, - { - method: 'GET', - query, - signal, - } - ); + return KibanaServices.get().http.fetch(DETECTION_ENGINE_RULES_URL_FIND, { + method: 'GET', + query, + signal, + }); }; /** diff --git a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/rules_tables.tsx b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/rules_tables.tsx index d04832d2e738c..b61a568ea35d2 100644 --- a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/rules_tables.tsx +++ b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/rules_tables.tsx @@ -219,6 +219,12 @@ export const RulesTables = React.memo( */ if (isSelectAllCalled.current) { isSelectAllCalled.current = false; + // Handle special case of unselecting all rules via checkbox + // after all rules were selected via Bulk select. + if (selected.length === 0) { + setIsAllSelected(false); + setSelectedRuleIds([]); + } } else { setSelectedRuleIds(selected.map(({ id }) => id)); setIsAllSelected(false); diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/__mocks__/request_responses.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/__mocks__/request_responses.ts index bbc40dcf4b8d6..9f2f576313531 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/__mocks__/request_responses.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/__mocks__/request_responses.ts @@ -23,6 +23,7 @@ import { DETECTION_ENGINE_RULES_BULK_UPDATE, DETECTION_ENGINE_RULES_BULK_DELETE, DETECTION_ENGINE_RULES_BULK_CREATE, + DETECTION_ENGINE_RULES_URL_FIND, } from '../../../../../common/constants'; import type { RuleAlertType, HapiReadableStream } from '../../rules/types'; import { requestMock } from './request'; @@ -97,7 +98,7 @@ export const getReadRequestWithId = (id: string) => export const getFindRequest = () => requestMock.create({ method: 'get', - path: `${DETECTION_ENGINE_RULES_URL}/_find`, + path: DETECTION_ENGINE_RULES_URL_FIND, }); export const getReadBulkRequest = () => diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/find_rules_route.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/find_rules_route.test.ts index 0e26601d64547..b1f1ec8ead8ac 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/find_rules_route.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/find_rules_route.test.ts @@ -6,7 +6,7 @@ */ import { loggingSystemMock } from '@kbn/core/server/mocks'; -import { DETECTION_ENGINE_RULES_URL } from '../../../../../common/constants'; +import { DETECTION_ENGINE_RULES_URL_FIND } from '../../../../../common/constants'; import { getQueryRuleParams } from '../../schemas/rule_schemas.mock'; import { requestContextMock, requestMock, serverMock } from '../__mocks__'; import { @@ -63,7 +63,7 @@ describe('find_rules', () => { test('allows optional query params', async () => { const request = requestMock.create({ method: 'get', - path: `${DETECTION_ENGINE_RULES_URL}/_find`, + path: DETECTION_ENGINE_RULES_URL_FIND, query: { page: 2, per_page: 20, @@ -79,7 +79,7 @@ describe('find_rules', () => { test('rejects unknown query params', async () => { const request = requestMock.create({ method: 'get', - path: `${DETECTION_ENGINE_RULES_URL}/_find`, + path: DETECTION_ENGINE_RULES_URL_FIND, query: { invalid_value: 'hi mom', }, diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/find_rules_route.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/find_rules_route.ts index 4f5621440a92b..fa28a16e7bd4b 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/find_rules_route.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/find_rules_route.ts @@ -11,7 +11,7 @@ import { findRuleValidateTypeDependents } from '../../../../../common/detection_ import type { FindRulesSchemaDecoded } from '../../../../../common/detection_engine/schemas/request/find_rules_schema'; import { findRulesSchema } from '../../../../../common/detection_engine/schemas/request/find_rules_schema'; import type { SecuritySolutionPluginRouter } from '../../../../types'; -import { DETECTION_ENGINE_RULES_URL } from '../../../../../common/constants'; +import { DETECTION_ENGINE_RULES_URL_FIND } from '../../../../../common/constants'; import { findRules } from '../../rules/find_rules'; import { buildSiemResponse } from '../utils'; import { buildRouteValidation } from '../../../../utils/build_validation/route_validation'; @@ -23,7 +23,7 @@ import { legacyGetBulkRuleActionsSavedObject } from '../../rule_actions/legacy_g export const findRulesRoute = (router: SecuritySolutionPluginRouter, logger: Logger) => { router.get( { - path: `${DETECTION_ENGINE_RULES_URL}/_find`, + path: DETECTION_ENGINE_RULES_URL_FIND, validate: { query: buildRouteValidation( findRulesSchema From 6ff5d595facab1b0a9724b30e540d2bd45bd7110 Mon Sep 17 00:00:00 2001 From: Nicolas Chaulet Date: Fri, 26 Aug 2022 13:48:02 -0400 Subject: [PATCH 27/28] [Fleet] Preconfigured output should allow to delete fields causing too many bump revision (#139564) --- .../fleet/common/types/models/output.ts | 10 ++-- .../steps/install_fleet_server.tsx | 2 +- .../cloud_preconfiguration.test.ts | 59 ++++++++++++++++++- .../fleet/server/services/output.test.ts | 24 ++++++++ .../plugins/fleet/server/services/output.ts | 3 + .../services/preconfiguration/outputs.test.ts | 6 +- .../services/preconfiguration/outputs.ts | 40 +++++++++---- 7 files changed, 122 insertions(+), 22 deletions(-) diff --git a/x-pack/plugins/fleet/common/types/models/output.ts b/x-pack/plugins/fleet/common/types/models/output.ts index 49115ffbeeed1..14b3986b67a70 100644 --- a/x-pack/plugins/fleet/common/types/models/output.ts +++ b/x-pack/plugins/fleet/common/types/models/output.ts @@ -17,19 +17,19 @@ export interface NewOutput { name: string; type: ValueOf; hosts?: string[]; - ca_sha256?: string; - ca_trusted_fingerprint?: string; - config_yaml?: string; + ca_sha256?: string | null; + ca_trusted_fingerprint?: string | null; + config_yaml?: string | null; ssl?: { certificate_authorities?: string[]; certificate?: string; key?: string; - }; + } | null; } export type OutputSOAttributes = NewOutput & { output_id?: string; - ssl?: string; // encrypted ssl field + ssl?: string | null; // encrypted ssl field }; export type Output = NewOutput & { diff --git a/x-pack/plugins/fleet/public/applications/fleet/components/fleet_server_instructions/steps/install_fleet_server.tsx b/x-pack/plugins/fleet/public/applications/fleet/components/fleet_server_instructions/steps/install_fleet_server.tsx index 71c67aa4204dd..4189edfbd6184 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/components/fleet_server_instructions/steps/install_fleet_server.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/components/fleet_server_instructions/steps/install_fleet_server.tsx @@ -73,7 +73,7 @@ const InstallFleetServerStepContent: React.FunctionComponent<{ fleetServerPolicyId, fleetServerHost, deploymentMode === 'production', - commandOutput?.ca_trusted_fingerprint, + commandOutput?.ca_trusted_fingerprint ?? undefined, kibanaVersion ); diff --git a/x-pack/plugins/fleet/server/integration_tests/cloud_preconfiguration.test.ts b/x-pack/plugins/fleet/server/integration_tests/cloud_preconfiguration.test.ts index efc68f8849381..ab5fc5b9500f6 100644 --- a/x-pack/plugins/fleet/server/integration_tests/cloud_preconfiguration.test.ts +++ b/x-pack/plugins/fleet/server/integration_tests/cloud_preconfiguration.test.ts @@ -10,7 +10,7 @@ import Path from 'path'; import * as kbnTestServer from '@kbn/core/test_helpers/kbn_server'; import { AGENT_POLICY_INDEX } from '../../common'; -import type { PackagePolicySOAttributes } from '../../common/types'; +import type { PackagePolicySOAttributes, OutputSOAttributes } from '../../common/types'; import type { AgentPolicySOAttributes } from '../types'; import { useDockerRegistry, waitForFleetSetup } from './helpers'; @@ -331,5 +331,62 @@ describe.skip('Fleet preconfiguration reset', () => { ).toBeDefined(); }); }); + + describe('Support removing a field from output after first setup', () => { + beforeAll(async () => { + // 1. Start with a preconfigured policy withtout APM + const { startOrRestartKibana } = await startServers({ + xpack: { + fleet: { + outputs: [ + { + name: 'Elastic Cloud internal output', + type: 'elasticsearch', + id: 'es-containerhost', + hosts: ['https://cloudinternales:9200'], + config: { test: '123' }, + }, + ], + }, + }, + }); + + // 2. Change the output remove config + await startOrRestartKibana({ + xpack: { + fleet: { + outputs: [ + { + name: 'Elastic Cloud internal output', + type: 'elasticsearch', + id: 'es-containerhost', + hosts: ['https://cloudinternales:9200'], + }, + ], + }, + }, + }); + }); + + afterAll(async () => { + await stopServers(); + }); + + it('Works and preconfigure correctly agent policies', async () => { + const agentPolicies = await kbnServer.coreStart.savedObjects + .createInternalRepository() + .find({ + type: 'ingest-outputs', + perPage: 10000, + }); + + expect(agentPolicies.total).toBe(2); + const outputSO = agentPolicies.saved_objects.find( + (so) => so.attributes.output_id === 'es-containerhost' + ); + expect(outputSO).toBeDefined(); + expect(outputSO?.attributes.config_yaml).toBeNull(); + }); + }); }); }); diff --git a/x-pack/plugins/fleet/server/services/output.test.ts b/x-pack/plugins/fleet/server/services/output.test.ts index 893c77578f0e5..0e063fa667ec1 100644 --- a/x-pack/plugins/fleet/server/services/output.test.ts +++ b/x-pack/plugins/fleet/server/services/output.test.ts @@ -527,6 +527,30 @@ describe('Output Service', () => { expect(soClient.update).toBeCalled(); }); + it('Should call update with null fields if', async () => { + const soClient = getMockedSoClient({}); + mockedAgentPolicyService.list.mockResolvedValue({ + items: [{}], + } as unknown as ReturnType); + mockedAgentPolicyService.hasAPMIntegration.mockReturnValue(false); + + await outputService.update(soClient, 'existing-logstash-output', { + is_default: true, + ca_sha256: null, + ca_trusted_fingerprint: null, + config_yaml: null, + ssl: null, + }); + + expect(soClient.update).toBeCalled(); + expect(soClient.update).toBeCalledWith(expect.anything(), expect.anything(), { + is_default: true, + ca_sha256: null, + ca_trusted_fingerprint: null, + config_yaml: null, + ssl: null, + }); + }); it('Should throw if you try to make that output the default output and somne policies using default output has APM integration', async () => { const soClient = getMockedSoClient({}); mockedAgentPolicyService.list.mockResolvedValue({ diff --git a/x-pack/plugins/fleet/server/services/output.ts b/x-pack/plugins/fleet/server/services/output.ts index 2ed64cf746eef..57c57619beacb 100644 --- a/x-pack/plugins/fleet/server/services/output.ts +++ b/x-pack/plugins/fleet/server/services/output.ts @@ -369,6 +369,9 @@ class OutputService { if (data.ssl) { updateData.ssl = JSON.stringify(data.ssl); + } else if (data.ssl === null) { + // Explicitly set to null to allow to delete the field + updateData.ssl = null; } // ensure only default output exists diff --git a/x-pack/plugins/fleet/server/services/preconfiguration/outputs.test.ts b/x-pack/plugins/fleet/server/services/preconfiguration/outputs.test.ts index 4e4db6c252821..a8eaa39d427df 100644 --- a/x-pack/plugins/fleet/server/services/preconfiguration/outputs.test.ts +++ b/x-pack/plugins/fleet/server/services/preconfiguration/outputs.test.ts @@ -209,15 +209,14 @@ describe('output preconfiguration', () => { expect(spyAgentPolicyServicBumpAllAgentPoliciesForOutput).toBeCalled(); }); - it('should not delete default output if preconfigured default output exists and changed', async () => { + it('should not update output if preconfigured output exists and did not changed', async () => { const soClient = savedObjectsClientMock.create(); const esClient = elasticsearchServiceMock.createClusterClient().asInternalUser; soClient.find.mockResolvedValue({ saved_objects: [], page: 0, per_page: 0, total: 0 }); - mockedOutputService.getDefaultDataOutputId.mockResolvedValue('existing-output-1'); await createOrUpdatePreconfiguredOutputs(soClient, esClient, [ { id: 'existing-output-1', - is_default: true, + is_default: false, is_default_monitoring: false, name: 'Output 1', type: 'elasticsearch', @@ -225,7 +224,6 @@ describe('output preconfiguration', () => { }, ]); - expect(mockedOutputService.delete).not.toBeCalled(); expect(mockedOutputService.create).not.toBeCalled(); expect(mockedOutputService.update).toBeCalled(); expect(spyAgentPolicyServicBumpAllAgentPoliciesForOutput).toBeCalled(); diff --git a/x-pack/plugins/fleet/server/services/preconfiguration/outputs.ts b/x-pack/plugins/fleet/server/services/preconfiguration/outputs.ts index b8a639330872f..a61d8316dcc5f 100644 --- a/x-pack/plugins/fleet/server/services/preconfiguration/outputs.ts +++ b/x-pack/plugins/fleet/server/services/preconfiguration/outputs.ts @@ -9,7 +9,7 @@ import type { ElasticsearchClient, SavedObjectsClientContract } from '@kbn/core/ import { isEqual } from 'lodash'; import { safeDump } from 'js-yaml'; -import type { PreconfiguredOutput, Output } from '../../../common/types'; +import type { PreconfiguredOutput, Output, NewOutput } from '../../../common/types'; import { normalizeHostsForAgents } from '../../../common/services'; import type { FleetConfigType } from '../../config'; import { DEFAULT_OUTPUT_ID, DEFAULT_OUTPUT } from '../../constants'; @@ -72,10 +72,14 @@ export async function createOrUpdatePreconfiguredOutputs( const configYaml = config ? safeDump(config) : undefined; - const data = { + const data: NewOutput = { ...outputData, - config_yaml: configYaml, is_preconfigured: true, + config_yaml: configYaml ?? null, + // Set value to null to update these fields on update + ca_sha256: outputData.ca_sha256 ?? null, + ca_trusted_fingerprint: outputData.ca_sha256 ?? null, + ssl: outputData.ssl ?? null, }; if (!data.hosts || data.hosts.length === 0) { @@ -147,16 +151,27 @@ export async function cleanPreconfiguredOutputs( } } +function isDifferent(val1: any, val2: any) { + if ( + (val1 === null || typeof val1 === 'undefined') && + (val2 === null || typeof val2 === 'undefined') + ) { + return false; + } + + return !isEqual(val1, val2); +} + function isPreconfiguredOutputDifferentFromCurrent( existingOutput: Output, preconfiguredOutput: Partial ): boolean { return ( !existingOutput.is_preconfigured || - existingOutput.is_default !== preconfiguredOutput.is_default || - existingOutput.is_default_monitoring !== preconfiguredOutput.is_default_monitoring || - existingOutput.name !== preconfiguredOutput.name || - existingOutput.type !== preconfiguredOutput.type || + isDifferent(existingOutput.is_default, preconfiguredOutput.is_default) || + isDifferent(existingOutput.is_default_monitoring, preconfiguredOutput.is_default_monitoring) || + isDifferent(existingOutput.name, preconfiguredOutput.name) || + isDifferent(existingOutput.type, preconfiguredOutput.type) || (preconfiguredOutput.hosts && !isEqual( existingOutput?.type === 'elasticsearch' @@ -166,9 +181,12 @@ function isPreconfiguredOutputDifferentFromCurrent( ? preconfiguredOutput.hosts.map(normalizeHostsForAgents) : preconfiguredOutput.hosts )) || - (preconfiguredOutput.ssl && !isEqual(preconfiguredOutput.ssl, existingOutput.ssl)) || - existingOutput.ca_sha256 !== preconfiguredOutput.ca_sha256 || - existingOutput.ca_trusted_fingerprint !== preconfiguredOutput.ca_trusted_fingerprint || - existingOutput.config_yaml !== preconfiguredOutput.config_yaml + isDifferent(preconfiguredOutput.ssl, existingOutput.ssl) || + isDifferent(existingOutput.ca_sha256, preconfiguredOutput.ca_sha256) || + isDifferent( + existingOutput.ca_trusted_fingerprint, + preconfiguredOutput.ca_trusted_fingerprint + ) || + isDifferent(existingOutput.config_yaml, preconfiguredOutput.config_yaml) ); } From a16fd1e0339083dde3e360c8e69e64ad0bd722e2 Mon Sep 17 00:00:00 2001 From: Spencer Date: Fri, 26 Aug 2022 11:09:04 -0700 Subject: [PATCH 28/28] [perf-tests/scalability] improve logging when uploading traces (#139477) * [perf-tests/scalability] improve logging when uploading traces * restore including kibana artifacts in scalability dataset * create parent dirs too * support skipping builds too --- .buildkite/pipelines/performance/daily.yml | 1 + .../scalability_dataset_extraction.sh | 35 +++++++++++++------ 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/.buildkite/pipelines/performance/daily.yml b/.buildkite/pipelines/performance/daily.yml index 28f58d6c814ef..da9370c2f50da 100644 --- a/.buildkite/pipelines/performance/daily.yml +++ b/.buildkite/pipelines/performance/daily.yml @@ -11,6 +11,7 @@ steps: agents: queue: c2-16 key: build + if: "build.env('KIBANA_BUILD_ID') == null || build.env('KIBANA_BUILD_ID') == ''" - label: ':muscle: Performance Tests with Playwright config' command: .buildkite/scripts/steps/functional/performance_playwright.sh diff --git a/.buildkite/scripts/steps/functional/scalability_dataset_extraction.sh b/.buildkite/scripts/steps/functional/scalability_dataset_extraction.sh index 86d067174ba8b..4be4a750cf383 100755 --- a/.buildkite/scripts/steps/functional/scalability_dataset_extraction.sh +++ b/.buildkite/scripts/steps/functional/scalability_dataset_extraction.sh @@ -7,8 +7,10 @@ source .buildkite/scripts/common/util.sh USER_FROM_VAULT="$(retry 5 5 vault read -field=username secret/kibana-issues/dev/apm_parser_performance)" PASS_FROM_VAULT="$(retry 5 5 vault read -field=password secret/kibana-issues/dev/apm_parser_performance)" ES_SERVER_URL="https://kibana-ops-e2e-perf.es.us-central1.gcp.cloud.es.io:9243" -BUILD_ID=${BUILDKITE_BUILD_ID} +BUILD_ID="${BUILDKITE_BUILD_ID}" GCS_BUCKET="gs://kibana-performance/scalability-tests" +OUTPUT_REL="target/scalability_tests/${BUILD_ID}" +OUTPUT_DIR="${KIBANA_DIR}/${OUTPUT_REL}" .buildkite/scripts/bootstrap.sh @@ -28,16 +30,27 @@ for i in "${scalabilityJourneys[@]}"; do --without-static-resources done -echo "--- Upload Kibana build, plugins and scalability traces to the public bucket" -mkdir "${BUILD_ID}" -# Archive json files with traces and upload as build artifacts -tar -czf "${BUILD_ID}/scalability_traces.tar.gz" -C target scalability_traces -buildkite-agent artifact upload "${BUILD_ID}/scalability_traces.tar.gz" -# Upload Kibana build, plugins, commit sha and traces to the bucket -download_artifact kibana-default.tar.gz ./"${BUILD_ID}" -download_artifact kibana-default-plugins.tar.gz ./"${BUILD_ID}" -echo "${BUILDKITE_COMMIT}" > "${BUILD_ID}/KIBANA_COMMIT_HASH" +echo "--- Creating scalability dataset in ${OUTPUT_REL}" +mkdir -p "${OUTPUT_DIR}" + +echo "--- Archiving scalability trace and uploading as build artifact" +tar -czf "${OUTPUT_DIR}/scalability_traces.tar.gz" -C target scalability_traces +buildkite-agent artifact upload "${OUTPUT_DIR}/scalability_traces.tar.gz" + +echo "--- Downloading Kibana artifacts used in tests" +download_artifact kibana-default.tar.gz "${OUTPUT_DIR}/" --build "${KIBANA_BUILD_ID:-$BUILDKITE_BUILD_ID}" +download_artifact kibana-default-plugins.tar.gz "${OUTPUT_DIR}/" --build "${KIBANA_BUILD_ID:-$BUILDKITE_BUILD_ID}" + +echo "--- Adding commit info" +echo "${BUILDKITE_COMMIT}" > "${OUTPUT_DIR}/KIBANA_COMMIT_HASH" + +echo "--- Uploading ${OUTPUT_REL} dir to ${GCS_BUCKET}" +cd "${OUTPUT_DIR}/.." gsutil -m cp -r "${BUILD_ID}" "${GCS_BUCKET}" -echo "--- Update reference to the latest CI build" +cd - + +echo "--- Promoting '${BUILD_ID}' dataset to LATEST" +cd "${OUTPUT_DIR}/.." echo "${BUILD_ID}" > LATEST gsutil cp LATEST "${GCS_BUCKET}" +cd -