From 5046a3a68da1cfa59ca95797be3dff09e4046a00 Mon Sep 17 00:00:00 2001 From: Angela Chuang <6295984+angorayc@users.noreply.github.com> Date: Fri, 28 Feb 2020 10:13:41 +0000 Subject: [PATCH 01/31] clean up snapshot (#58724) --- .../__snapshots__/zeek_details.test.tsx.snap | 3971 ----------------- .../body/renderers/zeek/zeek_details.test.tsx | 1 - 2 files changed, 3972 deletions(-) diff --git a/x-pack/legacy/plugins/siem/public/components/timeline/body/renderers/zeek/__snapshots__/zeek_details.test.tsx.snap b/x-pack/legacy/plugins/siem/public/components/timeline/body/renderers/zeek/__snapshots__/zeek_details.test.tsx.snap index c883983f8cf01..0a60c8facff9c 100644 --- a/x-pack/legacy/plugins/siem/public/components/timeline/body/renderers/zeek/__snapshots__/zeek_details.test.tsx.snap +++ b/x-pack/legacy/plugins/siem/public/components/timeline/body/renderers/zeek/__snapshots__/zeek_details.test.tsx.snap @@ -498,3974 +498,3 @@ exports[`ZeekDetails rendering it renders the default ZeekDetails 1`] = ` timelineId="test" /> `; - -exports[`ZeekDetails rendering it returns zeek.files if the data does contain zeek.files data 1`] = ` -.c3, -.c3::before, -.c3::after { - -webkit-transition: background 150ms ease, color 150ms ease; - transition: background 150ms ease, color 150ms ease; -} - -.c3 { - border-radius: 2px; - padding: 0 4px 0 8px; - position: relative; - z-index: 0 !important; -} - -.c3::before { - background-image: linear-gradient( 135deg, #535966 25%, transparent 25% ), linear-gradient( -135deg, #535966 25%, transparent 25% ), linear-gradient( 135deg, transparent 75%, #535966 75% ), linear-gradient( -135deg, transparent 75%, #535966 75% ); - background-position: 0 0,1px 0,1px -1px,0px 1px; - background-size: 2px 2px; - bottom: 2px; - content: ''; - display: block; - left: 2px; - position: absolute; - top: 2px; - width: 4px; -} - -.c3:hover, -.c3:hover .euiBadge, -.c3:hover .euiBadge__text { - cursor: move; - cursor: -webkit-grab; - cursor: -moz-grab; - cursor: grab; -} - -.event-column-view:hover .c3, -tr:hover .c3 { - background-color: #343741; -} - -.event-column-view:hover .c3::before, -tr:hover .c3::before { - background-image: linear-gradient( 135deg, #98a2b3 25%, transparent 25% ), linear-gradient( -135deg, #98a2b3 25%, transparent 25% ), linear-gradient( 135deg, transparent 75%, #98a2b3 75% ), linear-gradient( -135deg, transparent 75%, #98a2b3 75% ); -} - -.c3:hover, -.c3:focus, -.event-column-view:hover .c3:hover, -.event-column-view:focus .c3:focus, -tr:hover .c3:hover, -tr:hover .c3:focus { - background-color: #1ba9f5; -} - -.c3:hover, -.c3:focus, -.event-column-view:hover .c3:hover, -.event-column-view:focus .c3:focus, -tr:hover .c3:hover, -tr:hover .c3:focus, -.c3:hover a, -.c3:focus a, -.event-column-view:hover .c3:hover a, -.event-column-view:focus .c3:focus a, -tr:hover .c3:hover a, -tr:hover .c3:focus a, -.c3:hover a:hover, -.c3:focus a:hover, -.event-column-view:hover .c3:hover a:hover, -.event-column-view:focus .c3:focus a:hover, -tr:hover .c3:hover a:hover, -tr:hover .c3:focus a:hover { - color: #1d1e24; -} - -.c3:hover::before, -.c3:focus::before, -.event-column-view:hover .c3:hover::before, -.event-column-view:focus .c3:focus::before, -tr:hover .c3:hover::before, -tr:hover .c3:focus::before { - background-image: linear-gradient( 135deg, #1d1e24 25%, transparent 25% ), linear-gradient( -135deg, #1d1e24 25%, transparent 25% ), linear-gradient( 135deg, transparent 75%, #1d1e24 75% ), linear-gradient( -135deg, transparent 75%, #1d1e24 75% ); -} - -.c2 { - display: inline-block; - max-width: 100%; -} - -.c2 [data-rbd-placeholder-context-id] { - display: none !important; -} - -.c4 > span.euiToolTipAnchor { - display: block; -} - -.c8 { - margin: 0 2px; -} - -.c7 { - margin-top: 3px; -} - -.c6 { - margin-right: 10px; -} - -.c1 { - margin-left: 3px; -} - -.c5 { - margin-left: 6px; -} - -.c0 { - margin: 5px 0; -} - - - - - - - - - - - - - - - -
-
- - -
- - - -
- - - -
- - -
- - - - - - -
- - - - - - - - - - - Cu0n232QMyvNtzb75j - - - - - - - - - - - - - - - -
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
- - - -
- - - -
- - -
- - - - - - -
- - - - - - - - - - - files - - - - - - - - - - - - - - - -
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
- - - -
- - - -
- - -
- - - - - - -
- - - - - - - - - - - sha1: fa5195a... - - - - - - - - - - - - - - - -
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
- - - -
- - - -
- - -
- - - - - - -
- - - - - - - - - - - md5: f7653f1... - - - - - - - - - - - - - - - -
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
- - - - - - - - - - -
-
- -
- - - - - - - - -
-
- -
-
-
-
-
-
-
-
- -
- - - - -
- -
- - -
- - -
- - -
- - -
- - - - -
- - -
- - -
- - - -
- - -
- -
- - -
- - -
- - - -
- - -
- -
- -
-
- - - -
- - - - -
- -
-
-
-
- -
- - -
-
- -
-
-
-
- -
-
- -
- - -
- - -
- -
-
- - -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-`; diff --git a/x-pack/legacy/plugins/siem/public/components/timeline/body/renderers/zeek/zeek_details.test.tsx b/x-pack/legacy/plugins/siem/public/components/timeline/body/renderers/zeek/zeek_details.test.tsx index db51ade6df4c5..b45e4c41762bc 100644 --- a/x-pack/legacy/plugins/siem/public/components/timeline/body/renderers/zeek/zeek_details.test.tsx +++ b/x-pack/legacy/plugins/siem/public/components/timeline/body/renderers/zeek/zeek_details.test.tsx @@ -113,7 +113,6 @@ describe('ZeekDetails', () => { /> ); - expect(wrapper).toMatchSnapshot(); expect(wrapper.text()).toEqual('Cu0n232QMyvNtzb75jfilessha1: fa5195a...md5: f7653f1...'); }); From 967bef7b3877ab67e0c213fd5fa67a66ad14f5d1 Mon Sep 17 00:00:00 2001 From: Christos Nasikas Date: Fri, 28 Feb 2020 13:59:43 +0200 Subject: [PATCH 02/31] [SIEM][CASE] Init Configure Case Page (#58121) * [SIEM][CASE] Init configure cases * [SIEM][CASE] Translate header title * [SIEM][CASE] Add back link * [SIEM][CASE] Add default options to header page * [SIEM][CASE] Create configure cases page redirections and links * [SIEM][CASE] Add configure cases button * [SIEM][CASE] Change translation variable * [SIEM][CASE] Create wrappers * [SIEM][CASE]Create section wrapper * [SIEM][CASE] Switch to new wrapper * [SIEM][CASE] Add translations * [SIEM][CASE] Add connectors dropdown component * [SIEM][CASE] Add connectors component * [SIEM][CASE] Show connectors * [SIEM][CASE] Create add new connector button * [SIEM][CASE] Change values * [SIEM][CASE] Use state for connectors dropdown * [SIEM][CASE] Remove unnecessary attribute * [SIEM][CASE] Remove timeline in configuration page * [SIEM][CASE] Remove text from gear button * [SIEM][CASE] make show timeline more generic so we can re-use if need it Co-authored-by: Xavier Mouligneau <189600+XavierM@users.noreply.github.com> Co-authored-by: Elastic Machine --- .../siem/public/components/link_to/index.ts | 2 + .../public/components/link_to/link_to.tsx | 11 +++- .../components/link_to/redirect_to_case.tsx | 4 ++ .../plugins/siem/public/pages/case/case.tsx | 27 +++++---- .../components/case_header_page/index.tsx | 22 ++++++++ .../case_header_page/translations.ts | 16 ++++++ .../pages/case/components/case_view/index.tsx | 13 +---- .../components/configure_cases/connectors.tsx | 52 +++++++++++++++++ .../connectors_dropdown/index.tsx | 56 +++++++++++++++++++ .../configure_cases/translations.ts | 37 ++++++++++++ .../pages/case/components/wrappers/index.tsx | 22 ++++++++ .../public/pages/case/configure_cases.tsx | 54 ++++++++++++++++++ .../siem/public/pages/case/create_case.tsx | 10 +--- .../plugins/siem/public/pages/case/index.tsx | 5 ++ .../siem/public/pages/case/translations.ts | 20 ++++--- .../plugins/siem/public/pages/home/index.tsx | 5 +- .../utils/timeline/use_show_timeline.tsx | 31 ++++++++++ 17 files changed, 345 insertions(+), 42 deletions(-) create mode 100644 x-pack/legacy/plugins/siem/public/pages/case/components/case_header_page/index.tsx create mode 100644 x-pack/legacy/plugins/siem/public/pages/case/components/case_header_page/translations.ts create mode 100644 x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/connectors.tsx create mode 100644 x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/connectors_dropdown/index.tsx create mode 100644 x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/translations.ts create mode 100644 x-pack/legacy/plugins/siem/public/pages/case/components/wrappers/index.tsx create mode 100644 x-pack/legacy/plugins/siem/public/pages/case/configure_cases.tsx create mode 100644 x-pack/legacy/plugins/siem/public/utils/timeline/use_show_timeline.tsx diff --git a/x-pack/legacy/plugins/siem/public/components/link_to/index.ts b/x-pack/legacy/plugins/siem/public/components/link_to/index.ts index c93b415e017bb..a1c1f78e398e3 100644 --- a/x-pack/legacy/plugins/siem/public/components/link_to/index.ts +++ b/x-pack/legacy/plugins/siem/public/components/link_to/index.ts @@ -17,6 +17,8 @@ export { getCaseDetailsUrl, getCaseUrl, getCreateCaseUrl, + getConfigureCasesUrl, RedirectToCasePage, RedirectToCreatePage, + RedirectToConfigureCasesPage, } from './redirect_to_case'; diff --git a/x-pack/legacy/plugins/siem/public/components/link_to/link_to.tsx b/x-pack/legacy/plugins/siem/public/components/link_to/link_to.tsx index c08b429dc4625..08e4d1a3494e0 100644 --- a/x-pack/legacy/plugins/siem/public/components/link_to/link_to.tsx +++ b/x-pack/legacy/plugins/siem/public/components/link_to/link_to.tsx @@ -20,7 +20,11 @@ import { RedirectToHostsPage, RedirectToHostDetailsPage } from './redirect_to_ho import { RedirectToNetworkPage } from './redirect_to_network'; import { RedirectToOverviewPage } from './redirect_to_overview'; import { RedirectToTimelinesPage } from './redirect_to_timelines'; -import { RedirectToCasePage, RedirectToCreatePage } from './redirect_to_case'; +import { + RedirectToCasePage, + RedirectToCreatePage, + RedirectToConfigureCasesPage, +} from './redirect_to_case'; import { DetectionEngineTab } from '../../pages/detection_engine/types'; interface LinkToPageProps { @@ -43,6 +47,11 @@ export const LinkToPage = React.memo(({ match }) => ( component={RedirectToCreatePage} path={`${match.url}/:pageName(${SiemPageName.case})/create`} /> + ; +export const RedirectToConfigureCasesPage = () => ( + +); const baseCaseUrl = `#/link-to/${SiemPageName.case}`; export const getCaseUrl = () => baseCaseUrl; export const getCaseDetailsUrl = (detailName: string) => `${baseCaseUrl}/${detailName}`; export const getCreateCaseUrl = () => `${baseCaseUrl}/create`; +export const getConfigureCasesUrl = () => `${baseCaseUrl}/configure`; diff --git a/x-pack/legacy/plugins/siem/public/pages/case/case.tsx b/x-pack/legacy/plugins/siem/public/pages/case/case.tsx index 1206ec950deed..15a6d076f1009 100644 --- a/x-pack/legacy/plugins/siem/public/pages/case/case.tsx +++ b/x-pack/legacy/plugins/siem/public/pages/case/case.tsx @@ -6,30 +6,29 @@ import React from 'react'; -import { EuiButton, EuiFlexGroup } from '@elastic/eui'; -import { HeaderPage } from '../../components/header_page'; +import { EuiButton, EuiButtonIcon, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; +import { CaseHeaderPage } from './components/case_header_page'; import { WrapperPage } from '../../components/wrapper_page'; import { AllCases } from './components/all_cases'; import { SpyRoute } from '../../utils/route/spy_routes'; import * as i18n from './translations'; -import { getCreateCaseUrl } from '../../components/link_to'; - -const badgeOptions = { - beta: true, - text: i18n.PAGE_BADGE_LABEL, - tooltip: i18n.PAGE_BADGE_TOOLTIP, -}; +import { getCreateCaseUrl, getConfigureCasesUrl } from '../../components/link_to'; export const CasesPage = React.memo(() => ( <> - + - - {i18n.CREATE_TITLE} - + + + {i18n.CREATE_TITLE} + + + + + - + diff --git a/x-pack/legacy/plugins/siem/public/pages/case/components/case_header_page/index.tsx b/x-pack/legacy/plugins/siem/public/pages/case/components/case_header_page/index.tsx new file mode 100644 index 0000000000000..ae2664ca6e839 --- /dev/null +++ b/x-pack/legacy/plugins/siem/public/pages/case/components/case_header_page/index.tsx @@ -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; + * you may not use this file except in compliance with the Elastic License. + */ + +import React from 'react'; + +import { HeaderPage, HeaderPageProps } from '../../../../components/header_page'; +import * as i18n from './translations'; + +const CaseHeaderPageComponent: React.FC = props => ; + +CaseHeaderPageComponent.defaultProps = { + badgeOptions: { + beta: true, + text: i18n.PAGE_BADGE_LABEL, + tooltip: i18n.PAGE_BADGE_TOOLTIP, + }, +}; + +export const CaseHeaderPage = React.memo(CaseHeaderPageComponent); diff --git a/x-pack/legacy/plugins/siem/public/pages/case/components/case_header_page/translations.ts b/x-pack/legacy/plugins/siem/public/pages/case/components/case_header_page/translations.ts new file mode 100644 index 0000000000000..9fcad926c03b8 --- /dev/null +++ b/x-pack/legacy/plugins/siem/public/pages/case/components/case_header_page/translations.ts @@ -0,0 +1,16 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { i18n } from '@kbn/i18n'; + +export const PAGE_BADGE_LABEL = i18n.translate('xpack.siem.case.caseView.pageBadgeLabel', { + defaultMessage: 'Beta', +}); + +export const PAGE_BADGE_TOOLTIP = i18n.translate('xpack.siem.case.caseView.pageBadgeTooltip', { + defaultMessage: + 'Case Workflow is still in beta. Please help us improve by reporting issues or bugs in the Kibana repo.', +}); diff --git a/x-pack/legacy/plugins/siem/public/pages/case/components/case_view/index.tsx b/x-pack/legacy/plugins/siem/public/pages/case/components/case_view/index.tsx index 5cd71c5855d34..df3e30a698b56 100644 --- a/x-pack/legacy/plugins/siem/public/pages/case/components/case_view/index.tsx +++ b/x-pack/legacy/plugins/siem/public/pages/case/components/case_view/index.tsx @@ -34,6 +34,7 @@ import { UserActionTree } from '../user_action_tree'; import { UserList } from '../user_list'; import { useUpdateCase } from '../../../../containers/case/use_update_case'; import { WrapperPage } from '../../../../components/wrapper_page'; +import { WhitePageWrapper } from '../wrappers'; interface Props { caseId: string; @@ -52,14 +53,6 @@ const MyWrapper = styled(WrapperPage)` padding-bottom: 0; `; -const BackgroundWrapper = styled.div` - ${({ theme }) => css` - background-color: ${theme.eui.euiColorEmptyShade}; - border-top: ${theme.eui.euiBorderThin}; - height: 100%; - `} -`; - export interface CaseProps { caseId: string; initialData: Case; @@ -279,7 +272,7 @@ export const CaseComponent = React.memo(({ caseId, initialData, isLoa - + @@ -305,7 +298,7 @@ export const CaseComponent = React.memo(({ caseId, initialData, isLoa - + ); }); diff --git a/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/connectors.tsx b/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/connectors.tsx new file mode 100644 index 0000000000000..561464e44c703 --- /dev/null +++ b/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/connectors.tsx @@ -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; + * you may not use this file except in compliance with the Elastic License. + */ + +import React from 'react'; +import { + EuiDescribedFormGroup, + EuiFormRow, + EuiFlexGroup, + EuiFlexItem, + EuiLink, +} from '@elastic/eui'; + +import styled from 'styled-components'; + +import { ConnectorsDropdown } from './connectors_dropdown'; +import * as i18n from './translations'; + +const EuiFormRowExtended = styled(EuiFormRow)` + .euiFormRow__labelWrapper { + .euiFormRow__label { + width: 100%; + } + } +`; + +const ConnectorsComponent: React.FC = () => { + const dropDownLabel = ( + + {i18n.INCIDENT_MANAGEMENT_SYSTEM_LABEL} + + {i18n.ADD_NEW_CONNECTOR} + + + ); + + return ( + {i18n.INCIDENT_MANAGEMENT_SYSTEM_TITLE}} + description={i18n.INCIDENT_MANAGEMENT_SYSTEM_DESC} + > + + + + + ); +}; + +export const Connectors = React.memo(ConnectorsComponent); diff --git a/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/connectors_dropdown/index.tsx b/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/connectors_dropdown/index.tsx new file mode 100644 index 0000000000000..c00baa04d78a0 --- /dev/null +++ b/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/connectors_dropdown/index.tsx @@ -0,0 +1,56 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import React, { useState, useCallback } from 'react'; +import { EuiSuperSelect, EuiIcon, EuiSuperSelectOption } from '@elastic/eui'; +import styled from 'styled-components'; + +import * as i18n from '../translations'; + +const ICON_SIZE = 'm'; + +const EuiIconExtended = styled(EuiIcon)` + margin-right: 13px; +`; + +const connectors: Array> = [ + { + value: 'no-connector', + inputDisplay: ( + <> + + {i18n.NO_CONNECTOR} + + ), + 'data-test-subj': 'no-connector', + }, + { + value: 'servicenow-connector', + inputDisplay: ( + <> + + {'My ServiceNow connector'} + + ), + 'data-test-subj': 'servicenow-connector', + }, +]; + +const ConnectorsDropdownComponent: React.FC = () => { + const [selectedConnector, selectConnector] = useState(connectors[0].value); + const onChange = useCallback(connector => selectConnector(connector), [selectedConnector]); + + return ( + + ); +}; + +export const ConnectorsDropdown = React.memo(ConnectorsDropdownComponent); diff --git a/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/translations.ts b/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/translations.ts new file mode 100644 index 0000000000000..54d256b143f60 --- /dev/null +++ b/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/translations.ts @@ -0,0 +1,37 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { i18n } from '@kbn/i18n'; + +export const INCIDENT_MANAGEMENT_SYSTEM_TITLE = i18n.translate( + 'xpack.siem.case.configureCases.incidentManagementSystemTitle', + { + defaultMessage: 'Connect to third-party incident management system', + } +); + +export const INCIDENT_MANAGEMENT_SYSTEM_DESC = i18n.translate( + 'xpack.siem.case.configureCases.incidentManagementSystemDesc', + { + defaultMessage: + 'You may optionally connect SIEM cases to a third-party incident management system of your choosing. This will allow you to push case data as an incident in your chosen third-party system.', + } +); + +export const INCIDENT_MANAGEMENT_SYSTEM_LABEL = i18n.translate( + 'xpack.siem.case.configureCases.incidentManagementSystemLabel', + { + defaultMessage: 'Incident management system', + } +); + +export const NO_CONNECTOR = i18n.translate('xpack.siem.case.configureCases.noConnector', { + defaultMessage: 'No connector selected', +}); + +export const ADD_NEW_CONNECTOR = i18n.translate('xpack.siem.case.configureCases.addNewConnector', { + defaultMessage: 'Add new connector option', +}); diff --git a/x-pack/legacy/plugins/siem/public/pages/case/components/wrappers/index.tsx b/x-pack/legacy/plugins/siem/public/pages/case/components/wrappers/index.tsx new file mode 100644 index 0000000000000..772d78f948b79 --- /dev/null +++ b/x-pack/legacy/plugins/siem/public/pages/case/components/wrappers/index.tsx @@ -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; + * you may not use this file except in compliance with the Elastic License. + */ + +import styled, { css } from 'styled-components'; + +export const WhitePageWrapper = styled.div` + ${({ theme }) => css` + background-color: ${theme.eui.euiColorEmptyShade}; + border-top: ${theme.eui.euiBorderThin}; + height: 100%; + min-height: 100vh; + `} +`; + +export const SectionWrapper = styled.div` + box-sizing: content-box; + margin: 0 auto; + max-width: 1175px; +`; diff --git a/x-pack/legacy/plugins/siem/public/pages/case/configure_cases.tsx b/x-pack/legacy/plugins/siem/public/pages/case/configure_cases.tsx new file mode 100644 index 0000000000000..018f9dc9ade52 --- /dev/null +++ b/x-pack/legacy/plugins/siem/public/pages/case/configure_cases.tsx @@ -0,0 +1,54 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import React from 'react'; +import styled, { css } from 'styled-components'; + +import { WrapperPage } from '../../components/wrapper_page'; +import { CaseHeaderPage } from './components/case_header_page'; +import { SpyRoute } from '../../utils/route/spy_routes'; +import { getCaseUrl } from '../../components/link_to'; +import { WhitePageWrapper, SectionWrapper } from './components/wrappers'; +import { Connectors } from './components/configure_cases/connectors'; +import * as i18n from './translations'; + +const backOptions = { + href: getCaseUrl(), + text: i18n.BACK_TO_ALL, +}; + +const wrapperPageStyle: Record = { + paddingLeft: '0', + paddingRight: '0', + paddingBottom: '0', +}; + +export const FormWrapper = styled.div` + ${({ theme }) => css` + padding-top: ${theme.eui.paddingSizes.l}; + padding-bottom: ${theme.eui.paddingSizes.l}; + `} +`; + +const ConfigureCasesPageComponent: React.FC = () => ( + <> + + + + + + + + + + + + + + +); + +export const ConfigureCasesPage = React.memo(ConfigureCasesPageComponent); diff --git a/x-pack/legacy/plugins/siem/public/pages/case/create_case.tsx b/x-pack/legacy/plugins/siem/public/pages/case/create_case.tsx index 9bc356517cc68..2c7525264f71b 100644 --- a/x-pack/legacy/plugins/siem/public/pages/case/create_case.tsx +++ b/x-pack/legacy/plugins/siem/public/pages/case/create_case.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { WrapperPage } from '../../components/wrapper_page'; import { Create } from './components/create'; import { SpyRoute } from '../../utils/route/spy_routes'; -import { HeaderPage } from '../../components/header_page'; +import { CaseHeaderPage } from './components/case_header_page'; import * as i18n from './translations'; import { getCaseUrl } from '../../components/link_to'; @@ -17,15 +17,11 @@ const backOptions = { href: getCaseUrl(), text: i18n.BACK_TO_ALL, }; -const badgeOptions = { - beta: true, - text: i18n.PAGE_BADGE_LABEL, - tooltip: i18n.PAGE_BADGE_TOOLTIP, -}; + export const CreateCasePage = React.memo(() => ( <> - + diff --git a/x-pack/legacy/plugins/siem/public/pages/case/index.tsx b/x-pack/legacy/plugins/siem/public/pages/case/index.tsx index 9bd91b1c6d62d..1bde9de1535b5 100644 --- a/x-pack/legacy/plugins/siem/public/pages/case/index.tsx +++ b/x-pack/legacy/plugins/siem/public/pages/case/index.tsx @@ -11,10 +11,12 @@ import { SiemPageName } from '../home/types'; import { CaseDetailsPage } from './case_details'; import { CasesPage } from './case'; import { CreateCasePage } from './create_case'; +import { ConfigureCasesPage } from './configure_cases'; const casesPagePath = `/:pageName(${SiemPageName.case})`; const caseDetailsPagePath = `${casesPagePath}/:detailName`; const createCasePagePath = `${casesPagePath}/create`; +const configureCasesPagePath = `${casesPagePath}/configure`; const CaseContainerComponent: React.FC = () => ( @@ -24,6 +26,9 @@ const CaseContainerComponent: React.FC = () => ( + + + diff --git a/x-pack/legacy/plugins/siem/public/pages/case/translations.ts b/x-pack/legacy/plugins/siem/public/pages/case/translations.ts index 4e878ba58411e..265af0bde547f 100644 --- a/x-pack/legacy/plugins/siem/public/pages/case/translations.ts +++ b/x-pack/legacy/plugins/siem/public/pages/case/translations.ts @@ -57,15 +57,6 @@ export const LAST_UPDATED = i18n.translate('xpack.siem.case.caseView.updatedAt', defaultMessage: 'Last updated', }); -export const PAGE_BADGE_LABEL = i18n.translate('xpack.siem.case.caseView.pageBadgeLabel', { - defaultMessage: 'Beta', -}); - -export const PAGE_BADGE_TOOLTIP = i18n.translate('xpack.siem.case.caseView.pageBadgeTooltip', { - defaultMessage: - 'Case Workflow is still in beta. Please help us improve by reporting issues or bugs in the Kibana repo.', -}); - export const PAGE_SUBTITLE = i18n.translate('xpack.siem.case.caseView.pageSubtitle', { defaultMessage: 'Case Workflow Management within the Elastic SIEM', }); @@ -102,3 +93,14 @@ export const NO_TAGS = i18n.translate('xpack.siem.case.caseView.noTags', { export const TITLE_REQUIRED = i18n.translate('xpack.siem.case.createCase.titleFieldRequiredError', { defaultMessage: 'A title is required.', }); + +export const CONFIGURE_CASES_PAGE_TITLE = i18n.translate( + 'xpack.siem.case.configureCases.headerTitle', + { + defaultMessage: 'Configure cases', + } +); + +export const CONFIGURE_CASES_BUTTON = i18n.translate('xpack.siem.case.configureCasesButton', { + defaultMessage: 'Configure cases', +}); diff --git a/x-pack/legacy/plugins/siem/public/pages/home/index.tsx b/x-pack/legacy/plugins/siem/public/pages/home/index.tsx index 806f6c7937077..5d20993144af9 100644 --- a/x-pack/legacy/plugins/siem/public/pages/home/index.tsx +++ b/x-pack/legacy/plugins/siem/public/pages/home/index.tsx @@ -21,6 +21,7 @@ import { AutoSaveWarningMsg } from '../../components/timeline/auto_save_warning' import { UseUrlState } from '../../components/url_state'; import { useWithSource } from '../../containers/source'; import { SpyRoute } from '../../utils/route/spy_routes'; +import { useShowTimeline } from '../../utils/timeline/use_show_timeline'; import { NotFoundPage } from '../404'; import { DetectionEngineContainer } from '../detection_engine'; import { HostsContainer } from '../hosts'; @@ -74,6 +75,8 @@ export const HomePageComponent = () => { const { browserFields, indexPattern, contentAvailable } = useWithSource(); + const [showTimeline] = useShowTimeline(); + return ( @@ -81,7 +84,7 @@ export const HomePageComponent = () => {
- {contentAvailable && ( + {contentAvailable && showTimeline && ( <> { + const currentLocation = useLocation(); + const [showTimeline, setShowTimeline] = useState( + !hideTimelineForRoutes.includes(currentLocation.pathname) + ); + + useEffect(() => { + if (hideTimelineForRoutes.includes(currentLocation.pathname)) { + if (showTimeline) { + setShowTimeline(false); + } + } else if (!showTimeline) { + setShowTimeline(true); + } + }, [currentLocation.pathname]); + + return [showTimeline]; +}; From 8f9004b661eb48ff841872b89fe076af3481ec3a Mon Sep 17 00:00:00 2001 From: Walter Rafelsberger Date: Fri, 28 Feb 2020 14:27:57 +0100 Subject: [PATCH 03/31] [ML] Transforms: NP ui/imports migration (#58469) - Migrates ui/* imports to NP. - Uses direct React mounting instead of Angular. - Service Cleanup. --- .../public/__mocks__/shared_imports.ts | 7 + .../plugins/transform/public/app/app.tsx | 49 ++++--- .../transform/public/app/app_dependencies.tsx | 43 +++--- .../public/app/common/navigation.tsx | 4 +- .../public/app/components/section_error.tsx | 30 +--- .../toast_notification_text.test.tsx | 25 +++- .../components/toast_notification_text.tsx | 9 +- .../transform/public/app/constants/index.ts | 2 +- .../transform/public/app/hooks/index.ts | 1 + .../transform/public/app/hooks/use_api.ts | 10 +- .../public/app/hooks/use_delete_transform.tsx | 7 +- .../transform/public/app/hooks/use_request.ts | 16 +++ .../public/app/hooks/use_start_transform.ts | 3 +- .../public/app/hooks/use_stop_transform.ts | 3 +- .../components/authorization_provider.tsx | 14 +- .../public/app/lib/kibana/kibana_context.tsx | 1 - .../public/app/lib/kibana/kibana_provider.tsx | 10 +- .../clone_transform_section.tsx | 16 ++- .../source_index_preview.test.tsx | 2 - .../step_create/step_create_form.test.tsx | 2 - .../step_create/step_create_form.tsx | 15 +- .../step_define/pivot_preview.test.tsx | 2 - .../step_define/step_define_form.test.tsx | 76 +++++++--- .../step_define/step_define_form.tsx | 78 +++++----- .../step_define/step_define_summary.test.tsx | 2 - .../step_details/step_details_form.tsx | 10 +- .../create_transform_section.tsx | 7 +- .../create_transform_button.test.tsx | 2 - .../transform_list/action_clone.tsx | 2 +- .../transform_list/action_delete.test.tsx | 1 - .../transform_list/action_start.test.tsx | 1 - .../transform_list/action_stop.test.tsx | 1 - .../transform_list/actions.test.tsx | 2 - .../transform_list/columns.test.tsx | 2 - .../transform_list.test.mocks.ts | 15 -- .../transform_list/transform_list.test.tsx | 3 - .../transform_list/use_refresh_interval.ts | 62 +------- .../transform_management_section.test.tsx | 5 - .../transform_management_section.tsx | 6 +- .../documentation/documentation_links.ts | 20 --- .../app/services/documentation/index.ts | 7 - .../public/app/services/http/http.ts | 18 --- .../public/app/services/http/index.ts | 6 - .../public/app/services/http/use_request.ts | 22 --- .../public/app/services/http_service.ts | 81 ++++++----- .../app/services/navigation/breadcrumb.ts | 22 ++- .../legacy/plugins/transform/public/plugin.ts | 136 +++++++----------- .../transform/public/shared_imports.ts | 2 +- .../legacy/plugins/transform/public/shim.ts | 106 ++++++-------- 49 files changed, 422 insertions(+), 544 deletions(-) create mode 100644 x-pack/legacy/plugins/transform/public/app/hooks/use_request.ts delete mode 100644 x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/transform_list.test.mocks.ts delete mode 100644 x-pack/legacy/plugins/transform/public/app/services/documentation/documentation_links.ts delete mode 100644 x-pack/legacy/plugins/transform/public/app/services/documentation/index.ts delete mode 100644 x-pack/legacy/plugins/transform/public/app/services/http/http.ts delete mode 100644 x-pack/legacy/plugins/transform/public/app/services/http/index.ts delete mode 100644 x-pack/legacy/plugins/transform/public/app/services/http/use_request.ts diff --git a/x-pack/legacy/plugins/transform/public/__mocks__/shared_imports.ts b/x-pack/legacy/plugins/transform/public/__mocks__/shared_imports.ts index b55a4cd5c7bd6..aa130b5030fc7 100644 --- a/x-pack/legacy/plugins/transform/public/__mocks__/shared_imports.ts +++ b/x-pack/legacy/plugins/transform/public/__mocks__/shared_imports.ts @@ -4,7 +4,14 @@ * you may not use this file except in compliance with the Elastic License. */ +jest.mock('ui/new_platform'); + export function XJsonMode() {} export function setDependencyCache() {} +export const useRequest = () => ({ + isLoading: false, + error: null, + data: undefined, +}); export { mlInMemoryTableBasicFactory } from '../../../ml/public/application/components/ml_in_memory_table'; export const SORT_DIRECTION = { ASC: 'asc' }; diff --git a/x-pack/legacy/plugins/transform/public/app/app.tsx b/x-pack/legacy/plugins/transform/public/app/app.tsx index 0f21afbcccca8..efbaabe447efa 100644 --- a/x-pack/legacy/plugins/transform/public/app/app.tsx +++ b/x-pack/legacy/plugins/transform/public/app/app.tsx @@ -5,8 +5,8 @@ */ import React, { useContext, FC } from 'react'; -import { render } from 'react-dom'; -import { Redirect, Route, Switch } from 'react-router-dom'; +import { render, unmountComponentAtNode } from 'react-dom'; +import { HashRouter, Redirect, Route, Switch } from 'react-router-dom'; import { FormattedMessage } from '@kbn/i18n/react'; @@ -22,8 +22,7 @@ import { TransformManagementSection } from './sections/transform_management'; export const App: FC = () => { const { apiError } = useContext(AuthorizationContext); - - if (apiError) { + if (apiError !== null) { return ( { return (
- - - - - - + + + + + + + +
); }; -export const renderReact = (elem: Element, appDependencies: AppDependencies) => { +export const renderApp = (element: HTMLElement, appDependencies: AppDependencies) => { const Providers = getAppProviders(appDependencies); render( , - elem + element ); + + return () => { + unmountComponentAtNode(element); + }; }; diff --git a/x-pack/legacy/plugins/transform/public/app/app_dependencies.tsx b/x-pack/legacy/plugins/transform/public/app/app_dependencies.tsx index 282d1380b396b..21ffbf5911a21 100644 --- a/x-pack/legacy/plugins/transform/public/app/app_dependencies.tsx +++ b/x-pack/legacy/plugins/transform/public/app/app_dependencies.tsx @@ -7,9 +7,6 @@ import React, { createContext, useContext, ReactNode } from 'react'; import { HashRouter } from 'react-router-dom'; -import chrome from 'ui/chrome'; -import { metadata } from 'ui/metadata'; - import { API_BASE_PATH } from '../../common/constants'; import { setDependencyCache } from '../shared_imports'; @@ -17,24 +14,20 @@ import { AppDependencies } from '../shim'; import { AuthorizationProvider } from './lib/authorization'; -const legacyBasePath = { - prepend: chrome.addBasePath, - get: chrome.getBasePath, - remove: () => {}, -}; -const legacyDocLinks = { - ELASTIC_WEBSITE_URL: 'https://www.elastic.co/', - DOC_LINK_VERSION: metadata.branch, -}; - let DependenciesContext: React.Context; const setAppDependencies = (deps: AppDependencies) => { + const legacyBasePath = { + prepend: deps.core.http.basePath.prepend, + get: deps.core.http.basePath.get, + remove: () => {}, + }; + setDependencyCache({ autocomplete: deps.plugins.data.autocomplete, - docLinks: legacyDocLinks as any, + docLinks: deps.core.docLinks, basePath: legacyBasePath as any, - XSRF: chrome.getXsrfToken(), + XSRF: deps.plugins.xsrfToken, }); DependenciesContext = createContext(deps); return DependenciesContext.Provider; @@ -48,6 +41,22 @@ export const useAppDependencies = () => { return useContext(DependenciesContext); }; +export const useDocumentationLinks = () => { + const { + core: { documentation }, + } = useAppDependencies(); + return documentation; +}; + +export const useToastNotifications = () => { + const { + core: { + notifications: { toasts: toastNotifications }, + }, + } = useAppDependencies(); + return toastNotifications; +}; + export const getAppProviders = (deps: AppDependencies) => { const I18nContext = deps.core.i18n.Context; @@ -55,9 +64,7 @@ export const getAppProviders = (deps: AppDependencies) => { const AppDependenciesProvider = setAppDependencies(deps); return ({ children }: { children: ReactNode }) => ( - + {children} diff --git a/x-pack/legacy/plugins/transform/public/app/common/navigation.tsx b/x-pack/legacy/plugins/transform/public/app/common/navigation.tsx index ac98d92fdba83..15966a93e1f42 100644 --- a/x-pack/legacy/plugins/transform/public/app/common/navigation.tsx +++ b/x-pack/legacy/plugins/transform/public/app/common/navigation.tsx @@ -29,9 +29,9 @@ export function getDiscoverUrl(indexPatternId: string, baseUrl: string): string } export const RedirectToTransformManagement: FC = () => ( - + ); export const RedirectToCreateTransform: FC<{ savedObjectId: string }> = ({ savedObjectId }) => ( - + ); diff --git a/x-pack/legacy/plugins/transform/public/app/components/section_error.tsx b/x-pack/legacy/plugins/transform/public/app/components/section_error.tsx index 2ad6f0870c140..4bef917a91a18 100644 --- a/x-pack/legacy/plugins/transform/public/app/components/section_error.tsx +++ b/x-pack/legacy/plugins/transform/public/app/components/section_error.tsx @@ -4,18 +4,12 @@ * you may not use this file except in compliance with the Elastic License. */ -import { EuiCallOut, EuiSpacer } from '@elastic/eui'; -import React, { Fragment } from 'react'; +import { EuiCallOut } from '@elastic/eui'; +import React from 'react'; interface Props { title: React.ReactNode; - error: { - data: { - error: string; - cause?: string[]; - message?: string; - }; - }; + error: Error | null; actions?: JSX.Element; } @@ -25,25 +19,11 @@ export const SectionError: React.FunctionComponent = ({ actions, ...rest }) => { - const { - error: errorString, - cause, // wrapEsError() on the server adds a "cause" array - message, - } = error.data; + const errorMessage = error?.message ?? JSON.stringify(error, null, 2); return ( - {cause ? message || errorString :

{message || errorString}

} - {cause && ( - - -
    - {cause.map((causeMsg, i) => ( -
  • {causeMsg}
  • - ))} -
-
- )} +
{errorMessage}
{actions ? actions : null}
); diff --git a/x-pack/legacy/plugins/transform/public/app/components/toast_notification_text.test.tsx b/x-pack/legacy/plugins/transform/public/app/components/toast_notification_text.test.tsx index 904d788b04e2c..81af5c974fe04 100644 --- a/x-pack/legacy/plugins/transform/public/app/components/toast_notification_text.test.tsx +++ b/x-pack/legacy/plugins/transform/public/app/components/toast_notification_text.test.tsx @@ -6,23 +6,44 @@ import React from 'react'; import { render } from '@testing-library/react'; + +import { KibanaContext } from '../lib/kibana'; +import { createPublicShim } from '../../shim'; +import { getAppProviders } from '../app_dependencies'; + import { ToastNotificationText } from './toast_notification_text'; +jest.mock('../../shared_imports'); + describe('ToastNotificationText', () => { test('should render the text as plain text', () => { + const Providers = getAppProviders(createPublicShim()); const props = { text: 'a short text message', }; - const { container } = render(); + const { container } = render( + + + + + + ); expect(container.textContent).toBe('a short text message'); }); test('should render the text within a modal', () => { + const Providers = getAppProviders(createPublicShim()); const props = { text: 'a text message that is longer than 140 characters. a text message that is longer than 140 characters. a text message that is longer than 140 characters. ', }; - const { container } = render(); + const { container } = render( + + + + + + ); expect(container.textContent).toBe( 'a text message that is longer than 140 characters. a text message that is longer than 140 characters. a text message that is longer than 140 ...View details' ); diff --git a/x-pack/legacy/plugins/transform/public/app/components/toast_notification_text.tsx b/x-pack/legacy/plugins/transform/public/app/components/toast_notification_text.tsx index c79bf52a86642..4e0a0a12558d8 100644 --- a/x-pack/legacy/plugins/transform/public/app/components/toast_notification_text.tsx +++ b/x-pack/legacy/plugins/transform/public/app/components/toast_notification_text.tsx @@ -18,12 +18,17 @@ import { import { i18n } from '@kbn/i18n'; -import { npStart } from 'ui/new_platform'; import { toMountPoint } from '../../../../../../../src/plugins/kibana_react/public'; +import { useAppDependencies } from '../app_dependencies'; + const MAX_SIMPLE_MESSAGE_LENGTH = 140; export const ToastNotificationText: FC<{ text: any }> = ({ text }) => { + const { + core: { overlays }, + } = useAppDependencies(); + if (typeof text === 'string' && text.length <= MAX_SIMPLE_MESSAGE_LENGTH) { return text; } @@ -43,7 +48,7 @@ export const ToastNotificationText: FC<{ text: any }> = ({ text }) => { }`; const openModal = () => { - const modal = npStart.core.overlays.openModal( + const modal = overlays.openModal( toMountPoint( modal.close()}> diff --git a/x-pack/legacy/plugins/transform/public/app/constants/index.ts b/x-pack/legacy/plugins/transform/public/app/constants/index.ts index 78b5f018dd782..5d71980c83714 100644 --- a/x-pack/legacy/plugins/transform/public/app/constants/index.ts +++ b/x-pack/legacy/plugins/transform/public/app/constants/index.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -export const CLIENT_BASE_PATH = '/management/elasticsearch/transform'; +export const CLIENT_BASE_PATH = '/management/elasticsearch/transform/'; export enum SECTION_SLUG { HOME = 'transform_management', diff --git a/x-pack/legacy/plugins/transform/public/app/hooks/index.ts b/x-pack/legacy/plugins/transform/public/app/hooks/index.ts index 7981f560a525f..a36550bcd8e57 100644 --- a/x-pack/legacy/plugins/transform/public/app/hooks/index.ts +++ b/x-pack/legacy/plugins/transform/public/app/hooks/index.ts @@ -9,3 +9,4 @@ export { useGetTransforms } from './use_get_transforms'; export { useDeleteTransforms } from './use_delete_transform'; export { useStartTransforms } from './use_start_transform'; export { useStopTransforms } from './use_stop_transform'; +export { useRequest } from './use_request'; diff --git a/x-pack/legacy/plugins/transform/public/app/hooks/use_api.ts b/x-pack/legacy/plugins/transform/public/app/hooks/use_api.ts index c71299eccb34d..802599aaedd4f 100644 --- a/x-pack/legacy/plugins/transform/public/app/hooks/use_api.ts +++ b/x-pack/legacy/plugins/transform/public/app/hooks/use_api.ts @@ -5,14 +5,12 @@ */ import { useAppDependencies } from '../app_dependencies'; - import { PreviewRequestBody, TransformId } from '../common'; - -import { http } from '../services/http_service'; +import { httpFactory, Http } from '../services/http_service'; import { EsIndex, TransformEndpointRequest, TransformEndpointResult } from './use_api_types'; -const apiFactory = (basePath: string, indicesBasePath: string) => ({ +const apiFactory = (basePath: string, indicesBasePath: string, http: Http) => ({ getTransforms(transformId?: TransformId): Promise { const transformIdString = transformId !== undefined ? `/${transformId}` : ''; return http({ @@ -98,6 +96,8 @@ export const useApi = () => { const basePath = appDeps.core.http.basePath.prepend('/api/transform'); const indicesBasePath = appDeps.core.http.basePath.prepend('/api'); + const xsrfToken = appDeps.plugins.xsrfToken; + const http = httpFactory(xsrfToken); - return apiFactory(basePath, indicesBasePath); + return apiFactory(basePath, indicesBasePath, http); }; diff --git a/x-pack/legacy/plugins/transform/public/app/hooks/use_delete_transform.tsx b/x-pack/legacy/plugins/transform/public/app/hooks/use_delete_transform.tsx index e23151900447c..83f456231cb85 100644 --- a/x-pack/legacy/plugins/transform/public/app/hooks/use_delete_transform.tsx +++ b/x-pack/legacy/plugins/transform/public/app/hooks/use_delete_transform.tsx @@ -7,9 +7,9 @@ import React from 'react'; import { i18n } from '@kbn/i18n'; -import { toastNotifications } from 'ui/notify'; import { toMountPoint } from '../../../../../../../src/plugins/kibana_react/public'; +import { useToastNotifications } from '../app_dependencies'; import { TransformListRow, refreshTransformList$, REFRESH_TRANSFORM_LIST_STATE } from '../common'; import { ToastNotificationText } from '../components'; @@ -17,6 +17,7 @@ import { useApi } from './use_api'; import { TransformEndpointRequest, TransformEndpointResult } from './use_api_types'; export const useDeleteTransforms = () => { + const toastNotifications = useToastNotifications(); const api = useApi(); return async (transforms: TransformListRow[]) => { @@ -54,7 +55,9 @@ export const useDeleteTransforms = () => { title: i18n.translate('xpack.transform.transformList.deleteTransformGenericErrorMessage', { defaultMessage: 'An error occurred calling the API endpoint to delete transforms.', }), - text: toMountPoint(), + text: toMountPoint( + + ), }); } }; diff --git a/x-pack/legacy/plugins/transform/public/app/hooks/use_request.ts b/x-pack/legacy/plugins/transform/public/app/hooks/use_request.ts new file mode 100644 index 0000000000000..8c489048a77ef --- /dev/null +++ b/x-pack/legacy/plugins/transform/public/app/hooks/use_request.ts @@ -0,0 +1,16 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { UseRequestConfig, useRequest as _useRequest } from '../../shared_imports'; + +import { useAppDependencies } from '../app_dependencies'; + +export const useRequest = (config: UseRequestConfig) => { + const { + core: { http }, + } = useAppDependencies(); + return _useRequest(http, config); +}; diff --git a/x-pack/legacy/plugins/transform/public/app/hooks/use_start_transform.ts b/x-pack/legacy/plugins/transform/public/app/hooks/use_start_transform.ts index d6b216accebd9..f460d8200c6e4 100644 --- a/x-pack/legacy/plugins/transform/public/app/hooks/use_start_transform.ts +++ b/x-pack/legacy/plugins/transform/public/app/hooks/use_start_transform.ts @@ -5,14 +5,15 @@ */ import { i18n } from '@kbn/i18n'; -import { toastNotifications } from 'ui/notify'; +import { useToastNotifications } from '../app_dependencies'; import { TransformListRow, refreshTransformList$, REFRESH_TRANSFORM_LIST_STATE } from '../common'; import { useApi } from './use_api'; import { TransformEndpointRequest, TransformEndpointResult } from './use_api_types'; export const useStartTransforms = () => { + const toastNotifications = useToastNotifications(); const api = useApi(); return async (transforms: TransformListRow[]) => { diff --git a/x-pack/legacy/plugins/transform/public/app/hooks/use_stop_transform.ts b/x-pack/legacy/plugins/transform/public/app/hooks/use_stop_transform.ts index bf6edf995bb1f..758c574a3f7cd 100644 --- a/x-pack/legacy/plugins/transform/public/app/hooks/use_stop_transform.ts +++ b/x-pack/legacy/plugins/transform/public/app/hooks/use_stop_transform.ts @@ -5,14 +5,15 @@ */ import { i18n } from '@kbn/i18n'; -import { toastNotifications } from 'ui/notify'; +import { useToastNotifications } from '../app_dependencies'; import { TransformListRow, refreshTransformList$, REFRESH_TRANSFORM_LIST_STATE } from '../common'; import { useApi } from './use_api'; import { TransformEndpointRequest, TransformEndpointResult } from './use_api_types'; export const useStopTransforms = () => { + const toastNotifications = useToastNotifications(); const api = useApi(); return async (transforms: TransformListRow[]) => { diff --git a/x-pack/legacy/plugins/transform/public/app/lib/authorization/components/authorization_provider.tsx b/x-pack/legacy/plugins/transform/public/app/lib/authorization/components/authorization_provider.tsx index 8060659c78b80..dde63710f56aa 100644 --- a/x-pack/legacy/plugins/transform/public/app/lib/authorization/components/authorization_provider.tsx +++ b/x-pack/legacy/plugins/transform/public/app/lib/authorization/components/authorization_provider.tsx @@ -5,20 +5,12 @@ */ import React, { createContext } from 'react'; -import { useRequest } from '../../../services/http/use_request'; +import { useRequest } from '../../../hooks'; import { hasPrivilegeFactory, Capabilities, Privileges } from './common'; -interface ApiError { - data: { - error: string; - cause?: string[]; - message?: string; - }; -} - interface Authorization { isLoading: boolean; - apiError: ApiError | null; + apiError: Error | null; privileges: Privileges; capabilities: Capabilities; } @@ -58,7 +50,7 @@ export const AuthorizationProvider = ({ privilegesEndpoint, children }: Props) = isLoading, privileges: isLoading ? { ...initialValue.privileges } : privilegesData, capabilities: { ...initialCapabalities }, - apiError: error ? (error as ApiError) : null, + apiError: error ? (error as Error) : null, }; const hasPrivilege = hasPrivilegeFactory(value.privileges); diff --git a/x-pack/legacy/plugins/transform/public/app/lib/kibana/kibana_context.tsx b/x-pack/legacy/plugins/transform/public/app/lib/kibana/kibana_context.tsx index b0a0371d2de86..3acec1ea0e809 100644 --- a/x-pack/legacy/plugins/transform/public/app/lib/kibana/kibana_context.tsx +++ b/x-pack/legacy/plugins/transform/public/app/lib/kibana/kibana_context.tsx @@ -22,7 +22,6 @@ export interface InitializedKibanaContextValue { combinedQuery: any; indexPatterns: IndexPatternsContract; initialized: true; - kbnBaseUrl: string; kibanaConfig: IUiSettingsClient; currentIndexPattern: IndexPattern; currentSavedSearch?: SavedSearch; diff --git a/x-pack/legacy/plugins/transform/public/app/lib/kibana/kibana_provider.tsx b/x-pack/legacy/plugins/transform/public/app/lib/kibana/kibana_provider.tsx index d2cf5f2b32910..f2574a4a85f29 100644 --- a/x-pack/legacy/plugins/transform/public/app/lib/kibana/kibana_provider.tsx +++ b/x-pack/legacy/plugins/transform/public/app/lib/kibana/kibana_provider.tsx @@ -6,8 +6,6 @@ import React, { useEffect, useState, FC } from 'react'; -import { npStart } from 'ui/new_platform'; - import { useAppDependencies } from '../../app_dependencies'; import { @@ -19,15 +17,14 @@ import { import { InitializedKibanaContextValue, KibanaContext, KibanaContextValue } from './kibana_context'; -const indexPatterns = npStart.plugins.data.indexPatterns; -const savedObjectsClient = npStart.core.savedObjects.client; - interface Props { savedObjectId: string; } export const KibanaProvider: FC = ({ savedObjectId, children }) => { const appDeps = useAppDependencies(); + const indexPatterns = appDeps.plugins.data.indexPatterns; + const savedObjectsClient = appDeps.core.savedObjects.client; const savedSearches = appDeps.plugins.savedSearches.getClient(); const [contextValue, setContextValue] = useState({ initialized: false }); @@ -50,7 +47,7 @@ export const KibanaProvider: FC = ({ savedObjectId, children }) => { // Just let fetchedSavedSearch stay undefined in case it doesn't exist. } - const kibanaConfig = npStart.core.uiSettings; + const kibanaConfig = appDeps.core.uiSettings; const { indexPattern: currentIndexPattern, @@ -61,7 +58,6 @@ export const KibanaProvider: FC = ({ savedObjectId, children }) => { const kibanaContext: InitializedKibanaContextValue = { indexPatterns, initialized: true, - kbnBaseUrl: npStart.core.injectedMetadata.getBasePath(), kibanaConfig, combinedQuery, currentIndexPattern, diff --git a/x-pack/legacy/plugins/transform/public/app/sections/clone_transform/clone_transform_section.tsx b/x-pack/legacy/plugins/transform/public/app/sections/clone_transform/clone_transform_section.tsx index de96a4de32962..8f58bc94e7c12 100644 --- a/x-pack/legacy/plugins/transform/public/app/sections/clone_transform/clone_transform_section.tsx +++ b/x-pack/legacy/plugins/transform/public/app/sections/clone_transform/clone_transform_section.tsx @@ -22,14 +22,13 @@ import { EuiTitle, } from '@elastic/eui'; -import { npStart } from 'ui/new_platform'; - import { useApi } from '../../hooks/use_api'; import { APP_CREATE_TRANSFORM_CLUSTER_PRIVILEGES } from '../../../../common/constants'; + +import { useAppDependencies, useDocumentationLinks } from '../../app_dependencies'; import { TransformPivotConfig } from '../../common'; import { breadcrumbService, docTitleService, BREADCRUMB_SECTION } from '../../services/navigation'; -import { documentationLinksService } from '../../services/documentation'; import { PrivilegesWrapper } from '../../lib/authorization'; import { getIndexPatternIdByTitle, @@ -40,9 +39,6 @@ import { import { Wizard } from '../create_transform/components/wizard'; -const indexPatterns = npStart.plugins.data.indexPatterns; -const savedObjectsClient = npStart.core.savedObjects.client; - interface GetTransformsResponseOk { count: number; transforms: TransformPivotConfig[]; @@ -74,6 +70,12 @@ export const CloneTransformSection: FC = ({ match }) => { const api = useApi(); + const appDeps = useAppDependencies(); + const savedObjectsClient = appDeps.core.savedObjects.client; + const indexPatterns = appDeps.plugins.data.indexPatterns; + + const { esTransform } = useDocumentationLinks(); + const transformId = match.params.transformId; const [transformConfig, setTransformConfig] = useState(); @@ -154,7 +156,7 @@ export const CloneTransformSection: FC = ({ match }) => { { const r = jest.requireActual('react'); diff --git a/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_create/step_create_form.test.tsx b/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_create/step_create_form.test.tsx index a0c91c070844b..625c545ee8c46 100644 --- a/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_create/step_create_form.test.tsx +++ b/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_create/step_create_form.test.tsx @@ -11,8 +11,6 @@ import { KibanaContext } from '../../../../lib/kibana'; import { StepCreateForm } from './step_create_form'; -jest.mock('ui/new_platform'); - // workaround to make React.memo() work with enzyme jest.mock('react', () => { const r = jest.requireActual('react'); diff --git a/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_create/step_create_form.tsx b/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_create/step_create_form.tsx index 2ca3253d72b44..312d8a30dab77 100644 --- a/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_create/step_create_form.tsx +++ b/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_create/step_create_form.tsx @@ -6,7 +6,6 @@ import React, { Fragment, FC, useEffect, useState } from 'react'; import { i18n } from '@kbn/i18n'; -import { toastNotifications } from 'ui/notify'; import { EuiButton, @@ -30,13 +29,15 @@ import { } from '@elastic/eui'; import { toMountPoint } from '../../../../../../../../../../src/plugins/kibana_react/public'; -import { ToastNotificationText } from '../../../../components'; -import { useApi } from '../../../../hooks/use_api'; -import { useKibanaContext } from '../../../../lib/kibana'; -import { RedirectToTransformManagement } from '../../../../common/navigation'; + import { PROGRESS_REFRESH_INTERVAL_MS } from '../../../../../../common/constants'; import { getTransformProgress, getDiscoverUrl } from '../../../../common'; +import { useApi } from '../../../../hooks/use_api'; +import { useKibanaContext } from '../../../../lib/kibana'; +import { useAppDependencies, useToastNotifications } from '../../../../app_dependencies'; +import { RedirectToTransformManagement } from '../../../../common/navigation'; +import { ToastNotificationText } from '../../../../components'; export interface StepDetailsExposedState { created: boolean; @@ -73,7 +74,9 @@ export const StepCreateForm: FC = React.memo( undefined ); + const deps = useAppDependencies(); const kibanaContext = useKibanaContext(); + const toastNotifications = useToastNotifications(); useEffect(() => { onChange({ created, started, indexPatternId }); @@ -437,7 +440,7 @@ export const StepCreateForm: FC = React.memo( defaultMessage: 'Use Discover to explore the transform.', } )} - href={getDiscoverUrl(indexPatternId, kibanaContext.kbnBaseUrl)} + href={getDiscoverUrl(indexPatternId, deps.core.http.basePath.get())} data-test-subj="transformWizardCardDiscover" /> diff --git a/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_define/pivot_preview.test.tsx b/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_define/pivot_preview.test.tsx index a2aa056c1634d..2ac4295da1eed 100644 --- a/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_define/pivot_preview.test.tsx +++ b/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_define/pivot_preview.test.tsx @@ -19,8 +19,6 @@ import { import { PivotPreview } from './pivot_preview'; -jest.mock('ui/new_platform'); - // workaround to make React.memo() work with enzyme jest.mock('react', () => { const r = jest.requireActual('react'); diff --git a/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_define/step_define_form.test.tsx b/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_define/step_define_form.test.tsx index 0311b26304c30..44edd1340e8d6 100644 --- a/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_define/step_define_form.test.tsx +++ b/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_define/step_define_form.test.tsx @@ -15,9 +15,7 @@ import { PIVOT_SUPPORTED_AGGS, PIVOT_SUPPORTED_GROUP_BY_AGGS, } from '../../../../common'; -import { StepDefineForm, isAggNameConflict } from './step_define_form'; - -jest.mock('ui/new_platform'); +import { StepDefineForm, getAggNameConflictToastMessages } from './step_define_form'; // workaround to make React.memo() work with enzyme jest.mock('react', () => { @@ -76,38 +74,78 @@ describe('Transform: isAggNameConflict()', () => { }; // no conflict, completely different name, no namespacing involved - expect(isAggNameConflict('the-other-agg-name', aggList, groupByList)).toBe(false); + expect( + getAggNameConflictToastMessages('the-other-agg-name', aggList, groupByList) + ).toHaveLength(0); // no conflict, completely different name and no conflicting namespace - expect(isAggNameConflict('the-other-agg-name.namespace', aggList, groupByList)).toBe(false); + expect( + getAggNameConflictToastMessages('the-other-agg-name.namespace', aggList, groupByList) + ).toHaveLength(0); // exact match conflict on aggregation name - expect(isAggNameConflict('the-agg-name', aggList, groupByList)).toBe(true); + expect(getAggNameConflictToastMessages('the-agg-name', aggList, groupByList)).toStrictEqual([ + `An aggregation configuration with the name 'the-agg-name' already exists.`, + ]); // namespace conflict with `the-agg-name` aggregation - expect(isAggNameConflict('the-agg-name.namespace', aggList, groupByList)).toBe(true); + expect( + getAggNameConflictToastMessages('the-agg-name.namespace', aggList, groupByList) + ).toStrictEqual([ + `Couldn't add configuration 'the-agg-name.namespace' because of a nesting conflict with 'the-agg-name'.`, + ]); // exact match conflict on group-by name - expect(isAggNameConflict('the-group-by-agg-name', aggList, groupByList)).toBe(true); + expect( + getAggNameConflictToastMessages('the-group-by-agg-name', aggList, groupByList) + ).toStrictEqual([ + `A group by configuration with the name 'the-group-by-agg-name' already exists.`, + ]); // namespace conflict with `the-group-by-agg-name` group-by - expect(isAggNameConflict('the-group-by-agg-name.namespace', aggList, groupByList)).toBe(true); + expect( + getAggNameConflictToastMessages('the-group-by-agg-name.namespace', aggList, groupByList) + ).toStrictEqual([ + `Couldn't add configuration 'the-group-by-agg-name.namespace' because of a nesting conflict with 'the-group-by-agg-name'.`, + ]); // exact match conflict on namespaced agg name - expect(isAggNameConflict('the-namespaced-agg-name.namespace', aggList, groupByList)).toBe(true); + expect( + getAggNameConflictToastMessages('the-namespaced-agg-name.namespace', aggList, groupByList) + ).toStrictEqual([ + `An aggregation configuration with the name 'the-namespaced-agg-name.namespace' already exists.`, + ]); // no conflict, same base agg name but different namespace - expect(isAggNameConflict('the-namespaced-agg-name.namespace2', aggList, groupByList)).toBe( - false - ); + expect( + getAggNameConflictToastMessages('the-namespaced-agg-name.namespace2', aggList, groupByList) + ).toHaveLength(0); // namespace conflict because the new agg name is base name of existing nested field - expect(isAggNameConflict('the-namespaced-agg-name', aggList, groupByList)).toBe(true); + expect( + getAggNameConflictToastMessages('the-namespaced-agg-name', aggList, groupByList) + ).toStrictEqual([ + `Couldn't add configuration 'the-namespaced-agg-name' because of a nesting conflict with 'the-namespaced-agg-name.namespace'.`, + ]); // exact match conflict on namespaced group-by name expect( - isAggNameConflict('the-namespaced-group-by-agg-name.namespace', aggList, groupByList) - ).toBe(true); + getAggNameConflictToastMessages( + 'the-namespaced-group-by-agg-name.namespace', + aggList, + groupByList + ) + ).toStrictEqual([ + `A group by configuration with the name 'the-namespaced-group-by-agg-name.namespace' already exists.`, + ]); // no conflict, same base group-by name but different namespace expect( - isAggNameConflict('the-namespaced-group-by-agg-name.namespace2', aggList, groupByList) - ).toBe(false); + getAggNameConflictToastMessages( + 'the-namespaced-group-by-agg-name.namespace2', + aggList, + groupByList + ) + ).toHaveLength(0); // namespace conflict because the new group-by name is base name of existing nested field - expect(isAggNameConflict('the-namespaced-group-by-agg-name', aggList, groupByList)).toBe(true); + expect( + getAggNameConflictToastMessages('the-namespaced-group-by-agg-name', aggList, groupByList) + ).toStrictEqual([ + `Couldn't add configuration 'the-namespaced-group-by-agg-name' because of a nesting conflict with 'the-namespaced-group-by-agg-name.namespace'.`, + ]); }); }); diff --git a/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_define/step_define_form.tsx b/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_define/step_define_form.tsx index 1499f99f82824..3adb74e4704dc 100644 --- a/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_define/step_define_form.tsx +++ b/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_define/step_define_form.tsx @@ -9,9 +9,6 @@ import React, { Fragment, FC, useEffect, useState } from 'react'; import { i18n } from '@kbn/i18n'; -import { metadata } from 'ui/metadata'; -import { toastNotifications } from 'ui/notify'; - import { EuiButton, EuiCodeEditor, @@ -29,6 +26,7 @@ import { } from '@elastic/eui'; import { useXJsonMode, xJsonMode } from '../../../../hooks/use_x_json_mode'; +import { useDocumentationLinks, useToastNotifications } from '../../../../app_dependencies'; import { TransformPivotConfig } from '../../../../common'; import { dictionaryToArray, Dictionary } from '../../../../../../common/types/common'; import { DropDown } from '../aggregation_dropdown'; @@ -147,32 +145,30 @@ export function applyTransformConfigToDefineState( return state; } -export function isAggNameConflict( +export function getAggNameConflictToastMessages( aggName: AggName, aggList: PivotAggsConfigDict, groupByList: PivotGroupByConfigDict -) { +): string[] { if (aggList[aggName] !== undefined) { - toastNotifications.addDanger( + return [ i18n.translate('xpack.transform.stepDefineForm.aggExistsErrorMessage', { defaultMessage: `An aggregation configuration with the name '{aggName}' already exists.`, values: { aggName }, - }) - ); - return true; + }), + ]; } if (groupByList[aggName] !== undefined) { - toastNotifications.addDanger( + return [ i18n.translate('xpack.transform.stepDefineForm.groupByExistsErrorMessage', { defaultMessage: `A group by configuration with the name '{aggName}' already exists.`, values: { aggName }, - }) - ); - return true; + }), + ]; } - let conflict = false; + const conflicts: string[] = []; // check the new aggName against existing aggs and groupbys const aggNameSplit = aggName.split('.'); @@ -180,29 +176,28 @@ export function isAggNameConflict( aggNameSplit.forEach(aggNamePart => { aggNameCheck = aggNameCheck === undefined ? aggNamePart : `${aggNameCheck}.${aggNamePart}`; if (aggList[aggNameCheck] !== undefined || groupByList[aggNameCheck] !== undefined) { - toastNotifications.addDanger( + conflicts.push( i18n.translate('xpack.transform.stepDefineForm.nestedConflictErrorMessage', { defaultMessage: `Couldn't add configuration '{aggName}' because of a nesting conflict with '{aggNameCheck}'.`, values: { aggName, aggNameCheck }, }) ); - conflict = true; } }); - if (conflict) { - return true; + if (conflicts.length > 0) { + return conflicts; } // check all aggs against new aggName - conflict = Object.keys(aggList).some(aggListName => { + Object.keys(aggList).some(aggListName => { const aggListNameSplit = aggListName.split('.'); let aggListNameCheck: string; return aggListNameSplit.some(aggListNamePart => { aggListNameCheck = aggListNameCheck === undefined ? aggListNamePart : `${aggListNameCheck}.${aggListNamePart}`; if (aggListNameCheck === aggName) { - toastNotifications.addDanger( + conflicts.push( i18n.translate('xpack.transform.stepDefineForm.nestedAggListConflictErrorMessage', { defaultMessage: `Couldn't add configuration '{aggName}' because of a nesting conflict with '{aggListName}'.`, values: { aggName, aggListName }, @@ -214,12 +209,12 @@ export function isAggNameConflict( }); }); - if (conflict) { - return true; + if (conflicts.length > 0) { + return conflicts; } // check all group-bys against new aggName - conflict = Object.keys(groupByList).some(groupByListName => { + Object.keys(groupByList).some(groupByListName => { const groupByListNameSplit = groupByListName.split('.'); let groupByListNameCheck: string; return groupByListNameSplit.some(groupByListNamePart => { @@ -228,7 +223,7 @@ export function isAggNameConflict( ? groupByListNamePart : `${groupByListNameCheck}.${groupByListNamePart}`; if (groupByListNameCheck === aggName) { - toastNotifications.addDanger( + conflicts.push( i18n.translate('xpack.transform.stepDefineForm.nestedGroupByListConflictErrorMessage', { defaultMessage: `Couldn't add configuration '{aggName}' because of a nesting conflict with '{groupByListName}'.`, values: { aggName, groupByListName }, @@ -240,7 +235,7 @@ export function isAggNameConflict( }); }); - return conflict; + return conflicts; } interface Props { @@ -250,6 +245,8 @@ interface Props { export const StepDefineForm: FC = React.memo(({ overrides = {}, onChange }) => { const kibanaContext = useKibanaContext(); + const toastNotifications = useToastNotifications(); + const { esQueryDsl, esTransformPivot } = useDocumentationLinks(); const defaults = { ...getDefaultStepDefineState(kibanaContext), ...overrides }; @@ -288,7 +285,9 @@ export const StepDefineForm: FC = React.memo(({ overrides = {}, onChange const config: PivotGroupByConfig = groupByOptionsData[label]; const aggName: AggName = config.aggName; - if (isAggNameConflict(aggName, aggList, groupByList)) { + const aggNameConflictMessages = getAggNameConflictToastMessages(aggName, aggList, groupByList); + if (aggNameConflictMessages.length > 0) { + aggNameConflictMessages.forEach(m => toastNotifications.addDanger(m)); return; } @@ -300,7 +299,13 @@ export const StepDefineForm: FC = React.memo(({ overrides = {}, onChange const groupByListWithoutPrevious = { ...groupByList }; delete groupByListWithoutPrevious[previousAggName]; - if (isAggNameConflict(item.aggName, aggList, groupByListWithoutPrevious)) { + const aggNameConflictMessages = getAggNameConflictToastMessages( + item.aggName, + aggList, + groupByListWithoutPrevious + ); + if (aggNameConflictMessages.length > 0) { + aggNameConflictMessages.forEach(m => toastNotifications.addDanger(m)); return; } @@ -321,7 +326,9 @@ export const StepDefineForm: FC = React.memo(({ overrides = {}, onChange const config: PivotAggsConfig = aggOptionsData[label]; const aggName: AggName = config.aggName; - if (isAggNameConflict(aggName, aggList, groupByList)) { + const aggNameConflictMessages = getAggNameConflictToastMessages(aggName, aggList, groupByList); + if (aggNameConflictMessages.length > 0) { + aggNameConflictMessages.forEach(m => toastNotifications.addDanger(m)); return; } @@ -333,7 +340,13 @@ export const StepDefineForm: FC = React.memo(({ overrides = {}, onChange const aggListWithoutPrevious = { ...aggList }; delete aggListWithoutPrevious[previousAggName]; - if (isAggNameConflict(item.aggName, aggListWithoutPrevious, groupByList)) { + const aggNameConflictMessages = getAggNameConflictToastMessages( + item.aggName, + aggListWithoutPrevious, + groupByList + ); + if (aggNameConflictMessages.length > 0) { + aggNameConflictMessages.forEach(m => toastNotifications.addDanger(m)); return; } @@ -477,15 +490,13 @@ export const StepDefineForm: FC = React.memo(({ overrides = {}, onChange setAdvancedSourceEditorApplyButtonEnabled(false); }; - // metadata.branch corresponds to the version used in documentation links. - const docsUrl = `https://www.elastic.co/guide/en/elasticsearch/reference/${metadata.branch}/transform-resource.html#transform-pivot`; const advancedEditorHelpText = ( {i18n.translate('xpack.transform.stepDefineForm.advancedEditorHelpText', { defaultMessage: 'The advanced editor allows you to edit the pivot configuration of the transform.', })}{' '} - + {i18n.translate('xpack.transform.stepDefineForm.advancedEditorHelpTextLink', { defaultMessage: 'Learn more about available options.', })} @@ -493,14 +504,13 @@ export const StepDefineForm: FC = React.memo(({ overrides = {}, onChange ); - const sourceDocsUrl = `https://www.elastic.co/guide/en/elasticsearch/reference/${metadata.branch}/query-dsl.html`; const advancedSourceEditorHelpText = ( {i18n.translate('xpack.transform.stepDefineForm.advancedSourceEditorHelpText', { defaultMessage: 'The advanced editor allows you to edit the source query clause of the transform.', })}{' '} - + {i18n.translate('xpack.transform.stepDefineForm.advancedEditorHelpTextLink', { defaultMessage: 'Learn more about available options.', })} diff --git a/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_define/step_define_summary.test.tsx b/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_define/step_define_summary.test.tsx index aae366e6008d5..78f6fc30f9191 100644 --- a/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_define/step_define_summary.test.tsx +++ b/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_define/step_define_summary.test.tsx @@ -18,8 +18,6 @@ import { import { StepDefineExposedState } from './step_define_form'; import { StepDefineSummary } from './step_define_summary'; -jest.mock('ui/new_platform'); - // workaround to make React.memo() work with enzyme jest.mock('react', () => { const r = jest.requireActual('react'); diff --git a/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_details/step_details_form.tsx b/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_details/step_details_form.tsx index 220923f88ed36..5ae2180bfe779 100644 --- a/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_details/step_details_form.tsx +++ b/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_details/step_details_form.tsx @@ -7,8 +7,6 @@ import React, { Fragment, FC, useEffect, useState } from 'react'; import { i18n } from '@kbn/i18n'; -import { metadata } from 'ui/metadata'; -import { toastNotifications } from 'ui/notify'; import { EuiLink, EuiSwitch, EuiFieldText, EuiForm, EuiFormRow, EuiSelect } from '@elastic/eui'; @@ -16,6 +14,7 @@ import { toMountPoint } from '../../../../../../../../../../src/plugins/kibana_r import { useKibanaContext } from '../../../../lib/kibana'; import { isValidIndexName } from '../../../../../../common/utils/es_utils'; +import { useDocumentationLinks, useToastNotifications } from '../../../../app_dependencies'; import { ToastNotificationText } from '../../../../components'; import { useApi } from '../../../../hooks/use_api'; @@ -72,6 +71,8 @@ interface Props { export const StepDetailsForm: FC = React.memo(({ overrides = {}, onChange }) => { const kibanaContext = useKibanaContext(); + const toastNotifications = useToastNotifications(); + const { esIndicesCreateIndex } = useDocumentationLinks(); const defaults = { ...getDefaultStepDetailsState(), ...overrides }; @@ -274,10 +275,7 @@ export const StepDetailsForm: FC = React.memo(({ overrides = {}, onChange defaultMessage: 'Invalid destination index name.', })}
- + {i18n.translate( 'xpack.transform.stepDetailsForm.destinationIndexInvalidErrorLink', { diff --git a/x-pack/legacy/plugins/transform/public/app/sections/create_transform/create_transform_section.tsx b/x-pack/legacy/plugins/transform/public/app/sections/create_transform/create_transform_section.tsx index ae82f03718c02..e92ba256256a4 100644 --- a/x-pack/legacy/plugins/transform/public/app/sections/create_transform/create_transform_section.tsx +++ b/x-pack/legacy/plugins/transform/public/app/sections/create_transform/create_transform_section.tsx @@ -22,8 +22,9 @@ import { } from '@elastic/eui'; import { APP_CREATE_TRANSFORM_CLUSTER_PRIVILEGES } from '../../../../common/constants'; + +import { useDocumentationLinks } from '../../app_dependencies'; import { breadcrumbService, docTitleService, BREADCRUMB_SECTION } from '../../services/navigation'; -import { documentationLinksService } from '../../services/documentation'; import { PrivilegesWrapper } from '../../lib/authorization'; import { KibanaProvider, RenderOnlyWithInitializedKibanaContext } from '../../lib/kibana'; @@ -37,6 +38,8 @@ export const CreateTransformSection: FC = ({ match }) => { docTitleService.setTitle('createTransform'); }, []); + const { esTransform } = useDocumentationLinks(); + return ( @@ -65,7 +68,7 @@ export const CreateTransformSection: FC = ({ match }) => { ', () => { diff --git a/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/action_clone.tsx b/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/action_clone.tsx index 40098ac7ef72a..4b333f73f048c 100644 --- a/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/action_clone.tsx +++ b/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/action_clone.tsx @@ -30,7 +30,7 @@ export const CloneAction: FC = ({ itemId }) => { }); function clickHandler() { - history.push(`${CLIENT_BASE_PATH}/${SECTION_SLUG.CLONE_TRANSFORM}/${itemId}`); + history.push(`${CLIENT_BASE_PATH}${SECTION_SLUG.CLONE_TRANSFORM}/${itemId}`); } const cloneButton = ( diff --git a/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/action_delete.test.tsx b/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/action_delete.test.tsx index 4795a2eb7d7bc..82b9f0a292bb9 100644 --- a/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/action_delete.test.tsx +++ b/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/action_delete.test.tsx @@ -16,7 +16,6 @@ import { DeleteAction } from './action_delete'; import transformListRow from '../../../../common/__mocks__/transform_list_row.json'; jest.mock('ui/new_platform'); - jest.mock('../../../../../shared_imports'); describe('Transform: Transform List Actions ', () => { diff --git a/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/action_start.test.tsx b/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/action_start.test.tsx index 5f4d4a71c71eb..002b4ea19f967 100644 --- a/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/action_start.test.tsx +++ b/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/action_start.test.tsx @@ -16,7 +16,6 @@ import { StartAction } from './action_start'; import transformListRow from '../../../../common/__mocks__/transform_list_row.json'; jest.mock('ui/new_platform'); - jest.mock('../../../../../shared_imports'); describe('Transform: Transform List Actions ', () => { diff --git a/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/action_stop.test.tsx b/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/action_stop.test.tsx index f6bb1c8b60667..e2a22765dfb98 100644 --- a/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/action_stop.test.tsx +++ b/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/action_stop.test.tsx @@ -16,7 +16,6 @@ import { StopAction } from './action_stop'; import transformListRow from '../../../../common/__mocks__/transform_list_row.json'; jest.mock('ui/new_platform'); - jest.mock('../../../../../shared_imports'); describe('Transform: Transform List Actions ', () => { diff --git a/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/actions.test.tsx b/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/actions.test.tsx index 12e1ba5528c43..e8ac2fa057ad8 100644 --- a/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/actions.test.tsx +++ b/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/actions.test.tsx @@ -6,8 +6,6 @@ import { getActions } from './actions'; -jest.mock('ui/new_platform'); - jest.mock('../../../../../shared_imports'); describe('Transform: Transform List Actions', () => { diff --git a/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/columns.test.tsx b/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/columns.test.tsx index 42f04ed101ad6..b4198ce3c7244 100644 --- a/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/columns.test.tsx +++ b/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/columns.test.tsx @@ -6,8 +6,6 @@ import { getColumns } from './columns'; -jest.mock('ui/new_platform'); - jest.mock('../../../../../shared_imports'); describe('Transform: Job List Columns', () => { diff --git a/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/transform_list.test.mocks.ts b/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/transform_list.test.mocks.ts deleted file mode 100644 index 1d20965526115..0000000000000 --- a/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/transform_list.test.mocks.ts +++ /dev/null @@ -1,15 +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; - * you may not use this file except in compliance with the Elastic License. - */ - -import { chromeServiceMock } from '../../../../../../../../../../src/core/public/mocks'; - -jest.doMock('ui/new_platform', () => ({ - npStart: { - core: { - chrome: chromeServiceMock.createStartContract(), - }, - }, -})); diff --git a/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/transform_list.test.tsx b/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/transform_list.test.tsx index e1a19ddd3c742..5e0363d0a7a15 100644 --- a/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/transform_list.test.tsx +++ b/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/transform_list.test.tsx @@ -7,11 +7,8 @@ import { shallow } from 'enzyme'; import React from 'react'; -import './transform_list.test.mocks'; import { TransformList } from './transform_list'; -jest.mock('ui/new_platform'); - jest.mock('../../../../../shared_imports'); describe('Transform: Transform List ', () => { diff --git a/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/use_refresh_interval.ts b/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/use_refresh_interval.ts index 8e505c7cccc02..812e636a3b338 100644 --- a/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/use_refresh_interval.ts +++ b/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/use_refresh_interval.ts @@ -6,12 +6,7 @@ import React, { useEffect } from 'react'; -import { timefilter } from 'ui/timefilter'; - -import { - DEFAULT_REFRESH_INTERVAL_MS, - MINIMUM_REFRESH_INTERVAL_MS, -} from '../../../../../../common/constants'; +import { DEFAULT_REFRESH_INTERVAL_MS } from '../../../../../../common/constants'; import { useRefreshTransformList } from '../../../../common'; @@ -20,62 +15,11 @@ export const useRefreshInterval = ( ) => { const { refresh } = useRefreshTransformList(); useEffect(() => { - let transformRefreshInterval: null | number = null; - const refreshIntervalSubscription = timefilter - .getRefreshIntervalUpdate$() - .subscribe(setAutoRefresh); - - timefilter.disableTimeRangeSelector(); - timefilter.enableAutoRefreshSelector(); - - initAutoRefresh(); - - function initAutoRefresh() { - const { value } = timefilter.getRefreshInterval(); - if (value === 0) { - // the auto refresher starts in an off state - // so switch it on and set the interval to 30s - timefilter.setRefreshInterval({ - pause: false, - value: DEFAULT_REFRESH_INTERVAL_MS, - }); - } - - setAutoRefresh(); - } - - function setAutoRefresh() { - const { value, pause } = timefilter.getRefreshInterval(); - if (pause) { - clearRefreshInterval(); - } else { - setRefreshInterval(value); - } - refresh(); - } - - function setRefreshInterval(interval: number) { - clearRefreshInterval(); - if (interval >= MINIMUM_REFRESH_INTERVAL_MS) { - setBlockRefresh(false); - const intervalId = window.setInterval(() => { - refresh(); - }, interval); - transformRefreshInterval = intervalId; - } - } - - function clearRefreshInterval() { - setBlockRefresh(true); - if (transformRefreshInterval !== null) { - window.clearInterval(transformRefreshInterval); - } - } + const interval = setInterval(refresh, DEFAULT_REFRESH_INTERVAL_MS); // useEffect cleanup return () => { - refreshIntervalSubscription.unsubscribe(); - clearRefreshInterval(); + clearInterval(interval); }; // custom comparison // eslint-disable-next-line react-hooks/exhaustive-deps diff --git a/x-pack/legacy/plugins/transform/public/app/sections/transform_management/transform_management_section.test.tsx b/x-pack/legacy/plugins/transform/public/app/sections/transform_management/transform_management_section.test.tsx index f68670f0b38b2..b1ca9e370c99e 100644 --- a/x-pack/legacy/plugins/transform/public/app/sections/transform_management/transform_management_section.test.tsx +++ b/x-pack/legacy/plugins/transform/public/app/sections/transform_management/transform_management_section.test.tsx @@ -9,11 +9,6 @@ import React from 'react'; import { TransformManagementSection } from './transform_management_section'; -jest.mock('ui/new_platform'); -jest.mock('ui/timefilter', () => { - return {}; -}); - jest.mock('../../../shared_imports'); describe('Transform: ', () => { diff --git a/x-pack/legacy/plugins/transform/public/app/sections/transform_management/transform_management_section.tsx b/x-pack/legacy/plugins/transform/public/app/sections/transform_management/transform_management_section.tsx index 6eb03c6537e0e..1573d4c53c0cf 100644 --- a/x-pack/legacy/plugins/transform/public/app/sections/transform_management/transform_management_section.tsx +++ b/x-pack/legacy/plugins/transform/public/app/sections/transform_management/transform_management_section.tsx @@ -24,12 +24,12 @@ import { } from '@elastic/eui'; import { APP_GET_TRANSFORM_CLUSTER_PRIVILEGES } from '../../../../common/constants'; +import { useDocumentationLinks } from '../../app_dependencies'; import { useRefreshTransformList, TransformListRow } from '../../common'; import { useGetTransforms } from '../../hooks'; import { RedirectToCreateTransform } from '../../common/navigation'; import { PrivilegesWrapper } from '../../lib/authorization'; import { breadcrumbService, docTitleService, BREADCRUMB_SECTION } from '../../services/navigation'; -import { documentationLinksService } from '../../services/documentation'; import { useRefreshInterval } from './components/transform_list/use_refresh_interval'; import { SearchSelection } from './components/search_selection'; @@ -37,6 +37,8 @@ import { TransformList } from './components/transform_list'; import { TransformStatsBar } from './components/transform_list/transforms_stats_bar'; export const TransformManagement: FC = () => { + const { esTransform } = useDocumentationLinks(); + const [transformsLoading, setTransformsLoading] = useState(false); const [isInitialized, setIsInitialized] = useState(false); const [blockRefresh, setBlockRefresh] = useState(false); @@ -98,7 +100,7 @@ export const TransformManagement: FC = () => { > => { - return _sendRequest(httpService.httpClient, config); -}; - -export const useRequest = (config: UseRequestConfig) => { - return _useRequest(httpService.httpClient, config); -}; diff --git a/x-pack/legacy/plugins/transform/public/app/services/http_service.ts b/x-pack/legacy/plugins/transform/public/app/services/http_service.ts index 11ba5119b1394..fa4c8d1ba7844 100644 --- a/x-pack/legacy/plugins/transform/public/app/services/http_service.ts +++ b/x-pack/legacy/plugins/transform/public/app/services/http_service.ts @@ -5,48 +5,47 @@ */ // service for interacting with the server - -import chrome from 'ui/chrome'; - -// @ts-ignore -import { addSystemApiHeader } from 'ui/system_api'; - import { Dictionary } from '../../../common/types/common'; -export function http(options: Dictionary) { - return new Promise((resolve, reject) => { - if (options && options.url) { - let url = ''; - url = url + (options.url || ''); - const headers = addSystemApiHeader({ - 'Content-Type': 'application/json', - 'kbn-version': chrome.getXsrfToken(), - ...options.headers, - }); - - const allHeaders = - options.headers === undefined ? headers : { ...options.headers, ...headers }; - const body = options.data === undefined ? null : JSON.stringify(options.data); - - const payload: Dictionary = { - method: options.method || 'GET', - headers: allHeaders, - credentials: 'same-origin', - }; - - if (body !== null) { - payload.body = body; +export type Http = (options: Dictionary) => Promise; + +export function httpFactory(xsrfToken: string) { + return function http(options: Dictionary) { + return new Promise((resolve, reject) => { + if (options && options.url) { + let url = ''; + url = url + (options.url || ''); + const headers = { + 'kbn-system-request': true, + 'Content-Type': 'application/json', + 'kbn-version': xsrfToken, + ...options.headers, + }; + + const allHeaders = + options.headers === undefined ? headers : { ...options.headers, ...headers }; + const body = options.data === undefined ? null : JSON.stringify(options.data); + + const payload: Dictionary = { + method: options.method || 'GET', + headers: allHeaders, + credentials: 'same-origin', + }; + + if (body !== null) { + payload.body = body; + } + + fetch(url, payload) + .then(resp => { + resp.json().then(resp.ok === true ? resolve : reject); + }) + .catch(resp => { + reject(resp); + }); + } else { + reject(); } - - fetch(url, payload) - .then(resp => { - resp.json().then(resp.ok === true ? resolve : reject); - }) - .catch(resp => { - reject(resp); - }); - } else { - reject(); - } - }); + }); + }; } diff --git a/x-pack/legacy/plugins/transform/public/app/services/navigation/breadcrumb.ts b/x-pack/legacy/plugins/transform/public/app/services/navigation/breadcrumb.ts index 5a2f698b35154..aa8041a1cbe23 100644 --- a/x-pack/legacy/plugins/transform/public/app/services/navigation/breadcrumb.ts +++ b/x-pack/legacy/plugins/transform/public/app/services/navigation/breadcrumb.ts @@ -7,6 +7,10 @@ import { textService } from '../text'; import { linkToHome } from './links'; +import { ManagementAppMountParams } from '../../../../../../../../src/plugins/management/public'; + +type SetBreadcrumbs = ManagementAppMountParams['setBreadcrumbs']; + export enum BREADCRUMB_SECTION { MANAGEMENT = 'management', HOME = 'home', @@ -24,17 +28,16 @@ type Breadcrumbs = { }; class BreadcrumbService { - private chrome: any; private breadcrumbs: Breadcrumbs = { management: [], home: [], cloneTransform: [], createTransform: [], }; + private setBreadcrumbsHandler?: SetBreadcrumbs; - public init(chrome: any, managementBreadcrumb: any): void { - this.chrome = chrome; - this.breadcrumbs.management = [managementBreadcrumb]; + public setup(setBreadcrumbsHandler: SetBreadcrumbs): void { + this.setBreadcrumbsHandler = setBreadcrumbsHandler; // Home and sections this.breadcrumbs.home = [ @@ -59,12 +62,19 @@ class BreadcrumbService { } public setBreadcrumbs(type: BREADCRUMB_SECTION): void { + if (!this.setBreadcrumbsHandler) { + throw new Error(`BreadcrumbService#setup() must be called first!`); + } + const newBreadcrumbs = this.breadcrumbs[type] ? [...this.breadcrumbs[type]] : [...this.breadcrumbs.home]; // Pop off last breadcrumb - const lastBreadcrumb = newBreadcrumbs.pop() as BreadcrumbItem; + const lastBreadcrumb = newBreadcrumbs.pop() as { + text: string; + href?: string; + }; // Put last breadcrumb back without href newBreadcrumbs.push({ @@ -72,7 +82,7 @@ class BreadcrumbService { href: undefined, }); - this.chrome.setBreadcrumbs(newBreadcrumbs); + this.setBreadcrumbsHandler(newBreadcrumbs); } } diff --git a/x-pack/legacy/plugins/transform/public/plugin.ts b/x-pack/legacy/plugins/transform/public/plugin.ts index d55695f891bb7..23fad00fb0786 100644 --- a/x-pack/legacy/plugins/transform/public/plugin.ts +++ b/x-pack/legacy/plugins/transform/public/plugin.ts @@ -3,121 +3,89 @@ * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ -import { unmountComponentAtNode } from 'react-dom'; import { i18n } from '@kbn/i18n'; -import { PLUGIN } from '../common/constants'; -import { CLIENT_BASE_PATH } from './app/constants'; -import { renderReact } from './app/app'; -import { Core, Plugins } from './shim'; +import { renderApp } from './app/app'; +import { ShimCore, ShimPlugins } from './shim'; -import { breadcrumbService, docTitleService } from './app/services/navigation'; -import { documentationLinksService } from './app/services/documentation'; -import { httpService } from './app/services/http'; +import { breadcrumbService } from './app/services/navigation'; +import { docTitleService } from './app/services/navigation'; import { textService } from './app/services/text'; import { uiMetricService } from './app/services/ui_metric'; import { createSavedSearchesLoader } from '../../../../../src/plugins/discover/public'; -const REACT_ROOT_ID = 'transformReactRoot'; -const KBN_MANAGEMENT_SECTION = 'elasticsearch/transform'; - -const template = `
`; - export class Plugin { - public start(core: Core, plugins: Plugins): void { + public start(core: ShimCore, plugins: ShimPlugins): void { const { http, - routing, - legacyHttp, chrome, documentation, + docLinks, docTitle, + injectedMetadata, + notifications, uiSettings, savedObjects, overlays, } = core; - const { data, management, savedSearches: coreSavedSearches, uiMetric } = plugins; + const { data, management, savedSearches: coreSavedSearches, uiMetric, xsrfToken } = plugins; // AppCore/AppPlugins to be passed on as React context const appDependencies = { - core: { chrome, http, i18n: core.i18n, uiSettings, savedObjects, overlays }, + core: { + chrome, + documentation, + docLinks, + http, + i18n: core.i18n, + injectedMetadata, + notifications, + uiSettings, + savedObjects, + overlays, + }, plugins: { data, - management: { sections: management.sections }, + management, savedSearches: coreSavedSearches, + xsrfToken, }, }; // Register management section const esSection = management.sections.getSection('elasticsearch'); - esSection.register(PLUGIN.ID, { - visible: true, - display: i18n.translate('xpack.transform.appName', { - defaultMessage: 'Transforms', - }), - order: 3, - url: `#${CLIENT_BASE_PATH}`, - }); + if (esSection !== undefined) { + esSection.registerApp({ + id: 'transform', + title: i18n.translate('xpack.transform.appTitle', { + defaultMessage: 'Transforms', + }), + order: 3, + mount(params) { + const savedSearches = createSavedSearchesLoader({ + savedObjectsClient: core.savedObjects.client, + indexPatterns: plugins.data.indexPatterns, + chrome: core.chrome, + overlays: core.overlays, + }); + coreSavedSearches.setClient(savedSearches); + + breadcrumbService.setup(params.setBreadcrumbs); + params.setBreadcrumbs([ + { + text: i18n.translate('xpack.transform.breadcrumbsTitle', { + defaultMessage: 'Transforms', + }), + }, + ]); + + return renderApp(params.element, appDependencies); + }, + }); + } // Initialize services textService.init(); - breadcrumbService.init(chrome, management.constants.BREADCRUMB); uiMetricService.init(uiMetric.createUiStatsReporter); - documentationLinksService.init(documentation.esDocBasePath); docTitleService.init(docTitle.change); - - const unmountReactApp = (): void => { - const elem = document.getElementById(REACT_ROOT_ID); - if (elem) { - unmountComponentAtNode(elem); - } - }; - - // Register react root - routing.registerAngularRoute(`${CLIENT_BASE_PATH}/:section?/:subsection?/:view?/:id?`, { - template, - controllerAs: 'transformController', - controller: ($scope: any, $route: any, $http: ng.IHttpService) => { - const savedSearches = createSavedSearchesLoader({ - savedObjectsClient: core.savedObjects.client, - indexPatterns: plugins.data.indexPatterns, - chrome: core.chrome, - overlays: core.overlays, - }); - // NOTE: We depend upon Angular's $http service because it's decorated with interceptors, - // e.g. to check license status per request. - legacyHttp.setClient($http); - httpService.init(legacyHttp.getClient()); - coreSavedSearches.setClient(savedSearches); - - // Angular Lifecycle - const appRoute = $route.current; - const stopListeningForLocationChange = $scope.$on('$locationChangeSuccess', () => { - const currentRoute = $route.current; - const isNavigationInApp = currentRoute.$$route.template === appRoute.$$route.template; - - // When we navigate within Transform, prevent Angular from re-matching the route and rebuild the app - if (isNavigationInApp) { - $route.current = appRoute; - } else { - // Any clean up when user leaves Transform - } - - $scope.$on('$destroy', () => { - if (stopListeningForLocationChange) { - stopListeningForLocationChange(); - } - unmountReactApp(); - }); - }); - - $scope.$$postDigest(() => { - unmountReactApp(); - const elem = document.getElementById(REACT_ROOT_ID); - if (elem) { - renderReact(elem, appDependencies); - } - }); - }, - }); } } diff --git a/x-pack/legacy/plugins/transform/public/shared_imports.ts b/x-pack/legacy/plugins/transform/public/shared_imports.ts index 248eb00c67dff..b077cd8836c4b 100644 --- a/x-pack/legacy/plugins/transform/public/shared_imports.ts +++ b/x-pack/legacy/plugins/transform/public/shared_imports.ts @@ -16,7 +16,7 @@ export { UseRequestConfig, sendRequest, useRequest, -} from '../../../../../src/plugins/es_ui_shared/public/request'; +} from '../../../../../src/plugins/es_ui_shared/public/request/np_ready_request'; export { CronEditor, diff --git a/x-pack/legacy/plugins/transform/public/shim.ts b/x-pack/legacy/plugins/transform/public/shim.ts index 38bb072ff9eb7..95f54605377a8 100644 --- a/x-pack/legacy/plugins/transform/public/shim.ts +++ b/x-pack/legacy/plugins/transform/public/shim.ts @@ -6,77 +6,69 @@ import { npStart } from 'ui/new_platform'; -import { management, MANAGEMENT_BREADCRUMB } from 'ui/management'; -import routes from 'ui/routes'; +import chrome from 'ui/chrome'; import { docTitle } from 'ui/doc_title/doc_title'; -import { CoreStart } from 'kibana/public'; // @ts-ignore: allow traversal to fail on x-pack build import { createUiStatsReporter } from '../../../../../src/legacy/core_plugins/ui_metric/public'; import { SavedSearchLoader } from '../../../../../src/legacy/core_plugins/kibana/public/discover/np_ready/types'; -import { DataPublicPluginStart } from '../../../../../src/plugins/data/public'; -export type npCore = typeof npStart.core; +import { TRANSFORM_DOC_PATHS } from './app/constants'; + +export type NpCore = typeof npStart.core; +export type NpPlugins = typeof npStart.plugins; // AppCore/AppPlugins is the set of core features/plugins // we pass on via context/hooks to the app and its components. export type AppCore = Pick< - CoreStart, - 'chrome' | 'http' | 'i18n' | 'savedObjects' | 'uiSettings' | 'overlays' + ShimCore, + | 'chrome' + | 'documentation' + | 'docLinks' + | 'http' + | 'i18n' + | 'injectedMetadata' + | 'savedObjects' + | 'uiSettings' + | 'overlays' + | 'notifications' >; - -export interface AppPlugins { - data: DataPublicPluginStart; - management: { - sections: typeof management; - }; - savedSearches: { - getClient(): any; - setClient(client: any): void; - }; -} +export type AppPlugins = Pick; export interface AppDependencies { core: AppCore; plugins: AppPlugins; } -export interface Core extends npCore { - legacyHttp: { - getClient(): any; - setClient(client: any): void; - }; - routing: { - registerAngularRoute(path: string, config: object): void; - }; - documentation: { - esDocBasePath: string; - esPluginDocBasePath: string; - esStackOverviewDocBasePath: string; - esMLDocBasePath: string; - }; +export interface ShimCore extends NpCore { + documentation: Record< + | 'esDocBasePath' + | 'esIndicesCreateIndex' + | 'esPluginDocBasePath' + | 'esQueryDsl' + | 'esStackOverviewDocBasePath' + | 'esTransform' + | 'esTransformPivot' + | 'mlDocBasePath', + string + >; docTitle: { change: typeof docTitle.change; }; } -export interface Plugins extends AppPlugins { - management: { - sections: typeof management; - constants: { - BREADCRUMB: typeof MANAGEMENT_BREADCRUMB; - }; - }; +export interface ShimPlugins extends NpPlugins { uiMetric: { createUiStatsReporter: typeof createUiStatsReporter; }; - data: DataPublicPluginStart; + savedSearches: { + getClient(): any; + setClient(client: any): void; + }; + xsrfToken: string; } -export function createPublicShim(): { core: Core; plugins: Plugins } { - // This is an Angular service, which is why we use this provider pattern - // to access it within our React app. - let httpClient: ng.IHttpService; +export function createPublicShim(): { core: ShimCore; plugins: ShimPlugins } { // This is an Angular service, which is why we use this provider pattern // to access it within our React app. let savedSearches: SavedSearchLoader; @@ -86,35 +78,22 @@ export function createPublicShim(): { core: Core; plugins: Plugins } { return { core: { ...npStart.core, - routing: { - registerAngularRoute: (path: string, config: object): void => { - routes.when(path, config); - }, - }, - legacyHttp: { - setClient: (client: any): void => { - httpClient = client; - }, - getClient: (): any => httpClient, - }, documentation: { esDocBasePath: `${ELASTIC_WEBSITE_URL}guide/en/elasticsearch/reference/${DOC_LINK_VERSION}/`, + esIndicesCreateIndex: `${ELASTIC_WEBSITE_URL}guide/en/elasticsearch/reference/${DOC_LINK_VERSION}/indices-create-index.html#indices-create-index`, esPluginDocBasePath: `${ELASTIC_WEBSITE_URL}guide/en/elasticsearch/plugins/${DOC_LINK_VERSION}/`, + esQueryDsl: `${ELASTIC_WEBSITE_URL}guide/en/elasticsearch/reference/${DOC_LINK_VERSION}/query-dsl.html`, esStackOverviewDocBasePath: `${ELASTIC_WEBSITE_URL}guide/en/elastic-stack-overview/${DOC_LINK_VERSION}/`, - esMLDocBasePath: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/`, + esTransform: `${ELASTIC_WEBSITE_URL}guide/en/elasticsearch/reference/${DOC_LINK_VERSION}/${TRANSFORM_DOC_PATHS.transforms}`, + esTransformPivot: `${ELASTIC_WEBSITE_URL}guide/en/elasticsearch/reference/${DOC_LINK_VERSION}/put-transform.html#put-transform-request-body`, + mlDocBasePath: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/`, }, docTitle: { change: docTitle.change, }, }, plugins: { - data: npStart.plugins.data, - management: { - sections: management, - constants: { - BREADCRUMB: MANAGEMENT_BREADCRUMB, - }, - }, + ...npStart.plugins, savedSearches: { setClient: (client: any): void => { savedSearches = client; @@ -124,6 +103,7 @@ export function createPublicShim(): { core: Core; plugins: Plugins } { uiMetric: { createUiStatsReporter, }, + xsrfToken: chrome.getXsrfToken(), }, }; } From 3f7abe3c55023a546f559b536c232054be6d1d21 Mon Sep 17 00:00:00 2001 From: Ryan Keairns Date: Fri, 28 Feb 2020 07:28:31 -0600 Subject: [PATCH 04/31] Add alt attribute to images on the Add data page (#58767) * add alt attr to images * add alt attr to images --- .../components/__snapshots__/synopsis.test.js.snap | 1 + .../kibana/public/home/np_ready/components/synopsis.js | 8 +------- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/legacy/core_plugins/kibana/public/home/np_ready/components/__snapshots__/synopsis.test.js.snap b/src/legacy/core_plugins/kibana/public/home/np_ready/components/__snapshots__/synopsis.test.js.snap index 525cc5bdda9d4..594d67d9c8eb0 100644 --- a/src/legacy/core_plugins/kibana/public/home/np_ready/components/__snapshots__/synopsis.test.js.snap +++ b/src/legacy/core_plugins/kibana/public/home/np_ready/components/__snapshots__/synopsis.test.js.snap @@ -9,6 +9,7 @@ exports[`props iconType 1`] = ` href="link_to_item" icon={ diff --git a/src/legacy/core_plugins/kibana/public/home/np_ready/components/synopsis.js b/src/legacy/core_plugins/kibana/public/home/np_ready/components/synopsis.js index 968b8eb64def5..f43c377b4e5b9 100644 --- a/src/legacy/core_plugins/kibana/public/home/np_ready/components/synopsis.js +++ b/src/legacy/core_plugins/kibana/public/home/np_ready/components/synopsis.js @@ -37,13 +37,7 @@ export function Synopsis({ if (iconUrl) { optionalImg = ; } else if (iconType) { - optionalImg = ( - - ); + optionalImg = ; } const classes = classNames('homSynopsis__card', { From 91330d24933345e63dad8357a52d3a03168dba7f Mon Sep 17 00:00:00 2001 From: Larry Gregory Date: Fri, 28 Feb 2020 09:06:48 -0500 Subject: [PATCH 05/31] Spaces - NP updates for usage collection and capabilities (#57693) * remove kibanaIndex from LegacyAPI * moving capabilities, adding tests * moving usage collection * cleanup * don't toggle capabilities on unauthenticated routes * reintroduce exception handling * pipe dat config * start addressing PR feedback * fix CoreSetup's generic type * fix usage collector tests * PR review updates Co-authored-by: Elastic Machine --- src/core/server/http/http_server.mocks.ts | 6 +- src/plugins/usage_collection/server/mocks.ts | 38 +++++++ x-pack/legacy/plugins/spaces/index.ts | 18 --- x-pack/plugins/features/server/index.ts | 2 +- x-pack/plugins/features/server/mocks.ts | 27 +++++ x-pack/plugins/features/server/plugin.ts | 23 ++-- .../capabilities_provider.test.ts | 24 ++++ .../capabilities/capabilities_provider.ts | 16 +++ .../capabilities_switcher.test.ts} | 104 ++++++++++++++++-- .../capabilities_switcher.ts} | 40 +++++-- .../spaces/server/capabilities/index.ts | 20 ++++ .../on_post_auth_interceptor.test.ts | 2 - .../on_post_auth_interceptor.ts | 4 +- .../on_request_interceptor.test.ts | 5 - .../on_request_interceptor.ts | 4 +- .../spaces_tutorial_context_factory.test.ts | 1 - x-pack/plugins/spaces/server/plugin.test.ts | 72 ++++++++++++ x-pack/plugins/spaces/server/plugin.ts | 63 +++++------ .../api/__fixtures__/create_legacy_api.ts | 3 - .../spaces_service/spaces_service.test.ts | 1 - .../spaces/server/usage_collection/index.ts | 7 ++ .../spaces_usage_collector.test.ts | 25 ++++- .../spaces_usage_collector.ts | 23 ++-- 23 files changed, 409 insertions(+), 119 deletions(-) create mode 100644 src/plugins/usage_collection/server/mocks.ts create mode 100644 x-pack/plugins/features/server/mocks.ts create mode 100644 x-pack/plugins/spaces/server/capabilities/capabilities_provider.test.ts create mode 100644 x-pack/plugins/spaces/server/capabilities/capabilities_provider.ts rename x-pack/plugins/spaces/server/{lib/toggle_ui_capabilities.test.ts => capabilities/capabilities_switcher.test.ts} (53%) rename x-pack/plugins/spaces/server/{lib/toggle_ui_capabilities.ts => capabilities/capabilities_switcher.ts} (66%) create mode 100644 x-pack/plugins/spaces/server/capabilities/index.ts create mode 100644 x-pack/plugins/spaces/server/plugin.test.ts create mode 100644 x-pack/plugins/spaces/server/usage_collection/index.ts rename x-pack/plugins/spaces/server/{lib => usage_collection}/spaces_usage_collector.test.ts (85%) rename x-pack/plugins/spaces/server/{lib => usage_collection}/spaces_usage_collector.ts (90%) diff --git a/src/core/server/http/http_server.mocks.ts b/src/core/server/http/http_server.mocks.ts index c586cf6a9825f..0a9541393284e 100644 --- a/src/core/server/http/http_server.mocks.ts +++ b/src/core/server/http/http_server.mocks.ts @@ -43,6 +43,7 @@ interface RequestFixtureOptions

{ method?: RouteMethod; socket?: Socket; routeTags?: string[]; + routeAuthRequired?: false; validation?: { params?: RouteValidationSpec

; query?: RouteValidationSpec; @@ -59,6 +60,7 @@ function createKibanaRequestMock

({ method = 'get', socket = new Socket(), routeTags, + routeAuthRequired, validation = {}, }: RequestFixtureOptions = {}) { const queryString = stringify(query, { sort: false }); @@ -77,7 +79,9 @@ function createKibanaRequestMock

({ query: queryString, search: queryString ? `?${queryString}` : queryString, }, - route: { settings: { tags: routeTags } }, + route: { + settings: { tags: routeTags, auth: routeAuthRequired }, + }, raw: { req: { socket }, }, diff --git a/src/plugins/usage_collection/server/mocks.ts b/src/plugins/usage_collection/server/mocks.ts new file mode 100644 index 0000000000000..2194b1fb83f6e --- /dev/null +++ b/src/plugins/usage_collection/server/mocks.ts @@ -0,0 +1,38 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { loggingServiceMock } from '../../../core/server/mocks'; +import { UsageCollectionSetup } from './plugin'; +import { CollectorSet } from './collector'; + +const createSetupContract = () => { + return { + ...new CollectorSet({ + logger: loggingServiceMock.createLogger(), + maximumWaitTimeForAllCollectorsInS: 1, + }), + registerLegacySavedObjects: jest.fn() as jest.Mocked< + UsageCollectionSetup['registerLegacySavedObjects'] + >, + } as UsageCollectionSetup; +}; + +export const usageCollectionPluginMock = { + createSetupContract, +}; diff --git a/x-pack/legacy/plugins/spaces/index.ts b/x-pack/legacy/plugins/spaces/index.ts index ab3388ae96475..757c1eb557c54 100644 --- a/x-pack/legacy/plugins/spaces/index.ts +++ b/x-pack/legacy/plugins/spaces/index.ts @@ -34,19 +34,6 @@ export const spaces = (kibana: Record) => publicDir: resolve(__dirname, 'public'), require: ['kibana', 'elasticsearch', 'xpack_main'], - uiCapabilities() { - return { - spaces: { - manage: true, - }, - management: { - kibana: { - spaces: true, - }, - }, - }; - }, - uiExports: { styleSheetPaths: resolve(__dirname, 'public/index.scss'), managementSections: [], @@ -110,14 +97,9 @@ export const spaces = (kibana: Record) => throw new Error('New Platform XPack Spaces plugin is not available.'); } - const config = server.config(); - const { registerLegacyAPI, createDefaultSpace } = spacesPlugin.__legacyCompat; registerLegacyAPI({ - legacyConfig: { - kibanaIndex: config.get('kibana.index'), - }, savedObjects: server.savedObjects, auditLogger: { create: (pluginId: string) => diff --git a/x-pack/plugins/features/server/index.ts b/x-pack/plugins/features/server/index.ts index 2b4f85aa04f04..48ef97a494f7e 100644 --- a/x-pack/plugins/features/server/index.ts +++ b/x-pack/plugins/features/server/index.ts @@ -14,7 +14,7 @@ import { Plugin } from './plugin'; export { uiCapabilitiesRegex } from './feature_schema'; export { Feature, FeatureWithAllOrReadPrivileges, FeatureKibanaPrivileges } from '../common'; -export { PluginSetupContract } from './plugin'; +export { PluginSetupContract, PluginStartContract } from './plugin'; export const plugin = (initializerContext: PluginInitializerContext) => new Plugin(initializerContext); diff --git a/x-pack/plugins/features/server/mocks.ts b/x-pack/plugins/features/server/mocks.ts new file mode 100644 index 0000000000000..ebaa5f1a504ca --- /dev/null +++ b/x-pack/plugins/features/server/mocks.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; + * you may not use this file except in compliance with the Elastic License. + */ + +import { PluginSetupContract, PluginStartContract } from './plugin'; + +const createSetup = (): jest.Mocked => { + return { + getFeatures: jest.fn(), + getFeaturesUICapabilities: jest.fn(), + registerFeature: jest.fn(), + registerLegacyAPI: jest.fn(), + }; +}; + +const createStart = (): jest.Mocked => { + return { + getFeatures: jest.fn(), + }; +}; + +export const featuresPluginMock = { + createSetup, + createStart, +}; diff --git a/x-pack/plugins/features/server/plugin.ts b/x-pack/plugins/features/server/plugin.ts index 96a8e68f8326d..e77fa218c0681 100644 --- a/x-pack/plugins/features/server/plugin.ts +++ b/x-pack/plugins/features/server/plugin.ts @@ -30,6 +30,10 @@ export interface PluginSetupContract { registerLegacyAPI: (legacyAPI: LegacyAPI) => void; } +export interface PluginStartContract { + getFeatures(): Feature[]; +} + /** * Describes a set of APIs that are available in the legacy platform only and required by this plugin * to function properly. @@ -45,6 +49,8 @@ export interface LegacyAPI { export class Plugin { private readonly logger: Logger; + private readonly featureRegistry: FeatureRegistry = new FeatureRegistry(); + private legacyAPI?: LegacyAPI; private readonly getLegacyAPI = () => { if (!this.legacyAPI) { @@ -61,18 +67,16 @@ export class Plugin { core: CoreSetup, { timelion }: { timelion?: TimelionSetupContract } ): Promise> { - const featureRegistry = new FeatureRegistry(); - defineRoutes({ router: core.http.createRouter(), - featureRegistry, + featureRegistry: this.featureRegistry, getLegacyAPI: this.getLegacyAPI, }); return deepFreeze({ - registerFeature: featureRegistry.register.bind(featureRegistry), - getFeatures: featureRegistry.getAll.bind(featureRegistry), - getFeaturesUICapabilities: () => uiCapabilitiesForFeatures(featureRegistry.getAll()), + registerFeature: this.featureRegistry.register.bind(this.featureRegistry), + getFeatures: this.featureRegistry.getAll.bind(this.featureRegistry), + getFeaturesUICapabilities: () => uiCapabilitiesForFeatures(this.featureRegistry.getAll()), registerLegacyAPI: (legacyAPI: LegacyAPI) => { this.legacyAPI = legacyAPI; @@ -82,14 +86,17 @@ export class Plugin { savedObjectTypes: this.legacyAPI.savedObjectTypes, includeTimelion: timelion !== undefined && timelion.uiEnabled, })) { - featureRegistry.register(feature); + this.featureRegistry.register(feature); } }, }); } - public start() { + public start(): RecursiveReadonly { this.logger.debug('Starting plugin'); + return deepFreeze({ + getFeatures: this.featureRegistry.getAll.bind(this.featureRegistry), + }); } public stop() { diff --git a/x-pack/plugins/spaces/server/capabilities/capabilities_provider.test.ts b/x-pack/plugins/spaces/server/capabilities/capabilities_provider.test.ts new file mode 100644 index 0000000000000..8678bdceb70f9 --- /dev/null +++ b/x-pack/plugins/spaces/server/capabilities/capabilities_provider.test.ts @@ -0,0 +1,24 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { capabilitiesProvider } from './capabilities_provider'; + +describe('Capabilities provider', () => { + it('provides the expected capabilities', () => { + expect(capabilitiesProvider()).toMatchInlineSnapshot(` + Object { + "management": Object { + "kibana": Object { + "spaces": true, + }, + }, + "spaces": Object { + "manage": true, + }, + } + `); + }); +}); diff --git a/x-pack/plugins/spaces/server/capabilities/capabilities_provider.ts b/x-pack/plugins/spaces/server/capabilities/capabilities_provider.ts new file mode 100644 index 0000000000000..5976aabfa66e8 --- /dev/null +++ b/x-pack/plugins/spaces/server/capabilities/capabilities_provider.ts @@ -0,0 +1,16 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +export const capabilitiesProvider = () => ({ + spaces: { + manage: true, + }, + management: { + kibana: { + spaces: true, + }, + }, +}); diff --git a/x-pack/plugins/spaces/server/lib/toggle_ui_capabilities.test.ts b/x-pack/plugins/spaces/server/capabilities/capabilities_switcher.test.ts similarity index 53% rename from x-pack/plugins/spaces/server/lib/toggle_ui_capabilities.test.ts rename to x-pack/plugins/spaces/server/capabilities/capabilities_switcher.test.ts index b92922def2eb8..3f7b93c754aef 100644 --- a/x-pack/plugins/spaces/server/lib/toggle_ui_capabilities.test.ts +++ b/x-pack/plugins/spaces/server/capabilities/capabilities_switcher.test.ts @@ -6,8 +6,12 @@ import { Feature } from '../../../../plugins/features/server'; import { Space } from '../../common/model/space'; -import { toggleUICapabilities } from './toggle_ui_capabilities'; -import { Capabilities } from 'src/core/public'; +import { setupCapabilitiesSwitcher } from './capabilities_switcher'; +import { Capabilities, CoreSetup } from 'src/core/server'; +import { coreMock, httpServerMock, loggingServiceMock } from 'src/core/server/mocks'; +import { featuresPluginMock } from '../../../features/server/mocks'; +import { spacesServiceMock } from '../spaces_service/spaces_service.mock'; +import { PluginsStart } from '../plugin'; const features: Feature[] = [ { @@ -91,8 +95,33 @@ const buildCapabilities = () => }, }) as Capabilities; -describe('toggleUiCapabilities', () => { - it('does not toggle capabilities when the space has no disabled features', () => { +const setup = (space: Space) => { + const coreSetup = coreMock.createSetup(); + + const featuresStart = featuresPluginMock.createStart(); + featuresStart.getFeatures.mockReturnValue(features); + + coreSetup.getStartServices.mockResolvedValue([ + coreMock.createStart(), + { features: featuresStart }, + ]); + + const spacesService = spacesServiceMock.createSetupContract(); + spacesService.getActiveSpace.mockResolvedValue(space); + + const logger = loggingServiceMock.createLogger(); + + const switcher = setupCapabilitiesSwitcher( + (coreSetup as unknown) as CoreSetup, + spacesService, + logger + ); + + return { switcher, logger, spacesService }; +}; + +describe('capabilitiesSwitcher', () => { + it('does not toggle capabilities when the space has no disabled features', async () => { const space: Space = { id: 'space', name: '', @@ -100,11 +129,54 @@ describe('toggleUiCapabilities', () => { }; const capabilities = buildCapabilities(); - const result = toggleUICapabilities(features, capabilities, space); + + const { switcher } = setup(space); + const request = httpServerMock.createKibanaRequest(); + const result = await switcher(request, capabilities); + + expect(result).toEqual(buildCapabilities()); + }); + + it('does not toggle capabilities when the request is not authenticated', async () => { + const space: Space = { + id: 'space', + name: '', + disabledFeatures: ['feature_1', 'feature_2', 'feature_3'], + }; + + const capabilities = buildCapabilities(); + + const { switcher } = setup(space); + const request = httpServerMock.createKibanaRequest({ routeAuthRequired: false }); + + const result = await switcher(request, capabilities); + + expect(result).toEqual(buildCapabilities()); + }); + + it('logs a warning, and does not toggle capabilities if an error is encountered', async () => { + const space: Space = { + id: 'space', + name: '', + disabledFeatures: ['feature_1', 'feature_2', 'feature_3'], + }; + + const capabilities = buildCapabilities(); + + const { switcher, logger, spacesService } = setup(space); + const request = httpServerMock.createKibanaRequest(); + + spacesService.getActiveSpace.mockRejectedValue(new Error('Something terrible happened')); + + const result = await switcher(request, capabilities); + expect(result).toEqual(buildCapabilities()); + expect(logger.warn).toHaveBeenCalledWith( + `Error toggling capabilities for request to /path: Error: Something terrible happened` + ); }); - it('ignores unknown disabledFeatures', () => { + it('ignores unknown disabledFeatures', async () => { const space: Space = { id: 'space', name: '', @@ -112,11 +184,15 @@ describe('toggleUiCapabilities', () => { }; const capabilities = buildCapabilities(); - const result = toggleUICapabilities(features, capabilities, space); + + const { switcher } = setup(space); + const request = httpServerMock.createKibanaRequest(); + const result = await switcher(request, capabilities); + expect(result).toEqual(buildCapabilities()); }); - it('disables the corresponding navLink, catalogue, management sections, and all capability flags for disabled features', () => { + it('disables the corresponding navLink, catalogue, management sections, and all capability flags for disabled features', async () => { const space: Space = { id: 'space', name: '', @@ -124,7 +200,10 @@ describe('toggleUiCapabilities', () => { }; const capabilities = buildCapabilities(); - const result = toggleUICapabilities(features, capabilities, space); + + const { switcher } = setup(space); + const request = httpServerMock.createKibanaRequest(); + const result = await switcher(request, capabilities); const expectedCapabilities = buildCapabilities(); @@ -137,7 +216,7 @@ describe('toggleUiCapabilities', () => { expect(result).toEqual(expectedCapabilities); }); - it('can disable everything', () => { + it('can disable everything', async () => { const space: Space = { id: 'space', name: '', @@ -145,7 +224,10 @@ describe('toggleUiCapabilities', () => { }; const capabilities = buildCapabilities(); - const result = toggleUICapabilities(features, capabilities, space); + + const { switcher } = setup(space); + const request = httpServerMock.createKibanaRequest(); + const result = await switcher(request, capabilities); const expectedCapabilities = buildCapabilities(); diff --git a/x-pack/plugins/spaces/server/lib/toggle_ui_capabilities.ts b/x-pack/plugins/spaces/server/capabilities/capabilities_switcher.ts similarity index 66% rename from x-pack/plugins/spaces/server/lib/toggle_ui_capabilities.ts rename to x-pack/plugins/spaces/server/capabilities/capabilities_switcher.ts index 2de84ec05017b..317cc7fe0e3c3 100644 --- a/x-pack/plugins/spaces/server/lib/toggle_ui_capabilities.ts +++ b/x-pack/plugins/spaces/server/capabilities/capabilities_switcher.ts @@ -4,15 +4,41 @@ * you may not use this file except in compliance with the Elastic License. */ import _ from 'lodash'; -import { UICapabilities } from 'ui/capabilities'; +import { Capabilities, CapabilitiesSwitcher, CoreSetup, Logger } from 'src/core/server'; import { Feature } from '../../../../plugins/features/server'; import { Space } from '../../common/model/space'; +import { SpacesServiceSetup } from '../spaces_service'; +import { PluginsStart } from '../plugin'; -export function toggleUICapabilities( - features: Feature[], - capabilities: UICapabilities, - activeSpace: Space -) { +export function setupCapabilitiesSwitcher( + core: CoreSetup, + spacesService: SpacesServiceSetup, + logger: Logger +): CapabilitiesSwitcher { + return async (request, capabilities) => { + const isAnonymousRequest = !request.route.options.authRequired; + + if (isAnonymousRequest) { + return capabilities; + } + + try { + const [activeSpace, [, { features }]] = await Promise.all([ + spacesService.getActiveSpace(request), + core.getStartServices(), + ]); + + const registeredFeatures = features.getFeatures(); + + return toggleCapabilities(registeredFeatures, capabilities, activeSpace); + } catch (e) { + logger.warn(`Error toggling capabilities for request to ${request.url.pathname}: ${e}`); + return capabilities; + } + }; +} + +function toggleCapabilities(features: Feature[], capabilities: Capabilities, activeSpace: Space) { const clonedCapabilities = _.cloneDeep(capabilities); toggleDisabledFeatures(features, clonedCapabilities, activeSpace); @@ -22,7 +48,7 @@ export function toggleUICapabilities( function toggleDisabledFeatures( features: Feature[], - capabilities: UICapabilities, + capabilities: Capabilities, activeSpace: Space ) { const disabledFeatureKeys = activeSpace.disabledFeatures; diff --git a/x-pack/plugins/spaces/server/capabilities/index.ts b/x-pack/plugins/spaces/server/capabilities/index.ts new file mode 100644 index 0000000000000..56a72a2eeaf19 --- /dev/null +++ b/x-pack/plugins/spaces/server/capabilities/index.ts @@ -0,0 +1,20 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { CoreSetup, Logger } from 'src/core/server'; +import { capabilitiesProvider } from './capabilities_provider'; +import { setupCapabilitiesSwitcher } from './capabilities_switcher'; +import { PluginsStart } from '../plugin'; +import { SpacesServiceSetup } from '../spaces_service'; + +export const setupCapabilities = ( + core: CoreSetup, + spacesService: SpacesServiceSetup, + logger: Logger +) => { + core.capabilities.registerProvider(capabilitiesProvider); + core.capabilities.registerSwitcher(setupCapabilitiesSwitcher(core, spacesService, logger)); +}; diff --git a/x-pack/plugins/spaces/server/lib/request_interceptors/on_post_auth_interceptor.test.ts b/x-pack/plugins/spaces/server/lib/request_interceptors/on_post_auth_interceptor.test.ts index 92be88b91c652..61157a9318781 100644 --- a/x-pack/plugins/spaces/server/lib/request_interceptors/on_post_auth_interceptor.test.ts +++ b/x-pack/plugins/spaces/server/lib/request_interceptors/on_post_auth_interceptor.test.ts @@ -201,12 +201,10 @@ describe('onPostAuthInterceptor', () => { // interceptor to parse out the space id and rewrite the request's URL. Rather than duplicating that logic, // we are including the already tested interceptor here in the test chain. initSpacesOnRequestInterceptor({ - getLegacyAPI: () => legacyAPI, http: (http as unknown) as CoreSetup['http'], }); initSpacesOnPostAuthRequestInterceptor({ - getLegacyAPI: () => legacyAPI, http: (http as unknown) as CoreSetup['http'], log: loggingMock, features: featuresPlugin, diff --git a/x-pack/plugins/spaces/server/lib/request_interceptors/on_post_auth_interceptor.ts b/x-pack/plugins/spaces/server/lib/request_interceptors/on_post_auth_interceptor.ts index 4674f3641084a..b07ff11f6efc6 100644 --- a/x-pack/plugins/spaces/server/lib/request_interceptors/on_post_auth_interceptor.ts +++ b/x-pack/plugins/spaces/server/lib/request_interceptors/on_post_auth_interceptor.ts @@ -7,13 +7,12 @@ import { Logger, CoreSetup } from 'src/core/server'; import { Space } from '../../../common/model/space'; import { wrapError } from '../errors'; import { SpacesServiceSetup } from '../../spaces_service/spaces_service'; -import { LegacyAPI, PluginsSetup } from '../../plugin'; +import { PluginsSetup } from '../../plugin'; import { getSpaceSelectorUrl } from '../get_space_selector_url'; import { DEFAULT_SPACE_ID, ENTER_SPACE_PATH } from '../../../common/constants'; import { addSpaceIdToPath } from '../../../common'; export interface OnPostAuthInterceptorDeps { - getLegacyAPI(): LegacyAPI; http: CoreSetup['http']; features: PluginsSetup['features']; spacesService: SpacesServiceSetup; @@ -22,7 +21,6 @@ export interface OnPostAuthInterceptorDeps { export function initSpacesOnPostAuthRequestInterceptor({ features, - getLegacyAPI, spacesService, log, http, diff --git a/x-pack/plugins/spaces/server/lib/request_interceptors/on_request_interceptor.test.ts b/x-pack/plugins/spaces/server/lib/request_interceptors/on_request_interceptor.test.ts index 5e6cf67ee8c90..448bc39eb606e 100644 --- a/x-pack/plugins/spaces/server/lib/request_interceptors/on_request_interceptor.test.ts +++ b/x-pack/plugins/spaces/server/lib/request_interceptors/on_request_interceptor.test.ts @@ -16,7 +16,6 @@ import { } from '../../../../../../src/core/server'; import * as kbnTestServer from '../../../../../../src/test_utils/kbn_server'; -import { LegacyAPI } from '../../plugin'; import { elasticsearchServiceMock } from 'src/core/server/mocks'; describe('onRequestInterceptor', () => { @@ -110,10 +109,6 @@ describe('onRequestInterceptor', () => { elasticsearch.esNodesCompatibility$ = elasticsearchServiceMock.createInternalSetup().esNodesCompatibility$; initSpacesOnRequestInterceptor({ - getLegacyAPI: () => - ({ - legacyConfig: {}, - } as LegacyAPI), http: (http as unknown) as CoreSetup['http'], }); diff --git a/x-pack/plugins/spaces/server/lib/request_interceptors/on_request_interceptor.ts b/x-pack/plugins/spaces/server/lib/request_interceptors/on_request_interceptor.ts index 22d704c1b7e13..c59851f8b8061 100644 --- a/x-pack/plugins/spaces/server/lib/request_interceptors/on_request_interceptor.ts +++ b/x-pack/plugins/spaces/server/lib/request_interceptors/on_request_interceptor.ts @@ -12,14 +12,12 @@ import { import { format } from 'url'; import { DEFAULT_SPACE_ID } from '../../../common/constants'; import { modifyUrl } from '../utils/url'; -import { LegacyAPI } from '../../plugin'; import { getSpaceIdFromPath } from '../../../common'; export interface OnRequestInterceptorDeps { - getLegacyAPI(): LegacyAPI; http: CoreSetup['http']; } -export function initSpacesOnRequestInterceptor({ getLegacyAPI, http }: OnRequestInterceptorDeps) { +export function initSpacesOnRequestInterceptor({ http }: OnRequestInterceptorDeps) { http.registerOnPreAuth(async function spacesOnPreAuthHandler( request: KibanaRequest, response: LifecycleResponseFactory, diff --git a/x-pack/plugins/spaces/server/lib/spaces_tutorial_context_factory.test.ts b/x-pack/plugins/spaces/server/lib/spaces_tutorial_context_factory.test.ts index a3396e98c3512..094ca8a11816e 100644 --- a/x-pack/plugins/spaces/server/lib/spaces_tutorial_context_factory.test.ts +++ b/x-pack/plugins/spaces/server/lib/spaces_tutorial_context_factory.test.ts @@ -23,7 +23,6 @@ import { securityMock } from '../../../security/server/mocks'; const log = loggingServiceMock.createLogger(); const legacyAPI: LegacyAPI = { - legacyConfig: {}, savedObjects: {} as SavedObjectsLegacyService, } as LegacyAPI; diff --git a/x-pack/plugins/spaces/server/plugin.test.ts b/x-pack/plugins/spaces/server/plugin.test.ts new file mode 100644 index 0000000000000..4e3f4f52cbeb4 --- /dev/null +++ b/x-pack/plugins/spaces/server/plugin.test.ts @@ -0,0 +1,72 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { CoreSetup } from 'src/core/server'; +import { coreMock } from 'src/core/server/mocks'; +import { featuresPluginMock } from '../../features/server/mocks'; +import { licensingMock } from '../../licensing/server/mocks'; +import { Plugin, PluginsSetup } from './plugin'; +import { usageCollectionPluginMock } from '../../../../src/plugins/usage_collection/server/mocks'; + +describe('Spaces Plugin', () => { + describe('#setup', () => { + it('can setup with all optional plugins disabled, exposing the expected contract', async () => { + const initializerContext = coreMock.createPluginInitializerContext({}); + const core = coreMock.createSetup() as CoreSetup; + const features = featuresPluginMock.createSetup(); + const licensing = licensingMock.createSetup(); + + const plugin = new Plugin(initializerContext); + const spacesSetup = await plugin.setup(core, { features, licensing }); + expect(spacesSetup).toMatchInlineSnapshot(` + Object { + "__legacyCompat": Object { + "createDefaultSpace": [Function], + "registerLegacyAPI": [Function], + }, + "spacesService": Object { + "getActiveSpace": [Function], + "getBasePath": [Function], + "getSpaceId": [Function], + "isInDefaultSpace": [Function], + "namespaceToSpaceId": [Function], + "scopedClient": [Function], + "spaceIdToNamespace": [Function], + }, + } + `); + }); + + it('registers the capabilities provider and switcher', async () => { + const initializerContext = coreMock.createPluginInitializerContext({}); + const core = coreMock.createSetup() as CoreSetup; + const features = featuresPluginMock.createSetup(); + const licensing = licensingMock.createSetup(); + + const plugin = new Plugin(initializerContext); + + await plugin.setup(core, { features, licensing }); + + expect(core.capabilities.registerProvider).toHaveBeenCalledTimes(1); + expect(core.capabilities.registerSwitcher).toHaveBeenCalledTimes(1); + }); + + it('registers the usage collector', async () => { + const initializerContext = coreMock.createPluginInitializerContext({}); + const core = coreMock.createSetup() as CoreSetup; + const features = featuresPluginMock.createSetup(); + const licensing = licensingMock.createSetup(); + + const usageCollection = usageCollectionPluginMock.createSetupContract(); + + const plugin = new Plugin(initializerContext); + + await plugin.setup(core, { features, licensing, usageCollection }); + + expect(usageCollection.getCollectorByType('spaces')).toBeDefined(); + }); + }); +}); diff --git a/x-pack/plugins/spaces/server/plugin.ts b/x-pack/plugins/spaces/server/plugin.ts index 90c2da6e69df8..d125e0f54e9c1 100644 --- a/x-pack/plugins/spaces/server/plugin.ts +++ b/x-pack/plugins/spaces/server/plugin.ts @@ -13,7 +13,10 @@ import { Logger, PluginInitializerContext, } from '../../../../src/core/server'; -import { PluginSetupContract as FeaturesPluginSetup } from '../../features/server'; +import { + PluginSetupContract as FeaturesPluginSetup, + PluginStartContract as FeaturesPluginStart, +} from '../../features/server'; import { SecurityPluginSetup } from '../../security/server'; import { LicensingPluginSetup } from '../../licensing/server'; import { createDefaultSpace } from './lib/create_default_space'; @@ -22,15 +25,15 @@ import { AuditLogger } from '../../../../server/lib/audit_logger'; import { spacesSavedObjectsClientWrapperFactory } from './lib/saved_objects_client/saved_objects_client_wrapper_factory'; import { SpacesAuditLogger } from './lib/audit_logger'; import { createSpacesTutorialContextFactory } from './lib/spaces_tutorial_context_factory'; -import { registerSpacesUsageCollector } from './lib/spaces_usage_collector'; +import { registerSpacesUsageCollector } from './usage_collection'; import { SpacesService } from './spaces_service'; import { SpacesServiceSetup } from './spaces_service'; import { ConfigType } from './config'; -import { toggleUICapabilities } from './lib/toggle_ui_capabilities'; import { initSpacesRequestInterceptors } from './lib/request_interceptors'; import { initExternalSpacesApi } from './routes/api/external'; import { initInternalSpacesApi } from './routes/api/internal'; import { initSpacesViewsRoutes } from './routes/views'; +import { setupCapabilities } from './capabilities'; /** * Describes a set of APIs that is available in the legacy platform only and required by this plugin @@ -41,9 +44,6 @@ export interface LegacyAPI { auditLogger: { create: (pluginId: string) => AuditLogger; }; - legacyConfig: { - kibanaIndex: string; - }; } export interface PluginsSetup { @@ -54,6 +54,10 @@ export interface PluginsSetup { home?: HomeServerPluginSetup; } +export interface PluginsStart { + features: FeaturesPluginStart; +} + export interface SpacesPluginSetup { spacesService: SpacesServiceSetup; __legacyCompat: { @@ -70,6 +74,8 @@ export class Plugin { private readonly config$: Observable; + private readonly kibanaIndexConfig$: Observable<{ kibana: { index: string } }>; + private readonly log: Logger; private legacyAPI?: LegacyAPI; @@ -92,12 +98,16 @@ export class Plugin { constructor(initializerContext: PluginInitializerContext) { this.config$ = initializerContext.config.create(); + this.kibanaIndexConfig$ = initializerContext.config.legacy.globalConfig$; this.log = initializerContext.logger.get(); } public async start() {} - public async setup(core: CoreSetup, plugins: PluginsSetup): Promise { + public async setup( + core: CoreSetup, + plugins: PluginsSetup + ): Promise { const service = new SpacesService(this.log, this.getLegacyAPI); const spacesService = await service.setup({ @@ -131,20 +141,19 @@ export class Plugin { initSpacesRequestInterceptors({ http: core.http, log: this.log, - getLegacyAPI: this.getLegacyAPI, spacesService, features: plugins.features, }); - core.capabilities.registerSwitcher(async (request, uiCapabilities) => { - try { - const activeSpace = await spacesService.getActiveSpace(request); - const features = plugins.features.getFeatures(); - return toggleUICapabilities(features, uiCapabilities, activeSpace); - } catch (e) { - return uiCapabilities; - } - }); + setupCapabilities(core, spacesService, this.log); + + if (plugins.usageCollection) { + registerSpacesUsageCollector(plugins.usageCollection, { + kibanaIndexConfig$: this.kibanaIndexConfig$, + features: plugins.features, + licensing: plugins.licensing, + }); + } if (plugins.security) { plugins.security.registerSpacesService(spacesService); @@ -161,12 +170,7 @@ export class Plugin { __legacyCompat: { registerLegacyAPI: (legacyAPI: LegacyAPI) => { this.legacyAPI = legacyAPI; - this.setupLegacyComponents( - spacesService, - plugins.features, - plugins.licensing, - plugins.usageCollection - ); + this.setupLegacyComponents(spacesService); }, createDefaultSpace: async () => { return await createDefaultSpace({ @@ -180,12 +184,7 @@ export class Plugin { public stop() {} - private setupLegacyComponents( - spacesService: SpacesServiceSetup, - featuresSetup: FeaturesPluginSetup, - licensingSetup: LicensingPluginSetup, - usageCollectionSetup?: UsageCollectionSetup - ) { + private setupLegacyComponents(spacesService: SpacesServiceSetup) { const legacyAPI = this.getLegacyAPI(); const { addScopedSavedObjectsClientWrapperFactory, types } = legacyAPI.savedObjects; addScopedSavedObjectsClientWrapperFactory( @@ -193,11 +192,5 @@ export class Plugin { 'spaces', spacesSavedObjectsClientWrapperFactory(spacesService, types) ); - // Register a function with server to manage the collection of usage stats - registerSpacesUsageCollector(usageCollectionSetup, { - kibanaIndex: legacyAPI.legacyConfig.kibanaIndex, - features: featuresSetup, - licensing: licensingSetup, - }); } } diff --git a/x-pack/plugins/spaces/server/routes/api/__fixtures__/create_legacy_api.ts b/x-pack/plugins/spaces/server/routes/api/__fixtures__/create_legacy_api.ts index 812b02e94f591..7765cc3c52e96 100644 --- a/x-pack/plugins/spaces/server/routes/api/__fixtures__/create_legacy_api.ts +++ b/x-pack/plugins/spaces/server/routes/api/__fixtures__/create_legacy_api.ts @@ -100,9 +100,6 @@ export const createLegacyAPI = ({ } as unknown) as jest.Mocked; const legacyAPI: jest.Mocked = { - legacyConfig: { - kibanaIndex: '', - }, auditLogger: {} as any, savedObjects: savedObjectsService, }; diff --git a/x-pack/plugins/spaces/server/spaces_service/spaces_service.test.ts b/x-pack/plugins/spaces/server/spaces_service/spaces_service.test.ts index 68d096e046ed4..fc5ff39780524 100644 --- a/x-pack/plugins/spaces/server/spaces_service/spaces_service.test.ts +++ b/x-pack/plugins/spaces/server/spaces_service/spaces_service.test.ts @@ -28,7 +28,6 @@ const mockLogger = loggingServiceMock.createLogger(); const createService = async (serverBasePath: string = '') => { const legacyAPI = { - legacyConfig: {}, savedObjects: ({ getSavedObjectsRepository: jest.fn().mockReturnValue({ get: jest.fn().mockImplementation((type, id) => { diff --git a/x-pack/plugins/spaces/server/usage_collection/index.ts b/x-pack/plugins/spaces/server/usage_collection/index.ts new file mode 100644 index 0000000000000..01df2b815f5ff --- /dev/null +++ b/x-pack/plugins/spaces/server/usage_collection/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; + * you may not use this file except in compliance with the Elastic License. + */ + +export { registerSpacesUsageCollector } from './spaces_usage_collector'; diff --git a/x-pack/plugins/spaces/server/lib/spaces_usage_collector.test.ts b/x-pack/plugins/spaces/server/usage_collection/spaces_usage_collector.test.ts similarity index 85% rename from x-pack/plugins/spaces/server/lib/spaces_usage_collector.test.ts rename to x-pack/plugins/spaces/server/usage_collection/spaces_usage_collector.test.ts index c0a6a152c8322..57ec688ab70e8 100644 --- a/x-pack/plugins/spaces/server/lib/spaces_usage_collector.test.ts +++ b/x-pack/plugins/spaces/server/usage_collection/spaces_usage_collector.test.ts @@ -9,6 +9,7 @@ import * as Rx from 'rxjs'; import { PluginsSetup } from '../plugin'; import { Feature } from '../../../features/server'; import { ILicense, LicensingPluginSetup } from '../../../licensing/server'; +import { pluginInitializerContextConfigMock } from 'src/core/server/mocks'; interface SetupOpts { license?: Partial; @@ -72,7 +73,7 @@ describe('error handling', () => { license: { isAvailable: true, type: 'basic' }, }); const { fetch: getSpacesUsage } = getSpacesUsageCollector(usageCollecion as any, { - kibanaIndex: '.kibana', + kibanaIndexConfig$: Rx.of({ kibana: { index: '.kibana' } }), features, licensing, }); @@ -85,7 +86,7 @@ describe('error handling', () => { license: { isAvailable: true, type: 'basic' }, }); const { fetch: getSpacesUsage } = getSpacesUsageCollector(usageCollecion as any, { - kibanaIndex: '.kibana', + kibanaIndexConfig$: Rx.of({ kibana: { index: '.kibana' } }), features, licensing, }); @@ -105,11 +106,25 @@ describe('with a basic license', () => { license: { isAvailable: true, type: 'basic' }, }); const { fetch: getSpacesUsage } = getSpacesUsageCollector(usageCollecion as any, { - kibanaIndex: '.kibana', + kibanaIndexConfig$: pluginInitializerContextConfigMock({}).legacy.globalConfig$, features, licensing, }); usageStats = await getSpacesUsage(defaultCallClusterMock); + + expect(defaultCallClusterMock).toHaveBeenCalledWith('search', { + body: { + aggs: { + disabledFeatures: { + terms: { field: 'space.disabledFeatures', include: ['feature1', 'feature2'], size: 2 }, + }, + }, + query: { term: { type: { value: 'space' } } }, + size: 0, + track_total_hits: true, + }, + index: '.kibana-tests', + }); }); test('sets enabled to true', () => { @@ -139,7 +154,7 @@ describe('with no license', () => { beforeAll(async () => { const { features, licensing, usageCollecion } = setup({ license: { isAvailable: false } }); const { fetch: getSpacesUsage } = getSpacesUsageCollector(usageCollecion as any, { - kibanaIndex: '.kibana', + kibanaIndexConfig$: pluginInitializerContextConfigMock({}).legacy.globalConfig$, features, licensing, }); @@ -170,7 +185,7 @@ describe('with platinum license', () => { license: { isAvailable: true, type: 'platinum' }, }); const { fetch: getSpacesUsage } = getSpacesUsageCollector(usageCollecion as any, { - kibanaIndex: '.kibana', + kibanaIndexConfig$: pluginInitializerContextConfigMock({}).legacy.globalConfig$, features, licensing, }); diff --git a/x-pack/plugins/spaces/server/lib/spaces_usage_collector.ts b/x-pack/plugins/spaces/server/usage_collection/spaces_usage_collector.ts similarity index 90% rename from x-pack/plugins/spaces/server/lib/spaces_usage_collector.ts rename to x-pack/plugins/spaces/server/usage_collection/spaces_usage_collector.ts index af77f2d3a72ba..90187b7853185 100644 --- a/x-pack/plugins/spaces/server/lib/spaces_usage_collector.ts +++ b/x-pack/plugins/spaces/server/usage_collection/spaces_usage_collector.ts @@ -4,11 +4,10 @@ * you may not use this file except in compliance with the Elastic License. */ -import { get } from 'lodash'; import { CallAPIOptions } from 'src/core/server'; import { take } from 'rxjs/operators'; import { UsageCollectionSetup } from 'src/plugins/usage_collection/server'; -// @ts-ignore +import { Observable } from 'rxjs'; import { KIBANA_STATS_TYPE_MONITORING } from '../../../../legacy/plugins/monitoring/common/constants'; import { KIBANA_SPACES_STATS_TYPE } from '../../common/constants'; import { PluginsSetup } from '../plugin'; @@ -85,8 +84,8 @@ async function getSpacesUsage( const { hits, aggregations } = resp!; - const count = get(hits, 'total.value', 0); - const disabledFeatureBuckets = get(aggregations, 'disabledFeatures.buckets', []); + const count = hits?.total?.value ?? 0; + const disabledFeatureBuckets = aggregations?.disabledFeatures?.buckets ?? []; const initialCounts = knownFeatureIds.reduce( (acc, featureId) => ({ ...acc, [featureId]: 0 }), @@ -125,7 +124,7 @@ export interface UsageStats { } interface CollectorDeps { - kibanaIndex: string; + kibanaIndexConfig$: Observable<{ kibana: { index: string } }>; features: PluginsSetup['features']; licensing: PluginsSetup['licensing']; } @@ -145,12 +144,9 @@ export function getSpacesUsageCollector( const license = await deps.licensing.license$.pipe(take(1)).toPromise(); const available = license.isAvailable; // some form of spaces is available for all valid licenses - const usageStats = await getSpacesUsage( - callCluster, - deps.kibanaIndex, - deps.features, - available - ); + const kibanaIndex = (await deps.kibanaIndexConfig$.pipe(take(1)).toPromise()).kibana.index; + + const usageStats = await getSpacesUsage(callCluster, kibanaIndex, deps.features, available); return { available, @@ -178,12 +174,9 @@ export function getSpacesUsageCollector( } export function registerSpacesUsageCollector( - usageCollection: UsageCollectionSetup | undefined, + usageCollection: UsageCollectionSetup, deps: CollectorDeps ) { - if (!usageCollection) { - return; - } const collector = getSpacesUsageCollector(usageCollection, deps); usageCollection.registerCollector(collector); } From 38067da7acd6c77947eafcfe04d894037c5c3351 Mon Sep 17 00:00:00 2001 From: James Gowdy Date: Fri, 28 Feb 2020 14:30:04 +0000 Subject: [PATCH 06/31] [ML] Fixing annotations alias checks (#58722) --- .../ml/server/lib/check_annotations/index.d.ts | 11 ----------- .../check_annotations/{index.js => index.ts} | 17 +++++++++++++---- 2 files changed, 13 insertions(+), 15 deletions(-) delete mode 100644 x-pack/plugins/ml/server/lib/check_annotations/index.d.ts rename x-pack/plugins/ml/server/lib/check_annotations/{index.js => index.ts} (79%) diff --git a/x-pack/plugins/ml/server/lib/check_annotations/index.d.ts b/x-pack/plugins/ml/server/lib/check_annotations/index.d.ts deleted file mode 100644 index dbd08eacd3ca2..0000000000000 --- a/x-pack/plugins/ml/server/lib/check_annotations/index.d.ts +++ /dev/null @@ -1,11 +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; - * you may not use this file except in compliance with the Elastic License. - */ - -import { IScopedClusterClient } from 'src/core/server'; - -export function isAnnotationsFeatureAvailable( - callAsCurrentUser: IScopedClusterClient['callAsCurrentUser'] -): boolean; diff --git a/x-pack/plugins/ml/server/lib/check_annotations/index.js b/x-pack/plugins/ml/server/lib/check_annotations/index.ts similarity index 79% rename from x-pack/plugins/ml/server/lib/check_annotations/index.js rename to x-pack/plugins/ml/server/lib/check_annotations/index.ts index 55a90c0cec322..8d9d56ad665c4 100644 --- a/x-pack/plugins/ml/server/lib/check_annotations/index.js +++ b/x-pack/plugins/ml/server/lib/check_annotations/index.ts @@ -4,6 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ +import { APICaller } from 'src/core/server'; import { mlLog } from '../../client/log'; import { @@ -16,23 +17,31 @@ import { // - ML_ANNOTATIONS_INDEX_PATTERN index is present // - ML_ANNOTATIONS_INDEX_ALIAS_READ alias is present // - ML_ANNOTATIONS_INDEX_ALIAS_WRITE alias is present -export async function isAnnotationsFeatureAvailable(callAsCurrentUser) { +export async function isAnnotationsFeatureAvailable(callAsCurrentUser: APICaller) { try { const indexParams = { index: ML_ANNOTATIONS_INDEX_PATTERN }; const annotationsIndexExists = await callAsCurrentUser('indices.exists', indexParams); - if (!annotationsIndexExists) return false; + if (!annotationsIndexExists) { + return false; + } const annotationsReadAliasExists = await callAsCurrentUser('indices.existsAlias', { + index: ML_ANNOTATIONS_INDEX_ALIAS_READ, name: ML_ANNOTATIONS_INDEX_ALIAS_READ, }); - if (!annotationsReadAliasExists) return false; + if (!annotationsReadAliasExists) { + return false; + } const annotationsWriteAliasExists = await callAsCurrentUser('indices.existsAlias', { + index: ML_ANNOTATIONS_INDEX_ALIAS_WRITE, name: ML_ANNOTATIONS_INDEX_ALIAS_WRITE, }); - if (!annotationsWriteAliasExists) return false; + if (!annotationsWriteAliasExists) { + return false; + } } catch (err) { mlLog.info('Disabling ML annotations feature because the index/alias integrity check failed.'); return false; From f86c75893b4265fece1369539eb29478658feed0 Mon Sep 17 00:00:00 2001 From: Dario Gieselaar Date: Fri, 28 Feb 2020 16:32:46 +0100 Subject: [PATCH 07/31] [APM] Update tsconfig.json template in optimization script (#58731) * [APM] Update tsconfig.json template in optimization script The location of the cypress tests has changed, and those files are no longer excluded in the APM type check. This change updates the tsconfig.json template to exclude the new location. * Update link in readme --- x-pack/legacy/plugins/apm/readme.md | 2 +- .../legacy/plugins/apm/scripts/optimize-tsconfig/tsconfig.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/x-pack/legacy/plugins/apm/readme.md b/x-pack/legacy/plugins/apm/readme.md index 0edcdc279815c..addf73064716c 100644 --- a/x-pack/legacy/plugins/apm/readme.md +++ b/x-pack/legacy/plugins/apm/readme.md @@ -125,6 +125,6 @@ You can access the development environment at http://localhost:9001. #### Further resources -- [Cypress integration tests](cypress/README.md) +- [Cypress integration tests](./e2e/README.md) - [VSCode setup instructions](./dev_docs/vscode_setup.md) - [Github PR commands](./dev_docs/github_commands.md) diff --git a/x-pack/legacy/plugins/apm/scripts/optimize-tsconfig/tsconfig.json b/x-pack/legacy/plugins/apm/scripts/optimize-tsconfig/tsconfig.json index c2f87503b4548..5021694ff04ac 100644 --- a/x-pack/legacy/plugins/apm/scripts/optimize-tsconfig/tsconfig.json +++ b/x-pack/legacy/plugins/apm/scripts/optimize-tsconfig/tsconfig.json @@ -7,6 +7,6 @@ ], "exclude": [ "**/__fixtures__/**/*", - "./cypress/**/*" + "./e2e/cypress/**/*" ] } From 7aaf58c86c6932b996a8b42d1258b782a6390cd2 Mon Sep 17 00:00:00 2001 From: Frank Hassanabad Date: Fri, 28 Feb 2020 08:38:23 -0700 Subject: [PATCH 08/31] Added Security Intelligence And Analytics for prepackaged_rules (#58808) --- .github/CODEOWNERS | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index b924c7a1a2c29..de46bcfa69830 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -195,3 +195,7 @@ /x-pack/test/detection_engine_api_integration @elastic/siem /x-pack/test/api_integration/apis/siem @elastic/siem /x-pack/plugins/case @elastic/siem + +# Security Intelligence And Analytics +/x-pack/legacy/plugins/siem/server/lib/detection_engine/rules/prepackaged_rules @elastic/security-intelligence-analytics +/x-pack/plugins/siem/server/lib/detection_engine/rules/prepackaged_rules @elastic/security-intelligence-analytics From 2b9dc43158fcb71a87a7e2922783339947b5d95a Mon Sep 17 00:00:00 2001 From: Pierre Gayvallet Date: Fri, 28 Feb 2020 16:39:06 +0100 Subject: [PATCH 09/31] add dynamic property to type definition (#58852) --- ...vedobjectstypemappingdefinition.dynamic.md | 13 +++ ...erver.savedobjectstypemappingdefinition.md | 3 +- ...objectstypemappingdefinition.properties.md | 2 + .../server/saved_objects/mappings/types.ts | 3 + .../build_active_mappings.test.ts.snap | 79 +++++++++++++++++++ .../core/build_active_mappings.test.ts | 19 ++++- src/core/server/server.api.md | 2 +- 7 files changed, 118 insertions(+), 3 deletions(-) create mode 100644 docs/development/core/server/kibana-plugin-server.savedobjectstypemappingdefinition.dynamic.md diff --git a/docs/development/core/server/kibana-plugin-server.savedobjectstypemappingdefinition.dynamic.md b/docs/development/core/server/kibana-plugin-server.savedobjectstypemappingdefinition.dynamic.md new file mode 100644 index 0000000000000..0efab7bebfbe5 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-server.savedobjectstypemappingdefinition.dynamic.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [SavedObjectsTypeMappingDefinition](./kibana-plugin-server.savedobjectstypemappingdefinition.md) > [dynamic](./kibana-plugin-server.savedobjectstypemappingdefinition.dynamic.md) + +## SavedObjectsTypeMappingDefinition.dynamic property + +The dynamic property of the mapping. either `false` or 'strict'. Defaults to strict + +Signature: + +```typescript +dynamic?: false | 'strict'; +``` diff --git a/docs/development/core/server/kibana-plugin-server.savedobjectstypemappingdefinition.md b/docs/development/core/server/kibana-plugin-server.savedobjectstypemappingdefinition.md index 99983d3a9f02b..8c1a279894ffd 100644 --- a/docs/development/core/server/kibana-plugin-server.savedobjectstypemappingdefinition.md +++ b/docs/development/core/server/kibana-plugin-server.savedobjectstypemappingdefinition.md @@ -41,5 +41,6 @@ const typeDefinition: SavedObjectsTypeMappingDefinition = { | Property | Type | Description | | --- | --- | --- | -| [properties](./kibana-plugin-server.savedobjectstypemappingdefinition.properties.md) | SavedObjectsMappingProperties | | +| [dynamic](./kibana-plugin-server.savedobjectstypemappingdefinition.dynamic.md) | false | 'strict' | The dynamic property of the mapping. either false or 'strict'. Defaults to strict | +| [properties](./kibana-plugin-server.savedobjectstypemappingdefinition.properties.md) | SavedObjectsMappingProperties | The underlying properties of the type mapping | diff --git a/docs/development/core/server/kibana-plugin-server.savedobjectstypemappingdefinition.properties.md b/docs/development/core/server/kibana-plugin-server.savedobjectstypemappingdefinition.properties.md index 555870c3fdd7d..f6be5214ec6d9 100644 --- a/docs/development/core/server/kibana-plugin-server.savedobjectstypemappingdefinition.properties.md +++ b/docs/development/core/server/kibana-plugin-server.savedobjectstypemappingdefinition.properties.md @@ -4,6 +4,8 @@ ## SavedObjectsTypeMappingDefinition.properties property +The underlying properties of the type mapping + Signature: ```typescript diff --git a/src/core/server/saved_objects/mappings/types.ts b/src/core/server/saved_objects/mappings/types.ts index 578fdcea3718e..bc556c0429981 100644 --- a/src/core/server/saved_objects/mappings/types.ts +++ b/src/core/server/saved_objects/mappings/types.ts @@ -45,6 +45,9 @@ * @public */ export interface SavedObjectsTypeMappingDefinition { + /** The dynamic property of the mapping. either `false` or 'strict'. Defaults to strict */ + dynamic?: false | 'strict'; + /** The underlying properties of the type mapping */ properties: SavedObjectsMappingProperties; } diff --git a/src/core/server/saved_objects/migrations/core/__snapshots__/build_active_mappings.test.ts.snap b/src/core/server/saved_objects/migrations/core/__snapshots__/build_active_mappings.test.ts.snap index e82fbfc85dfa0..68f90ea70a0c6 100644 --- a/src/core/server/saved_objects/migrations/core/__snapshots__/build_active_mappings.test.ts.snap +++ b/src/core/server/saved_objects/migrations/core/__snapshots__/build_active_mappings.test.ts.snap @@ -60,3 +60,82 @@ Object { }, } `; + +exports[`buildActiveMappings handles the \`dynamic\` property of types 1`] = ` +Object { + "_meta": Object { + "migrationMappingPropertyHashes": Object { + "config": "87aca8fdb053154f11383fce3dbf3edf", + "firstType": "635418ab953d81d93f1190b70a8d3f57", + "migrationVersion": "4a1746014a75ade3a714e1db5763276f", + "namespace": "2f4316de49999235636386fe51dc06c1", + "references": "7997cf5a56cc02bdc9c93361bde732b0", + "secondType": "72d57924f415fbadb3ee293b67d233ab", + "thirdType": "510f1f0adb69830cf8a1c5ce2923ed82", + "type": "2f4316de49999235636386fe51dc06c1", + "updated_at": "00da57df13e94e9d98437d13ace4bfe0", + }, + }, + "dynamic": "strict", + "properties": Object { + "config": Object { + "dynamic": "true", + "properties": Object { + "buildNum": Object { + "type": "keyword", + }, + }, + }, + "firstType": Object { + "dynamic": "strict", + "properties": Object { + "field": Object { + "type": "keyword", + }, + }, + }, + "migrationVersion": Object { + "dynamic": "true", + "type": "object", + }, + "namespace": Object { + "type": "keyword", + }, + "references": Object { + "properties": Object { + "id": Object { + "type": "keyword", + }, + "name": Object { + "type": "keyword", + }, + "type": Object { + "type": "keyword", + }, + }, + "type": "nested", + }, + "secondType": Object { + "dynamic": false, + "properties": Object { + "field": Object { + "type": "long", + }, + }, + }, + "thirdType": Object { + "properties": Object { + "field": Object { + "type": "text", + }, + }, + }, + "type": Object { + "type": "keyword", + }, + "updated_at": Object { + "type": "date", + }, + }, +} +`; diff --git a/src/core/server/saved_objects/migrations/core/build_active_mappings.test.ts b/src/core/server/saved_objects/migrations/core/build_active_mappings.test.ts index 9d220cfdf94b7..33e1a395e64a2 100644 --- a/src/core/server/saved_objects/migrations/core/build_active_mappings.test.ts +++ b/src/core/server/saved_objects/migrations/core/build_active_mappings.test.ts @@ -17,7 +17,7 @@ * under the License. */ -import { IndexMapping } from './../../mappings'; +import { IndexMapping, SavedObjectsTypeMappingDefinitions } from './../../mappings'; import { buildActiveMappings, diffMappings } from './build_active_mappings'; describe('buildActiveMappings', () => { @@ -49,6 +49,23 @@ describe('buildActiveMappings', () => { ); }); + test('handles the `dynamic` property of types', () => { + const typeMappings: SavedObjectsTypeMappingDefinitions = { + firstType: { + dynamic: 'strict', + properties: { field: { type: 'keyword' } }, + }, + secondType: { + dynamic: false, + properties: { field: { type: 'long' } }, + }, + thirdType: { + properties: { field: { type: 'text' } }, + }, + }; + expect(buildActiveMappings(typeMappings)).toMatchSnapshot(); + }); + test('generated hashes are stable', () => { const properties = { aaa: { type: 'keyword', fields: { a: { type: 'keyword' }, b: { type: 'text' } } }, diff --git a/src/core/server/server.api.md b/src/core/server/server.api.md index 8f4feb7169651..42bc1ce214b19 100644 --- a/src/core/server/server.api.md +++ b/src/core/server/server.api.md @@ -2058,7 +2058,7 @@ export interface SavedObjectsType { // @public export interface SavedObjectsTypeMappingDefinition { - // (undocumented) + dynamic?: false | 'strict'; properties: SavedObjectsMappingProperties; } From 29fbe395b71bf1a2d8de9e3d10cfa3440e8eb47f Mon Sep 17 00:00:00 2001 From: Chris Cowan Date: Fri, 28 Feb 2020 09:42:52 -0700 Subject: [PATCH 10/31] [Metrics UI] Use CPU Usage limits for Kubernetes pods when available (#58424) Co-authored-by: Elastic Machine --- .../pod/metrics/snapshot/cpu.ts | 20 ++++++++++++++++++- .../pod/metrics/tsvb/pod_cpu_usage.ts | 16 ++++++++++++++- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/infra/common/inventory_models/pod/metrics/snapshot/cpu.ts b/x-pack/plugins/infra/common/inventory_models/pod/metrics/snapshot/cpu.ts index f25dd8179aa1a..d5979d455f0bf 100644 --- a/x-pack/plugins/infra/common/inventory_models/pod/metrics/snapshot/cpu.ts +++ b/x-pack/plugins/infra/common/inventory_models/pod/metrics/snapshot/cpu.ts @@ -7,9 +7,27 @@ import { SnapshotModel } from '../../../types'; export const cpu: SnapshotModel = { - cpu: { + cpu_with_limit: { + avg: { + field: 'kubernetes.pod.cpu.usage.limit.pct', + }, + }, + cpu_without_limit: { avg: { field: 'kubernetes.pod.cpu.usage.node.pct', }, }, + cpu: { + bucket_script: { + buckets_path: { + with_limit: 'cpu_with_limit', + without_limit: 'cpu_without_limit', + }, + script: { + source: 'params.with_limit > 0.0 ? params.with_limit : params.without_limit', + lang: 'painless', + }, + gap_policy: 'skip', + }, + }, }; diff --git a/x-pack/plugins/infra/common/inventory_models/pod/metrics/tsvb/pod_cpu_usage.ts b/x-pack/plugins/infra/common/inventory_models/pod/metrics/tsvb/pod_cpu_usage.ts index 1d778d11e0725..52d48c6329e51 100644 --- a/x-pack/plugins/infra/common/inventory_models/pod/metrics/tsvb/pod_cpu_usage.ts +++ b/x-pack/plugins/infra/common/inventory_models/pod/metrics/tsvb/pod_cpu_usage.ts @@ -24,9 +24,23 @@ export const podCpuUsage: TSVBMetricModelCreator = ( metrics: [ { field: 'kubernetes.pod.cpu.usage.node.pct', - id: 'avg-cpu-usage', + id: 'avg-cpu-without', type: 'avg', }, + { + field: 'kubernetes.pod.cpu.usage.limit.pct', + id: 'avg-cpu-with', + type: 'avg', + }, + { + id: 'cpu-usage', + type: 'calculation', + variables: [ + { id: 'cpu_with', name: 'with_limit', field: 'avg-cpu-with' }, + { id: 'cpu_without', name: 'without_limit', field: 'avg-cpu-without' }, + ], + script: 'params.with_limit > 0.0 ? params.with_limit : params.without_limit', + }, ], }, ], From 5b7270541ccbcb923e4b7728478276a17225d85e Mon Sep 17 00:00:00 2001 From: Patrick Mueller Date: Fri, 28 Feb 2020 11:48:28 -0500 Subject: [PATCH 11/31] [alerting] initial index threshold alertType and supporting APIs (#57030) Adds the first built-in alertType for Kibana alerting, an index threshold alert, and associated HTTP endpoint to generate preview data for it. addresses the server-side requirements for issue https://github.com/elastic/kibana/issues/53041 --- x-pack/.i18nrc.json | 1 + x-pack/plugins/alerting_builtins/README.md | 23 ++ x-pack/plugins/alerting_builtins/kibana.json | 8 + .../server/alert_types/index.ts | 19 ++ .../alert_types/index_threshold/README.md | 271 +++++++++++++++++ .../index_threshold/action_context.test.ts | 89 ++++++ .../index_threshold/action_context.ts | 69 +++++ .../index_threshold/alert_type.test.ts | 56 ++++ .../alert_types/index_threshold/alert_type.ts | 129 ++++++++ .../index_threshold/alert_type_params.test.ts | 67 +++++ .../index_threshold/alert_type_params.ts | 65 ++++ .../alert_types/index_threshold/index.ts | 37 +++ .../lib/core_query_types.test.ts | 165 ++++++++++ .../index_threshold/lib/core_query_types.ts | 108 +++++++ .../lib/date_range_info.test.ts | 225 ++++++++++++++ .../index_threshold/lib/date_range_info.ts | 128 ++++++++ .../lib/time_series_query.test.ts | 64 ++++ .../index_threshold/lib/time_series_query.ts | 152 ++++++++++ .../lib/time_series_types.test.ts | 105 +++++++ .../index_threshold/lib/time_series_types.ts | 106 +++++++ .../alert_types/index_threshold/routes.ts | 53 ++++ .../alerting_builtins/server/config.ts | 13 + .../plugins/alerting_builtins/server/index.ts | 17 ++ .../alerting_builtins/server/plugin.test.ts | 70 +++++ .../alerting_builtins/server/plugin.ts | 40 +++ .../plugins/alerting_builtins/server/types.ts | 34 +++ .../common/lib/es_test_index_tool.ts | 10 + .../alerting/builtin_alert_types/index.ts | 14 + .../index_threshold/create_test_data.ts | 72 +++++ .../index_threshold/index.ts | 14 + .../index_threshold/query_data_endpoint.ts | 283 ++++++++++++++++++ .../spaces_only/tests/alerting/index.ts | 1 + 32 files changed, 2508 insertions(+) create mode 100644 x-pack/plugins/alerting_builtins/README.md create mode 100644 x-pack/plugins/alerting_builtins/kibana.json create mode 100644 x-pack/plugins/alerting_builtins/server/alert_types/index.ts create mode 100644 x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/README.md create mode 100644 x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/action_context.test.ts create mode 100644 x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/action_context.ts create mode 100644 x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/alert_type.test.ts create mode 100644 x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/alert_type.ts create mode 100644 x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/alert_type_params.test.ts create mode 100644 x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/alert_type_params.ts create mode 100644 x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/index.ts create mode 100644 x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/lib/core_query_types.test.ts create mode 100644 x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/lib/core_query_types.ts create mode 100644 x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/lib/date_range_info.test.ts create mode 100644 x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/lib/date_range_info.ts create mode 100644 x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/lib/time_series_query.test.ts create mode 100644 x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/lib/time_series_query.ts create mode 100644 x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/lib/time_series_types.test.ts create mode 100644 x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/lib/time_series_types.ts create mode 100644 x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/routes.ts create mode 100644 x-pack/plugins/alerting_builtins/server/config.ts create mode 100644 x-pack/plugins/alerting_builtins/server/index.ts create mode 100644 x-pack/plugins/alerting_builtins/server/plugin.test.ts create mode 100644 x-pack/plugins/alerting_builtins/server/plugin.ts create mode 100644 x-pack/plugins/alerting_builtins/server/types.ts create mode 100644 x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/index.ts create mode 100644 x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/index_threshold/create_test_data.ts create mode 100644 x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/index_threshold/index.ts create mode 100644 x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/index_threshold/query_data_endpoint.ts diff --git a/x-pack/.i18nrc.json b/x-pack/.i18nrc.json index 66342266f1dbc..51099815ec938 100644 --- a/x-pack/.i18nrc.json +++ b/x-pack/.i18nrc.json @@ -4,6 +4,7 @@ "xpack.actions": "plugins/actions", "xpack.advancedUiActions": "plugins/advanced_ui_actions", "xpack.alerting": "plugins/alerting", + "xpack.alertingBuiltins": "plugins/alerting_builtins", "xpack.apm": ["legacy/plugins/apm", "plugins/apm"], "xpack.beatsManagement": "legacy/plugins/beats_management", "xpack.canvas": "legacy/plugins/canvas", diff --git a/x-pack/plugins/alerting_builtins/README.md b/x-pack/plugins/alerting_builtins/README.md new file mode 100644 index 0000000000000..233984a1ff23f --- /dev/null +++ b/x-pack/plugins/alerting_builtins/README.md @@ -0,0 +1,23 @@ +# alerting_builtins plugin + +This plugin provides alertTypes shipped with Kibana for use with the +[the alerting plugin](../alerting/README.md). When enabled, it will register +the built-in alertTypes with the alerting plugin, register associated HTTP +routes, etc. + +The plugin `setup` and `start` contracts for this plugin are the following +type, which provides some runtime capabilities. Each built-in alertType will +have it's own top-level property in the `IService` interface, if it needs to +expose functionality. + +```ts +export interface IService { + indexThreshold: { + timeSeriesQuery(params: TimeSeriesQueryParameters): Promise; + } +} +``` + +Each built-in alertType is described in it's own README: + +- index threshold: [`server/alert_types/index_threshold`](server/alert_types/index_threshold/README.md) diff --git a/x-pack/plugins/alerting_builtins/kibana.json b/x-pack/plugins/alerting_builtins/kibana.json new file mode 100644 index 0000000000000..cd6bb7519c093 --- /dev/null +++ b/x-pack/plugins/alerting_builtins/kibana.json @@ -0,0 +1,8 @@ +{ + "id": "alertingBuiltins", + "server": true, + "version": "8.0.0", + "kibanaVersion": "kibana", + "requiredPlugins": ["alerting"], + "ui": false +} diff --git a/x-pack/plugins/alerting_builtins/server/alert_types/index.ts b/x-pack/plugins/alerting_builtins/server/alert_types/index.ts new file mode 100644 index 0000000000000..475efc87b443a --- /dev/null +++ b/x-pack/plugins/alerting_builtins/server/alert_types/index.ts @@ -0,0 +1,19 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { Service, IRouter, AlertingSetup } from '../types'; +import { register as registerIndexThreshold } from './index_threshold'; + +interface RegisterBuiltInAlertTypesParams { + service: Service; + router: IRouter; + alerting: AlertingSetup; + baseRoute: string; +} + +export function registerBuiltInAlertTypes(params: RegisterBuiltInAlertTypesParams) { + registerIndexThreshold(params); +} diff --git a/x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/README.md b/x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/README.md new file mode 100644 index 0000000000000..b1a9e6daaaee3 --- /dev/null +++ b/x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/README.md @@ -0,0 +1,271 @@ +# built-in alertType index threshold + +directory in plugin: `server/alert_types/index_threshold` + +The index threshold alert type is designed to run an ES query over indices, +aggregating field values from documents, comparing them to threshold values, +and scheduling actions to run when the thresholds are met. + +And example would be checking a monitoring index for percent cpu usage field +values that are greater than some threshold, which could then be used to invoke +an action (email, slack, etc) to notify interested parties when the threshold +is exceeded. + +## alertType `.index-threshold` + +The alertType parameters are specified in +[`lib/core_query_types.ts`][it-core-query] +and +[`alert_type_params.ts`][it-alert-params]. + +The alertType has a single actionGroup, `'threshold met'`. The `context` object +provided to actions is specified in +[`action_context.ts`][it-alert-context]. + +[it-alert-params]: alert_type_params.ts +[it-alert-context]: action_context.ts +[it-core-query]: lib/core_query_types.ts + +### example + +This example uses [kbn-action][]'s `kbn-alert` command to create the alert, +and [es-hb-sim][] to generate ES documents for the alert to run queries +against. + +Start `es-hb-sim`: + +``` +es-hb-sim 1 es-hb-sim host-A https://elastic:changeme@localhost:9200 +``` + +This will start indexing documents of the following form, to the `es-hb-sim` +index: + +``` +{"@timestamp":"2020-02-20T22:10:30.011Z","summary":{"up":1,"down":0},"monitor":{"status":"up","name":"host-A"}} +``` + +Press `u` to have it start writing "down" documents instead of "up" documents. + +Create a server log action that we can use with the alert: + +``` +export ACTION_ID=`kbn-action create .server-log 'server-log' '{}' '{}' | jq -r '.id'` +``` + +Finally, create the alert: + +``` +kbn-alert create .index-threshold 'es-hb-sim threshold' 1s \ + '{ + index: es-hb-sim + timeField: @timestamp + aggType: average + aggField: summary.up + groupField: monitor.name.keyword + window: 5s + comparator: lessThan + threshold: [ 0.6 ] + }' \ + "[ + { + group: threshold met + id: '$ACTION_ID' + params: { + level: warn + message: '{{context.message}}' + } + } + ]" +``` + +This alert will run a query over the `es-hb-sim` index, using the `@timestamp` +field as the date field, using an `average` aggregation over the `summary.up` +field. The results are then aggregated by `monitor.name.keyword`. If we ran +another instance of `es-hb-sim`, using `host-B` instead of `host-A`, then the +alert will end up potentially scheduling actions for both, independently. +Within the alerting plugin, this grouping is also referred to as "instanceIds" +(`host-A` and `host-B` being distinct instanceIds, which can have actions +scheduled against them independently). + +The `window` is set to `5s` which is 5 seconds. That means, every time the +alert runs it's queries (every second, in the example above), it will run it's +ES query over the last 5 seconds. Thus, the queries, over time, will overlap. +Sometimes that's what you want. Other times, maybe you just want to do +sampling, running an alert every hour, with a 5 minute window. Up to the you! + +Using the `comparator` `lessThan` and `threshold` `[0.6]`, the alert will +calculate the average of all the `summary.up` fields for each unique +`monitor.name.keyword`, and then if the value is less than 0.6, it will +schedule the specified action (server log) to run. The `message` param +passed to the action includes a mustache template for the context variable +`message`, which is created by the alert type. That message generates +a generic but useful text message, already constructed. Alternatively, +a customer could set the `message` param in the action to a much more +complex message, using other context variables made available by the +alert type. + +Here's the message you should see in the Kibana console, if everything is +working: + +``` +server log [17:32:10.060] [warning][actions][actions][plugins] \ + Server log: alert es-hb-sim threshold instance host-A value 0 \ + exceeded threshold average(summary.up) lessThan 0.6 over 5s \ + on 2020-02-20T22:32:07.000Z +``` + +[kbn-action]: https://github.com/pmuellr/kbn-action +[es-hb-sim]: https://github.com/pmuellr/es-hb-sim +[now-iso]: https://github.com/pmuellr/now-iso + + +## http endpoints + +An HTTP endpoint is provided to return the values the alertType would calculate, +over a series of time. This is intended to be used in the alerting UI to +provide a "preview" of the alert during creation/editing based on recent data, +and could be used to show a "simulation" of the the alert over an arbitrary +range of time. + +The endpoint is `POST /api/alerting_builtins/index_threshold/_time_series_query`. +The request and response bodies are specifed in +[`lib/core_query_types.ts`][it-core-query] +and +[`lib/time_series_types.ts`][it-timeSeries-types]. +The request body is very similar to the alertType's parameters. + +### example + +Continuing with the example above, here's a query to get the values calculated +for the last 10 seconds. +This example uses [now-iso][] to generate iso date strings. + +```console +curl -k "https://elastic:changeme@localhost:5601/api/alerting_builtins/index_threshold/_time_series_query" \ + -H "kbn-xsrf: foo" -H "content-type: application/json" -d "{ + \"index\": \"es-hb-sim\", + \"timeField\": \"@timestamp\", + \"aggType\": \"average\", + \"aggField\": \"summary.up\", + \"groupField\": \"monitor.name.keyword\", + \"interval\": \"1s\", + \"dateStart\": \"`now-iso -10s`\", + \"dateEnd\": \"`now-iso`\", + \"window\": \"5s\" +}" +``` + +``` +{ + "results": [ + { + "group": "host-A", + "metrics": [ + [ "2020-02-26T15:10:40.000Z", 0 ], + [ "2020-02-26T15:10:41.000Z", 0 ], + [ "2020-02-26T15:10:42.000Z", 0 ], + [ "2020-02-26T15:10:43.000Z", 0 ], + [ "2020-02-26T15:10:44.000Z", 0 ], + [ "2020-02-26T15:10:45.000Z", 0 ], + [ "2020-02-26T15:10:46.000Z", 0 ], + [ "2020-02-26T15:10:47.000Z", 0 ], + [ "2020-02-26T15:10:48.000Z", 0 ], + [ "2020-02-26T15:10:49.000Z", 0 ], + [ "2020-02-26T15:10:50.000Z", 0 ] + ] + } + ] +} +``` + +To get the current value of the calculated metric, you can leave off the date: + +``` +curl -k "https://elastic:changeme@localhost:5601/api/alerting_builtins/index_threshold/_time_series_query" \ + -H "kbn-xsrf: foo" -H "content-type: application/json" -d '{ + "index": "es-hb-sim", + "timeField": "@timestamp", + "aggType": "average", + "aggField": "summary.up", + "groupField": "monitor.name.keyword", + "interval": "1s", + "window": "5s" +}' +``` + +``` +{ + "results": [ + { + "group": "host-A", + "metrics": [ + [ "2020-02-26T15:23:36.635Z", 0 ] + ] + } + ] +} +``` + +[it-timeSeries-types]: lib/time_series_types.ts + +## service functions + +A single service function is available that provides the functionality +of the http endpoint `POST /api/alerting_builtins/index_threshold/_time_series_query`, +but as an API for Kibana plugins. The function is available as +`alertingService.indexThreshold.timeSeriesQuery()` + +The parameters and return value for the function are the same as for the HTTP +request, though some additional parameters are required (logger, callCluster, +etc). + +## notes on the timeSeriesQuery API / http endpoint + +This API provides additional parameters beyond what the alertType itself uses: + +- `dateStart` +- `dateEnd` +- `interval` + +The `dateStart` and `dateEnd` parameters are ISO date strings. + +The `interval` parameter is intended to model the `interval` the alert is +currently using, and uses the same `1s`, `2m`, `3h`, etc format. Over the +supplied date range, a time-series data point will be calculated every +`interval` duration. + +So the number of time-series points in the output of the API should be: + +``` +( dateStart - dateEnd ) / interval +``` + +Example: + +``` +dateStart: '2020-01-01T00:00:00' +dateEnd: '2020-01-02T00:00:00' +interval: '1h' +``` + +The date range is 1 day === 24 hours. The interval is 1 hour. So there should +be ~24 time series points in the output. + +For preview purposes: + +- The `groupLimit` parameter should be used to help cut +down on the amount of work ES does, and keep the generated graphs a little +simpler. Probably something like `10`. + +- For queries with long date ranges, you probably don't want to use the +`interval` the alert is set to, as the `interval` used in the query, as this +could result in a lot of time-series points being generated, which is both +costly in ES, and may result in noisy graphs. + +- The `window` parameter should be the same as what the alert is using, +especially for the `count` and `sum` aggregation types. Those aggregations +don't scale the same way the others do, when the window changes. Even for +the other aggregations, changing the window could result in dramatically +different values being generated - `averages` will be more "average-y", `min` +and `max` will be a little stickier. \ No newline at end of file diff --git a/x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/action_context.test.ts b/x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/action_context.test.ts new file mode 100644 index 0000000000000..fbadf14f1d560 --- /dev/null +++ b/x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/action_context.test.ts @@ -0,0 +1,89 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { BaseActionContext, addMessages } from './action_context'; +import { ParamsSchema } from './alert_type_params'; + +describe('ActionContext', () => { + it('generates expected properties if aggField is null', async () => { + const base: BaseActionContext = { + date: '2020-01-01T00:00:00.000Z', + group: '[group]', + name: '[name]', + spaceId: '[spaceId]', + namespace: '[spaceId]', + value: 42, + }; + const params = ParamsSchema.validate({ + index: '[index]', + timeField: '[timeField]', + aggType: 'count', + window: '5m', + comparator: 'greaterThan', + threshold: [4], + }); + const context = addMessages(base, params); + expect(context.subject).toMatchInlineSnapshot( + `"alert [name] group [group] exceeded threshold"` + ); + expect(context.message).toMatchInlineSnapshot( + `"alert [name] group [group] value 42 exceeded threshold count greaterThan 4 over 5m on 2020-01-01T00:00:00.000Z"` + ); + }); + + it('generates expected properties if aggField is not null', async () => { + const base: BaseActionContext = { + date: '2020-01-01T00:00:00.000Z', + group: '[group]', + name: '[name]', + spaceId: '[spaceId]', + namespace: '[spaceId]', + value: 42, + }; + const params = ParamsSchema.validate({ + index: '[index]', + timeField: '[timeField]', + aggType: 'average', + aggField: '[aggField]', + window: '5m', + comparator: 'greaterThan', + threshold: [4.2], + }); + const context = addMessages(base, params); + expect(context.subject).toMatchInlineSnapshot( + `"alert [name] group [group] exceeded threshold"` + ); + expect(context.message).toMatchInlineSnapshot( + `"alert [name] group [group] value 42 exceeded threshold average([aggField]) greaterThan 4.2 over 5m on 2020-01-01T00:00:00.000Z"` + ); + }); + + it('generates expected properties if comparator is between', async () => { + const base: BaseActionContext = { + date: '2020-01-01T00:00:00.000Z', + group: '[group]', + name: '[name]', + spaceId: '[spaceId]', + namespace: '[spaceId]', + value: 4, + }; + const params = ParamsSchema.validate({ + index: '[index]', + timeField: '[timeField]', + aggType: 'count', + window: '5m', + comparator: 'between', + threshold: [4, 5], + }); + const context = addMessages(base, params); + expect(context.subject).toMatchInlineSnapshot( + `"alert [name] group [group] exceeded threshold"` + ); + expect(context.message).toMatchInlineSnapshot( + `"alert [name] group [group] value 4 exceeded threshold count between 4,5 over 5m on 2020-01-01T00:00:00.000Z"` + ); + }); +}); diff --git a/x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/action_context.ts b/x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/action_context.ts new file mode 100644 index 0000000000000..98a8e5ae14b7f --- /dev/null +++ b/x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/action_context.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; + * you may not use this file except in compliance with the Elastic License. + */ + +import { i18n } from '@kbn/i18n'; +import { Params } from './alert_type_params'; + +// alert type context provided to actions + +export interface ActionContext extends BaseActionContext { + // a short generic message which may be used in an action message + subject: string; + // a longer generic message which may be used in an action message + message: string; +} + +export interface BaseActionContext { + // the alert name + name: string; + // the spaceId of the alert + spaceId: string; + // the namespace of the alert (spaceId === (namespace || 'default') + namespace?: string; + // the alert tags + tags?: string[]; + // the aggType used in the alert + // the value of the aggField, if used, otherwise 'all documents' + group: string; + // the date the alert was run as an ISO date + date: string; + // the value that met the threshold + value: number; +} + +export function addMessages(c: BaseActionContext, p: Params): ActionContext { + const subject = i18n.translate( + 'xpack.alertingBuiltins.indexThreshold.alertTypeContextSubjectTitle', + { + defaultMessage: 'alert {name} group {group} exceeded threshold', + values: { + name: c.name, + group: c.group, + }, + } + ); + + const agg = p.aggField ? `${p.aggType}(${p.aggField})` : `${p.aggType}`; + const humanFn = `${agg} ${p.comparator} ${p.threshold.join(',')}`; + + const message = i18n.translate( + 'xpack.alertingBuiltins.indexThreshold.alertTypeContextMessageDescription', + { + defaultMessage: + 'alert {name} group {group} value {value} exceeded threshold {function} over {window} on {date}', + values: { + name: c.name, + group: c.group, + value: c.value, + function: humanFn, + window: p.window, + date: c.date, + }, + } + ); + + return { ...c, subject, message }; +} diff --git a/x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/alert_type.test.ts b/x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/alert_type.test.ts new file mode 100644 index 0000000000000..f6e26cdaa283a --- /dev/null +++ b/x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/alert_type.test.ts @@ -0,0 +1,56 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { loggingServiceMock } from '../../../../../../src/core/server/mocks'; +import { getAlertType } from './alert_type'; + +describe('alertType', () => { + const service = { + indexThreshold: { + timeSeriesQuery: jest.fn(), + }, + logger: loggingServiceMock.create().get(), + }; + + const alertType = getAlertType(service); + + it('alert type creation structure is the expected value', async () => { + expect(alertType.id).toBe('.index-threshold'); + expect(alertType.name).toBe('Index Threshold'); + expect(alertType.actionGroups).toEqual([{ id: 'threshold met', name: 'Threshold Met' }]); + }); + + it('validator succeeds with valid params', async () => { + const params = { + index: 'index-name', + timeField: 'time-field', + aggType: 'count', + window: '5m', + comparator: 'greaterThan', + threshold: [0], + }; + + expect(alertType.validate?.params?.validate(params)).toBeTruthy(); + }); + + it('validator fails with invalid params', async () => { + const paramsSchema = alertType.validate?.params; + if (!paramsSchema) throw new Error('params validator not set'); + + const params = { + index: 'index-name', + timeField: 'time-field', + aggType: 'foo', + window: '5m', + comparator: 'greaterThan', + threshold: [0], + }; + + expect(() => paramsSchema.validate(params)).toThrowErrorMatchingInlineSnapshot( + `"[aggType]: invalid aggType: \\"foo\\""` + ); + }); +}); diff --git a/x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/alert_type.ts b/x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/alert_type.ts new file mode 100644 index 0000000000000..2b0c07ed4355a --- /dev/null +++ b/x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/alert_type.ts @@ -0,0 +1,129 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { i18n } from '@kbn/i18n'; +import { AlertType, AlertExecutorOptions } from '../../types'; +import { Params, ParamsSchema } from './alert_type_params'; +import { BaseActionContext, addMessages } from './action_context'; + +export const ID = '.index-threshold'; + +import { Service } from '../../types'; + +const ActionGroupId = 'threshold met'; +const ComparatorFns = getComparatorFns(); +export const ComparatorFnNames = new Set(ComparatorFns.keys()); + +export function getAlertType(service: Service): AlertType { + const { logger } = service; + + const alertTypeName = i18n.translate('xpack.alertingBuiltins.indexThreshold.alertTypeTitle', { + defaultMessage: 'Index Threshold', + }); + + const actionGroupName = i18n.translate( + 'xpack.alertingBuiltins.indexThreshold.actionGroupThresholdMetTitle', + { + defaultMessage: 'Threshold Met', + } + ); + + return { + id: ID, + name: alertTypeName, + actionGroups: [{ id: ActionGroupId, name: actionGroupName }], + defaultActionGroupId: ActionGroupId, + validate: { + params: ParamsSchema, + }, + executor, + }; + + async function executor(options: AlertExecutorOptions) { + const { alertId, name, services } = options; + const params: Params = options.params as Params; + + const compareFn = ComparatorFns.get(params.comparator); + if (compareFn == null) { + throw new Error(getInvalidComparatorMessage(params.comparator)); + } + + const callCluster = services.callCluster; + const date = new Date().toISOString(); + // the undefined values below are for config-schema optional types + const queryParams = { + index: params.index, + timeField: params.timeField, + aggType: params.aggType, + aggField: params.aggField, + groupField: params.groupField, + groupLimit: params.groupLimit, + dateStart: date, + dateEnd: date, + window: params.window, + interval: undefined, + }; + const result = await service.indexThreshold.timeSeriesQuery({ + logger, + callCluster, + query: queryParams, + }); + logger.debug(`alert ${ID}:${alertId} "${name}" query result: ${JSON.stringify(result)}`); + + const groupResults = result.results || []; + for (const groupResult of groupResults) { + const instanceId = groupResult.group; + const value = groupResult.metrics[0][1]; + const met = compareFn(value, params.threshold); + + if (!met) continue; + + const baseContext: BaseActionContext = { + name, + spaceId: options.spaceId, + namespace: options.namespace, + tags: options.tags, + date, + group: instanceId, + value, + }; + const actionContext = addMessages(baseContext, params); + const alertInstance = options.services.alertInstanceFactory(instanceId); + alertInstance.scheduleActions(ActionGroupId, actionContext); + logger.debug(`scheduled actionGroup: ${JSON.stringify(actionContext)}`); + } + } +} + +export function getInvalidComparatorMessage(comparator: string) { + return i18n.translate('xpack.alertingBuiltins.indexThreshold.invalidComparatorErrorMessage', { + defaultMessage: 'invalid comparator specified: {comparator}', + values: { + comparator, + }, + }); +} + +type ComparatorFn = (value: number, threshold: number[]) => boolean; + +function getComparatorFns(): Map { + const fns: Record = { + lessThan: (value: number, threshold: number[]) => value < threshold[0], + lessThanOrEqual: (value: number, threshold: number[]) => value <= threshold[0], + greaterThanOrEqual: (value: number, threshold: number[]) => value >= threshold[0], + greaterThan: (value: number, threshold: number[]) => value > threshold[0], + between: (value: number, threshold: number[]) => value >= threshold[0] && value <= threshold[1], + notBetween: (value: number, threshold: number[]) => + value < threshold[0] || value > threshold[1], + }; + + const result = new Map(); + for (const key of Object.keys(fns)) { + result.set(key, fns[key]); + } + + return result; +} diff --git a/x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/alert_type_params.test.ts b/x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/alert_type_params.test.ts new file mode 100644 index 0000000000000..b9f66cfa7a253 --- /dev/null +++ b/x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/alert_type_params.test.ts @@ -0,0 +1,67 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { ParamsSchema } from './alert_type_params'; +import { runTests } from './lib/core_query_types.test'; + +const DefaultParams = { + index: 'index-name', + timeField: 'time-field', + aggType: 'count', + window: '5m', + comparator: 'greaterThan', + threshold: [0], +}; + +describe('alertType Params validate()', () => { + runTests(ParamsSchema, DefaultParams); + + let params: any; + beforeEach(() => { + params = { ...DefaultParams }; + }); + + it('passes for minimal valid input', async () => { + expect(validate()).toBeTruthy(); + }); + + it('passes for maximal valid input', async () => { + params.aggType = 'average'; + params.aggField = 'agg-field'; + params.groupField = 'group-field'; + params.groupLimit = 100; + expect(validate()).toBeTruthy(); + }); + + it('fails for invalid comparator', async () => { + params.comparator = '[invalid-comparator]'; + expect(onValidate()).toThrowErrorMatchingInlineSnapshot( + `"[comparator]: invalid comparator specified: [invalid-comparator]"` + ); + }); + + it('fails for invalid threshold length', async () => { + params.comparator = 'lessThan'; + params.threshold = [0, 1]; + expect(onValidate()).toThrowErrorMatchingInlineSnapshot( + `"[threshold]: must have one element for the \\"lessThan\\" comparator"` + ); + + params.comparator = 'between'; + params.threshold = [0]; + expect(onValidate()).toThrowErrorMatchingInlineSnapshot( + `"[threshold]: must have two elements for the \\"between\\" comparator"` + ); + }); + + function onValidate(): () => void { + return () => validate(); + } + + function validate(): any { + return ParamsSchema.validate(params); + } +}); diff --git a/x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/alert_type_params.ts b/x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/alert_type_params.ts new file mode 100644 index 0000000000000..d5b83f9f6ad5a --- /dev/null +++ b/x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/alert_type_params.ts @@ -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; + * you may not use this file except in compliance with the Elastic License. + */ + +import { i18n } from '@kbn/i18n'; +import { schema, TypeOf } from '@kbn/config-schema'; +import { ComparatorFnNames, getInvalidComparatorMessage } from './alert_type'; +import { CoreQueryParamsSchemaProperties, validateCoreQueryBody } from './lib/core_query_types'; + +// alert type parameters + +export type Params = TypeOf; + +export const ParamsSchema = schema.object( + { + ...CoreQueryParamsSchemaProperties, + // the comparison function to use to determine if the threshold as been met + comparator: schema.string({ validate: validateComparator }), + // the values to use as the threshold; `between` and `notBetween` require + // two values, the others require one. + threshold: schema.arrayOf(schema.number(), { minSize: 1, maxSize: 2 }), + }, + { + validate: validateParams, + } +); + +const betweenComparators = new Set(['between', 'notBetween']); + +// using direct type not allowed, circular reference, so body is typed to any +function validateParams(anyParams: any): string | undefined { + // validate core query parts, return if it fails validation (returning string) + const coreQueryValidated = validateCoreQueryBody(anyParams); + if (coreQueryValidated) return coreQueryValidated; + + const { comparator, threshold }: Params = anyParams; + + if (betweenComparators.has(comparator)) { + if (threshold.length === 1) { + return i18n.translate('xpack.alertingBuiltins.indexThreshold.invalidThreshold2ErrorMessage', { + defaultMessage: '[threshold]: must have two elements for the "{comparator}" comparator', + values: { + comparator, + }, + }); + } + } else { + if (threshold.length === 2) { + return i18n.translate('xpack.alertingBuiltins.indexThreshold.invalidThreshold1ErrorMessage', { + defaultMessage: '[threshold]: must have one element for the "{comparator}" comparator', + values: { + comparator, + }, + }); + } + } +} + +export function validateComparator(comparator: string): string | undefined { + if (ComparatorFnNames.has(comparator)) return; + + return getInvalidComparatorMessage(comparator); +} diff --git a/x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/index.ts b/x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/index.ts new file mode 100644 index 0000000000000..05c6101e0a515 --- /dev/null +++ b/x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/index.ts @@ -0,0 +1,37 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { Service, AlertingSetup, IRouter } from '../../types'; +import { timeSeriesQuery } from './lib/time_series_query'; +import { getAlertType } from './alert_type'; +import { createTimeSeriesQueryRoute } from './routes'; + +// future enhancement: make these configurable? +export const MAX_INTERVALS = 1000; +export const MAX_GROUPS = 1000; +export const DEFAULT_GROUPS = 100; + +export function getService() { + return { + timeSeriesQuery, + }; +} + +interface RegisterParams { + service: Service; + router: IRouter; + alerting: AlertingSetup; + baseRoute: string; +} + +export function register(params: RegisterParams) { + const { service, router, alerting, baseRoute } = params; + + alerting.registerType(getAlertType(service)); + + const alertTypeBaseRoute = `${baseRoute}/index_threshold`; + createTimeSeriesQueryRoute(service, router, alertTypeBaseRoute); +} diff --git a/x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/lib/core_query_types.test.ts b/x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/lib/core_query_types.test.ts new file mode 100644 index 0000000000000..b4f061adb8f54 --- /dev/null +++ b/x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/lib/core_query_types.test.ts @@ -0,0 +1,165 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +// tests of common properties on time_series_query and alert_type_params + +import { ObjectType } from '@kbn/config-schema'; + +import { MAX_GROUPS } from '../index'; + +const DefaultParams: Record = { + index: 'index-name', + timeField: 'time-field', + aggType: 'count', + window: '5m', +}; + +export function runTests(schema: ObjectType, defaultTypeParams: Record): void { + let params: any; + + describe('coreQueryTypes', () => { + beforeEach(() => { + params = { ...DefaultParams, ...defaultTypeParams }; + }); + + it('succeeds with minimal properties', async () => { + expect(validate()).toBeTruthy(); + }); + + it('succeeds with maximal properties', async () => { + params.aggType = 'average'; + params.aggField = 'agg-field'; + params.groupField = 'group-field'; + params.groupLimit = 200; + expect(validate()).toBeTruthy(); + }); + + it('fails for invalid index', async () => { + delete params.index; + expect(onValidate()).toThrowErrorMatchingInlineSnapshot( + `"[index]: expected value of type [string] but got [undefined]"` + ); + + params.index = 42; + expect(onValidate()).toThrowErrorMatchingInlineSnapshot( + `"[index]: expected value of type [string] but got [number]"` + ); + + params.index = ''; + expect(onValidate()).toThrowErrorMatchingInlineSnapshot( + `"[index]: value is [] but it must have a minimum length of [1]."` + ); + }); + + it('fails for invalid timeField', async () => { + delete params.timeField; + expect(onValidate()).toThrowErrorMatchingInlineSnapshot( + `"[timeField]: expected value of type [string] but got [undefined]"` + ); + + params.timeField = 42; + expect(onValidate()).toThrowErrorMatchingInlineSnapshot( + `"[timeField]: expected value of type [string] but got [number]"` + ); + + params.timeField = ''; + expect(onValidate()).toThrowErrorMatchingInlineSnapshot( + `"[timeField]: value is [] but it must have a minimum length of [1]."` + ); + }); + + it('fails for invalid aggType', async () => { + params.aggType = 42; + expect(onValidate()).toThrowErrorMatchingInlineSnapshot( + `"[aggType]: expected value of type [string] but got [number]"` + ); + + params.aggType = '-not-a-valid-aggType-'; + expect(onValidate()).toThrowErrorMatchingInlineSnapshot( + `"[aggType]: invalid aggType: \\"-not-a-valid-aggType-\\""` + ); + }); + + it('fails for invalid aggField', async () => { + params.aggField = 42; + expect(onValidate()).toThrowErrorMatchingInlineSnapshot( + `"[aggField]: expected value of type [string] but got [number]"` + ); + + params.aggField = ''; + expect(onValidate()).toThrowErrorMatchingInlineSnapshot( + `"[aggField]: value is [] but it must have a minimum length of [1]."` + ); + }); + + it('fails for invalid groupField', async () => { + params.groupField = 42; + expect(onValidate()).toThrowErrorMatchingInlineSnapshot( + `"[groupField]: expected value of type [string] but got [number]"` + ); + + params.groupField = ''; + expect(onValidate()).toThrowErrorMatchingInlineSnapshot( + `"[groupField]: value is [] but it must have a minimum length of [1]."` + ); + }); + + it('fails for invalid groupLimit', async () => { + params.groupLimit = 'foo'; + expect(onValidate()).toThrowErrorMatchingInlineSnapshot( + `"[groupLimit]: expected value of type [number] but got [string]"` + ); + + params.groupLimit = 0; + expect(onValidate()).toThrowErrorMatchingInlineSnapshot( + `"[groupLimit]: must be greater than 0"` + ); + + params.groupLimit = MAX_GROUPS + 1; + expect(onValidate()).toThrowErrorMatchingInlineSnapshot( + `"[groupLimit]: must be less than or equal to 1000"` + ); + }); + + it('fails for invalid window', async () => { + params.window = 42; + expect(onValidate()).toThrowErrorMatchingInlineSnapshot( + `"[window]: expected value of type [string] but got [number]"` + ); + + params.window = 'x'; + expect(onValidate()).toThrowErrorMatchingInlineSnapshot( + `"[window]: invalid duration: \\"x\\""` + ); + }); + + it('fails for invalid aggType/aggField', async () => { + params.aggType = 'count'; + params.aggField = 'agg-field-1'; + expect(onValidate()).toThrowErrorMatchingInlineSnapshot( + `"[aggField]: must not have a value when [aggType] is \\"count\\""` + ); + + params.aggType = 'average'; + delete params.aggField; + expect(onValidate()).toThrowErrorMatchingInlineSnapshot( + `"[aggField]: must have a value when [aggType] is \\"average\\""` + ); + }); + }); + + function onValidate(): () => void { + return () => validate(); + } + + function validate(): any { + return schema.validate(params); + } +} + +describe('coreQueryTypes wrapper', () => { + test('this test suite is meant to be called via the export', () => {}); +}); diff --git a/x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/lib/core_query_types.ts b/x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/lib/core_query_types.ts new file mode 100644 index 0000000000000..265a70eba4d6b --- /dev/null +++ b/x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/lib/core_query_types.ts @@ -0,0 +1,108 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +// common properties on time_series_query and alert_type_params + +import { i18n } from '@kbn/i18n'; +import { schema, TypeOf } from '@kbn/config-schema'; + +import { MAX_GROUPS } from '../index'; +import { parseDuration } from '../../../../../alerting/server'; + +export const CoreQueryParamsSchemaProperties = { + // name of the index to search + index: schema.string({ minLength: 1 }), + // field in index used for date/time + timeField: schema.string({ minLength: 1 }), + // aggregation type + aggType: schema.string({ validate: validateAggType }), + // aggregation field + aggField: schema.maybe(schema.string({ minLength: 1 })), + // group field + groupField: schema.maybe(schema.string({ minLength: 1 })), + // limit on number of groups returned + groupLimit: schema.maybe(schema.number()), + // size of time window for date range aggregations + window: schema.string({ validate: validateDuration }), +}; + +const CoreQueryParamsSchema = schema.object(CoreQueryParamsSchemaProperties); +export type CoreQueryParams = TypeOf; + +// Meant to be used in a "subclass"'s schema body validator, so the +// anyParams object is assumed to have been validated with the schema +// above. +// Using direct type not allowed, circular reference, so body is typed to any. +export function validateCoreQueryBody(anyParams: any): string | undefined { + const { aggType, aggField, groupLimit }: CoreQueryParams = anyParams; + + if (aggType === 'count' && aggField) { + return i18n.translate('xpack.alertingBuiltins.indexThreshold.aggTypeNotEmptyErrorMessage', { + defaultMessage: '[aggField]: must not have a value when [aggType] is "{aggType}"', + values: { + aggType, + }, + }); + } + + if (aggType !== 'count' && !aggField) { + return i18n.translate('xpack.alertingBuiltins.indexThreshold.aggTypeRequiredErrorMessage', { + defaultMessage: '[aggField]: must have a value when [aggType] is "{aggType}"', + values: { + aggType, + }, + }); + } + + // schema.number doesn't seem to check the max value ... + if (groupLimit != null) { + if (groupLimit <= 0) { + return i18n.translate( + 'xpack.alertingBuiltins.indexThreshold.invalidGroupMinimumErrorMessage', + { + defaultMessage: '[groupLimit]: must be greater than 0', + } + ); + } + if (groupLimit > MAX_GROUPS) { + return i18n.translate( + 'xpack.alertingBuiltins.indexThreshold.invalidGroupMaximumErrorMessage', + { + defaultMessage: '[groupLimit]: must be less than or equal to {maxGroups}', + values: { + maxGroups: MAX_GROUPS, + }, + } + ); + } + } +} + +const AggTypes = new Set(['count', 'average', 'min', 'max', 'sum']); + +function validateAggType(aggType: string): string | undefined { + if (AggTypes.has(aggType)) return; + + return i18n.translate('xpack.alertingBuiltins.indexThreshold.invalidAggTypeErrorMessage', { + defaultMessage: 'invalid aggType: "{aggType}"', + values: { + aggType, + }, + }); +} + +export function validateDuration(duration: string): string | undefined { + try { + parseDuration(duration); + } catch (err) { + return i18n.translate('xpack.alertingBuiltins.indexThreshold.invalidDurationErrorMessage', { + defaultMessage: 'invalid duration: "{duration}"', + values: { + duration, + }, + }); + } +} diff --git a/x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/lib/date_range_info.test.ts b/x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/lib/date_range_info.test.ts new file mode 100644 index 0000000000000..eff5ef2567784 --- /dev/null +++ b/x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/lib/date_range_info.test.ts @@ -0,0 +1,225 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { times } from 'lodash'; + +import { getDateRangeInfo, DateRangeInfo } from './date_range_info'; + +// dates to test with, separated by 1m, starting with BaseDate, descending +const BaseDate = Date.parse('2000-01-01T00:00:00Z'); +const Dates: string[] = []; + +// array of date strings, starting at 2000-01-01T00:00:00Z, decreasing by 1 minute +times(10, index => Dates.push(new Date(BaseDate - index * 1000 * 60).toISOString())); + +const DEFAULT_WINDOW_MINUTES = 5; + +const BaseRangeQuery = { + window: `${DEFAULT_WINDOW_MINUTES}m`, +}; + +describe('getRangeInfo', () => { + it('should return 1 date range when no dateStart or interval specified', async () => { + const info = getDateRangeInfo({ ...BaseRangeQuery, dateEnd: Dates[0] }); + const rInfo = asReadableDateRangeInfo(info); + expect(rInfo).toMatchInlineSnapshot(` + Object { + "dateStart": "1999-12-31T23:55:00.000Z", + "dateStop_": "2000-01-01T00:00:00.000Z", + "ranges": Array [ + Object { + "f": "1999-12-31T23:55:00.000Z", + "t": "2000-01-01T00:00:00.000Z", + }, + ], + } + `); + }); + + it('should return 1 date range when no dateStart specified', async () => { + const info = getDateRangeInfo({ ...BaseRangeQuery, dateEnd: Dates[0], interval: '1000d' }); + const rInfo = asReadableDateRangeInfo(info); + expect(rInfo).toMatchInlineSnapshot(` + Object { + "dateStart": "1999-12-31T23:55:00.000Z", + "dateStop_": "2000-01-01T00:00:00.000Z", + "ranges": Array [ + Object { + "f": "1999-12-31T23:55:00.000Z", + "t": "2000-01-01T00:00:00.000Z", + }, + ], + } + `); + }); + + it('should return 1 date range when no interval specified', async () => { + const info = getDateRangeInfo({ ...BaseRangeQuery, dateStart: Dates[1], dateEnd: Dates[0] }); + const rInfo = asReadableDateRangeInfo(info); + expect(rInfo).toMatchInlineSnapshot(` + Object { + "dateStart": "1999-12-31T23:55:00.000Z", + "dateStop_": "2000-01-01T00:00:00.000Z", + "ranges": Array [ + Object { + "f": "1999-12-31T23:55:00.000Z", + "t": "2000-01-01T00:00:00.000Z", + }, + ], + } + `); + }); + + it('should return 2 date ranges as expected', async () => { + const info = getDateRangeInfo({ + ...BaseRangeQuery, + dateStart: Dates[1], + dateEnd: Dates[0], + interval: '1m', + }); + const rInfo = asReadableDateRangeInfo(info); + expect(rInfo).toMatchInlineSnapshot(` + Object { + "dateStart": "1999-12-31T23:54:00.000Z", + "dateStop_": "2000-01-01T00:00:00.000Z", + "ranges": Array [ + Object { + "f": "1999-12-31T23:54:00.000Z", + "t": "1999-12-31T23:59:00.000Z", + }, + Object { + "f": "1999-12-31T23:55:00.000Z", + "t": "2000-01-01T00:00:00.000Z", + }, + ], + } + `); + }); + + it('should return 3 date ranges as expected', async () => { + const info = getDateRangeInfo({ + ...BaseRangeQuery, + dateStart: Dates[2], + dateEnd: Dates[0], + interval: '1m', + }); + const rInfo = asReadableDateRangeInfo(info); + expect(rInfo).toMatchInlineSnapshot(` + Object { + "dateStart": "1999-12-31T23:53:00.000Z", + "dateStop_": "2000-01-01T00:00:00.000Z", + "ranges": Array [ + Object { + "f": "1999-12-31T23:53:00.000Z", + "t": "1999-12-31T23:58:00.000Z", + }, + Object { + "f": "1999-12-31T23:54:00.000Z", + "t": "1999-12-31T23:59:00.000Z", + }, + Object { + "f": "1999-12-31T23:55:00.000Z", + "t": "2000-01-01T00:00:00.000Z", + }, + ], + } + `); + }); + + it('should handle no dateStart, dateEnd or interval specified', async () => { + const nowM0 = Date.now(); + const nowM5 = nowM0 - 1000 * 60 * 5; + + const info = getDateRangeInfo(BaseRangeQuery); + expect(sloppyMilliDiff(nowM5, Date.parse(info.dateStart))).toBeCloseTo(0); + expect(sloppyMilliDiff(nowM0, Date.parse(info.dateEnd))).toBeCloseTo(0); + expect(info.dateRanges.length).toEqual(1); + expect(info.dateRanges[0].from).toEqual(info.dateStart); + expect(info.dateRanges[0].to).toEqual(info.dateEnd); + }); + + it('should throw an error if passed dateStart > dateEnd', async () => { + const params = { + ...BaseRangeQuery, + dateStart: '2020-01-01T00:00:00.000Z', + dateEnd: '2000-01-01T00:00:00.000Z', + }; + expect(() => getDateRangeInfo(params)).toThrowErrorMatchingInlineSnapshot( + `"[dateStart]: is greater than [dateEnd]"` + ); + }); + + it('should throw an error if passed an unparseable dateStart', async () => { + const params = { + ...BaseRangeQuery, + dateStart: 'woopsie', + }; + expect(() => getDateRangeInfo(params)).toThrowErrorMatchingInlineSnapshot( + `"invalid date format for dateStart: \\"woopsie\\""` + ); + }); + + it('should throw an error if passed an unparseable dateEnd', async () => { + const params = { + ...BaseRangeQuery, + dateStart: '2020-01-01T00:00:00.000Z', + dateEnd: 'woopsie', + }; + expect(() => getDateRangeInfo(params)).toThrowErrorMatchingInlineSnapshot( + `"invalid date format for dateEnd: \\"woopsie\\""` + ); + }); + + it('should throw an error if passed an unparseable window', async () => { + const params = { window: 'woopsie' }; + expect(() => getDateRangeInfo(params)).toThrowErrorMatchingInlineSnapshot( + `"invalid duration format for window: \\"woopsie\\""` + ); + }); + + it('should throw an error if passed an unparseable interval', async () => { + const params = { + ...BaseRangeQuery, + interval: 'woopsie', + }; + expect(() => getDateRangeInfo(params)).toThrowErrorMatchingInlineSnapshot( + `"invalid duration format for interval: \\"woopsie\\""` + ); + }); + + it('should throw an error if too many intervals calculated', async () => { + const params = { + ...BaseRangeQuery, + dateStart: '2000-01-01T00:00:00.000Z', + dateEnd: '2020-01-01T00:00:00.000Z', + interval: '1s', + }; + expect(() => getDateRangeInfo(params)).toThrowErrorMatchingInlineSnapshot( + `"calculated number of intervals 631152001 is greater than maximum 1000"` + ); + }); +}); + +// Calculate 1/1000 of the millisecond diff between two millisecond values, +// to be used with jest `toBeCloseTo()` +function sloppyMilliDiff(ms1: number | string, ms2: number | string) { + const m1 = typeof ms1 === 'number' ? ms1 : Date.parse(ms1); + const m2 = typeof ms2 === 'number' ? ms2 : Date.parse(ms2); + return Math.abs(m1 - m2) / 1000; +} + +function asReadableDateRangeInfo(info: DateRangeInfo) { + return { + dateStart: info.dateStart, + dateStop_: info.dateEnd, + ranges: info.dateRanges.map(dateRange => { + return { + f: new Date(dateRange.from).toISOString(), + t: new Date(dateRange.to).toISOString(), + }; + }), + }; +} diff --git a/x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/lib/date_range_info.ts b/x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/lib/date_range_info.ts new file mode 100644 index 0000000000000..0a4accc983d79 --- /dev/null +++ b/x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/lib/date_range_info.ts @@ -0,0 +1,128 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { i18n } from '@kbn/i18n'; +import { times } from 'lodash'; +import { parseDuration } from '../../../../../alerting/server'; +import { MAX_INTERVALS } from '../index'; + +// dates as numbers are epoch millis +// dates as strings are ISO + +export interface DateRange { + from: string; + to: string; +} + +export interface DateRangeInfo { + dateStart: string; + dateEnd: string; + dateRanges: DateRange[]; +} + +export interface GetDateRangeInfoParams { + dateStart?: string; + dateEnd?: string; + interval?: string; + window: string; +} + +// Given a start and end date, an interval, and a window, calculate the +// array of date ranges, each date range is offset by it's peer by one interval, +// and each date range is window milliseconds long. +export function getDateRangeInfo(params: GetDateRangeInfoParams): DateRangeInfo { + const { dateStart: dateStartS, dateEnd: dateEndS, interval: intervalS, window: windowS } = params; + + // get dates in epoch millis, interval and window in millis + const dateEnd = getDateOrUndefined(dateEndS, 'dateEnd') || Date.now(); + const dateStart = getDateOrUndefined(dateStartS, 'dateStart') || dateEnd; + + if (dateStart > dateEnd) throw new Error(getDateStartAfterDateEndErrorMessage()); + + const interval = getDurationOrUndefined(intervalS, 'interval') || 0; + const window = getDuration(windowS, 'window'); + + // Start from the end, as it's more likely the user wants precision there. + // We'll reverse the resultant ranges at the end, to get ascending order. + let dateCurrent = dateEnd; + const dateRanges: DateRange[] = []; + + // Calculate number of intervals; if no interval specified, only calculate one. + const intervals = !interval ? 1 : 1 + Math.round((dateEnd - dateStart) / interval); + if (intervals > MAX_INTERVALS) { + throw new Error(getTooManyIntervalsErrorMessage(intervals, MAX_INTERVALS)); + } + + times(intervals, () => { + dateRanges.push({ + from: new Date(dateCurrent - window).toISOString(), + to: new Date(dateCurrent).toISOString(), + }); + dateCurrent -= interval; + }); + + // reverse in-place + dateRanges.reverse(); + + return { + dateStart: dateRanges[0].from, + dateEnd: dateRanges[dateRanges.length - 1].to, + dateRanges, + }; +} + +function getDateOrUndefined(dateS: string | undefined, field: string): number | undefined { + if (!dateS) return undefined; + return getDate(dateS, field); +} + +function getDate(dateS: string, field: string): number { + const date = Date.parse(dateS); + if (isNaN(date)) throw new Error(getParseErrorMessage('date', field, dateS)); + + return date.valueOf(); +} + +function getDurationOrUndefined(durationS: string | undefined, field: string): number | undefined { + if (!durationS) return undefined; + return getDuration(durationS, field); +} + +function getDuration(durationS: string, field: string): number { + try { + return parseDuration(durationS); + } catch (err) { + throw new Error(getParseErrorMessage('duration', field, durationS)); + } +} + +function getParseErrorMessage(formatName: string, fieldName: string, fieldValue: string) { + return i18n.translate('xpack.alertingBuiltins.indexThreshold.formattedFieldErrorMessage', { + defaultMessage: 'invalid {formatName} format for {fieldName}: "{fieldValue}"', + values: { + formatName, + fieldName, + fieldValue, + }, + }); +} + +export function getTooManyIntervalsErrorMessage(intervals: number, maxIntervals: number) { + return i18n.translate('xpack.alertingBuiltins.indexThreshold.maxIntervalsErrorMessage', { + defaultMessage: + 'calculated number of intervals {intervals} is greater than maximum {maxIntervals}', + values: { + intervals, + maxIntervals, + }, + }); +} + +export function getDateStartAfterDateEndErrorMessage(): string { + return i18n.translate('xpack.alertingBuiltins.indexThreshold.dateStartGTdateEndErrorMessage', { + defaultMessage: '[dateStart]: is greater than [dateEnd]', + }); +} diff --git a/x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/lib/time_series_query.test.ts b/x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/lib/time_series_query.test.ts new file mode 100644 index 0000000000000..1955cdfa4cea6 --- /dev/null +++ b/x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/lib/time_series_query.test.ts @@ -0,0 +1,64 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +// test error conditions of calling timeSeriesQuery - postive results tested in FT + +import { loggingServiceMock } from '../../../../../../../src/core/server/mocks'; +import { coreMock } from '../../../../../../../src/core/server/mocks'; +import { AlertingBuiltinsPlugin } from '../../../plugin'; +import { TimeSeriesQueryParameters, TimeSeriesResult } from './time_series_query'; + +type TimeSeriesQuery = (params: TimeSeriesQueryParameters) => Promise; + +const DefaultQueryParams = { + index: 'index-name', + timeField: 'time-field', + aggType: 'count', + aggField: undefined, + window: '5m', + dateStart: undefined, + dateEnd: undefined, + interval: undefined, + groupField: undefined, + groupLimit: undefined, +}; + +describe('timeSeriesQuery', () => { + let params: TimeSeriesQueryParameters; + const mockCallCluster = jest.fn(); + + let timeSeriesQuery: TimeSeriesQuery; + + beforeEach(async () => { + // rather than use the function from an import, retrieve it from the plugin + const context = coreMock.createPluginInitializerContext(); + const plugin = new AlertingBuiltinsPlugin(context); + const coreStart = coreMock.createStart(); + const service = await plugin.start(coreStart); + timeSeriesQuery = service.indexThreshold.timeSeriesQuery; + + mockCallCluster.mockReset(); + params = { + logger: loggingServiceMock.create().get(), + callCluster: mockCallCluster, + query: { ...DefaultQueryParams }, + }; + }); + + it('fails as expected when the callCluster call fails', async () => { + mockCallCluster.mockRejectedValue(new Error('woopsie')); + expect(timeSeriesQuery(params)).rejects.toThrowErrorMatchingInlineSnapshot( + `"error running search"` + ); + }); + + it('fails as expected when the query params are invalid', async () => { + params.query = { ...params.query, dateStart: 'x' }; + expect(timeSeriesQuery(params)).rejects.toThrowErrorMatchingInlineSnapshot( + `"invalid date format for dateStart: \\"x\\""` + ); + }); +}); diff --git a/x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/lib/time_series_query.ts b/x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/lib/time_series_query.ts new file mode 100644 index 0000000000000..8ea2a7dd1dcc5 --- /dev/null +++ b/x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/lib/time_series_query.ts @@ -0,0 +1,152 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { DEFAULT_GROUPS } from '../index'; +import { getDateRangeInfo } from './date_range_info'; +import { Logger, CallCluster } from '../../../types'; + +import { TimeSeriesQuery, TimeSeriesResult, TimeSeriesResultRow } from './time_series_types'; +export { TimeSeriesQuery, TimeSeriesResult } from './time_series_types'; + +export interface TimeSeriesQueryParameters { + logger: Logger; + callCluster: CallCluster; + query: TimeSeriesQuery; +} + +export async function timeSeriesQuery( + params: TimeSeriesQueryParameters +): Promise { + const { logger, callCluster, query: queryParams } = params; + const { index, window, interval, timeField, dateStart, dateEnd } = queryParams; + + const dateRangeInfo = getDateRangeInfo({ dateStart, dateEnd, window, interval }); + + // core query + const esQuery: any = { + index, + body: { + size: 0, + query: { + bool: { + filter: { + range: { + [timeField]: { + gte: dateRangeInfo.dateStart, + lt: dateRangeInfo.dateEnd, + format: 'strict_date_time', + }, + }, + }, + }, + }, + // aggs: {...}, filled in below + }, + ignoreUnavailable: true, + allowNoIndices: true, + ignore: [404], + }; + + // add the aggregations + const { aggType, aggField, groupField, groupLimit } = queryParams; + + const isCountAgg = aggType === 'count'; + const isGroupAgg = !!groupField; + + let aggParent = esQuery.body; + + // first, add a group aggregation, if requested + if (isGroupAgg) { + aggParent.aggs = { + groupAgg: { + terms: { + field: groupField, + size: groupLimit || DEFAULT_GROUPS, + }, + }, + }; + aggParent = aggParent.aggs.groupAgg; + } + + // next, add the time window aggregation + aggParent.aggs = { + dateAgg: { + date_range: { + field: timeField, + ranges: dateRangeInfo.dateRanges, + }, + }, + }; + aggParent = aggParent.aggs.dateAgg; + + // finally, the metric aggregation, if requested + const actualAggType = aggType === 'average' ? 'avg' : aggType; + if (!isCountAgg) { + aggParent.aggs = { + metricAgg: { + [actualAggType]: { + field: aggField, + }, + }, + }; + } + + let esResult: any; + const logPrefix = 'indexThreshold timeSeriesQuery: callCluster'; + logger.debug(`${logPrefix} call: ${JSON.stringify(esQuery)}`); + + try { + esResult = await callCluster('search', esQuery); + } catch (err) { + logger.warn(`${logPrefix} error: ${JSON.stringify(err.message)}`); + throw new Error('error running search'); + } + + logger.debug(`${logPrefix} result: ${JSON.stringify(esResult)}`); + return getResultFromEs(isCountAgg, isGroupAgg, esResult); +} + +function getResultFromEs( + isCountAgg: boolean, + isGroupAgg: boolean, + esResult: Record +): TimeSeriesResult { + const aggregations = esResult?.aggregations || {}; + + // add a fake 'all documents' group aggregation, if a group aggregation wasn't used + if (!isGroupAgg) { + const dateAgg = aggregations.dateAgg || {}; + + aggregations.groupAgg = { + buckets: [{ key: 'all documents', dateAgg }], + }; + + delete aggregations.dateAgg; + } + + const groupBuckets = aggregations.groupAgg?.buckets || []; + const result: TimeSeriesResult = { + results: [], + }; + + for (const groupBucket of groupBuckets) { + const groupName: string = `${groupBucket?.key}`; + const dateBuckets = groupBucket?.dateAgg?.buckets || []; + const groupResult: TimeSeriesResultRow = { + group: groupName, + metrics: [], + }; + result.results.push(groupResult); + + for (const dateBucket of dateBuckets) { + const date: string = dateBucket.to_as_string; + const value: number = isCountAgg ? dateBucket.doc_count : dateBucket.metricAgg.value; + groupResult.metrics.push([date, value]); + } + } + + return result; +} diff --git a/x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/lib/time_series_types.test.ts b/x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/lib/time_series_types.test.ts new file mode 100644 index 0000000000000..d69d48efcdf6b --- /dev/null +++ b/x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/lib/time_series_types.test.ts @@ -0,0 +1,105 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { TimeSeriesQuerySchema } from './time_series_types'; +import { runTests } from './core_query_types.test'; + +const DefaultParams = { + index: 'index-name', + timeField: 'time-field', + aggType: 'count', + window: '5m', +}; + +describe('TimeSeriesParams validate()', () => { + runTests(TimeSeriesQuerySchema, DefaultParams); + + let params: any; + beforeEach(() => { + params = { ...DefaultParams }; + }); + + it('passes for minimal valid input', async () => { + expect(validate()).toBeTruthy(); + }); + + it('passes for maximal valid input', async () => { + params.aggType = 'average'; + params.aggField = 'agg-field'; + params.groupField = 'group-field'; + params.groupLimit = 100; + params.dateStart = new Date().toISOString(); + params.dateEnd = new Date().toISOString(); + params.interval = '1s'; + expect(validate()).toBeTruthy(); + }); + + it('fails for invalid dateStart', async () => { + params.dateStart = 42; + expect(onValidate()).toThrowErrorMatchingInlineSnapshot( + `"[dateStart]: expected value of type [string] but got [number]"` + ); + + params.dateStart = 'x'; + expect(onValidate()).toThrowErrorMatchingInlineSnapshot(`"[dateStart]: invalid date x"`); + }); + + it('fails for invalid dateEnd', async () => { + params.dateEnd = 42; + expect(onValidate()).toThrowErrorMatchingInlineSnapshot( + `"[dateEnd]: expected value of type [string] but got [number]"` + ); + + params.dateEnd = 'x'; + expect(onValidate()).toThrowErrorMatchingInlineSnapshot(`"[dateEnd]: invalid date x"`); + }); + + it('fails for invalid interval', async () => { + params.interval = 42; + expect(onValidate()).toThrowErrorMatchingInlineSnapshot( + `"[interval]: expected value of type [string] but got [number]"` + ); + + params.interval = 'x'; + expect(onValidate()).toThrowErrorMatchingInlineSnapshot( + `"[interval]: invalid duration: \\"x\\""` + ); + }); + + it('fails for dateStart > dateEnd', async () => { + params.dateStart = '2021-01-01T00:00:00.000Z'; + params.dateEnd = '2020-01-01T00:00:00.000Z'; + params.interval = '1s'; + expect(onValidate()).toThrowErrorMatchingInlineSnapshot( + `"[dateStart]: is greater than [dateEnd]"` + ); + }); + + it('fails for dateStart != dateEnd and no interval', async () => { + params.dateStart = '2020-01-01T00:00:00.000Z'; + params.dateEnd = '2021-01-01T00:00:00.000Z'; + expect(onValidate()).toThrowErrorMatchingInlineSnapshot( + `"[interval]: must be specified if [dateStart] does not equal [dateEnd]"` + ); + }); + + it('fails for too many intervals', async () => { + params.dateStart = '2020-01-01T00:00:00.000Z'; + params.dateEnd = '2021-01-01T00:00:00.000Z'; + params.interval = '1s'; + expect(onValidate()).toThrowErrorMatchingInlineSnapshot( + `"calculated number of intervals 31622400 is greater than maximum 1000"` + ); + }); + + function onValidate(): () => void { + return () => validate(); + } + + function validate(): any { + return TimeSeriesQuerySchema.validate(params); + } +}); diff --git a/x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/lib/time_series_types.ts b/x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/lib/time_series_types.ts new file mode 100644 index 0000000000000..a727e67c621d4 --- /dev/null +++ b/x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/lib/time_series_types.ts @@ -0,0 +1,106 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +// The parameters and response for the `timeSeriesQuery()` service function, +// and associated HTTP endpoint. + +import { i18n } from '@kbn/i18n'; +import { schema, TypeOf } from '@kbn/config-schema'; + +import { parseDuration } from '../../../../../alerting/server'; +import { MAX_INTERVALS } from '../index'; +import { + CoreQueryParamsSchemaProperties, + validateCoreQueryBody, + validateDuration, +} from './core_query_types'; +import { + getTooManyIntervalsErrorMessage, + getDateStartAfterDateEndErrorMessage, +} from './date_range_info'; + +// The result is an object with a key for every field value aggregated +// via the `aggField` property. If `aggField` is not specified, the +// object will have a single key of `all documents`. The value associated +// with each key is an array of 2-tuples of `[ ISO-date, calculated-value ]` + +export interface TimeSeriesResult { + results: TimeSeriesResultRow[]; +} +export interface TimeSeriesResultRow { + group: string; + metrics: MetricResult[]; +} +export type MetricResult = [string, number]; // [iso date, value] + +// The parameters here are very similar to the alert parameters. +// Missing are `comparator` and `threshold`, which aren't needed to generate +// data values, only needed when evaluating the data. +// Additional parameters are used to indicate the date range of the search, +// and the interval. +export type TimeSeriesQuery = TypeOf; + +export const TimeSeriesQuerySchema = schema.object( + { + ...CoreQueryParamsSchemaProperties, + // start of the date range to search, as an iso string; defaults to dateEnd + dateStart: schema.maybe(schema.string({ validate: validateDate })), + // end of the date range to search, as an iso string; defaults to now + dateEnd: schema.maybe(schema.string({ validate: validateDate })), + // intended to be set to the `interval` property of the alert itself, + // this value indicates the amount of time between time series dates + // that will be calculated. + interval: schema.maybe(schema.string({ validate: validateDuration })), + }, + { + validate: validateBody, + } +); + +// using direct type not allowed, circular reference, so body is typed to any +function validateBody(anyParams: any): string | undefined { + // validate core query parts, return if it fails validation (returning string) + const coreQueryValidated = validateCoreQueryBody(anyParams); + if (coreQueryValidated) return coreQueryValidated; + + const { dateStart, dateEnd, interval }: TimeSeriesQuery = anyParams; + + // dates already validated in validateDate(), if provided + const epochStart = dateStart ? Date.parse(dateStart) : undefined; + const epochEnd = dateEnd ? Date.parse(dateEnd) : undefined; + + if (epochStart && epochEnd) { + if (epochStart > epochEnd) { + return getDateStartAfterDateEndErrorMessage(); + } + + if (epochStart !== epochEnd && !interval) { + return i18n.translate('xpack.alertingBuiltins.indexThreshold.intervalRequiredErrorMessage', { + defaultMessage: '[interval]: must be specified if [dateStart] does not equal [dateEnd]', + }); + } + + if (interval) { + const intervalMillis = parseDuration(interval); + const intervals = Math.round((epochEnd - epochStart) / intervalMillis); + if (intervals > MAX_INTERVALS) { + return getTooManyIntervalsErrorMessage(intervals, MAX_INTERVALS); + } + } + } +} + +function validateDate(dateString: string): string | undefined { + const parsed = Date.parse(dateString); + if (isNaN(parsed)) { + return i18n.translate('xpack.alertingBuiltins.indexThreshold.invalidDateErrorMessage', { + defaultMessage: 'invalid date {date}', + values: { + date: dateString, + }, + }); + } +} diff --git a/x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/routes.ts b/x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/routes.ts new file mode 100644 index 0000000000000..1aabca8af0715 --- /dev/null +++ b/x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/routes.ts @@ -0,0 +1,53 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { + IRouter, + RequestHandlerContext, + KibanaRequest, + IKibanaResponse, + KibanaResponseFactory, +} from 'kibana/server'; + +import { Service } from '../../types'; +import { TimeSeriesQuery, TimeSeriesQuerySchema, TimeSeriesResult } from './lib/time_series_types'; +export { TimeSeriesQuery, TimeSeriesResult } from './lib/time_series_types'; + +export function createTimeSeriesQueryRoute(service: Service, router: IRouter, baseRoute: string) { + const path = `${baseRoute}/_time_series_query`; + service.logger.debug(`registering indexThreshold timeSeriesQuery route POST ${path}`); + router.post( + { + path, + validate: { + body: TimeSeriesQuerySchema, + }, + }, + handler + ); + async function handler( + ctx: RequestHandlerContext, + req: KibanaRequest, + res: KibanaResponseFactory + ): Promise { + service.logger.debug(`route query_data request: ${JSON.stringify(req.body, null, 4)}`); + + let result: TimeSeriesResult; + try { + result = await service.indexThreshold.timeSeriesQuery({ + logger: service.logger, + callCluster: ctx.core.elasticsearch.dataClient.callAsCurrentUser, + query: req.body, + }); + } catch (err) { + service.logger.debug(`route query_data error: ${err.message}`); + return res.internalError({ body: 'error running time series query' }); + } + + service.logger.debug(`route query_data response: ${JSON.stringify(result, null, 4)}`); + return res.ok({ body: result }); + } +} diff --git a/x-pack/plugins/alerting_builtins/server/config.ts b/x-pack/plugins/alerting_builtins/server/config.ts new file mode 100644 index 0000000000000..8a13aedd5fdd8 --- /dev/null +++ b/x-pack/plugins/alerting_builtins/server/config.ts @@ -0,0 +1,13 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { schema, TypeOf } from '@kbn/config-schema'; + +export const configSchema = schema.object({ + enabled: schema.boolean({ defaultValue: true }), +}); + +export type Config = TypeOf; diff --git a/x-pack/plugins/alerting_builtins/server/index.ts b/x-pack/plugins/alerting_builtins/server/index.ts new file mode 100644 index 0000000000000..00613213d5aed --- /dev/null +++ b/x-pack/plugins/alerting_builtins/server/index.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; + * you may not use this file except in compliance with the Elastic License. + */ + +import { PluginInitializerContext } from 'src/core/server'; +import { AlertingBuiltinsPlugin } from './plugin'; +import { configSchema } from './config'; + +export const plugin = (ctx: PluginInitializerContext) => new AlertingBuiltinsPlugin(ctx); + +export const config = { + schema: configSchema, +}; + +export { IService } from './types'; diff --git a/x-pack/plugins/alerting_builtins/server/plugin.test.ts b/x-pack/plugins/alerting_builtins/server/plugin.test.ts new file mode 100644 index 0000000000000..6bcf0379d5abe --- /dev/null +++ b/x-pack/plugins/alerting_builtins/server/plugin.test.ts @@ -0,0 +1,70 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { AlertingBuiltinsPlugin } from './plugin'; +import { coreMock } from '../../../../src/core/server/mocks'; +import { alertsMock } from '../../../plugins/alerting/server/mocks'; + +describe('AlertingBuiltins Plugin', () => { + describe('setup()', () => { + let context: ReturnType; + let plugin: AlertingBuiltinsPlugin; + let coreSetup: ReturnType; + + beforeEach(() => { + context = coreMock.createPluginInitializerContext(); + plugin = new AlertingBuiltinsPlugin(context); + coreSetup = coreMock.createSetup(); + }); + + it('should register built-in alert types', async () => { + const alertingSetup = alertsMock.createSetup(); + await plugin.setup(coreSetup, { alerting: alertingSetup }); + + expect(alertingSetup.registerType).toHaveBeenCalledTimes(1); + + const args = alertingSetup.registerType.mock.calls[0][0]; + const testedArgs = { id: args.id, name: args.name, actionGroups: args.actionGroups }; + expect(testedArgs).toMatchInlineSnapshot(` + Object { + "actionGroups": Array [ + Object { + "id": "threshold met", + "name": "Threshold Met", + }, + ], + "id": ".index-threshold", + "name": "Index Threshold", + } + `); + }); + + it('should return a service in the expected shape', async () => { + const alertingSetup = alertsMock.createSetup(); + const service = await plugin.setup(coreSetup, { alerting: alertingSetup }); + + expect(typeof service.indexThreshold.timeSeriesQuery).toBe('function'); + }); + }); + + describe('start()', () => { + let context: ReturnType; + let plugin: AlertingBuiltinsPlugin; + let coreStart: ReturnType; + + beforeEach(() => { + context = coreMock.createPluginInitializerContext(); + plugin = new AlertingBuiltinsPlugin(context); + coreStart = coreMock.createStart(); + }); + + it('should return a service in the expected shape', async () => { + const service = await plugin.start(coreStart); + + expect(typeof service.indexThreshold.timeSeriesQuery).toBe('function'); + }); + }); +}); diff --git a/x-pack/plugins/alerting_builtins/server/plugin.ts b/x-pack/plugins/alerting_builtins/server/plugin.ts new file mode 100644 index 0000000000000..9a9483f9c9dfa --- /dev/null +++ b/x-pack/plugins/alerting_builtins/server/plugin.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; + * you may not use this file except in compliance with the Elastic License. + */ + +import { Plugin, Logger, CoreSetup, CoreStart, PluginInitializerContext } from 'src/core/server'; + +import { Service, IService, AlertingBuiltinsDeps } from './types'; +import { getService as getServiceIndexThreshold } from './alert_types/index_threshold'; +import { registerBuiltInAlertTypes } from './alert_types'; + +export class AlertingBuiltinsPlugin implements Plugin { + private readonly logger: Logger; + private readonly service: Service; + + constructor(ctx: PluginInitializerContext) { + this.logger = ctx.logger.get(); + this.service = { + indexThreshold: getServiceIndexThreshold(), + logger: this.logger, + }; + } + + public async setup(core: CoreSetup, { alerting }: AlertingBuiltinsDeps): Promise { + registerBuiltInAlertTypes({ + service: this.service, + router: core.http.createRouter(), + alerting, + baseRoute: '/api/alerting_builtins', + }); + return this.service; + } + + public async start(core: CoreStart): Promise { + return this.service; + } + + public async stop(): Promise {} +} diff --git a/x-pack/plugins/alerting_builtins/server/types.ts b/x-pack/plugins/alerting_builtins/server/types.ts new file mode 100644 index 0000000000000..ff07b85fd3038 --- /dev/null +++ b/x-pack/plugins/alerting_builtins/server/types.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; + * you may not use this file except in compliance with the Elastic License. + */ + +import { Logger, ScopedClusterClient } from '../../../../src/core/server'; +import { PluginSetupContract as AlertingSetup } from '../../alerting/server'; +import { getService as getServiceIndexThreshold } from './alert_types/index_threshold'; + +export { Logger, IRouter } from '../../../../src/core/server'; + +export { + PluginSetupContract as AlertingSetup, + AlertType, + AlertExecutorOptions, +} from '../../alerting/server'; + +// this plugin's dependendencies +export interface AlertingBuiltinsDeps { + alerting: AlertingSetup; +} + +// external service exposed through plugin setup/start +export interface IService { + indexThreshold: ReturnType; +} + +// version of service for internal use +export interface Service extends IService { + logger: Logger; +} + +export type CallCluster = ScopedClusterClient['callAsCurrentUser']; diff --git a/x-pack/test/alerting_api_integration/common/lib/es_test_index_tool.ts b/x-pack/test/alerting_api_integration/common/lib/es_test_index_tool.ts index d409ea4e2615a..ccd7748d9e899 100644 --- a/x-pack/test/alerting_api_integration/common/lib/es_test_index_tool.ts +++ b/x-pack/test/alerting_api_integration/common/lib/es_test_index_tool.ts @@ -39,6 +39,16 @@ export class ESTestIndexTool { enabled: false, type: 'object', }, + date: { + type: 'date', + format: 'strict_date_time', + }, + testedValue: { + type: 'long', + }, + group: { + type: 'keyword', + }, }, }, }, diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/index.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/index.ts new file mode 100644 index 0000000000000..c0147cbedcdfe --- /dev/null +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/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; + * you may not use this file except in compliance with the Elastic License. + */ + +import { FtrProviderContext } from '../../../../common/ftr_provider_context'; + +// eslint-disable-next-line import/no-default-export +export default function alertingTests({ loadTestFile }: FtrProviderContext) { + describe('builtin alertTypes', () => { + loadTestFile(require.resolve('./index_threshold')); + }); +} diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/index_threshold/create_test_data.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/index_threshold/create_test_data.ts new file mode 100644 index 0000000000000..41c07c428a089 --- /dev/null +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/index_threshold/create_test_data.ts @@ -0,0 +1,72 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { times } from 'lodash'; +import { v4 as uuid } from 'uuid'; +import { ESTestIndexTool, ES_TEST_INDEX_NAME } from '../../../../../common/lib'; + +// date to start writing data +export const START_DATE = '2020-01-01T00:00:00Z'; + +const DOCUMENT_SOURCE = 'queryDataEndpointTests'; + +// Create a set of es documents to run the queries against. +// Will create 2 documents for each interval. +// The difference between the dates of the docs will be intervalMillis. +// The date of the last documents will be startDate - intervalMillis / 2. +// So there will be 2 documents written in the middle of each interval range. +// The data value written to each doc is a power of 2, with 2^0 as the value +// of the last documents, the values increasing for older documents. The +// second document for each time value will be power of 2 + 1 +export async function createEsDocuments( + es: any, + esTestIndexTool: ESTestIndexTool, + startDate: string, + intervals: number, + intervalMillis: number +) { + const totalDocuments = intervals * 2; + const startDateMillis = Date.parse(startDate) - intervalMillis / 2; + + times(intervals, interval => { + const date = startDateMillis - interval * intervalMillis; + + // base value for each window is 2^window + const testedValue = 2 ** interval; + + // don't need await on these, wait at the end of the function + createEsDocument(es, '-na-', date, testedValue, 'groupA'); + createEsDocument(es, '-na-', date, testedValue + 1, 'groupB'); + }); + + await esTestIndexTool.waitForDocs(DOCUMENT_SOURCE, '-na-', totalDocuments); +} + +async function createEsDocument( + es: any, + reference: string, + epochMillis: number, + testedValue: number, + group: string +) { + const document = { + source: DOCUMENT_SOURCE, + reference, + date: new Date(epochMillis).toISOString(), + testedValue, + group, + }; + + const response = await es.index({ + id: uuid(), + index: ES_TEST_INDEX_NAME, + body: document, + }); + + if (response.result !== 'created') { + throw new Error(`document not created: ${JSON.stringify(response)}`); + } +} diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/index_threshold/index.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/index_threshold/index.ts new file mode 100644 index 0000000000000..6fdc68889b66f --- /dev/null +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/index_threshold/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; + * you may not use this file except in compliance with the Elastic License. + */ + +import { FtrProviderContext } from '../../../../../common/ftr_provider_context'; + +// eslint-disable-next-line import/no-default-export +export default function alertingTests({ loadTestFile }: FtrProviderContext) { + describe('index_threshold', () => { + loadTestFile(require.resolve('./query_data_endpoint')); + }); +} diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/index_threshold/query_data_endpoint.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/index_threshold/query_data_endpoint.ts new file mode 100644 index 0000000000000..9c1a58760be79 --- /dev/null +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/index_threshold/query_data_endpoint.ts @@ -0,0 +1,283 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import expect from '@kbn/expect'; + +import { Spaces } from '../../../../scenarios'; +import { FtrProviderContext } from '../../../../../common/ftr_provider_context'; +import { ESTestIndexTool, ES_TEST_INDEX_NAME, getUrlPrefix } from '../../../../../common/lib'; +import { TimeSeriesQuery } from '../../../../../../../plugins/alerting_builtins/server/alert_types/index_threshold/routes'; + +import { createEsDocuments } from './create_test_data'; + +const INDEX_THRESHOLD_TIME_SERIES_QUERY_URL = + 'api/alerting_builtins/index_threshold/_time_series_query'; + +const START_DATE_MM_DD_HH_MM_SS_MS = '01-01T00:00:00.000Z'; +const START_DATE = `2020-${START_DATE_MM_DD_HH_MM_SS_MS}`; +const INTERVALS = 3; + +// time length of a window +const INTERVAL_MINUTES = 1; +const INTERVAL_DURATION = `${INTERVAL_MINUTES}m`; +const INTERVAL_MILLIS = INTERVAL_MINUTES * 60 * 1000; + +const WINDOW_MINUTES = 5; +const WINDOW_DURATION = `${WINDOW_MINUTES}m`; + +// interesting dates pertaining to docs and intervals +const START_DATE_PLUS_YEAR = `2021-${START_DATE_MM_DD_HH_MM_SS_MS}`; +const START_DATE_MINUS_YEAR = `2019-${START_DATE_MM_DD_HH_MM_SS_MS}`; +const START_DATE_MINUS_0INTERVALS = START_DATE; +const START_DATE_MINUS_1INTERVALS = getStartDate(-1 * INTERVAL_MILLIS); +const START_DATE_MINUS_2INTERVALS = getStartDate(-2 * INTERVAL_MILLIS); + +/* creates the following documents to run queries over; the documents + are offset from the top of the minute by 30 seconds, the queries always + run from the top of the hour. + + { "date":"2019-12-31T23:59:30.000Z", "testedValue":1, "group":"groupA" } + { "date":"2019-12-31T23:59:30.000Z", "testedValue":2, "group":"groupB" } + { "date":"2019-12-31T23:58:30.000Z", "testedValue":2, "group":"groupA" } + { "date":"2019-12-31T23:58:30.000Z", "testedValue":3, "group":"groupB" } + { "date":"2019-12-31T23:57:30.000Z", "testedValue":4, "group":"groupA" } + { "date":"2019-12-31T23:57:30.000Z", "testedValue":5, "group":"groupB" } +*/ + +// eslint-disable-next-line import/no-default-export +export default function queryDataEndpointTests({ getService }: FtrProviderContext) { + const supertest = getService('supertest'); + const retry = getService('retry'); + const es = getService('legacyEs'); + const esTestIndexTool = new ESTestIndexTool(es, retry); + + describe('query_data endpoint', () => { + before(async () => { + await esTestIndexTool.destroy(); + await esTestIndexTool.setup(); + // To browse the documents created, comment out esTestIndexTool.destroy() in below, then: + // curl http://localhost:9220/.kibaka-alerting-test-data/_search?size=100 | json + await createEsDocuments(es, esTestIndexTool, START_DATE, INTERVALS, INTERVAL_MILLIS); + }); + + after(async () => { + await esTestIndexTool.destroy(); + }); + + it('should handle queries before any data available', async () => { + const query = getQueryBody({ + dateStart: undefined, + dateEnd: START_DATE_PLUS_YEAR, + }); + + const expected = { + results: [{ group: 'all documents', metrics: [[START_DATE_PLUS_YEAR, 0]] }], + }; + + expect(await runQueryExpect(query, 200)).eql(expected); + }); + + it('should handle queries after any data available', async () => { + const query = getQueryBody({ + dateStart: undefined, + dateEnd: START_DATE_MINUS_YEAR, + }); + + const expected = { + results: [{ group: 'all documents', metrics: [[START_DATE_MINUS_YEAR, 0]] }], + }; + + expect(await runQueryExpect(query, 200)).eql(expected); + }); + + it('should return the current count for 1 interval, not grouped', async () => { + const query = getQueryBody({ + dateStart: START_DATE, + dateEnd: START_DATE, + }); + + const expected = { + results: [{ group: 'all documents', metrics: [[START_DATE, 6]] }], + }; + + expect(await runQueryExpect(query, 200)).eql(expected); + }); + + it('should return correct count for all intervals, not grouped', async () => { + const query = getQueryBody({ + dateStart: START_DATE_MINUS_2INTERVALS, + dateEnd: START_DATE_MINUS_0INTERVALS, + }); + + const expected = { + results: [ + { + group: 'all documents', + metrics: [ + [START_DATE_MINUS_2INTERVALS, 2], + [START_DATE_MINUS_1INTERVALS, 4], + [START_DATE_MINUS_0INTERVALS, 6], + ], + }, + ], + }; + + expect(await runQueryExpect(query, 200)).eql(expected); + }); + + it('should return correct min for all intervals, not grouped', async () => { + const query = getQueryBody({ + aggType: 'min', + aggField: 'testedValue', + dateStart: START_DATE_MINUS_2INTERVALS, + dateEnd: START_DATE_MINUS_0INTERVALS, + }); + + const expected = { + results: [ + { + group: 'all documents', + metrics: [ + [START_DATE_MINUS_2INTERVALS, 4], + [START_DATE_MINUS_1INTERVALS, 2], + [START_DATE_MINUS_0INTERVALS, 1], + ], + }, + ], + }; + + expect(await runQueryExpect(query, 200)).eql(expected); + }); + + it('should return correct count for all intervals, grouped', async () => { + const query = getQueryBody({ + groupField: 'group', + dateStart: START_DATE_MINUS_2INTERVALS, + dateEnd: START_DATE_MINUS_0INTERVALS, + }); + + const expected = { + results: [ + { + group: 'groupA', + metrics: [ + [START_DATE_MINUS_2INTERVALS, 1], + [START_DATE_MINUS_1INTERVALS, 2], + [START_DATE_MINUS_0INTERVALS, 3], + ], + }, + { + group: 'groupB', + metrics: [ + [START_DATE_MINUS_2INTERVALS, 1], + [START_DATE_MINUS_1INTERVALS, 2], + [START_DATE_MINUS_0INTERVALS, 3], + ], + }, + ], + }; + + expect(await runQueryExpect(query, 200)).eql(expected); + }); + + it('should return correct average for all intervals, grouped', async () => { + const query = getQueryBody({ + aggType: 'average', + aggField: 'testedValue', + groupField: 'group', + dateStart: START_DATE_MINUS_2INTERVALS, + dateEnd: START_DATE_MINUS_0INTERVALS, + }); + + const expected = { + results: [ + { + group: 'groupA', + metrics: [ + [START_DATE_MINUS_2INTERVALS, 4 / 1], + [START_DATE_MINUS_1INTERVALS, (4 + 2) / 2], + [START_DATE_MINUS_0INTERVALS, (4 + 2 + 1) / 3], + ], + }, + { + group: 'groupB', + metrics: [ + [START_DATE_MINUS_2INTERVALS, 5 / 1], + [START_DATE_MINUS_1INTERVALS, (5 + 3) / 2], + [START_DATE_MINUS_0INTERVALS, (5 + 3 + 2) / 3], + ], + }, + ], + }; + + expect(await runQueryExpect(query, 200)).eql(expected); + }); + + it('should return an error when passed invalid input', async () => { + const query = { ...getQueryBody(), aggType: 'invalid-agg-type' }; + const expected = { + error: 'Bad Request', + message: '[request body.aggType]: invalid aggType: "invalid-agg-type"', + statusCode: 400, + }; + expect(await runQueryExpect(query, 400)).eql(expected); + }); + + it('should return an error when too many intervals calculated', async () => { + const query = { + ...getQueryBody(), + dateStart: '2000-01-01T00:00:00.000Z', + dateEnd: '2020-01-01T00:00:00.000Z', + interval: '1s', + }; + const expected = { + error: 'Bad Request', + message: + '[request body]: calculated number of intervals 631152000 is greater than maximum 1000', + statusCode: 400, + }; + expect(await runQueryExpect(query, 400)).eql(expected); + }); + }); + + async function runQueryExpect(requestBody: TimeSeriesQuery, status: number): Promise { + const url = `${getUrlPrefix(Spaces.space1.id)}/${INDEX_THRESHOLD_TIME_SERIES_QUERY_URL}`; + const res = await supertest + .post(url) + .set('kbn-xsrf', 'foo') + .send(requestBody); + + if (res.status !== status) { + // good place to put a console log for debugging unexpected results + // console.log(res.body) + throw new Error(`expected status ${status}, but got ${res.status}`); + } + + return res.body; + } +} + +function getQueryBody(body: Partial = {}): TimeSeriesQuery { + const defaults: TimeSeriesQuery = { + index: ES_TEST_INDEX_NAME, + timeField: 'date', + aggType: 'count', + aggField: undefined, + groupField: undefined, + groupLimit: undefined, + dateStart: START_DATE_MINUS_0INTERVALS, + dateEnd: undefined, + window: WINDOW_DURATION, + interval: INTERVAL_DURATION, + }; + return Object.assign({}, defaults, body); +} + +function getStartDate(deltaMillis: number) { + const startDateMillis = Date.parse(START_DATE); + const returnedDateMillis = startDateMillis + deltaMillis; + return new Date(returnedDateMillis).toISOString(); +} diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/index.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/index.ts index 0b7f51ac9a79b..a0c4da361bd38 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/index.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/index.ts @@ -25,5 +25,6 @@ export default function alertingTests({ loadTestFile }: FtrProviderContext) { loadTestFile(require.resolve('./update_api_key')); loadTestFile(require.resolve('./alerts_space1')); loadTestFile(require.resolve('./alerts_default_space')); + loadTestFile(require.resolve('./builtin_alert_types')); }); } From fd25ae6505afe088ed2cc58ed6efd392b02a7e47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Fern=C3=A1ndez=20Haro?= Date: Fri, 28 Feb 2020 16:52:35 +0000 Subject: [PATCH 12/31] [Telemetry] Application Usage implemented in @kbn/analytics (#58401) * [Telemetry] Report the Application Usage (time of usage + number of clicks) * Add Unit tests to the server side * Do not use optional chaining in JS * Add tests on the public end * Fix jslint errors * jest.useFakeTimers() + jest.clearAllTimers() * Remove Jest timer handlers from my tests (only affecting to a minimum coverage bit) * Catch ES actions in the setup/start steps because it broke core_services tests * Fix boolean check * Use core's ES.adminCLient over .createClient * Fix tests after ES.adminClient * [Telemetry] Application Usage implemented in kbn-analytics * Use bulkCreate in store_report * ApplicationUsagePluginStart does not exist anymore * Fix usage_collection mock interface * Check there is something to store before calling the bulkCreate method * Add unit tests * Fix types in tests * Unit tests for rollTotals and actual fix for the bug found * Fix usage_collection mock after #57693 got merged Co-authored-by: Elastic Machine --- .../src/metrics/application_usage.ts | 56 +++++ packages/kbn-analytics/src/metrics/index.ts | 5 +- packages/kbn-analytics/src/report.ts | 29 ++- packages/kbn-analytics/src/reporter.ts | 41 +++- .../core_plugins/application_usage/index.ts | 31 +++ .../application_usage/mappings.ts | 36 +++ .../application_usage/package.json | 4 + .../telemetry/common/constants.ts | 5 + src/legacy/core_plugins/telemetry/index.ts | 11 +- .../application_usage/index.test.ts | 144 +++++++++++ .../collectors/application_usage/index.ts | 20 ++ .../telemetry_application_usage_collector.ts | 225 ++++++++++++++++++ .../telemetry/server/collectors/index.ts | 1 + .../core_plugins/telemetry/server/plugin.ts | 18 +- .../telemetry/server/routes/index.ts | 12 +- .../server/routes/telemetry_opt_in.ts | 6 +- .../server/routes/telemetry_opt_in_stats.ts | 6 +- .../server/routes/telemetry_usage_stats.ts | 8 +- .../routes/telemetry_user_has_seen_notice.ts | 5 +- src/legacy/core_plugins/ui_metric/index.ts | 10 +- .../ui/public/chrome/api/sub_url_hooks.js | 9 + src/plugins/usage_collection/public/mocks.ts | 3 + src/plugins/usage_collection/public/plugin.ts | 18 +- .../public/services/application_usage.test.ts | 69 ++++++ .../public/services/application_usage.ts | 39 +++ src/plugins/usage_collection/server/mocks.ts | 3 - src/plugins/usage_collection/server/plugin.ts | 21 +- .../usage_collection/server/report/schema.ts | 9 + .../server/report/store_report.test.ts | 102 ++++++++ .../server/report/store_report.ts | 44 +++- .../usage_collection/server/routes/index.ts | 9 +- .../server/routes/report_metrics.ts | 12 +- 32 files changed, 931 insertions(+), 80 deletions(-) create mode 100644 packages/kbn-analytics/src/metrics/application_usage.ts create mode 100644 src/legacy/core_plugins/application_usage/index.ts create mode 100644 src/legacy/core_plugins/application_usage/mappings.ts create mode 100644 src/legacy/core_plugins/application_usage/package.json create mode 100644 src/legacy/core_plugins/telemetry/server/collectors/application_usage/index.test.ts create mode 100644 src/legacy/core_plugins/telemetry/server/collectors/application_usage/index.ts create mode 100644 src/legacy/core_plugins/telemetry/server/collectors/application_usage/telemetry_application_usage_collector.ts create mode 100644 src/plugins/usage_collection/public/services/application_usage.test.ts create mode 100644 src/plugins/usage_collection/public/services/application_usage.ts create mode 100644 src/plugins/usage_collection/server/report/store_report.test.ts diff --git a/packages/kbn-analytics/src/metrics/application_usage.ts b/packages/kbn-analytics/src/metrics/application_usage.ts new file mode 100644 index 0000000000000..7aea3ba0ef2fc --- /dev/null +++ b/packages/kbn-analytics/src/metrics/application_usage.ts @@ -0,0 +1,56 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import moment, { Moment } from 'moment-timezone'; +import { METRIC_TYPE } from './'; + +export interface ApplicationUsageCurrent { + type: METRIC_TYPE.APPLICATION_USAGE; + appId: string; + startTime: Moment; + numberOfClicks: number; +} + +export class ApplicationUsage { + private currentUsage?: ApplicationUsageCurrent; + + public start() { + // Count any clicks and assign it to the current app + if (window) + window.addEventListener( + 'click', + () => this.currentUsage && this.currentUsage.numberOfClicks++ + ); + } + + public appChanged(appId?: string) { + const currentUsage = this.currentUsage; + + if (appId) { + this.currentUsage = { + type: METRIC_TYPE.APPLICATION_USAGE, + appId, + startTime: moment(), + numberOfClicks: 0, + }; + } else { + this.currentUsage = void 0; + } + return currentUsage; + } +} diff --git a/packages/kbn-analytics/src/metrics/index.ts b/packages/kbn-analytics/src/metrics/index.ts index ceaf53cbc9753..4fbdddeea90fd 100644 --- a/packages/kbn-analytics/src/metrics/index.ts +++ b/packages/kbn-analytics/src/metrics/index.ts @@ -19,15 +19,18 @@ import { UiStatsMetric } from './ui_stats'; import { UserAgentMetric } from './user_agent'; +import { ApplicationUsageCurrent } from './application_usage'; export { UiStatsMetric, createUiStatsMetric, UiStatsMetricType } from './ui_stats'; export { Stats } from './stats'; export { trackUsageAgent } from './user_agent'; +export { ApplicationUsage, ApplicationUsageCurrent } from './application_usage'; -export type Metric = UiStatsMetric | UserAgentMetric; +export type Metric = UiStatsMetric | UserAgentMetric | ApplicationUsageCurrent; export enum METRIC_TYPE { COUNT = 'count', LOADED = 'loaded', CLICK = 'click', USER_AGENT = 'user_agent', + APPLICATION_USAGE = 'application_usage', } diff --git a/packages/kbn-analytics/src/report.ts b/packages/kbn-analytics/src/report.ts index 16c0a3069e5fd..58891e48aa3a6 100644 --- a/packages/kbn-analytics/src/report.ts +++ b/packages/kbn-analytics/src/report.ts @@ -17,6 +17,7 @@ * under the License. */ +import moment from 'moment-timezone'; import { UnreachableCaseError, wrapArray } from './util'; import { Metric, Stats, UiStatsMetricType, METRIC_TYPE } from './metrics'; const REPORT_VERSION = 1; @@ -42,6 +43,13 @@ export interface Report { appName: string; } >; + application_usage?: Record< + string, + { + minutesOnScreen: number; + numberOfClicks: number; + } + >; } export class ReportManager { @@ -57,10 +65,11 @@ export class ReportManager { this.report = ReportManager.createReport(); } public isReportEmpty(): boolean { - const { uiStatsMetrics, userAgent } = this.report; + const { uiStatsMetrics, userAgent, application_usage: appUsage } = this.report; const noUiStats = !uiStatsMetrics || Object.keys(uiStatsMetrics).length === 0; const noUserAgent = !userAgent || Object.keys(userAgent).length === 0; - return noUiStats && noUserAgent; + const noAppUsage = !appUsage || Object.keys(appUsage).length === 0; + return noUiStats && noUserAgent && noAppUsage; } private incrementStats(count: number, stats?: Stats): Stats { const { min = 0, max = 0, sum = 0 } = stats || {}; @@ -92,6 +101,8 @@ export class ReportManager { const { appName, eventName, type } = metric; return `${appName}-${type}-${eventName}`; } + case METRIC_TYPE.APPLICATION_USAGE: + return metric.appId; default: throw new UnreachableCaseError(metric); } @@ -129,6 +140,20 @@ export class ReportManager { }; return; } + case METRIC_TYPE.APPLICATION_USAGE: + const { numberOfClicks, startTime } = metric; + const minutesOnScreen = moment().diff(startTime, 'minutes', true); + + report.application_usage = report.application_usage || {}; + const appExistingData = report.application_usage[key] || { + minutesOnScreen: 0, + numberOfClicks: 0, + }; + report.application_usage[key] = { + minutesOnScreen: appExistingData.minutesOnScreen + minutesOnScreen, + numberOfClicks: appExistingData.numberOfClicks + numberOfClicks, + }; + break; default: throw new UnreachableCaseError(metric); } diff --git a/packages/kbn-analytics/src/reporter.ts b/packages/kbn-analytics/src/reporter.ts index 98e29c1e4329e..cbcdf6af63052 100644 --- a/packages/kbn-analytics/src/reporter.ts +++ b/packages/kbn-analytics/src/reporter.ts @@ -22,6 +22,7 @@ import { Metric, createUiStatsMetric, trackUsageAgent, UiStatsMetricType } from import { Storage, ReportStorageManager } from './storage'; import { Report, ReportManager } from './report'; +import { ApplicationUsage } from './metrics'; export interface ReporterConfig { http: ReportHTTP; @@ -35,19 +36,22 @@ export type ReportHTTP = (report: Report) => Promise; export class Reporter { checkInterval: number; - private interval: any; + private interval?: NodeJS.Timer; + private lastAppId?: string; private http: ReportHTTP; private reportManager: ReportManager; private storageManager: ReportStorageManager; + private readonly applicationUsage: ApplicationUsage; private debug: boolean; private retryCount = 0; private readonly maxRetries = 3; + private started = false; constructor(config: ReporterConfig) { const { http, storage, debug, checkInterval = 90000, storageKey = 'analytics' } = config; this.http = http; this.checkInterval = checkInterval; - this.interval = null; + this.applicationUsage = new ApplicationUsage(); this.storageManager = new ReportStorageManager(storageKey, storage); const storedReport = this.storageManager.get(); this.reportManager = new ReportManager(storedReport); @@ -68,10 +72,34 @@ export class Reporter { public start = () => { if (!this.interval) { this.interval = setTimeout(() => { - this.interval = null; + this.interval = undefined; this.sendReports(); }, this.checkInterval); } + + if (this.started) { + return; + } + + if (window && document) { + // Before leaving the page, make sure we store the current usage + window.addEventListener('beforeunload', () => this.reportApplicationUsage()); + + // Monitoring dashboards might be open in background and we are fine with that + // but we don't want to report hours if the user goes to another tab and Kibana is not shown + document.addEventListener('visibilitychange', () => { + if (document.visibilityState === 'visible' && this.lastAppId) { + this.reportApplicationUsage(this.lastAppId); + } else if (document.visibilityState === 'hidden') { + this.reportApplicationUsage(); + + // We also want to send the report now because intervals and timeouts be stalled when too long in the "hidden" state + this.sendReports(); + } + }); + } + this.started = true; + this.applicationUsage.start(); }; private log(message: any) { @@ -102,6 +130,13 @@ export class Reporter { this.saveToReport([report]); }; + public reportApplicationUsage(appId?: string) { + this.log(`Reporting application changed to ${appId}`); + this.lastAppId = appId || this.lastAppId; + const appChangedReport = this.applicationUsage.appChanged(appId); + if (appChangedReport) this.saveToReport([appChangedReport]); + } + public sendReports = async () => { if (!this.reportManager.isReportEmpty()) { try { diff --git a/src/legacy/core_plugins/application_usage/index.ts b/src/legacy/core_plugins/application_usage/index.ts new file mode 100644 index 0000000000000..752d6eaa19bb0 --- /dev/null +++ b/src/legacy/core_plugins/application_usage/index.ts @@ -0,0 +1,31 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { Legacy } from '../../../../kibana'; +import { mappings } from './mappings'; + +// eslint-disable-next-line import/no-default-export +export default function ApplicationUsagePlugin(kibana: any) { + const config: Legacy.PluginSpecOptions = { + id: 'application_usage', + uiExports: { mappings }, // Needed to define the mappings for the SavedObjects + }; + + return new kibana.Plugin(config); +} diff --git a/src/legacy/core_plugins/application_usage/mappings.ts b/src/legacy/core_plugins/application_usage/mappings.ts new file mode 100644 index 0000000000000..39adc53f7e9ff --- /dev/null +++ b/src/legacy/core_plugins/application_usage/mappings.ts @@ -0,0 +1,36 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +export const mappings = { + application_usage_totals: { + properties: { + appId: { type: 'keyword' }, + numberOfClicks: { type: 'long' }, + minutesOnScreen: { type: 'float' }, + }, + }, + application_usage_transactional: { + properties: { + timestamp: { type: 'date' }, + appId: { type: 'keyword' }, + numberOfClicks: { type: 'long' }, + minutesOnScreen: { type: 'float' }, + }, + }, +}; diff --git a/src/legacy/core_plugins/application_usage/package.json b/src/legacy/core_plugins/application_usage/package.json new file mode 100644 index 0000000000000..5ab10a2f8d237 --- /dev/null +++ b/src/legacy/core_plugins/application_usage/package.json @@ -0,0 +1,4 @@ +{ + "name": "application_usage", + "version": "kibana" +} \ No newline at end of file diff --git a/src/legacy/core_plugins/telemetry/common/constants.ts b/src/legacy/core_plugins/telemetry/common/constants.ts index 52981c04ad34a..b44bf319e6627 100644 --- a/src/legacy/core_plugins/telemetry/common/constants.ts +++ b/src/legacy/core_plugins/telemetry/common/constants.ts @@ -66,6 +66,11 @@ export const TELEMETRY_STATS_TYPE = 'telemetry'; */ export const UI_METRIC_USAGE_TYPE = 'ui_metric'; +/** + * Application Usage type + */ +export const APPLICATION_USAGE_TYPE = 'application_usage'; + /** * Link to Advanced Settings. */ diff --git a/src/legacy/core_plugins/telemetry/index.ts b/src/legacy/core_plugins/telemetry/index.ts index ec70380d83a0a..1e88e7d65cffd 100644 --- a/src/legacy/core_plugins/telemetry/index.ts +++ b/src/legacy/core_plugins/telemetry/index.ts @@ -21,7 +21,7 @@ import * as Rx from 'rxjs'; import { resolve } from 'path'; import JoiNamespace from 'joi'; import { Server } from 'hapi'; -import { CoreSetup, PluginInitializerContext } from 'src/core/server'; +import { PluginInitializerContext } from 'src/core/server'; // eslint-disable-next-line @kbn/eslint/no-restricted-paths import { getConfigPath } from '../../../core/server/path'; // @ts-ignore @@ -132,11 +132,6 @@ const telemetry = (kibana: any) => { }, } as PluginInitializerContext; - const coreSetup = ({ - http: { server }, - log: server.log, - } as any) as CoreSetup; - try { await handleOldSettings(server); } catch (err) { @@ -147,7 +142,9 @@ const telemetry = (kibana: any) => { usageCollection, }; - telemetryPlugin(initializerContext).setup(coreSetup, pluginsSetup, server); + const npPlugin = telemetryPlugin(initializerContext); + await npPlugin.setup(server.newPlatform.setup.core, pluginsSetup, server); + await npPlugin.start(server.newPlatform.start.core); }, }); }; diff --git a/src/legacy/core_plugins/telemetry/server/collectors/application_usage/index.test.ts b/src/legacy/core_plugins/telemetry/server/collectors/application_usage/index.test.ts new file mode 100644 index 0000000000000..cdfead2dff3c6 --- /dev/null +++ b/src/legacy/core_plugins/telemetry/server/collectors/application_usage/index.test.ts @@ -0,0 +1,144 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { UsageCollectionSetup } from '../../../../../../plugins/usage_collection/server'; +import { savedObjectsRepositoryMock } from '../../../../../../core/server/mocks'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { CollectorOptions } from '../../../../../../plugins/usage_collection/server/collector/collector'; + +import { registerApplicationUsageCollector } from './'; +import { + ROLL_INDICES_INTERVAL, + SAVED_OBJECTS_TOTAL_TYPE, + SAVED_OBJECTS_TRANSACTIONAL_TYPE, +} from './telemetry_application_usage_collector'; + +describe('telemetry_application_usage', () => { + jest.useFakeTimers(); + + let collector: CollectorOptions; + + const usageCollectionMock: jest.Mocked = { + makeUsageCollector: jest.fn().mockImplementation(config => (collector = config)), + registerCollector: jest.fn(), + } as any; + + const getUsageCollector = jest.fn(); + const callCluster = jest.fn(); + + beforeAll(() => registerApplicationUsageCollector(usageCollectionMock, getUsageCollector)); + afterAll(() => jest.clearAllTimers()); + + test('registered collector is set', () => { + expect(collector).not.toBeUndefined(); + }); + + test('if no savedObjectClient initialised, return undefined', async () => { + expect(await collector.fetch(callCluster)).toBeUndefined(); + jest.runTimersToTime(ROLL_INDICES_INTERVAL); + }); + + test('when savedObjectClient is initialised, return something', async () => { + const savedObjectClient = savedObjectsRepositoryMock.create(); + savedObjectClient.find.mockImplementation( + async () => + ({ + saved_objects: [], + total: 0, + } as any) + ); + getUsageCollector.mockImplementation(() => savedObjectClient); + + jest.runTimersToTime(ROLL_INDICES_INTERVAL); // Force rollTotals to run + + expect(await collector.fetch(callCluster)).toStrictEqual({}); + expect(savedObjectClient.bulkCreate).not.toHaveBeenCalled(); + }); + + test('paging in findAll works', async () => { + const savedObjectClient = savedObjectsRepositoryMock.create(); + let total = 201; + savedObjectClient.find.mockImplementation(async opts => { + if (opts.type === SAVED_OBJECTS_TOTAL_TYPE) { + return { + saved_objects: [ + { + id: 'appId', + attributes: { + appId: 'appId', + minutesOnScreen: 10, + numberOfClicks: 10, + }, + }, + ], + total: 1, + } as any; + } + if ((opts.page || 1) > 2) { + return { saved_objects: [], total }; + } + const doc = { + id: 'test-id', + attributes: { + appId: 'appId', + timestamp: new Date().toISOString(), + minutesOnScreen: 1, + numberOfClicks: 1, + }, + }; + const savedObjects = new Array(opts.perPage).fill(doc); + total = savedObjects.length * 2 + 1; + return { saved_objects: savedObjects, total }; + }); + + getUsageCollector.mockImplementation(() => savedObjectClient); + + jest.runTimersToTime(ROLL_INDICES_INTERVAL); // Force rollTotals to run + + expect(await collector.fetch(callCluster)).toStrictEqual({ + appId: { + clicks_total: total - 1 + 10, + clicks_30_days: total - 1, + clicks_90_days: total - 1, + minutes_on_screen_total: total - 1 + 10, + minutes_on_screen_30_days: total - 1, + minutes_on_screen_90_days: total - 1, + }, + }); + expect(savedObjectClient.bulkCreate).toHaveBeenCalledWith( + [ + { + id: 'appId', + type: SAVED_OBJECTS_TOTAL_TYPE, + attributes: { + appId: 'appId', + minutesOnScreen: total - 1 + 10, + numberOfClicks: total - 1 + 10, + }, + }, + ], + { overwrite: true } + ); + expect(savedObjectClient.delete).toHaveBeenCalledTimes(total - 1); + expect(savedObjectClient.delete).toHaveBeenCalledWith( + SAVED_OBJECTS_TRANSACTIONAL_TYPE, + 'test-id' + ); + }); +}); diff --git a/src/legacy/core_plugins/telemetry/server/collectors/application_usage/index.ts b/src/legacy/core_plugins/telemetry/server/collectors/application_usage/index.ts new file mode 100644 index 0000000000000..1dac303880375 --- /dev/null +++ b/src/legacy/core_plugins/telemetry/server/collectors/application_usage/index.ts @@ -0,0 +1,20 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +export { registerApplicationUsageCollector } from './telemetry_application_usage_collector'; diff --git a/src/legacy/core_plugins/telemetry/server/collectors/application_usage/telemetry_application_usage_collector.ts b/src/legacy/core_plugins/telemetry/server/collectors/application_usage/telemetry_application_usage_collector.ts new file mode 100644 index 0000000000000..5047ebc4b0454 --- /dev/null +++ b/src/legacy/core_plugins/telemetry/server/collectors/application_usage/telemetry_application_usage_collector.ts @@ -0,0 +1,225 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import moment from 'moment'; +import { APPLICATION_USAGE_TYPE } from '../../../common/constants'; +import { UsageCollectionSetup } from '../../../../../../plugins/usage_collection/server'; +import { + ISavedObjectsRepository, + SavedObjectAttributes, + SavedObjectsFindOptions, + SavedObject, +} from '../../../../../../core/server'; + +/** + * Roll indices every 24h + */ +export const ROLL_INDICES_INTERVAL = 24 * 60 * 60 * 1000; + +/** + * Start rolling indices after 5 minutes up + */ +export const ROLL_INDICES_START = 5 * 60 * 1000; + +export const SAVED_OBJECTS_TOTAL_TYPE = 'application_usage_totals'; +export const SAVED_OBJECTS_TRANSACTIONAL_TYPE = 'application_usage_transactional'; + +interface ApplicationUsageTotal extends SavedObjectAttributes { + appId: string; + minutesOnScreen: number; + numberOfClicks: number; +} + +interface ApplicationUsageTransactional extends ApplicationUsageTotal { + timestamp: string; +} + +interface ApplicationUsageTelemetryReport { + [appId: string]: { + clicks_total: number; + clicks_30_days: number; + clicks_90_days: number; + minutes_on_screen_total: number; + minutes_on_screen_30_days: number; + minutes_on_screen_90_days: number; + }; +} + +async function findAll( + savedObjectsClient: ISavedObjectsRepository, + opts: SavedObjectsFindOptions +): Promise>> { + const { page = 1, perPage = 100, ...options } = opts; + const { saved_objects: savedObjects, total } = await savedObjectsClient.find({ + ...options, + page, + perPage, + }); + if (page * perPage >= total) { + return savedObjects; + } + return [...savedObjects, ...(await findAll(savedObjectsClient, { ...opts, page: page + 1 }))]; +} + +export function registerApplicationUsageCollector( + usageCollection: UsageCollectionSetup, + getSavedObjectsClient: () => ISavedObjectsRepository | undefined +) { + const collector = usageCollection.makeUsageCollector({ + type: APPLICATION_USAGE_TYPE, + isReady: () => typeof getSavedObjectsClient() !== 'undefined', + fetch: async () => { + const savedObjectsClient = getSavedObjectsClient(); + if (typeof savedObjectsClient === 'undefined') { + return; + } + const [rawApplicationUsageTotals, rawApplicationUsageTransactional] = await Promise.all([ + findAll(savedObjectsClient, { type: SAVED_OBJECTS_TOTAL_TYPE }), + findAll(savedObjectsClient, { + type: SAVED_OBJECTS_TRANSACTIONAL_TYPE, + }), + ]); + + const applicationUsageFromTotals = rawApplicationUsageTotals.reduce( + (acc, { attributes: { appId, minutesOnScreen, numberOfClicks } }) => { + const existing = acc[appId] || { clicks_total: 0, minutes_on_screen_total: 0 }; + return { + ...acc, + [appId]: { + clicks_total: numberOfClicks + existing.clicks_total, + clicks_30_days: 0, + clicks_90_days: 0, + minutes_on_screen_total: minutesOnScreen + existing.minutes_on_screen_total, + minutes_on_screen_30_days: 0, + minutes_on_screen_90_days: 0, + }, + }; + }, + {} as ApplicationUsageTelemetryReport + ); + + const nowMinus30 = moment().subtract(30, 'days'); + const nowMinus90 = moment().subtract(90, 'days'); + + const applicationUsage = rawApplicationUsageTransactional.reduce( + (acc, { attributes: { appId, minutesOnScreen, numberOfClicks, timestamp } }) => { + const existing = acc[appId] || { + clicks_total: 0, + clicks_30_days: 0, + clicks_90_days: 0, + minutes_on_screen_total: 0, + minutes_on_screen_30_days: 0, + minutes_on_screen_90_days: 0, + }; + + const timeOfEntry = moment(timestamp as string); + const isInLast30Days = timeOfEntry.isSameOrAfter(nowMinus30); + const isInLast90Days = timeOfEntry.isSameOrAfter(nowMinus90); + + const last30Days = { + clicks_30_days: existing.clicks_30_days + numberOfClicks, + minutes_on_screen_30_days: existing.minutes_on_screen_30_days + minutesOnScreen, + }; + const last90Days = { + clicks_90_days: existing.clicks_90_days + numberOfClicks, + minutes_on_screen_90_days: existing.minutes_on_screen_90_days + minutesOnScreen, + }; + + return { + ...acc, + [appId]: { + ...existing, + clicks_total: existing.clicks_total + numberOfClicks, + minutes_on_screen_total: existing.minutes_on_screen_total + minutesOnScreen, + ...(isInLast30Days ? last30Days : {}), + ...(isInLast90Days ? last90Days : {}), + }, + }; + }, + applicationUsageFromTotals + ); + + return applicationUsage; + }, + }); + + usageCollection.registerCollector(collector); + + setInterval(() => rollTotals(getSavedObjectsClient()), ROLL_INDICES_INTERVAL); + setTimeout(() => rollTotals(getSavedObjectsClient()), ROLL_INDICES_START); +} + +async function rollTotals(savedObjectsClient?: ISavedObjectsRepository) { + if (!savedObjectsClient) { + return; + } + + try { + const [rawApplicationUsageTotals, rawApplicationUsageTransactional] = await Promise.all([ + findAll(savedObjectsClient, { type: SAVED_OBJECTS_TOTAL_TYPE }), + findAll(savedObjectsClient, { + type: SAVED_OBJECTS_TRANSACTIONAL_TYPE, + filter: `${SAVED_OBJECTS_TRANSACTIONAL_TYPE}.attributes.timestamp < now-90d`, + }), + ]); + + const existingTotals = rawApplicationUsageTotals.reduce( + (acc, { attributes: { appId, numberOfClicks, minutesOnScreen } }) => { + return { + ...acc, + // No need to sum because there should be 1 document per appId only + [appId]: { appId, numberOfClicks, minutesOnScreen }, + }; + }, + {} as Record + ); + + const totals = rawApplicationUsageTransactional.reduce((acc, { attributes, id }) => { + const { appId, numberOfClicks, minutesOnScreen } = attributes; + + const existing = acc[appId] || { minutesOnScreen: 0, numberOfClicks: 0 }; + + return { + ...acc, + [appId]: { + appId, + numberOfClicks: numberOfClicks + existing.numberOfClicks, + minutesOnScreen: minutesOnScreen + existing.minutesOnScreen, + }, + }; + }, existingTotals); + + await Promise.all([ + Object.entries(totals).length && + savedObjectsClient.bulkCreate( + Object.entries(totals).map(([id, entry]) => ({ + type: SAVED_OBJECTS_TOTAL_TYPE, + id, + attributes: entry, + })), + { overwrite: true } + ), + ...rawApplicationUsageTransactional.map( + ({ id }) => savedObjectsClient.delete(SAVED_OBJECTS_TRANSACTIONAL_TYPE, id) // There is no bulkDelete :( + ), + ]); + } catch (err) { + // Silent failure + } +} diff --git a/src/legacy/core_plugins/telemetry/server/collectors/index.ts b/src/legacy/core_plugins/telemetry/server/collectors/index.ts index 04ee4773cd60d..6cb7a38b6414f 100644 --- a/src/legacy/core_plugins/telemetry/server/collectors/index.ts +++ b/src/legacy/core_plugins/telemetry/server/collectors/index.ts @@ -23,3 +23,4 @@ export { registerUiMetricUsageCollector } from './ui_metric'; export { registerLocalizationUsageCollector } from './localization'; export { registerTelemetryPluginUsageCollector } from './telemetry_plugin'; export { registerManagementUsageCollector } from './management'; +export { registerApplicationUsageCollector } from './application_usage'; diff --git a/src/legacy/core_plugins/telemetry/server/plugin.ts b/src/legacy/core_plugins/telemetry/server/plugin.ts index b5b53b1daba55..d859c0cfd4678 100644 --- a/src/legacy/core_plugins/telemetry/server/plugin.ts +++ b/src/legacy/core_plugins/telemetry/server/plugin.ts @@ -17,7 +17,12 @@ * under the License. */ -import { CoreSetup, PluginInitializerContext } from 'src/core/server'; +import { + CoreSetup, + PluginInitializerContext, + ISavedObjectsRepository, + CoreStart, +} from 'src/core/server'; import { Server } from 'hapi'; import { registerRoutes } from './routes'; import { registerCollection } from './telemetry_collection'; @@ -28,6 +33,7 @@ import { registerLocalizationUsageCollector, registerTelemetryPluginUsageCollector, registerManagementUsageCollector, + registerApplicationUsageCollector, } from './collectors'; export interface PluginsSetup { @@ -36,6 +42,7 @@ export interface PluginsSetup { export class TelemetryPlugin { private readonly currentKibanaVersion: string; + private savedObjectsClient?: ISavedObjectsRepository; constructor(initializerContext: PluginInitializerContext) { this.currentKibanaVersion = initializerContext.env.packageInfo.version; @@ -45,12 +52,19 @@ export class TelemetryPlugin { const currentKibanaVersion = this.currentKibanaVersion; registerCollection(); - registerRoutes({ core, currentKibanaVersion }); + registerRoutes({ core, currentKibanaVersion, server }); + + const getSavedObjectsClient = () => this.savedObjectsClient; registerTelemetryPluginUsageCollector(usageCollection, server); registerLocalizationUsageCollector(usageCollection, server); registerTelemetryUsageCollector(usageCollection, server); registerUiMetricUsageCollector(usageCollection, server); registerManagementUsageCollector(usageCollection, server); + registerApplicationUsageCollector(usageCollection, getSavedObjectsClient); + } + + public start({ savedObjects }: CoreStart) { + this.savedObjectsClient = savedObjects.createInternalRepository(); } } diff --git a/src/legacy/core_plugins/telemetry/server/routes/index.ts b/src/legacy/core_plugins/telemetry/server/routes/index.ts index 30c018ca7796d..31ff1682d6806 100644 --- a/src/legacy/core_plugins/telemetry/server/routes/index.ts +++ b/src/legacy/core_plugins/telemetry/server/routes/index.ts @@ -17,6 +17,7 @@ * under the License. */ +import { Legacy } from 'kibana'; import { CoreSetup } from 'src/core/server'; import { registerTelemetryOptInRoutes } from './telemetry_opt_in'; import { registerTelemetryUsageStatsRoutes } from './telemetry_usage_stats'; @@ -26,11 +27,12 @@ import { registerTelemetryUserHasSeenNotice } from './telemetry_user_has_seen_no interface RegisterRoutesParams { core: CoreSetup; currentKibanaVersion: string; + server: Legacy.Server; } -export function registerRoutes({ core, currentKibanaVersion }: RegisterRoutesParams) { - registerTelemetryOptInRoutes({ core, currentKibanaVersion }); - registerTelemetryUsageStatsRoutes(core); - registerTelemetryOptInStatsRoutes(core); - registerTelemetryUserHasSeenNotice(core); +export function registerRoutes({ core, currentKibanaVersion, server }: RegisterRoutesParams) { + registerTelemetryOptInRoutes({ core, currentKibanaVersion, server }); + registerTelemetryUsageStatsRoutes(server); + registerTelemetryOptInStatsRoutes(server); + registerTelemetryUserHasSeenNotice(server); } diff --git a/src/legacy/core_plugins/telemetry/server/routes/telemetry_opt_in.ts b/src/legacy/core_plugins/telemetry/server/routes/telemetry_opt_in.ts index 596c5c17c353e..ccbc28f6cbadb 100644 --- a/src/legacy/core_plugins/telemetry/server/routes/telemetry_opt_in.ts +++ b/src/legacy/core_plugins/telemetry/server/routes/telemetry_opt_in.ts @@ -21,6 +21,7 @@ import Joi from 'joi'; import moment from 'moment'; import { boomify } from 'boom'; import { CoreSetup } from 'src/core/server'; +import { Legacy } from 'kibana'; import { getTelemetryAllowChangingOptInStatus } from '../telemetry_config'; import { sendTelemetryOptInStatus } from './telemetry_opt_in_stats'; @@ -32,14 +33,13 @@ import { interface RegisterOptInRoutesParams { core: CoreSetup; currentKibanaVersion: string; + server: Legacy.Server; } export function registerTelemetryOptInRoutes({ - core, + server, currentKibanaVersion, }: RegisterOptInRoutesParams) { - const { server } = core.http as any; - server.route({ method: 'POST', path: '/api/telemetry/v2/optIn', diff --git a/src/legacy/core_plugins/telemetry/server/routes/telemetry_opt_in_stats.ts b/src/legacy/core_plugins/telemetry/server/routes/telemetry_opt_in_stats.ts index d3bf6dbb77d7a..e64f3f6ff8a94 100644 --- a/src/legacy/core_plugins/telemetry/server/routes/telemetry_opt_in_stats.ts +++ b/src/legacy/core_plugins/telemetry/server/routes/telemetry_opt_in_stats.ts @@ -21,7 +21,7 @@ import fetch from 'node-fetch'; import Joi from 'joi'; import moment from 'moment'; -import { CoreSetup } from 'src/core/server'; +import { Legacy } from 'kibana'; import { telemetryCollectionManager, StatsGetterConfig } from '../collection_manager'; interface SendTelemetryOptInStatusConfig { @@ -45,9 +45,7 @@ export async function sendTelemetryOptInStatus( }); } -export function registerTelemetryOptInStatsRoutes(core: CoreSetup) { - const { server } = core.http as any; - +export function registerTelemetryOptInStatsRoutes(server: Legacy.Server) { server.route({ method: 'POST', path: '/api/telemetry/v2/clusters/_opt_in_stats', diff --git a/src/legacy/core_plugins/telemetry/server/routes/telemetry_usage_stats.ts b/src/legacy/core_plugins/telemetry/server/routes/telemetry_usage_stats.ts index c14314ca4da24..ee3241b0dc2ea 100644 --- a/src/legacy/core_plugins/telemetry/server/routes/telemetry_usage_stats.ts +++ b/src/legacy/core_plugins/telemetry/server/routes/telemetry_usage_stats.ts @@ -19,16 +19,14 @@ import Joi from 'joi'; import { boomify } from 'boom'; -import { CoreSetup } from 'src/core/server'; +import { Legacy } from 'kibana'; import { telemetryCollectionManager } from '../collection_manager'; -export function registerTelemetryUsageStatsRoutes(core: CoreSetup) { - const { server } = core.http as any; - +export function registerTelemetryUsageStatsRoutes(server: Legacy.Server) { server.route({ method: 'POST', path: '/api/telemetry/v2/clusters/_stats', - config: { + options: { validate: { payload: Joi.object({ unencrypted: Joi.bool(), diff --git a/src/legacy/core_plugins/telemetry/server/routes/telemetry_user_has_seen_notice.ts b/src/legacy/core_plugins/telemetry/server/routes/telemetry_user_has_seen_notice.ts index 93416058c3277..665e6d9aaeb75 100644 --- a/src/legacy/core_plugins/telemetry/server/routes/telemetry_user_has_seen_notice.ts +++ b/src/legacy/core_plugins/telemetry/server/routes/telemetry_user_has_seen_notice.ts @@ -19,7 +19,6 @@ import { Legacy } from 'kibana'; import { Request } from 'hapi'; -import { CoreSetup } from 'src/core/server'; import { TelemetrySavedObject, TelemetrySavedObjectAttributes, @@ -34,9 +33,7 @@ const getInternalRepository = (server: Legacy.Server) => { return internalRepository; }; -export function registerTelemetryUserHasSeenNotice(core: CoreSetup) { - const { server }: { server: Legacy.Server } = core.http as any; - +export function registerTelemetryUserHasSeenNotice(server: Legacy.Server) { server.route({ method: 'PUT', path: '/api/telemetry/v2/userHasSeenNotice', diff --git a/src/legacy/core_plugins/ui_metric/index.ts b/src/legacy/core_plugins/ui_metric/index.ts index 86d75a9f1818a..5a4a0ebf1a632 100644 --- a/src/legacy/core_plugins/ui_metric/index.ts +++ b/src/legacy/core_plugins/ui_metric/index.ts @@ -18,7 +18,6 @@ */ import { resolve } from 'path'; -import { Legacy } from '../../../../kibana'; // eslint-disable-next-line import/no-default-export export default function(kibana: any) { @@ -29,13 +28,6 @@ export default function(kibana: any) { uiExports: { mappings: require('./mappings.json'), }, - init(server: Legacy.Server) { - const { getSavedObjectsRepository } = server.savedObjects; - const { callWithInternalUser } = server.plugins.elasticsearch.getCluster('admin'); - const internalRepository = getSavedObjectsRepository(callWithInternalUser); - const { usageCollection } = server.newPlatform.setup.plugins; - - usageCollection.registerLegacySavedObjects(internalRepository); - }, + init() {}, }); } diff --git a/src/legacy/ui/public/chrome/api/sub_url_hooks.js b/src/legacy/ui/public/chrome/api/sub_url_hooks.js index 3ff262f546e3c..27d147b1ffc72 100644 --- a/src/legacy/ui/public/chrome/api/sub_url_hooks.js +++ b/src/legacy/ui/public/chrome/api/sub_url_hooks.js @@ -21,6 +21,7 @@ import url from 'url'; import { unhashUrl } from '../../../../../plugins/kibana_utils/public'; import { toastNotifications } from '../../notify/toasts'; +import { npSetup } from '../../new_platform'; export function registerSubUrlHooks(angularModule, internals) { angularModule.run(($rootScope, Private, $location) => { @@ -40,6 +41,7 @@ export function registerSubUrlHooks(angularModule, internals) { function onRouteChange($event) { if (subUrlRouteFilter($event)) { + updateUsage($event); updateSubUrls(); } } @@ -67,6 +69,13 @@ export function registerSubUrlHooks(angularModule, internals) { }); } +function updateUsage($event) { + const scope = $event.targetScope; + const app = scope.chrome.getApp(); + const appId = app.id === 'kibana' ? scope.getFirstPathSegment() : app.id; + if (npSetup.plugins.usageCollection) npSetup.plugins.usageCollection.__LEGACY.appChanged(appId); +} + /** * Creates a function that will be called on each route change * to determine if the event should be used to update the last diff --git a/src/plugins/usage_collection/public/mocks.ts b/src/plugins/usage_collection/public/mocks.ts index 69fbf56ca5604..cc2cfcfd8f661 100644 --- a/src/plugins/usage_collection/public/mocks.ts +++ b/src/plugins/usage_collection/public/mocks.ts @@ -26,6 +26,9 @@ const createSetupContract = (): Setup => { allowTrackUserAgent: jest.fn(), reportUiStats: jest.fn(), METRIC_TYPE, + __LEGACY: { + appChanged: jest.fn(), + }, }; return setupContract; diff --git a/src/plugins/usage_collection/public/plugin.ts b/src/plugins/usage_collection/public/plugin.ts index 7f80076a483b4..e89e24e25c627 100644 --- a/src/plugins/usage_collection/public/plugin.ts +++ b/src/plugins/usage_collection/public/plugin.ts @@ -18,6 +18,7 @@ */ import { Reporter, METRIC_TYPE } from '@kbn/analytics'; +import { Subject, merge } from 'rxjs'; import { Storage } from '../../kibana_utils/public'; import { createReporter } from './services'; import { @@ -27,6 +28,7 @@ import { CoreStart, HttpSetup, } from '../../../core/public'; +import { reportApplicationUsage } from './services/application_usage'; interface PublicConfigType { uiMetric: { @@ -39,6 +41,15 @@ export interface UsageCollectionSetup { allowTrackUserAgent: (allow: boolean) => void; reportUiStats: Reporter['reportUiStats']; METRIC_TYPE: typeof METRIC_TYPE; + __LEGACY: { + /** + * Legacy handler so we can report the actual app being used inside "kibana#/{appId}". + * To be removed when we get rid of the legacy world + * + * @deprecated + */ + appChanged: (appId: string) => void; + }; } export function isUnauthenticated(http: HttpSetup) { @@ -47,6 +58,7 @@ export function isUnauthenticated(http: HttpSetup) { } export class UsageCollectionPlugin implements Plugin { + private readonly legacyAppId$ = new Subject(); private trackUserAgent: boolean = true; private reporter?: Reporter; private config: PublicConfigType; @@ -70,10 +82,13 @@ export class UsageCollectionPlugin implements Plugin { }, reportUiStats: this.reporter.reportUiStats, METRIC_TYPE, + __LEGACY: { + appChanged: appId => this.legacyAppId$.next(appId), + }, }; } - public start({ http }: CoreStart) { + public start({ http, application }: CoreStart) { if (!this.reporter) { return; } @@ -85,6 +100,7 @@ export class UsageCollectionPlugin implements Plugin { if (this.trackUserAgent) { this.reporter.reportUserAgent('kibana'); } + reportApplicationUsage(merge(application.currentAppId$, this.legacyAppId$), this.reporter); } public stop() {} diff --git a/src/plugins/usage_collection/public/services/application_usage.test.ts b/src/plugins/usage_collection/public/services/application_usage.test.ts new file mode 100644 index 0000000000000..b314d6cf6472c --- /dev/null +++ b/src/plugins/usage_collection/public/services/application_usage.test.ts @@ -0,0 +1,69 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { Reporter } from '@kbn/analytics'; +import { Subject } from 'rxjs'; + +import { reportApplicationUsage } from './application_usage'; + +describe('application_usage', () => { + test('report an appId change', () => { + const reporterMock: jest.Mocked = { + reportApplicationUsage: jest.fn(), + } as any; + + const currentAppId$ = new Subject(); + reportApplicationUsage(currentAppId$, reporterMock); + + currentAppId$.next('appId'); + + expect(reporterMock.reportApplicationUsage).toHaveBeenCalledWith('appId'); + expect(reporterMock.reportApplicationUsage).toHaveBeenCalledTimes(1); + }); + + test('skip duplicates', () => { + const reporterMock: jest.Mocked = { + reportApplicationUsage: jest.fn(), + } as any; + + const currentAppId$ = new Subject(); + reportApplicationUsage(currentAppId$, reporterMock); + + currentAppId$.next('appId'); + currentAppId$.next('appId'); + + expect(reporterMock.reportApplicationUsage).toHaveBeenCalledWith('appId'); + expect(reporterMock.reportApplicationUsage).toHaveBeenCalledTimes(1); + }); + + test('skip if not a valid value', () => { + const reporterMock: jest.Mocked = { + reportApplicationUsage: jest.fn(), + } as any; + + const currentAppId$ = new Subject(); + reportApplicationUsage(currentAppId$, reporterMock); + + currentAppId$.next(''); + currentAppId$.next('kibana'); + currentAppId$.next(undefined); + + expect(reporterMock.reportApplicationUsage).toHaveBeenCalledTimes(0); + }); +}); diff --git a/src/plugins/usage_collection/public/services/application_usage.ts b/src/plugins/usage_collection/public/services/application_usage.ts new file mode 100644 index 0000000000000..15aaabc70ed0d --- /dev/null +++ b/src/plugins/usage_collection/public/services/application_usage.ts @@ -0,0 +1,39 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { Observable } from 'rxjs'; +import { filter, distinctUntilChanged } from 'rxjs/operators'; +import { Reporter } from '@kbn/analytics'; + +/** + * List of appIds not to report usage from (due to legacy hacks) + */ +const DO_NOT_REPORT = ['kibana']; + +export function reportApplicationUsage( + currentAppId$: Observable, + reporter: Reporter +) { + currentAppId$ + .pipe( + filter(appId => typeof appId === 'string' && !DO_NOT_REPORT.includes(appId)), + distinctUntilChanged() + ) + .subscribe(appId => appId && reporter.reportApplicationUsage(appId)); +} diff --git a/src/plugins/usage_collection/server/mocks.ts b/src/plugins/usage_collection/server/mocks.ts index 2194b1fb83f6e..ca3710c62cd89 100644 --- a/src/plugins/usage_collection/server/mocks.ts +++ b/src/plugins/usage_collection/server/mocks.ts @@ -27,9 +27,6 @@ const createSetupContract = () => { logger: loggingServiceMock.createLogger(), maximumWaitTimeForAllCollectorsInS: 1, }), - registerLegacySavedObjects: jest.fn() as jest.Mocked< - UsageCollectionSetup['registerLegacySavedObjects'] - >, } as UsageCollectionSetup; }; diff --git a/src/plugins/usage_collection/server/plugin.ts b/src/plugins/usage_collection/server/plugin.ts index 5c5b58ae84936..52acb5b3fc86f 100644 --- a/src/plugins/usage_collection/server/plugin.ts +++ b/src/plugins/usage_collection/server/plugin.ts @@ -18,18 +18,16 @@ */ import { first } from 'rxjs/operators'; +import { CoreStart, ISavedObjectsRepository } from 'kibana/server'; import { ConfigType } from './config'; import { PluginInitializerContext, Logger, CoreSetup } from '../../../../src/core/server'; import { CollectorSet } from './collector'; import { setupRoutes } from './routes'; -export type UsageCollectionSetup = CollectorSet & { - registerLegacySavedObjects: (legacySavedObjects: any) => void; -}; - +export type UsageCollectionSetup = CollectorSet; export class UsageCollectionPlugin { logger: Logger; - private legacySavedObjects: any; + private savedObjects?: ISavedObjectsRepository; constructor(private readonly initializerContext: PluginInitializerContext) { this.logger = this.initializerContext.logger.get(); } @@ -46,19 +44,14 @@ export class UsageCollectionPlugin { }); const router = core.http.createRouter(); - const getLegacySavedObjects = () => this.legacySavedObjects; - setupRoutes(router, getLegacySavedObjects); + setupRoutes(router, () => this.savedObjects); - return { - ...collectorSet, - registerLegacySavedObjects: (legacySavedObjects: any) => { - this.legacySavedObjects = legacySavedObjects; - }, - }; + return collectorSet; } - public start() { + public start({ savedObjects }: CoreStart) { this.logger.debug('Starting plugin'); + this.savedObjects = savedObjects.createInternalRepository(); } public stop() { diff --git a/src/plugins/usage_collection/server/report/schema.ts b/src/plugins/usage_collection/server/report/schema.ts index 5adf7d6575a70..a8081e3e320e9 100644 --- a/src/plugins/usage_collection/server/report/schema.ts +++ b/src/plugins/usage_collection/server/report/schema.ts @@ -54,6 +54,15 @@ export const reportSchema = schema.object({ }) ) ), + application_usage: schema.maybe( + schema.recordOf( + schema.string(), + schema.object({ + minutesOnScreen: schema.number(), + numberOfClicks: schema.number(), + }) + ) + ), }); export type ReportSchemaType = TypeOf; diff --git a/src/plugins/usage_collection/server/report/store_report.test.ts b/src/plugins/usage_collection/server/report/store_report.test.ts new file mode 100644 index 0000000000000..29b6d79cc139a --- /dev/null +++ b/src/plugins/usage_collection/server/report/store_report.test.ts @@ -0,0 +1,102 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { savedObjectsRepositoryMock } from '../../../../core/server/mocks'; +import { storeReport } from './store_report'; +import { ReportSchemaType } from './schema'; +import { METRIC_TYPE } from '../../public'; + +describe('store_report', () => { + test('stores report for all types of data', async () => { + const savedObjectClient = savedObjectsRepositoryMock.create(); + const report: ReportSchemaType = { + reportVersion: 1, + userAgent: { + 'key-user-agent': { + key: 'test-key', + type: METRIC_TYPE.USER_AGENT, + appName: 'test-app-name', + userAgent: 'test-user-agent', + }, + }, + uiStatsMetrics: { + any: { + key: 'test-key', + type: METRIC_TYPE.CLICK, + appName: 'test-app-name', + eventName: 'test-event-name', + stats: { + min: 1, + max: 2, + avg: 1.5, + sum: 3, + }, + }, + }, + application_usage: { + appId: { + numberOfClicks: 3, + minutesOnScreen: 10, + }, + }, + }; + await storeReport(savedObjectClient, report); + + expect(savedObjectClient.create).toHaveBeenCalledWith( + 'ui-metric', + { count: 1 }, + { + id: 'key-user-agent:test-user-agent', + overwrite: true, + } + ); + expect(savedObjectClient.incrementCounter).toHaveBeenCalledWith( + 'ui-metric', + 'test-app-name:test-event-name', + 'count' + ); + expect(savedObjectClient.bulkCreate).toHaveBeenCalledWith([ + { + type: 'application_usage_transactional', + attributes: { + numberOfClicks: 3, + minutesOnScreen: 10, + appId: 'appId', + timestamp: expect.any(Date), + }, + }, + ]); + }); + + test('it should not fail if nothing to store', async () => { + const savedObjectClient = savedObjectsRepositoryMock.create(); + const report: ReportSchemaType = { + reportVersion: 1, + userAgent: void 0, + uiStatsMetrics: void 0, + application_usage: void 0, + }; + await storeReport(savedObjectClient, report); + + expect(savedObjectClient.bulkCreate).not.toHaveBeenCalled(); + expect(savedObjectClient.incrementCounter).not.toHaveBeenCalled(); + expect(savedObjectClient.create).not.toHaveBeenCalled(); + expect(savedObjectClient.create).not.toHaveBeenCalled(); + }); +}); diff --git a/src/plugins/usage_collection/server/report/store_report.ts b/src/plugins/usage_collection/server/report/store_report.ts index 9232a23d6151b..c40622831eeee 100644 --- a/src/plugins/usage_collection/server/report/store_report.ts +++ b/src/plugins/usage_collection/server/report/store_report.ts @@ -17,28 +17,50 @@ * under the License. */ +import { ISavedObjectsRepository, SavedObject } from 'kibana/server'; import { ReportSchemaType } from './schema'; -export async function storeReport(internalRepository: any, report: ReportSchemaType) { +export async function storeReport( + internalRepository: ISavedObjectsRepository, + report: ReportSchemaType +) { const uiStatsMetrics = report.uiStatsMetrics ? Object.entries(report.uiStatsMetrics) : []; const userAgents = report.userAgent ? Object.entries(report.userAgent) : []; - return Promise.all([ + const appUsage = report.application_usage ? Object.entries(report.application_usage) : []; + const timestamp = new Date(); + return Promise.all<{ saved_objects: Array> }>([ ...userAgents.map(async ([key, metric]) => { const { userAgent } = metric; const savedObjectId = `${key}:${userAgent}`; - return await internalRepository.create( - 'ui-metric', - { count: 1 }, - { - id: savedObjectId, - overwrite: true, - } - ); + return { + saved_objects: [ + await internalRepository.create( + 'ui-metric', + { count: 1 }, + { + id: savedObjectId, + overwrite: true, + } + ), + ], + }; }), ...uiStatsMetrics.map(async ([key, metric]) => { const { appName, eventName } = metric; const savedObjectId = `${appName}:${eventName}`; - return await internalRepository.incrementCounter('ui-metric', savedObjectId, 'count'); + return { + saved_objects: [ + await internalRepository.incrementCounter('ui-metric', savedObjectId, 'count'), + ], + }; }), + appUsage.length + ? internalRepository.bulkCreate( + appUsage.map(([appId, metric]) => ({ + type: 'application_usage_transactional', + attributes: { ...metric, appId, timestamp }, + })) + ) + : { saved_objects: [] }, ]); } diff --git a/src/plugins/usage_collection/server/routes/index.ts b/src/plugins/usage_collection/server/routes/index.ts index 9e0d74add57bd..e6beef3fbdc59 100644 --- a/src/plugins/usage_collection/server/routes/index.ts +++ b/src/plugins/usage_collection/server/routes/index.ts @@ -17,9 +17,12 @@ * under the License. */ -import { IRouter } from '../../../../../src/core/server'; +import { IRouter, ISavedObjectsRepository } from 'kibana/server'; import { registerUiMetricRoute } from './report_metrics'; -export function setupRoutes(router: IRouter, getLegacySavedObjects: any) { - registerUiMetricRoute(router, getLegacySavedObjects); +export function setupRoutes( + router: IRouter, + getSavedObjects: () => ISavedObjectsRepository | undefined +) { + registerUiMetricRoute(router, getSavedObjects); } diff --git a/src/plugins/usage_collection/server/routes/report_metrics.ts b/src/plugins/usage_collection/server/routes/report_metrics.ts index 93f03ea8067d2..a72222968eabf 100644 --- a/src/plugins/usage_collection/server/routes/report_metrics.ts +++ b/src/plugins/usage_collection/server/routes/report_metrics.ts @@ -18,10 +18,13 @@ */ import { schema } from '@kbn/config-schema'; -import { IRouter } from '../../../../../src/core/server'; +import { IRouter, ISavedObjectsRepository } from 'kibana/server'; import { storeReport, reportSchema } from '../report'; -export function registerUiMetricRoute(router: IRouter, getLegacySavedObjects: () => any) { +export function registerUiMetricRoute( + router: IRouter, + getSavedObjects: () => ISavedObjectsRepository | undefined +) { router.post( { path: '/api/ui_metric/report', @@ -34,7 +37,10 @@ export function registerUiMetricRoute(router: IRouter, getLegacySavedObjects: () async (context, req, res) => { const { report } = req.body; try { - const internalRepository = getLegacySavedObjects(); + const internalRepository = getSavedObjects(); + if (!internalRepository) { + throw Error(`The saved objects client hasn't been initialised yet`); + } await storeReport(internalRepository, report); return res.ok({ body: { status: 'ok' } }); } catch (error) { From c5d17acab6c4b5ebdcab60dab8fdecde1e3d0881 Mon Sep 17 00:00:00 2001 From: Brandon Kobel Date: Fri, 28 Feb 2020 08:58:24 -0800 Subject: [PATCH 13/31] Fix privileges flaky test because the order in arrays matters for equality (#58790) Co-authored-by: Elastic Machine --- .../apis/security/privileges.ts | 84 ++++++++++++------- 1 file changed, 54 insertions(+), 30 deletions(-) diff --git a/x-pack/test/api_integration/apis/security/privileges.ts b/x-pack/test/api_integration/apis/security/privileges.ts index 81cffaac07285..4068b88cd30bc 100644 --- a/x-pack/test/api_integration/apis/security/privileges.ts +++ b/x-pack/test/api_integration/apis/security/privileges.ts @@ -3,47 +3,71 @@ * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ - +import util from 'util'; +import { isEqual } from 'lodash'; import { FtrProviderContext } from '../../ftr_provider_context'; export default function({ getService }: FtrProviderContext) { const supertest = getService('supertest'); - // FLAKY: https://github.com/elastic/kibana/issues/58785 - describe.skip('Privileges', () => { + describe('Privileges', () => { describe('GET /api/security/privileges', () => { it('should return a privilege map with all known privileges, without actions', async () => { + // If you're adding a privilege to the following, that's great! + // If you're removing a privilege, this breaks backwards compatibility + // Roles are associated with these privileges, and we shouldn't be removing them in a minor version. + const expected = { + features: { + discover: ['all', 'read'], + visualize: ['all', 'read'], + dashboard: ['all', 'read'], + dev_tools: ['all', 'read'], + advancedSettings: ['all', 'read'], + indexPatterns: ['all', 'read'], + savedObjectsManagement: ['all', 'read'], + timelion: ['all', 'read'], + graph: ['all', 'read'], + maps: ['all', 'read'], + canvas: ['all', 'read'], + infrastructure: ['all', 'read'], + logs: ['all', 'read'], + uptime: ['all', 'read'], + apm: ['all', 'read'], + siem: ['all', 'read'], + endpoint: ['all', 'read'], + }, + global: ['all', 'read'], + space: ['all', 'read'], + reserved: ['ml', 'monitoring'], + }; + await supertest .get('/api/security/privileges') .set('kbn-xsrf', 'xxx') .send() - .expect(200, { - // If you're adding a privilege to the following, that's great! - // If you're removing a privilege, this breaks backwards compatibility - // Roles are associated with these privileges, and we shouldn't be removing them in a minor version. - features: { - discover: ['all', 'read'], - visualize: ['all', 'read'], - dashboard: ['all', 'read'], - dev_tools: ['all', 'read'], - advancedSettings: ['all', 'read'], - indexPatterns: ['all', 'read'], - savedObjectsManagement: ['all', 'read'], - timelion: ['all', 'read'], - graph: ['all', 'read'], - maps: ['all', 'read'], - canvas: ['all', 'read'], - infrastructure: ['all', 'read'], - logs: ['all', 'read'], - uptime: ['all', 'read'], - apm: ['all', 'read'], - siem: ['all', 'read'], - endpoint: ['all', 'read'], - }, - global: ['all', 'read'], - space: ['all', 'read'], - reserved: ['monitoring', 'ml'], - }); + .expect(200) + .expect((res: any) => { + // when comparing privileges, the order of the privileges doesn't matter. + // supertest uses assert.deepStrictEqual. + // expect.js doesn't help us here. + // and lodash's isEqual doesn't know how to compare Sets. + const success = isEqual(res.body, expected, (value, other, key) => { + if (Array.isArray(value) && Array.isArray(other)) { + return isEqual(value.sort(), other.sort()); + } + + // Lodash types aren't correct, `undefined` should be supported as a return value here and it + // has special meaning. + return undefined as any; + }); + + if (!success) { + throw new Error( + `Expected ${util.inspect(res.body)} to equal ${util.inspect(expected)}` + ); + } + }) + .expect(200); }); }); }); From ad0aa1229605ef23e9fc436aef17ffc0aac93b0b Mon Sep 17 00:00:00 2001 From: Stacey Gammon Date: Fri, 28 Feb 2020 12:12:03 -0500 Subject: [PATCH 14/31] Improve action and trigger types (#58657) * Improve types so emitting the wrong context shape complains, as does using a trigger id that has not been added to the trigger context mapping. * remove unneccessary code --- .../public/hello_world_action.tsx | 9 +- examples/ui_action_examples/public/plugin.ts | 28 ++-- .../public/actions/actions.tsx | 30 ++-- examples/ui_actions_explorer/public/app.tsx | 2 +- .../ui_actions_explorer/public/plugin.tsx | 11 ++ .../public/trigger_context_example.tsx | 9 +- .../np_ready/embeddable/search_embeddable.ts | 4 +- .../embeddable/search_embeddable_factory.ts | 4 +- src/plugins/embeddable/public/bootstrap.ts | 7 +- .../lib/containers/embeddable_child_panel.tsx | 4 +- .../lib/panel/embeddable_panel.test.tsx | 2 +- .../public/lib/panel/embeddable_panel.tsx | 24 ++-- .../lib/panel/panel_header/panel_header.tsx | 5 +- .../test_samples/actions/edit_mode_action.ts | 8 +- .../embeddables/contact_card/contact_card.tsx | 12 +- .../contact_card/contact_card_embeddable.tsx | 4 +- .../contact_card_embeddable_factory.tsx | 4 +- .../slow_contact_card_embeddable_factory.ts | 4 +- .../embeddables/hello_world_container.tsx | 4 +- .../hello_world_container_component.tsx | 4 +- .../public/lib/triggers/triggers.ts | 4 + .../ui_actions/public/actions/action.ts | 14 +- .../public/actions/create_action.ts | 8 +- src/plugins/ui_actions/public/index.ts | 19 +-- src/plugins/ui_actions/public/mocks.ts | 3 +- .../public/service/ui_actions_service.test.ts | 128 ++++++++++-------- .../public/service/ui_actions_service.ts | 42 ++++-- .../tests/execute_trigger_actions.test.ts | 23 ++-- .../public/tests/get_trigger_actions.test.ts | 13 +- .../get_trigger_compatible_actions.test.ts | 21 +-- .../public/triggers/trigger_contract.ts | 5 +- .../public/triggers/trigger_internal.ts | 15 +- src/plugins/ui_actions/public/types.ts | 15 +- .../public/np_ready/public/app/app.tsx | 4 +- .../app/dashboard_container_example.tsx | 4 +- 35 files changed, 278 insertions(+), 219 deletions(-) diff --git a/examples/ui_action_examples/public/hello_world_action.tsx b/examples/ui_action_examples/public/hello_world_action.tsx index e07855a6f422c..f4c3bfeee6a6d 100644 --- a/examples/ui_action_examples/public/hello_world_action.tsx +++ b/examples/ui_action_examples/public/hello_world_action.tsx @@ -24,11 +24,16 @@ import { toMountPoint } from '../../../src/plugins/kibana_react/public'; export const HELLO_WORLD_ACTION_TYPE = 'HELLO_WORLD_ACTION_TYPE'; -export const createHelloWorldAction = (openModal: OverlayStart['openModal']) => - createAction<{}>({ +interface StartServices { + openModal: OverlayStart['openModal']; +} + +export const createHelloWorldAction = (getStartServices: () => Promise) => + createAction({ type: HELLO_WORLD_ACTION_TYPE, getDisplayName: () => 'Hello World!', execute: async () => { + const { openModal } = await getStartServices(); const overlay = openModal( toMountPoint( diff --git a/examples/ui_action_examples/public/plugin.ts b/examples/ui_action_examples/public/plugin.ts index bf62b4d973d4d..08b65714dbf66 100644 --- a/examples/ui_action_examples/public/plugin.ts +++ b/examples/ui_action_examples/public/plugin.ts @@ -17,30 +17,34 @@ * under the License. */ -import { Plugin, CoreSetup, CoreStart } from '../../../src/core/public'; -import { UiActionsSetup, UiActionsStart } from '../../../src/plugins/ui_actions/public'; -import { createHelloWorldAction, HELLO_WORLD_ACTION_TYPE } from './hello_world_action'; -import { helloWorldTrigger } from './hello_world_trigger'; +import { Plugin, CoreSetup } from '../../../src/core/public'; +import { UiActionsSetup } from '../../../src/plugins/ui_actions/public'; +import { createHelloWorldAction } from './hello_world_action'; +import { helloWorldTrigger, HELLO_WORLD_TRIGGER_ID } from './hello_world_trigger'; interface UiActionExamplesSetupDependencies { uiActions: UiActionsSetup; } -interface UiActionExamplesStartDependencies { - uiActions: UiActionsStart; +declare module '../../../src/plugins/ui_actions/public' { + export interface TriggerContextMapping { + [HELLO_WORLD_TRIGGER_ID]: undefined; + } } export class UiActionExamplesPlugin - implements - Plugin { + implements Plugin { public setup(core: CoreSetup, { uiActions }: UiActionExamplesSetupDependencies) { uiActions.registerTrigger(helloWorldTrigger); - uiActions.attachAction(helloWorldTrigger.id, HELLO_WORLD_ACTION_TYPE); - } - public start(coreStart: CoreStart, deps: UiActionExamplesStartDependencies) { - deps.uiActions.registerAction(createHelloWorldAction(coreStart.overlays.openModal)); + const helloWorldAction = createHelloWorldAction(async () => ({ + openModal: (await core.getStartServices())[0].overlays.openModal, + })); + + uiActions.registerAction(helloWorldAction); + uiActions.attachAction(helloWorldTrigger.id, helloWorldAction.id); } + public start() {} public stop() {} } diff --git a/examples/ui_actions_explorer/public/actions/actions.tsx b/examples/ui_actions_explorer/public/actions/actions.tsx index 821a1205861e6..2770b0e3bd5ff 100644 --- a/examples/ui_actions_explorer/public/actions/actions.tsx +++ b/examples/ui_actions_explorer/public/actions/actions.tsx @@ -34,16 +34,18 @@ export const EDIT_USER_ACTION = 'EDIT_USER_ACTION'; export const PHONE_USER_ACTION = 'PHONE_USER_ACTION'; export const SHOWCASE_PLUGGABILITY_ACTION = 'SHOWCASE_PLUGGABILITY_ACTION'; -export const showcasePluggability = createAction<{}>({ +export const showcasePluggability = createAction({ type: SHOWCASE_PLUGGABILITY_ACTION, getDisplayName: () => 'This is pluggable! Any plugin can inject their actions here.', - execute: async ({}) => alert("Isn't that cool?!"), + execute: async () => alert("Isn't that cool?!"), }); -export const makePhoneCallAction = createAction<{ phone: string }>({ +export type PhoneContext = string; + +export const makePhoneCallAction = createAction({ type: CALL_PHONE_NUMBER_ACTION, getDisplayName: () => 'Call phone number', - execute: async ({ phone }) => alert(`Pretend calling ${phone}...`), + execute: async phone => alert(`Pretend calling ${phone}...`), }); export const lookUpWeatherAction = createAction<{ country: string }>({ @@ -55,11 +57,13 @@ export const lookUpWeatherAction = createAction<{ country: string }>({ }, }); -export const viewInMapsAction = createAction<{ country: string }>({ +export type CountryContext = string; + +export const viewInMapsAction = createAction({ type: VIEW_IN_MAPS_ACTION, getIconType: () => 'popout', getDisplayName: () => 'View in maps', - execute: async ({ country }) => { + execute: async country => { window.open(`https://www.google.com/maps/place/${country}`, '_blank'); }, }); @@ -110,11 +114,13 @@ export const createEditUserAction = (getOpenModal: () => Promise void; +} + export const createPhoneUserAction = (getUiActionsApi: () => Promise) => - createAction<{ - user: User; - update: (user: User) => void; - }>({ + createAction({ type: PHONE_USER_ACTION, getDisplayName: () => 'Call phone number', isCompatible: async ({ user }) => user.phone !== undefined, @@ -126,6 +132,8 @@ export const createPhoneUserAction = (getUiActionsApi: () => Promise { uiActionsApi.executeTriggerActions(HELLO_WORLD_TRIGGER_ID, {})} + onClick={() => uiActionsApi.executeTriggerActions(HELLO_WORLD_TRIGGER_ID, undefined)} > Say hello world! diff --git a/examples/ui_actions_explorer/public/plugin.tsx b/examples/ui_actions_explorer/public/plugin.tsx index 953bfd3f52692..fecada71099e8 100644 --- a/examples/ui_actions_explorer/public/plugin.tsx +++ b/examples/ui_actions_explorer/public/plugin.tsx @@ -35,6 +35,9 @@ import { makePhoneCallAction, showcasePluggability, SHOWCASE_PLUGGABILITY_ACTION, + UserContext, + CountryContext, + PhoneContext, } from './actions/actions'; interface StartDeps { @@ -45,6 +48,14 @@ interface SetupDeps { uiActions: UiActionsSetup; } +declare module '../../../src/plugins/ui_actions/public' { + export interface TriggerContextMapping { + [USER_TRIGGER]: UserContext; + [COUNTRY_TRIGGER]: CountryContext; + [PHONE_TRIGGER]: PhoneContext; + } +} + export class UiActionsExplorerPlugin implements Plugin { public setup(core: CoreSetup<{ uiActions: UiActionsStart }>, deps: SetupDeps) { deps.uiActions.registerTrigger({ diff --git a/examples/ui_actions_explorer/public/trigger_context_example.tsx b/examples/ui_actions_explorer/public/trigger_context_example.tsx index 09e1de05bb313..00d974e938138 100644 --- a/examples/ui_actions_explorer/public/trigger_context_example.tsx +++ b/examples/ui_actions_explorer/public/trigger_context_example.tsx @@ -47,9 +47,7 @@ const createRowData = ( { - uiActionsApi.executeTriggerActions(COUNTRY_TRIGGER, { - country: user.countryOfResidence, - }); + uiActionsApi.executeTriggerActions(COUNTRY_TRIGGER, user.countryOfResidence); }} > {user.countryOfResidence} @@ -59,10 +57,9 @@ const createRowData = ( phone: ( { - uiActionsApi.executeTriggerActions(PHONE_TRIGGER, { - phone: user.phone, - }); + uiActionsApi.executeTriggerActions(PHONE_TRIGGER, user.phone!); }} > {user.phone} diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/embeddable/search_embeddable.ts b/src/legacy/core_plugins/kibana/public/discover/np_ready/embeddable/search_embeddable.ts index 2bb76386bb7ba..738a74d93449d 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/embeddable/search_embeddable.ts +++ b/src/legacy/core_plugins/kibana/public/discover/np_ready/embeddable/search_embeddable.ts @@ -20,7 +20,7 @@ import _ from 'lodash'; import * as Rx from 'rxjs'; import { Subscription } from 'rxjs'; import { i18n } from '@kbn/i18n'; -import { ExecuteTriggerActions } from 'src/plugins/ui_actions/public'; +import { UiActionsStart } from 'src/plugins/ui_actions/public'; import { RequestAdapter, Adapters } from '../../../../../../../plugins/inspector/public'; import { esFilters, @@ -110,7 +110,7 @@ export class SearchEmbeddable extends Embeddable filterManager, }: SearchEmbeddableConfig, initialInput: SearchInput, - private readonly executeTriggerActions: ExecuteTriggerActions, + private readonly executeTriggerActions: UiActionsStart['executeTriggerActions'], parent?: Container ) { super( diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/embeddable/search_embeddable_factory.ts b/src/legacy/core_plugins/kibana/public/discover/np_ready/embeddable/search_embeddable_factory.ts index 15b3f2d4517ac..90f1549c9f369 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/embeddable/search_embeddable_factory.ts +++ b/src/legacy/core_plugins/kibana/public/discover/np_ready/embeddable/search_embeddable_factory.ts @@ -19,7 +19,7 @@ import { auto } from 'angular'; import { i18n } from '@kbn/i18n'; -import { ExecuteTriggerActions } from 'src/plugins/ui_actions/public'; +import { UiActionsStart } from 'src/plugins/ui_actions/public'; import { getServices } from '../../kibana_services'; import { EmbeddableFactory, @@ -43,7 +43,7 @@ export class SearchEmbeddableFactory extends EmbeddableFactory< public isEditable: () => boolean; constructor( - private readonly executeTriggerActions: ExecuteTriggerActions, + private readonly executeTriggerActions: UiActionsStart['executeTriggerActions'], getInjector: () => Promise, isEditable: () => boolean ) { diff --git a/src/plugins/embeddable/public/bootstrap.ts b/src/plugins/embeddable/public/bootstrap.ts index 9989345df2796..93a15aab7a0dd 100644 --- a/src/plugins/embeddable/public/bootstrap.ts +++ b/src/plugins/embeddable/public/bootstrap.ts @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import { UiActionsSetup } from 'src/plugins/ui_actions/public'; +import { UiActionsSetup } from '../../ui_actions/public'; import { Filter } from '../../data/public'; import { applyFilterTrigger, @@ -27,6 +27,7 @@ import { valueClickTrigger, EmbeddableVisTriggerContext, IEmbeddable, + EmbeddableContext, APPLY_FILTER_TRIGGER, VALUE_CLICK_TRIGGER, SELECT_RANGE_TRIGGER, @@ -42,8 +43,8 @@ declare module '../../ui_actions/public' { embeddable: IEmbeddable; filters: Filter[]; }; - [CONTEXT_MENU_TRIGGER]: object; - [PANEL_BADGE_TRIGGER]: object; + [CONTEXT_MENU_TRIGGER]: EmbeddableContext; + [PANEL_BADGE_TRIGGER]: EmbeddableContext; } } diff --git a/src/plugins/embeddable/public/lib/containers/embeddable_child_panel.tsx b/src/plugins/embeddable/public/lib/containers/embeddable_child_panel.tsx index f604cb0c274ba..e15f1faaa397c 100644 --- a/src/plugins/embeddable/public/lib/containers/embeddable_child_panel.tsx +++ b/src/plugins/embeddable/public/lib/containers/embeddable_child_panel.tsx @@ -23,7 +23,7 @@ import React from 'react'; import { EuiLoadingChart } from '@elastic/eui'; import { Subscription } from 'rxjs'; import { CoreStart } from 'src/core/public'; -import { GetActionsCompatibleWithTrigger } from 'src/plugins/ui_actions/public'; +import { UiActionsService } from 'src/plugins/ui_actions/public'; import { Start as InspectorStartContract } from 'src/plugins/inspector/public'; import { ErrorEmbeddable, IEmbeddable } from '../embeddables'; @@ -35,7 +35,7 @@ export interface EmbeddableChildPanelProps { embeddableId: string; className?: string; container: IContainer; - getActions: GetActionsCompatibleWithTrigger; + getActions: UiActionsService['getTriggerCompatibleActions']; getEmbeddableFactory: GetEmbeddableFactory; getAllEmbeddableFactories: GetEmbeddableFactories; overlays: CoreStart['overlays']; diff --git a/src/plugins/embeddable/public/lib/panel/embeddable_panel.test.tsx b/src/plugins/embeddable/public/lib/panel/embeddable_panel.test.tsx index 79d59317767d9..218660462b4ef 100644 --- a/src/plugins/embeddable/public/lib/panel/embeddable_panel.test.tsx +++ b/src/plugins/embeddable/public/lib/panel/embeddable_panel.test.tsx @@ -44,7 +44,7 @@ import { import { inspectorPluginMock } from 'src/plugins/inspector/public/mocks'; import { EuiBadge } from '@elastic/eui'; -const actionRegistry = new Map(); +const actionRegistry = new Map>(); const triggerRegistry = new Map(); const embeddableFactories = new Map(); const getEmbeddableFactory: GetEmbeddableFactory = (id: string) => embeddableFactories.get(id); diff --git a/src/plugins/embeddable/public/lib/panel/embeddable_panel.tsx b/src/plugins/embeddable/public/lib/panel/embeddable_panel.tsx index c5f4265ac3b0d..28474544f40b5 100644 --- a/src/plugins/embeddable/public/lib/panel/embeddable_panel.tsx +++ b/src/plugins/embeddable/public/lib/panel/embeddable_panel.tsx @@ -20,12 +20,12 @@ import { EuiContextMenuPanelDescriptor, EuiPanel, htmlIdGenerator } from '@elast import classNames from 'classnames'; import React from 'react'; import { Subscription } from 'rxjs'; -import { buildContextMenuForActions, GetActionsCompatibleWithTrigger, Action } from '../ui_actions'; +import { buildContextMenuForActions, UiActionsService, Action } from '../ui_actions'; import { CoreStart, OverlayStart } from '../../../../../core/public'; import { toMountPoint } from '../../../../kibana_react/public'; import { Start as InspectorStartContract } from '../inspector'; -import { CONTEXT_MENU_TRIGGER, PANEL_BADGE_TRIGGER } from '../triggers'; +import { CONTEXT_MENU_TRIGGER, PANEL_BADGE_TRIGGER, EmbeddableContext } from '../triggers'; import { IEmbeddable } from '../embeddables/i_embeddable'; import { ViewMode, GetEmbeddableFactory, GetEmbeddableFactories } from '../types'; @@ -39,7 +39,7 @@ import { CustomizePanelModal } from './panel_header/panel_actions/customize_titl interface Props { embeddable: IEmbeddable; - getActions: GetActionsCompatibleWithTrigger; + getActions: UiActionsService['getTriggerCompatibleActions']; getEmbeddableFactory: GetEmbeddableFactory; getAllEmbeddableFactories: GetEmbeddableFactories; overlays: CoreStart['overlays']; @@ -55,7 +55,7 @@ interface State { viewMode: ViewMode; hidePanelTitles: boolean; closeContextMenu: boolean; - badges: Action[]; + badges: Array>; } export class EmbeddablePanel extends React.Component { @@ -87,7 +87,7 @@ export class EmbeddablePanel extends React.Component { } private async refreshBadges() { - let badges: Action[] = await this.props.getActions(PANEL_BADGE_TRIGGER, { + let badges = await this.props.getActions(PANEL_BADGE_TRIGGER, { embeddable: this.props.embeddable, }); if (!this.mounted) return; @@ -231,7 +231,7 @@ export class EmbeddablePanel extends React.Component { // These actions are exposed on the context menu for every embeddable, they bypass the trigger // registry. - const extraActions: Array> = [ + const extraActions: Array> = [ new CustomizePanelTitleAction(createGetUserData(this.props.overlays)), new AddPanelAction( this.props.getEmbeddableFactory, @@ -245,11 +245,13 @@ export class EmbeddablePanel extends React.Component { new EditPanelAction(this.props.getEmbeddableFactory), ]; - const sorted = actions.concat(extraActions).sort((a: Action, b: Action) => { - const bOrder = b.order || 0; - const aOrder = a.order || 0; - return bOrder - aOrder; - }); + const sorted = actions + .concat(extraActions) + .sort((a: Action, b: Action) => { + const bOrder = b.order || 0; + const aOrder = a.order || 0; + return bOrder - aOrder; + }); return await buildContextMenuForActions({ actions: sorted, diff --git a/src/plugins/embeddable/public/lib/panel/panel_header/panel_header.tsx b/src/plugins/embeddable/public/lib/panel/panel_header/panel_header.tsx index cc0733a08dd78..99516a1d21d6f 100644 --- a/src/plugins/embeddable/public/lib/panel/panel_header/panel_header.tsx +++ b/src/plugins/embeddable/public/lib/panel/panel_header/panel_header.tsx @@ -29,6 +29,7 @@ import React from 'react'; import { Action } from 'src/plugins/ui_actions/public'; import { PanelOptionsMenu } from './panel_options_menu'; import { IEmbeddable } from '../../embeddables'; +import { EmbeddableContext } from '../../triggers'; export interface PanelHeaderProps { title?: string; @@ -36,12 +37,12 @@ export interface PanelHeaderProps { hidePanelTitles: boolean; getActionContextMenuPanel: () => Promise; closeContextMenu: boolean; - badges: Action[]; + badges: Array>; embeddable: IEmbeddable; headerId?: string; } -function renderBadges(badges: Action[], embeddable: IEmbeddable) { +function renderBadges(badges: Array>, embeddable: IEmbeddable) { return badges.map(badge => ( ({ + return createAction({ type: EDIT_MODE_ACTION, getDisplayName: () => 'I only show up in edit mode', isCompatible: async context => context.embeddable.getInput().viewMode === ViewMode.EDIT, diff --git a/src/plugins/embeddable/public/lib/test_samples/embeddables/contact_card/contact_card.tsx b/src/plugins/embeddable/public/lib/test_samples/embeddables/contact_card/contact_card.tsx index a8c760f7b9497..01228c778754b 100644 --- a/src/plugins/embeddable/public/lib/test_samples/embeddables/contact_card/contact_card.tsx +++ b/src/plugins/embeddable/public/lib/test_samples/embeddables/contact_card/contact_card.tsx @@ -22,12 +22,19 @@ import { EuiCard, EuiFlexItem, EuiFlexGroup, EuiFormRow } from '@elastic/eui'; import { Subscription } from 'rxjs'; import { EuiButton } from '@elastic/eui'; import * as Rx from 'rxjs'; -import { ExecuteTriggerActions } from 'src/plugins/ui_actions/public'; +import { UiActionsStart } from '../../../../../../ui_actions/public'; import { ContactCardEmbeddable, CONTACT_USER_TRIGGER } from './contact_card_embeddable'; +import { EmbeddableContext } from '../../../triggers'; + +declare module '../../../../../../ui_actions/public' { + export interface TriggerContextMapping { + [CONTACT_USER_TRIGGER]: EmbeddableContext; + } +} interface Props { embeddable: ContactCardEmbeddable; - execTrigger: ExecuteTriggerActions; + execTrigger: UiActionsStart['executeTriggerActions']; } interface State { @@ -72,7 +79,6 @@ export class ContactCardEmbeddableComponent extends React.Component { this.props.execTrigger(CONTACT_USER_TRIGGER, { embeddable: this.props.embeddable, - triggerContext: {}, }); }; diff --git a/src/plugins/embeddable/public/lib/test_samples/embeddables/contact_card/contact_card_embeddable.tsx b/src/plugins/embeddable/public/lib/test_samples/embeddables/contact_card/contact_card_embeddable.tsx index 48f9cd2ce516d..078e21df0f0ce 100644 --- a/src/plugins/embeddable/public/lib/test_samples/embeddables/contact_card/contact_card_embeddable.tsx +++ b/src/plugins/embeddable/public/lib/test_samples/embeddables/contact_card/contact_card_embeddable.tsx @@ -19,7 +19,7 @@ import React from 'react'; import ReactDom from 'react-dom'; import { Subscription } from 'rxjs'; -import { ExecuteTriggerActions } from 'src/plugins/ui_actions/public'; +import { UiActionsStart } from 'src/plugins/ui_actions/public'; import { Container } from '../../../containers'; import { EmbeddableOutput, Embeddable, EmbeddableInput } from '../../../embeddables'; import { CONTACT_CARD_EMBEDDABLE } from './contact_card_embeddable_factory'; @@ -37,7 +37,7 @@ export interface ContactCardEmbeddableOutput extends EmbeddableOutput { } export interface ContactCardEmbeddableOptions { - execAction: ExecuteTriggerActions; + execAction: UiActionsStart['executeTriggerActions']; } function getFullName(input: ContactCardEmbeddableInput) { diff --git a/src/plugins/embeddable/public/lib/test_samples/embeddables/contact_card/contact_card_embeddable_factory.tsx b/src/plugins/embeddable/public/lib/test_samples/embeddables/contact_card/contact_card_embeddable_factory.tsx index 838c8d7de8f12..7a9ba4fbbf6d6 100644 --- a/src/plugins/embeddable/public/lib/test_samples/embeddables/contact_card/contact_card_embeddable_factory.tsx +++ b/src/plugins/embeddable/public/lib/test_samples/embeddables/contact_card/contact_card_embeddable_factory.tsx @@ -19,7 +19,7 @@ import React from 'react'; import { i18n } from '@kbn/i18n'; -import { ExecuteTriggerActions } from 'src/plugins/ui_actions/public'; +import { UiActionsStart } from 'src/plugins/ui_actions/public'; import { CoreStart } from 'src/core/public'; import { toMountPoint } from '../../../../../../kibana_react/public'; @@ -36,7 +36,7 @@ export class ContactCardEmbeddableFactory extends EmbeddableFactory, - private readonly execTrigger: ExecuteTriggerActions, + private readonly execTrigger: UiActionsStart['executeTriggerActions'], private readonly overlays: CoreStart['overlays'] ) { super(options); diff --git a/src/plugins/embeddable/public/lib/test_samples/embeddables/contact_card/slow_contact_card_embeddable_factory.ts b/src/plugins/embeddable/public/lib/test_samples/embeddables/contact_card/slow_contact_card_embeddable_factory.ts index d16cd6dcd2187..b90e16c13fc62 100644 --- a/src/plugins/embeddable/public/lib/test_samples/embeddables/contact_card/slow_contact_card_embeddable_factory.ts +++ b/src/plugins/embeddable/public/lib/test_samples/embeddables/contact_card/slow_contact_card_embeddable_factory.ts @@ -17,13 +17,13 @@ * under the License. */ -import { ExecuteTriggerActions } from 'src/plugins/ui_actions/public'; +import { UiActionsStart } from 'src/plugins/ui_actions/public'; import { Container, EmbeddableFactory } from '../../..'; import { ContactCardEmbeddable, ContactCardEmbeddableInput } from './contact_card_embeddable'; import { CONTACT_CARD_EMBEDDABLE } from './contact_card_embeddable_factory'; interface SlowContactCardEmbeddableFactoryOptions { - execAction: ExecuteTriggerActions; + execAction: UiActionsStart['executeTriggerActions']; loadTickCount?: number; } diff --git a/src/plugins/embeddable/public/lib/test_samples/embeddables/hello_world_container.tsx b/src/plugins/embeddable/public/lib/test_samples/embeddables/hello_world_container.tsx index 7eca9f64bf937..c5ba054bebb7a 100644 --- a/src/plugins/embeddable/public/lib/test_samples/embeddables/hello_world_container.tsx +++ b/src/plugins/embeddable/public/lib/test_samples/embeddables/hello_world_container.tsx @@ -20,7 +20,7 @@ import React from 'react'; import ReactDOM from 'react-dom'; import { I18nProvider } from '@kbn/i18n/react'; import { CoreStart } from 'src/core/public'; -import { GetActionsCompatibleWithTrigger } from 'src/plugins/ui_actions/public'; +import { UiActionsService } from 'src/plugins/ui_actions/public'; import { Start as InspectorStartContract } from 'src/plugins/inspector/public'; import { Container, ViewMode, ContainerInput } from '../..'; import { HelloWorldContainerComponent } from './hello_world_container_component'; @@ -45,7 +45,7 @@ interface HelloWorldContainerInput extends ContainerInput { } interface HelloWorldContainerOptions { - getActions: GetActionsCompatibleWithTrigger; + getActions: UiActionsService['getTriggerCompatibleActions']; getEmbeddableFactory: GetEmbeddableFactory; getAllEmbeddableFactories: GetEmbeddableFactories; overlays: CoreStart['overlays']; diff --git a/src/plugins/embeddable/public/lib/test_samples/embeddables/hello_world_container_component.tsx b/src/plugins/embeddable/public/lib/test_samples/embeddables/hello_world_container_component.tsx index 413a0914bff65..e9acfd4539768 100644 --- a/src/plugins/embeddable/public/lib/test_samples/embeddables/hello_world_container_component.tsx +++ b/src/plugins/embeddable/public/lib/test_samples/embeddables/hello_world_container_component.tsx @@ -21,14 +21,14 @@ import { Subscription } from 'rxjs'; import { EuiFlexGroup, EuiFlexItem, EuiSpacer } from '@elastic/eui'; import { CoreStart } from 'src/core/public'; -import { GetActionsCompatibleWithTrigger } from 'src/plugins/ui_actions/public'; +import { UiActionsService } from 'src/plugins/ui_actions/public'; import { Start as InspectorStartContract } from 'src/plugins/inspector/public'; import { IContainer, PanelState, EmbeddableChildPanel } from '../..'; import { GetEmbeddableFactory, GetEmbeddableFactories } from '../../types'; interface Props { container: IContainer; - getActions: GetActionsCompatibleWithTrigger; + getActions: UiActionsService['getTriggerCompatibleActions']; getEmbeddableFactory: GetEmbeddableFactory; getAllEmbeddableFactories: GetEmbeddableFactories; overlays: CoreStart['overlays']; diff --git a/src/plugins/embeddable/public/lib/triggers/triggers.ts b/src/plugins/embeddable/public/lib/triggers/triggers.ts index 491d9e730eb75..a348e1ed79d8d 100644 --- a/src/plugins/embeddable/public/lib/triggers/triggers.ts +++ b/src/plugins/embeddable/public/lib/triggers/triggers.ts @@ -20,6 +20,10 @@ import { Trigger } from '../../../../ui_actions/public'; import { IEmbeddable } from '..'; +export interface EmbeddableContext { + embeddable: IEmbeddable; +} + export interface EmbeddableVisTriggerContext { embeddable: IEmbeddable; timeFieldName: string; diff --git a/src/plugins/ui_actions/public/actions/action.ts b/src/plugins/ui_actions/public/actions/action.ts index 22530f003f2cd..854e2c8c1cb09 100644 --- a/src/plugins/ui_actions/public/actions/action.ts +++ b/src/plugins/ui_actions/public/actions/action.ts @@ -19,7 +19,7 @@ import { UiComponent } from 'src/plugins/kibana_utils/common'; -export interface Action { +export interface Action { /** * Determined the order when there is more than one action matched to a trigger. * Higher numbers are displayed first. @@ -33,33 +33,33 @@ export interface Action { /** * Optional EUI icon type that can be displayed along with the title. */ - getIconType(context: ActionContext): string | undefined; + getIconType(context: Context): string | undefined; /** * Returns a title to be displayed to the user. * @param context */ - getDisplayName(context: ActionContext): string; + getDisplayName(context: Context): string; /** * `UiComponent` to render when displaying this action as a context menu item. * If not provided, `getDisplayName` will be used instead. */ - MenuItem?: UiComponent<{ context: ActionContext }>; + MenuItem?: UiComponent<{ context: Context }>; /** * Returns a promise that resolves to true if this action is compatible given the context, * otherwise resolves to false. */ - isCompatible(context: ActionContext): Promise; + isCompatible(context: Context): Promise; /** * If this returns something truthy, this is used in addition to the `execute` method when clicked. */ - getHref?(context: ActionContext): string | undefined; + getHref?(context: Context): string | undefined; /** * Executes the action. */ - execute(context: ActionContext): Promise; + execute(context: Context): Promise; } diff --git a/src/plugins/ui_actions/public/actions/create_action.ts b/src/plugins/ui_actions/public/actions/create_action.ts index 0cec076745334..4077cf1081021 100644 --- a/src/plugins/ui_actions/public/actions/create_action.ts +++ b/src/plugins/ui_actions/public/actions/create_action.ts @@ -19,11 +19,9 @@ import { Action } from './action'; -export function createAction( - action: { type: string; execute: Action['execute'] } & Partial< - Action - > -): Action { +export function createAction( + action: { type: string; execute: Action['execute'] } & Partial> +): Action { return { getIconType: () => undefined, order: 0, diff --git a/src/plugins/ui_actions/public/index.ts b/src/plugins/ui_actions/public/index.ts index 1ce48d5460b2e..eb69aefdbb50e 100644 --- a/src/plugins/ui_actions/public/index.ts +++ b/src/plugins/ui_actions/public/index.ts @@ -19,7 +19,6 @@ import { PluginInitializerContext } from '../../../core/public'; import { UiActionsPlugin } from './plugin'; -import { UiActionsService } from './service'; export function plugin(initializerContext: PluginInitializerContext) { return new UiActionsPlugin(initializerContext); @@ -30,20 +29,4 @@ export { UiActionsServiceParams, UiActionsService } from './service'; export { Action, createAction, IncompatibleActionError } from './actions'; export { buildContextMenuForActions } from './context_menu'; export { Trigger, TriggerContext } from './triggers'; -export { TriggerContextMapping } from './types'; - -/** - * @deprecated - * - * Use `UiActionsStart['getTriggerCompatibleActions']` or - * `UiActionsService['getTriggerCompatibleActions']` instead. - */ -export type GetActionsCompatibleWithTrigger = UiActionsService['getTriggerCompatibleActions']; - -/** - * @deprecated - * - * Use `UiActionsStart['executeTriggerActions']` or - * `UiActionsService['executeTriggerActions']` instead. - */ -export type ExecuteTriggerActions = UiActionsService['executeTriggerActions']; +export { TriggerContextMapping, TriggerId } from './types'; diff --git a/src/plugins/ui_actions/public/mocks.ts b/src/plugins/ui_actions/public/mocks.ts index d2ba901f1040d..948450495384a 100644 --- a/src/plugins/ui_actions/public/mocks.ts +++ b/src/plugins/ui_actions/public/mocks.ts @@ -21,6 +21,7 @@ import { CoreSetup, CoreStart } from 'src/core/public'; import { UiActionsSetup, UiActionsStart } from '.'; import { plugin as pluginInitializer } from '.'; import { coreMock } from '../../../core/public/mocks'; +import { TriggerId } from './types'; export type Setup = jest.Mocked; export type Start = jest.Mocked; @@ -43,7 +44,7 @@ const createStartContract = (): Start => { detachAction: jest.fn(), executeTriggerActions: jest.fn(), getTrigger: jest.fn(), - getTriggerActions: jest.fn((id: string) => []), + getTriggerActions: jest.fn((id: TriggerId) => []), getTriggerCompatibleActions: jest.fn(), clear: jest.fn(), fork: jest.fn(), diff --git a/src/plugins/ui_actions/public/service/ui_actions_service.test.ts b/src/plugins/ui_actions/public/service/ui_actions_service.test.ts index 8963ba4ddb005..c52b975358610 100644 --- a/src/plugins/ui_actions/public/service/ui_actions_service.test.ts +++ b/src/plugins/ui_actions/public/service/ui_actions_service.test.ts @@ -20,9 +20,16 @@ import { UiActionsService } from './ui_actions_service'; import { Action } from '../actions'; import { createRestrictedAction, createHelloWorldAction } from '../tests/test_samples'; -import { ActionRegistry, TriggerRegistry } from '../types'; +import { ActionRegistry, TriggerRegistry, TriggerId } from '../types'; import { Trigger } from '../triggers'; +// I tried redeclaring the module in here to extend the `TriggerContextMapping` but +// that seems to overwrite all other plugins extending it, I suspect because it's inside +// the main plugin. +const FOO_TRIGGER: TriggerId = 'FOO_TRIGGER' as TriggerId; +const BAR_TRIGGER: TriggerId = 'BAR_TRIGGER' as TriggerId; +const MY_TRIGGER: TriggerId = 'MY_TRIGGER' as TriggerId; + const testAction1: Action = { id: 'action1', order: 1, @@ -52,7 +59,7 @@ describe('UiActionsService', () => { test('can register a trigger', () => { const service = new UiActionsService(); service.registerTrigger({ - id: 'test', + id: BAR_TRIGGER, }); }); }); @@ -62,15 +69,15 @@ describe('UiActionsService', () => { const service = new UiActionsService(); service.registerTrigger({ description: 'foo', - id: 'bar', + id: BAR_TRIGGER, title: 'baz', }); - const trigger = service.getTrigger('bar'); + const trigger = service.getTrigger(BAR_TRIGGER); expect(trigger).toMatchObject({ description: 'foo', - id: 'bar', + id: BAR_TRIGGER, title: 'baz', }); }); @@ -78,8 +85,8 @@ describe('UiActionsService', () => { test('throws if trigger does not exist', () => { const service = new UiActionsService(); - expect(() => service.getTrigger('foo')).toThrowError( - 'Trigger [triggerId = foo] does not exist.' + expect(() => service.getTrigger(FOO_TRIGGER)).toThrowError( + 'Trigger [triggerId = FOO_TRIGGER] does not exist.' ); }); }); @@ -125,22 +132,22 @@ describe('UiActionsService', () => { service.registerAction(action2); service.registerTrigger({ description: 'foo', - id: 'trigger', + id: FOO_TRIGGER, title: 'baz', }); - const list0 = service.getTriggerActions('trigger'); + const list0 = service.getTriggerActions(FOO_TRIGGER); expect(list0).toHaveLength(0); - service.attachAction('trigger', 'action1'); - const list1 = service.getTriggerActions('trigger'); + service.attachAction(FOO_TRIGGER, 'action1'); + const list1 = service.getTriggerActions(FOO_TRIGGER); expect(list1).toHaveLength(1); expect(list1).toEqual([action1]); - service.attachAction('trigger', 'action2'); - const list2 = service.getTriggerActions('trigger'); + service.attachAction(FOO_TRIGGER, 'action2'); + const list2 = service.getTriggerActions(FOO_TRIGGER); expect(list2).toHaveLength(2); expect(!!list2.find(({ id }: any) => id === 'action1')).toBe(true); @@ -168,13 +175,15 @@ describe('UiActionsService', () => { service.registerAction(helloWorldAction); const testTrigger: Trigger = { - id: 'MY-TRIGGER', + id: MY_TRIGGER, title: 'My trigger', }; service.registerTrigger(testTrigger); - service.attachAction('MY-TRIGGER', helloWorldAction.id); + service.attachAction(MY_TRIGGER, helloWorldAction.id); - const compatibleActions = await service.getTriggerCompatibleActions('MY-TRIGGER', {}); + const compatibleActions = await service.getTriggerCompatibleActions(MY_TRIGGER, { + hi: 'there', + }); expect(compatibleActions.length).toBe(1); expect(compatibleActions[0].id).toBe(helloWorldAction.id); @@ -189,7 +198,7 @@ describe('UiActionsService', () => { service.registerAction(restrictedAction); const testTrigger: Trigger = { - id: 'MY-TRIGGER', + id: MY_TRIGGER, title: 'My trigger', }; @@ -212,15 +221,16 @@ describe('UiActionsService', () => { test(`throws an error with an invalid trigger ID`, async () => { const service = new UiActionsService(); - await expect(service.getTriggerCompatibleActions('I do not exist', {})).rejects.toMatchObject( - new Error('Trigger [triggerId = I do not exist] does not exist.') - ); + // Without the cast "as TriggerId" typescript will happily throw an error! + await expect( + service.getTriggerCompatibleActions('I do not exist' as TriggerId, {}) + ).rejects.toMatchObject(new Error('Trigger [triggerId = I do not exist] does not exist.')); }); test('returns empty list if trigger not attached to any action', async () => { const service = new UiActionsService(); const testTrigger: Trigger = { - id: '123', + id: '123' as TriggerId, title: '123', }; service.registerTrigger(testTrigger); @@ -243,15 +253,15 @@ describe('UiActionsService', () => { test('triggers registered in original service are available in original an forked services', () => { const service1 = new UiActionsService(); service1.registerTrigger({ - id: 'foo', + id: FOO_TRIGGER, }); const service2 = service1.fork(); - const trigger1 = service1.getTrigger('foo'); - const trigger2 = service2.getTrigger('foo'); + const trigger1 = service1.getTrigger(FOO_TRIGGER); + const trigger2 = service2.getTrigger(FOO_TRIGGER); - expect(trigger1.id).toBe('foo'); - expect(trigger2.id).toBe('foo'); + expect(trigger1.id).toBe(FOO_TRIGGER); + expect(trigger2.id).toBe(FOO_TRIGGER); }); test('triggers registered in forked service are not available in original service', () => { @@ -259,30 +269,30 @@ describe('UiActionsService', () => { const service2 = service1.fork(); service2.registerTrigger({ - id: 'foo', + id: FOO_TRIGGER, }); - expect(() => service1.getTrigger('foo')).toThrowErrorMatchingInlineSnapshot( - `"Trigger [triggerId = foo] does not exist."` + expect(() => service1.getTrigger(FOO_TRIGGER)).toThrowErrorMatchingInlineSnapshot( + `"Trigger [triggerId = FOO_TRIGGER] does not exist."` ); - const trigger2 = service2.getTrigger('foo'); - expect(trigger2.id).toBe('foo'); + const trigger2 = service2.getTrigger(FOO_TRIGGER); + expect(trigger2.id).toBe(FOO_TRIGGER); }); test('forked service preserves trigger-to-actions mapping', () => { const service1 = new UiActionsService(); service1.registerTrigger({ - id: 'foo', + id: FOO_TRIGGER, }); service1.registerAction(testAction1); - service1.attachAction('foo', testAction1.id); + service1.attachAction(FOO_TRIGGER, testAction1.id); const service2 = service1.fork(); - const actions1 = service1.getTriggerActions('foo'); - const actions2 = service2.getTriggerActions('foo'); + const actions1 = service1.getTriggerActions(FOO_TRIGGER); + const actions2 = service2.getTriggerActions(FOO_TRIGGER); expect(actions1).toHaveLength(1); expect(actions2).toHaveLength(1); @@ -294,42 +304,42 @@ describe('UiActionsService', () => { const service1 = new UiActionsService(); service1.registerTrigger({ - id: 'foo', + id: FOO_TRIGGER, }); service1.registerAction(testAction1); service1.registerAction(testAction2); - service1.attachAction('foo', testAction1.id); + service1.attachAction(FOO_TRIGGER, testAction1.id); const service2 = service1.fork(); - expect(service1.getTriggerActions('foo')).toHaveLength(1); - expect(service2.getTriggerActions('foo')).toHaveLength(1); + expect(service1.getTriggerActions(FOO_TRIGGER)).toHaveLength(1); + expect(service2.getTriggerActions(FOO_TRIGGER)).toHaveLength(1); - service2.attachAction('foo', testAction2.id); + service2.attachAction(FOO_TRIGGER, testAction2.id); - expect(service1.getTriggerActions('foo')).toHaveLength(1); - expect(service2.getTriggerActions('foo')).toHaveLength(2); + expect(service1.getTriggerActions(FOO_TRIGGER)).toHaveLength(1); + expect(service2.getTriggerActions(FOO_TRIGGER)).toHaveLength(2); }); test('new attachments in original service do not appear in fork', () => { const service1 = new UiActionsService(); service1.registerTrigger({ - id: 'foo', + id: FOO_TRIGGER, }); service1.registerAction(testAction1); service1.registerAction(testAction2); - service1.attachAction('foo', testAction1.id); + service1.attachAction(FOO_TRIGGER, testAction1.id); const service2 = service1.fork(); - expect(service1.getTriggerActions('foo')).toHaveLength(1); - expect(service2.getTriggerActions('foo')).toHaveLength(1); + expect(service1.getTriggerActions(FOO_TRIGGER)).toHaveLength(1); + expect(service2.getTriggerActions(FOO_TRIGGER)).toHaveLength(1); - service1.attachAction('foo', testAction2.id); + service1.attachAction(FOO_TRIGGER, testAction2.id); - expect(service1.getTriggerActions('foo')).toHaveLength(2); - expect(service2.getTriggerActions('foo')).toHaveLength(1); + expect(service1.getTriggerActions(FOO_TRIGGER)).toHaveLength(2); + expect(service2.getTriggerActions(FOO_TRIGGER)).toHaveLength(1); }); }); @@ -342,14 +352,14 @@ describe('UiActionsService', () => { service.registerTrigger({ description: 'foo', - id: 'bar', + id: BAR_TRIGGER, title: 'baz', }); - const triggerContract = service.getTrigger('bar'); + const triggerContract = service.getTrigger(BAR_TRIGGER); expect(triggerContract).toMatchObject({ description: 'foo', - id: 'bar', + id: BAR_TRIGGER, title: 'baz', }); }); @@ -373,7 +383,7 @@ describe('UiActionsService', () => { const service = new UiActionsService(); const trigger: Trigger = { - id: 'MY-TRIGGER', + id: MY_TRIGGER, }; const action = { id: HELLO_WORLD_ACTION_ID, @@ -382,7 +392,7 @@ describe('UiActionsService', () => { service.registerTrigger(trigger); service.registerAction(action); - service.attachAction('MY-TRIGGER', HELLO_WORLD_ACTION_ID); + service.attachAction(MY_TRIGGER, HELLO_WORLD_ACTION_ID); const actions = service.getTriggerActions(trigger.id); @@ -394,7 +404,7 @@ describe('UiActionsService', () => { const service = new UiActionsService(); const trigger: Trigger = { - id: 'MY-TRIGGER', + id: MY_TRIGGER, }; const action = { id: HELLO_WORLD_ACTION_ID, @@ -419,7 +429,9 @@ describe('UiActionsService', () => { } as any; service.registerAction(action); - expect(() => service.detachAction('i do not exist', HELLO_WORLD_ACTION_ID)).toThrowError( + expect(() => + service.detachAction('i do not exist' as TriggerId, HELLO_WORLD_ACTION_ID) + ).toThrowError( 'No trigger [triggerId = i do not exist] exists, for detaching action [actionId = HELLO_WORLD_ACTION_ID].' ); }); @@ -433,7 +445,9 @@ describe('UiActionsService', () => { } as any; service.registerAction(action); - expect(() => service.attachAction('i do not exist', HELLO_WORLD_ACTION_ID)).toThrowError( + expect(() => + service.attachAction('i do not exist' as TriggerId, HELLO_WORLD_ACTION_ID) + ).toThrowError( 'No trigger [triggerId = i do not exist] exists, for attaching action [actionId = HELLO_WORLD_ACTION_ID].' ); }); diff --git a/src/plugins/ui_actions/public/service/ui_actions_service.ts b/src/plugins/ui_actions/public/service/ui_actions_service.ts index ae409830bbb6e..66f038f05a4ac 100644 --- a/src/plugins/ui_actions/public/service/ui_actions_service.ts +++ b/src/plugins/ui_actions/public/service/ui_actions_service.ts @@ -17,7 +17,13 @@ * under the License. */ -import { TriggerRegistry, ActionRegistry, TriggerToActionsRegistry, TriggerId } from '../types'; +import { + TriggerRegistry, + ActionRegistry, + TriggerToActionsRegistry, + TriggerId, + TriggerContextMapping, +} from '../types'; import { Action } from '../actions'; import { Trigger, TriggerContext } from '../triggers/trigger'; import { TriggerInternal } from '../triggers/trigger_internal'; @@ -60,7 +66,7 @@ export class UiActionsService { }; public readonly getTrigger = (triggerId: T): TriggerContract => { - const trigger = this.triggers.get(triggerId as string); + const trigger = this.triggers.get(triggerId); if (!trigger) { throw new Error(`Trigger [triggerId = ${triggerId}] does not exist.`); @@ -69,7 +75,7 @@ export class UiActionsService { return trigger.contract; }; - public readonly registerAction = (action: Action) => { + public readonly registerAction = (action: Action) => { if (this.actions.has(action.id)) { throw new Error(`Action [action.id = ${action.id}] already registered.`); } @@ -77,7 +83,10 @@ export class UiActionsService { this.actions.set(action.id, action); }; - public readonly attachAction = (triggerId: string, actionId: string): void => { + // TODO: make this + // (triggerId: T, action: Action): \ + // to get type checks here! + public readonly attachAction = (triggerId: T, actionId: string): void => { const trigger = this.triggers.get(triggerId); if (!trigger) { @@ -93,7 +102,7 @@ export class UiActionsService { } }; - public readonly detachAction = (triggerId: string, actionId: string) => { + public readonly detachAction = (triggerId: TriggerId, actionId: string) => { const trigger = this.triggers.get(triggerId); if (!trigger) { @@ -110,23 +119,30 @@ export class UiActionsService { ); }; - public readonly getTriggerActions = (triggerId: string) => { + public readonly getTriggerActions = ( + triggerId: T + ): Array> => { // This line checks if trigger exists, otherwise throws. this.getTrigger!(triggerId); const actionIds = this.triggerToActions.get(triggerId); - const actions = actionIds! - .map(actionId => this.actions.get(actionId)) - .filter(Boolean) as Action[]; - return actions; + const actions = actionIds!.map(actionId => this.actions.get(actionId)).filter(Boolean) as Array< + Action + >; + + return actions as Array>>; }; - public readonly getTriggerCompatibleActions = async (triggerId: string, context: C) => { + public readonly getTriggerCompatibleActions = async ( + triggerId: T, + context: TriggerContextMapping[T] + ): Promise>> => { const actions = this.getTriggerActions!(triggerId); const isCompatibles = await Promise.all(actions.map(action => action.isCompatible(context))); - return actions.reduce( - (acc, action, i) => (isCompatibles[i] ? [...acc, action] : acc), + return actions.reduce( + (acc: Array>, action, i) => + isCompatibles[i] ? [...acc, action] : acc, [] ); }; diff --git a/src/plugins/ui_actions/public/tests/execute_trigger_actions.test.ts b/src/plugins/ui_actions/public/tests/execute_trigger_actions.test.ts index f8c196a623499..450bfbfc6c959 100644 --- a/src/plugins/ui_actions/public/tests/execute_trigger_actions.test.ts +++ b/src/plugins/ui_actions/public/tests/execute_trigger_actions.test.ts @@ -21,6 +21,7 @@ import { Action, createAction } from '../actions'; import { openContextMenu } from '../context_menu'; import { uiActionsPluginMock } from '../mocks'; import { Trigger } from '../triggers'; +import { TriggerId } from '../types'; jest.mock('../context_menu'); @@ -55,7 +56,7 @@ beforeEach(reset); test('executes a single action mapped to a trigger', async () => { const { setup, doStart } = uiActions; const trigger: Trigger = { - id: 'MY-TRIGGER', + id: 'MY-TRIGGER' as TriggerId, title: 'My trigger', }; const action = createTestAction('test1', () => true); @@ -66,7 +67,7 @@ test('executes a single action mapped to a trigger', async () => { const context = {}; const start = doStart(); - await start.executeTriggerActions('MY-TRIGGER', context); + await start.executeTriggerActions('MY-TRIGGER' as TriggerId, context); expect(executeFn).toBeCalledTimes(1); expect(executeFn).toBeCalledWith(context); @@ -75,7 +76,7 @@ test('executes a single action mapped to a trigger', async () => { test('throws an error if there are no compatible actions to execute', async () => { const { setup, doStart } = uiActions; const trigger: Trigger = { - id: 'MY-TRIGGER', + id: 'MY-TRIGGER' as TriggerId, title: 'My trigger', }; @@ -84,7 +85,9 @@ test('throws an error if there are no compatible actions to execute', async () = const context = {}; const start = doStart(); - await expect(start.executeTriggerActions('MY-TRIGGER', context)).rejects.toMatchObject( + await expect( + start.executeTriggerActions('MY-TRIGGER' as TriggerId, context) + ).rejects.toMatchObject( new Error('No compatible actions found to execute for trigger [triggerId = MY-TRIGGER].') ); }); @@ -92,7 +95,7 @@ test('throws an error if there are no compatible actions to execute', async () = test('does not execute an incompatible action', async () => { const { setup, doStart } = uiActions; const trigger: Trigger = { - id: 'MY-TRIGGER', + id: 'MY-TRIGGER' as TriggerId, title: 'My trigger', }; const action = createTestAction<{ name: string }>('test1', ({ name }) => name === 'executeme'); @@ -105,7 +108,7 @@ test('does not execute an incompatible action', async () => { const context = { name: 'executeme', }; - await start.executeTriggerActions('MY-TRIGGER', context); + await start.executeTriggerActions('MY-TRIGGER' as TriggerId, context); expect(executeFn).toBeCalledTimes(1); }); @@ -113,7 +116,7 @@ test('does not execute an incompatible action', async () => { test('shows a context menu when more than one action is mapped to a trigger', async () => { const { setup, doStart } = uiActions; const trigger: Trigger = { - id: 'MY-TRIGGER', + id: 'MY-TRIGGER' as TriggerId, title: 'My trigger', }; const action1 = createTestAction('test1', () => true); @@ -129,7 +132,7 @@ test('shows a context menu when more than one action is mapped to a trigger', as const start = doStart(); const context = {}; - await start.executeTriggerActions('MY-TRIGGER', context); + await start.executeTriggerActions('MY-TRIGGER' as TriggerId, context); expect(executeFn).toBeCalledTimes(0); expect(openContextMenu).toHaveBeenCalledTimes(1); @@ -138,7 +141,7 @@ test('shows a context menu when more than one action is mapped to a trigger', as test('passes whole action context to isCompatible()', async () => { const { setup, doStart } = uiActions; const trigger = { - id: 'MY-TRIGGER', + id: 'MY-TRIGGER' as TriggerId, title: 'My trigger', }; const action = createTestAction<{ foo: string }>('test', ({ foo }) => { @@ -153,5 +156,5 @@ test('passes whole action context to isCompatible()', async () => { const start = doStart(); const context = { foo: 'bar' }; - await start.executeTriggerActions('MY-TRIGGER', context); + await start.executeTriggerActions('MY-TRIGGER' as TriggerId, context); }); diff --git a/src/plugins/ui_actions/public/tests/get_trigger_actions.test.ts b/src/plugins/ui_actions/public/tests/get_trigger_actions.test.ts index e91acd4c7151b..ae335de4b3deb 100644 --- a/src/plugins/ui_actions/public/tests/get_trigger_actions.test.ts +++ b/src/plugins/ui_actions/public/tests/get_trigger_actions.test.ts @@ -19,6 +19,7 @@ import { Action } from '../actions'; import { uiActionsPluginMock } from '../mocks'; +import { TriggerId } from '../types'; const action1: Action = { id: 'action1', @@ -37,23 +38,23 @@ test('returns actions set on trigger', () => { setup.registerAction(action2); setup.registerTrigger({ description: 'foo', - id: 'trigger', + id: 'trigger' as TriggerId, title: 'baz', }); const start = doStart(); - const list0 = start.getTriggerActions('trigger'); + const list0 = start.getTriggerActions('trigger' as TriggerId); expect(list0).toHaveLength(0); - setup.attachAction('trigger', 'action1'); - const list1 = start.getTriggerActions('trigger'); + setup.attachAction('trigger' as TriggerId, 'action1'); + const list1 = start.getTriggerActions('trigger' as TriggerId); expect(list1).toHaveLength(1); expect(list1).toEqual([action1]); - setup.attachAction('trigger', 'action2'); - const list2 = start.getTriggerActions('trigger'); + setup.attachAction('trigger' as TriggerId, 'action2'); + const list2 = start.getTriggerActions('trigger' as TriggerId); expect(list2).toHaveLength(2); expect(!!list2.find(({ id }: any) => id === 'action1')).toBe(true); diff --git a/src/plugins/ui_actions/public/tests/get_trigger_compatible_actions.test.ts b/src/plugins/ui_actions/public/tests/get_trigger_compatible_actions.test.ts index a966003973aba..dfb55e42b9443 100644 --- a/src/plugins/ui_actions/public/tests/get_trigger_compatible_actions.test.ts +++ b/src/plugins/ui_actions/public/tests/get_trigger_compatible_actions.test.ts @@ -22,6 +22,7 @@ import { uiActionsPluginMock } from '../mocks'; import { createRestrictedAction, createHelloWorldAction } from '../tests/test_samples'; import { Action } from '../actions'; import { Trigger } from '../triggers'; +import { TriggerId } from '../types'; let action: Action<{ name: string }>; let uiActions: ReturnType; @@ -31,10 +32,10 @@ beforeEach(() => { uiActions.setup.registerAction(action); uiActions.setup.registerTrigger({ - id: 'trigger', + id: 'trigger' as TriggerId, title: 'trigger', }); - uiActions.setup.attachAction('trigger', action.id); + uiActions.setup.attachAction('trigger' as TriggerId, action.id); }); test('can register action', async () => { @@ -51,14 +52,14 @@ test('getTriggerCompatibleActions returns attached actions', async () => { setup.registerAction(helloWorldAction); const testTrigger: Trigger = { - id: 'MY-TRIGGER', + id: 'MY-TRIGGER' as TriggerId, title: 'My trigger', }; setup.registerTrigger(testTrigger); - setup.attachAction('MY-TRIGGER', helloWorldAction.id); + setup.attachAction('MY-TRIGGER' as TriggerId, helloWorldAction.id); const start = doStart(); - const actions = await start.getTriggerCompatibleActions('MY-TRIGGER', {}); + const actions = await start.getTriggerCompatibleActions('MY-TRIGGER' as TriggerId, {}); expect(actions.length).toBe(1); expect(actions[0].id).toBe(helloWorldAction.id); @@ -73,7 +74,7 @@ test('filters out actions not applicable based on the context', async () => { setup.registerAction(restrictedAction); const testTrigger: Trigger = { - id: 'MY-TRIGGER', + id: 'MY-TRIGGER' as TriggerId, title: 'My trigger', }; @@ -94,15 +95,15 @@ test(`throws an error with an invalid trigger ID`, async () => { const { doStart } = uiActions; const start = doStart(); - await expect(start.getTriggerCompatibleActions('I do not exist', {})).rejects.toMatchObject( - new Error('Trigger [triggerId = I do not exist] does not exist.') - ); + await expect( + start.getTriggerCompatibleActions('I do not exist' as TriggerId, {}) + ).rejects.toMatchObject(new Error('Trigger [triggerId = I do not exist] does not exist.')); }); test(`with a trigger mapping that maps to an non-existing action returns empty list`, async () => { const { setup, doStart } = uiActions; const testTrigger: Trigger = { - id: '123', + id: '123' as TriggerId, title: '123', }; setup.registerTrigger(testTrigger); diff --git a/src/plugins/ui_actions/public/triggers/trigger_contract.ts b/src/plugins/ui_actions/public/triggers/trigger_contract.ts index 853b83dccabcc..ba1c5a693f937 100644 --- a/src/plugins/ui_actions/public/triggers/trigger_contract.ts +++ b/src/plugins/ui_actions/public/triggers/trigger_contract.ts @@ -17,9 +17,8 @@ * under the License. */ -import { TriggerContext } from './trigger'; import { TriggerInternal } from './trigger_internal'; -import { TriggerId } from '../types'; +import { TriggerId, TriggerContextMapping } from '../types'; /** * This is a public representation of a trigger that is provided to other plugins. @@ -50,7 +49,7 @@ export class TriggerContract { /** * Use this method to execute action attached to this trigger. */ - public readonly exec = async (context: TriggerContext) => { + public readonly exec = async (context: TriggerContextMapping[T]) => { await this.internal.execute(context); }; } diff --git a/src/plugins/ui_actions/public/triggers/trigger_internal.ts b/src/plugins/ui_actions/public/triggers/trigger_internal.ts index efcdc72ecad57..5b670df354f78 100644 --- a/src/plugins/ui_actions/public/triggers/trigger_internal.ts +++ b/src/plugins/ui_actions/public/triggers/trigger_internal.ts @@ -17,12 +17,12 @@ * under the License. */ -import { TriggerContext, Trigger } from './trigger'; +import { Trigger } from './trigger'; import { TriggerContract } from './trigger_contract'; import { UiActionsService } from '../service'; import { Action } from '../actions'; import { buildContextMenuForActions, openContextMenu } from '../context_menu'; -import { TriggerId } from '../types'; +import { TriggerId, TriggerContextMapping } from '../types'; /** * Internal representation of a trigger kept for consumption only internally @@ -33,7 +33,7 @@ export class TriggerInternal { constructor(public readonly service: UiActionsService, public readonly trigger: Trigger) {} - public async execute(context: TriggerContext) { + public async execute(context: TriggerContextMapping[T]) { const triggerId = this.trigger.id; const actions = await this.service.getTriggerCompatibleActions!(triggerId, context); @@ -51,7 +51,10 @@ export class TriggerInternal { await this.executeMultipleActions(actions, context); } - private async executeSingleAction(action: Action>, context: TriggerContext) { + private async executeSingleAction( + action: Action, + context: TriggerContextMapping[T] + ) { const href = action.getHref && action.getHref(context); if (href) { @@ -63,8 +66,8 @@ export class TriggerInternal { } private async executeMultipleActions( - actions: Array>>, - context: TriggerContext + actions: Array>, + context: TriggerContextMapping[T] ) { const panel = await buildContextMenuForActions({ actions, diff --git a/src/plugins/ui_actions/public/types.ts b/src/plugins/ui_actions/public/types.ts index 8daa893eb4347..d78d3c8951222 100644 --- a/src/plugins/ui_actions/public/types.ts +++ b/src/plugins/ui_actions/public/types.ts @@ -20,12 +20,17 @@ import { Action } from './actions/action'; import { TriggerInternal } from './triggers/trigger_internal'; -export type TriggerRegistry = Map>; -export type ActionRegistry = Map; -export type TriggerToActionsRegistry = Map; +export type TriggerRegistry = Map>; +export type ActionRegistry = Map>; +export type TriggerToActionsRegistry = Map; -export type TriggerId = string; +const DEFAULT_TRIGGER = ''; + +export type TriggerId = keyof TriggerContextMapping; + +export type TriggerContext = BaseContext; +export type BaseContext = object | undefined | string | number; export interface TriggerContextMapping { - [key: string]: object; + [DEFAULT_TRIGGER]: TriggerContext; } diff --git a/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/app/app.tsx b/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/app/app.tsx index dde58eaf44f88..144954800c91f 100644 --- a/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/app/app.tsx +++ b/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/app/app.tsx @@ -23,12 +23,12 @@ import { GetEmbeddableFactory, GetEmbeddableFactories, } from 'src/legacy/core_plugins/embeddable_api/public/np_ready/public'; -import { GetActionsCompatibleWithTrigger } from '../../../../../../../../src/plugins/ui_actions/public'; +import { UiActionsService } from '../../../../../../../../src/plugins/ui_actions/public'; import { DashboardContainerExample } from './dashboard_container_example'; import { Start as InspectorStartContract } from '../../../../../../../../src/plugins/inspector/public'; export interface AppProps { - getActions: GetActionsCompatibleWithTrigger; + getActions: UiActionsService['getTriggerCompatibleActions']; getEmbeddableFactory: GetEmbeddableFactory; getAllEmbeddableFactories: GetEmbeddableFactories; overlays: CoreStart['overlays']; diff --git a/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/app/dashboard_container_example.tsx b/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/app/dashboard_container_example.tsx index 0237df63351cf..df0c00fb48b2e 100644 --- a/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/app/dashboard_container_example.tsx +++ b/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/app/dashboard_container_example.tsx @@ -35,10 +35,10 @@ import { import { CoreStart } from '../../../../../../../../src/core/public'; import { dashboardInput } from './dashboard_input'; import { Start as InspectorStartContract } from '../../../../../../../../src/plugins/inspector/public'; -import { GetActionsCompatibleWithTrigger } from '../../../../../../../../src/plugins/ui_actions/public'; +import { UiActionsService } from '../../../../../../../../src/plugins/ui_actions/public'; interface Props { - getActions: GetActionsCompatibleWithTrigger; + getActions: UiActionsService['getTriggerCompatibleActions']; getEmbeddableFactory: GetEmbeddableFactory; getAllEmbeddableFactories: GetEmbeddableFactories; overlays: CoreStart['overlays']; From 8620f437d0ca303a3652139cc5ba828855584eca Mon Sep 17 00:00:00 2001 From: Lukas Olson Date: Fri, 28 Feb 2020 10:15:09 -0700 Subject: [PATCH 15/31] [Autocomplete] Use settings from config rather than UI settings (#58784) * Update autocomplete to use settings from config rather than advanced settings * Update terrible snapshot Co-authored-by: Elastic Machine --- src/core/server/mocks.ts | 6 +++++- src/core/server/plugins/plugin_context.test.ts | 6 +++++- src/core/server/plugins/types.ts | 2 +- .../server/autocomplete/autocomplete_service.ts | 6 ++++-- src/plugins/data/server/autocomplete/routes.ts | 7 ++++--- .../autocomplete/value_suggestions_route.ts | 15 ++++++++++----- src/plugins/data/server/plugin.ts | 3 ++- 7 files changed, 31 insertions(+), 14 deletions(-) diff --git a/src/core/server/mocks.ts b/src/core/server/mocks.ts index b8380a3045962..96b28ab5827e1 100644 --- a/src/core/server/mocks.ts +++ b/src/core/server/mocks.ts @@ -44,7 +44,11 @@ import { uuidServiceMock } from './uuid/uuid_service.mock'; export function pluginInitializerContextConfigMock(config: T) { const globalConfig: SharedGlobalConfig = { - kibana: { index: '.kibana-tests' }, + kibana: { + index: '.kibana-tests', + autocompleteTerminateAfter: duration(100000), + autocompleteTimeout: duration(1000), + }, elasticsearch: { shardTimeout: duration('30s'), requestTimeout: duration('30s'), diff --git a/src/core/server/plugins/plugin_context.test.ts b/src/core/server/plugins/plugin_context.test.ts index 823299771544c..54350d96984b4 100644 --- a/src/core/server/plugins/plugin_context.test.ts +++ b/src/core/server/plugins/plugin_context.test.ts @@ -75,7 +75,11 @@ describe('Plugin Context', () => { .pipe(first()) .toPromise(); expect(configObject).toStrictEqual({ - kibana: { index: '.kibana' }, + kibana: { + index: '.kibana', + autocompleteTerminateAfter: duration(100000), + autocompleteTimeout: duration(1000), + }, elasticsearch: { shardTimeout: duration(30, 's'), requestTimeout: duration(30, 's'), diff --git a/src/core/server/plugins/types.ts b/src/core/server/plugins/types.ts index e6a04c1223e6c..100e3c2288dbf 100644 --- a/src/core/server/plugins/types.ts +++ b/src/core/server/plugins/types.ts @@ -214,7 +214,7 @@ export interface Plugin< export const SharedGlobalConfigKeys = { // We can add more if really needed - kibana: ['index'] as const, + kibana: ['index', 'autocompleteTerminateAfter', 'autocompleteTimeout'] as const, elasticsearch: ['shardTimeout', 'requestTimeout', 'pingTimeout', 'startupTimeout'] as const, path: ['data'] as const, }; diff --git a/src/plugins/data/server/autocomplete/autocomplete_service.ts b/src/plugins/data/server/autocomplete/autocomplete_service.ts index 1b85321aa2185..412e9b6236195 100644 --- a/src/plugins/data/server/autocomplete/autocomplete_service.ts +++ b/src/plugins/data/server/autocomplete/autocomplete_service.ts @@ -17,12 +17,14 @@ * under the License. */ -import { CoreSetup, Plugin } from 'kibana/server'; +import { CoreSetup, Plugin, PluginInitializerContext } from 'kibana/server'; import { registerRoutes } from './routes'; export class AutocompleteService implements Plugin { + constructor(private initializerContext: PluginInitializerContext) {} + public setup(core: CoreSetup) { - registerRoutes(core); + registerRoutes(core, this.initializerContext.config.legacy.globalConfig$); } public start() {} diff --git a/src/plugins/data/server/autocomplete/routes.ts b/src/plugins/data/server/autocomplete/routes.ts index 9134287d2b8ff..b7fd00947ce0e 100644 --- a/src/plugins/data/server/autocomplete/routes.ts +++ b/src/plugins/data/server/autocomplete/routes.ts @@ -17,11 +17,12 @@ * under the License. */ -import { CoreSetup } from 'kibana/server'; +import { Observable } from 'rxjs'; +import { CoreSetup, SharedGlobalConfig } from 'kibana/server'; import { registerValueSuggestionsRoute } from './value_suggestions_route'; -export function registerRoutes({ http }: CoreSetup): void { +export function registerRoutes({ http }: CoreSetup, config$: Observable): void { const router = http.createRouter(); - registerValueSuggestionsRoute(router); + registerValueSuggestionsRoute(router, config$); } diff --git a/src/plugins/data/server/autocomplete/value_suggestions_route.ts b/src/plugins/data/server/autocomplete/value_suggestions_route.ts index 02a5e0921fe4f..03dbd40984412 100644 --- a/src/plugins/data/server/autocomplete/value_suggestions_route.ts +++ b/src/plugins/data/server/autocomplete/value_suggestions_route.ts @@ -19,13 +19,18 @@ import { get, map } from 'lodash'; import { schema } from '@kbn/config-schema'; -import { IRouter } from 'kibana/server'; +import { IRouter, SharedGlobalConfig } from 'kibana/server'; +import { Observable } from 'rxjs'; +import { first } from 'rxjs/operators'; import { IFieldType, Filter } from '../index'; import { findIndexPatternById, getFieldByName } from '../index_patterns'; import { getRequestAbortedSignal } from '../lib'; -export function registerValueSuggestionsRoute(router: IRouter) { +export function registerValueSuggestionsRoute( + router: IRouter, + config$: Observable +) { router.post( { path: '/api/kibana/suggestions/values/{index}', @@ -47,15 +52,15 @@ export function registerValueSuggestionsRoute(router: IRouter) { }, }, async (context, request, response) => { - const { client: uiSettings } = context.core.uiSettings; + const config = await config$.pipe(first()).toPromise(); const { field: fieldName, query, boolFilter } = request.body; const { index } = request.params; const { dataClient } = context.core.elasticsearch; const signal = getRequestAbortedSignal(request.events.aborted$); const autocompleteSearchOptions = { - timeout: await uiSettings.get('kibana.autocompleteTimeout'), - terminate_after: await uiSettings.get('kibana.autocompleteTerminateAfter'), + timeout: `${config.kibana.autocompleteTimeout.asMilliseconds()}ms`, + terminate_after: config.kibana.autocompleteTerminateAfter.asMilliseconds(), }; const indexPattern = await findIndexPatternById(context.core.savedObjects.client, index); diff --git a/src/plugins/data/server/plugin.ts b/src/plugins/data/server/plugin.ts index fcd3b62b2ec67..616e65ad872ab 100644 --- a/src/plugins/data/server/plugin.ts +++ b/src/plugins/data/server/plugin.ts @@ -44,7 +44,7 @@ export class DataServerPlugin implements Plugin Date: Fri, 28 Feb 2020 13:08:37 -0500 Subject: [PATCH 16/31] [Lens] Allow number formatting within Lens (#56253) * [Lens] Allow custom number formats on dimensions * Fix merge issues * Text and decimal changes from review * Persist number format across operations * Respond to review comments * Change label * Add persistence * Fix import * 2 decimals * Persist number formatting on drop too Co-authored-by: Elastic Machine --- .../data/common/field_formats/types.ts | 1 + .../editor_frame_service/format_column.ts | 92 +++++++ .../public/editor_frame_service/service.tsx | 2 + .../dimension_panel/dimension_panel.test.tsx | 253 ++++++++++++++++-- .../dimension_panel/dimension_panel.tsx | 3 + .../dimension_panel/format_selector.tsx | 136 ++++++++++ .../dimension_panel/popover_editor.tsx | 24 +- .../indexpattern.test.ts | 2 +- .../indexpattern_datasource/indexpattern.tsx | 1 + .../operations/definitions/cardinality.tsx | 8 +- .../operations/definitions/column_types.ts | 12 + .../operations/definitions/count.tsx | 13 +- .../operations/definitions/index.ts | 3 +- .../operations/definitions/metrics.tsx | 20 +- .../operations/operations.ts | 7 +- .../state_helpers.test.ts | 41 +++ .../indexpattern_datasource/state_helpers.ts | 13 +- .../indexpattern_datasource/to_expression.ts | 17 +- 18 files changed, 600 insertions(+), 48 deletions(-) create mode 100644 x-pack/legacy/plugins/lens/public/editor_frame_service/format_column.ts create mode 100644 x-pack/legacy/plugins/lens/public/indexpattern_datasource/dimension_panel/format_selector.tsx diff --git a/src/plugins/data/common/field_formats/types.ts b/src/plugins/data/common/field_formats/types.ts index 0c16d9f1ac8bf..7c1d6a8522e52 100644 --- a/src/plugins/data/common/field_formats/types.ts +++ b/src/plugins/data/common/field_formats/types.ts @@ -87,6 +87,7 @@ export type IFieldFormatType = (new ( getConfig?: FieldFormatsGetConfigFn ) => FieldFormat) & { id: FieldFormatId; + title: string; fieldType: string | string[]; }; diff --git a/x-pack/legacy/plugins/lens/public/editor_frame_service/format_column.ts b/x-pack/legacy/plugins/lens/public/editor_frame_service/format_column.ts new file mode 100644 index 0000000000000..dfb725fef49bb --- /dev/null +++ b/x-pack/legacy/plugins/lens/public/editor_frame_service/format_column.ts @@ -0,0 +1,92 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { ExpressionFunctionDefinition, KibanaDatatable } from 'src/plugins/expressions/public'; + +interface FormatColumn { + format: string; + columnId: string; + decimals?: number; +} + +const supportedFormats: Record string }> = { + number: { + decimalsToPattern: (decimals = 2) => { + if (decimals === 0) { + return `0,0`; + } + return `0,0.${'0'.repeat(decimals)}`; + }, + }, + percent: { + decimalsToPattern: (decimals = 2) => { + if (decimals === 0) { + return `0,0%`; + } + return `0,0.${'0'.repeat(decimals)}%`; + }, + }, + bytes: { + decimalsToPattern: (decimals = 2) => { + if (decimals === 0) { + return `0,0b`; + } + return `0,0.${'0'.repeat(decimals)}b`; + }, + }, +}; + +export const formatColumn: ExpressionFunctionDefinition< + 'lens_format_column', + KibanaDatatable, + FormatColumn, + KibanaDatatable +> = { + name: 'lens_format_column', + type: 'kibana_datatable', + help: '', + args: { + format: { + types: ['string'], + help: '', + required: true, + }, + columnId: { + types: ['string'], + help: '', + required: true, + }, + decimals: { + types: ['number'], + help: '', + }, + }, + inputTypes: ['kibana_datatable'], + fn(input, { format, columnId, decimals }: FormatColumn) { + return { + ...input, + columns: input.columns.map(col => { + if (col.id === columnId) { + if (supportedFormats[format]) { + return { + ...col, + formatHint: { + id: format, + params: { pattern: supportedFormats[format].decimalsToPattern(decimals) }, + }, + }; + } else { + return { + ...col, + formatHint: { id: format, params: {} }, + }; + } + } + return col; + }), + }; + }, +}; diff --git a/x-pack/legacy/plugins/lens/public/editor_frame_service/service.tsx b/x-pack/legacy/plugins/lens/public/editor_frame_service/service.tsx index 7a0bb3a2cc50f..5347be47e145e 100644 --- a/x-pack/legacy/plugins/lens/public/editor_frame_service/service.tsx +++ b/x-pack/legacy/plugins/lens/public/editor_frame_service/service.tsx @@ -29,6 +29,7 @@ import { } from '../types'; import { EditorFrame } from './editor_frame'; import { mergeTables } from './merge_tables'; +import { formatColumn } from './format_column'; import { EmbeddableFactory } from './embeddable/embeddable_factory'; import { getActiveDatasourceIdFromDoc } from './editor_frame/state_management'; @@ -64,6 +65,7 @@ export class EditorFrameService { public setup(core: CoreSetup, plugins: EditorFrameSetupPlugins): EditorFrameSetup { plugins.expressions.registerFunction(() => mergeTables); + plugins.expressions.registerFunction(() => formatColumn); return { registerDatasource: datasource => { diff --git a/x-pack/legacy/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_panel.test.tsx b/x-pack/legacy/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_panel.test.tsx index 98cf862e1fd2b..56f75ae4b17be 100644 --- a/x-pack/legacy/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_panel.test.tsx +++ b/x-pack/legacy/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_panel.test.tsx @@ -7,7 +7,14 @@ import { ReactWrapper, ShallowWrapper } from 'enzyme'; import React from 'react'; import { act } from 'react-dom/test-utils'; -import { EuiComboBox, EuiSideNav, EuiSideNavItemType, EuiPopover } from '@elastic/eui'; +import { + EuiComboBox, + EuiSideNav, + EuiSideNavItemType, + EuiPopover, + EuiFieldNumber, +} from '@elastic/eui'; +import { DataPublicPluginStart } from '../../../../../../../src/plugins/data/public'; import { changeColumn } from '../state_helpers'; import { IndexPatternDimensionPanel, @@ -139,6 +146,18 @@ describe('IndexPatternDimensionPanel', () => { uiSettings: {} as IUiSettingsClient, savedObjectsClient: {} as SavedObjectsClientContract, http: {} as HttpSetup, + data: ({ + fieldFormats: ({ + getType: jest.fn().mockReturnValue({ + id: 'number', + title: 'Number', + }), + getDefaultType: jest.fn().mockReturnValue({ + id: 'bytes', + title: 'Bytes', + }), + } as unknown) as DataPublicPluginStart['fieldFormats'], + } as unknown) as DataPublicPluginStart, }; jest.clearAllMocks(); @@ -175,7 +194,9 @@ describe('IndexPatternDimensionPanel', () => { openPopover(); - expect(wrapper.find(EuiComboBox)).toHaveLength(1); + expect( + wrapper.find(EuiComboBox).filter('[data-test-subj="indexPattern-dimension-field"]') + ).toHaveLength(1); }); it('should not show any choices if the filter returns false', () => { @@ -189,7 +210,12 @@ describe('IndexPatternDimensionPanel', () => { openPopover(); - expect(wrapper.find(EuiComboBox)!.prop('options')!).toHaveLength(0); + expect( + wrapper + .find(EuiComboBox) + .filter('[data-test-subj="indexPattern-dimension-field"]')! + .prop('options')! + ).toHaveLength(0); }); it('should list all field names and document as a whole in prioritized order', () => { @@ -197,7 +223,10 @@ describe('IndexPatternDimensionPanel', () => { openPopover(); - const options = wrapper.find(EuiComboBox).prop('options'); + const options = wrapper + .find(EuiComboBox) + .filter('[data-test-subj="indexPattern-dimension-field"]') + .prop('options'); expect(options).toHaveLength(2); @@ -228,7 +257,10 @@ describe('IndexPatternDimensionPanel', () => { openPopover(); - const options = wrapper.find(EuiComboBox).prop('options'); + const options = wrapper + .find(EuiComboBox) + .filter('[data-test-subj="indexPattern-dimension-field"]') + .prop('options'); expect(options![1].options!.map(({ label }) => label)).toEqual(['timestamp', 'source']); }); @@ -262,7 +294,10 @@ describe('IndexPatternDimensionPanel', () => { openPopover(); - const options = wrapper.find(EuiComboBox).prop('options'); + const options = wrapper + .find(EuiComboBox) + .filter('[data-test-subj="indexPattern-dimension-field"]') + .prop('options'); expect(options![0]['data-test-subj']).toEqual('lns-fieldOptionIncompatible-Records'); @@ -335,6 +370,7 @@ describe('IndexPatternDimensionPanel', () => { // Private operationType: 'max', sourceField: 'bytes', + params: { format: { id: 'bytes' } }, }, }, }, @@ -345,7 +381,9 @@ describe('IndexPatternDimensionPanel', () => { openPopover(); - const comboBox = wrapper.find(EuiComboBox)!; + const comboBox = wrapper + .find(EuiComboBox) + .filter('[data-test-subj="indexPattern-dimension-field"]')!; const option = comboBox.prop('options')![1].options!.find(({ label }) => label === 'memory')!; act(() => { @@ -362,6 +400,7 @@ describe('IndexPatternDimensionPanel', () => { col1: expect.objectContaining({ operationType: 'max', sourceField: 'memory', + params: { format: { id: 'bytes' } }, // Other parts of this don't matter for this test }), }, @@ -375,7 +414,9 @@ describe('IndexPatternDimensionPanel', () => { openPopover(); - const comboBox = wrapper.find(EuiComboBox)!; + const comboBox = wrapper + .find(EuiComboBox) + .filter('[data-test-subj="indexPattern-dimension-field"]')!; const option = comboBox.prop('options')![1].options!.find(({ label }) => label === 'source')!; act(() => { @@ -419,6 +460,7 @@ describe('IndexPatternDimensionPanel', () => { // Private operationType: 'max', sourceField: 'bytes', + params: { format: { id: 'bytes' } }, }, }, }, @@ -443,6 +485,7 @@ describe('IndexPatternDimensionPanel', () => { col1: expect.objectContaining({ operationType: 'min', sourceField: 'bytes', + params: { format: { id: 'bytes' } }, // Other parts of this don't matter for this test }), }, @@ -565,7 +608,10 @@ describe('IndexPatternDimensionPanel', () => { .find('button[data-test-subj="lns-indexPatternDimensionIncompatible-terms"]') .simulate('click'); - const options = wrapper.find(EuiComboBox).prop('options'); + const options = wrapper + .find(EuiComboBox) + .filter('[data-test-subj="indexPattern-dimension-field"]') + .prop('options'); expect(options![0]['data-test-subj']).toContain('Incompatible'); @@ -584,7 +630,9 @@ describe('IndexPatternDimensionPanel', () => { wrapper.find('button[data-test-subj="lns-indexPatternDimension-avg"]').simulate('click'); - const comboBox = wrapper.find(EuiComboBox); + const comboBox = wrapper + .find(EuiComboBox) + .filter('[data-test-subj="indexPattern-dimension-field"]'); const options = comboBox.prop('options'); // options[1][2] is a `source` field of type `string` which doesn't support `avg` operation @@ -674,7 +722,10 @@ describe('IndexPatternDimensionPanel', () => { .find('button[data-test-subj="lns-indexPatternDimensionIncompatible-terms"]') .simulate('click'); - const options = wrapper.find(EuiComboBox).prop('options'); + const options = wrapper + .find(EuiComboBox) + .filter('[data-test-subj="indexPattern-dimension-field"]') + .prop('options'); expect(options![0]['data-test-subj']).toContain('Incompatible'); @@ -697,7 +748,9 @@ describe('IndexPatternDimensionPanel', () => { .simulate('click'); }); - const comboBox = wrapper.find(EuiComboBox)!; + const comboBox = wrapper + .find(EuiComboBox) + .filter('[data-test-subj="indexPattern-dimension-field"]')!; const option = comboBox.prop('options')![1].options!.find(({ label }) => label === 'source')!; act(() => { @@ -729,7 +782,9 @@ describe('IndexPatternDimensionPanel', () => { wrapper.find('button[data-test-subj="lns-indexPatternDimension-avg"]').simulate('click'); - const comboBox = wrapper.find(EuiComboBox); + const comboBox = wrapper + .find(EuiComboBox) + .filter('[data-test-subj="indexPattern-dimension-field"]'); const options = comboBox.prop('options'); act(() => { @@ -825,7 +880,10 @@ describe('IndexPatternDimensionPanel', () => { wrapper.find('button[data-test-subj="lns-indexPatternDimension-avg"]').simulate('click'); - const options = wrapper.find(EuiComboBox).prop('options'); + const options = wrapper + .find(EuiComboBox) + .filter('[data-test-subj="indexPattern-dimension-field"]') + .prop('options'); expect(options![0]['data-test-subj']).toContain('Incompatible'); @@ -865,7 +923,10 @@ describe('IndexPatternDimensionPanel', () => { openPopover(); - const options = wrapper.find(EuiComboBox).prop('options'); + const options = wrapper + .find(EuiComboBox) + .filter('[data-test-subj="indexPattern-dimension-field"]') + .prop('options'); expect(options![0]['data-test-subj']).not.toContain('Incompatible'); @@ -905,7 +966,9 @@ describe('IndexPatternDimensionPanel', () => { openPopover(); - const comboBox = wrapper.find(EuiComboBox)!; + const comboBox = wrapper + .find(EuiComboBox) + .filter('[data-test-subj="indexPattern-dimension-field"]')!; const option = comboBox.prop('options')![1].options![0]; act(() => { @@ -1002,7 +1065,10 @@ describe('IndexPatternDimensionPanel', () => { openPopover(); act(() => { - wrapper.find(EuiComboBox).prop('onChange')!([]); + wrapper + .find(EuiComboBox) + .filter('[data-test-subj="indexPattern-dimension-field"]') + .prop('onChange')!([]); }); expect(setState).toHaveBeenCalledWith({ @@ -1017,6 +1083,159 @@ describe('IndexPatternDimensionPanel', () => { }); }); + it('allows custom format', () => { + const stateWithNumberCol: IndexPatternPrivateState = { + ...state, + layers: { + first: { + indexPatternId: '1', + columnOrder: ['col1'], + columns: { + col1: { + label: 'Average of bar', + dataType: 'number', + isBucketed: false, + // Private + operationType: 'avg', + sourceField: 'bar', + }, + }, + }, + }, + }; + + wrapper = mount(); + + openPopover(); + + act(() => { + wrapper + .find(EuiComboBox) + .filter('[data-test-subj="indexPattern-dimension-format"]') + .prop('onChange')!([{ value: 'bytes', label: 'Bytes' }]); + }); + + expect(setState).toHaveBeenCalledWith({ + ...state, + layers: { + first: { + ...state.layers.first, + columns: { + ...state.layers.first.columns, + col1: expect.objectContaining({ + params: { + format: { id: 'bytes', params: { decimals: 2 } }, + }, + }), + }, + }, + }, + }); + }); + + it('keeps decimal places while switching', () => { + const stateWithNumberCol: IndexPatternPrivateState = { + ...state, + layers: { + first: { + indexPatternId: '1', + columnOrder: ['col1'], + columns: { + col1: { + label: 'Average of bar', + dataType: 'number', + isBucketed: false, + // Private + operationType: 'avg', + sourceField: 'bar', + params: { + format: { id: 'bytes', params: { decimals: 0 } }, + }, + }, + }, + }, + }, + }; + + wrapper = mount(); + + openPopover(); + + act(() => { + wrapper + .find(EuiComboBox) + .filter('[data-test-subj="indexPattern-dimension-format"]') + .prop('onChange')!([{ value: '', label: 'Default' }]); + }); + + act(() => { + wrapper + .find(EuiComboBox) + .filter('[data-test-subj="indexPattern-dimension-format"]') + .prop('onChange')!([{ value: 'number', label: 'Number' }]); + }); + + expect( + wrapper + .find(EuiFieldNumber) + .filter('[data-test-subj="indexPattern-dimension-formatDecimals"]') + .prop('value') + ).toEqual(0); + }); + + it('allows custom format with number of decimal places', () => { + const stateWithNumberCol: IndexPatternPrivateState = { + ...state, + layers: { + first: { + indexPatternId: '1', + columnOrder: ['col1'], + columns: { + col1: { + label: 'Average of bar', + dataType: 'number', + isBucketed: false, + // Private + operationType: 'avg', + sourceField: 'bar', + params: { + format: { id: 'bytes', params: { decimals: 2 } }, + }, + }, + }, + }, + }, + }; + + wrapper = mount(); + + openPopover(); + + act(() => { + wrapper + .find(EuiFieldNumber) + .filter('[data-test-subj="indexPattern-dimension-formatDecimals"]') + .prop('onChange')!({ target: { value: '0' } }); + }); + + expect(setState).toHaveBeenCalledWith({ + ...state, + layers: { + first: { + ...state.layers.first, + columns: { + ...state.layers.first.columns, + col1: expect.objectContaining({ + params: { + format: { id: 'bytes', params: { decimals: 0 } }, + }, + }), + }, + }, + }, + }); + }); + describe('drag and drop', () => { function dragDropState(): IndexPatternPrivateState { return { diff --git a/x-pack/legacy/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_panel.tsx b/x-pack/legacy/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_panel.tsx index 972c396f93b43..59350ff215c27 100644 --- a/x-pack/legacy/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_panel.tsx +++ b/x-pack/legacy/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_panel.tsx @@ -10,6 +10,7 @@ import { EuiButtonIcon } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { IUiSettingsClient, SavedObjectsClientContract, HttpSetup } from 'src/core/public'; import { IStorageWrapper } from 'src/plugins/kibana_utils/public'; +import { DataPublicPluginStart } from '../../../../../../../src/plugins/data/public'; import { DatasourceDimensionPanelProps, StateSetter } from '../../types'; import { IndexPatternColumn, OperationType } from '../indexpattern'; import { getAvailableOperationsByMetadata, buildColumn, changeField } from '../operations'; @@ -30,6 +31,7 @@ export type IndexPatternDimensionPanelProps = DatasourceDimensionPanelProps & { savedObjectsClient: SavedObjectsClientContract; layerId: string; http: HttpSetup; + data: DataPublicPluginStart; uniqueLabel: string; dateRange: DateRange; }; @@ -128,6 +130,7 @@ export const IndexPatternDimensionPanelComponent = function IndexPatternDimensio layerId, suggestedPriority: props.suggestedPriority, field: droppedItem.field, + previousColumn: selectedColumn, }); trackUiEvent('drop_onto_dimension'); diff --git a/x-pack/legacy/plugins/lens/public/indexpattern_datasource/dimension_panel/format_selector.tsx b/x-pack/legacy/plugins/lens/public/indexpattern_datasource/dimension_panel/format_selector.tsx new file mode 100644 index 0000000000000..ed68a93c51ca2 --- /dev/null +++ b/x-pack/legacy/plugins/lens/public/indexpattern_datasource/dimension_panel/format_selector.tsx @@ -0,0 +1,136 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import React, { useState } from 'react'; +import { i18n } from '@kbn/i18n'; +import { EuiFormRow, EuiFieldNumber, EuiComboBox } from '@elastic/eui'; +import { IndexPatternColumn } from '../indexpattern'; + +const supportedFormats: Record = { + number: { + title: i18n.translate('xpack.lens.indexPattern.numberFormatLabel', { + defaultMessage: 'Number', + }), + }, + percent: { + title: i18n.translate('xpack.lens.indexPattern.percentFormatLabel', { + defaultMessage: 'Percent', + }), + }, + bytes: { + title: i18n.translate('xpack.lens.indexPattern.bytesFormatLabel', { + defaultMessage: 'Bytes (1024)', + }), + }, +}; + +interface FormatSelectorProps { + selectedColumn: IndexPatternColumn; + onChange: (newFormat?: { id: string; params?: Record }) => void; +} + +interface State { + decimalPlaces: number; +} + +export function FormatSelector(props: FormatSelectorProps) { + const { selectedColumn, onChange } = props; + + const currentFormat = + 'params' in selectedColumn && selectedColumn.params && 'format' in selectedColumn.params + ? selectedColumn.params.format + : undefined; + const [state, setState] = useState({ + decimalPlaces: + typeof currentFormat?.params?.decimals === 'number' ? currentFormat.params.decimals : 2, + }); + + const selectedFormat = currentFormat?.id ? supportedFormats[currentFormat.id] : undefined; + + const defaultOption = { + value: '', + label: i18n.translate('xpack.lens.indexPattern.defaultFormatLabel', { + defaultMessage: 'Default', + }), + }; + + return ( + <> + + ({ + value: id, + label: format.title ?? id, + })), + ]} + selectedOptions={ + currentFormat + ? [ + { + value: currentFormat.id, + label: selectedFormat?.title ?? currentFormat.id, + }, + ] + : [defaultOption] + } + onChange={choices => { + if (choices.length === 0) { + return; + } + + if (!choices[0].value) { + onChange(); + return; + } + onChange({ + id: choices[0].value, + params: { decimals: state.decimalPlaces }, + }); + }} + /> + + + {currentFormat ? ( + + { + setState({ decimalPlaces: Number(e.target.value) }); + onChange({ + id: (selectedColumn.params as { format: { id: string } }).format.id, + params: { + decimals: Number(e.target.value), + }, + }); + }} + compressed + fullWidth + /> + + ) : null} + + ); +} diff --git a/x-pack/legacy/plugins/lens/public/indexpattern_datasource/dimension_panel/popover_editor.tsx b/x-pack/legacy/plugins/lens/public/indexpattern_datasource/dimension_panel/popover_editor.tsx index 98773c04db4a6..ec2acd73cc1ce 100644 --- a/x-pack/legacy/plugins/lens/public/indexpattern_datasource/dimension_panel/popover_editor.tsx +++ b/x-pack/legacy/plugins/lens/public/indexpattern_datasource/dimension_panel/popover_editor.tsx @@ -29,12 +29,13 @@ import { buildColumn, changeField, } from '../operations'; -import { deleteColumn, changeColumn } from '../state_helpers'; +import { deleteColumn, changeColumn, updateColumnParam } from '../state_helpers'; import { FieldSelect } from './field_select'; import { hasField } from '../utils'; import { BucketNestingEditor } from './bucket_nesting_editor'; import { IndexPattern, IndexPatternField } from '../types'; import { trackUiEvent } from '../../lens_ui_telemetry'; +import { FormatSelector } from './format_selector'; const operationPanels = getOperationDisplay(); @@ -143,6 +144,7 @@ export function PopoverEditor(props: PopoverEditorProps) { op: operationType, indexPattern: currentIndexPattern, field: fieldMap[possibleFields[0]], + previousColumn: selectedColumn, }), }) ); @@ -165,7 +167,9 @@ export function PopoverEditor(props: PopoverEditorProps) { op: operationType, indexPattern: currentIndexPattern, field: fieldMap[selectedColumn.sourceField], + previousColumn: selectedColumn, }); + trackUiEvent( `indexpattern_dimension_operation_from_${selectedColumn.operationType}_to_${operationType}` ); @@ -293,6 +297,7 @@ export function PopoverEditor(props: PopoverEditorProps) { layerId: props.layerId, suggestedPriority: props.suggestedPriority, op: operation as OperationType, + previousColumn: selectedColumn, }); } @@ -400,6 +405,23 @@ export function PopoverEditor(props: PopoverEditorProps) { }} /> )} + + {selectedColumn && selectedColumn.dataType === 'number' ? ( + { + setState( + updateColumnParam({ + state, + layerId, + currentColumn: selectedColumn, + paramName: 'format', + value: newFormat, + }) + ); + }} + /> + ) : null} diff --git a/x-pack/legacy/plugins/lens/public/indexpattern_datasource/indexpattern.test.ts b/x-pack/legacy/plugins/lens/public/indexpattern_datasource/indexpattern.test.ts index 41be22f2c72ed..25121eec30f2a 100644 --- a/x-pack/legacy/plugins/lens/public/indexpattern_datasource/indexpattern.test.ts +++ b/x-pack/legacy/plugins/lens/public/indexpattern_datasource/indexpattern.test.ts @@ -264,7 +264,7 @@ describe('IndexPattern Data Source', () => { metricsAtAllLevels=false partialRows=false includeFormatHints=true - aggConfigs={lens_auto_date aggConfigs='[{\\"id\\":\\"col1\\",\\"enabled\\":true,\\"type\\":\\"count\\",\\"schema\\":\\"metric\\",\\"params\\":{}},{\\"id\\":\\"col2\\",\\"enabled\\":true,\\"type\\":\\"date_histogram\\",\\"schema\\":\\"segment\\",\\"params\\":{\\"field\\":\\"timestamp\\",\\"useNormalizedEsInterval\\":true,\\"interval\\":\\"1d\\",\\"drop_partials\\":false,\\"min_doc_count\\":0,\\"extended_bounds\\":{}}}]'} | lens_rename_columns idMap='{\\"col-0-col1\\":{\\"label\\":\\"Count of records\\",\\"dataType\\":\\"number\\",\\"isBucketed\\":false,\\"sourceField\\":\\"Records\\",\\"operationType\\":\\"count\\",\\"id\\":\\"col1\\"},\\"col-1-col2\\":{\\"label\\":\\"Date\\",\\"dataType\\":\\"date\\",\\"isBucketed\\":true,\\"operationType\\":\\"date_histogram\\",\\"sourceField\\":\\"timestamp\\",\\"params\\":{\\"interval\\":\\"1d\\"},\\"id\\":\\"col2\\"}}'" + aggConfigs={lens_auto_date aggConfigs='[{\\"id\\":\\"col1\\",\\"enabled\\":true,\\"type\\":\\"count\\",\\"schema\\":\\"metric\\",\\"params\\":{}},{\\"id\\":\\"col2\\",\\"enabled\\":true,\\"type\\":\\"date_histogram\\",\\"schema\\":\\"segment\\",\\"params\\":{\\"field\\":\\"timestamp\\",\\"useNormalizedEsInterval\\":true,\\"interval\\":\\"1d\\",\\"drop_partials\\":false,\\"min_doc_count\\":0,\\"extended_bounds\\":{}}}]'} | lens_rename_columns idMap='{\\"col-0-col1\\":{\\"label\\":\\"Count of records\\",\\"dataType\\":\\"number\\",\\"isBucketed\\":false,\\"sourceField\\":\\"Records\\",\\"operationType\\":\\"count\\",\\"id\\":\\"col1\\"},\\"col-1-col2\\":{\\"label\\":\\"Date\\",\\"dataType\\":\\"date\\",\\"isBucketed\\":true,\\"operationType\\":\\"date_histogram\\",\\"sourceField\\":\\"timestamp\\",\\"params\\":{\\"interval\\":\\"1d\\"},\\"id\\":\\"col2\\"}}' " `); }); }); diff --git a/x-pack/legacy/plugins/lens/public/indexpattern_datasource/indexpattern.tsx b/x-pack/legacy/plugins/lens/public/indexpattern_datasource/indexpattern.tsx index afb88d1af7951..00f52d6a1747f 100644 --- a/x-pack/legacy/plugins/lens/public/indexpattern_datasource/indexpattern.tsx +++ b/x-pack/legacy/plugins/lens/public/indexpattern_datasource/indexpattern.tsx @@ -239,6 +239,7 @@ export function getIndexPatternDatasource({ savedObjectsClient={core.savedObjects.client} layerId={props.layerId} http={core.http} + data={data} uniqueLabel={columnLabelMap[props.columnId]} dateRange={dateRange} {...props} diff --git a/x-pack/legacy/plugins/lens/public/indexpattern_datasource/operations/definitions/cardinality.tsx b/x-pack/legacy/plugins/lens/public/indexpattern_datasource/operations/definitions/cardinality.tsx index 3e591c8754651..33325016deaeb 100644 --- a/x-pack/legacy/plugins/lens/public/indexpattern_datasource/operations/definitions/cardinality.tsx +++ b/x-pack/legacy/plugins/lens/public/indexpattern_datasource/operations/definitions/cardinality.tsx @@ -6,7 +6,7 @@ import { i18n } from '@kbn/i18n'; import { OperationDefinition } from '.'; -import { FieldBasedIndexPatternColumn } from './column_types'; +import { FormattedIndexPatternColumn } from './column_types'; const supportedTypes = new Set(['string', 'boolean', 'number', 'ip', 'date']); @@ -21,7 +21,7 @@ function ofName(name: string) { }); } -export interface CardinalityIndexPatternColumn extends FieldBasedIndexPatternColumn { +export interface CardinalityIndexPatternColumn extends FormattedIndexPatternColumn { operationType: 'cardinality'; } @@ -49,7 +49,7 @@ export const cardinalityOperation: OperationDefinition ({ diff --git a/x-pack/legacy/plugins/lens/public/indexpattern_datasource/operations/definitions/column_types.ts b/x-pack/legacy/plugins/lens/public/indexpattern_datasource/operations/definitions/column_types.ts index fe8a3d34d1c1c..639e982142f57 100644 --- a/x-pack/legacy/plugins/lens/public/indexpattern_datasource/operations/definitions/column_types.ts +++ b/x-pack/legacy/plugins/lens/public/indexpattern_datasource/operations/definitions/column_types.ts @@ -18,6 +18,18 @@ export interface BaseIndexPatternColumn extends Operation { suggestedPriority?: DimensionPriority; } +// Formatting can optionally be added to any column +export interface FormattedIndexPatternColumn extends BaseIndexPatternColumn { + params?: { + format: { + id: string; + params?: { + decimals: number; + }; + }; + }; +} + /** * Base type for a column that doesn't have additional parameter. * diff --git a/x-pack/legacy/plugins/lens/public/indexpattern_datasource/operations/definitions/count.tsx b/x-pack/legacy/plugins/lens/public/indexpattern_datasource/operations/definitions/count.tsx index d86e688fca013..1592b1049f666 100644 --- a/x-pack/legacy/plugins/lens/public/indexpattern_datasource/operations/definitions/count.tsx +++ b/x-pack/legacy/plugins/lens/public/indexpattern_datasource/operations/definitions/count.tsx @@ -6,17 +6,16 @@ import { i18n } from '@kbn/i18n'; import { OperationDefinition } from '.'; -import { ParameterlessIndexPatternColumn, BaseIndexPatternColumn } from './column_types'; +import { FormattedIndexPatternColumn } from './column_types'; import { IndexPatternField } from '../../types'; const countLabel = i18n.translate('xpack.lens.indexPattern.countOf', { defaultMessage: 'Count of records', }); -export type CountIndexPatternColumn = ParameterlessIndexPatternColumn< - 'count', - BaseIndexPatternColumn ->; +export type CountIndexPatternColumn = FormattedIndexPatternColumn & { + operationType: 'count'; +}; export const countOperation: OperationDefinition = { type: 'count', @@ -40,7 +39,7 @@ export const countOperation: OperationDefinition = { }; } }, - buildColumn({ suggestedPriority, field }) { + buildColumn({ suggestedPriority, field, previousColumn }) { return { label: countLabel, dataType: 'number', @@ -49,6 +48,8 @@ export const countOperation: OperationDefinition = { isBucketed: false, scale: 'ratio', sourceField: field.name, + params: + previousColumn && previousColumn.dataType === 'number' ? previousColumn.params : undefined, }; }, toEsAggsConfig: (column, columnId) => ({ diff --git a/x-pack/legacy/plugins/lens/public/indexpattern_datasource/operations/definitions/index.ts b/x-pack/legacy/plugins/lens/public/indexpattern_datasource/operations/definitions/index.ts index f357038be41a4..cbced3bfc8709 100644 --- a/x-pack/legacy/plugins/lens/public/indexpattern_datasource/operations/definitions/index.ts +++ b/x-pack/legacy/plugins/lens/public/indexpattern_datasource/operations/definitions/index.ts @@ -117,6 +117,7 @@ interface FieldBasedOperationDefinition buildColumn: ( arg: BaseBuildColumnArgs & { field: IndexPatternField; + previousColumn?: C; } ) => C; /** @@ -169,7 +170,7 @@ export type OperationType = typeof internalOperationDefinitions[number]['type']; /** * This is an operation definition of an unspecified column out of all possible - * column types. It + * column types. */ export type GenericOperationDefinition = FieldBasedOperationDefinition; diff --git a/x-pack/legacy/plugins/lens/public/indexpattern_datasource/operations/definitions/metrics.tsx b/x-pack/legacy/plugins/lens/public/indexpattern_datasource/operations/definitions/metrics.tsx index 09bb427d9559c..c2d9478c6ea15 100644 --- a/x-pack/legacy/plugins/lens/public/indexpattern_datasource/operations/definitions/metrics.tsx +++ b/x-pack/legacy/plugins/lens/public/indexpattern_datasource/operations/definitions/metrics.tsx @@ -6,9 +6,13 @@ import { i18n } from '@kbn/i18n'; import { OperationDefinition } from '.'; -import { ParameterlessIndexPatternColumn } from './column_types'; +import { FormattedIndexPatternColumn } from './column_types'; -function buildMetricOperation>({ +type MetricColumn = FormattedIndexPatternColumn & { + operationType: T; +}; + +function buildMetricOperation>({ type, displayName, ofName, @@ -46,7 +50,7 @@ function buildMetricOperation> (!newField.aggregationRestrictions || newField.aggregationRestrictions![type]) ); }, - buildColumn: ({ suggestedPriority, field }) => ({ + buildColumn: ({ suggestedPriority, field, previousColumn }) => ({ label: ofName(field.name), dataType: 'number', operationType: type, @@ -54,6 +58,8 @@ function buildMetricOperation> sourceField: field.name, isBucketed: false, scale: 'ratio', + params: + previousColumn && previousColumn.dataType === 'number' ? previousColumn.params : undefined, }), onFieldChange: (oldColumn, indexPattern, field) => { return { @@ -75,10 +81,10 @@ function buildMetricOperation> } as OperationDefinition; } -export type SumIndexPatternColumn = ParameterlessIndexPatternColumn<'sum'>; -export type AvgIndexPatternColumn = ParameterlessIndexPatternColumn<'avg'>; -export type MinIndexPatternColumn = ParameterlessIndexPatternColumn<'min'>; -export type MaxIndexPatternColumn = ParameterlessIndexPatternColumn<'max'>; +export type SumIndexPatternColumn = MetricColumn<'sum'>; +export type AvgIndexPatternColumn = MetricColumn<'avg'>; +export type MinIndexPatternColumn = MetricColumn<'min'>; +export type MaxIndexPatternColumn = MetricColumn<'max'>; export const minOperation = buildMetricOperation({ type: 'min', diff --git a/x-pack/legacy/plugins/lens/public/indexpattern_datasource/operations/operations.ts b/x-pack/legacy/plugins/lens/public/indexpattern_datasource/operations/operations.ts index ecd0942eef7b4..ce8ea55c445dc 100644 --- a/x-pack/legacy/plugins/lens/public/indexpattern_datasource/operations/operations.ts +++ b/x-pack/legacy/plugins/lens/public/indexpattern_datasource/operations/operations.ts @@ -202,6 +202,7 @@ export function buildColumn({ layerId, indexPattern, suggestedPriority, + previousColumn, }: { op?: OperationType; columns: Partial>; @@ -209,6 +210,7 @@ export function buildColumn({ layerId: string; indexPattern: IndexPattern; field: IndexPatternField; + previousColumn?: IndexPatternColumn; }): IndexPatternColumn { let operationDefinition: GenericOperationDefinition | undefined; @@ -229,16 +231,19 @@ export function buildColumn({ suggestedPriority, layerId, indexPattern, + previousColumn, }; if (!field) { throw new Error(`Invariant error: ${operationDefinition.type} operation requires field`); } - return operationDefinition.buildColumn({ + const newColumn = operationDefinition.buildColumn({ ...baseOptions, field, }); + + return newColumn; } export { operationDefinitionMap } from './definitions'; diff --git a/x-pack/legacy/plugins/lens/public/indexpattern_datasource/state_helpers.test.ts b/x-pack/legacy/plugins/lens/public/indexpattern_datasource/state_helpers.test.ts index 28486c8201da0..0a58853f1ef4f 100644 --- a/x-pack/legacy/plugins/lens/public/indexpattern_datasource/state_helpers.test.ts +++ b/x-pack/legacy/plugins/lens/public/indexpattern_datasource/state_helpers.test.ts @@ -173,6 +173,47 @@ describe('state_helpers', () => { params: { interval: 'M' }, }); }); + + it('should set optional params', () => { + const currentColumn: AvgIndexPatternColumn = { + label: 'Avg of bytes', + dataType: 'number', + isBucketed: false, + // Private + operationType: 'avg', + sourceField: 'bytes', + }; + + const state: IndexPatternPrivateState = { + indexPatternRefs: [], + existingFields: {}, + indexPatterns: {}, + currentIndexPatternId: '1', + showEmptyFields: false, + layers: { + first: { + indexPatternId: '1', + columnOrder: ['col1'], + columns: { + col1: currentColumn, + }, + }, + }, + }; + + expect( + updateColumnParam({ + state, + layerId: 'first', + currentColumn, + paramName: 'format', + value: { id: 'bytes' }, + }).layers.first.columns.col1 + ).toEqual({ + ...currentColumn, + params: { format: { id: 'bytes' } }, + }); + }); }); describe('changeColumn', () => { diff --git a/x-pack/legacy/plugins/lens/public/indexpattern_datasource/state_helpers.ts b/x-pack/legacy/plugins/lens/public/indexpattern_datasource/state_helpers.ts index f56f8089ea586..a2d64e8f2eb8f 100644 --- a/x-pack/legacy/plugins/lens/public/indexpattern_datasource/state_helpers.ts +++ b/x-pack/legacy/plugins/lens/public/indexpattern_datasource/state_helpers.ts @@ -9,10 +9,7 @@ import { isColumnTransferable } from './operations'; import { operationDefinitionMap, IndexPatternColumn } from './operations'; import { IndexPattern, IndexPatternPrivateState, IndexPatternLayer } from './types'; -export function updateColumnParam< - C extends IndexPatternColumn & { params: object }, - K extends keyof C['params'] ->({ +export function updateColumnParam({ state, layerId, currentColumn, @@ -22,17 +19,13 @@ export function updateColumnParam< state: IndexPatternPrivateState; layerId: string; currentColumn: C; - paramName: K; - value: C['params'][K]; + paramName: string; + value: unknown; }): IndexPatternPrivateState { const columnId = Object.entries(state.layers[layerId].columns).find( ([_columnId, column]) => column === currentColumn )![0]; - if (!('params' in state.layers[layerId].columns[columnId])) { - throw new Error('Invariant: no params in this column'); - } - return { ...state, layers: { diff --git a/x-pack/legacy/plugins/lens/public/indexpattern_datasource/to_expression.ts b/x-pack/legacy/plugins/lens/public/indexpattern_datasource/to_expression.ts index 96006ae6b6ed1..3747deaa6059b 100644 --- a/x-pack/legacy/plugins/lens/public/indexpattern_datasource/to_expression.ts +++ b/x-pack/legacy/plugins/lens/public/indexpattern_datasource/to_expression.ts @@ -40,6 +40,21 @@ function getExpressionForLayer( }; }, {} as Record); + const formatterOverrides = columnEntries + .map(([id, col]) => { + const format = col.params && 'format' in col.params ? col.params.format : undefined; + if (!format) { + return null; + } + const base = `| lens_format_column format="${format.id}" columnId="${id}"`; + if (typeof format.params?.decimals === 'number') { + return base + ` decimals=${format.params.decimals}`; + } + return base; + }) + .filter(expr => !!expr) + .join(' '); + return `esaggs index="${indexPattern.id}" metricsAtAllLevels=false @@ -47,7 +62,7 @@ function getExpressionForLayer( includeFormatHints=true aggConfigs={lens_auto_date aggConfigs='${JSON.stringify( aggs - )}'} | lens_rename_columns idMap='${JSON.stringify(idMap)}'`; + )}'} | lens_rename_columns idMap='${JSON.stringify(idMap)}' ${formatterOverrides}`; } return null; From 621fb6606cfa5064dac9cfb586ed47f090fbe67c Mon Sep 17 00:00:00 2001 From: Luke Elmers Date: Fri, 28 Feb 2020 11:15:43 -0700 Subject: [PATCH 17/31] [resubmit] Prep agg types for new platform (#58893) --- packages/kbn-utility-types/README.md | 1 + packages/kbn-utility-types/index.ts | 2 +- .../actions/filters/brush_event.test.ts | 49 +- src/legacy/core_plugins/data/public/index.ts | 12 +- src/legacy/core_plugins/data/public/plugin.ts | 6 +- .../public/search/aggs/agg_config.test.ts | 497 +++++++++++++++++ .../data/public/search/aggs/agg_config.ts | 61 +-- .../public/search/aggs/agg_configs.test.ts | 503 ++++++++++++++++++ .../data/public/search/aggs/agg_configs.ts | 76 ++- .../public/search/aggs/agg_params.test.ts | 2 - .../data/public/search/aggs/agg_type.test.ts | 16 +- .../data/public/search/aggs/agg_type.ts | 5 +- .../search/aggs/agg_types_registry.test.ts | 91 ++++ .../public/search/aggs/agg_types_registry.ts | 68 +++ .../search/aggs/buckets/_bucket_agg_type.ts | 12 +- .../search/aggs/buckets/_interval_options.ts | 1 + .../create_filter/date_histogram.test.ts | 12 +- .../buckets/create_filter/date_range.test.ts | 7 +- .../buckets/create_filter/filters.test.ts | 13 +- .../buckets/create_filter/histogram.test.ts | 12 +- .../buckets/create_filter/ip_range.test.ts | 11 +- .../aggs/buckets/create_filter/range.test.ts | 12 +- .../aggs/buckets/create_filter/terms.test.ts | 11 +- .../search/aggs/buckets/date_histogram.ts | 8 +- .../search/aggs/buckets/date_range.test.ts | 25 +- .../public/search/aggs/buckets/date_range.ts | 12 +- .../data/public/search/aggs/buckets/filter.ts | 1 + .../public/search/aggs/buckets/filters.ts | 26 +- .../search/aggs/buckets/geo_hash.test.ts | 7 +- .../public/search/aggs/buckets/geo_tile.ts | 3 +- .../search/aggs/buckets/histogram.test.ts | 33 +- .../public/search/aggs/buckets/histogram.ts | 12 +- .../public/search/aggs/buckets/ip_range.ts | 12 +- .../buckets/migrate_include_exclude_format.ts | 4 +- .../public/search/aggs/buckets/range.test.ts | 12 +- .../aggs/buckets/significant_terms.test.ts | 9 +- .../public/search/aggs/buckets/terms.test.ts | 8 +- .../aggs/filter/agg_type_filters.test.ts | 5 +- .../search/aggs/filter/agg_type_filters.ts | 1 + .../search/aggs/filter/prop_filter.test.ts | 19 +- .../data/public/search/aggs/index.test.ts | 2 - .../data/public/search/aggs/index.ts | 9 +- .../public/search/aggs/metrics/bucket_avg.ts | 1 - .../public/search/aggs/metrics/bucket_max.ts | 1 - .../public/search/aggs/metrics/bucket_min.ts | 1 + .../public/search/aggs/metrics/cardinality.ts | 5 +- .../data/public/search/aggs/metrics/count.ts | 7 +- .../lib/get_response_agg_config_class.ts | 1 + .../metrics/lib/parent_pipeline_agg_helper.ts | 1 - .../lib/sibling_pipeline_agg_helper.ts | 1 - .../public/search/aggs/metrics/median.test.ts | 7 +- .../data/public/search/aggs/metrics/median.ts | 4 +- .../search/aggs/metrics/metric_agg_type.ts | 7 +- .../data/public/search/aggs/metrics/min.ts | 1 + .../aggs/metrics/parent_pipeline.test.ts | 18 +- .../aggs/metrics/percentile_ranks.test.ts | 8 +- .../search/aggs/metrics/percentile_ranks.ts | 7 +- .../search/aggs/metrics/percentiles.test.ts | 6 +- .../public/search/aggs/metrics/percentiles.ts | 4 - .../aggs/metrics/sibling_pipeline.test.ts | 22 +- .../search/aggs/metrics/std_deviation.test.ts | 6 +- .../search/aggs/metrics/top_hit.test.ts | 6 +- .../public/search/aggs/param_types/agg.ts | 4 +- .../public/search/aggs/param_types/base.ts | 4 +- .../search/aggs/param_types/field.test.ts | 2 - .../public/search/aggs/param_types/field.ts | 5 +- .../param_types/filter/field_filters.test.ts | 11 +- .../aggs/param_types/filter/field_filters.ts | 8 +- .../search/aggs/param_types/json.test.ts | 8 +- .../public/search/aggs/param_types/json.ts | 4 +- .../search/aggs/param_types/optioned.test.ts | 2 - .../search/aggs/param_types/optioned.ts | 6 +- .../search/aggs/param_types/string.test.ts | 8 +- .../public/search/aggs/param_types/string.ts | 4 +- .../public/search/aggs/test_helpers/index.ts} | 4 +- .../test_helpers/mock_agg_types_registry.ts | 57 ++ .../aggs/test_helpers/mock_data_services.ts | 54 ++ .../data/public/search/aggs/types.ts | 2 +- .../data/public/search/aggs/utils.test.tsx | 2 - .../data/public/search/aggs/utils.ts | 39 +- .../data/public/search/expressions/esaggs.ts | 4 +- .../data/public/search/expressions/utils.ts | 5 +- .../core_plugins/data/public/search/mocks.ts | 85 +++ .../data/public/search/search_service.ts | 60 ++- .../data/public/search/tabify/buckets.test.ts | 2 - .../public/search/tabify/get_columns.test.ts | 22 +- .../search/tabify/response_writer.test.ts | 20 +- .../data/public/search/tabify/tabify.test.ts | 16 +- .../brush_event.test.mocks.ts => services.ts} | 13 +- .../components/sidebar/state/reducers.ts | 18 +- .../public/legacy_imports.ts | 2 +- .../public/table_vis_controller.test.ts | 4 +- .../visualizations/public/legacy_imports.ts | 2 +- .../public/np_ready/public/vis_impl.js | 6 +- src/legacy/ui/public/agg_types/index.ts | 9 +- .../ui/public/vis/__tests__/_agg_config.js | 485 ----------------- .../ui/public/vis/__tests__/_agg_configs.js | 420 --------------- .../data/common/field_formats/mocks.ts | 49 ++ src/plugins/data/public/mocks.ts | 28 +- .../data/public/search/search_source/mocks.ts | 19 - .../editor_frame_service/service.test.tsx | 4 - 101 files changed, 1958 insertions(+), 1341 deletions(-) create mode 100644 src/legacy/core_plugins/data/public/search/aggs/agg_config.test.ts create mode 100644 src/legacy/core_plugins/data/public/search/aggs/agg_configs.test.ts create mode 100644 src/legacy/core_plugins/data/public/search/aggs/agg_types_registry.test.ts create mode 100644 src/legacy/core_plugins/data/public/search/aggs/agg_types_registry.ts rename src/legacy/{ui/public/vis/__tests__/index.js => core_plugins/data/public/search/aggs/test_helpers/index.ts} (86%) create mode 100644 src/legacy/core_plugins/data/public/search/aggs/test_helpers/mock_agg_types_registry.ts create mode 100644 src/legacy/core_plugins/data/public/search/aggs/test_helpers/mock_data_services.ts create mode 100644 src/legacy/core_plugins/data/public/search/mocks.ts rename src/legacy/core_plugins/data/public/{actions/filters/brush_event.test.mocks.ts => services.ts} (76%) delete mode 100644 src/legacy/ui/public/vis/__tests__/_agg_config.js delete mode 100644 src/legacy/ui/public/vis/__tests__/_agg_configs.js create mode 100644 src/plugins/data/common/field_formats/mocks.ts diff --git a/packages/kbn-utility-types/README.md b/packages/kbn-utility-types/README.md index 829fd21e14366..b57e98e379707 100644 --- a/packages/kbn-utility-types/README.md +++ b/packages/kbn-utility-types/README.md @@ -18,6 +18,7 @@ type B = UnwrapPromise; // string ## Reference +- `Assign` — From `U` assign properties to `T` (just like object assign). - `Ensure` — Makes sure `T` is of type `X`. - `ObservableLike` — Minimal interface for an object resembling an `Observable`. - `PublicContract` — Returns an object with public keys only. diff --git a/packages/kbn-utility-types/index.ts b/packages/kbn-utility-types/index.ts index 808935ed4cb5b..657d9f547de66 100644 --- a/packages/kbn-utility-types/index.ts +++ b/packages/kbn-utility-types/index.ts @@ -18,7 +18,7 @@ */ import { PromiseType } from 'utility-types'; -export { $Values, Required, Optional, Class } from 'utility-types'; +export { $Values, Assign, Class, Optional, Required } from 'utility-types'; /** * A type that may or may not be a `Promise`. diff --git a/src/legacy/core_plugins/data/public/actions/filters/brush_event.test.ts b/src/legacy/core_plugins/data/public/actions/filters/brush_event.test.ts index 0e18c7c707fa3..eb29530f92fee 100644 --- a/src/legacy/core_plugins/data/public/actions/filters/brush_event.test.ts +++ b/src/legacy/core_plugins/data/public/actions/filters/brush_event.test.ts @@ -19,34 +19,14 @@ import moment from 'moment'; -jest.mock('../../search/aggs', () => ({ - AggConfigs: function AggConfigs() { - return { - createAggConfig: ({ params }: Record) => ({ - params, - getIndexPattern: () => ({ - timeFieldName: 'time', - }), - }), - }; - }, -})); - -jest.mock('../../../../../../plugins/data/public/services', () => ({ - getIndexPatterns: () => { - return { - get: async () => { - return { - id: 'logstash-*', - timeFieldName: 'time', - }; - }, - }; - }, -})); - import { onBrushEvent, BrushEvent } from './brush_event'; +import { mockDataServices } from '../../search/aggs/test_helpers'; +import { IndexPatternsContract } from '../../../../../../plugins/data/public'; +import { dataPluginMock } from '../../../../../../plugins/data/public/mocks'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { setIndexPatterns } from '../../../../../../plugins/data/public/services'; + describe('brushEvent', () => { const DAY_IN_MS = 24 * 60 * 60 * 1000; const JAN_01_2014 = 1388559600000; @@ -59,11 +39,28 @@ describe('brushEvent', () => { }, getIndexPattern: () => ({ timeFieldName: 'time', + fields: { + getByName: () => undefined, + filter: () => [], + }, }), }, ]; beforeEach(() => { + mockDataServices(); + setIndexPatterns(({ + ...dataPluginMock.createStartContract().indexPatterns, + get: async () => ({ + id: 'indexPatternId', + timeFieldName: 'time', + fields: { + getByName: () => undefined, + filter: () => [], + }, + }), + } as unknown) as IndexPatternsContract); + baseEvent = { data: { ordered: { diff --git a/src/legacy/core_plugins/data/public/index.ts b/src/legacy/core_plugins/data/public/index.ts index 8cde5d0a1fc11..8d730d18a1755 100644 --- a/src/legacy/core_plugins/data/public/index.ts +++ b/src/legacy/core_plugins/data/public/index.ts @@ -35,18 +35,18 @@ export { } from '../../../../plugins/data/public'; export { // agg_types - AggParam, - AggParamOption, - DateRangeKey, + AggParam, // only the type is used externally, only in vis editor + AggParamOption, // only the type is used externally + DateRangeKey, // only used in field formatter deserialization, which will live in data IAggConfig, IAggConfigs, IAggType, IFieldParamType, IMetricAggType, - IpRangeKey, + IpRangeKey, // only used in field formatter deserialization, which will live in data ISchemas, - OptionedParamEditorProps, - OptionedValueProp, + OptionedParamEditorProps, // only type is used externally + OptionedValueProp, // only type is used externally } from './search/types'; /** @public static code */ diff --git a/src/legacy/core_plugins/data/public/plugin.ts b/src/legacy/core_plugins/data/public/plugin.ts index e13e8e34eaebe..e2b8ca5dda78c 100644 --- a/src/legacy/core_plugins/data/public/plugin.ts +++ b/src/legacy/core_plugins/data/public/plugin.ts @@ -36,6 +36,7 @@ import { setOverlays, // eslint-disable-next-line @kbn/eslint/no-restricted-paths } from '../../../../plugins/data/public/services'; +import { setSearchServiceShim } from './services'; import { SELECT_RANGE_ACTION, selectRangeAction } from './actions/select_range_action'; import { VALUE_CLICK_ACTION, valueClickAction } from './actions/value_click_action'; import { @@ -112,6 +113,9 @@ export class DataPlugin } public start(core: CoreStart, { data, uiActions }: DataPluginStartDependencies): DataStart { + const search = this.search.start(core); + setSearchServiceShim(search); + setUiSettings(core.uiSettings); setQueryService(data.query); setIndexPatterns(data.indexPatterns); @@ -123,7 +127,7 @@ export class DataPlugin uiActions.attachAction(VALUE_CLICK_TRIGGER, VALUE_CLICK_ACTION); return { - search: this.search.start(core), + search, }; } diff --git a/src/legacy/core_plugins/data/public/search/aggs/agg_config.test.ts b/src/legacy/core_plugins/data/public/search/aggs/agg_config.test.ts new file mode 100644 index 0000000000000..7769aa29184d3 --- /dev/null +++ b/src/legacy/core_plugins/data/public/search/aggs/agg_config.test.ts @@ -0,0 +1,497 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { identity } from 'lodash'; + +import { AggConfig, IAggConfig } from './agg_config'; +import { AggConfigs, CreateAggConfigParams } from './agg_configs'; +import { AggType } from './agg_types'; +import { AggTypesRegistryStart } from './agg_types_registry'; +import { mockDataServices, mockAggTypesRegistry } from './test_helpers'; +import { IndexPatternField, IndexPattern } from '../../../../../../plugins/data/public'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { stubIndexPatternWithFields } from '../../../../../../plugins/data/public/stubs'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { dataPluginMock } from '../../../../../../plugins/data/public/mocks'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { setFieldFormats } from '../../../../../../plugins/data/public/services'; + +describe('AggConfig', () => { + let indexPattern: IndexPattern; + let typesRegistry: AggTypesRegistryStart; + + beforeEach(() => { + jest.restoreAllMocks(); + mockDataServices(); + indexPattern = stubIndexPatternWithFields as IndexPattern; + typesRegistry = mockAggTypesRegistry(); + }); + + describe('#toDsl', () => { + it('calls #write()', () => { + const ac = new AggConfigs(indexPattern, [], { typesRegistry }); + const configStates = { + enabled: true, + type: 'date_histogram', + schema: 'segment', + params: {}, + }; + const aggConfig = ac.createAggConfig(configStates); + + const spy = jest.spyOn(aggConfig, 'write').mockImplementation(() => ({ params: {} })); + aggConfig.toDsl(); + expect(spy).toHaveBeenCalledTimes(1); + }); + + it('uses the type name as the agg name', () => { + const ac = new AggConfigs(indexPattern, [], { typesRegistry }); + const configStates = { + enabled: true, + type: 'date_histogram', + schema: 'segment', + params: {}, + }; + const aggConfig = ac.createAggConfig(configStates); + + jest.spyOn(aggConfig, 'write').mockImplementation(() => ({ params: {} })); + const dsl = aggConfig.toDsl(); + expect(dsl).toHaveProperty('date_histogram'); + }); + + it('uses the params from #write() output as the agg params', () => { + const ac = new AggConfigs(indexPattern, [], { typesRegistry }); + const configStates = { + enabled: true, + type: 'date_histogram', + schema: 'segment', + params: {}, + }; + const aggConfig = ac.createAggConfig(configStates); + + const football = {}; + jest.spyOn(aggConfig, 'write').mockImplementation(() => ({ params: football })); + const dsl = aggConfig.toDsl(); + expect(dsl.date_histogram).toBe(football); + }); + + it('includes subAggs from #write() output', () => { + const configStates = [ + { + enabled: true, + type: 'avg', + schema: 'metric', + params: {}, + }, + { + enabled: true, + type: 'date_histogram', + schema: 'segment', + params: {}, + }, + ]; + const ac = new AggConfigs(indexPattern, configStates, { typesRegistry }); + + const histoConfig = ac.byName('date_histogram')[0]; + const avgConfig = ac.byName('avg')[0]; + const football = {}; + + jest + .spyOn(histoConfig, 'write') + .mockImplementation(() => ({ params: {}, subAggs: [avgConfig] })); + jest.spyOn(avgConfig, 'write').mockImplementation(() => ({ params: football })); + + const dsl = histoConfig.toDsl(); + expect(dsl).toHaveProperty('aggs'); + expect(dsl.aggs).toHaveProperty(avgConfig.id); + expect(dsl.aggs[avgConfig.id]).toHaveProperty('avg'); + expect(dsl.aggs[avgConfig.id].avg).toBe(football); + }); + }); + + describe('::ensureIds', () => { + it('accepts an array of objects and assigns ids to them', () => { + const objs = [{}, {}, {}, {}]; + AggConfig.ensureIds(objs); + expect(objs[0]).toHaveProperty('id', '1'); + expect(objs[1]).toHaveProperty('id', '2'); + expect(objs[2]).toHaveProperty('id', '3'); + expect(objs[3]).toHaveProperty('id', '4'); + }); + + it('assigns ids relative to the other only item in the list', () => { + const objs = [{ id: '100' }, {}]; + AggConfig.ensureIds(objs); + expect(objs[0]).toHaveProperty('id', '100'); + expect(objs[1]).toHaveProperty('id', '101'); + }); + + it('assigns ids relative to the other items in the list', () => { + const objs = [{ id: '100' }, { id: '200' }, { id: '500' }, { id: '350' }, {}]; + AggConfig.ensureIds(objs); + expect(objs[0]).toHaveProperty('id', '100'); + expect(objs[1]).toHaveProperty('id', '200'); + expect(objs[2]).toHaveProperty('id', '500'); + expect(objs[3]).toHaveProperty('id', '350'); + expect(objs[4]).toHaveProperty('id', '501'); + }); + + it('uses ::nextId to get the starting value', () => { + jest.spyOn(AggConfig, 'nextId').mockImplementation(() => 534); + const objs = AggConfig.ensureIds([{}]); + expect(objs[0]).toHaveProperty('id', '534'); + }); + + it('only calls ::nextId once', () => { + const start = 420; + const spy = jest.spyOn(AggConfig, 'nextId').mockImplementation(() => start); + const objs = AggConfig.ensureIds([{}, {}, {}, {}, {}, {}, {}]); + + expect(spy).toHaveBeenCalledTimes(1); + objs.forEach((obj, i) => { + expect(obj).toHaveProperty('id', String(start + i)); + }); + }); + }); + + describe('::nextId', () => { + it('accepts a list of objects and picks the next id', () => { + const next = AggConfig.nextId([{ id: '100' }, { id: '500' }] as IAggConfig[]); + expect(next).toBe(501); + }); + + it('handles an empty list', () => { + const next = AggConfig.nextId([]); + expect(next).toBe(1); + }); + + it('fails when the list is not defined', () => { + expect(() => { + AggConfig.nextId((undefined as unknown) as IAggConfig[]); + }).toThrowError(); + }); + }); + + describe('#toJsonDataEquals', () => { + const testsIdentical = [ + [ + { + enabled: true, + type: 'count', + schema: 'metric', + params: { field: '@timestamp' }, + }, + ], + [ + { + enabled: true, + type: 'avg', + schema: 'metric', + params: {}, + }, + { + enabled: true, + type: 'date_histogram', + schema: 'segment', + params: {}, + }, + ], + ]; + + testsIdentical.forEach((configState, index) => { + it(`identical aggregations (${index})`, () => { + const ac1 = new AggConfigs(indexPattern, configState, { typesRegistry }); + const ac2 = new AggConfigs(indexPattern, configState, { typesRegistry }); + expect(ac1.jsonDataEquals(ac2.aggs)).toBe(true); + }); + }); + + const testsIdenticalDifferentOrder = [ + { + config1: [ + { + enabled: true, + type: 'avg', + schema: 'metric', + params: {}, + }, + { + enabled: true, + type: 'date_histogram', + schema: 'segment', + params: {}, + }, + ], + config2: [ + { + enabled: true, + schema: 'metric', + type: 'avg', + params: {}, + }, + { + enabled: true, + schema: 'segment', + type: 'date_histogram', + params: {}, + }, + ], + }, + ]; + + testsIdenticalDifferentOrder.forEach((test, index) => { + it(`identical aggregations (${index}) - init json is in different order`, () => { + const ac1 = new AggConfigs(indexPattern, test.config1, { typesRegistry }); + const ac2 = new AggConfigs(indexPattern, test.config2, { typesRegistry }); + expect(ac1.jsonDataEquals(ac2.aggs)).toBe(true); + }); + }); + + const testsDifferent = [ + { + config1: [ + { + enabled: true, + type: 'avg', + schema: 'metric', + params: {}, + }, + { + enabled: true, + type: 'date_histogram', + schema: 'segment', + params: {}, + }, + ], + config2: [ + { + enabled: true, + type: 'max', + schema: 'metric', + params: {}, + }, + { + enabled: true, + type: 'date_histogram', + schema: 'segment', + params: {}, + }, + ], + }, + { + config1: [ + { + enabled: true, + type: 'count', + schema: 'metric', + params: { field: '@timestamp' }, + }, + ], + config2: [ + { + enabled: true, + type: 'count', + schema: 'metric', + params: { field: '@timestamp' }, + }, + { + enabled: true, + type: 'date_histogram', + schema: 'segment', + params: {}, + }, + ], + }, + ]; + + testsDifferent.forEach((test, index) => { + it(`different aggregations (${index})`, () => { + const ac1 = new AggConfigs(indexPattern, test.config1, { typesRegistry }); + const ac2 = new AggConfigs(indexPattern, test.config2, { typesRegistry }); + expect(ac1.jsonDataEquals(ac2.aggs)).toBe(false); + }); + }); + }); + + describe('#toJSON', () => { + it('includes the aggs id, params, type and schema', () => { + const ac = new AggConfigs(indexPattern, [], { typesRegistry }); + const configStates = { + enabled: true, + type: 'date_histogram', + schema: 'segment', + params: {}, + }; + const aggConfig = ac.createAggConfig(configStates); + + expect(aggConfig.id).toBe('1'); + expect(typeof aggConfig.params).toBe('object'); + expect(aggConfig.type).toBeInstanceOf(AggType); + expect(aggConfig.type).toHaveProperty('name', 'date_histogram'); + expect(typeof aggConfig.schema).toBe('object'); + expect(aggConfig.schema).toHaveProperty('name', 'segment'); + + const state = aggConfig.toJSON(); + expect(state).toHaveProperty('id', '1'); + expect(typeof state.params).toBe('object'); + expect(state).toHaveProperty('type', 'date_histogram'); + expect(state).toHaveProperty('schema', 'segment'); + }); + + it('test serialization order is identical (for visual consistency)', () => { + const configStates = [ + { + enabled: true, + type: 'date_histogram', + schema: 'segment', + params: {}, + }, + ]; + const ac1 = new AggConfigs(indexPattern, configStates, { typesRegistry }); + const ac2 = new AggConfigs(indexPattern, configStates, { typesRegistry }); + + // this relies on the assumption that js-engines consistently loop over properties in insertion order. + // most likely the case, but strictly speaking not guaranteed by the JS and JSON specifications. + expect(JSON.stringify(ac1.aggs) === JSON.stringify(ac2.aggs)).toBe(true); + }); + }); + + describe('#makeLabel', () => { + let aggConfig: AggConfig; + + beforeEach(() => { + const ac = new AggConfigs(indexPattern, [], { typesRegistry }); + aggConfig = ac.createAggConfig({ type: 'count' } as CreateAggConfigParams); + }); + + it('uses the custom label if it is defined', () => { + aggConfig.params.customLabel = 'Custom label'; + const label = aggConfig.makeLabel(); + expect(label).toBe(aggConfig.params.customLabel); + }); + + it('default label should be "Count"', () => { + const label = aggConfig.makeLabel(); + expect(label).toBe('Count'); + }); + + it('default label should be "Percentage of Count" when percentageMode is set to true', () => { + const label = aggConfig.makeLabel(true); + expect(label).toBe('Percentage of Count'); + }); + + it('empty label if the type is not defined', () => { + aggConfig.type = (undefined as unknown) as AggType; + const label = aggConfig.makeLabel(); + expect(label).toBe(''); + }); + }); + + describe('#fieldFormatter - custom getFormat handler', () => { + it('returns formatter from getFormat handler', () => { + setFieldFormats({ + ...dataPluginMock.createStartContract().fieldFormats, + getDefaultInstance: jest.fn().mockImplementation(() => ({ + getConverterFor: jest.fn().mockImplementation(() => (t: string) => t), + })) as any, + }); + + const ac = new AggConfigs(indexPattern, [], { typesRegistry }); + const configStates = { + enabled: true, + type: 'count', + schema: 'metric', + params: { field: '@timestamp' }, + }; + const aggConfig = ac.createAggConfig(configStates); + + const fieldFormatter = aggConfig.fieldFormatter(); + expect(fieldFormatter).toBeDefined(); + expect(fieldFormatter('text')).toBe('text'); + }); + }); + + // TODO: Converting these field formatter tests from browser tests to unit + // tests makes them much less helpful due to the extensive use of mocking. + // We should revisit these and rewrite them into something more useful. + describe('#fieldFormatter - no custom getFormat handler', () => { + let aggConfig: AggConfig; + + beforeEach(() => { + setFieldFormats({ + ...dataPluginMock.createStartContract().fieldFormats, + getDefaultInstance: jest.fn().mockImplementation(() => ({ + getConverterFor: (t?: string) => t || identity, + })) as any, + }); + indexPattern.fields.getByName = name => + ({ + format: { + getConverterFor: (t?: string) => t || identity, + }, + } as IndexPatternField); + + const configStates = { + enabled: true, + type: 'histogram', + schema: 'bucket', + params: { + field: { + format: { + getConverterFor: (t?: string) => t || identity, + }, + }, + }, + }; + const ac = new AggConfigs(indexPattern, [configStates], { typesRegistry }); + aggConfig = ac.createAggConfig(configStates); + }); + + it("returns the field's formatter", () => { + expect(aggConfig.fieldFormatter().toString()).toBe( + aggConfig + .getField() + .format.getConverterFor() + .toString() + ); + }); + + it('returns the string format if the field does not have a format', () => { + const agg = aggConfig; + agg.params.field = { type: 'number', format: null }; + const fieldFormatter = agg.fieldFormatter(); + expect(fieldFormatter).toBeDefined(); + expect(fieldFormatter('text')).toBe('text'); + }); + + it('returns the string format if there is no field', () => { + const agg = aggConfig; + delete agg.params.field; + const fieldFormatter = agg.fieldFormatter(); + expect(fieldFormatter).toBeDefined(); + expect(fieldFormatter('text')).toBe('text'); + }); + + it('returns the html converter if "html" is passed in', () => { + const field = indexPattern.fields.getByName('bytes'); + expect(aggConfig.fieldFormatter('html').toString()).toBe( + field!.format.getConverterFor('html').toString() + ); + }); + }); +}); diff --git a/src/legacy/core_plugins/data/public/search/aggs/agg_config.ts b/src/legacy/core_plugins/data/public/search/aggs/agg_config.ts index 2b21c5c4868a5..659bec3f702e3 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/agg_config.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/agg_config.ts @@ -17,16 +17,8 @@ * under the License. */ -/** - * @name AggConfig - * - * @description This class represents an aggregation, which is displayed in the left-hand nav of - * the Visualize app. - */ - import _ from 'lodash'; import { i18n } from '@kbn/i18n'; -import { npStart } from 'ui/new_platform'; import { IAggType } from './agg_type'; import { AggGroupNames } from './agg_groups'; import { writeParams } from './agg_params'; @@ -38,18 +30,20 @@ import { FieldFormatsContentType, KBN_FIELD_TYPES, } from '../../../../../../plugins/data/public'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { getFieldFormats } from '../../../../../../plugins/data/public/services'; export interface AggConfigOptions { - enabled: boolean; - type: string; - params: any; + type: IAggType; + enabled?: boolean; id?: string; - schema?: string; + params?: Record; + schema?: string | Schema; } const unknownSchema: Schema = { name: 'unknown', - title: 'Unknown', + title: 'Unknown', // only here for illustrative purposes hideCustomLabel: true, aggFilter: [], min: 1, @@ -65,21 +59,6 @@ const unknownSchema: Schema = { }, }; -const getTypeFromRegistry = (type: string): IAggType => { - // We need to inline require here, since we're having a cyclic dependency - // from somewhere inside agg_types back to AggConfig. - const aggTypes = require('../aggs').aggTypes; - const registeredType = - aggTypes.metrics.find((agg: IAggType) => agg.name === type) || - aggTypes.buckets.find((agg: IAggType) => agg.name === type); - - if (!registeredType) { - throw new Error('unknown type'); - } - - return registeredType; -}; - const getSchemaFromRegistry = (schemas: any, schema: string): Schema => { let registeredSchema = schemas ? schemas.byName[schema] : null; if (!registeredSchema) { @@ -90,6 +69,13 @@ const getSchemaFromRegistry = (schemas: any, schema: string): Schema => { return registeredSchema; }; +/** + * @name AggConfig + * + * @description This class represents an aggregation, which is displayed in the left-hand nav of + * the Visualize app. + */ + // TODO need to make a more explicit interface for this export type IAggConfig = AggConfig; @@ -101,9 +87,9 @@ export class AggConfig { * @param {array[object]} list - a list of objects, objects can be anything really * @return {array} - the list that was passed in */ - static ensureIds(list: AggConfig[]) { - const have: AggConfig[] = []; - const haveNot: AggConfig[] = []; + static ensureIds(list: any[]) { + const have: IAggConfig[] = []; + const haveNot: AggConfigOptions[] = []; list.forEach(function(obj) { (obj.id ? have : haveNot).push(obj); }); @@ -121,7 +107,7 @@ export class AggConfig { * * @return {array} list - a list of objects with id properties */ - static nextId(list: AggConfig[]) { + static nextId(list: IAggConfig[]) { return ( 1 + list.reduce(function(max, obj) { @@ -161,10 +147,10 @@ export class AggConfig { // set the params to the values from opts, or just to the defaults this.setParams(opts.params || {}); - // @ts-ignore - this.__type = this.__type; // @ts-ignore this.__schema = this.__schema; + // @ts-ignore + this.__type = this.__type; } /** @@ -394,7 +380,8 @@ export class AggConfig { } fieldOwnFormatter(contentType?: FieldFormatsContentType, defaultFormat?: any) { - const fieldFormatsService = npStart.plugins.data.fieldFormats; + const fieldFormatsService = getFieldFormats(); + const field = this.getField(); let format = field && field.format; if (!format) format = defaultFormat; @@ -456,8 +443,8 @@ export class AggConfig { }); } - public setType(type: string | IAggType) { - this.type = typeof type === 'string' ? getTypeFromRegistry(type) : type; + public setType(type: IAggType) { + this.type = type; } public get schema() { diff --git a/src/legacy/core_plugins/data/public/search/aggs/agg_configs.test.ts b/src/legacy/core_plugins/data/public/search/aggs/agg_configs.test.ts new file mode 100644 index 0000000000000..29f16b1e4f0bf --- /dev/null +++ b/src/legacy/core_plugins/data/public/search/aggs/agg_configs.test.ts @@ -0,0 +1,503 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { indexBy } from 'lodash'; +import { AggConfig } from './agg_config'; +import { AggConfigs } from './agg_configs'; +import { AggTypesRegistryStart } from './agg_types_registry'; +import { Schemas } from './schemas'; +import { AggGroupNames } from './agg_groups'; +import { mockDataServices, mockAggTypesRegistry } from './test_helpers'; +import { IndexPatternField, IndexPattern } from '../../../../../../plugins/data/public'; +import { + stubIndexPattern, + stubIndexPatternWithFields, + // eslint-disable-next-line @kbn/eslint/no-restricted-paths +} from '../../../../../../plugins/data/public/stubs'; + +describe('AggConfigs', () => { + let indexPattern: IndexPattern; + let typesRegistry: AggTypesRegistryStart; + + beforeEach(() => { + indexPattern = stubIndexPatternWithFields as IndexPattern; + typesRegistry = mockAggTypesRegistry(); + }); + + describe('constructor', () => { + it('handles passing just a type', () => { + const configStates = [ + { + enabled: true, + type: 'histogram', + params: {}, + }, + ]; + + const ac = new AggConfigs(indexPattern, configStates, { typesRegistry }); + expect(ac.aggs).toHaveLength(1); + }); + + it('attempts to ensure that all states have an id', () => { + const configStates = [ + { + enabled: true, + type: 'histogram', + params: {}, + }, + { + enabled: true, + type: 'date_histogram', + params: {}, + }, + { + enabled: true, + type: 'terms', + params: {}, + schema: 'split', + }, + ]; + + const spy = jest.spyOn(AggConfig, 'ensureIds'); + new AggConfigs(indexPattern, configStates, { typesRegistry }); + expect(spy).toHaveBeenCalledTimes(1); + expect(spy.mock.calls[0]).toEqual([configStates]); + spy.mockRestore(); + }); + + describe('defaults', () => { + const schemas = new Schemas([ + { + group: AggGroupNames.Metrics, + name: 'metric', + title: 'Simple', + min: 1, + max: 2, + defaults: [ + { schema: 'metric', type: 'count' }, + { schema: 'metric', type: 'avg' }, + { schema: 'metric', type: 'sum' }, + ], + }, + { + group: AggGroupNames.Buckets, + name: 'segment', + title: 'Example', + min: 0, + max: 1, + defaults: [ + { schema: 'segment', type: 'terms' }, + { schema: 'segment', type: 'filters' }, + ], + }, + ]); + + it('should only set the number of defaults defined by the max', () => { + const ac = new AggConfigs(indexPattern, [], { + schemas: schemas.all, + typesRegistry, + }); + expect(ac.bySchemaName('metric')).toHaveLength(2); + }); + + it('should set the defaults defined in the schema when none exist', () => { + const ac = new AggConfigs(indexPattern, [], { + schemas: schemas.all, + typesRegistry, + }); + expect(ac.aggs).toHaveLength(3); + }); + + it('should NOT set the defaults defined in the schema when some exist', () => { + const configStates = [ + { + enabled: true, + type: 'date_histogram', + params: {}, + schema: 'segment', + }, + ]; + const ac = new AggConfigs(indexPattern, configStates, { + schemas: schemas.all, + typesRegistry, + }); + expect(ac.aggs).toHaveLength(3); + expect(ac.bySchemaName('segment')[0].type.name).toEqual('date_histogram'); + }); + }); + }); + + describe('#createAggConfig', () => { + it('accepts a configState which is provided as an AggConfig object', () => { + const configStates = [ + { + enabled: true, + type: 'histogram', + params: {}, + }, + { + enabled: true, + type: 'date_histogram', + params: {}, + }, + ]; + + const ac = new AggConfigs(indexPattern, configStates, { typesRegistry }); + expect(ac.aggs).toHaveLength(2); + + ac.createAggConfig( + new AggConfig(ac, { + enabled: true, + type: typesRegistry.get('terms'), + params: {}, + schema: 'split', + }) + ); + expect(ac.aggs).toHaveLength(3); + }); + + it('adds new AggConfig entries to AggConfigs by default', () => { + const configStates = [ + { + enabled: true, + type: 'histogram', + params: {}, + }, + ]; + + const ac = new AggConfigs(indexPattern, configStates, { typesRegistry }); + expect(ac.aggs).toHaveLength(1); + + ac.createAggConfig({ + enabled: true, + type: 'terms', + params: {}, + schema: 'split', + }); + expect(ac.aggs).toHaveLength(2); + }); + + it('does not add an agg to AggConfigs if addToAggConfigs: false', () => { + const configStates = [ + { + enabled: true, + type: 'histogram', + params: {}, + }, + ]; + + const ac = new AggConfigs(indexPattern, configStates, { typesRegistry }); + expect(ac.aggs).toHaveLength(1); + + ac.createAggConfig( + { + enabled: true, + type: 'terms', + params: {}, + schema: 'split', + }, + { addToAggConfigs: false } + ); + expect(ac.aggs).toHaveLength(1); + }); + }); + + describe('#getRequestAggs', () => { + it('performs a stable sort, but moves metrics to the bottom', () => { + const configStates = [ + { type: 'avg', enabled: true, params: {}, schema: 'metric' }, + { type: 'terms', enabled: true, params: {}, schema: 'split' }, + { type: 'histogram', enabled: true, params: {}, schema: 'split' }, + { type: 'sum', enabled: true, params: {}, schema: 'metric' }, + { type: 'date_histogram', enabled: true, params: {}, schema: 'segment' }, + { type: 'filters', enabled: true, params: {}, schema: 'split' }, + { type: 'percentiles', enabled: true, params: {}, schema: 'metric' }, + ]; + + const ac = new AggConfigs(indexPattern, configStates, { typesRegistry }); + const sorted = ac.getRequestAggs(); + const aggs = indexBy(ac.aggs, agg => agg.type.name); + + expect(sorted.shift()).toBe(aggs.terms); + expect(sorted.shift()).toBe(aggs.histogram); + expect(sorted.shift()).toBe(aggs.date_histogram); + expect(sorted.shift()).toBe(aggs.filters); + expect(sorted.shift()).toBe(aggs.avg); + expect(sorted.shift()).toBe(aggs.sum); + expect(sorted.shift()).toBe(aggs.percentiles); + expect(sorted).toHaveLength(0); + }); + }); + + describe('#getResponseAggs', () => { + it('returns all request aggs for basic aggs', () => { + const configStates = [ + { type: 'terms', enabled: true, params: {}, schema: 'split' }, + { type: 'date_histogram', enabled: true, params: {}, schema: 'segment' }, + { type: 'count', enabled: true, params: {}, schema: 'metric' }, + ]; + + const ac = new AggConfigs(indexPattern, configStates, { typesRegistry }); + const sorted = ac.getResponseAggs(); + const aggs = indexBy(ac.aggs, agg => agg.type.name); + + expect(sorted.shift()).toBe(aggs.terms); + expect(sorted.shift()).toBe(aggs.date_histogram); + expect(sorted.shift()).toBe(aggs.count); + expect(sorted).toHaveLength(0); + }); + + it('expands aggs that have multiple responses', () => { + const configStates = [ + { type: 'terms', enabled: true, params: {}, schema: 'split' }, + { type: 'date_histogram', enabled: true, params: {}, schema: 'segment' }, + { type: 'percentiles', enabled: true, params: { percents: [1, 2, 3] }, schema: 'metric' }, + ]; + + const ac = new AggConfigs(indexPattern, configStates, { typesRegistry }); + const sorted = ac.getResponseAggs(); + const aggs = indexBy(ac.aggs, agg => agg.type.name); + + expect(sorted.shift()).toBe(aggs.terms); + expect(sorted.shift()).toBe(aggs.date_histogram); + expect(sorted.shift()!.id!).toBe(aggs.percentiles.id + '.' + 1); + expect(sorted.shift()!.id!).toBe(aggs.percentiles.id + '.' + 2); + expect(sorted.shift()!.id!).toBe(aggs.percentiles.id + '.' + 3); + expect(sorted).toHaveLength(0); + }); + }); + + describe('#toDsl', () => { + const schemas = new Schemas([ + { + group: AggGroupNames.Buckets, + name: 'segment', + }, + { + group: AggGroupNames.Buckets, + name: 'split', + }, + ]); + + beforeEach(() => { + mockDataServices(); + indexPattern = stubIndexPattern as IndexPattern; + indexPattern.fields.getByName = name => (name as unknown) as IndexPatternField; + }); + + it('uses the sorted aggs', () => { + const configStates = [{ enabled: true, type: 'avg', params: { field: 'bytes' } }]; + const ac = new AggConfigs(indexPattern, configStates, { typesRegistry }); + const spy = jest.spyOn(AggConfigs.prototype, 'getRequestAggs'); + ac.toDsl(); + expect(spy).toHaveBeenCalledTimes(1); + spy.mockRestore(); + }); + + it('calls aggConfig#toDsl() on each aggConfig and compiles the nested output', () => { + const configStates = [ + { enabled: true, type: 'date_histogram', params: {}, schema: 'segment' }, + { enabled: true, type: 'terms', params: {}, schema: 'split' }, + { enabled: true, type: 'count', params: {} }, + ]; + + const ac = new AggConfigs(indexPattern, configStates, { + typesRegistry, + schemas: schemas.all, + }); + + const aggInfos = ac.aggs.map(aggConfig => { + const football = {}; + aggConfig.toDsl = jest.fn().mockImplementation(() => football); + + return { + id: aggConfig.id, + football, + }; + }); + + (function recurse(lvl: Record): void { + const info = aggInfos.shift(); + if (!info) return; + + expect(lvl).toHaveProperty(info.id); + expect(lvl[info.id]).toBe(info.football); + + if (lvl[info.id].aggs) { + return recurse(lvl[info.id].aggs); + } + })(ac.toDsl()); + + expect(aggInfos).toHaveLength(1); + }); + + it("skips aggs that don't have a dsl representation", () => { + const configStates = [ + { + enabled: true, + type: 'date_histogram', + params: { field: '@timestamp', interval: '10s' }, + schema: 'segment', + }, + { + enabled: true, + type: 'count', + params: {}, + schema: 'metric', + }, + ]; + + const ac = new AggConfigs(indexPattern, configStates, { typesRegistry }); + const dsl = ac.toDsl(); + const histo = ac.byName('date_histogram')[0]; + const count = ac.byName('count')[0]; + + expect(dsl).toHaveProperty(histo.id); + expect(typeof dsl[histo.id]).toBe('object'); + expect(dsl[histo.id]).not.toHaveProperty('aggs'); + expect(dsl).not.toHaveProperty(count.id); + }); + + it('writes multiple metric aggregations at the same level', () => { + const configStates = [ + { + enabled: true, + type: 'date_histogram', + schema: 'segment', + params: { field: '@timestamp', interval: '10s' }, + }, + { enabled: true, type: 'avg', schema: 'metric', params: { field: 'bytes' } }, + { enabled: true, type: 'sum', schema: 'metric', params: { field: 'bytes' } }, + { enabled: true, type: 'min', schema: 'metric', params: { field: 'bytes' } }, + { enabled: true, type: 'max', schema: 'metric', params: { field: 'bytes' } }, + ]; + + const ac = new AggConfigs(indexPattern, configStates, { + typesRegistry, + schemas: schemas.all, + }); + const dsl = ac.toDsl(); + const histo = ac.byName('date_histogram')[0]; + const metrics = ac.bySchemaGroup('metrics'); + + expect(dsl).toHaveProperty(histo.id); + expect(typeof dsl[histo.id]).toBe('object'); + expect(dsl[histo.id]).toHaveProperty('aggs'); + + metrics.forEach(metric => { + expect(dsl[histo.id].aggs).toHaveProperty(metric.id); + expect(dsl[histo.id].aggs[metric.id]).not.toHaveProperty('aggs'); + }); + }); + + it('writes multiple metric aggregations at every level if the vis is hierarchical', () => { + const configStates = [ + { enabled: true, type: 'terms', schema: 'segment', params: { field: 'bytes', orderBy: 1 } }, + { enabled: true, type: 'terms', schema: 'segment', params: { field: 'bytes', orderBy: 1 } }, + { enabled: true, id: '1', type: 'avg', schema: 'metric', params: { field: 'bytes' } }, + { enabled: true, type: 'sum', schema: 'metric', params: { field: 'bytes' } }, + { enabled: true, type: 'min', schema: 'metric', params: { field: 'bytes' } }, + { enabled: true, type: 'max', schema: 'metric', params: { field: 'bytes' } }, + ]; + + const ac = new AggConfigs(indexPattern, configStates, { typesRegistry }); + const topLevelDsl = ac.toDsl(true); + const buckets = ac.bySchemaGroup('buckets'); + const metrics = ac.bySchemaGroup('metrics'); + + (function checkLevel(dsl) { + const bucket = buckets.shift(); + if (!bucket) return; + + expect(dsl).toHaveProperty(bucket.id); + + expect(typeof dsl[bucket.id]).toBe('object'); + expect(dsl[bucket.id]).toHaveProperty('aggs'); + + metrics.forEach((metric: AggConfig) => { + expect(dsl[bucket.id].aggs).toHaveProperty(metric.id); + expect(dsl[bucket.id].aggs[metric.id]).not.toHaveProperty('aggs'); + }); + + if (buckets.length) { + checkLevel(dsl[bucket.id].aggs); + } + })(topLevelDsl); + }); + + it('adds the parent aggs of nested metrics at every level if the vis is hierarchical', () => { + const configStates = [ + { + enabled: true, + id: '1', + type: 'avg_bucket', + schema: 'metric', + params: { + customBucket: { + id: '1-bucket', + type: 'date_histogram', + schema: 'bucketAgg', + params: { + field: '@timestamp', + interval: '10s', + }, + }, + customMetric: { + id: '1-metric', + type: 'count', + schema: 'metricAgg', + params: {}, + }, + }, + }, + { + enabled: true, + id: '2', + type: 'terms', + schema: 'bucket', + params: { + field: 'clientip', + }, + }, + { + enabled: true, + id: '3', + type: 'terms', + schema: 'bucket', + params: { + field: 'machine.os.raw', + }, + }, + ]; + + const ac = new AggConfigs(indexPattern, configStates, { typesRegistry }); + const topLevelDsl = ac.toDsl(true)['2']; + + expect(Object.keys(topLevelDsl.aggs)).toContain('1'); + expect(Object.keys(topLevelDsl.aggs)).toContain('1-bucket'); + expect(topLevelDsl.aggs['1'].avg_bucket).toHaveProperty('buckets_path', '1-bucket>_count'); + expect(Object.keys(topLevelDsl.aggs['3'].aggs)).toContain('1'); + expect(Object.keys(topLevelDsl.aggs['3'].aggs)).toContain('1-bucket'); + expect(topLevelDsl.aggs['3'].aggs['1'].avg_bucket).toHaveProperty( + 'buckets_path', + '1-bucket>_count' + ); + }); + }); +}); diff --git a/src/legacy/core_plugins/data/public/search/aggs/agg_configs.ts b/src/legacy/core_plugins/data/public/search/aggs/agg_configs.ts index 8e091ed5f21ae..ab70e66b1e138 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/agg_configs.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/agg_configs.ts @@ -17,17 +17,12 @@ * under the License. */ -/** - * @name AggConfig - * - * @extends IndexedArray - * - * @description A "data structure"-like class with methods for indexing and - * accessing instances of AggConfig. - */ - import _ from 'lodash'; +import { Assign } from '@kbn/utility-types'; + import { AggConfig, AggConfigOptions, IAggConfig } from './agg_config'; +import { IAggType } from './agg_type'; +import { AggTypesRegistryStart } from './agg_types_registry'; import { Schema } from './schemas'; import { AggGroupNames } from './agg_groups'; import { @@ -55,6 +50,24 @@ function parseParentAggs(dslLvlCursor: any, dsl: any) { } } +export interface AggConfigsOptions { + schemas?: Schemas; + typesRegistry: AggTypesRegistryStart; +} + +export type CreateAggConfigParams = Assign; + +/** + * @name AggConfigs + * + * @description A "data structure"-like class with methods for indexing and + * accessing instances of AggConfig. This should never be instantiated directly + * outside of this plugin. Rather, downstream plugins should do this via + * `createAggConfigs()` + * + * @internal + */ + // TODO need to make a more explicit interface for this export type IAggConfigs = AggConfigs; @@ -62,23 +75,31 @@ export class AggConfigs { public indexPattern: IndexPattern; public schemas: any; public timeRange?: TimeRange; + private readonly typesRegistry: AggTypesRegistryStart; aggs: IAggConfig[]; - constructor(indexPattern: IndexPattern, configStates = [] as any, schemas?: any) { + constructor( + indexPattern: IndexPattern, + configStates: CreateAggConfigParams[] = [], + opts: AggConfigsOptions + ) { + this.typesRegistry = opts.typesRegistry; + configStates = AggConfig.ensureIds(configStates); this.aggs = []; this.indexPattern = indexPattern; - this.schemas = schemas; + this.schemas = opts.schemas; configStates.forEach((params: any) => this.createAggConfig(params)); - if (schemas) { - this.initializeDefaultsFromSchemas(schemas); + if (this.schemas) { + this.initializeDefaultsFromSchemas(this.schemas); } } + // do this wherever the schemas were passed in, & pass in state defaults instead initializeDefaultsFromSchemas(schemas: Schemas) { // Set the defaults for any schema which has them. If the defaults // for some reason has more then the max only set the max number @@ -91,10 +112,11 @@ export class AggConfigs { }) .each((schema: any) => { if (!this.aggs.find((agg: AggConfig) => agg.schema && agg.schema.name === schema.name)) { + // the result here should be passable as a configState const defaults = schema.defaults.slice(0, schema.max); _.each(defaults, defaultState => { const state = _.defaults({ id: AggConfig.nextId(this.aggs) }, defaultState); - this.aggs.push(new AggConfig(this, state as AggConfigOptions)); + this.createAggConfig(state as AggConfigOptions); }); } }) @@ -124,28 +146,36 @@ export class AggConfigs { if (!enabledOnly) return true; return agg.enabled; }; - const aggConfigs = new AggConfigs( - this.indexPattern, - this.aggs.filter(filterAggs), - this.schemas - ); + + const aggConfigs = new AggConfigs(this.indexPattern, this.aggs.filter(filterAggs), { + schemas: this.schemas, + typesRegistry: this.typesRegistry, + }); + return aggConfigs; } createAggConfig = ( - params: AggConfig | AggConfigOptions, + params: CreateAggConfigParams, { addToAggConfigs = true } = {} ) => { + const { type } = params; let aggConfig; + if (params instanceof AggConfig) { aggConfig = params; params.parent = this; } else { - aggConfig = new AggConfig(this, params); + aggConfig = new AggConfig(this, { + ...params, + type: typeof type === 'string' ? this.typesRegistry.get(type) : type, + }); } + if (addToAggConfigs) { this.aggs.push(aggConfig); } + return aggConfig as T; }; @@ -166,10 +196,10 @@ export class AggConfigs { return true; } - toDsl(hierarchical: boolean = false) { + toDsl(hierarchical: boolean = false): Record { const dslTopLvl = {}; let dslLvlCursor: Record; - let nestedMetrics: Array<{ config: AggConfig; dsl: any }> | []; + let nestedMetrics: Array<{ config: AggConfig; dsl: Record }> | []; if (hierarchical) { // collect all metrics, and filter out the ones that we won't be copying diff --git a/src/legacy/core_plugins/data/public/search/aggs/agg_params.test.ts b/src/legacy/core_plugins/data/public/search/aggs/agg_params.test.ts index 30ab272537dad..b08fcf309e9ed 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/agg_params.test.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/agg_params.test.ts @@ -23,8 +23,6 @@ import { FieldParamType } from './param_types/field'; import { OptionedParamType } from './param_types/optioned'; import { AggParamType } from '../aggs/param_types/agg'; -jest.mock('ui/new_platform'); - describe('AggParams class', () => { describe('constructor args', () => { it('accepts an array of param defs', () => { diff --git a/src/legacy/core_plugins/data/public/search/aggs/agg_type.test.ts b/src/legacy/core_plugins/data/public/search/aggs/agg_type.test.ts index 6d4c2d1317f50..c78e56dd25887 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/agg_type.test.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/agg_type.test.ts @@ -19,11 +19,16 @@ import { AggType, AggTypeConfig } from './agg_type'; import { IAggConfig } from './agg_config'; -import { npStart } from 'ui/new_platform'; - -jest.mock('ui/new_platform'); +import { mockDataServices } from './test_helpers'; +import { dataPluginMock } from '../../../../../../plugins/data/public/mocks'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { setFieldFormats } from '../../../../../../plugins/data/public/services'; describe('AggType Class', () => { + beforeEach(() => { + mockDataServices(); + }); + describe('constructor', () => { it("requires a valid config object as it's first param", () => { expect(() => { @@ -153,7 +158,10 @@ describe('AggType Class', () => { }); it('returns default formatter', () => { - npStart.plugins.data.fieldFormats.getDefaultInstance = jest.fn(() => 'default') as any; + setFieldFormats({ + ...dataPluginMock.createStartContract().fieldFormats, + getDefaultInstance: jest.fn(() => 'default') as any, + }); const aggType = new AggType({ name: 'name', diff --git a/src/legacy/core_plugins/data/public/search/aggs/agg_type.ts b/src/legacy/core_plugins/data/public/search/aggs/agg_type.ts index 5ccf0f65c0e92..3cd9496d3f23d 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/agg_type.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/agg_type.ts @@ -19,7 +19,6 @@ import { constant, noop, identity } from 'lodash'; import { i18n } from '@kbn/i18n'; -import { npStart } from 'ui/new_platform'; import { initParams } from './agg_params'; import { AggConfig } from './agg_config'; @@ -32,6 +31,8 @@ import { IFieldFormat, ISearchSource, } from '../../../../../../plugins/data/public'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { getFieldFormats } from '../../../../../../plugins/data/public/services'; export interface AggTypeConfig< TAggConfig extends AggConfig = AggConfig, @@ -65,7 +66,7 @@ export interface AggTypeConfig< const getFormat = (agg: AggConfig) => { const field = agg.getField(); - const fieldFormatsService = npStart.plugins.data.fieldFormats; + const fieldFormatsService = getFieldFormats(); return field ? field.format : fieldFormatsService.getDefaultInstance(KBN_FIELD_TYPES.STRING); }; diff --git a/src/legacy/core_plugins/data/public/search/aggs/agg_types_registry.test.ts b/src/legacy/core_plugins/data/public/search/aggs/agg_types_registry.test.ts new file mode 100644 index 0000000000000..405f83e237de8 --- /dev/null +++ b/src/legacy/core_plugins/data/public/search/aggs/agg_types_registry.test.ts @@ -0,0 +1,91 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { + AggTypesRegistry, + AggTypesRegistrySetup, + AggTypesRegistryStart, +} from './agg_types_registry'; +import { BucketAggType } from './buckets/_bucket_agg_type'; +import { MetricAggType } from './metrics/metric_agg_type'; + +const bucketType = { name: 'terms', type: 'bucket' } as BucketAggType; +const metricType = { name: 'count', type: 'metric' } as MetricAggType; + +describe('AggTypesRegistry', () => { + let registry: AggTypesRegistry; + let setup: AggTypesRegistrySetup; + let start: AggTypesRegistryStart; + + beforeEach(() => { + registry = new AggTypesRegistry(); + setup = registry.setup(); + start = registry.start(); + }); + + it('registerBucket adds new buckets', () => { + setup.registerBucket(bucketType); + expect(start.getBuckets()).toEqual([bucketType]); + }); + + it('registerBucket throws error when registering duplicate bucket', () => { + expect(() => { + setup.registerBucket(bucketType); + setup.registerBucket(bucketType); + }).toThrow(/already been registered with name: terms/); + }); + + it('registerMetric adds new metrics', () => { + setup.registerMetric(metricType); + expect(start.getMetrics()).toEqual([metricType]); + }); + + it('registerMetric throws error when registering duplicate metric', () => { + expect(() => { + setup.registerMetric(metricType); + setup.registerMetric(metricType); + }).toThrow(/already been registered with name: count/); + }); + + it('gets either buckets or metrics by id', () => { + setup.registerBucket(bucketType); + setup.registerMetric(metricType); + expect(start.get('terms')).toEqual(bucketType); + expect(start.get('count')).toEqual(metricType); + }); + + it('getBuckets retrieves only buckets', () => { + setup.registerBucket(bucketType); + expect(start.getBuckets()).toEqual([bucketType]); + }); + + it('getMetrics retrieves only metrics', () => { + setup.registerMetric(metricType); + expect(start.getMetrics()).toEqual([metricType]); + }); + + it('getAll returns all buckets and metrics', () => { + setup.registerBucket(bucketType); + setup.registerMetric(metricType); + expect(start.getAll()).toEqual({ + buckets: [bucketType], + metrics: [metricType], + }); + }); +}); diff --git a/src/legacy/core_plugins/data/public/search/aggs/agg_types_registry.ts b/src/legacy/core_plugins/data/public/search/aggs/agg_types_registry.ts new file mode 100644 index 0000000000000..8a8746106ae58 --- /dev/null +++ b/src/legacy/core_plugins/data/public/search/aggs/agg_types_registry.ts @@ -0,0 +1,68 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { BucketAggType } from './buckets/_bucket_agg_type'; +import { MetricAggType } from './metrics/metric_agg_type'; + +export type AggTypesRegistrySetup = ReturnType; +export type AggTypesRegistryStart = ReturnType; + +export class AggTypesRegistry { + private readonly bucketAggs = new Map(); + private readonly metricAggs = new Map(); + + setup = () => { + return { + registerBucket: >(type: T): void => { + const { name } = type; + if (this.bucketAggs.get(name)) { + throw new Error(`Bucket agg has already been registered with name: ${name}`); + } + this.bucketAggs.set(name, type); + }, + registerMetric: >(type: T): void => { + const { name } = type; + if (this.metricAggs.get(name)) { + throw new Error(`Metric agg has already been registered with name: ${name}`); + } + this.metricAggs.set(name, type); + }, + }; + }; + + start = () => { + return { + get: (name: string) => { + return this.bucketAggs.get(name) || this.metricAggs.get(name); + }, + getBuckets: () => { + return Array.from(this.bucketAggs.values()); + }, + getMetrics: () => { + return Array.from(this.metricAggs.values()); + }, + getAll: () => { + return { + buckets: Array.from(this.bucketAggs.values()), + metrics: Array.from(this.metricAggs.values()), + }; + }, + }; + }; +} diff --git a/src/legacy/core_plugins/data/public/search/aggs/buckets/_bucket_agg_type.ts b/src/legacy/core_plugins/data/public/search/aggs/buckets/_bucket_agg_type.ts index 546d054c5af97..d6ab58d5250a8 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/buckets/_bucket_agg_type.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/buckets/_bucket_agg_type.ts @@ -17,16 +17,16 @@ * under the License. */ -import { AggConfig } from '../agg_config'; +import { IAggConfig } from '../agg_config'; import { KBN_FIELD_TYPES } from '../../../../../../../plugins/data/public'; import { AggType, AggTypeConfig } from '../agg_type'; import { AggParamType } from '../param_types/agg'; -export interface IBucketAggConfig extends AggConfig { +export interface IBucketAggConfig extends IAggConfig { type: InstanceType; } -export interface BucketAggParam +export interface BucketAggParam extends AggParamType { scriptable?: boolean; filterFieldTypes?: KBN_FIELD_TYPES | KBN_FIELD_TYPES[] | '*'; @@ -34,12 +34,12 @@ export interface BucketAggParam const bucketType = 'buckets'; -interface BucketAggTypeConfig +interface BucketAggTypeConfig extends AggTypeConfig> { - getKey?: (bucket: any, key: any, agg: AggConfig) => any; + getKey?: (bucket: any, key: any, agg: IAggConfig) => any; } -export class BucketAggType extends AggType< +export class BucketAggType extends AggType< TBucketAggConfig, BucketAggParam > { diff --git a/src/legacy/core_plugins/data/public/search/aggs/buckets/_interval_options.ts b/src/legacy/core_plugins/data/public/search/aggs/buckets/_interval_options.ts index e196687607d19..393d3b745250f 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/buckets/_interval_options.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/buckets/_interval_options.ts @@ -16,6 +16,7 @@ * specific language governing permissions and limitations * under the License. */ + import { i18n } from '@kbn/i18n'; import { IBucketAggConfig } from './_bucket_agg_type'; diff --git a/src/legacy/core_plugins/data/public/search/aggs/buckets/create_filter/date_histogram.test.ts b/src/legacy/core_plugins/data/public/search/aggs/buckets/create_filter/date_histogram.test.ts index 0d3f58c50a42e..2b47dc384bca2 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/buckets/create_filter/date_histogram.test.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/buckets/create_filter/date_histogram.test.ts @@ -21,14 +21,22 @@ import moment from 'moment'; import { createFilterDateHistogram } from './date_histogram'; import { intervalOptions } from '../_interval_options'; import { AggConfigs } from '../../agg_configs'; -import { IBucketDateHistogramAggConfig } from '../date_histogram'; +import { mockDataServices, mockAggTypesRegistry } from '../../test_helpers'; +import { dateHistogramBucketAgg, IBucketDateHistogramAggConfig } from '../date_histogram'; import { BUCKET_TYPES } from '../bucket_agg_types'; import { RangeFilter } from '../../../../../../../../plugins/data/public'; +// TODO: remove this once time buckets is migrated jest.mock('ui/new_platform'); describe('AggConfig Filters', () => { describe('date_histogram', () => { + beforeEach(() => { + mockDataServices(); + }); + + const typesRegistry = mockAggTypesRegistry([dateHistogramBucketAgg]); + let agg: IBucketDateHistogramAggConfig; let filter: RangeFilter; let bucketStart: any; @@ -56,7 +64,7 @@ describe('AggConfig Filters', () => { params: { field: field.name, interval, customInterval: '5d' }, }, ], - null + { typesRegistry } ); const bucketKey = 1422579600000; diff --git a/src/legacy/core_plugins/data/public/search/aggs/buckets/create_filter/date_range.test.ts b/src/legacy/core_plugins/data/public/search/aggs/buckets/create_filter/date_range.test.ts index 41e806668337e..c594c7718e58b 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/buckets/create_filter/date_range.test.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/buckets/create_filter/date_range.test.ts @@ -18,16 +18,17 @@ */ import moment from 'moment'; +import { dateRangeBucketAgg } from '../date_range'; import { createFilterDateRange } from './date_range'; import { fieldFormats, FieldFormatsGetConfigFn } from '../../../../../../../../plugins/data/public'; import { AggConfigs } from '../../agg_configs'; +import { mockAggTypesRegistry } from '../../test_helpers'; import { BUCKET_TYPES } from '../bucket_agg_types'; import { IBucketAggConfig } from '../_bucket_agg_type'; -jest.mock('ui/new_platform'); - describe('AggConfig Filters', () => { describe('Date range', () => { + const typesRegistry = mockAggTypesRegistry([dateRangeBucketAgg]); const getConfig = (() => {}) as FieldFormatsGetConfigFn; const getAggConfigs = () => { const field = { @@ -55,7 +56,7 @@ describe('AggConfig Filters', () => { }, }, ], - null + { typesRegistry } ); }; diff --git a/src/legacy/core_plugins/data/public/search/aggs/buckets/create_filter/filters.test.ts b/src/legacy/core_plugins/data/public/search/aggs/buckets/create_filter/filters.test.ts index 34cf996826865..3b9c771e0f15f 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/buckets/create_filter/filters.test.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/buckets/create_filter/filters.test.ts @@ -16,14 +16,21 @@ * specific language governing permissions and limitations * under the License. */ + +import { filtersBucketAgg } from '../filters'; import { createFilterFilters } from './filters'; import { AggConfigs } from '../../agg_configs'; +import { mockDataServices, mockAggTypesRegistry } from '../../test_helpers'; import { IBucketAggConfig } from '../_bucket_agg_type'; -jest.mock('ui/new_platform'); - describe('AggConfig Filters', () => { describe('filters', () => { + beforeEach(() => { + mockDataServices(); + }); + + const typesRegistry = mockAggTypesRegistry([filtersBucketAgg]); + const getAggConfigs = () => { const field = { name: 'bytes', @@ -52,7 +59,7 @@ describe('AggConfig Filters', () => { }, }, ], - null + { typesRegistry } ); }; it('should return a filters filter', () => { diff --git a/src/legacy/core_plugins/data/public/search/aggs/buckets/create_filter/histogram.test.ts b/src/legacy/core_plugins/data/public/search/aggs/buckets/create_filter/histogram.test.ts index 9f845847df5d9..b046c802c58c1 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/buckets/create_filter/histogram.test.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/buckets/create_filter/histogram.test.ts @@ -16,16 +16,22 @@ * specific language governing permissions and limitations * under the License. */ + import { createFilterHistogram } from './histogram'; import { AggConfigs } from '../../agg_configs'; +import { mockDataServices, mockAggTypesRegistry } from '../../test_helpers'; import { BUCKET_TYPES } from '../bucket_agg_types'; import { IBucketAggConfig } from '../_bucket_agg_type'; import { fieldFormats, FieldFormatsGetConfigFn } from '../../../../../../../../plugins/data/public'; -jest.mock('ui/new_platform'); - describe('AggConfig Filters', () => { describe('histogram', () => { + beforeEach(() => { + mockDataServices(); + }); + + const typesRegistry = mockAggTypesRegistry(); + const getConfig = (() => {}) as FieldFormatsGetConfigFn; const getAggConfigs = () => { const field = { @@ -55,7 +61,7 @@ describe('AggConfig Filters', () => { }, }, ], - null + { typesRegistry } ); }; diff --git a/src/legacy/core_plugins/data/public/search/aggs/buckets/create_filter/ip_range.test.ts b/src/legacy/core_plugins/data/public/search/aggs/buckets/create_filter/ip_range.test.ts index e92ba5cb2852a..7572c48390dc2 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/buckets/create_filter/ip_range.test.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/buckets/create_filter/ip_range.test.ts @@ -17,17 +17,18 @@ * under the License. */ +import { ipRangeBucketAgg } from '../ip_range'; import { createFilterIpRange } from './ip_range'; -import { AggConfigs } from '../../agg_configs'; +import { AggConfigs, CreateAggConfigParams } from '../../agg_configs'; +import { mockAggTypesRegistry } from '../../test_helpers'; import { fieldFormats } from '../../../../../../../../plugins/data/public'; import { BUCKET_TYPES } from '../bucket_agg_types'; import { IBucketAggConfig } from '../_bucket_agg_type'; -jest.mock('ui/new_platform'); - describe('AggConfig Filters', () => { describe('IP range', () => { - const getAggConfigs = (aggs: Array>) => { + const typesRegistry = mockAggTypesRegistry([ipRangeBucketAgg]); + const getAggConfigs = (aggs: CreateAggConfigParams[]) => { const field = { name: 'ip', format: fieldFormats.IpFormat, @@ -42,7 +43,7 @@ describe('AggConfig Filters', () => { }, } as any; - return new AggConfigs(indexPattern, aggs, null); + return new AggConfigs(indexPattern, aggs, { typesRegistry }); }; it('should return a range filter for ip_range agg', () => { diff --git a/src/legacy/core_plugins/data/public/search/aggs/buckets/create_filter/range.test.ts b/src/legacy/core_plugins/data/public/search/aggs/buckets/create_filter/range.test.ts index 33344ca0a3484..324d425290832 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/buckets/create_filter/range.test.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/buckets/create_filter/range.test.ts @@ -17,16 +17,22 @@ * under the License. */ +import { rangeBucketAgg } from '../range'; import { createFilterRange } from './range'; import { fieldFormats, FieldFormatsGetConfigFn } from '../../../../../../../../plugins/data/public'; import { AggConfigs } from '../../agg_configs'; +import { mockDataServices, mockAggTypesRegistry } from '../../test_helpers'; import { BUCKET_TYPES } from '../bucket_agg_types'; import { IBucketAggConfig } from '../_bucket_agg_type'; -jest.mock('ui/new_platform'); - describe('AggConfig Filters', () => { describe('range', () => { + beforeEach(() => { + mockDataServices(); + }); + + const typesRegistry = mockAggTypesRegistry([rangeBucketAgg]); + const getConfig = (() => {}) as FieldFormatsGetConfigFn; const getAggConfigs = () => { const field = { @@ -56,7 +62,7 @@ describe('AggConfig Filters', () => { }, }, ], - null + { typesRegistry } ); }; diff --git a/src/legacy/core_plugins/data/public/search/aggs/buckets/create_filter/terms.test.ts b/src/legacy/core_plugins/data/public/search/aggs/buckets/create_filter/terms.test.ts index 7c6e769437ca1..6db6eb11a5f52 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/buckets/create_filter/terms.test.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/buckets/create_filter/terms.test.ts @@ -17,17 +17,18 @@ * under the License. */ +import { termsBucketAgg } from '../terms'; import { createFilterTerms } from './terms'; -import { AggConfigs } from '../../agg_configs'; +import { AggConfigs, CreateAggConfigParams } from '../../agg_configs'; +import { mockAggTypesRegistry } from '../../test_helpers'; import { BUCKET_TYPES } from '../bucket_agg_types'; import { IBucketAggConfig } from '../_bucket_agg_type'; import { Filter, ExistsFilter } from '../../../../../../../../plugins/data/public'; -jest.mock('ui/new_platform'); - describe('AggConfig Filters', () => { describe('terms', () => { - const getAggConfigs = (aggs: Array>) => { + const typesRegistry = mockAggTypesRegistry([termsBucketAgg]); + const getAggConfigs = (aggs: CreateAggConfigParams[]) => { const indexPattern = { id: '1234', title: 'logstash-*', @@ -42,7 +43,7 @@ describe('AggConfig Filters', () => { indexPattern, }; - return new AggConfigs(indexPattern, aggs, null); + return new AggConfigs(indexPattern, aggs, { typesRegistry }); }; it('should return a match_phrase filter for terms', () => { diff --git a/src/legacy/core_plugins/data/public/search/aggs/buckets/date_histogram.ts b/src/legacy/core_plugins/data/public/search/aggs/buckets/date_histogram.ts index dc0f9baa6d0cc..a5368135728d4 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/buckets/date_histogram.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/buckets/date_histogram.ts @@ -21,8 +21,7 @@ import _ from 'lodash'; import moment from 'moment-timezone'; import { i18n } from '@kbn/i18n'; -import { npStart } from 'ui/new_platform'; -import { timefilter } from 'ui/timefilter'; +// TODO need to move TimeBuckets import { TimeBuckets } from 'ui/time_buckets'; import { BucketAggType, IBucketAggConfig } from './_bucket_agg_type'; import { BUCKET_TYPES } from './bucket_agg_types'; @@ -33,6 +32,8 @@ import { writeParams } from '../agg_params'; import { isMetricAggType } from '../metrics/metric_agg_type'; import { KBN_FIELD_TYPES } from '../../../../../../../plugins/data/public'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { getQueryService, getUiSettings } from '../../../../../../../plugins/data/public/services'; const detectedTimezone = moment.tz.guess(); const tzOffset = moment().format('Z'); @@ -40,6 +41,7 @@ const tzOffset = moment().format('Z'); const getInterval = (agg: IBucketAggConfig): string => _.get(agg, ['params', 'interval']); export const setBounds = (agg: IBucketDateHistogramAggConfig, force?: boolean) => { + const { timefilter } = getQueryService().timefilter; if (agg.buckets._alreadySet && !force) return; agg.buckets._alreadySet = true; const bounds = agg.params.timeRange ? timefilter.calculateBounds(agg.params.timeRange) : null; @@ -221,7 +223,7 @@ export const dateHistogramBucketAgg = new BucketAggType { + beforeEach(() => { + mockDataServices(); + }); + + const typesRegistry = mockAggTypesRegistry([dateRangeBucketAgg]); + const getAggConfigs = (params: Record = {}, hasIncludeTypeMeta: boolean = true) => { const field = { name: 'bytes', @@ -58,7 +67,7 @@ describe('date_range params', () => { params, }, ], - null + { typesRegistry } ); }; @@ -95,7 +104,11 @@ describe('date_range params', () => { }); it('should use the Kibana time_zone if no parameter specified', () => { - npStart.core.uiSettings.get = jest.fn(() => 'kibanaTimeZone' as any); + const core = coreMock.createStart(); + setUiSettings({ + ...core.uiSettings, + get: () => 'kibanaTimeZone' as any, + }); const aggConfigs = getAggConfigs( { @@ -106,6 +119,8 @@ describe('date_range params', () => { const dateRange = aggConfigs.aggs[0]; const params = dateRange.toDsl()[BUCKET_TYPES.DATE_RANGE]; + setUiSettings(core.uiSettings); // clean up + expect(params.time_zone).toBe('kibanaTimeZone'); }); }); diff --git a/src/legacy/core_plugins/data/public/search/aggs/buckets/date_range.ts b/src/legacy/core_plugins/data/public/search/aggs/buckets/date_range.ts index 1dc24ca80035c..933cdd0577f8d 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/buckets/date_range.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/buckets/date_range.ts @@ -16,18 +16,20 @@ * specific language governing permissions and limitations * under the License. */ + import { get } from 'lodash'; import moment from 'moment-timezone'; import { i18n } from '@kbn/i18n'; -import { npStart } from 'ui/new_platform'; -import { convertDateRangeToString, DateRangeKey } from './lib/date_range'; import { BUCKET_TYPES } from './bucket_agg_types'; import { BucketAggType, IBucketAggConfig } from './_bucket_agg_type'; import { createFilterDateRange } from './create_filter/date_range'; import { KBN_FIELD_TYPES, fieldFormats } from '../../../../../../../plugins/data/public'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { getFieldFormats, getUiSettings } from '../../../../../../../plugins/data/public/services'; -export { convertDateRangeToString, DateRangeKey }; +import { convertDateRangeToString, DateRangeKey } from './lib/date_range'; +export { convertDateRangeToString, DateRangeKey }; // for BWC const dateRangeTitle = i18n.translate('data.search.aggs.buckets.dateRangeTitle', { defaultMessage: 'Date Range', @@ -41,7 +43,7 @@ export const dateRangeBucketAgg = new BucketAggType({ return { from, to }; }, getFormat(agg) { - const fieldFormatsService = npStart.plugins.data.fieldFormats; + const fieldFormatsService = getFieldFormats(); const formatter = agg.fieldOwnFormatter( fieldFormats.TEXT_CONTEXT_TYPE, @@ -92,7 +94,7 @@ export const dateRangeBucketAgg = new BucketAggType({ ]); } if (!tz) { - const config = npStart.core.uiSettings; + const config = getUiSettings(); const detectedTimezone = moment.tz.guess(); const tzOffset = moment().format('Z'); const isDefaultTimezone = config.isDefault('dateFormat:tz'); diff --git a/src/legacy/core_plugins/data/public/search/aggs/buckets/filter.ts b/src/legacy/core_plugins/data/public/search/aggs/buckets/filter.ts index b52e2d6cfd4df..80efc0cf92071 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/buckets/filter.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/buckets/filter.ts @@ -16,6 +16,7 @@ * specific language governing permissions and limitations * under the License. */ + import { i18n } from '@kbn/i18n'; import { BucketAggType } from './_bucket_agg_type'; import { BUCKET_TYPES } from './bucket_agg_types'; diff --git a/src/legacy/core_plugins/data/public/search/aggs/buckets/filters.ts b/src/legacy/core_plugins/data/public/search/aggs/buckets/filters.ts index 6eaf788b83c04..2852f3e4bdf46 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/buckets/filters.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/buckets/filters.ts @@ -18,19 +18,21 @@ */ import _ from 'lodash'; -import angular from 'angular'; - import { i18n } from '@kbn/i18n'; import chrome from 'ui/chrome'; + import { createFilterFilters } from './create_filter/filters'; +import { toAngularJSON } from '../utils'; import { BucketAggType } from './_bucket_agg_type'; +import { BUCKET_TYPES } from './bucket_agg_types'; import { Storage } from '../../../../../../../plugins/kibana_utils/public'; + import { getQueryLog, esQuery, Query } from '../../../../../../../plugins/data/public'; -import { BUCKET_TYPES } from './bucket_agg_types'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { getUiSettings } from '../../../../../../../plugins/data/public/services'; const config = chrome.getUiSettingsClient(); -const storage = new Storage(window.localStorage); const filtersTitle = i18n.translate('data.search.aggs.buckets.filtersTitle', { defaultMessage: 'Filters', @@ -52,15 +54,17 @@ export const filtersBucketAgg = new BucketAggType({ params: [ { name: 'filters', + // TODO need to get rid of reference to `config` below default: [{ input: { query: '', language: config.get('search:queryLanguage') }, label: '' }], write(aggConfig, output) { + const uiSettings = getUiSettings(); const inFilters: FilterValue[] = aggConfig.params.filters; if (!_.size(inFilters)) return; inFilters.forEach(filter => { const persistedLog = getQueryLog( - config, - storage, + uiSettings, + new Storage(window.localStorage), 'vis_default_editor', filter.input.language ); @@ -77,7 +81,13 @@ export const filtersBucketAgg = new BucketAggType({ return; } - const query = esQuery.buildEsQuery(aggConfig.getIndexPattern(), [input], [], config); + const esQueryConfigs = esQuery.getEsQueryConfig(uiSettings); + const query = esQuery.buildEsQuery( + aggConfig.getIndexPattern(), + [input], + [], + esQueryConfigs + ); if (!query) { console.log('malformed filter agg params, missing "query" on input'); // eslint-disable-line no-console @@ -90,7 +100,7 @@ export const filtersBucketAgg = new BucketAggType({ matchAllLabel || (typeof filter.input.query === 'string' ? filter.input.query - : angular.toJson(filter.input.query)); + : toAngularJSON(filter.input.query)); filters[label] = { query }; }, {} diff --git a/src/legacy/core_plugins/data/public/search/aggs/buckets/geo_hash.test.ts b/src/legacy/core_plugins/data/public/search/aggs/buckets/geo_hash.test.ts index f0ad595476486..09dd03c759155 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/buckets/geo_hash.test.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/buckets/geo_hash.test.ts @@ -19,12 +19,13 @@ import { geoHashBucketAgg } from './geo_hash'; import { AggConfigs, IAggConfigs } from '../agg_configs'; +import { mockAggTypesRegistry } from '../test_helpers'; import { BUCKET_TYPES } from './bucket_agg_types'; import { IBucketAggConfig } from './_bucket_agg_type'; -jest.mock('ui/new_platform'); - describe('Geohash Agg', () => { + // const typesRegistry = mockAggTypesRegistry([geoHashBucketAgg]); + const typesRegistry = mockAggTypesRegistry(); const getAggConfigs = (params?: Record) => { const indexPattern = { id: '1234', @@ -62,7 +63,7 @@ describe('Geohash Agg', () => { }, }, ], - null + { typesRegistry } ); }; diff --git a/src/legacy/core_plugins/data/public/search/aggs/buckets/geo_tile.ts b/src/legacy/core_plugins/data/public/search/aggs/buckets/geo_tile.ts index 57e8f6e8c5ded..9142a30338163 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/buckets/geo_tile.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/buckets/geo_tile.ts @@ -19,7 +19,6 @@ import { i18n } from '@kbn/i18n'; import { noop } from 'lodash'; -import { AggConfigOptions } from '../agg_config'; import { BucketAggType } from './_bucket_agg_type'; import { BUCKET_TYPES } from './bucket_agg_types'; @@ -57,7 +56,7 @@ export const geoTileBucketAgg = new BucketAggType({ aggs.push(agg); if (useGeocentroid) { - const aggConfig: AggConfigOptions = { + const aggConfig = { type: METRIC_TYPES.GEO_CENTROID, enabled: true, params: { diff --git a/src/legacy/core_plugins/data/public/search/aggs/buckets/histogram.test.ts b/src/legacy/core_plugins/data/public/search/aggs/buckets/histogram.test.ts index 4e89d7db1ff64..11dc8e42fd653 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/buckets/histogram.test.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/buckets/histogram.test.ts @@ -17,16 +17,23 @@ * under the License. */ -import { npStart } from 'ui/new_platform'; -import { AggConfigs } from '../index'; +import { AggConfigs } from '../agg_configs'; +import { mockDataServices, mockAggTypesRegistry } from '../test_helpers'; import { BUCKET_TYPES } from './bucket_agg_types'; import { IBucketHistogramAggConfig, histogramBucketAgg, AutoBounds } from './histogram'; import { BucketAggType } from './_bucket_agg_type'; - -jest.mock('ui/new_platform'); +import { coreMock } from '../../../../../../../../src/core/public/mocks'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { setUiSettings } from '../../../../../../../plugins/data/public/services'; describe('Histogram Agg', () => { - const getAggConfigs = (params: Record = {}) => { + beforeEach(() => { + mockDataServices(); + }); + + const typesRegistry = mockAggTypesRegistry([histogramBucketAgg]); + + const getAggConfigs = (params: Record) => { const indexPattern = { id: '1234', title: 'logstash-*', @@ -45,16 +52,13 @@ describe('Histogram Agg', () => { indexPattern, [ { - field: { - name: 'field', - }, id: 'test', type: BUCKET_TYPES.HISTOGRAM, schema: 'segment', params, }, ], - null + { typesRegistry } ); }; @@ -158,10 +162,15 @@ describe('Histogram Agg', () => { aggConfig.setAutoBounds(autoBounds); } - // mock histogram:maxBars value; - npStart.core.uiSettings.get = jest.fn(() => maxBars as any); + const core = coreMock.createStart(); + setUiSettings({ + ...core.uiSettings, + get: () => maxBars as any, + }); - return aggConfig.write(aggConfigs).params; + const interval = aggConfig.write(aggConfigs).params; + setUiSettings(core.uiSettings); // clean up + return interval; }; it('will respect the histogram:maxBars setting', () => { diff --git a/src/legacy/core_plugins/data/public/search/aggs/buckets/histogram.ts b/src/legacy/core_plugins/data/public/search/aggs/buckets/histogram.ts index f7e9ef45961e0..70df2f230db09 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/buckets/histogram.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/buckets/histogram.ts @@ -19,13 +19,13 @@ import _ from 'lodash'; import { i18n } from '@kbn/i18n'; -import { toastNotifications } from 'ui/notify'; -import { npStart } from 'ui/new_platform'; import { BucketAggType, IBucketAggConfig } from './_bucket_agg_type'; import { createFilterHistogram } from './create_filter/histogram'; -import { KBN_FIELD_TYPES } from '../../../../../../../plugins/data/public'; import { BUCKET_TYPES } from './bucket_agg_types'; +import { KBN_FIELD_TYPES } from '../../../../../../../plugins/data/public'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { getNotifications, getUiSettings } from '../../../../../../../plugins/data/public/services'; export interface AutoBounds { min: number; @@ -37,8 +37,6 @@ export interface IBucketHistogramAggConfig extends IBucketAggConfig { getAutoBounds: () => AutoBounds; } -const getUIConfig = () => npStart.core.uiSettings; - export const histogramBucketAgg = new BucketAggType({ name: BUCKET_TYPES.HISTOGRAM, title: i18n.translate('data.search.aggs.buckets.histogramTitle', { @@ -116,7 +114,7 @@ export const histogramBucketAgg = new BucketAggType({ }) .catch((e: Error) => { if (e.name === 'AbortError') return; - toastNotifications.addWarning( + getNotifications().toasts.addWarning( i18n.translate('data.search.aggs.histogram.missingMaxMinValuesWarning', { defaultMessage: 'Unable to retrieve max and min values to auto-scale histogram buckets. This may lead to poor visualization performance.', @@ -136,7 +134,7 @@ export const histogramBucketAgg = new BucketAggType({ const range = autoBounds.max - autoBounds.min; const bars = range / interval; - const config = getUIConfig(); + const config = getUiSettings(); if (bars > config.get('histogram:maxBars')) { const minInterval = range / config.get('histogram:maxBars'); diff --git a/src/legacy/core_plugins/data/public/search/aggs/buckets/ip_range.ts b/src/legacy/core_plugins/data/public/search/aggs/buckets/ip_range.ts index 91bdf53e7f809..3fb464d8fa7a8 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/buckets/ip_range.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/buckets/ip_range.ts @@ -19,15 +19,17 @@ import { noop, map, omit, isNull } from 'lodash'; import { i18n } from '@kbn/i18n'; -import { npStart } from 'ui/new_platform'; -import { IpRangeKey, convertIPRangeToString } from './lib/ip_range'; import { BucketAggType } from './_bucket_agg_type'; import { BUCKET_TYPES } from './bucket_agg_types'; -// @ts-ignore import { createFilterIpRange } from './create_filter/ip_range'; import { KBN_FIELD_TYPES, fieldFormats } from '../../../../../../../plugins/data/public'; -export { IpRangeKey, convertIPRangeToString }; + +import { IpRangeKey, convertIPRangeToString } from './lib/ip_range'; +export { IpRangeKey, convertIPRangeToString }; // for BWC + +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { getFieldFormats } from '../../../../../../../plugins/data/public/services'; const ipRangeTitle = i18n.translate('data.search.aggs.buckets.ipRangeTitle', { defaultMessage: 'IPv4 Range', @@ -44,7 +46,7 @@ export const ipRangeBucketAgg = new BucketAggType({ return { type: 'range', from: bucket.from, to: bucket.to }; }, getFormat(agg) { - const fieldFormatsService = npStart.plugins.data.fieldFormats; + const fieldFormatsService = getFieldFormats(); const formatter = agg.fieldOwnFormatter( fieldFormats.TEXT_CONTEXT_TYPE, fieldFormatsService.getDefaultInstance(KBN_FIELD_TYPES.IP) diff --git a/src/legacy/core_plugins/data/public/search/aggs/buckets/migrate_include_exclude_format.ts b/src/legacy/core_plugins/data/public/search/aggs/buckets/migrate_include_exclude_format.ts index 77e84e044de55..d94477b588f8d 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/buckets/migrate_include_exclude_format.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/buckets/migrate_include_exclude_format.ts @@ -19,10 +19,10 @@ import { isString, isObject } from 'lodash'; import { IBucketAggConfig, BucketAggType, BucketAggParam } from './_bucket_agg_type'; -import { AggConfig } from '../agg_config'; +import { IAggConfig } from '../agg_config'; export const isType = (type: string) => { - return (agg: AggConfig): boolean => { + return (agg: IAggConfig): boolean => { const field = agg.params.field; return field && field.type === type; diff --git a/src/legacy/core_plugins/data/public/search/aggs/buckets/range.test.ts b/src/legacy/core_plugins/data/public/search/aggs/buckets/range.test.ts index b1b0c4bc30a58..096b19fe7de66 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/buckets/range.test.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/buckets/range.test.ts @@ -17,12 +17,12 @@ * under the License. */ +import { rangeBucketAgg } from './range'; import { AggConfigs } from '../agg_configs'; +import { mockDataServices, mockAggTypesRegistry } from '../test_helpers'; import { BUCKET_TYPES } from './bucket_agg_types'; import { FieldFormatsGetConfigFn, fieldFormats } from '../../../../../../../plugins/data/public'; -jest.mock('ui/new_platform'); - const buckets = [ { to: 1024, @@ -44,6 +44,12 @@ const buckets = [ ]; describe('Range Agg', () => { + beforeEach(() => { + mockDataServices(); + }); + + const typesRegistry = mockAggTypesRegistry([rangeBucketAgg]); + const getConfig = (() => {}) as FieldFormatsGetConfigFn; const getAggConfigs = () => { const field = { @@ -80,7 +86,7 @@ describe('Range Agg', () => { }, }, ], - null + { typesRegistry } ); }; diff --git a/src/legacy/core_plugins/data/public/search/aggs/buckets/significant_terms.test.ts b/src/legacy/core_plugins/data/public/search/aggs/buckets/significant_terms.test.ts index 37b829bfc20fb..cee3ed506c29c 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/buckets/significant_terms.test.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/buckets/significant_terms.test.ts @@ -17,17 +17,16 @@ * under the License. */ -import { AggConfigs } from '../index'; -import { IAggConfigs } from '../types'; +import { AggConfigs, IAggConfigs } from '../agg_configs'; +import { mockAggTypesRegistry } from '../test_helpers'; import { BUCKET_TYPES } from './bucket_agg_types'; import { significantTermsBucketAgg } from './significant_terms'; import { IBucketAggConfig } from './_bucket_agg_type'; -jest.mock('ui/new_platform'); - describe('Significant Terms Agg', () => { describe('order agg editor UI', () => { describe('convert include/exclude from old format', () => { + const typesRegistry = mockAggTypesRegistry([significantTermsBucketAgg]); const getAggConfigs = (params: Record = {}) => { const indexPattern = { id: '1234', @@ -53,7 +52,7 @@ describe('Significant Terms Agg', () => { params, }, ], - null + { typesRegistry } ); }; diff --git a/src/legacy/core_plugins/data/public/search/aggs/buckets/terms.test.ts b/src/legacy/core_plugins/data/public/search/aggs/buckets/terms.test.ts index 24ac332ae4d55..9a4f28afd3edf 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/buckets/terms.test.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/buckets/terms.test.ts @@ -17,13 +17,13 @@ * under the License. */ -import { AggConfigs } from '../index'; +import { AggConfigs } from '../agg_configs'; +import { mockAggTypesRegistry } from '../test_helpers'; import { BUCKET_TYPES } from './bucket_agg_types'; -jest.mock('ui/new_platform'); - describe('Terms Agg', () => { describe('order agg editor UI', () => { + const typesRegistry = mockAggTypesRegistry(); const getAggConfigs = (params: Record = {}) => { const indexPattern = { id: '1234', @@ -48,7 +48,7 @@ describe('Terms Agg', () => { type: BUCKET_TYPES.TERMS, }, ], - null + { typesRegistry } ); }; diff --git a/src/legacy/core_plugins/data/public/search/aggs/filter/agg_type_filters.test.ts b/src/legacy/core_plugins/data/public/search/aggs/filter/agg_type_filters.test.ts index cc1288d339692..0de1c31d02f96 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/filter/agg_type_filters.test.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/filter/agg_type_filters.test.ts @@ -19,13 +19,12 @@ import { IndexPattern } from '../../../../../../../plugins/data/public'; import { AggTypeFilters } from './agg_type_filters'; -import { AggConfig } from '..'; -import { IAggType } from '../types'; +import { IAggConfig, IAggType } from '../types'; describe('AggTypeFilters', () => { let registry: AggTypeFilters; const indexPattern = ({ id: '1234', fields: [], title: 'foo' } as unknown) as IndexPattern; - const aggConfig = {} as AggConfig; + const aggConfig = {} as IAggConfig; beforeEach(() => { registry = new AggTypeFilters(); diff --git a/src/legacy/core_plugins/data/public/search/aggs/filter/agg_type_filters.ts b/src/legacy/core_plugins/data/public/search/aggs/filter/agg_type_filters.ts index d3b38ce041d7e..13a4cc0856b09 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/filter/agg_type_filters.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/filter/agg_type_filters.ts @@ -16,6 +16,7 @@ * specific language governing permissions and limitations * under the License. */ + import { IndexPattern } from 'src/plugins/data/public'; import { IAggConfig, IAggType } from '../types'; diff --git a/src/legacy/core_plugins/data/public/search/aggs/filter/prop_filter.test.ts b/src/legacy/core_plugins/data/public/search/aggs/filter/prop_filter.test.ts index 431e1161e0dbd..32cda7b950e93 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/filter/prop_filter.test.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/filter/prop_filter.test.ts @@ -17,7 +17,6 @@ * under the License. */ -import expect from '@kbn/expect'; import { propFilter } from './prop_filter'; describe('prop filter', () => { @@ -47,48 +46,48 @@ describe('prop filter', () => { it('returns list when no filters are provided', () => { const objects = getObjects('table', 'table', 'pie'); - expect(nameFilter(objects)).to.eql(objects); + expect(nameFilter(objects)).toEqual(objects); }); it('returns list when empty list of filters is provided', () => { const objects = getObjects('table', 'table', 'pie'); - expect(nameFilter(objects, [])).to.eql(objects); + expect(nameFilter(objects, [])).toEqual(objects); }); it('should keep only the tables', () => { const objects = getObjects('table', 'table', 'pie'); - expect(nameFilter(objects, 'table')).to.eql(getObjects('table', 'table')); + expect(nameFilter(objects, 'table')).toEqual(getObjects('table', 'table')); }); it('should support comma-separated values', () => { const objects = getObjects('table', 'line', 'pie'); - expect(nameFilter(objects, 'table,line')).to.eql(getObjects('table', 'line')); + expect(nameFilter(objects, 'table,line')).toEqual(getObjects('table', 'line')); }); it('should support an array of values', () => { const objects = getObjects('table', 'line', 'pie'); - expect(nameFilter(objects, ['table', 'line'])).to.eql(getObjects('table', 'line')); + expect(nameFilter(objects, ['table', 'line'])).toEqual(getObjects('table', 'line')); }); it('should return all objects', () => { const objects = getObjects('table', 'line', 'pie'); - expect(nameFilter(objects, '*')).to.eql(objects); + expect(nameFilter(objects, '*')).toEqual(objects); }); it('should allow negation', () => { const objects = getObjects('table', 'line', 'pie'); - expect(nameFilter(objects, ['!line'])).to.eql(getObjects('table', 'pie')); + expect(nameFilter(objects, ['!line'])).toEqual(getObjects('table', 'pie')); }); it('should support a function for specifying what should be kept', () => { const objects = getObjects('table', 'line', 'pie'); const line = (value: string) => value === 'line'; - expect(nameFilter(objects, line)).to.eql(getObjects('line')); + expect(nameFilter(objects, line)).toEqual(getObjects('line')); }); it('gracefully handles a filter function with zero arity', () => { const objects = getObjects('table', 'line', 'pie'); const rejectEverything = () => false; - expect(nameFilter(objects, rejectEverything)).to.eql([]); + expect(nameFilter(objects, rejectEverything)).toEqual([]); }); }); diff --git a/src/legacy/core_plugins/data/public/search/aggs/index.test.ts b/src/legacy/core_plugins/data/public/search/aggs/index.test.ts index a867769a77fc1..4d0cd55b09d53 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/index.test.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/index.test.ts @@ -25,8 +25,6 @@ import { isMetricAggType } from './metrics/metric_agg_type'; const bucketAggs = aggTypes.buckets; const metricAggs = aggTypes.metrics; -jest.mock('ui/new_platform'); - describe('AggTypesComponent', () => { describe('bucket aggs', () => { it('all extend BucketAggType', () => { diff --git a/src/legacy/core_plugins/data/public/search/aggs/index.ts b/src/legacy/core_plugins/data/public/search/aggs/index.ts index 0bdb92b8de65e..f6914c36f6c05 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/index.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/index.ts @@ -17,8 +17,13 @@ * under the License. */ -export { aggTypes } from './agg_types'; +export { + AggTypesRegistry, + AggTypesRegistrySetup, + AggTypesRegistryStart, +} from './agg_types_registry'; export { AggType } from './agg_type'; +export { aggTypes } from './agg_types'; export { AggConfig } from './agg_config'; export { AggConfigs } from './agg_configs'; export { FieldParamType } from './param_types'; @@ -52,4 +57,4 @@ export { METRIC_TYPES } from './metrics/metric_agg_types'; export { ISchemas, Schema, Schemas } from './schemas'; // types -export { IAggConfig, IAggConfigs } from './types'; +export { CreateAggConfigParams, IAggConfig, IAggConfigs } from './types'; diff --git a/src/legacy/core_plugins/data/public/search/aggs/metrics/bucket_avg.ts b/src/legacy/core_plugins/data/public/search/aggs/metrics/bucket_avg.ts index 9fb28f8631bc6..11bb559274729 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/metrics/bucket_avg.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/metrics/bucket_avg.ts @@ -19,7 +19,6 @@ import { i18n } from '@kbn/i18n'; import { get } from 'lodash'; - import { MetricAggType } from './metric_agg_type'; import { makeNestedLabel } from './lib/make_nested_label'; import { siblingPipelineAggHelper } from './lib/sibling_pipeline_agg_helper'; diff --git a/src/legacy/core_plugins/data/public/search/aggs/metrics/bucket_max.ts b/src/legacy/core_plugins/data/public/search/aggs/metrics/bucket_max.ts index 83837f0de5114..0668a9bcf57a8 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/metrics/bucket_max.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/metrics/bucket_max.ts @@ -18,7 +18,6 @@ */ import { i18n } from '@kbn/i18n'; - import { MetricAggType } from './metric_agg_type'; import { makeNestedLabel } from './lib/make_nested_label'; import { siblingPipelineAggHelper } from './lib/sibling_pipeline_agg_helper'; diff --git a/src/legacy/core_plugins/data/public/search/aggs/metrics/bucket_min.ts b/src/legacy/core_plugins/data/public/search/aggs/metrics/bucket_min.ts index d96197693dc2e..8f728cb5e7e42 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/metrics/bucket_min.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/metrics/bucket_min.ts @@ -16,6 +16,7 @@ * specific language governing permissions and limitations * under the License. */ + import { i18n } from '@kbn/i18n'; import { MetricAggType } from './metric_agg_type'; import { makeNestedLabel } from './lib/make_nested_label'; diff --git a/src/legacy/core_plugins/data/public/search/aggs/metrics/cardinality.ts b/src/legacy/core_plugins/data/public/search/aggs/metrics/cardinality.ts index 147e925521088..4f7b6e555ca33 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/metrics/cardinality.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/metrics/cardinality.ts @@ -18,10 +18,11 @@ */ import { i18n } from '@kbn/i18n'; -import { npStart } from 'ui/new_platform'; import { MetricAggType } from './metric_agg_type'; import { METRIC_TYPES } from './metric_agg_types'; import { KBN_FIELD_TYPES } from '../../../../../../../plugins/data/public'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { getFieldFormats } from '../../../../../../../plugins/data/public/services'; const uniqueCountTitle = i18n.translate('data.search.aggs.metrics.uniqueCountTitle', { defaultMessage: 'Unique Count', @@ -37,7 +38,7 @@ export const cardinalityMetricAgg = new MetricAggType({ }); }, getFormat() { - const fieldFormatsService = npStart.plugins.data.fieldFormats; + const fieldFormatsService = getFieldFormats(); return fieldFormatsService.getDefaultInstance(KBN_FIELD_TYPES.NUMBER); }, diff --git a/src/legacy/core_plugins/data/public/search/aggs/metrics/count.ts b/src/legacy/core_plugins/data/public/search/aggs/metrics/count.ts index 14a9bd073ff2b..8b3e0a488c68a 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/metrics/count.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/metrics/count.ts @@ -18,10 +18,11 @@ */ import { i18n } from '@kbn/i18n'; -import { npStart } from 'ui/new_platform'; -import { KBN_FIELD_TYPES } from '../../../../../../../plugins/data/public'; import { MetricAggType } from './metric_agg_type'; import { METRIC_TYPES } from './metric_agg_types'; +import { KBN_FIELD_TYPES } from '../../../../../../../plugins/data/public'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { getFieldFormats } from '../../../../../../../plugins/data/public/services'; export const countMetricAgg = new MetricAggType({ name: METRIC_TYPES.COUNT, @@ -35,7 +36,7 @@ export const countMetricAgg = new MetricAggType({ }); }, getFormat() { - const fieldFormatsService = npStart.plugins.data.fieldFormats; + const fieldFormatsService = getFieldFormats(); return fieldFormatsService.getDefaultInstance(KBN_FIELD_TYPES.NUMBER); }, diff --git a/src/legacy/core_plugins/data/public/search/aggs/metrics/lib/get_response_agg_config_class.ts b/src/legacy/core_plugins/data/public/search/aggs/metrics/lib/get_response_agg_config_class.ts index 054543de3dd06..00d866e6f2b3e 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/metrics/lib/get_response_agg_config_class.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/metrics/lib/get_response_agg_config_class.ts @@ -16,6 +16,7 @@ * specific language governing permissions and limitations * under the License. */ + import { assign } from 'lodash'; import { IMetricAggConfig } from '../metric_agg_type'; diff --git a/src/legacy/core_plugins/data/public/search/aggs/metrics/lib/parent_pipeline_agg_helper.ts b/src/legacy/core_plugins/data/public/search/aggs/metrics/lib/parent_pipeline_agg_helper.ts index e24aca08271c7..88549ee3019ee 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/metrics/lib/parent_pipeline_agg_helper.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/metrics/lib/parent_pipeline_agg_helper.ts @@ -23,7 +23,6 @@ import { noop, identity } from 'lodash'; import { forwardModifyAggConfigOnSearchRequestStart } from './nested_agg_helpers'; import { IMetricAggConfig, MetricAggParam } from '../metric_agg_type'; import { parentPipelineAggWriter } from './parent_pipeline_agg_writer'; - import { Schemas } from '../../schemas'; import { fieldFormats } from '../../../../../../../../plugins/data/public'; diff --git a/src/legacy/core_plugins/data/public/search/aggs/metrics/lib/sibling_pipeline_agg_helper.ts b/src/legacy/core_plugins/data/public/search/aggs/metrics/lib/sibling_pipeline_agg_helper.ts index e7c98e575fdb4..05e009cc9da30 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/metrics/lib/sibling_pipeline_agg_helper.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/metrics/lib/sibling_pipeline_agg_helper.ts @@ -21,7 +21,6 @@ import { identity } from 'lodash'; import { i18n } from '@kbn/i18n'; import { siblingPipelineAggWriter } from './sibling_pipeline_agg_writer'; import { forwardModifyAggConfigOnSearchRequestStart } from './nested_agg_helpers'; - import { IMetricAggConfig, MetricAggParam } from '../metric_agg_type'; import { Schemas } from '../../schemas'; import { fieldFormats } from '../../../../../../../../plugins/data/public'; diff --git a/src/legacy/core_plugins/data/public/search/aggs/metrics/median.test.ts b/src/legacy/core_plugins/data/public/search/aggs/metrics/median.test.ts index 4755a873e6977..ad55837ec9a30 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/metrics/median.test.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/metrics/median.test.ts @@ -17,15 +17,16 @@ * under the License. */ +import { medianMetricAgg } from './median'; import { AggConfigs, IAggConfigs } from '../agg_configs'; +import { mockAggTypesRegistry } from '../test_helpers'; import { METRIC_TYPES } from './metric_agg_types'; -jest.mock('ui/new_platform'); - describe('AggTypeMetricMedianProvider class', () => { let aggConfigs: IAggConfigs; beforeEach(() => { + const typesRegistry = mockAggTypesRegistry([medianMetricAgg]); const field = { name: 'bytes', }; @@ -50,7 +51,7 @@ describe('AggTypeMetricMedianProvider class', () => { }, }, ], - null + { typesRegistry } ); }); diff --git a/src/legacy/core_plugins/data/public/search/aggs/metrics/median.ts b/src/legacy/core_plugins/data/public/search/aggs/metrics/median.ts index 53a5ffff418f1..68fc98261118c 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/metrics/median.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/metrics/median.ts @@ -16,12 +16,10 @@ * specific language governing permissions and limitations * under the License. */ + import { i18n } from '@kbn/i18n'; import { MetricAggType } from './metric_agg_type'; import { METRIC_TYPES } from './metric_agg_types'; - -// @ts-ignore -import { percentilesMetricAgg } from './percentiles'; import { KBN_FIELD_TYPES } from '../../../../../../../plugins/data/public'; const medianTitle = i18n.translate('data.search.aggs.metrics.medianTitle', { diff --git a/src/legacy/core_plugins/data/public/search/aggs/metrics/metric_agg_type.ts b/src/legacy/core_plugins/data/public/search/aggs/metrics/metric_agg_type.ts index 3bae7b92618dc..952dcc96de833 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/metrics/metric_agg_type.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/metrics/metric_agg_type.ts @@ -18,13 +18,14 @@ */ import { i18n } from '@kbn/i18n'; -import { npStart } from 'ui/new_platform'; import { AggType, AggTypeConfig } from '../agg_type'; import { AggParamType } from '../param_types/agg'; import { AggConfig } from '../agg_config'; +import { FilterFieldTypes } from '../param_types/field'; import { METRIC_TYPES } from './metric_agg_types'; import { KBN_FIELD_TYPES } from '../../../../../../../plugins/data/public'; -import { FilterFieldTypes } from '../param_types/field'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { getFieldFormats } from '../../../../../../../plugins/data/public/services'; export interface IMetricAggConfig extends AggConfig { type: InstanceType; @@ -78,7 +79,7 @@ export class MetricAggType { - const fieldFormatsService = npStart.plugins.data.fieldFormats; + const fieldFormatsService = getFieldFormats(); const field = agg.getField(); return field ? field.format diff --git a/src/legacy/core_plugins/data/public/search/aggs/metrics/min.ts b/src/legacy/core_plugins/data/public/search/aggs/metrics/min.ts index 4885105163435..1806c6d9d7710 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/metrics/min.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/metrics/min.ts @@ -16,6 +16,7 @@ * specific language governing permissions and limitations * under the License. */ + import { i18n } from '@kbn/i18n'; import { MetricAggType } from './metric_agg_type'; import { METRIC_TYPES } from './metric_agg_types'; diff --git a/src/legacy/core_plugins/data/public/search/aggs/metrics/parent_pipeline.test.ts b/src/legacy/core_plugins/data/public/search/aggs/metrics/parent_pipeline.test.ts index 11fc39c20bdc4..58b4ee530a8c2 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/metrics/parent_pipeline.test.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/metrics/parent_pipeline.test.ts @@ -17,12 +17,12 @@ * under the License. */ -import sinon from 'sinon'; import { derivativeMetricAgg } from './derivative'; import { cumulativeSumMetricAgg } from './cumulative_sum'; import { movingAvgMetricAgg } from './moving_avg'; import { serialDiffMetricAgg } from './serial_diff'; import { AggConfigs } from '../agg_configs'; +import { mockDataServices, mockAggTypesRegistry } from '../test_helpers'; import { IMetricAggConfig, MetricAggType } from './metric_agg_type'; jest.mock('../schemas', () => { @@ -34,9 +34,13 @@ jest.mock('../schemas', () => { }; }); -jest.mock('ui/new_platform'); - describe('parent pipeline aggs', function() { + beforeEach(() => { + mockDataServices(); + }); + + const typesRegistry = mockAggTypesRegistry(); + const metrics = [ { name: 'derivative', title: 'Derivative', provider: derivativeMetricAgg }, { name: 'cumulative_sum', title: 'Cumulative Sum', provider: cumulativeSumMetricAgg }, @@ -94,7 +98,7 @@ describe('parent pipeline aggs', function() { schema: 'metric', }, ], - null + { typesRegistry } ); // Grab the aggConfig off the vis (we don't actually use the vis for anything else) @@ -220,16 +224,16 @@ describe('parent pipeline aggs', function() { }); const searchSource: any = {}; - const customMetricSpy = sinon.spy(); + const customMetricSpy = jest.fn(); const customMetric = aggConfig.params.customMetric; // Attach a modifyAggConfigOnSearchRequestStart with a spy to the first parameter customMetric.type.params[0].modifyAggConfigOnSearchRequestStart = customMetricSpy; aggConfig.type.params.forEach(param => { - param.modifyAggConfigOnSearchRequestStart(aggConfig, searchSource); + param.modifyAggConfigOnSearchRequestStart(aggConfig, searchSource, {}); }); - expect(customMetricSpy.calledWith(customMetric, searchSource)).toBe(true); + expect(customMetricSpy.mock.calls[0]).toEqual([customMetric, searchSource, {}]); }); }); }); diff --git a/src/legacy/core_plugins/data/public/search/aggs/metrics/percentile_ranks.test.ts b/src/legacy/core_plugins/data/public/search/aggs/metrics/percentile_ranks.test.ts index 655e918ce07de..628f1cd204ee5 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/metrics/percentile_ranks.test.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/metrics/percentile_ranks.test.ts @@ -19,14 +19,16 @@ import { IPercentileRanksAggConfig, percentileRanksMetricAgg } from './percentile_ranks'; import { AggConfigs, IAggConfigs } from '../agg_configs'; +import { mockDataServices, mockAggTypesRegistry } from '../test_helpers'; import { METRIC_TYPES } from './metric_agg_types'; -jest.mock('ui/new_platform'); - describe('AggTypesMetricsPercentileRanksProvider class', function() { let aggConfigs: IAggConfigs; beforeEach(() => { + mockDataServices(); + + const typesRegistry = mockAggTypesRegistry([percentileRanksMetricAgg]); const field = { name: 'bytes', }; @@ -58,7 +60,7 @@ describe('AggTypesMetricsPercentileRanksProvider class', function() { }, }, ], - null + { typesRegistry } ); }); diff --git a/src/legacy/core_plugins/data/public/search/aggs/metrics/percentile_ranks.ts b/src/legacy/core_plugins/data/public/search/aggs/metrics/percentile_ranks.ts index 38b47a7e97d2f..1d640a9c1fa42 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/metrics/percentile_ranks.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/metrics/percentile_ranks.ts @@ -18,20 +18,17 @@ */ import { i18n } from '@kbn/i18n'; -import { npStart } from 'ui/new_platform'; import { MetricAggType } from './metric_agg_type'; import { getResponseAggConfigClass, IResponseAggConfig } from './lib/get_response_agg_config_class'; - import { getPercentileValue } from './percentiles_get_value'; import { METRIC_TYPES } from './metric_agg_types'; import { fieldFormats, KBN_FIELD_TYPES } from '../../../../../../../plugins/data/public'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { getFieldFormats } from '../../../../../../../plugins/data/public/services'; // required by the values editor - export type IPercentileRanksAggConfig = IResponseAggConfig; -const getFieldFormats = () => npStart.plugins.data.fieldFormats; - const valueProps = { makeLabel(this: IPercentileRanksAggConfig) { const fieldFormatsService = getFieldFormats(); diff --git a/src/legacy/core_plugins/data/public/search/aggs/metrics/percentiles.test.ts b/src/legacy/core_plugins/data/public/search/aggs/metrics/percentiles.test.ts index dd1aaca973e47..e077bc0f8c773 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/metrics/percentiles.test.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/metrics/percentiles.test.ts @@ -19,14 +19,14 @@ import { IPercentileAggConfig, percentilesMetricAgg } from './percentiles'; import { AggConfigs, IAggConfigs } from '../agg_configs'; +import { mockAggTypesRegistry } from '../test_helpers'; import { METRIC_TYPES } from './metric_agg_types'; -jest.mock('ui/new_platform'); - describe('AggTypesMetricsPercentilesProvider class', () => { let aggConfigs: IAggConfigs; beforeEach(() => { + const typesRegistry = mockAggTypesRegistry([percentilesMetricAgg]); const field = { name: 'bytes', }; @@ -58,7 +58,7 @@ describe('AggTypesMetricsPercentilesProvider class', () => { }, }, ], - null + { typesRegistry } ); }); diff --git a/src/legacy/core_plugins/data/public/search/aggs/metrics/percentiles.ts b/src/legacy/core_plugins/data/public/search/aggs/metrics/percentiles.ts index 39dc0d0f181e9..49e927d07d8dd 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/metrics/percentiles.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/metrics/percentiles.ts @@ -18,15 +18,11 @@ */ import { i18n } from '@kbn/i18n'; - import { MetricAggType } from './metric_agg_type'; import { METRIC_TYPES } from './metric_agg_types'; import { KBN_FIELD_TYPES } from '../../../../../../../plugins/data/public'; - import { getResponseAggConfigClass, IResponseAggConfig } from './lib/get_response_agg_config_class'; import { getPercentileValue } from './percentiles_get_value'; - -// @ts-ignore import { ordinalSuffix } from './lib/ordinal_suffix'; export type IPercentileAggConfig = IResponseAggConfig; diff --git a/src/legacy/core_plugins/data/public/search/aggs/metrics/sibling_pipeline.test.ts b/src/legacy/core_plugins/data/public/search/aggs/metrics/sibling_pipeline.test.ts index d643cf0d2a478..d3456bacceb6a 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/metrics/sibling_pipeline.test.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/metrics/sibling_pipeline.test.ts @@ -17,7 +17,6 @@ * under the License. */ -import { spy } from 'sinon'; import { bucketSumMetricAgg } from './bucket_sum'; import { bucketAvgMetricAgg } from './bucket_avg'; import { bucketMinMetricAgg } from './bucket_min'; @@ -25,6 +24,7 @@ import { bucketMaxMetricAgg } from './bucket_max'; import { AggConfigs } from '../agg_configs'; import { IMetricAggConfig, MetricAggType } from './metric_agg_type'; +import { mockDataServices, mockAggTypesRegistry } from '../test_helpers'; jest.mock('../schemas', () => { class MockedSchemas { @@ -35,9 +35,13 @@ jest.mock('../schemas', () => { }; }); -jest.mock('ui/new_platform'); - describe('sibling pipeline aggs', () => { + beforeEach(() => { + mockDataServices(); + }); + + const typesRegistry = mockAggTypesRegistry(); + const metrics = [ { name: 'sum_bucket', title: 'Overall Sum', provider: bucketSumMetricAgg }, { name: 'avg_bucket', title: 'Overall Average', provider: bucketAvgMetricAgg }, @@ -96,7 +100,7 @@ describe('sibling pipeline aggs', () => { }, }, ], - null + { typesRegistry } ); // Grab the aggConfig off the vis (we don't actually use the vis for anything else) @@ -162,8 +166,8 @@ describe('sibling pipeline aggs', () => { init(); const searchSource: any = {}; - const customMetricSpy = spy(); - const customBucketSpy = spy(); + const customMetricSpy = jest.fn(); + const customBucketSpy = jest.fn(); const { customMetric, customBucket } = aggConfig.params; // Attach a modifyAggConfigOnSearchRequestStart with a spy to the first parameter @@ -171,11 +175,11 @@ describe('sibling pipeline aggs', () => { customBucket.type.params[0].modifyAggConfigOnSearchRequestStart = customBucketSpy; aggConfig.type.params.forEach(param => { - param.modifyAggConfigOnSearchRequestStart(aggConfig, searchSource); + param.modifyAggConfigOnSearchRequestStart(aggConfig, searchSource, {}); }); - expect(customMetricSpy.calledWith(customMetric, searchSource)).toBe(true); - expect(customBucketSpy.calledWith(customBucket, searchSource)).toBe(true); + expect(customMetricSpy.mock.calls[0]).toEqual([customMetric, searchSource, {}]); + expect(customBucketSpy.mock.calls[0]).toEqual([customBucket, searchSource, {}]); }); }); }); diff --git a/src/legacy/core_plugins/data/public/search/aggs/metrics/std_deviation.test.ts b/src/legacy/core_plugins/data/public/search/aggs/metrics/std_deviation.test.ts index 3125026a52185..0679831b1e6ac 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/metrics/std_deviation.test.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/metrics/std_deviation.test.ts @@ -19,11 +19,11 @@ import { IStdDevAggConfig, stdDeviationMetricAgg } from './std_deviation'; import { AggConfigs } from '../agg_configs'; +import { mockAggTypesRegistry } from '../test_helpers'; import { METRIC_TYPES } from './metric_agg_types'; -jest.mock('ui/new_platform'); - describe('AggTypeMetricStandardDeviationProvider class', () => { + const typesRegistry = mockAggTypesRegistry([stdDeviationMetricAgg]); const getAggConfigs = (customLabel?: string) => { const field = { name: 'memory', @@ -52,7 +52,7 @@ describe('AggTypeMetricStandardDeviationProvider class', () => { }, }, ], - null + { typesRegistry } ); }; diff --git a/src/legacy/core_plugins/data/public/search/aggs/metrics/top_hit.test.ts b/src/legacy/core_plugins/data/public/search/aggs/metrics/top_hit.test.ts index a973de4fe8659..ad1f42f5c563e 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/metrics/top_hit.test.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/metrics/top_hit.test.ts @@ -20,11 +20,10 @@ import { dropRight, last } from 'lodash'; import { topHitMetricAgg } from './top_hit'; import { AggConfigs } from '../agg_configs'; +import { mockAggTypesRegistry } from '../test_helpers'; import { IMetricAggConfig } from './metric_agg_type'; import { KBN_FIELD_TYPES } from '../../../../../../../plugins/data/public'; -jest.mock('ui/new_platform'); - describe('Top hit metric', () => { let aggDsl: Record; let aggConfig: IMetricAggConfig; @@ -37,6 +36,7 @@ describe('Top hit metric', () => { fieldType = KBN_FIELD_TYPES.NUMBER, size = 1, }: any) => { + const typesRegistry = mockAggTypesRegistry([topHitMetricAgg]); const field = { name: fieldName, displayName: fieldName, @@ -81,7 +81,7 @@ describe('Top hit metric', () => { params, }, ], - null + { typesRegistry } ); // Grab the aggConfig off the vis (we don't actually use the vis for anything else) diff --git a/src/legacy/core_plugins/data/public/search/aggs/param_types/agg.ts b/src/legacy/core_plugins/data/public/search/aggs/param_types/agg.ts index 2e7c11004b472..d31abe64491d0 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/param_types/agg.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/param_types/agg.ts @@ -17,10 +17,10 @@ * under the License. */ -import { AggConfig } from '../agg_config'; +import { AggConfig, IAggConfig } from '../agg_config'; import { BaseParamType } from './base'; -export class AggParamType extends BaseParamType< +export class AggParamType extends BaseParamType< TAggConfig > { makeAgg: (agg: TAggConfig, state?: any) => TAggConfig; diff --git a/src/legacy/core_plugins/data/public/search/aggs/param_types/base.ts b/src/legacy/core_plugins/data/public/search/aggs/param_types/base.ts index 1523cb03eb966..95ad71a616ab2 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/param_types/base.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/param_types/base.ts @@ -18,10 +18,10 @@ */ import { IAggConfigs } from '../agg_configs'; -import { AggConfig } from '../agg_config'; +import { IAggConfig } from '../agg_config'; import { FetchOptions, ISearchSource } from '../../../../../../../plugins/data/public'; -export class BaseParamType { +export class BaseParamType { name: string; type: string; displayName: string; diff --git a/src/legacy/core_plugins/data/public/search/aggs/param_types/field.test.ts b/src/legacy/core_plugins/data/public/search/aggs/param_types/field.test.ts index fa88754ac60b9..7338c41f920d7 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/param_types/field.test.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/param_types/field.test.ts @@ -25,8 +25,6 @@ import { IAggConfig } from '../agg_config'; import { IMetricAggConfig } from '../metrics/metric_agg_type'; import { Schema } from '../schemas'; -jest.mock('ui/new_platform'); - describe('Field', () => { const indexPattern = { id: '1234', diff --git a/src/legacy/core_plugins/data/public/search/aggs/param_types/field.ts b/src/legacy/core_plugins/data/public/search/aggs/param_types/field.ts index 40c30f6210a83..bb5707cbb482e 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/param_types/field.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/param_types/field.ts @@ -19,7 +19,6 @@ import { i18n } from '@kbn/i18n'; import { isFunction } from 'lodash'; -import { npStart } from 'ui/new_platform'; import { IAggConfig } from '../agg_config'; import { SavedObjectNotFound } from '../../../../../../../plugins/kibana_utils/public'; import { BaseParamType } from './base'; @@ -30,6 +29,8 @@ import { indexPatterns, KBN_FIELD_TYPES, } from '../../../../../../../plugins/data/public'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { getNotifications } from '../../../../../../../plugins/data/public/services'; const filterByType = propFilter('type'); @@ -93,7 +94,7 @@ export class FieldParamType extends BaseParamType { // @ts-ignore const validField = this.getAvailableFields(aggConfig).find((f: any) => f.name === fieldName); if (!validField) { - npStart.core.notifications.toasts.addDanger( + getNotifications().toasts.addDanger( i18n.translate( 'data.search.aggs.paramTypes.field.invalidSavedFieldParameterErrorMessage', { diff --git a/src/legacy/core_plugins/data/public/search/aggs/param_types/filter/field_filters.test.ts b/src/legacy/core_plugins/data/public/search/aggs/param_types/filter/field_filters.test.ts index bc36bb46d3d16..1a453a225797d 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/param_types/filter/field_filters.test.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/param_types/filter/field_filters.test.ts @@ -17,27 +17,26 @@ * under the License. */ -import { IndexedArray } from 'ui/indexed_array'; import { AggTypeFieldFilters } from './field_filters'; -import { AggConfig } from '../../agg_config'; +import { IAggConfig } from '../../agg_config'; import { IndexPatternField } from '../../../../../../../../plugins/data/public'; describe('AggTypeFieldFilters', () => { let registry: AggTypeFieldFilters; - const aggConfig = {} as AggConfig; + const aggConfig = {} as IAggConfig; beforeEach(() => { registry = new AggTypeFieldFilters(); }); it('should filter nothing without registered filters', async () => { - const fields = [{ name: 'foo' }, { name: 'bar' }] as IndexedArray; + const fields = [{ name: 'foo' }, { name: 'bar' }] as IndexPatternField[]; const filtered = registry.filter(fields, aggConfig); expect(filtered).toEqual(fields); }); it('should pass all fields to the registered filter', async () => { - const fields = [{ name: 'foo' }, { name: 'bar' }] as IndexedArray; + const fields = [{ name: 'foo' }, { name: 'bar' }] as IndexPatternField[]; const filter = jest.fn(); registry.addFilter(filter); registry.filter(fields, aggConfig); @@ -46,7 +45,7 @@ describe('AggTypeFieldFilters', () => { }); it('should allow registered filters to filter out fields', async () => { - const fields = [{ name: 'foo' }, { name: 'bar' }] as IndexedArray; + const fields = [{ name: 'foo' }, { name: 'bar' }] as IndexPatternField[]; let filtered = registry.filter(fields, aggConfig); expect(filtered).toEqual(fields); diff --git a/src/legacy/core_plugins/data/public/search/aggs/param_types/filter/field_filters.ts b/src/legacy/core_plugins/data/public/search/aggs/param_types/filter/field_filters.ts index 7d1348ab5423b..1cbf0c9ae3624 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/param_types/filter/field_filters.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/param_types/filter/field_filters.ts @@ -17,9 +17,9 @@ * under the License. */ import { IndexPatternField } from 'src/plugins/data/public'; -import { AggConfig } from '../../agg_config'; +import { IAggConfig } from '../../agg_config'; -type AggTypeFieldFilter = (field: IndexPatternField, aggConfig: AggConfig) => boolean; +type AggTypeFieldFilter = (field: IndexPatternField, aggConfig: IAggConfig) => boolean; /** * A registry to store {@link AggTypeFieldFilter} which are used to filter down @@ -41,11 +41,11 @@ class AggTypeFieldFilters { /** * Returns the {@link any|fields} filtered by all registered filters. * - * @param fields An IndexedArray of fields that will be filtered down by this registry. + * @param fields An array of fields that will be filtered down by this registry. * @param aggConfig The aggConfig for which the returning list will be used. * @return A filtered list of the passed fields. */ - public filter(fields: IndexPatternField[], aggConfig: AggConfig) { + public filter(fields: IndexPatternField[], aggConfig: IAggConfig) { const allFilters = Array.from(this.filters); const allowedAggTypeFields = fields.filter(field => { const isAggTypeFieldAllowed = allFilters.every(filter => filter(field, aggConfig)); diff --git a/src/legacy/core_plugins/data/public/search/aggs/param_types/json.test.ts b/src/legacy/core_plugins/data/public/search/aggs/param_types/json.test.ts index 827299814c62a..12fd29b3a1452 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/param_types/json.test.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/param_types/json.test.ts @@ -19,13 +19,11 @@ import { BaseParamType } from './base'; import { JsonParamType } from './json'; -import { AggConfig } from '../agg_config'; - -jest.mock('ui/new_platform'); +import { IAggConfig } from '../agg_config'; describe('JSON', function() { const paramName = 'json_test'; - let aggConfig: AggConfig; + let aggConfig: IAggConfig; let output: Record; const initAggParam = (config: Record = {}) => @@ -36,7 +34,7 @@ describe('JSON', function() { }); beforeEach(function() { - aggConfig = { params: {} } as AggConfig; + aggConfig = { params: {} } as IAggConfig; output = { params: {} }; }); diff --git a/src/legacy/core_plugins/data/public/search/aggs/param_types/json.ts b/src/legacy/core_plugins/data/public/search/aggs/param_types/json.ts index 771919b0bb56b..bf85b3b890c35 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/param_types/json.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/param_types/json.ts @@ -19,7 +19,7 @@ import _ from 'lodash'; -import { AggConfig } from '../agg_config'; +import { IAggConfig } from '../agg_config'; import { BaseParamType } from './base'; export class JsonParamType extends BaseParamType { @@ -29,7 +29,7 @@ export class JsonParamType extends BaseParamType { this.name = config.name || 'json'; if (!config.write) { - this.write = (aggConfig: AggConfig, output: Record) => { + this.write = (aggConfig: IAggConfig, output: Record) => { let paramJson; const param = aggConfig.params[this.name]; diff --git a/src/legacy/core_plugins/data/public/search/aggs/param_types/optioned.test.ts b/src/legacy/core_plugins/data/public/search/aggs/param_types/optioned.test.ts index 6b58d81914097..c03d6cdfa1c70 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/param_types/optioned.test.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/param_types/optioned.test.ts @@ -20,8 +20,6 @@ import { BaseParamType } from './base'; import { OptionedParamType } from './optioned'; -jest.mock('ui/new_platform'); - describe('Optioned', () => { describe('constructor', () => { it('it is an instance of BaseParamType', () => { diff --git a/src/legacy/core_plugins/data/public/search/aggs/param_types/optioned.ts b/src/legacy/core_plugins/data/public/search/aggs/param_types/optioned.ts index 5ffda3740af49..9eb7ceda60711 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/param_types/optioned.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/param_types/optioned.ts @@ -17,14 +17,14 @@ * under the License. */ -import { AggConfig } from '../agg_config'; +import { IAggConfig } from '../agg_config'; import { BaseParamType } from './base'; export interface OptionedValueProp { value: string; text: string; disabled?: boolean; - isCompatible: (agg: AggConfig) => boolean; + isCompatible: (agg: IAggConfig) => boolean; } export interface OptionedParamEditorProps { @@ -40,7 +40,7 @@ export class OptionedParamType extends BaseParamType { super(config); if (!config.write) { - this.write = (aggConfig: AggConfig, output: Record) => { + this.write = (aggConfig: IAggConfig, output: Record) => { output.params[this.name] = aggConfig.params[this.name].value; }; } diff --git a/src/legacy/core_plugins/data/public/search/aggs/param_types/string.test.ts b/src/legacy/core_plugins/data/public/search/aggs/param_types/string.test.ts index fd5ccebde993e..29ec9741611a3 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/param_types/string.test.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/param_types/string.test.ts @@ -19,13 +19,11 @@ import { BaseParamType } from './base'; import { StringParamType } from './string'; -import { AggConfig } from '../agg_config'; - -jest.mock('ui/new_platform'); +import { IAggConfig } from '../agg_config'; describe('String', function() { let paramName = 'json_test'; - let aggConfig: AggConfig; + let aggConfig: IAggConfig; let output: Record; const initAggParam = (config: Record = {}) => @@ -36,7 +34,7 @@ describe('String', function() { }); beforeEach(() => { - aggConfig = { params: {} } as AggConfig; + aggConfig = { params: {} } as IAggConfig; output = { params: {} }; }); diff --git a/src/legacy/core_plugins/data/public/search/aggs/param_types/string.ts b/src/legacy/core_plugins/data/public/search/aggs/param_types/string.ts index 58ba99f8a6d63..750606eb8433b 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/param_types/string.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/param_types/string.ts @@ -17,7 +17,7 @@ * under the License. */ -import { AggConfig } from '../agg_config'; +import { IAggConfig } from '../agg_config'; import { BaseParamType } from './base'; export class StringParamType extends BaseParamType { @@ -25,7 +25,7 @@ export class StringParamType extends BaseParamType { super(config); if (!config.write) { - this.write = (aggConfig: AggConfig, output: Record) => { + this.write = (aggConfig: IAggConfig, output: Record) => { if (aggConfig.params[this.name] && aggConfig.params[this.name].length) { output.params[this.name] = aggConfig.params[this.name]; } diff --git a/src/legacy/ui/public/vis/__tests__/index.js b/src/legacy/core_plugins/data/public/search/aggs/test_helpers/index.ts similarity index 86% rename from src/legacy/ui/public/vis/__tests__/index.js rename to src/legacy/core_plugins/data/public/search/aggs/test_helpers/index.ts index 46074f2c5197b..131f921586144 100644 --- a/src/legacy/ui/public/vis/__tests__/index.js +++ b/src/legacy/core_plugins/data/public/search/aggs/test_helpers/index.ts @@ -17,5 +17,5 @@ * under the License. */ -import './_agg_config'; -import './_agg_configs'; +export { mockAggTypesRegistry } from './mock_agg_types_registry'; +export { mockDataServices } from './mock_data_services'; diff --git a/src/legacy/core_plugins/data/public/search/aggs/test_helpers/mock_agg_types_registry.ts b/src/legacy/core_plugins/data/public/search/aggs/test_helpers/mock_agg_types_registry.ts new file mode 100644 index 0000000000000..d6bb793866493 --- /dev/null +++ b/src/legacy/core_plugins/data/public/search/aggs/test_helpers/mock_agg_types_registry.ts @@ -0,0 +1,57 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { AggTypesRegistry, AggTypesRegistryStart } from '../agg_types_registry'; +import { aggTypes } from '../agg_types'; +import { BucketAggType } from '../buckets/_bucket_agg_type'; +import { MetricAggType } from '../metrics/metric_agg_type'; + +/** + * Testing utility which creates a new instance of AggTypesRegistry, + * registers the provided agg types, and returns AggTypesRegistry.start() + * + * This is useful if your test depends on a certain agg type to be present + * in the registry. + * + * @param [types] - Optional array of AggTypes to register. + * If no value is provided, all default types will be registered. + * + * @internal + */ +export function mockAggTypesRegistry | MetricAggType>( + types?: T[] +): AggTypesRegistryStart { + const registry = new AggTypesRegistry(); + const registrySetup = registry.setup(); + + if (types) { + types.forEach(type => { + if (type instanceof BucketAggType) { + registrySetup.registerBucket(type); + } else if (type instanceof MetricAggType) { + registrySetup.registerMetric(type); + } + }); + } else { + aggTypes.buckets.forEach(type => registrySetup.registerBucket(type)); + aggTypes.metrics.forEach(type => registrySetup.registerMetric(type)); + } + + return registry.start(); +} diff --git a/src/legacy/core_plugins/data/public/search/aggs/test_helpers/mock_data_services.ts b/src/legacy/core_plugins/data/public/search/aggs/test_helpers/mock_data_services.ts new file mode 100644 index 0000000000000..c4e78ab8f6422 --- /dev/null +++ b/src/legacy/core_plugins/data/public/search/aggs/test_helpers/mock_data_services.ts @@ -0,0 +1,54 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { coreMock } from '../../../../../../../../src/core/public/mocks'; +import { dataPluginMock } from '../../../../../../../plugins/data/public/mocks'; +import { searchStartMock } from '../../mocks'; +import { setSearchServiceShim } from '../../../services'; +import { + setFieldFormats, + setIndexPatterns, + setNotifications, + setOverlays, + setQueryService, + setSearchService, + setUiSettings, + // eslint-disable-next-line @kbn/eslint/no-restricted-paths +} from '../../../../../../../plugins/data/public/services'; + +/** + * Testing helper which calls all of the service setters used in the + * data plugin. Services are added using their provided mocks. + * + * @internal + */ +export function mockDataServices() { + const core = coreMock.createStart(); + const data = dataPluginMock.createStartContract(); + const searchShim = searchStartMock(); + + setSearchServiceShim(searchShim); + setFieldFormats(data.fieldFormats); + setIndexPatterns(data.indexPatterns); + setNotifications(core.notifications); + setOverlays(core.overlays); + setQueryService(data.query); + setSearchService(data.search); + setUiSettings(core.uiSettings); +} diff --git a/src/legacy/core_plugins/data/public/search/aggs/types.ts b/src/legacy/core_plugins/data/public/search/aggs/types.ts index 2c918abf99fca..5d02f426b5896 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/types.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/types.ts @@ -18,7 +18,7 @@ */ export { IAggConfig } from './agg_config'; -export { IAggConfigs } from './agg_configs'; +export { CreateAggConfigParams, IAggConfigs } from './agg_configs'; export { IAggType } from './agg_type'; export { AggParam, AggParamOption } from './agg_params'; export { IFieldParamType } from './param_types'; diff --git a/src/legacy/core_plugins/data/public/search/aggs/utils.test.tsx b/src/legacy/core_plugins/data/public/search/aggs/utils.test.tsx index a3c7f24f3927d..c0662c98755a3 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/utils.test.tsx +++ b/src/legacy/core_plugins/data/public/search/aggs/utils.test.tsx @@ -19,8 +19,6 @@ import { isValidJson } from './utils'; -jest.mock('ui/new_platform'); - const input = { valid: '{ "test": "json input" }', invalid: 'strings are not json', diff --git a/src/legacy/core_plugins/data/public/search/aggs/utils.ts b/src/legacy/core_plugins/data/public/search/aggs/utils.ts index 62f07ce44ab46..67ea373f438fb 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/utils.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/utils.ts @@ -26,7 +26,7 @@ import { isValidEsInterval } from '../../../common'; * @param {string} value a string that should be validated * @returns {boolean} true if value is a valid JSON or if value is an empty string, or a string with whitespaces, otherwise false */ -function isValidJson(value: string): boolean { +export function isValidJson(value: string): boolean { if (!value || value.length === 0) { return true; } @@ -49,7 +49,7 @@ function isValidJson(value: string): boolean { } } -function isValidInterval(value: string, baseInterval?: string) { +export function isValidInterval(value: string, baseInterval?: string) { if (baseInterval) { return _parseWithBase(value, baseInterval); } else { @@ -69,4 +69,37 @@ function _parseWithBase(value: string, baseInterval: string) { } } -export { isValidJson, isValidInterval }; +// An inlined version of angular.toJSON() +// source: https://github.com/angular/angular.js/blob/master/src/Angular.js#L1312 +// @internal +export function toAngularJSON(obj: any, pretty?: any): string { + if (obj === undefined) return ''; + if (typeof pretty === 'number') { + pretty = pretty ? 2 : null; + } + return JSON.stringify(obj, toJsonReplacer, pretty); +} + +function isWindow(obj: any) { + return obj && obj.window === obj; +} + +function isScope(obj: any) { + return obj && obj.$evalAsync && obj.$watch; +} + +function toJsonReplacer(key: any, value: any) { + let val = value; + + if (typeof key === 'string' && key.charAt(0) === '$' && key.charAt(1) === '$') { + val = undefined; + } else if (isWindow(value)) { + val = '$WINDOW'; + } else if (value && window.document === value) { + val = '$DOCUMENT'; + } else if (isScope(value)) { + val = '$SCOPE'; + } + + return val; +} diff --git a/src/legacy/core_plugins/data/public/search/expressions/esaggs.ts b/src/legacy/core_plugins/data/public/search/expressions/esaggs.ts index 7a5d927d0f219..24dd1c4944bfb 100644 --- a/src/legacy/core_plugins/data/public/search/expressions/esaggs.ts +++ b/src/legacy/core_plugins/data/public/search/expressions/esaggs.ts @@ -19,7 +19,7 @@ import { get, has } from 'lodash'; import { i18n } from '@kbn/i18n'; -import { AggConfigs, IAggConfigs } from 'ui/agg_types'; +import { createAggConfigs, IAggConfigs } from 'ui/agg_types'; import { createFormat } from 'ui/visualize/loader/pipeline_helpers/utilities'; import { KibanaContext, @@ -258,7 +258,7 @@ export const esaggs = (): ExpressionFunctionDefinition { - const aggConfigs = new AggConfigs(indexPattern); + const { aggs } = getSearchServiceShim(); + const aggConfigs = aggs.createAggConfigs(indexPattern); const aggConfig = aggConfigs.createAggConfig({ enabled: true, type, diff --git a/src/legacy/core_plugins/data/public/search/mocks.ts b/src/legacy/core_plugins/data/public/search/mocks.ts new file mode 100644 index 0000000000000..86b6a928dc5b4 --- /dev/null +++ b/src/legacy/core_plugins/data/public/search/mocks.ts @@ -0,0 +1,85 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { SearchSetup, SearchStart } from './search_service'; +import { AggTypesRegistrySetup, AggTypesRegistryStart } from './aggs/agg_types_registry'; +import { AggConfigs } from './aggs/agg_configs'; +import { mockAggTypesRegistry } from './aggs/test_helpers'; + +const aggTypeBaseParamMock = () => ({ + name: 'some_param', + type: 'some_param_type', + displayName: 'some_agg_type_param', + required: false, + advanced: false, + default: {}, + write: jest.fn(), + serialize: jest.fn().mockImplementation(() => {}), + deserialize: jest.fn().mockImplementation(() => {}), + options: [], +}); + +const aggTypeConfigMock = () => ({ + name: 'some_name', + title: 'some_title', + params: [aggTypeBaseParamMock()], +}); + +export const aggTypesRegistrySetupMock = (): MockedKeys => ({ + registerBucket: jest.fn(), + registerMetric: jest.fn(), +}); + +export const aggTypesRegistryStartMock = (): MockedKeys => ({ + get: jest.fn().mockImplementation(aggTypeConfigMock), + getBuckets: jest.fn().mockImplementation(() => [aggTypeConfigMock()]), + getMetrics: jest.fn().mockImplementation(() => [aggTypeConfigMock()]), + getAll: jest.fn().mockImplementation(() => ({ + buckets: [aggTypeConfigMock()], + metrics: [aggTypeConfigMock()], + })), +}); + +export const searchSetupMock = (): MockedKeys => ({ + aggs: { + types: aggTypesRegistrySetupMock(), + }, +}); + +export const searchStartMock = (): MockedKeys => ({ + aggs: { + createAggConfigs: jest.fn().mockImplementation((indexPattern, configStates = [], schemas) => { + return new AggConfigs(indexPattern, configStates, { + schemas, + typesRegistry: mockAggTypesRegistry(), + }); + }), + types: mockAggTypesRegistry(), + __LEGACY: { + AggConfig: jest.fn() as any, + AggType: jest.fn(), + aggTypeFieldFilters: jest.fn() as any, + FieldParamType: jest.fn(), + MetricAggType: jest.fn(), + parentPipelineAggHelper: jest.fn() as any, + setBounds: jest.fn(), + siblingPipelineAggHelper: jest.fn() as any, + }, + }, +}); diff --git a/src/legacy/core_plugins/data/public/search/search_service.ts b/src/legacy/core_plugins/data/public/search/search_service.ts index 45f9ff17328ad..6754c0e3551af 100644 --- a/src/legacy/core_plugins/data/public/search/search_service.ts +++ b/src/legacy/core_plugins/data/public/search/search_service.ts @@ -18,11 +18,16 @@ */ import { CoreSetup, CoreStart } from '../../../../../core/public'; +import { IndexPattern } from '../../../../../plugins/data/public'; import { aggTypes, AggType, + AggTypesRegistry, + AggTypesRegistrySetup, + AggTypesRegistryStart, AggConfig, AggConfigs, + CreateAggConfigParams, FieldParamType, MetricAggType, aggTypeFieldFilters, @@ -32,20 +37,28 @@ import { } from './aggs'; interface AggsSetup { - types: typeof aggTypes; + types: AggTypesRegistrySetup; } -interface AggsStart { - types: typeof aggTypes; +interface AggsStartLegacy { AggConfig: typeof AggConfig; - AggConfigs: typeof AggConfigs; AggType: typeof AggType; aggTypeFieldFilters: typeof aggTypeFieldFilters; FieldParamType: typeof FieldParamType; MetricAggType: typeof MetricAggType; parentPipelineAggHelper: typeof parentPipelineAggHelper; - siblingPipelineAggHelper: typeof siblingPipelineAggHelper; setBounds: typeof setBounds; + siblingPipelineAggHelper: typeof siblingPipelineAggHelper; +} + +interface AggsStart { + createAggConfigs: ( + indexPattern: IndexPattern, + configStates?: CreateAggConfigParams[], + schemas?: Record + ) => InstanceType; + types: AggTypesRegistryStart; + __LEGACY: AggsStartLegacy; } export interface SearchSetup { @@ -63,28 +76,41 @@ export interface SearchStart { * it will move into the existing search service in src/plugins/data/public/search */ export class SearchService { + private readonly aggTypesRegistry = new AggTypesRegistry(); + public setup(core: CoreSetup): SearchSetup { + const aggTypesSetup = this.aggTypesRegistry.setup(); + aggTypes.buckets.forEach(b => aggTypesSetup.registerBucket(b)); + aggTypes.metrics.forEach(m => aggTypesSetup.registerMetric(m)); + return { aggs: { - types: aggTypes, // TODO convert to registry - // TODO add other items as needed + types: aggTypesSetup, }, }; } public start(core: CoreStart): SearchStart { + const aggTypesStart = this.aggTypesRegistry.start(); return { aggs: { - types: aggTypes, // TODO convert to registry - AggConfig, // TODO make static - AggConfigs, - AggType, - aggTypeFieldFilters, - FieldParamType, - MetricAggType, - parentPipelineAggHelper, // TODO make static - siblingPipelineAggHelper, // TODO make static - setBounds, // TODO make static + createAggConfigs: (indexPattern, configStates = [], schemas) => { + return new AggConfigs(indexPattern, configStates, { + schemas, + typesRegistry: aggTypesStart, + }); + }, + types: aggTypesStart, + __LEGACY: { + AggConfig, // TODO make static + AggType, + aggTypeFieldFilters, + FieldParamType, + MetricAggType, + parentPipelineAggHelper, // TODO make static + setBounds, // TODO make static + siblingPipelineAggHelper, // TODO make static + }, }, }; } diff --git a/src/legacy/core_plugins/data/public/search/tabify/buckets.test.ts b/src/legacy/core_plugins/data/public/search/tabify/buckets.test.ts index ef2748102623a..98048cb25db2f 100644 --- a/src/legacy/core_plugins/data/public/search/tabify/buckets.test.ts +++ b/src/legacy/core_plugins/data/public/search/tabify/buckets.test.ts @@ -20,8 +20,6 @@ import { TabifyBuckets } from './buckets'; import { AggGroupNames } from '../aggs'; -jest.mock('ui/new_platform'); - describe('Buckets wrapper', () => { const check = (aggResp: any, count: number, keys: string[]) => { test('reads the length', () => { diff --git a/src/legacy/core_plugins/data/public/search/tabify/get_columns.test.ts b/src/legacy/core_plugins/data/public/search/tabify/get_columns.test.ts index cfd4cd7de640b..6c5dc790ef976 100644 --- a/src/legacy/core_plugins/data/public/search/tabify/get_columns.test.ts +++ b/src/legacy/core_plugins/data/public/search/tabify/get_columns.test.ts @@ -18,12 +18,17 @@ */ import { tabifyGetColumns } from './get_columns'; -import { AggConfigs, AggGroupNames, Schemas } from '../aggs'; import { TabbedAggColumn } from './types'; - -jest.mock('ui/new_platform'); +import { AggConfigs, AggGroupNames, Schemas } from '../aggs'; +import { mockAggTypesRegistry, mockDataServices } from '../aggs/test_helpers'; describe('get columns', () => { + beforeEach(() => { + mockDataServices(); + }); + + const typesRegistry = mockAggTypesRegistry(); + const createAggConfigs = (aggs: any[] = []) => { const field = { name: '@timestamp', @@ -38,18 +43,17 @@ describe('get columns', () => { }, } as any; - return new AggConfigs( - indexPattern, - aggs, - new Schemas([ + return new AggConfigs(indexPattern, aggs, { + typesRegistry, + schemas: new Schemas([ { group: AggGroupNames.Metrics, name: 'metric', min: 1, defaults: [{ schema: 'metric', type: 'count' }], }, - ]).all - ); + ]).all, + }); }; test('should inject a count metric if no aggs exist', () => { diff --git a/src/legacy/core_plugins/data/public/search/tabify/response_writer.test.ts b/src/legacy/core_plugins/data/public/search/tabify/response_writer.test.ts index f5df0a683ca00..94301eedac74a 100644 --- a/src/legacy/core_plugins/data/public/search/tabify/response_writer.test.ts +++ b/src/legacy/core_plugins/data/public/search/tabify/response_writer.test.ts @@ -19,14 +19,19 @@ import { TabbedAggResponseWriter } from './response_writer'; import { AggConfigs, AggGroupNames, Schemas, BUCKET_TYPES } from '../aggs'; +import { mockDataServices, mockAggTypesRegistry } from '../aggs/test_helpers'; import { TabbedResponseWriterOptions } from './types'; -jest.mock('ui/new_platform'); - describe('TabbedAggResponseWriter class', () => { + beforeEach(() => { + mockDataServices(); + }); + let responseWriter: TabbedAggResponseWriter; + const typesRegistry = mockAggTypesRegistry(); + const splitAggConfig = [ { type: BUCKET_TYPES.TERMS, @@ -66,18 +71,17 @@ describe('TabbedAggResponseWriter class', () => { } as any; return new TabbedAggResponseWriter( - new AggConfigs( - indexPattern, - aggs, - new Schemas([ + new AggConfigs(indexPattern, aggs, { + typesRegistry, + schemas: new Schemas([ { group: AggGroupNames.Metrics, name: 'metric', min: 1, defaults: [{ schema: 'metric', type: 'count' }], }, - ]).all - ), + ]).all, + }), { metricsAtAllLevels: false, partialRows: false, diff --git a/src/legacy/core_plugins/data/public/search/tabify/tabify.test.ts b/src/legacy/core_plugins/data/public/search/tabify/tabify.test.ts index 13fe7719b0a85..db4ad3bdea96b 100644 --- a/src/legacy/core_plugins/data/public/search/tabify/tabify.test.ts +++ b/src/legacy/core_plugins/data/public/search/tabify/tabify.test.ts @@ -20,11 +20,12 @@ import { IndexPattern } from '../../../../../../plugins/data/public'; import { tabifyAggResponse } from './tabify'; import { IAggConfig, IAggConfigs, AggGroupNames, Schemas, AggConfigs } from '../aggs'; +import { mockAggTypesRegistry } from '../aggs/test_helpers'; import { metricOnly, threeTermBuckets } from 'fixtures/fake_hierarchical_data'; -jest.mock('ui/new_platform'); - describe('tabifyAggResponse Integration', () => { + const typesRegistry = mockAggTypesRegistry(); + const createAggConfigs = (aggs: IAggConfig[] = []) => { const field = { name: '@timestamp', @@ -39,18 +40,17 @@ describe('tabifyAggResponse Integration', () => { }, } as unknown) as IndexPattern; - return new AggConfigs( - indexPattern, - aggs, - new Schemas([ + return new AggConfigs(indexPattern, aggs, { + typesRegistry, + schemas: new Schemas([ { group: AggGroupNames.Metrics, name: 'metric', min: 1, defaults: [{ schema: 'metric', type: 'count' }], }, - ]).all - ); + ]).all, + }); }; const mockAggConfig = (agg: any): IAggConfig => (agg as unknown) as IAggConfig; diff --git a/src/legacy/core_plugins/data/public/actions/filters/brush_event.test.mocks.ts b/src/legacy/core_plugins/data/public/services.ts similarity index 76% rename from src/legacy/core_plugins/data/public/actions/filters/brush_event.test.mocks.ts rename to src/legacy/core_plugins/data/public/services.ts index 2cecfd0fe8b76..7ecd041c70e22 100644 --- a/src/legacy/core_plugins/data/public/actions/filters/brush_event.test.mocks.ts +++ b/src/legacy/core_plugins/data/public/services.ts @@ -17,12 +17,9 @@ * under the License. */ -import { chromeServiceMock } from '../../../../../../core/public/mocks'; +import { createGetterSetter } from '../../../../plugins/kibana_utils/public'; +import { SearchStart } from './search/search_service'; -jest.doMock('ui/new_platform', () => ({ - npStart: { - core: { - chrome: chromeServiceMock.createStartContract(), - }, - }, -})); +export const [getSearchServiceShim, setSearchServiceShim] = createGetterSetter( + 'searchShim' +); diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/sidebar/state/reducers.ts b/src/legacy/core_plugins/vis_default_editor/public/components/sidebar/state/reducers.ts index 6591aa5fb53d5..6ae4e415f8caa 100644 --- a/src/legacy/core_plugins/vis_default_editor/public/components/sidebar/state/reducers.ts +++ b/src/legacy/core_plugins/vis_default_editor/public/components/sidebar/state/reducers.ts @@ -20,7 +20,8 @@ import { cloneDeep } from 'lodash'; import { Vis, VisState } from 'src/legacy/core_plugins/visualizations/public'; -import { AggConfigs, IAggConfig, AggGroupNames } from '../../../legacy_imports'; + +import { createAggConfigs, IAggConfig, AggGroupNames } from '../../../legacy_imports'; import { EditorStateActionTypes } from './constants'; import { getEnabledMetricAggsCount } from '../../agg_group_helper'; import { EditorAction } from './actions'; @@ -32,7 +33,8 @@ function initEditorState(vis: Vis) { function editorStateReducer(state: VisState, action: EditorAction): VisState { switch (action.type) { case EditorStateActionTypes.ADD_NEW_AGG: { - const aggConfig = state.aggs.createAggConfig(action.payload as IAggConfig, { + const payloadAggConfig = action.payload as IAggConfig; + const aggConfig = state.aggs.createAggConfig(payloadAggConfig, { addToAggConfigs: false, }); aggConfig.brandNew = true; @@ -40,7 +42,7 @@ function editorStateReducer(state: VisState, action: EditorAction): VisState { return { ...state, - aggs: new AggConfigs(state.aggs.indexPattern, newAggs, state.aggs.schemas), + aggs: createAggConfigs(state.aggs.indexPattern, newAggs, state.aggs.schemas), }; } @@ -63,7 +65,7 @@ function editorStateReducer(state: VisState, action: EditorAction): VisState { return { ...state, - aggs: new AggConfigs(state.aggs.indexPattern, newAggs, state.aggs.schemas), + aggs: createAggConfigs(state.aggs.indexPattern, newAggs, state.aggs.schemas), }; } @@ -88,7 +90,7 @@ function editorStateReducer(state: VisState, action: EditorAction): VisState { return { ...state, - aggs: new AggConfigs(state.aggs.indexPattern, newAggs, state.aggs.schemas), + aggs: createAggConfigs(state.aggs.indexPattern, newAggs, state.aggs.schemas), }; } @@ -129,7 +131,7 @@ function editorStateReducer(state: VisState, action: EditorAction): VisState { return { ...state, - aggs: new AggConfigs(state.aggs.indexPattern, newAggs, state.aggs.schemas), + aggs: createAggConfigs(state.aggs.indexPattern, newAggs, state.aggs.schemas), }; } @@ -141,7 +143,7 @@ function editorStateReducer(state: VisState, action: EditorAction): VisState { return { ...state, - aggs: new AggConfigs(state.aggs.indexPattern, newAggs, state.aggs.schemas), + aggs: createAggConfigs(state.aggs.indexPattern, newAggs, state.aggs.schemas), }; } @@ -163,7 +165,7 @@ function editorStateReducer(state: VisState, action: EditorAction): VisState { return { ...state, - aggs: new AggConfigs(state.aggs.indexPattern, newAggs, state.aggs.schemas), + aggs: createAggConfigs(state.aggs.indexPattern, newAggs, state.aggs.schemas), }; } diff --git a/src/legacy/core_plugins/vis_default_editor/public/legacy_imports.ts b/src/legacy/core_plugins/vis_default_editor/public/legacy_imports.ts index 832f73752a99b..8aed263c4e4d1 100644 --- a/src/legacy/core_plugins/vis_default_editor/public/legacy_imports.ts +++ b/src/legacy/core_plugins/vis_default_editor/public/legacy_imports.ts @@ -22,12 +22,12 @@ export { AggType, IAggType, IAggConfig, - AggConfigs, IAggConfigs, AggParam, AggGroupNames, aggGroupNamesMap, aggTypes, + createAggConfigs, FieldParamType, IFieldParamType, BUCKET_TYPES, diff --git a/src/legacy/core_plugins/vis_type_table/public/table_vis_controller.test.ts b/src/legacy/core_plugins/vis_type_table/public/table_vis_controller.test.ts index 0e1e48d00a1b2..736152c7014dc 100644 --- a/src/legacy/core_plugins/vis_type_table/public/table_vis_controller.test.ts +++ b/src/legacy/core_plugins/vis_type_table/public/table_vis_controller.test.ts @@ -34,7 +34,7 @@ import { stubFields } from '../../../../plugins/data/public/stubs'; import { tableVisResponseHandler } from './table_vis_response_handler'; import { coreMock } from '../../../../core/public/mocks'; // eslint-disable-next-line @kbn/eslint/no-restricted-paths -import { AggConfigs } from 'ui/agg_types'; +import { createAggConfigs } from 'ui/agg_types'; import { tabifyAggResponse, IAggConfig } from './legacy_imports'; jest.mock('ui/new_platform'); @@ -113,7 +113,7 @@ describe('Table Vis - Controller', () => { return ({ type: tableVisTypeDefinition, params: Object.assign({}, tableVisTypeDefinition.visConfig.defaults, params), - aggs: new AggConfigs( + aggs: createAggConfigs( stubIndexPattern, [ { type: 'count', schema: 'metric' }, diff --git a/src/legacy/core_plugins/visualizations/public/legacy_imports.ts b/src/legacy/core_plugins/visualizations/public/legacy_imports.ts index fb7a157b53a9a..0a3b1938436c0 100644 --- a/src/legacy/core_plugins/visualizations/public/legacy_imports.ts +++ b/src/legacy/core_plugins/visualizations/public/legacy_imports.ts @@ -18,10 +18,10 @@ */ export { - AggConfigs, IAggConfig, IAggConfigs, isDateHistogramBucketAggConfig, setBounds, } from '../../data/public'; +export { createAggConfigs } from 'ui/agg_types'; export { createSavedSearchesLoader } from '../../../../plugins/discover/public'; diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/vis_impl.js b/src/legacy/core_plugins/visualizations/public/np_ready/public/vis_impl.js index 2f36322c67256..15a826cc6ddbe 100644 --- a/src/legacy/core_plugins/visualizations/public/np_ready/public/vis_impl.js +++ b/src/legacy/core_plugins/visualizations/public/np_ready/public/vis_impl.js @@ -30,7 +30,7 @@ import { EventEmitter } from 'events'; import _ from 'lodash'; import { PersistedState } from '../../../../../../../src/plugins/visualizations/public'; -import { AggConfigs } from '../../legacy_imports'; +import { createAggConfigs } from '../../legacy_imports'; import { updateVisualizationConfig } from './legacy/vis_update'; import { getTypes } from './services'; @@ -83,7 +83,7 @@ class VisImpl extends EventEmitter { updateVisualizationConfig(state.params, this.params); if (state.aggs || !this.aggs) { - this.aggs = new AggConfigs( + this.aggs = createAggConfigs( this.indexPattern, state.aggs ? state.aggs.aggs || state.aggs : [], this.type.schemas.all @@ -125,7 +125,7 @@ class VisImpl extends EventEmitter { copyCurrentState(includeDisabled = false) { const state = this.getCurrentState(includeDisabled); - state.aggs = new AggConfigs( + state.aggs = createAggConfigs( this.indexPattern, state.aggs.aggs || state.aggs, this.type.schemas.all diff --git a/src/legacy/ui/public/agg_types/index.ts b/src/legacy/ui/public/agg_types/index.ts index ac5d0bed7ef15..ffc300251c4bb 100644 --- a/src/legacy/ui/public/agg_types/index.ts +++ b/src/legacy/ui/public/agg_types/index.ts @@ -27,18 +27,19 @@ import { start as dataStart } from '../../../core_plugins/data/public/legacy'; // runtime contracts +const { types } = dataStart.search.aggs; +export const aggTypes = types.getAll(); +export const { createAggConfigs } = dataStart.search.aggs; export const { - types: aggTypes, AggConfig, - AggConfigs, AggType, aggTypeFieldFilters, FieldParamType, MetricAggType, parentPipelineAggHelper, - siblingPipelineAggHelper, setBounds, -} = dataStart.search.aggs; + siblingPipelineAggHelper, +} = dataStart.search.aggs.__LEGACY; // types export { diff --git a/src/legacy/ui/public/vis/__tests__/_agg_config.js b/src/legacy/ui/public/vis/__tests__/_agg_config.js deleted file mode 100644 index 9e53044f681ba..0000000000000 --- a/src/legacy/ui/public/vis/__tests__/_agg_config.js +++ /dev/null @@ -1,485 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import sinon from 'sinon'; -import expect from '@kbn/expect'; -import ngMock from 'ng_mock'; -import { AggType, AggConfig } from '../../agg_types'; -import { start as visualizationsStart } from '../../../../core_plugins/visualizations/public/np_ready/public/legacy'; - -import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern'; - -describe('AggConfig', function() { - let indexPattern; - - beforeEach(ngMock.module('kibana')); - beforeEach( - ngMock.inject(function(Private) { - indexPattern = Private(FixturesStubbedLogstashIndexPatternProvider); - }) - ); - - describe('#toDsl', function() { - it('calls #write()', function() { - const vis = new visualizationsStart.Vis(indexPattern, { - type: 'histogram', - aggs: [ - { - type: 'date_histogram', - schema: 'segment', - }, - ], - }); - - const aggConfig = vis.aggs.byName('date_histogram')[0]; - const stub = sinon.stub(aggConfig, 'write').returns({ params: {} }); - - aggConfig.toDsl(); - expect(stub.callCount).to.be(1); - }); - - it('uses the type name as the agg name', function() { - const vis = new visualizationsStart.Vis(indexPattern, { - type: 'histogram', - aggs: [ - { - type: 'date_histogram', - schema: 'segment', - }, - ], - }); - - const aggConfig = vis.aggs.byName('date_histogram')[0]; - sinon.stub(aggConfig, 'write').returns({ params: {} }); - - const dsl = aggConfig.toDsl(); - expect(dsl).to.have.property('date_histogram'); - }); - - it('uses the params from #write() output as the agg params', function() { - const vis = new visualizationsStart.Vis(indexPattern, { - type: 'histogram', - aggs: [ - { - type: 'date_histogram', - schema: 'segment', - }, - ], - }); - - const aggConfig = vis.aggs.byName('date_histogram')[0]; - const football = {}; - - sinon.stub(aggConfig, 'write').returns({ params: football }); - - const dsl = aggConfig.toDsl(); - expect(dsl.date_histogram).to.be(football); - }); - - it('includes subAggs from #write() output', function() { - const vis = new visualizationsStart.Vis(indexPattern, { - type: 'histogram', - aggs: [ - { - type: 'avg', - schema: 'metric', - }, - { - type: 'date_histogram', - schema: 'segment', - }, - ], - }); - - const histoConfig = vis.aggs.byName('date_histogram')[0]; - const avgConfig = vis.aggs.byName('avg')[0]; - const football = {}; - - sinon.stub(histoConfig, 'write').returns({ params: {}, subAggs: [avgConfig] }); - sinon.stub(avgConfig, 'write').returns({ params: football }); - - const dsl = histoConfig.toDsl(); - - // didn't use .eql() because of variable key names, and final check is strict - expect(dsl).to.have.property('aggs'); - expect(dsl.aggs).to.have.property(avgConfig.id); - expect(dsl.aggs[avgConfig.id]).to.have.property('avg'); - expect(dsl.aggs[avgConfig.id].avg).to.be(football); - }); - }); - - describe('::ensureIds', function() { - it('accepts an array of objects and assigns ids to them', function() { - const objs = [{}, {}, {}, {}]; - AggConfig.ensureIds(objs); - expect(objs[0]).to.have.property('id', '1'); - expect(objs[1]).to.have.property('id', '2'); - expect(objs[2]).to.have.property('id', '3'); - expect(objs[3]).to.have.property('id', '4'); - }); - - it('assigns ids relative to the other only item in the list', function() { - const objs = [{ id: '100' }, {}]; - AggConfig.ensureIds(objs); - expect(objs[0]).to.have.property('id', '100'); - expect(objs[1]).to.have.property('id', '101'); - }); - - it('assigns ids relative to the other items in the list', function() { - const objs = [{ id: '100' }, { id: '200' }, { id: '500' }, { id: '350' }, {}]; - AggConfig.ensureIds(objs); - expect(objs[0]).to.have.property('id', '100'); - expect(objs[1]).to.have.property('id', '200'); - expect(objs[2]).to.have.property('id', '500'); - expect(objs[3]).to.have.property('id', '350'); - expect(objs[4]).to.have.property('id', '501'); - }); - - it('uses ::nextId to get the starting value', function() { - sinon.stub(AggConfig, 'nextId').returns(534); - const objs = AggConfig.ensureIds([{}]); - AggConfig.nextId.restore(); - expect(objs[0]).to.have.property('id', '534'); - }); - - it('only calls ::nextId once', function() { - const start = 420; - sinon.stub(AggConfig, 'nextId').returns(start); - const objs = AggConfig.ensureIds([{}, {}, {}, {}, {}, {}, {}]); - - expect(AggConfig.nextId).to.have.property('callCount', 1); - - AggConfig.nextId.restore(); - objs.forEach(function(obj, i) { - expect(obj).to.have.property('id', String(start + i)); - }); - }); - }); - - describe('::nextId', function() { - it('accepts a list of objects and picks the next id', function() { - const next = AggConfig.nextId([{ id: 100 }, { id: 500 }]); - expect(next).to.be(501); - }); - - it('handles an empty list', function() { - const next = AggConfig.nextId([]); - expect(next).to.be(1); - }); - - it('fails when the list is not defined', function() { - expect(function() { - AggConfig.nextId(); - }).to.throwError(); - }); - }); - - describe('#toJsonDataEquals', function() { - const testsIdentical = [ - { - type: 'metric', - aggs: [ - { - type: 'count', - schema: 'metric', - params: { field: '@timestamp' }, - }, - ], - }, - { - type: 'histogram', - aggs: [ - { - type: 'avg', - schema: 'metric', - }, - { - type: 'date_histogram', - schema: 'segment', - }, - ], - }, - ]; - - testsIdentical.forEach((visConfig, index) => { - it(`identical aggregations (${index})`, function() { - const vis1 = new visualizationsStart.Vis(indexPattern, visConfig); - const vis2 = new visualizationsStart.Vis(indexPattern, visConfig); - expect(vis1.aggs.jsonDataEquals(vis2.aggs.aggs)).to.be(true); - }); - }); - - const testsIdenticalDifferentOrder = [ - { - config1: { - type: 'histogram', - aggs: [ - { - type: 'avg', - schema: 'metric', - }, - { - type: 'date_histogram', - schema: 'segment', - }, - ], - }, - config2: { - type: 'histogram', - aggs: [ - { - schema: 'metric', - type: 'avg', - }, - { - schema: 'segment', - type: 'date_histogram', - }, - ], - }, - }, - ]; - - testsIdenticalDifferentOrder.forEach((test, index) => { - it(`identical aggregations (${index}) - init json is in different order`, function() { - const vis1 = new visualizationsStart.Vis(indexPattern, test.config1); - const vis2 = new visualizationsStart.Vis(indexPattern, test.config2); - expect(vis1.aggs.jsonDataEquals(vis2.aggs.aggs)).to.be(true); - }); - }); - - const testsDifferent = [ - { - config1: { - type: 'histogram', - aggs: [ - { - type: 'avg', - schema: 'metric', - }, - { - type: 'date_histogram', - schema: 'segment', - }, - ], - }, - config2: { - type: 'histogram', - aggs: [ - { - type: 'max', - schema: 'metric', - }, - { - type: 'date_histogram', - schema: 'segment', - }, - ], - }, - }, - { - config1: { - type: 'metric', - aggs: [ - { - type: 'count', - schema: 'metric', - params: { field: '@timestamp' }, - }, - ], - }, - config2: { - type: 'metric', - aggs: [ - { - type: 'count', - schema: 'metric', - params: { field: '@timestamp' }, - }, - { - type: 'date_histogram', - schema: 'segment', - }, - ], - }, - }, - ]; - - testsDifferent.forEach((test, index) => { - it(`different aggregations (${index})`, function() { - const vis1 = new visualizationsStart.Vis(indexPattern, test.config1); - const vis2 = new visualizationsStart.Vis(indexPattern, test.config2); - expect(vis1.aggs.jsonDataEquals(vis2.aggs.aggs)).to.be(false); - }); - }); - }); - - describe('#toJSON', function() { - it('includes the aggs id, params, type and schema', function() { - const vis = new visualizationsStart.Vis(indexPattern, { - type: 'histogram', - aggs: [ - { - type: 'date_histogram', - schema: 'segment', - }, - ], - }); - - const aggConfig = vis.aggs.byName('date_histogram')[0]; - expect(aggConfig.id).to.be('1'); - expect(aggConfig.params).to.be.an('object'); - expect(aggConfig.type) - .to.be.an(AggType) - .and.have.property('name', 'date_histogram'); - expect(aggConfig.schema) - .to.be.an('object') - .and.have.property('name', 'segment'); - - const state = aggConfig.toJSON(); - expect(state).to.have.property('id', '1'); - expect(state.params).to.be.an('object'); - expect(state).to.have.property('type', 'date_histogram'); - expect(state).to.have.property('schema', 'segment'); - }); - - it('test serialization order is identical (for visual consistency)', function() { - const vis1 = new visualizationsStart.Vis(indexPattern, { - type: 'histogram', - aggs: [ - { - type: 'date_histogram', - schema: 'segment', - }, - ], - }); - const vis2 = new visualizationsStart.Vis(indexPattern, { - type: 'histogram', - aggs: [ - { - schema: 'segment', - type: 'date_histogram', - }, - ], - }); - - //this relies on the assumption that js-engines consistently loop over properties in insertion order. - //most likely the case, but strictly speaking not guaranteed by the JS and JSON specifications. - expect(JSON.stringify(vis1.aggs.aggs) === JSON.stringify(vis2.aggs.aggs)).to.be(true); - }); - }); - - describe('#makeLabel', function() { - it('uses the custom label if it is defined', function() { - const vis = new visualizationsStart.Vis(indexPattern, {}); - const aggConfig = vis.aggs.aggs[0]; - aggConfig.params.customLabel = 'Custom label'; - const label = aggConfig.makeLabel(); - expect(label).to.be(aggConfig.params.customLabel); - }); - it('default label should be "Count"', function() { - const vis = new visualizationsStart.Vis(indexPattern, {}); - const aggConfig = vis.aggs.aggs[0]; - const label = aggConfig.makeLabel(); - expect(label).to.be('Count'); - }); - it('default label should be "Percentage of Count" when percentageMode is set to true', function() { - const vis = new visualizationsStart.Vis(indexPattern, {}); - const aggConfig = vis.aggs.aggs[0]; - const label = aggConfig.makeLabel(true); - expect(label).to.be('Percentage of Count'); - }); - it('empty label if the visualizationsStart.Vis type is not defined', function() { - const vis = new visualizationsStart.Vis(indexPattern, {}); - const aggConfig = vis.aggs.aggs[0]; - aggConfig.type = undefined; - const label = aggConfig.makeLabel(); - expect(label).to.be(''); - }); - }); - - describe('#fieldFormatter - custom getFormat handler', function() { - it('returns formatter from getFormat handler', function() { - const vis = new visualizationsStart.Vis(indexPattern, { - type: 'metric', - aggs: [ - { - type: 'count', - schema: 'metric', - params: { field: '@timestamp' }, - }, - ], - }); - - const fieldFormatter = vis.aggs.aggs[0].fieldFormatter(); - - expect(fieldFormatter).to.be.defined; - expect(fieldFormatter('text')).to.be('text'); - }); - }); - - describe('#fieldFormatter - no custom getFormat handler', function() { - const visStateAggWithoutCustomGetFormat = { - aggs: [ - { - type: 'histogram', - schema: 'bucket', - params: { field: 'bytes' }, - }, - ], - }; - let vis; - - beforeEach(function() { - vis = new visualizationsStart.Vis(indexPattern, visStateAggWithoutCustomGetFormat); - }); - - it("returns the field's formatter", function() { - expect(vis.aggs.aggs[0].fieldFormatter().toString()).to.be( - vis.aggs.aggs[0] - .getField() - .format.getConverterFor() - .toString() - ); - }); - - it('returns the string format if the field does not have a format', function() { - const agg = vis.aggs.aggs[0]; - agg.params.field = { type: 'number', format: null }; - const fieldFormatter = agg.fieldFormatter(); - expect(fieldFormatter).to.be.defined; - expect(fieldFormatter('text')).to.be('text'); - }); - - it('returns the string format if their is no field', function() { - const agg = vis.aggs.aggs[0]; - delete agg.params.field; - const fieldFormatter = agg.fieldFormatter(); - expect(fieldFormatter).to.be.defined; - expect(fieldFormatter('text')).to.be('text'); - }); - - it('returns the html converter if "html" is passed in', function() { - const field = indexPattern.fields.getByName('bytes'); - expect(vis.aggs.aggs[0].fieldFormatter('html').toString()).to.be( - field.format.getConverterFor('html').toString() - ); - }); - }); -}); diff --git a/src/legacy/ui/public/vis/__tests__/_agg_configs.js b/src/legacy/ui/public/vis/__tests__/_agg_configs.js deleted file mode 100644 index 172523ec50c8b..0000000000000 --- a/src/legacy/ui/public/vis/__tests__/_agg_configs.js +++ /dev/null @@ -1,420 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import _ from 'lodash'; -import sinon from 'sinon'; -import expect from '@kbn/expect'; -import ngMock from 'ng_mock'; -import { AggConfig, AggConfigs, AggGroupNames, Schemas } from '../../agg_types'; -import { start as visualizationsStart } from '../../../../core_plugins/visualizations/public/np_ready/public/legacy'; -import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern'; - -describe('AggConfigs', function() { - let indexPattern; - - beforeEach(ngMock.module('kibana')); - beforeEach( - ngMock.inject(function(Private) { - // load main deps - indexPattern = Private(FixturesStubbedLogstashIndexPatternProvider); - }) - ); - - describe('constructor', function() { - it('handles passing just a vis', function() { - const vis = new visualizationsStart.Vis(indexPattern, { - type: 'histogram', - aggs: [], - }); - - const ac = new AggConfigs(vis.indexPattern, [], vis.type.schemas.all); - expect(ac.aggs).to.have.length(1); - }); - - it('converts configStates into AggConfig objects if they are not already', function() { - const vis = new visualizationsStart.Vis(indexPattern, { - type: 'histogram', - aggs: [], - }); - - const ac = new AggConfigs( - vis.indexPattern, - [ - { - type: 'date_histogram', - schema: 'segment', - }, - new AggConfig(vis.aggs, { - type: 'terms', - schema: 'split', - }), - ], - vis.type.schemas.all - ); - - expect(ac.aggs).to.have.length(3); - }); - - it('attempts to ensure that all states have an id', function() { - const vis = new visualizationsStart.Vis(indexPattern, { - type: 'histogram', - aggs: [], - }); - - const states = [ - { - type: 'date_histogram', - schema: 'segment', - }, - { - type: 'terms', - schema: 'split', - }, - ]; - - const spy = sinon.spy(AggConfig, 'ensureIds'); - new AggConfigs(vis.indexPattern, states, vis.type.schemas.all); - expect(spy.callCount).to.be(1); - expect(spy.firstCall.args[0]).to.be(states); - AggConfig.ensureIds.restore(); - }); - - describe('defaults', function() { - let vis; - beforeEach(function() { - vis = { - indexPattern: indexPattern, - type: { - schemas: new Schemas([ - { - group: AggGroupNames.Metrics, - name: 'metric', - title: 'Simple', - min: 1, - max: 2, - defaults: [ - { schema: 'metric', type: 'count' }, - { schema: 'metric', type: 'avg' }, - { schema: 'metric', type: 'sum' }, - ], - }, - { - group: AggGroupNames.Buckets, - name: 'segment', - title: 'Example', - min: 0, - max: 1, - defaults: [ - { schema: 'segment', type: 'terms' }, - { schema: 'segment', type: 'filters' }, - ], - }, - ]), - }, - }; - }); - - it('should only set the number of defaults defined by the max', function() { - const ac = new AggConfigs(vis.indexPattern, [], vis.type.schemas.all); - expect(ac.bySchemaName('metric')).to.have.length(2); - }); - - it('should set the defaults defined in the schema when none exist', function() { - const ac = new AggConfigs(vis.indexPattern, [], vis.type.schemas.all); - expect(ac.aggs).to.have.length(3); - }); - - it('should NOT set the defaults defined in the schema when some exist', function() { - const ac = new AggConfigs( - vis.indexPattern, - [{ schema: 'segment', type: 'date_histogram' }], - vis.type.schemas.all - ); - expect(ac.aggs).to.have.length(3); - expect(ac.bySchemaName('segment')[0].type.name).to.equal('date_histogram'); - }); - }); - }); - - describe('#getRequestAggs', function() { - it('performs a stable sort, but moves metrics to the bottom', function() { - const vis = new visualizationsStart.Vis(indexPattern, { - type: 'histogram', - aggs: [ - { type: 'avg', schema: 'metric' }, - { type: 'terms', schema: 'split' }, - { type: 'histogram', schema: 'split' }, - { type: 'sum', schema: 'metric' }, - { type: 'date_histogram', schema: 'segment' }, - { type: 'filters', schema: 'split' }, - { type: 'percentiles', schema: 'metric' }, - ], - }); - - const sorted = vis.aggs.getRequestAggs(); - const aggs = _.indexBy(vis.aggs.aggs, function(agg) { - return agg.type.name; - }); - - expect(sorted.shift()).to.be(aggs.terms); - expect(sorted.shift()).to.be(aggs.histogram); - expect(sorted.shift()).to.be(aggs.date_histogram); - expect(sorted.shift()).to.be(aggs.filters); - expect(sorted.shift()).to.be(aggs.avg); - expect(sorted.shift()).to.be(aggs.sum); - expect(sorted.shift()).to.be(aggs.percentiles); - expect(sorted).to.have.length(0); - }); - }); - - describe('#getResponseAggs', function() { - it('returns all request aggs for basic aggs', function() { - const vis = new visualizationsStart.Vis(indexPattern, { - type: 'histogram', - aggs: [ - { type: 'terms', schema: 'split' }, - { type: 'date_histogram', schema: 'segment' }, - { type: 'count', schema: 'metric' }, - ], - }); - - const sorted = vis.aggs.getResponseAggs(); - const aggs = _.indexBy(vis.aggs.aggs, function(agg) { - return agg.type.name; - }); - - expect(sorted.shift()).to.be(aggs.terms); - expect(sorted.shift()).to.be(aggs.date_histogram); - expect(sorted.shift()).to.be(aggs.count); - expect(sorted).to.have.length(0); - }); - - it('expands aggs that have multiple responses', function() { - const vis = new visualizationsStart.Vis(indexPattern, { - type: 'histogram', - aggs: [ - { type: 'terms', schema: 'split' }, - { type: 'date_histogram', schema: 'segment' }, - { type: 'percentiles', schema: 'metric', params: { percents: [1, 2, 3] } }, - ], - }); - - const sorted = vis.aggs.getResponseAggs(); - const aggs = _.indexBy(vis.aggs.aggs, function(agg) { - return agg.type.name; - }); - - expect(sorted.shift()).to.be(aggs.terms); - expect(sorted.shift()).to.be(aggs.date_histogram); - expect(sorted.shift().id).to.be(aggs.percentiles.id + '.' + 1); - expect(sorted.shift().id).to.be(aggs.percentiles.id + '.' + 2); - expect(sorted.shift().id).to.be(aggs.percentiles.id + '.' + 3); - expect(sorted).to.have.length(0); - }); - }); - - describe('#toDsl', function() { - it('uses the sorted aggs', function() { - const vis = new visualizationsStart.Vis(indexPattern, { type: 'histogram' }); - sinon.spy(vis.aggs, 'getRequestAggs'); - vis.aggs.toDsl(); - expect(vis.aggs.getRequestAggs).to.have.property('callCount', 1); - }); - - it('calls aggConfig#toDsl() on each aggConfig and compiles the nested output', function() { - const vis = new visualizationsStart.Vis(indexPattern, { - type: 'histogram', - aggs: [ - { type: 'date_histogram', schema: 'segment' }, - { type: 'filters', schema: 'split' }, - ], - }); - - const aggInfos = vis.aggs.aggs.map(function(aggConfig) { - const football = {}; - - sinon.stub(aggConfig, 'toDsl').returns(football); - - return { - id: aggConfig.id, - football: football, - }; - }); - - (function recurse(lvl) { - const info = aggInfos.shift(); - - expect(lvl).to.have.property(info.id); - expect(lvl[info.id]).to.be(info.football); - - if (lvl[info.id].aggs) { - return recurse(lvl[info.id].aggs); - } - })(vis.aggs.toDsl()); - - expect(aggInfos).to.have.length(1); - }); - - it("skips aggs that don't have a dsl representation", function() { - const vis = new visualizationsStart.Vis(indexPattern, { - type: 'histogram', - aggs: [ - { - type: 'date_histogram', - schema: 'segment', - params: { field: '@timestamp', interval: '10s' }, - }, - { type: 'count', schema: 'metric' }, - ], - }); - - const dsl = vis.aggs.toDsl(); - const histo = vis.aggs.byName('date_histogram')[0]; - const count = vis.aggs.byName('count')[0]; - - expect(dsl).to.have.property(histo.id); - expect(dsl[histo.id]).to.be.an('object'); - expect(dsl[histo.id]).to.not.have.property('aggs'); - expect(dsl).to.not.have.property(count.id); - }); - - it('writes multiple metric aggregations at the same level', function() { - const vis = new visualizationsStart.Vis(indexPattern, { - type: 'histogram', - aggs: [ - { - type: 'date_histogram', - schema: 'segment', - params: { field: '@timestamp', interval: '10s' }, - }, - { type: 'avg', schema: 'metric', params: { field: 'bytes' } }, - { type: 'sum', schema: 'metric', params: { field: 'bytes' } }, - { type: 'min', schema: 'metric', params: { field: 'bytes' } }, - { type: 'max', schema: 'metric', params: { field: 'bytes' } }, - ], - }); - - const dsl = vis.aggs.toDsl(); - - const histo = vis.aggs.byName('date_histogram')[0]; - const metrics = vis.aggs.bySchemaGroup('metrics'); - - expect(dsl).to.have.property(histo.id); - expect(dsl[histo.id]).to.be.an('object'); - expect(dsl[histo.id]).to.have.property('aggs'); - - metrics.forEach(function(metric) { - expect(dsl[histo.id].aggs).to.have.property(metric.id); - expect(dsl[histo.id].aggs[metric.id]).to.not.have.property('aggs'); - }); - }); - - it('writes multiple metric aggregations at every level if the vis is hierarchical', function() { - const vis = new visualizationsStart.Vis(indexPattern, { - type: 'histogram', - aggs: [ - { type: 'terms', schema: 'segment', params: { field: 'ip', orderBy: 1 } }, - { type: 'terms', schema: 'segment', params: { field: 'extension', orderBy: 1 } }, - { id: 1, type: 'avg', schema: 'metric', params: { field: 'bytes' } }, - { type: 'sum', schema: 'metric', params: { field: 'bytes' } }, - { type: 'min', schema: 'metric', params: { field: 'bytes' } }, - { type: 'max', schema: 'metric', params: { field: 'bytes' } }, - ], - }); - vis.isHierarchical = _.constant(true); - - const topLevelDsl = vis.aggs.toDsl(vis.isHierarchical()); - const buckets = vis.aggs.bySchemaGroup('buckets'); - const metrics = vis.aggs.bySchemaGroup('metrics'); - - (function checkLevel(dsl) { - const bucket = buckets.shift(); - expect(dsl).to.have.property(bucket.id); - - expect(dsl[bucket.id]).to.be.an('object'); - expect(dsl[bucket.id]).to.have.property('aggs'); - - metrics.forEach(function(metric) { - expect(dsl[bucket.id].aggs).to.have.property(metric.id); - expect(dsl[bucket.id].aggs[metric.id]).to.not.have.property('aggs'); - }); - - if (buckets.length) { - checkLevel(dsl[bucket.id].aggs); - } - })(topLevelDsl); - }); - - it('adds the parent aggs of nested metrics at every level if the vis is hierarchical', function() { - const vis = new visualizationsStart.Vis(indexPattern, { - type: 'histogram', - aggs: [ - { - id: '1', - type: 'avg_bucket', - schema: 'metric', - params: { - customBucket: { - id: '1-bucket', - type: 'date_histogram', - schema: 'bucketAgg', - params: { - field: '@timestamp', - interval: '10s', - }, - }, - customMetric: { - id: '1-metric', - type: 'count', - schema: 'metricAgg', - params: {}, - }, - }, - }, - { - id: '2', - type: 'terms', - schema: 'bucket', - params: { - field: 'geo.src', - }, - }, - { - id: '3', - type: 'terms', - schema: 'bucket', - params: { - field: 'machine.os', - }, - }, - ], - }); - vis.isHierarchical = _.constant(true); - - const topLevelDsl = vis.aggs.toDsl(vis.isHierarchical())['2']; - expect(topLevelDsl.aggs).to.have.keys(['1', '1-bucket']); - expect(topLevelDsl.aggs['1'].avg_bucket).to.have.property('buckets_path', '1-bucket>_count'); - expect(topLevelDsl.aggs['3'].aggs).to.have.keys(['1', '1-bucket']); - expect(topLevelDsl.aggs['3'].aggs['1'].avg_bucket).to.have.property( - 'buckets_path', - '1-bucket>_count' - ); - }); - }); -}); diff --git a/src/plugins/data/common/field_formats/mocks.ts b/src/plugins/data/common/field_formats/mocks.ts new file mode 100644 index 0000000000000..bc38374e147cf --- /dev/null +++ b/src/plugins/data/common/field_formats/mocks.ts @@ -0,0 +1,49 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { FieldFormat, IFieldFormatsRegistry } from '.'; + +const fieldFormatMock = ({ + convert: jest.fn(), + getConverterFor: jest.fn(), + getParamDefaults: jest.fn(), + param: jest.fn(), + params: jest.fn(), + toJSON: jest.fn(), + type: jest.fn(), + setupContentType: jest.fn(), +} as unknown) as FieldFormat; + +export const fieldFormatsMock: IFieldFormatsRegistry = { + getByFieldType: jest.fn(), + getDefaultConfig: jest.fn(), + getDefaultInstance: jest.fn().mockImplementation(() => fieldFormatMock) as any, + getDefaultInstanceCacheResolver: jest.fn(), + getDefaultInstancePlain: jest.fn(), + getDefaultType: jest.fn(), + getDefaultTypeName: jest.fn(), + getInstance: jest.fn() as any, + getType: jest.fn(), + getTypeNameByEsTypes: jest.fn(), + init: jest.fn(), + register: jest.fn(), + parseDefaultTypeMap: jest.fn(), + deserialize: jest.fn(), + getTypeWithoutMetaParams: jest.fn(), +}; diff --git a/src/plugins/data/public/mocks.ts b/src/plugins/data/public/mocks.ts index 6a0a33096eaac..27de3b5a29bfd 100644 --- a/src/plugins/data/public/mocks.ts +++ b/src/plugins/data/public/mocks.ts @@ -16,13 +16,9 @@ * specific language governing permissions and limitations * under the License. */ -import { - Plugin, - DataPublicPluginSetup, - DataPublicPluginStart, - IndexPatternsContract, - IFieldFormatsRegistry, -} from '.'; + +import { Plugin, DataPublicPluginSetup, DataPublicPluginStart, IndexPatternsContract } from '.'; +import { fieldFormatsMock } from '../common/field_formats/mocks'; import { searchSetupMock } from './search/mocks'; import { queryServiceMock } from './query/mocks'; @@ -35,24 +31,6 @@ const autocompleteMock: any = { hasQuerySuggestions: jest.fn(), }; -const fieldFormatsMock: IFieldFormatsRegistry = { - getByFieldType: jest.fn(), - getDefaultConfig: jest.fn(), - getDefaultInstance: jest.fn() as any, - getDefaultInstanceCacheResolver: jest.fn(), - getDefaultInstancePlain: jest.fn(), - getDefaultType: jest.fn(), - getDefaultTypeName: jest.fn(), - getInstance: jest.fn() as any, - getType: jest.fn(), - getTypeNameByEsTypes: jest.fn(), - init: jest.fn(), - register: jest.fn(), - parseDefaultTypeMap: jest.fn(), - deserialize: jest.fn(), - getTypeWithoutMetaParams: jest.fn(), -}; - const createSetupContract = (): Setup => { const querySetupMock = queryServiceMock.createSetupContract(); const setupContract = { diff --git a/src/plugins/data/public/search/search_source/mocks.ts b/src/plugins/data/public/search/search_source/mocks.ts index fd72158012de6..700bea741bd6a 100644 --- a/src/plugins/data/public/search/search_source/mocks.ts +++ b/src/plugins/data/public/search/search_source/mocks.ts @@ -17,25 +17,6 @@ * under the License. */ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"), you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - import { ISearchSource } from './search_source'; export const searchSourceMock: MockedKeys = { diff --git a/x-pack/legacy/plugins/lens/public/editor_frame_service/service.test.tsx b/x-pack/legacy/plugins/lens/public/editor_frame_service/service.test.tsx index ef4b5f6d7b834..2e1645c816140 100644 --- a/x-pack/legacy/plugins/lens/public/editor_frame_service/service.test.tsx +++ b/x-pack/legacy/plugins/lens/public/editor_frame_service/service.test.tsx @@ -17,10 +17,6 @@ jest.mock('ui/new_platform'); // mock away actual dependencies to prevent all of it being loaded jest.mock('../../../../../../src/legacy/core_plugins/interpreter/public/registries', () => {}); -jest.mock('../../../../../../src/legacy/core_plugins/data/public/legacy', () => ({ - start: {}, - setup: {}, -})); jest.mock('./embeddable/embeddable_factory', () => ({ EmbeddableFactory: class Mock {}, })); From a3e68a18309d6731388878934ba70eaa10ea77d7 Mon Sep 17 00:00:00 2001 From: Spencer Date: Fri, 28 Feb 2020 11:42:34 -0700 Subject: [PATCH 18/31] =?UTF-8?q?Revert=20"[SIEM]=20apollo@3=20(#51926)"?= =?UTF-8?q?=20and=20"[SIEM][CASE]=20Init=20Confi=E2=80=A6=20(#58806)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Revert "[SIEM] apollo@3 (#51926)" This reverts commit 320e292ea8b32f397b59ec595af3822f37b11f1c. * Revert "[SIEM][CASE] Init Configure Case Page (#58121)" This reverts commit 967bef7b3877ab67e0c213fd5fa67a66ad14f5d1. * update a snapshot... --- package.json | 17 +- .../basic_optimization.test.ts | 1 + .../integration_tests/bundle_cache.test.ts | 1 + .../src/worker/webpack.config.ts | 2 +- packages/kbn-pm/dist/index.js | 26319 +++++++++++++++- .../siem/common/graphql/root/schema.gql.ts | 2 +- .../siem/common/graphql/shared/schema.gql.ts | 2 +- x-pack/legacy/plugins/siem/public/app/app.tsx | 20 +- .../drag_drop_context_wrapper.test.tsx | 4 +- .../drag_and_drop/draggable_wrapper.test.tsx | 4 +- .../drag_and_drop/droppable_wrapper.test.tsx | 4 +- .../components/event_details/columns.tsx | 4 +- .../components/event_details/helpers.tsx | 4 +- .../events_viewer/events_viewer.test.tsx | 11 +- .../events_viewer/events_viewer.tsx | 3 +- .../components/events_viewer/index.test.tsx | 7 +- .../siem/public/components/flyout/index.tsx | 13 +- .../__snapshots__/index.test.tsx.snap | 103 +- .../components/header_global/index.test.tsx | 7 +- .../public/components/header_global/index.tsx | 108 +- .../siem/public/components/link_to/index.ts | 2 - .../public/components/link_to/link_to.tsx | 11 +- .../components/link_to/redirect_to_case.tsx | 4 - .../components/open_timeline/helpers.ts | 2 +- .../components/open_timeline/index.test.tsx | 115 +- .../public/components/open_timeline/index.tsx | 5 +- .../open_timeline/open_timeline.test.tsx | 2 +- .../open_timeline_modal/index.test.tsx | 8 +- .../open_timeline_modal/index.tsx | 44 +- .../open_timeline_modal_body.test.tsx | 2 +- .../open_timeline_modal_button.test.tsx | 7 +- .../timelines_table/actions_columns.test.tsx | 2 +- .../timelines_table/common_columns.test.tsx | 2 +- .../timelines_table/extended_columns.test.tsx | 2 +- .../icon_header_columns.test.tsx | 2 +- .../timelines_table/index.test.tsx | 2 +- .../hosts/first_last_seen_host/index.test.tsx | 12 +- .../page/hosts/first_last_seen_host/index.tsx | 68 +- .../__snapshots__/index.test.tsx.snap | 91 + .../page/hosts/hosts_table/index.test.tsx | 11 +- .../page/hosts/hosts_table/index.tsx | 4 + .../components/page/hosts/kpi_hosts/index.tsx | 4 +- .../network/network_dns_table/index.test.tsx | 2 +- .../network/network_http_table/index.test.tsx | 2 +- .../index.test.tsx | 2 +- .../network_top_n_flow_table/index.test.tsx | 2 +- .../page/network/tls_table/index.test.tsx | 2 +- .../page/network/users_table/index.test.tsx | 2 +- .../overview/overview_host/index.test.tsx | 11 +- .../overview/overview_network/index.test.tsx | 11 +- .../page/overview/overview_network/index.tsx | 10 +- .../components/recent_timelines/index.tsx | 6 +- .../public/components/search_bar/index.tsx | 2 +- .../public/components/stat_items/index.tsx | 10 +- .../components/super_date_picker/index.tsx | 2 +- .../components/timeline/body/helpers.test.ts | 4 +- .../timeline/body/stateful_body.tsx | 3 +- .../timeline/fetch_kql_timeline.tsx | 12 +- .../components/timeline/footer/index.tsx | 3 + .../components/timeline/header/index.tsx | 18 +- .../public/components/timeline/helpers.tsx | 130 +- .../siem/public/components/timeline/index.tsx | 74 +- .../timeline/search_or_filter/index.tsx | 2 +- .../components/timeline/timeline.test.tsx | 2 +- .../public/components/timeline/timeline.tsx | 31 +- .../components/url_state/index.test.tsx | 29 +- .../public/components/url_state/index.tsx | 2 +- .../url_state/index_mocked.test.tsx | 17 +- .../siem/public/components/url_state/types.ts | 5 +- .../components/url_state/use_url_state.tsx | 2 +- .../authentications/index.gql_query.ts | 2 +- .../containers/authentications/index.tsx | 11 +- .../rules/fetch_index_patterns.test.tsx | 4 +- .../rules/fetch_index_patterns.tsx | 2 +- .../public/containers/errors/index.test.tsx | 3 +- .../events/last_event_time/index.ts | 88 +- .../last_event_time.gql_query.ts | 2 +- .../containers/events/last_event_time/mock.ts | 11 +- .../public/containers/global_time/index.tsx | 71 +- .../plugins/siem/public/containers/helpers.ts | 4 +- .../first_last_seen.gql_query.ts | 2 +- .../containers/hosts/first_last_seen/index.ts | 11 +- .../containers/hosts/first_last_seen/mock.ts | 10 +- .../containers/hosts/hosts_table.gql_query.ts | 2 +- .../siem/public/containers/hosts/index.tsx | 10 +- .../hosts/overview/host_overview.gql_query.ts | 2 +- .../containers/hosts/overview/index.tsx | 15 +- .../containers/ip_overview/index.gql_query.ts | 2 +- .../public/containers/ip_overview/index.tsx | 12 +- ...index.gql_query.ts => index.gql_query.tsx} | 2 +- .../containers/kpi_host_details/index.tsx | 12 +- .../containers/kpi_hosts/index.gql_query.ts | 2 +- .../public/containers/kpi_hosts/index.tsx | 12 +- .../containers/kpi_network/index.gql_query.ts | 2 +- .../public/containers/kpi_network/index.tsx | 12 +- .../matrix_histogram/index.gql_query.ts | 2 +- .../matrix_histogram/index.test.tsx | 5 +- .../containers/matrix_histogram/index.ts | 3 +- .../containers/network_dns/index.gql_query.ts | 2 +- .../public/containers/network_dns/index.tsx | 10 +- .../network_http/index.gql_query.ts | 2 +- .../public/containers/network_http/index.tsx | 10 +- .../network_top_countries/index.gql_query.ts | 2 +- .../network_top_countries/index.tsx | 10 +- .../network_top_n_flow/index.gql_query.ts | 2 +- .../containers/network_top_n_flow/index.tsx | 10 +- .../overview/overview_host/index.gql_query.ts | 2 +- .../overview/overview_host/index.tsx | 64 +- .../overview_network/index.gql_query.ts | 2 +- .../overview/overview_network/index.tsx | 12 +- .../siem/public/containers/query_template.tsx | 8 +- .../containers/query_template_paginated.tsx | 11 +- .../containers/source/index.gql_query.ts | 2 +- .../public/containers/source/index.test.tsx | 44 +- .../siem/public/containers/source/index.tsx | 127 +- .../timeline/all/index.gql_query.ts | 2 +- .../public/containers/timeline/all/index.tsx | 11 +- .../timeline/delete/persist.gql_query.ts | 2 +- .../timeline/details/index.gql_query.ts | 2 +- .../containers/timeline/details/index.tsx | 14 +- .../timeline/favorite/persist.gql_query.ts | 2 +- .../containers/timeline/index.gql_query.ts | 2 +- .../siem/public/containers/timeline/index.tsx | 16 +- .../timeline/notes/persist.gql_query.ts | 2 +- .../timeline/one/index.gql_query.ts | 2 +- .../containers/timeline/persist.gql_query.ts | 2 +- .../pinned_event/persist.gql_query.ts | 2 +- .../public/containers/tls/index.gql_query.ts | 2 +- .../siem/public/containers/tls/index.tsx | 10 +- .../uncommon_processes/index.gql_query.ts | 2 +- .../containers/uncommon_processes/index.tsx | 11 +- .../containers/users/index.gql_query.ts | 2 +- .../siem/public/containers/users/index.tsx | 18 +- .../siem/public/graphql/introspection.json | 12556 ++++++++ .../plugins/siem/public/graphql/types.ts | 5943 ++++ .../plugins/siem/public/graphql/types.tsx | 5314 ---- .../siem/public/lib/compose/helpers.test.ts | 25 +- .../siem/public/lib/compose/helpers.ts | 12 +- .../public/lib/compose/kibana_compose.tsx | 21 +- x-pack/legacy/plugins/siem/public/lib/lib.ts | 3 +- .../siem/public/mock/test_providers.tsx | 7 +- .../siem/public/mock/timeline_results.ts | 10 +- .../plugins/siem/public/pages/case/case.tsx | 27 +- .../components/case_header_page/index.tsx | 22 - .../case_header_page/translations.ts | 16 - .../pages/case/components/case_view/index.tsx | 13 +- .../components/configure_cases/connectors.tsx | 52 - .../connectors_dropdown/index.tsx | 56 - .../configure_cases/translations.ts | 37 - .../pages/case/components/wrappers/index.tsx | 22 - .../public/pages/case/configure_cases.tsx | 54 - .../siem/public/pages/case/create_case.tsx | 10 +- .../plugins/siem/public/pages/case/index.tsx | 5 - .../siem/public/pages/case/translations.ts | 20 +- .../components/signals/default_config.tsx | 4 +- .../components/signals/index.tsx | 2 +- .../components/signals/types.ts | 4 +- .../detection_engine/detection_engine.tsx | 166 +- .../detection_engine/rules/details/index.tsx | 291 +- .../plugins/siem/public/pages/home/index.tsx | 154 +- .../pages/hosts/details/details_tabs.test.tsx | 12 +- .../pages/hosts/details/details_tabs.tsx | 1 + .../siem/public/pages/hosts/details/index.tsx | 216 +- .../siem/public/pages/hosts/hosts.test.tsx | 5 +- .../plugins/siem/public/pages/hosts/hosts.tsx | 152 +- .../siem/public/pages/hosts/hosts_tabs.tsx | 39 +- .../plugins/siem/public/pages/hosts/index.tsx | 116 +- .../navigation/events_query_tab_body.tsx | 4 +- .../hosts/navigation/hosts_query_tab_body.tsx | 2 + .../public/pages/hosts/navigation/types.ts | 3 +- .../plugins/siem/public/pages/hosts/types.ts | 2 + .../siem/public/pages/network/index.tsx | 111 +- .../__snapshots__/index.test.tsx.snap | 65 +- .../pages/network/ip_details/index.test.tsx | 72 +- .../public/pages/network/ip_details/index.tsx | 305 +- .../public/pages/network/network.test.tsx | 5 +- .../siem/public/pages/network/network.tsx | 176 +- .../pages/overview/event_counts/index.tsx | 28 +- .../siem/public/pages/overview/index.tsx | 4 +- .../public/pages/overview/overview.test.tsx | 5 +- .../siem/public/pages/overview/overview.tsx | 167 +- .../public/pages/overview/sidebar/sidebar.tsx | 4 +- .../siem/public/pages/timelines/index.tsx | 39 +- .../public/pages/timelines/timelines_page.tsx | 48 + .../public/store/timeline/epic_favorite.ts | 3 +- .../siem/public/store/timeline/epic_note.ts | 3 +- .../store/timeline/epic_pinned_event.ts | 3 +- .../siem/public/utils/apollo_context.ts | 19 + .../siem/public/utils/route/spy_routes.tsx | 3 +- .../utils/timeline/use_show_timeline.tsx | 31 - .../plugins/siem/scripts/combined_schema.ts | 2 +- .../scripts/generate_types_from_graphql.js | 275 +- .../graphql/authentications/resolvers.ts | 9 +- .../graphql/authentications/schema.gql.ts | 2 +- .../siem/server/graphql/ecs/schema.gql.ts | 2 +- .../siem/server/graphql/events/resolvers.ts | 24 +- .../siem/server/graphql/events/schema.gql.ts | 2 +- .../siem/server/graphql/hosts/resolvers.ts | 23 +- .../siem/server/graphql/hosts/schema.gql.ts | 2 +- .../server/graphql/ip_details/resolvers.ts | 16 +- .../server/graphql/ip_details/schema.gql.ts | 2 +- .../server/graphql/kpi_hosts/resolvers.ts | 16 +- .../server/graphql/kpi_hosts/schema.gql.ts | 2 +- .../server/graphql/kpi_network/resolvers.ts | 9 +- .../server/graphql/kpi_network/schema.gql.ts | 2 +- .../graphql/matrix_histogram/resolvers.ts | 9 +- .../graphql/matrix_histogram/schema.gql.ts | 2 +- .../siem/server/graphql/network/resolvers.ts | 30 +- .../siem/server/graphql/network/schema.gql.ts | 2 +- .../siem/server/graphql/note/resolvers.ts | 38 +- .../siem/server/graphql/note/schema.gql.ts | 2 +- .../siem/server/graphql/overview/resolvers.ts | 16 +- .../server/graphql/overview/schema.gql.ts | 2 +- .../server/graphql/pinned_event/resolvers.ts | 25 +- .../server/graphql/pinned_event/schema.gql.ts | 2 +- .../graphql/scalar_date/resolvers.test.ts | 4 +- .../server/graphql/scalar_date/schema.gql.ts | 2 +- .../graphql/scalar_to_any/schema.gql.ts | 2 +- .../scalar_to_boolean_array/schema.gql.ts | 2 +- .../scalar_to_date_array/schema.gql.ts | 2 +- .../scalar_to_number_array/schema.gql.ts | 2 +- .../server/graphql/source_status/resolvers.ts | 16 +- .../graphql/source_status/schema.gql.ts | 2 +- .../siem/server/graphql/sources/resolvers.ts | 56 +- .../siem/server/graphql/sources/schema.gql.ts | 2 +- .../siem/server/graphql/timeline/resolvers.ts | 28 +- .../server/graphql/timeline/schema.gql.ts | 2 +- .../siem/server/graphql/tls/resolvers.ts | 9 +- .../siem/server/graphql/tls/schema.gql.ts | 2 +- .../plugins/siem/server/graphql/types.ts | 12347 +++++--- .../graphql/uncommon_processes/resolvers.ts | 9 +- .../graphql/uncommon_processes/schema.gql.ts | 2 +- .../siem/server/graphql/who_am_i/resolvers.ts | 9 +- .../server/graphql/who_am_i/schema.gql.ts | 2 +- .../legacy/plugins/siem/server/init_server.ts | 2 +- .../siem/server/lib/framework/types.ts | 6 +- .../siem/server/utils/typed_resolvers.ts | 111 + x-pack/package.json | 25 +- .../apis/siem/feature_controls.ts | 2 +- .../apis/siem/saved_objects/notes.ts | 2 +- .../apis/siem/saved_objects/timeline.ts | 2 +- .../services/siem_graphql_client.ts | 11 +- yarn.lock | 1734 +- 243 files changed, 55781 insertions(+), 13795 deletions(-) rename x-pack/legacy/plugins/siem/public/containers/kpi_host_details/{index.gql_query.ts => index.gql_query.tsx} (97%) create mode 100644 x-pack/legacy/plugins/siem/public/graphql/introspection.json create mode 100644 x-pack/legacy/plugins/siem/public/graphql/types.ts delete mode 100644 x-pack/legacy/plugins/siem/public/graphql/types.tsx delete mode 100644 x-pack/legacy/plugins/siem/public/pages/case/components/case_header_page/index.tsx delete mode 100644 x-pack/legacy/plugins/siem/public/pages/case/components/case_header_page/translations.ts delete mode 100644 x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/connectors.tsx delete mode 100644 x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/connectors_dropdown/index.tsx delete mode 100644 x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/translations.ts delete mode 100644 x-pack/legacy/plugins/siem/public/pages/case/components/wrappers/index.tsx delete mode 100644 x-pack/legacy/plugins/siem/public/pages/case/configure_cases.tsx create mode 100644 x-pack/legacy/plugins/siem/public/pages/timelines/timelines_page.tsx create mode 100644 x-pack/legacy/plugins/siem/public/utils/apollo_context.ts delete mode 100644 x-pack/legacy/plugins/siem/public/utils/timeline/use_show_timeline.tsx create mode 100644 x-pack/legacy/plugins/siem/server/utils/typed_resolvers.ts diff --git a/package.json b/package.json index 4ac4cbea96248..0f04a2fba3b65 100644 --- a/package.json +++ b/package.json @@ -77,31 +77,23 @@ "url": "https://github.com/elastic/kibana.git" }, "resolutions": { - "**/@apollo/client": "^3.0.0-beta.37", - "**/@graphql-toolkit/common": "^0.9.7", - "**/@graphql-toolkit/core": "^0.9.7", - "**/@graphql-toolkit/graphql-file-loader": "^0.9.7", - "**/@graphql-toolkit/json-file-loader": "^0.9.7", - "**/@graphql-toolkit/schema-merging": "^0.9.7", - "**/@graphql-toolkit/url-loader": "^0.9.7", "**/@types/node": "10.12.27", "**/@types/react": "^16.9.19", "**/@types/react-router": "^5.1.3", "**/@types/hapi": "^17.0.18", "**/@types/angular": "^1.6.56", "**/@types/hoist-non-react-statics": "^3.3.1", - "**/apollo-link": "^1.2.13", - "**/deepmerge": "^4.2.2", - "**/fast-deep-equal": "^3.1.1", - "**/fast-glob": "3.1.1", + "**/typescript": "3.7.2", + "**/graphql-toolkit/lodash": "^4.17.13", "**/hoist-non-react-statics": "^3.3.2", "**/isomorphic-git/**/base64-js": "^1.2.1", "**/image-diff/gm/debug": "^2.6.9", "**/react-dom": "^16.12.0", "**/react": "^16.12.0", "**/react-test-renderer": "^16.12.0", + "**/deepmerge": "^4.2.2", "**/serialize-javascript": "^2.1.1", - "**/typescript": "3.7.2" + "**/fast-deep-equal": "^3.1.1" }, "workspaces": { "packages": [ @@ -333,6 +325,7 @@ "@types/getopts": "^2.0.1", "@types/glob": "^7.1.1", "@types/globby": "^8.0.0", + "@types/graphql": "^0.13.2", "@types/hapi": "^17.0.18", "@types/hapi-auth-cookie": "^9.1.0", "@types/has-ansi": "^3.0.0", diff --git a/packages/kbn-optimizer/src/integration_tests/basic_optimization.test.ts b/packages/kbn-optimizer/src/integration_tests/basic_optimization.test.ts index 3d9393fd2d005..fec31cbe40dfe 100644 --- a/packages/kbn-optimizer/src/integration_tests/basic_optimization.test.ts +++ b/packages/kbn-optimizer/src/integration_tests/basic_optimization.test.ts @@ -38,6 +38,7 @@ beforeAll(async () => { await cpy('**/*', MOCK_REPO_DIR, { cwd: MOCK_REPO_SRC, parents: true, + deep: true, }); }); diff --git a/packages/kbn-optimizer/src/integration_tests/bundle_cache.test.ts b/packages/kbn-optimizer/src/integration_tests/bundle_cache.test.ts index 3cddbfc53c1b9..1bfd8d3fd073a 100644 --- a/packages/kbn-optimizer/src/integration_tests/bundle_cache.test.ts +++ b/packages/kbn-optimizer/src/integration_tests/bundle_cache.test.ts @@ -44,6 +44,7 @@ beforeEach(async () => { await cpy('**/*', MOCK_REPO_DIR, { cwd: MOCK_REPO_SRC, parents: true, + deep: true, }); }); diff --git a/packages/kbn-optimizer/src/worker/webpack.config.ts b/packages/kbn-optimizer/src/worker/webpack.config.ts index 9ca0ad5811ef8..3c6ae78bc4d91 100644 --- a/packages/kbn-optimizer/src/worker/webpack.config.ts +++ b/packages/kbn-optimizer/src/worker/webpack.config.ts @@ -217,7 +217,7 @@ export function getWebpackConfig(bundle: Bundle, worker: WorkerConfig) { }, resolve: { - extensions: ['.mjs', '.js', '.ts', '.tsx', '.json'], + extensions: ['.js', '.ts', '.tsx', '.json'], alias: { tinymath: require.resolve('tinymath/lib/tinymath.es5.js'), }, diff --git a/packages/kbn-pm/dist/index.js b/packages/kbn-pm/dist/index.js index 99b4b82a7e99b..fe0491870e4bd 100644 --- a/packages/kbn-pm/dist/index.js +++ b/packages/kbn-pm/dist/index.js @@ -94,7 +94,7 @@ __webpack_require__.r(__webpack_exports__); /* harmony import */ var _cli__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "run", function() { return _cli__WEBPACK_IMPORTED_MODULE_0__["run"]; }); -/* harmony import */ var _production__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(705); +/* harmony import */ var _production__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(704); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "buildProductionProjects", function() { return _production__WEBPACK_IMPORTED_MODULE_1__["buildProductionProjects"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "prepareExternalProjectDependencies", function() { return _production__WEBPACK_IMPORTED_MODULE_1__["prepareExternalProjectDependencies"]; }); @@ -152,7 +152,7 @@ __webpack_require__.r(__webpack_exports__); /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(16); /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_3__); /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(17); -/* harmony import */ var _run__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(690); +/* harmony import */ var _run__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(689); /* harmony import */ var _utils_log__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(34); /* * Licensed to Elasticsearch B.V. under one or more contributor @@ -2507,8 +2507,8 @@ __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "commands", function() { return commands; }); /* harmony import */ var _bootstrap__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(18); /* harmony import */ var _clean__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(586); -/* harmony import */ var _run__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(687); -/* harmony import */ var _watch__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(688); +/* harmony import */ var _run__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(686); +/* harmony import */ var _watch__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(687); /* * Licensed to Elasticsearch B.V. under one or more contributor * license agreements. See the NOTICE file distributed with @@ -67704,7 +67704,7 @@ __webpack_require__.r(__webpack_exports__); /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(chalk__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var del__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(587); /* harmony import */ var del__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(del__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var ora__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(676); +/* harmony import */ var ora__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(675); /* harmony import */ var ora__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(ora__WEBPACK_IMPORTED_MODULE_2__); /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(16); /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_3__); @@ -67813,12 +67813,12 @@ const {promisify} = __webpack_require__(29); const path = __webpack_require__(16); const globby = __webpack_require__(588); const isGlob = __webpack_require__(605); -const slash = __webpack_require__(667); +const slash = __webpack_require__(666); const gracefulFs = __webpack_require__(22); -const isPathCwd = __webpack_require__(669); -const isPathInside = __webpack_require__(670); -const rimraf = __webpack_require__(671); -const pMap = __webpack_require__(672); +const isPathCwd = __webpack_require__(668); +const isPathInside = __webpack_require__(669); +const rimraf = __webpack_require__(670); +const pMap = __webpack_require__(671); const rimrafP = promisify(rimraf); @@ -67942,9 +67942,9 @@ const arrayUnion = __webpack_require__(589); const merge2 = __webpack_require__(590); const glob = __webpack_require__(591); const fastGlob = __webpack_require__(596); -const dirGlob = __webpack_require__(663); -const gitignore = __webpack_require__(665); -const {FilterStream, UniqueStream} = __webpack_require__(668); +const dirGlob = __webpack_require__(662); +const gitignore = __webpack_require__(664); +const {FilterStream, UniqueStream} = __webpack_require__(667); const DEFAULT_FILTER = () => false; @@ -69831,10 +69831,10 @@ function childrenIgnored (self, path) { "use strict"; const taskManager = __webpack_require__(597); -const async_1 = __webpack_require__(626); -const stream_1 = __webpack_require__(659); -const sync_1 = __webpack_require__(660); -const settings_1 = __webpack_require__(662); +const async_1 = __webpack_require__(625); +const stream_1 = __webpack_require__(658); +const sync_1 = __webpack_require__(659); +const settings_1 = __webpack_require__(661); const utils = __webpack_require__(598); function FastGlob(source, options) { try { @@ -69846,8 +69846,6 @@ function FastGlob(source, options) { const works = getWorks(source, async_1.default, options); return Promise.all(works).then(utils.array.flatten); } -// https://github.com/typescript-eslint/typescript-eslint/issues/60 -// eslint-disable-next-line no-redeclare (function (FastGlob) { function sync(source, options) { assertPatternsInput(source); @@ -69873,17 +69871,6 @@ function FastGlob(source, options) { return taskManager.generate(patterns, settings); } FastGlob.generateTasks = generateTasks; - function isDynamicPattern(source, options) { - assertPatternsInput(source); - const settings = new settings_1.default(options); - return utils.pattern.isDynamicPattern(source, settings); - } - FastGlob.isDynamicPattern = isDynamicPattern; - function escapePath(source) { - assertPatternsInput(source); - return utils.path.escape(source); - } - FastGlob.escapePath = escapePath; })(FastGlob || (FastGlob = {})); function getWorks(source, _Provider, options) { const patterns = [].concat(source); @@ -69899,6 +69886,7 @@ function assertPatternsInput(source) { throw new TypeError('Patterns must be a string or an array of strings'); } function isString(source) { + /* tslint:disable-next-line strict-type-predicates */ return typeof source === 'string'; } module.exports = FastGlob; @@ -69915,8 +69903,12 @@ const utils = __webpack_require__(598); function generate(patterns, settings) { const positivePatterns = getPositivePatterns(patterns); const negativePatterns = getNegativePatternsAsPositive(patterns, settings.ignore); - const staticPatterns = positivePatterns.filter((pattern) => utils.pattern.isStaticPattern(pattern, settings)); - const dynamicPatterns = positivePatterns.filter((pattern) => utils.pattern.isDynamicPattern(pattern, settings)); + /** + * When the `caseSensitiveMatch` option is disabled, all patterns must be marked as dynamic, because we cannot check + * filepath directly (without read directory). + */ + const staticPatterns = !settings.caseSensitiveMatch ? [] : positivePatterns.filter(utils.pattern.isStaticPattern); + const dynamicPatterns = !settings.caseSensitiveMatch ? positivePatterns : positivePatterns.filter(utils.pattern.isDynamicPattern); const staticTasks = convertPatternsToTasks(staticPatterns, negativePatterns, /* dynamic */ false); const dynamicTasks = convertPatternsToTasks(dynamicPatterns, negativePatterns, /* dynamic */ true); return staticTasks.concat(dynamicTasks); @@ -69944,7 +69936,6 @@ function getNegativePatternsAsPositive(patterns, ignore) { } exports.getNegativePatternsAsPositive = getNegativePatternsAsPositive; function groupPatternsByBaseDirectory(patterns) { - const group = {}; return patterns.reduce((collection, pattern) => { const base = utils.pattern.getBaseDirectory(pattern); if (base in collection) { @@ -69954,7 +69945,7 @@ function groupPatternsByBaseDirectory(patterns) { collection[base] = [pattern]; } return collection; - }, group); + }, {}); } exports.groupPatternsByBaseDirectory = groupPatternsByBaseDirectory; function convertPatternGroupsToTasks(positive, negative, dynamic) { @@ -70055,7 +70046,6 @@ exports.createDirentFromStats = createDirentFromStats; Object.defineProperty(exports, "__esModule", { value: true }); const path = __webpack_require__(16); -const UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([*?|(){}[\]]|^!|[@+!](?=\())/g; /** * Designed to work only with simple paths: `dir\\file`. */ @@ -70067,10 +70057,6 @@ function makeAbsolute(cwd, filepath) { return path.resolve(cwd, filepath); } exports.makeAbsolute = makeAbsolute; -function escape(pattern) { - return pattern.replace(UNESCAPED_GLOB_SYMBOLS_RE, '\\$2'); -} -exports.escape = escape; /***/ }), @@ -70082,36 +70068,15 @@ exports.escape = escape; Object.defineProperty(exports, "__esModule", { value: true }); const path = __webpack_require__(16); const globParent = __webpack_require__(604); +const isGlob = __webpack_require__(605); const micromatch = __webpack_require__(607); const GLOBSTAR = '**'; -const ESCAPE_SYMBOL = '\\'; -const COMMON_GLOB_SYMBOLS_RE = /[*?]|^!/; -const REGEX_CHARACTER_CLASS_SYMBOLS_RE = /\[.*]/; -const REGEX_GROUP_SYMBOLS_RE = /(?:^|[^@!*?+])\(.*\|.*\)/; -const GLOB_EXTENSION_SYMBOLS_RE = /[@!*?+]\(.*\)/; -const BRACE_EXPANSIONS_SYMBOLS_RE = /{.*(?:,|\.\.).*}/; -function isStaticPattern(pattern, options = {}) { - return !isDynamicPattern(pattern, options); +function isStaticPattern(pattern) { + return !isDynamicPattern(pattern); } exports.isStaticPattern = isStaticPattern; -function isDynamicPattern(pattern, options = {}) { - /** - * When the `caseSensitiveMatch` option is disabled, all patterns must be marked as dynamic, because we cannot check - * filepath directly (without read directory). - */ - if (options.caseSensitiveMatch === false || pattern.includes(ESCAPE_SYMBOL)) { - return true; - } - if (COMMON_GLOB_SYMBOLS_RE.test(pattern) || REGEX_CHARACTER_CLASS_SYMBOLS_RE.test(pattern) || REGEX_GROUP_SYMBOLS_RE.test(pattern)) { - return true; - } - if (options.extglob !== false && GLOB_EXTENSION_SYMBOLS_RE.test(pattern)) { - return true; - } - if (options.braceExpansion !== false && BRACE_EXPANSIONS_SYMBOLS_RE.test(pattern)) { - return true; - } - return false; +function isDynamicPattern(pattern) { + return isGlob(pattern, { strict: false }); } exports.isDynamicPattern = isDynamicPattern; function convertToPositivePattern(pattern) { @@ -70139,11 +70104,11 @@ function getPositivePatterns(patterns) { } exports.getPositivePatterns = getPositivePatterns; function getBaseDirectory(pattern) { - return globParent(pattern, { flipBackslashes: false }); + return globParent(pattern); } exports.getBaseDirectory = getBaseDirectory; function hasGlobStar(pattern) { - return pattern.includes(GLOBSTAR); + return pattern.indexOf(GLOBSTAR) !== -1; } exports.hasGlobStar = hasGlobStar; function endsWithSlashGlobStar(pattern) { @@ -70186,7 +70151,7 @@ function convertPatternsToRe(patterns, options) { } exports.convertPatternsToRe = convertPatternsToRe; function matchAny(entry, patternsRe) { - const filepath = entry.replace(/^\.[\\/]/, ''); + const filepath = entry.replace(/^\.[\\\/]/, ''); return patternsRe.some((patternRe) => patternRe.test(filepath)); } exports.matchAny = matchAny; @@ -70209,16 +70174,9 @@ var enclosure = /[\{\[].*[\/]*.*[\}\]]$/; var globby = /(^|[^\\])([\{\[]|\([^\)]+$)/; var escaped = /\\([\*\?\|\[\]\(\)\{\}])/g; -/** - * @param {string} str - * @param {Object} opts - * @param {boolean} [opts.flipBackslashes=true] - */ -module.exports = function globParent(str, opts) { - var options = Object.assign({ flipBackslashes: true }, opts); - +module.exports = function globParent(str) { // flip windows path separators - if (options.flipBackslashes && isWin32 && str.indexOf(slash) < 0) { + if (isWin32 && str.indexOf(slash) < 0) { str = str.replace(backslash, slash); } @@ -74112,145 +74070,26 @@ module.exports = parse; "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const merge2 = __webpack_require__(625); +const merge2 = __webpack_require__(590); function merge(streams) { const mergedStream = merge2(streams); streams.forEach((stream) => { - stream.once('error', (error) => mergedStream.emit('error', error)); + stream.once('error', (err) => mergedStream.emit('error', err)); }); - mergedStream.once('close', () => propagateCloseEventToSources(streams)); - mergedStream.once('end', () => propagateCloseEventToSources(streams)); return mergedStream; } exports.merge = merge; -function propagateCloseEventToSources(streams) { - streams.forEach((stream) => stream.emit('close')); -} /***/ }), /* 625 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; - -/* - * merge2 - * https://github.com/teambition/merge2 - * - * Copyright (c) 2014-2016 Teambition - * Licensed under the MIT license. - */ -const Stream = __webpack_require__(27) -const PassThrough = Stream.PassThrough -const slice = Array.prototype.slice - -module.exports = merge2 - -function merge2 () { - const streamsQueue = [] - let merging = false - const args = slice.call(arguments) - let options = args[args.length - 1] - - if (options && !Array.isArray(options) && options.pipe == null) args.pop() - else options = {} - - const doEnd = options.end !== false - if (options.objectMode == null) options.objectMode = true - if (options.highWaterMark == null) options.highWaterMark = 64 * 1024 - const mergedStream = PassThrough(options) - - function addStream () { - for (let i = 0, len = arguments.length; i < len; i++) { - streamsQueue.push(pauseStreams(arguments[i], options)) - } - mergeStream() - return this - } - - function mergeStream () { - if (merging) return - merging = true - - let streams = streamsQueue.shift() - if (!streams) { - process.nextTick(endStream) - return - } - if (!Array.isArray(streams)) streams = [streams] - - let pipesCount = streams.length + 1 - - function next () { - if (--pipesCount > 0) return - merging = false - mergeStream() - } - - function pipe (stream) { - function onend () { - stream.removeListener('merge2UnpipeEnd', onend) - stream.removeListener('end', onend) - next() - } - // skip ended stream - if (stream._readableState.endEmitted) return next() - - stream.on('merge2UnpipeEnd', onend) - stream.on('end', onend) - stream.pipe(mergedStream, { end: false }) - // compatible for old stream - stream.resume() - } - - for (let i = 0; i < streams.length; i++) pipe(streams[i]) - - next() - } - - function endStream () { - merging = false - // emit 'queueDrain' when all streams merged. - mergedStream.emit('queueDrain') - return doEnd && mergedStream.end() - } - - mergedStream.setMaxListeners(0) - mergedStream.add = addStream - mergedStream.on('unpipe', function (stream) { - stream.emit('merge2UnpipeEnd') - }) - - if (args.length) addStream.apply(null, args) - return mergedStream -} - -// check and pause streams for pipe. -function pauseStreams (streams, options) { - if (!Array.isArray(streams)) { - // Backwards-compat with old-style streams - if (!streams._readableState && streams.pipe) streams = streams.pipe(PassThrough(options)) - if (!streams._readableState || !streams.pause || !streams.pipe) { - throw new Error('Only readable stream can be merged.') - } - streams.pause() - } else { - for (let i = 0, len = streams.length; i < len; i++) streams[i] = pauseStreams(streams[i], options) - } - return streams -} - - -/***/ }), -/* 626 */ -/***/ (function(module, exports, __webpack_require__) { - "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const stream_1 = __webpack_require__(627); -const provider_1 = __webpack_require__(654); +const stream_1 = __webpack_require__(626); +const provider_1 = __webpack_require__(653); class ProviderAsync extends provider_1.default { constructor() { super(...arguments); @@ -74278,16 +74117,16 @@ exports.default = ProviderAsync; /***/ }), -/* 627 */ +/* 626 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const stream_1 = __webpack_require__(27); -const fsStat = __webpack_require__(628); -const fsWalk = __webpack_require__(633); -const reader_1 = __webpack_require__(653); +const fsStat = __webpack_require__(627); +const fsWalk = __webpack_require__(632); +const reader_1 = __webpack_require__(652); class ReaderStream extends reader_1.default { constructor() { super(...arguments); @@ -74331,7 +74170,7 @@ class ReaderStream extends reader_1.default { _getStat(filepath) { return new Promise((resolve, reject) => { this._stat(filepath, this._fsStatSettings, (error, stats) => { - return error === null ? resolve(stats) : reject(error); + error ? reject(error) : resolve(stats); }); }); } @@ -74340,15 +74179,15 @@ exports.default = ReaderStream; /***/ }), -/* 628 */ +/* 627 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const async = __webpack_require__(629); -const sync = __webpack_require__(630); -const settings_1 = __webpack_require__(631); +const async = __webpack_require__(628); +const sync = __webpack_require__(629); +const settings_1 = __webpack_require__(630); exports.Settings = settings_1.default; function stat(path, optionsOrSettingsOrCallback, callback) { if (typeof optionsOrSettingsOrCallback === 'function') { @@ -74371,7 +74210,7 @@ function getSettings(settingsOrOptions = {}) { /***/ }), -/* 629 */ +/* 628 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -74379,14 +74218,14 @@ function getSettings(settingsOrOptions = {}) { Object.defineProperty(exports, "__esModule", { value: true }); function read(path, settings, callback) { settings.fs.lstat(path, (lstatError, lstat) => { - if (lstatError !== null) { + if (lstatError) { return callFailureCallback(callback, lstatError); } if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) { return callSuccessCallback(callback, lstat); } settings.fs.stat(path, (statError, stat) => { - if (statError !== null) { + if (statError) { if (settings.throwErrorOnBrokenSymbolicLink) { return callFailureCallback(callback, statError); } @@ -74409,7 +74248,7 @@ function callSuccessCallback(callback, result) { /***/ }), -/* 630 */ +/* 629 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -74438,13 +74277,13 @@ exports.read = read; /***/ }), -/* 631 */ +/* 630 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const fs = __webpack_require__(632); +const fs = __webpack_require__(631); class Settings { constructor(_options = {}) { this._options = _options; @@ -74461,7 +74300,7 @@ exports.default = Settings; /***/ }), -/* 632 */ +/* 631 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -74475,42 +74314,42 @@ exports.FILE_SYSTEM_ADAPTER = { statSync: fs.statSync }; function createFileSystemAdapter(fsMethods) { - if (fsMethods === undefined) { + if (!fsMethods) { return exports.FILE_SYSTEM_ADAPTER; } - return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods); + return Object.assign({}, exports.FILE_SYSTEM_ADAPTER, fsMethods); } exports.createFileSystemAdapter = createFileSystemAdapter; /***/ }), -/* 633 */ +/* 632 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const async_1 = __webpack_require__(634); -const stream_1 = __webpack_require__(649); -const sync_1 = __webpack_require__(650); -const settings_1 = __webpack_require__(652); +const async_1 = __webpack_require__(633); +const stream_1 = __webpack_require__(648); +const sync_1 = __webpack_require__(649); +const settings_1 = __webpack_require__(651); exports.Settings = settings_1.default; -function walk(directory, optionsOrSettingsOrCallback, callback) { +function walk(dir, optionsOrSettingsOrCallback, callback) { if (typeof optionsOrSettingsOrCallback === 'function') { - return new async_1.default(directory, getSettings()).read(optionsOrSettingsOrCallback); + return new async_1.default(dir, getSettings()).read(optionsOrSettingsOrCallback); } - new async_1.default(directory, getSettings(optionsOrSettingsOrCallback)).read(callback); + new async_1.default(dir, getSettings(optionsOrSettingsOrCallback)).read(callback); } exports.walk = walk; -function walkSync(directory, optionsOrSettings) { +function walkSync(dir, optionsOrSettings) { const settings = getSettings(optionsOrSettings); - const provider = new sync_1.default(directory, settings); + const provider = new sync_1.default(dir, settings); return provider.read(); } exports.walkSync = walkSync; -function walkStream(directory, optionsOrSettings) { +function walkStream(dir, optionsOrSettings) { const settings = getSettings(optionsOrSettings); - const provider = new stream_1.default(directory, settings); + const provider = new stream_1.default(dir, settings); return provider.read(); } exports.walkStream = walkStream; @@ -74523,13 +74362,13 @@ function getSettings(settingsOrOptions = {}) { /***/ }), -/* 634 */ +/* 633 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const async_1 = __webpack_require__(635); +const async_1 = __webpack_require__(634); class AsyncProvider { constructor(_root, _settings) { this._root = _root; @@ -74545,7 +74384,7 @@ class AsyncProvider { this._storage.add(entry); }); this._reader.onEnd(() => { - callSuccessCallback(callback, [...this._storage]); + callSuccessCallback(callback, Array.from(this._storage)); }); this._reader.read(); } @@ -74560,17 +74399,17 @@ function callSuccessCallback(callback, entries) { /***/ }), -/* 635 */ +/* 634 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const events_1 = __webpack_require__(379); -const fsScandir = __webpack_require__(636); -const fastq = __webpack_require__(645); -const common = __webpack_require__(647); -const reader_1 = __webpack_require__(648); +const fsScandir = __webpack_require__(635); +const fastq = __webpack_require__(644); +const common = __webpack_require__(646); +const reader_1 = __webpack_require__(647); class AsyncReader extends reader_1.default { constructor(_root, _settings) { super(_root, _settings); @@ -74610,17 +74449,17 @@ class AsyncReader extends reader_1.default { onEnd(callback) { this._emitter.once('end', callback); } - _pushToQueue(directory, base) { - const queueItem = { directory, base }; + _pushToQueue(dir, base) { + const queueItem = { dir, base }; this._queue.push(queueItem, (error) => { - if (error !== null) { + if (error) { this._handleError(error); } }); } _worker(item, done) { - this._scandir(item.directory, this._settings.fsScandirSettings, (error, entries) => { - if (error !== null) { + this._scandir(item.dir, this._settings.fsScandirSettings, (error, entries) => { + if (error) { return done(error, undefined); } for (const entry of entries) { @@ -74660,15 +74499,15 @@ exports.default = AsyncReader; /***/ }), -/* 636 */ +/* 635 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const async = __webpack_require__(637); -const sync = __webpack_require__(642); -const settings_1 = __webpack_require__(643); +const async = __webpack_require__(636); +const sync = __webpack_require__(641); +const settings_1 = __webpack_require__(642); exports.Settings = settings_1.default; function scandir(path, optionsOrSettingsOrCallback, callback) { if (typeof optionsOrSettingsOrCallback === 'function') { @@ -74691,39 +74530,39 @@ function getSettings(settingsOrOptions = {}) { /***/ }), -/* 637 */ +/* 636 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const fsStat = __webpack_require__(628); -const rpl = __webpack_require__(638); -const constants_1 = __webpack_require__(639); -const utils = __webpack_require__(640); -function read(directory, settings, callback) { +const fsStat = __webpack_require__(627); +const rpl = __webpack_require__(637); +const constants_1 = __webpack_require__(638); +const utils = __webpack_require__(639); +function read(dir, settings, callback) { if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) { - return readdirWithFileTypes(directory, settings, callback); + return readdirWithFileTypes(dir, settings, callback); } - return readdir(directory, settings, callback); + return readdir(dir, settings, callback); } exports.read = read; -function readdirWithFileTypes(directory, settings, callback) { - settings.fs.readdir(directory, { withFileTypes: true }, (readdirError, dirents) => { - if (readdirError !== null) { +function readdirWithFileTypes(dir, settings, callback) { + settings.fs.readdir(dir, { withFileTypes: true }, (readdirError, dirents) => { + if (readdirError) { return callFailureCallback(callback, readdirError); } const entries = dirents.map((dirent) => ({ dirent, name: dirent.name, - path: `${directory}${settings.pathSegmentSeparator}${dirent.name}` + path: `${dir}${settings.pathSegmentSeparator}${dirent.name}` })); if (!settings.followSymbolicLinks) { return callSuccessCallback(callback, entries); } const tasks = entries.map((entry) => makeRplTaskEntry(entry, settings)); rpl(tasks, (rplError, rplEntries) => { - if (rplError !== null) { + if (rplError) { return callFailureCallback(callback, rplError); } callSuccessCallback(callback, rplEntries); @@ -74737,7 +74576,7 @@ function makeRplTaskEntry(entry, settings) { return done(null, entry); } settings.fs.stat(entry.path, (statError, stats) => { - if (statError !== null) { + if (statError) { if (settings.throwErrorOnBrokenSymbolicLink) { return done(statError); } @@ -74748,21 +74587,22 @@ function makeRplTaskEntry(entry, settings) { }); }; } -function readdir(directory, settings, callback) { - settings.fs.readdir(directory, (readdirError, names) => { - if (readdirError !== null) { +function readdir(dir, settings, callback) { + settings.fs.readdir(dir, (readdirError, names) => { + if (readdirError) { return callFailureCallback(callback, readdirError); } - const filepaths = names.map((name) => `${directory}${settings.pathSegmentSeparator}${name}`); + const filepaths = names.map((name) => `${dir}${settings.pathSegmentSeparator}${name}`); const tasks = filepaths.map((filepath) => { return (done) => fsStat.stat(filepath, settings.fsStatSettings, done); }); rpl(tasks, (rplError, results) => { - if (rplError !== null) { + if (rplError) { return callFailureCallback(callback, rplError); } const entries = []; - names.forEach((name, index) => { + for (let index = 0; index < names.length; index++) { + const name = names[index]; const stats = results[index]; const entry = { name, @@ -74773,7 +74613,7 @@ function readdir(directory, settings, callback) { entry.stats = stats; } entries.push(entry); - }); + } callSuccessCallback(callback, entries); }); }); @@ -74788,7 +74628,7 @@ function callSuccessCallback(callback, result) { /***/ }), -/* 638 */ +/* 637 */ /***/ (function(module, exports) { module.exports = runParallel @@ -74842,7 +74682,7 @@ function runParallel (tasks, cb) { /***/ }), -/* 639 */ +/* 638 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -74851,29 +74691,25 @@ Object.defineProperty(exports, "__esModule", { value: true }); const NODE_PROCESS_VERSION_PARTS = process.versions.node.split('.'); const MAJOR_VERSION = parseInt(NODE_PROCESS_VERSION_PARTS[0], 10); const MINOR_VERSION = parseInt(NODE_PROCESS_VERSION_PARTS[1], 10); -const SUPPORTED_MAJOR_VERSION = 10; -const SUPPORTED_MINOR_VERSION = 10; -const IS_MATCHED_BY_MAJOR = MAJOR_VERSION > SUPPORTED_MAJOR_VERSION; -const IS_MATCHED_BY_MAJOR_AND_MINOR = MAJOR_VERSION === SUPPORTED_MAJOR_VERSION && MINOR_VERSION >= SUPPORTED_MINOR_VERSION; /** * IS `true` for Node.js 10.10 and greater. */ -exports.IS_SUPPORT_READDIR_WITH_FILE_TYPES = IS_MATCHED_BY_MAJOR || IS_MATCHED_BY_MAJOR_AND_MINOR; +exports.IS_SUPPORT_READDIR_WITH_FILE_TYPES = MAJOR_VERSION > 10 || (MAJOR_VERSION === 10 && MINOR_VERSION >= 10); /***/ }), -/* 640 */ +/* 639 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const fs = __webpack_require__(641); +const fs = __webpack_require__(640); exports.fs = fs; /***/ }), -/* 641 */ +/* 640 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -74898,29 +74734,29 @@ exports.createDirentFromStats = createDirentFromStats; /***/ }), -/* 642 */ +/* 641 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const fsStat = __webpack_require__(628); -const constants_1 = __webpack_require__(639); -const utils = __webpack_require__(640); -function read(directory, settings) { +const fsStat = __webpack_require__(627); +const constants_1 = __webpack_require__(638); +const utils = __webpack_require__(639); +function read(dir, settings) { if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) { - return readdirWithFileTypes(directory, settings); + return readdirWithFileTypes(dir, settings); } - return readdir(directory, settings); + return readdir(dir, settings); } exports.read = read; -function readdirWithFileTypes(directory, settings) { - const dirents = settings.fs.readdirSync(directory, { withFileTypes: true }); +function readdirWithFileTypes(dir, settings) { + const dirents = settings.fs.readdirSync(dir, { withFileTypes: true }); return dirents.map((dirent) => { const entry = { dirent, name: dirent.name, - path: `${directory}${settings.pathSegmentSeparator}${dirent.name}` + path: `${dir}${settings.pathSegmentSeparator}${dirent.name}` }; if (entry.dirent.isSymbolicLink() && settings.followSymbolicLinks) { try { @@ -74937,10 +74773,10 @@ function readdirWithFileTypes(directory, settings) { }); } exports.readdirWithFileTypes = readdirWithFileTypes; -function readdir(directory, settings) { - const names = settings.fs.readdirSync(directory); +function readdir(dir, settings) { + const names = settings.fs.readdirSync(dir); return names.map((name) => { - const entryPath = `${directory}${settings.pathSegmentSeparator}${name}`; + const entryPath = `${dir}${settings.pathSegmentSeparator}${name}`; const stats = fsStat.statSync(entryPath, settings.fsStatSettings); const entry = { name, @@ -74957,15 +74793,15 @@ exports.readdir = readdir; /***/ }), -/* 643 */ +/* 642 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const path = __webpack_require__(16); -const fsStat = __webpack_require__(628); -const fs = __webpack_require__(644); +const fsStat = __webpack_require__(627); +const fs = __webpack_require__(643); class Settings { constructor(_options = {}) { this._options = _options; @@ -74988,7 +74824,7 @@ exports.default = Settings; /***/ }), -/* 644 */ +/* 643 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -75004,22 +74840,22 @@ exports.FILE_SYSTEM_ADAPTER = { readdirSync: fs.readdirSync }; function createFileSystemAdapter(fsMethods) { - if (fsMethods === undefined) { + if (!fsMethods) { return exports.FILE_SYSTEM_ADAPTER; } - return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods); + return Object.assign({}, exports.FILE_SYSTEM_ADAPTER, fsMethods); } exports.createFileSystemAdapter = createFileSystemAdapter; /***/ }), -/* 645 */ +/* 644 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var reusify = __webpack_require__(646) +var reusify = __webpack_require__(645) function fastqueue (context, worker, concurrency) { if (typeof context === 'function') { @@ -75193,7 +75029,7 @@ module.exports = fastqueue /***/ }), -/* 646 */ +/* 645 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -75233,7 +75069,7 @@ module.exports = reusify /***/ }), -/* 647 */ +/* 646 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -75251,7 +75087,7 @@ function isAppliedFilter(filter, value) { } exports.isAppliedFilter = isAppliedFilter; function replacePathSegmentSeparator(filepath, separator) { - return filepath.split(/[\\/]/).join(separator); + return filepath.split(/[\\\/]/).join(separator); } exports.replacePathSegmentSeparator = replacePathSegmentSeparator; function joinPathSegments(a, b, separator) { @@ -75264,13 +75100,13 @@ exports.joinPathSegments = joinPathSegments; /***/ }), -/* 648 */ +/* 647 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const common = __webpack_require__(647); +const common = __webpack_require__(646); class Reader { constructor(_root, _settings) { this._root = _root; @@ -75282,14 +75118,14 @@ exports.default = Reader; /***/ }), -/* 649 */ +/* 648 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const stream_1 = __webpack_require__(27); -const async_1 = __webpack_require__(635); +const async_1 = __webpack_require__(634); class StreamProvider { constructor(_root, _settings) { this._root = _root; @@ -75319,13 +75155,13 @@ exports.default = StreamProvider; /***/ }), -/* 650 */ +/* 649 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const sync_1 = __webpack_require__(651); +const sync_1 = __webpack_require__(650); class SyncProvider { constructor(_root, _settings) { this._root = _root; @@ -75340,15 +75176,15 @@ exports.default = SyncProvider; /***/ }), -/* 651 */ +/* 650 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const fsScandir = __webpack_require__(636); -const common = __webpack_require__(647); -const reader_1 = __webpack_require__(648); +const fsScandir = __webpack_require__(635); +const common = __webpack_require__(646); +const reader_1 = __webpack_require__(647); class SyncReader extends reader_1.default { constructor() { super(...arguments); @@ -75359,19 +75195,19 @@ class SyncReader extends reader_1.default { read() { this._pushToQueue(this._root, this._settings.basePath); this._handleQueue(); - return [...this._storage]; + return Array.from(this._storage); } - _pushToQueue(directory, base) { - this._queue.add({ directory, base }); + _pushToQueue(dir, base) { + this._queue.add({ dir, base }); } _handleQueue() { for (const item of this._queue.values()) { - this._handleDirectory(item.directory, item.base); + this._handleDirectory(item.dir, item.base); } } - _handleDirectory(directory, base) { + _handleDirectory(dir, base) { try { - const entries = this._scandir(directory, this._settings.fsScandirSettings); + const entries = this._scandir(dir, this._settings.fsScandirSettings); for (const entry of entries) { this._handleEntry(entry, base); } @@ -75406,14 +75242,14 @@ exports.default = SyncReader; /***/ }), -/* 652 */ +/* 651 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const path = __webpack_require__(16); -const fsScandir = __webpack_require__(636); +const fsScandir = __webpack_require__(635); class Settings { constructor(_options = {}) { this._options = _options; @@ -75439,14 +75275,14 @@ exports.default = Settings; /***/ }), -/* 653 */ +/* 652 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const path = __webpack_require__(16); -const fsStat = __webpack_require__(628); +const fsStat = __webpack_require__(627); const utils = __webpack_require__(598); class Reader { constructor(_settings) { @@ -75479,17 +75315,17 @@ exports.default = Reader; /***/ }), -/* 654 */ +/* 653 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const path = __webpack_require__(16); -const deep_1 = __webpack_require__(655); -const entry_1 = __webpack_require__(656); -const error_1 = __webpack_require__(657); -const entry_2 = __webpack_require__(658); +const deep_1 = __webpack_require__(654); +const entry_1 = __webpack_require__(655); +const error_1 = __webpack_require__(656); +const entry_2 = __webpack_require__(657); class Provider { constructor(_settings) { this._settings = _settings; @@ -75534,7 +75370,7 @@ exports.default = Provider; /***/ }), -/* 655 */ +/* 654 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -75570,6 +75406,9 @@ class DeepFilter { if (this._isSkippedSymbolicLink(entry)) { return false; } + if (this._isSkippedDotDirectory(entry)) { + return false; + } return this._isSkippedByNegativePatterns(entry, negativeRe); } _getEntryDepth(basePath, entryPath) { @@ -75586,6 +75425,9 @@ class DeepFilter { _isSkippedSymbolicLink(entry) { return !this._settings.followSymbolicLinks && entry.dirent.isSymbolicLink(); } + _isSkippedDotDirectory(entry) { + return !this._settings.dot && entry.name.startsWith('.'); + } _isSkippedByNegativePatterns(entry, negativeRe) { return !utils.pattern.matchAny(entry.path, negativeRe); } @@ -75594,7 +75436,7 @@ exports.default = DeepFilter; /***/ }), -/* 656 */ +/* 655 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -75655,7 +75497,7 @@ exports.default = EntryFilter; /***/ }), -/* 657 */ +/* 656 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -75677,7 +75519,7 @@ exports.default = ErrorFilter; /***/ }), -/* 658 */ +/* 657 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -75703,22 +75545,22 @@ class EntryTransformer { if (!this._settings.objectMode) { return filepath; } - return Object.assign(Object.assign({}, entry), { path: filepath }); + return Object.assign({}, entry, { path: filepath }); } } exports.default = EntryTransformer; /***/ }), -/* 659 */ +/* 658 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const stream_1 = __webpack_require__(27); -const stream_2 = __webpack_require__(627); -const provider_1 = __webpack_require__(654); +const stream_2 = __webpack_require__(626); +const provider_1 = __webpack_require__(653); class ProviderStream extends provider_1.default { constructor() { super(...arguments); @@ -75728,14 +75570,12 @@ class ProviderStream extends provider_1.default { const root = this._getRootDirectory(task); const options = this._getReaderOptions(task); const source = this.api(root, task, options); - const destination = new stream_1.Readable({ objectMode: true, read: () => { } }); + const dest = new stream_1.Readable({ objectMode: true, read: () => { } }); source - .once('error', (error) => destination.emit('error', error)) - .on('data', (entry) => destination.emit('data', options.transform(entry))) - .once('end', () => destination.emit('end')); - destination - .once('close', () => source.destroy()); - return destination; + .once('error', (error) => dest.emit('error', error)) + .on('data', (entry) => dest.emit('data', options.transform(entry))) + .once('end', () => dest.emit('end')); + return dest; } api(root, task, options) { if (task.dynamic) { @@ -75748,14 +75588,14 @@ exports.default = ProviderStream; /***/ }), -/* 660 */ +/* 659 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const sync_1 = __webpack_require__(661); -const provider_1 = __webpack_require__(654); +const sync_1 = __webpack_require__(660); +const provider_1 = __webpack_require__(653); class ProviderSync extends provider_1.default { constructor() { super(...arguments); @@ -75778,15 +75618,15 @@ exports.default = ProviderSync; /***/ }), -/* 661 */ +/* 660 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const fsStat = __webpack_require__(628); -const fsWalk = __webpack_require__(633); -const reader_1 = __webpack_require__(653); +const fsStat = __webpack_require__(627); +const fsWalk = __webpack_require__(632); +const reader_1 = __webpack_require__(652); class ReaderSync extends reader_1.default { constructor() { super(...arguments); @@ -75828,7 +75668,7 @@ exports.default = ReaderSync; /***/ }), -/* 662 */ +/* 661 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -75845,6 +75685,7 @@ exports.DEFAULT_FILE_SYSTEM_ADAPTER = { readdir: fs.readdir, readdirSync: fs.readdirSync }; +// tslint:enable no-redundant-jsdoc class Settings { constructor(_options = {}) { this._options = _options; @@ -75880,20 +75721,20 @@ class Settings { return option === undefined ? value : option; } _getFileSystemMethods(methods = {}) { - return Object.assign(Object.assign({}, exports.DEFAULT_FILE_SYSTEM_ADAPTER), methods); + return Object.assign({}, exports.DEFAULT_FILE_SYSTEM_ADAPTER, methods); } } exports.default = Settings; /***/ }), -/* 663 */ +/* 662 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; const path = __webpack_require__(16); -const pathType = __webpack_require__(664); +const pathType = __webpack_require__(663); const getExtensions = extensions => extensions.length > 1 ? `{${extensions.join(',')}}` : extensions[0]; @@ -75969,7 +75810,7 @@ module.exports.sync = (input, options) => { /***/ }), -/* 664 */ +/* 663 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -76019,7 +75860,7 @@ exports.isSymlinkSync = isTypeSync.bind(null, 'lstatSync', 'isSymbolicLink'); /***/ }), -/* 665 */ +/* 664 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -76028,8 +75869,8 @@ const {promisify} = __webpack_require__(29); const fs = __webpack_require__(23); const path = __webpack_require__(16); const fastGlob = __webpack_require__(596); -const gitIgnore = __webpack_require__(666); -const slash = __webpack_require__(667); +const gitIgnore = __webpack_require__(665); +const slash = __webpack_require__(666); const DEFAULT_IGNORE = [ '**/node_modules/**', @@ -76143,7 +75984,7 @@ module.exports.sync = options => { /***/ }), -/* 666 */ +/* 665 */ /***/ (function(module, exports) { // A simple implementation of make-array @@ -76734,7 +76575,7 @@ if ( /***/ }), -/* 667 */ +/* 666 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -76752,7 +76593,7 @@ module.exports = path => { /***/ }), -/* 668 */ +/* 667 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -76805,7 +76646,7 @@ module.exports = { /***/ }), -/* 669 */ +/* 668 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -76827,7 +76668,7 @@ module.exports = path_ => { /***/ }), -/* 670 */ +/* 669 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -76855,7 +76696,7 @@ module.exports = (childPath, parentPath) => { /***/ }), -/* 671 */ +/* 670 */ /***/ (function(module, exports, __webpack_require__) { const assert = __webpack_require__(30) @@ -77229,12 +77070,12 @@ rimraf.sync = rimrafSync /***/ }), -/* 672 */ +/* 671 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const AggregateError = __webpack_require__(673); +const AggregateError = __webpack_require__(672); module.exports = async ( iterable, @@ -77317,13 +77158,13 @@ module.exports = async ( /***/ }), -/* 673 */ +/* 672 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const indentString = __webpack_require__(674); -const cleanStack = __webpack_require__(675); +const indentString = __webpack_require__(673); +const cleanStack = __webpack_require__(674); const cleanInternalStack = stack => stack.replace(/\s+at .*aggregate-error\/index.js:\d+:\d+\)?/g, ''); @@ -77371,7 +77212,7 @@ module.exports = AggregateError; /***/ }), -/* 674 */ +/* 673 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -77413,7 +77254,7 @@ module.exports = (string, count = 1, options) => { /***/ }), -/* 675 */ +/* 674 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -77460,14 +77301,14 @@ module.exports = (stack, options) => { /***/ }), -/* 676 */ +/* 675 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const chalk = __webpack_require__(677); -const cliCursor = __webpack_require__(681); -const cliSpinners = __webpack_require__(685); +const chalk = __webpack_require__(676); +const cliCursor = __webpack_require__(680); +const cliSpinners = __webpack_require__(684); const logSymbols = __webpack_require__(565); class Ora { @@ -77615,16 +77456,16 @@ module.exports.promise = (action, options) => { /***/ }), -/* 677 */ +/* 676 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; const escapeStringRegexp = __webpack_require__(3); -const ansiStyles = __webpack_require__(678); -const stdoutColor = __webpack_require__(679).stdout; +const ansiStyles = __webpack_require__(677); +const stdoutColor = __webpack_require__(678).stdout; -const template = __webpack_require__(680); +const template = __webpack_require__(679); const isSimpleWindowsTerm = process.platform === 'win32' && !(process.env.TERM || '').toLowerCase().startsWith('xterm'); @@ -77850,7 +77691,7 @@ module.exports.default = module.exports; // For TypeScript /***/ }), -/* 678 */ +/* 677 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -78023,7 +77864,7 @@ Object.defineProperty(module, 'exports', { /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(5)(module))) /***/ }), -/* 679 */ +/* 678 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -78165,7 +78006,7 @@ module.exports = { /***/ }), -/* 680 */ +/* 679 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -78300,12 +78141,12 @@ module.exports = (chalk, tmp) => { /***/ }), -/* 681 */ +/* 680 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const restoreCursor = __webpack_require__(682); +const restoreCursor = __webpack_require__(681); let hidden = false; @@ -78346,12 +78187,12 @@ exports.toggle = (force, stream) => { /***/ }), -/* 682 */ +/* 681 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const onetime = __webpack_require__(683); +const onetime = __webpack_require__(682); const signalExit = __webpack_require__(377); module.exports = onetime(() => { @@ -78362,12 +78203,12 @@ module.exports = onetime(() => { /***/ }), -/* 683 */ +/* 682 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const mimicFn = __webpack_require__(684); +const mimicFn = __webpack_require__(683); module.exports = (fn, opts) => { // TODO: Remove this in v3 @@ -78408,7 +78249,7 @@ module.exports = (fn, opts) => { /***/ }), -/* 684 */ +/* 683 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -78424,22 +78265,22 @@ module.exports = (to, from) => { /***/ }), -/* 685 */ +/* 684 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -module.exports = __webpack_require__(686); +module.exports = __webpack_require__(685); /***/ }), -/* 686 */ +/* 685 */ /***/ (function(module) { module.exports = JSON.parse("{\"dots\":{\"interval\":80,\"frames\":[\"⠋\",\"⠙\",\"⠹\",\"⠸\",\"⠼\",\"⠴\",\"⠦\",\"⠧\",\"⠇\",\"⠏\"]},\"dots2\":{\"interval\":80,\"frames\":[\"⣾\",\"⣽\",\"⣻\",\"⢿\",\"⡿\",\"⣟\",\"⣯\",\"⣷\"]},\"dots3\":{\"interval\":80,\"frames\":[\"⠋\",\"⠙\",\"⠚\",\"⠞\",\"⠖\",\"⠦\",\"⠴\",\"⠲\",\"⠳\",\"⠓\"]},\"dots4\":{\"interval\":80,\"frames\":[\"⠄\",\"⠆\",\"⠇\",\"⠋\",\"⠙\",\"⠸\",\"⠰\",\"⠠\",\"⠰\",\"⠸\",\"⠙\",\"⠋\",\"⠇\",\"⠆\"]},\"dots5\":{\"interval\":80,\"frames\":[\"⠋\",\"⠙\",\"⠚\",\"⠒\",\"⠂\",\"⠂\",\"⠒\",\"⠲\",\"⠴\",\"⠦\",\"⠖\",\"⠒\",\"⠐\",\"⠐\",\"⠒\",\"⠓\",\"⠋\"]},\"dots6\":{\"interval\":80,\"frames\":[\"⠁\",\"⠉\",\"⠙\",\"⠚\",\"⠒\",\"⠂\",\"⠂\",\"⠒\",\"⠲\",\"⠴\",\"⠤\",\"⠄\",\"⠄\",\"⠤\",\"⠴\",\"⠲\",\"⠒\",\"⠂\",\"⠂\",\"⠒\",\"⠚\",\"⠙\",\"⠉\",\"⠁\"]},\"dots7\":{\"interval\":80,\"frames\":[\"⠈\",\"⠉\",\"⠋\",\"⠓\",\"⠒\",\"⠐\",\"⠐\",\"⠒\",\"⠖\",\"⠦\",\"⠤\",\"⠠\",\"⠠\",\"⠤\",\"⠦\",\"⠖\",\"⠒\",\"⠐\",\"⠐\",\"⠒\",\"⠓\",\"⠋\",\"⠉\",\"⠈\"]},\"dots8\":{\"interval\":80,\"frames\":[\"⠁\",\"⠁\",\"⠉\",\"⠙\",\"⠚\",\"⠒\",\"⠂\",\"⠂\",\"⠒\",\"⠲\",\"⠴\",\"⠤\",\"⠄\",\"⠄\",\"⠤\",\"⠠\",\"⠠\",\"⠤\",\"⠦\",\"⠖\",\"⠒\",\"⠐\",\"⠐\",\"⠒\",\"⠓\",\"⠋\",\"⠉\",\"⠈\",\"⠈\"]},\"dots9\":{\"interval\":80,\"frames\":[\"⢹\",\"⢺\",\"⢼\",\"⣸\",\"⣇\",\"⡧\",\"⡗\",\"⡏\"]},\"dots10\":{\"interval\":80,\"frames\":[\"⢄\",\"⢂\",\"⢁\",\"⡁\",\"⡈\",\"⡐\",\"⡠\"]},\"dots11\":{\"interval\":100,\"frames\":[\"⠁\",\"⠂\",\"⠄\",\"⡀\",\"⢀\",\"⠠\",\"⠐\",\"⠈\"]},\"dots12\":{\"interval\":80,\"frames\":[\"⢀⠀\",\"⡀⠀\",\"⠄⠀\",\"⢂⠀\",\"⡂⠀\",\"⠅⠀\",\"⢃⠀\",\"⡃⠀\",\"⠍⠀\",\"⢋⠀\",\"⡋⠀\",\"⠍⠁\",\"⢋⠁\",\"⡋⠁\",\"⠍⠉\",\"⠋⠉\",\"⠋⠉\",\"⠉⠙\",\"⠉⠙\",\"⠉⠩\",\"⠈⢙\",\"⠈⡙\",\"⢈⠩\",\"⡀⢙\",\"⠄⡙\",\"⢂⠩\",\"⡂⢘\",\"⠅⡘\",\"⢃⠨\",\"⡃⢐\",\"⠍⡐\",\"⢋⠠\",\"⡋⢀\",\"⠍⡁\",\"⢋⠁\",\"⡋⠁\",\"⠍⠉\",\"⠋⠉\",\"⠋⠉\",\"⠉⠙\",\"⠉⠙\",\"⠉⠩\",\"⠈⢙\",\"⠈⡙\",\"⠈⠩\",\"⠀⢙\",\"⠀⡙\",\"⠀⠩\",\"⠀⢘\",\"⠀⡘\",\"⠀⠨\",\"⠀⢐\",\"⠀⡐\",\"⠀⠠\",\"⠀⢀\",\"⠀⡀\"]},\"line\":{\"interval\":130,\"frames\":[\"-\",\"\\\\\",\"|\",\"/\"]},\"line2\":{\"interval\":100,\"frames\":[\"⠂\",\"-\",\"–\",\"—\",\"–\",\"-\"]},\"pipe\":{\"interval\":100,\"frames\":[\"┤\",\"┘\",\"┴\",\"└\",\"├\",\"┌\",\"┬\",\"┐\"]},\"simpleDots\":{\"interval\":400,\"frames\":[\". \",\".. \",\"...\",\" \"]},\"simpleDotsScrolling\":{\"interval\":200,\"frames\":[\". \",\".. \",\"...\",\" ..\",\" .\",\" \"]},\"star\":{\"interval\":70,\"frames\":[\"✶\",\"✸\",\"✹\",\"✺\",\"✹\",\"✷\"]},\"star2\":{\"interval\":80,\"frames\":[\"+\",\"x\",\"*\"]},\"flip\":{\"interval\":70,\"frames\":[\"_\",\"_\",\"_\",\"-\",\"`\",\"`\",\"'\",\"´\",\"-\",\"_\",\"_\",\"_\"]},\"hamburger\":{\"interval\":100,\"frames\":[\"☱\",\"☲\",\"☴\"]},\"growVertical\":{\"interval\":120,\"frames\":[\"▁\",\"▃\",\"▄\",\"▅\",\"▆\",\"▇\",\"▆\",\"▅\",\"▄\",\"▃\"]},\"growHorizontal\":{\"interval\":120,\"frames\":[\"▏\",\"▎\",\"▍\",\"▌\",\"▋\",\"▊\",\"▉\",\"▊\",\"▋\",\"▌\",\"▍\",\"▎\"]},\"balloon\":{\"interval\":140,\"frames\":[\" \",\".\",\"o\",\"O\",\"@\",\"*\",\" \"]},\"balloon2\":{\"interval\":120,\"frames\":[\".\",\"o\",\"O\",\"°\",\"O\",\"o\",\".\"]},\"noise\":{\"interval\":100,\"frames\":[\"▓\",\"▒\",\"░\"]},\"bounce\":{\"interval\":120,\"frames\":[\"⠁\",\"⠂\",\"⠄\",\"⠂\"]},\"boxBounce\":{\"interval\":120,\"frames\":[\"▖\",\"▘\",\"▝\",\"▗\"]},\"boxBounce2\":{\"interval\":100,\"frames\":[\"▌\",\"▀\",\"▐\",\"▄\"]},\"triangle\":{\"interval\":50,\"frames\":[\"◢\",\"◣\",\"◤\",\"◥\"]},\"arc\":{\"interval\":100,\"frames\":[\"◜\",\"◠\",\"◝\",\"◞\",\"◡\",\"◟\"]},\"circle\":{\"interval\":120,\"frames\":[\"◡\",\"⊙\",\"◠\"]},\"squareCorners\":{\"interval\":180,\"frames\":[\"◰\",\"◳\",\"◲\",\"◱\"]},\"circleQuarters\":{\"interval\":120,\"frames\":[\"◴\",\"◷\",\"◶\",\"◵\"]},\"circleHalves\":{\"interval\":50,\"frames\":[\"◐\",\"◓\",\"◑\",\"◒\"]},\"squish\":{\"interval\":100,\"frames\":[\"╫\",\"╪\"]},\"toggle\":{\"interval\":250,\"frames\":[\"⊶\",\"⊷\"]},\"toggle2\":{\"interval\":80,\"frames\":[\"▫\",\"▪\"]},\"toggle3\":{\"interval\":120,\"frames\":[\"□\",\"■\"]},\"toggle4\":{\"interval\":100,\"frames\":[\"■\",\"□\",\"▪\",\"▫\"]},\"toggle5\":{\"interval\":100,\"frames\":[\"▮\",\"▯\"]},\"toggle6\":{\"interval\":300,\"frames\":[\"ဝ\",\"၀\"]},\"toggle7\":{\"interval\":80,\"frames\":[\"⦾\",\"⦿\"]},\"toggle8\":{\"interval\":100,\"frames\":[\"◍\",\"◌\"]},\"toggle9\":{\"interval\":100,\"frames\":[\"◉\",\"◎\"]},\"toggle10\":{\"interval\":100,\"frames\":[\"㊂\",\"㊀\",\"㊁\"]},\"toggle11\":{\"interval\":50,\"frames\":[\"⧇\",\"⧆\"]},\"toggle12\":{\"interval\":120,\"frames\":[\"☗\",\"☖\"]},\"toggle13\":{\"interval\":80,\"frames\":[\"=\",\"*\",\"-\"]},\"arrow\":{\"interval\":100,\"frames\":[\"←\",\"↖\",\"↑\",\"↗\",\"→\",\"↘\",\"↓\",\"↙\"]},\"arrow2\":{\"interval\":80,\"frames\":[\"⬆️ \",\"↗️ \",\"➡️ \",\"↘️ \",\"⬇️ \",\"↙️ \",\"⬅️ \",\"↖️ \"]},\"arrow3\":{\"interval\":120,\"frames\":[\"▹▹▹▹▹\",\"▸▹▹▹▹\",\"▹▸▹▹▹\",\"▹▹▸▹▹\",\"▹▹▹▸▹\",\"▹▹▹▹▸\"]},\"bouncingBar\":{\"interval\":80,\"frames\":[\"[ ]\",\"[= ]\",\"[== ]\",\"[=== ]\",\"[ ===]\",\"[ ==]\",\"[ =]\",\"[ ]\",\"[ =]\",\"[ ==]\",\"[ ===]\",\"[====]\",\"[=== ]\",\"[== ]\",\"[= ]\"]},\"bouncingBall\":{\"interval\":80,\"frames\":[\"( ● )\",\"( ● )\",\"( ● )\",\"( ● )\",\"( ●)\",\"( ● )\",\"( ● )\",\"( ● )\",\"( ● )\",\"(● )\"]},\"smiley\":{\"interval\":200,\"frames\":[\"😄 \",\"😝 \"]},\"monkey\":{\"interval\":300,\"frames\":[\"🙈 \",\"🙈 \",\"🙉 \",\"🙊 \"]},\"hearts\":{\"interval\":100,\"frames\":[\"💛 \",\"💙 \",\"💜 \",\"💚 \",\"❤️ \"]},\"clock\":{\"interval\":100,\"frames\":[\"🕐 \",\"🕑 \",\"🕒 \",\"🕓 \",\"🕔 \",\"🕕 \",\"🕖 \",\"🕗 \",\"🕘 \",\"🕙 \",\"🕚 \"]},\"earth\":{\"interval\":180,\"frames\":[\"🌍 \",\"🌎 \",\"🌏 \"]},\"moon\":{\"interval\":80,\"frames\":[\"🌑 \",\"🌒 \",\"🌓 \",\"🌔 \",\"🌕 \",\"🌖 \",\"🌗 \",\"🌘 \"]},\"runner\":{\"interval\":140,\"frames\":[\"🚶 \",\"🏃 \"]},\"pong\":{\"interval\":80,\"frames\":[\"▐⠂ ▌\",\"▐⠈ ▌\",\"▐ ⠂ ▌\",\"▐ ⠠ ▌\",\"▐ ⡀ ▌\",\"▐ ⠠ ▌\",\"▐ ⠂ ▌\",\"▐ ⠈ ▌\",\"▐ ⠂ ▌\",\"▐ ⠠ ▌\",\"▐ ⡀ ▌\",\"▐ ⠠ ▌\",\"▐ ⠂ ▌\",\"▐ ⠈ ▌\",\"▐ ⠂▌\",\"▐ ⠠▌\",\"▐ ⡀▌\",\"▐ ⠠ ▌\",\"▐ ⠂ ▌\",\"▐ ⠈ ▌\",\"▐ ⠂ ▌\",\"▐ ⠠ ▌\",\"▐ ⡀ ▌\",\"▐ ⠠ ▌\",\"▐ ⠂ ▌\",\"▐ ⠈ ▌\",\"▐ ⠂ ▌\",\"▐ ⠠ ▌\",\"▐ ⡀ ▌\",\"▐⠠ ▌\"]},\"shark\":{\"interval\":120,\"frames\":[\"▐|\\\\____________▌\",\"▐_|\\\\___________▌\",\"▐__|\\\\__________▌\",\"▐___|\\\\_________▌\",\"▐____|\\\\________▌\",\"▐_____|\\\\_______▌\",\"▐______|\\\\______▌\",\"▐_______|\\\\_____▌\",\"▐________|\\\\____▌\",\"▐_________|\\\\___▌\",\"▐__________|\\\\__▌\",\"▐___________|\\\\_▌\",\"▐____________|\\\\▌\",\"▐____________/|▌\",\"▐___________/|_▌\",\"▐__________/|__▌\",\"▐_________/|___▌\",\"▐________/|____▌\",\"▐_______/|_____▌\",\"▐______/|______▌\",\"▐_____/|_______▌\",\"▐____/|________▌\",\"▐___/|_________▌\",\"▐__/|__________▌\",\"▐_/|___________▌\",\"▐/|____________▌\"]},\"dqpb\":{\"interval\":100,\"frames\":[\"d\",\"q\",\"p\",\"b\"]},\"weather\":{\"interval\":100,\"frames\":[\"☀️ \",\"☀️ \",\"☀️ \",\"🌤 \",\"⛅️ \",\"🌥 \",\"☁️ \",\"🌧 \",\"🌨 \",\"🌧 \",\"🌨 \",\"🌧 \",\"🌨 \",\"⛈ \",\"🌨 \",\"🌧 \",\"🌨 \",\"☁️ \",\"🌥 \",\"⛅️ \",\"🌤 \",\"☀️ \",\"☀️ \"]},\"christmas\":{\"interval\":400,\"frames\":[\"🌲\",\"🎄\"]}}"); /***/ }), -/* 687 */ +/* 686 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -78499,7 +78340,7 @@ const RunCommand = { }; /***/ }), -/* 688 */ +/* 687 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -78510,7 +78351,7 @@ __webpack_require__.r(__webpack_exports__); /* harmony import */ var _utils_log__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(34); /* harmony import */ var _utils_parallelize__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(500); /* harmony import */ var _utils_projects__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(501); -/* harmony import */ var _utils_watch__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(689); +/* harmony import */ var _utils_watch__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(688); /* * Licensed to Elasticsearch B.V. under one or more contributor * license agreements. See the NOTICE file distributed with @@ -78594,7 +78435,7 @@ const WatchCommand = { }; /***/ }), -/* 689 */ +/* 688 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -78668,7 +78509,7 @@ function waitUntilWatchIsReady(stream, opts = {}) { } /***/ }), -/* 690 */ +/* 689 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -78676,15 +78517,15 @@ __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "runCommand", function() { return runCommand; }); /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2); /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(chalk__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var indent_string__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(691); +/* harmony import */ var indent_string__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(690); /* harmony import */ var indent_string__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(indent_string__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var wrap_ansi__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(692); +/* harmony import */ var wrap_ansi__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(691); /* harmony import */ var wrap_ansi__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(wrap_ansi__WEBPACK_IMPORTED_MODULE_2__); /* harmony import */ var _utils_errors__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(515); /* harmony import */ var _utils_log__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(34); /* harmony import */ var _utils_projects__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(501); -/* harmony import */ var _utils_projects_tree__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(699); -/* harmony import */ var _utils_kibana__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(700); +/* harmony import */ var _utils_projects_tree__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(698); +/* harmony import */ var _utils_kibana__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(699); function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } @@ -78772,7 +78613,7 @@ function toArray(value) { } /***/ }), -/* 691 */ +/* 690 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -78806,13 +78647,13 @@ module.exports = (str, count, opts) => { /***/ }), -/* 692 */ +/* 691 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const stringWidth = __webpack_require__(693); -const stripAnsi = __webpack_require__(697); +const stringWidth = __webpack_require__(692); +const stripAnsi = __webpack_require__(696); const ESCAPES = new Set([ '\u001B', @@ -79006,13 +78847,13 @@ module.exports = (str, cols, opts) => { /***/ }), -/* 693 */ +/* 692 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const stripAnsi = __webpack_require__(694); -const isFullwidthCodePoint = __webpack_require__(696); +const stripAnsi = __webpack_require__(693); +const isFullwidthCodePoint = __webpack_require__(695); module.exports = str => { if (typeof str !== 'string' || str.length === 0) { @@ -79049,18 +78890,18 @@ module.exports = str => { /***/ }), -/* 694 */ +/* 693 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const ansiRegex = __webpack_require__(695); +const ansiRegex = __webpack_require__(694); module.exports = input => typeof input === 'string' ? input.replace(ansiRegex(), '') : input; /***/ }), -/* 695 */ +/* 694 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -79077,7 +78918,7 @@ module.exports = () => { /***/ }), -/* 696 */ +/* 695 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -79130,18 +78971,18 @@ module.exports = x => { /***/ }), -/* 697 */ +/* 696 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const ansiRegex = __webpack_require__(698); +const ansiRegex = __webpack_require__(697); module.exports = input => typeof input === 'string' ? input.replace(ansiRegex(), '') : input; /***/ }), -/* 698 */ +/* 697 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -79158,7 +78999,7 @@ module.exports = () => { /***/ }), -/* 699 */ +/* 698 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -79311,7 +79152,7 @@ function addProjectToTree(tree, pathParts, project) { } /***/ }), -/* 700 */ +/* 699 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -79319,7 +79160,7 @@ __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Kibana", function() { return Kibana; }); /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16); /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var multimatch__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(701); +/* harmony import */ var multimatch__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(700); /* harmony import */ var multimatch__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(multimatch__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var _projects__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(501); /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(579); @@ -79454,15 +79295,15 @@ class Kibana { } /***/ }), -/* 701 */ +/* 700 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; const minimatch = __webpack_require__(505); -const arrayUnion = __webpack_require__(702); -const arrayDiffer = __webpack_require__(703); -const arrify = __webpack_require__(704); +const arrayUnion = __webpack_require__(701); +const arrayDiffer = __webpack_require__(702); +const arrify = __webpack_require__(703); module.exports = (list, patterns, options = {}) => { list = arrify(list); @@ -79486,7 +79327,7 @@ module.exports = (list, patterns, options = {}) => { /***/ }), -/* 702 */ +/* 701 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -79498,7 +79339,7 @@ module.exports = (...arguments_) => { /***/ }), -/* 703 */ +/* 702 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -79512,8 +79353,444 @@ const arrayDiffer = (array, ...values) => { module.exports = arrayDiffer; +/***/ }), +/* 703 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +const arrify = value => { + if (value === null || value === undefined) { + return []; + } + + if (Array.isArray(value)) { + return value; + } + + if (typeof value === 'string') { + return [value]; + } + + if (typeof value[Symbol.iterator] === 'function') { + return [...value]; + } + + return [value]; +}; + +module.exports = arrify; + + /***/ }), /* 704 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _build_production_projects__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(705); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "buildProductionProjects", function() { return _build_production_projects__WEBPACK_IMPORTED_MODULE_0__["buildProductionProjects"]; }); + +/* harmony import */ var _prepare_project_dependencies__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(928); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "prepareExternalProjectDependencies", function() { return _prepare_project_dependencies__WEBPACK_IMPORTED_MODULE_1__["prepareExternalProjectDependencies"]; }); + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + + + +/***/ }), +/* 705 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "buildProductionProjects", function() { return buildProductionProjects; }); +/* harmony import */ var cpy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(706); +/* harmony import */ var cpy__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(cpy__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var del__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(587); +/* harmony import */ var del__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(del__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(16); +/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(579); +/* harmony import */ var _utils_fs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(20); +/* harmony import */ var _utils_log__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(34); +/* harmony import */ var _utils_package_json__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(517); +/* harmony import */ var _utils_projects__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(501); +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + + + + + + + + +async function buildProductionProjects({ + kibanaRoot, + buildRoot, + onlyOSS +}) { + const projects = await getProductionProjects(kibanaRoot, onlyOSS); + const projectGraph = Object(_utils_projects__WEBPACK_IMPORTED_MODULE_7__["buildProjectGraph"])(projects); + const batchedProjects = Object(_utils_projects__WEBPACK_IMPORTED_MODULE_7__["topologicallyBatchProjects"])(projects, projectGraph); + const projectNames = [...projects.values()].map(project => project.name); + _utils_log__WEBPACK_IMPORTED_MODULE_5__["log"].write(`Preparing production build for [${projectNames.join(', ')}]`); + + for (const batch of batchedProjects) { + for (const project of batch) { + await deleteTarget(project); + await buildProject(project); + await copyToBuild(project, kibanaRoot, buildRoot); + } + } +} +/** + * Returns the subset of projects that should be built into the production + * bundle. As we copy these into Kibana's `node_modules` during the build step, + * and let Kibana's build process be responsible for installing dependencies, + * we only include Kibana's transitive _production_ dependencies. If onlyOSS + * is supplied, we omit projects with build.oss in their package.json set to false. + */ + +async function getProductionProjects(rootPath, onlyOSS) { + const projectPaths = Object(_config__WEBPACK_IMPORTED_MODULE_3__["getProjectPaths"])({ + rootPath + }); + const projects = await Object(_utils_projects__WEBPACK_IMPORTED_MODULE_7__["getProjects"])(rootPath, projectPaths); + const projectsSubset = [projects.get('kibana')]; + + if (projects.has('x-pack')) { + projectsSubset.push(projects.get('x-pack')); + } + + const productionProjects = Object(_utils_projects__WEBPACK_IMPORTED_MODULE_7__["includeTransitiveProjects"])(projectsSubset, projects, { + onlyProductionDependencies: true + }); // We remove Kibana, as we're already building Kibana + + productionProjects.delete('kibana'); + + if (onlyOSS) { + productionProjects.forEach(project => { + if (project.getBuildConfig().oss === false) { + productionProjects.delete(project.json.name); + } + }); + } + + return productionProjects; +} + +async function deleteTarget(project) { + const targetDir = project.targetLocation; + + if (await Object(_utils_fs__WEBPACK_IMPORTED_MODULE_4__["isDirectory"])(targetDir)) { + await del__WEBPACK_IMPORTED_MODULE_1___default()(targetDir, { + force: true + }); + } +} + +async function buildProject(project) { + if (project.hasScript('build')) { + await project.runScript('build'); + } +} +/** + * Copy all the project's files from its "intermediate build directory" and + * into the build. The intermediate directory can either be the root of the + * project or some other location defined in the project's `package.json`. + * + * When copying all the files into the build, we exclude `node_modules` because + * we want the Kibana build to be responsible for actually installing all + * dependencies. The primary reason for allowing the Kibana build process to + * manage dependencies is that it will "dedupe" them, so we don't include + * unnecessary copies of dependencies. + */ + + +async function copyToBuild(project, kibanaRoot, buildRoot) { + // We want the package to have the same relative location within the build + const relativeProjectPath = Object(path__WEBPACK_IMPORTED_MODULE_2__["relative"])(kibanaRoot, project.path); + const buildProjectPath = Object(path__WEBPACK_IMPORTED_MODULE_2__["resolve"])(buildRoot, relativeProjectPath); + await cpy__WEBPACK_IMPORTED_MODULE_0___default()(['**/*', '!node_modules/**'], buildProjectPath, { + cwd: project.getIntermediateBuildDirectory(), + dot: true, + nodir: true, + parents: true + }); // If a project is using an intermediate build directory, we special-case our + // handling of `package.json`, as the project build process might have copied + // (a potentially modified) `package.json` into the intermediate build + // directory already. If so, we want to use that `package.json` as the basis + // for creating the production-ready `package.json`. If it's not present in + // the intermediate build, we fall back to using the project's already defined + // `package.json`. + + const packageJson = (await Object(_utils_fs__WEBPACK_IMPORTED_MODULE_4__["isFile"])(Object(path__WEBPACK_IMPORTED_MODULE_2__["join"])(buildProjectPath, 'package.json'))) ? await Object(_utils_package_json__WEBPACK_IMPORTED_MODULE_6__["readPackageJson"])(buildProjectPath) : project.json; + await Object(_utils_package_json__WEBPACK_IMPORTED_MODULE_6__["writePackageJson"])(buildProjectPath, packageJson); +} + +/***/ }), +/* 706 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +const EventEmitter = __webpack_require__(379); +const path = __webpack_require__(16); +const os = __webpack_require__(11); +const pAll = __webpack_require__(707); +const arrify = __webpack_require__(709); +const globby = __webpack_require__(710); +const isGlob = __webpack_require__(605); +const cpFile = __webpack_require__(913); +const junk = __webpack_require__(925); +const CpyError = __webpack_require__(926); + +const defaultOptions = { + ignoreJunk: true +}; + +const preprocessSourcePath = (source, options) => options.cwd ? path.resolve(options.cwd, source) : source; + +const preprocessDestinationPath = (source, destination, options) => { + let basename = path.basename(source); + const dirname = path.dirname(source); + + if (typeof options.rename === 'string') { + basename = options.rename; + } else if (typeof options.rename === 'function') { + basename = options.rename(basename); + } + + if (options.cwd) { + destination = path.resolve(options.cwd, destination); + } + + if (options.parents) { + return path.join(destination, dirname, basename); + } + + return path.join(destination, basename); +}; + +module.exports = (source, destination, { + concurrency = (os.cpus().length || 1) * 2, + ...options +} = {}) => { + const progressEmitter = new EventEmitter(); + + options = { + ...defaultOptions, + ...options + }; + + const promise = (async () => { + source = arrify(source); + + if (source.length === 0 || !destination) { + throw new CpyError('`source` and `destination` required'); + } + + const copyStatus = new Map(); + let completedFiles = 0; + let completedSize = 0; + + let files; + try { + files = await globby(source, options); + + if (options.ignoreJunk) { + files = files.filter(file => junk.not(path.basename(file))); + } + } catch (error) { + throw new CpyError(`Cannot glob \`${source}\`: ${error.message}`, error); + } + + const sourcePaths = source.filter(value => !isGlob(value)); + + if (files.length === 0 || (sourcePaths.length > 0 && !sourcePaths.every(value => files.includes(value)))) { + throw new CpyError(`Cannot copy \`${source}\`: the file doesn't exist`); + } + + const fileProgressHandler = event => { + const fileStatus = copyStatus.get(event.src) || {written: 0, percent: 0}; + + if (fileStatus.written !== event.written || fileStatus.percent !== event.percent) { + completedSize -= fileStatus.written; + completedSize += event.written; + + if (event.percent === 1 && fileStatus.percent !== 1) { + completedFiles++; + } + + copyStatus.set(event.src, { + written: event.written, + percent: event.percent + }); + + progressEmitter.emit('progress', { + totalFiles: files.length, + percent: completedFiles / files.length, + completedFiles, + completedSize + }); + } + }; + + return pAll(files.map(sourcePath => { + return async () => { + const from = preprocessSourcePath(sourcePath, options); + const to = preprocessDestinationPath(sourcePath, destination, options); + + try { + await cpFile(from, to, options).on('progress', fileProgressHandler); + } catch (error) { + throw new CpyError(`Cannot copy from \`${from}\` to \`${to}\`: ${error.message}`, error); + } + + return to; + }; + }), {concurrency}); + })(); + + promise.on = (...arguments_) => { + progressEmitter.on(...arguments_); + return promise; + }; + + return promise; +}; + + +/***/ }), +/* 707 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +const pMap = __webpack_require__(708); + +module.exports = (iterable, options) => pMap(iterable, element => element(), options); +// TODO: Remove this for the next major release +module.exports.default = module.exports; + + +/***/ }), +/* 708 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +const pMap = (iterable, mapper, options) => new Promise((resolve, reject) => { + options = Object.assign({ + concurrency: Infinity + }, options); + + if (typeof mapper !== 'function') { + throw new TypeError('Mapper function is required'); + } + + const {concurrency} = options; + + if (!(typeof concurrency === 'number' && concurrency >= 1)) { + throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${concurrency}\` (${typeof concurrency})`); + } + + const ret = []; + const iterator = iterable[Symbol.iterator](); + let isRejected = false; + let isIterableDone = false; + let resolvingCount = 0; + let currentIndex = 0; + + const next = () => { + if (isRejected) { + return; + } + + const nextItem = iterator.next(); + const i = currentIndex; + currentIndex++; + + if (nextItem.done) { + isIterableDone = true; + + if (resolvingCount === 0) { + resolve(ret); + } + + return; + } + + resolvingCount++; + + Promise.resolve(nextItem.value) + .then(element => mapper(element, i)) + .then( + value => { + ret[i] = value; + resolvingCount--; + next(); + }, + error => { + isRejected = true; + reject(error); + } + ); + }; + + for (let i = 0; i < concurrency; i++) { + next(); + + if (isIterableDone) { + break; + } + } +}); + +module.exports = pMap; +// TODO: Remove this for the next major release +module.exports.default = pMap; + + +/***/ }), +/* 709 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -79542,454 +79819,18 @@ const arrify = value => { module.exports = arrify; -/***/ }), -/* 705 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _build_production_projects__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(706); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "buildProductionProjects", function() { return _build_production_projects__WEBPACK_IMPORTED_MODULE_0__["buildProductionProjects"]; }); - -/* harmony import */ var _prepare_project_dependencies__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(741); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "prepareExternalProjectDependencies", function() { return _prepare_project_dependencies__WEBPACK_IMPORTED_MODULE_1__["prepareExternalProjectDependencies"]; }); - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - - - -/***/ }), -/* 706 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "buildProductionProjects", function() { return buildProductionProjects; }); -/* harmony import */ var cpy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(707); -/* harmony import */ var cpy__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(cpy__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var del__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(587); -/* harmony import */ var del__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(del__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(16); -/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(579); -/* harmony import */ var _utils_fs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(20); -/* harmony import */ var _utils_log__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(34); -/* harmony import */ var _utils_package_json__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(517); -/* harmony import */ var _utils_projects__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(501); -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - - - - - - - - -async function buildProductionProjects({ - kibanaRoot, - buildRoot, - onlyOSS -}) { - const projects = await getProductionProjects(kibanaRoot, onlyOSS); - const projectGraph = Object(_utils_projects__WEBPACK_IMPORTED_MODULE_7__["buildProjectGraph"])(projects); - const batchedProjects = Object(_utils_projects__WEBPACK_IMPORTED_MODULE_7__["topologicallyBatchProjects"])(projects, projectGraph); - const projectNames = [...projects.values()].map(project => project.name); - _utils_log__WEBPACK_IMPORTED_MODULE_5__["log"].write(`Preparing production build for [${projectNames.join(', ')}]`); - - for (const batch of batchedProjects) { - for (const project of batch) { - await deleteTarget(project); - await buildProject(project); - await copyToBuild(project, kibanaRoot, buildRoot); - } - } -} -/** - * Returns the subset of projects that should be built into the production - * bundle. As we copy these into Kibana's `node_modules` during the build step, - * and let Kibana's build process be responsible for installing dependencies, - * we only include Kibana's transitive _production_ dependencies. If onlyOSS - * is supplied, we omit projects with build.oss in their package.json set to false. - */ - -async function getProductionProjects(rootPath, onlyOSS) { - const projectPaths = Object(_config__WEBPACK_IMPORTED_MODULE_3__["getProjectPaths"])({ - rootPath - }); - const projects = await Object(_utils_projects__WEBPACK_IMPORTED_MODULE_7__["getProjects"])(rootPath, projectPaths); - const projectsSubset = [projects.get('kibana')]; - - if (projects.has('x-pack')) { - projectsSubset.push(projects.get('x-pack')); - } - - const productionProjects = Object(_utils_projects__WEBPACK_IMPORTED_MODULE_7__["includeTransitiveProjects"])(projectsSubset, projects, { - onlyProductionDependencies: true - }); // We remove Kibana, as we're already building Kibana - - productionProjects.delete('kibana'); - - if (onlyOSS) { - productionProjects.forEach(project => { - if (project.getBuildConfig().oss === false) { - productionProjects.delete(project.json.name); - } - }); - } - - return productionProjects; -} - -async function deleteTarget(project) { - const targetDir = project.targetLocation; - - if (await Object(_utils_fs__WEBPACK_IMPORTED_MODULE_4__["isDirectory"])(targetDir)) { - await del__WEBPACK_IMPORTED_MODULE_1___default()(targetDir, { - force: true - }); - } -} - -async function buildProject(project) { - if (project.hasScript('build')) { - await project.runScript('build'); - } -} -/** - * Copy all the project's files from its "intermediate build directory" and - * into the build. The intermediate directory can either be the root of the - * project or some other location defined in the project's `package.json`. - * - * When copying all the files into the build, we exclude `node_modules` because - * we want the Kibana build to be responsible for actually installing all - * dependencies. The primary reason for allowing the Kibana build process to - * manage dependencies is that it will "dedupe" them, so we don't include - * unnecessary copies of dependencies. - */ - - -async function copyToBuild(project, kibanaRoot, buildRoot) { - // We want the package to have the same relative location within the build - const relativeProjectPath = Object(path__WEBPACK_IMPORTED_MODULE_2__["relative"])(kibanaRoot, project.path); - const buildProjectPath = Object(path__WEBPACK_IMPORTED_MODULE_2__["resolve"])(buildRoot, relativeProjectPath); - await cpy__WEBPACK_IMPORTED_MODULE_0___default()(['**/*', '!node_modules/**'], buildProjectPath, { - cwd: project.getIntermediateBuildDirectory(), - dot: true, - nodir: true, - parents: true - }); // If a project is using an intermediate build directory, we special-case our - // handling of `package.json`, as the project build process might have copied - // (a potentially modified) `package.json` into the intermediate build - // directory already. If so, we want to use that `package.json` as the basis - // for creating the production-ready `package.json`. If it's not present in - // the intermediate build, we fall back to using the project's already defined - // `package.json`. - - const packageJson = (await Object(_utils_fs__WEBPACK_IMPORTED_MODULE_4__["isFile"])(Object(path__WEBPACK_IMPORTED_MODULE_2__["join"])(buildProjectPath, 'package.json'))) ? await Object(_utils_package_json__WEBPACK_IMPORTED_MODULE_6__["readPackageJson"])(buildProjectPath) : project.json; - await Object(_utils_package_json__WEBPACK_IMPORTED_MODULE_6__["writePackageJson"])(buildProjectPath, packageJson); -} - -/***/ }), -/* 707 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -const EventEmitter = __webpack_require__(379); -const path = __webpack_require__(16); -const os = __webpack_require__(11); -const pAll = __webpack_require__(708); -const arrify = __webpack_require__(710); -const globby = __webpack_require__(711); -const isGlob = __webpack_require__(605); -const cpFile = __webpack_require__(726); -const junk = __webpack_require__(738); -const CpyError = __webpack_require__(739); - -const defaultOptions = { - ignoreJunk: true -}; - -const preprocessSourcePath = (source, options) => options.cwd ? path.resolve(options.cwd, source) : source; - -const preprocessDestinationPath = (source, destination, options) => { - let basename = path.basename(source); - const dirname = path.dirname(source); - - if (typeof options.rename === 'string') { - basename = options.rename; - } else if (typeof options.rename === 'function') { - basename = options.rename(basename); - } - - if (options.cwd) { - destination = path.resolve(options.cwd, destination); - } - - if (options.parents) { - return path.join(destination, dirname, basename); - } - - return path.join(destination, basename); -}; - -module.exports = (source, destination, { - concurrency = (os.cpus().length || 1) * 2, - ...options -} = {}) => { - const progressEmitter = new EventEmitter(); - - options = { - ...defaultOptions, - ...options - }; - - const promise = (async () => { - source = arrify(source); - - if (source.length === 0 || !destination) { - throw new CpyError('`source` and `destination` required'); - } - - const copyStatus = new Map(); - let completedFiles = 0; - let completedSize = 0; - - let files; - try { - files = await globby(source, options); - - if (options.ignoreJunk) { - files = files.filter(file => junk.not(path.basename(file))); - } - } catch (error) { - throw new CpyError(`Cannot glob \`${source}\`: ${error.message}`, error); - } - - const sourcePaths = source.filter(value => !isGlob(value)); - - if (files.length === 0 || (sourcePaths.length > 0 && !sourcePaths.every(value => files.includes(value)))) { - throw new CpyError(`Cannot copy \`${source}\`: the file doesn't exist`); - } - - const fileProgressHandler = event => { - const fileStatus = copyStatus.get(event.src) || {written: 0, percent: 0}; - - if (fileStatus.written !== event.written || fileStatus.percent !== event.percent) { - completedSize -= fileStatus.written; - completedSize += event.written; - - if (event.percent === 1 && fileStatus.percent !== 1) { - completedFiles++; - } - - copyStatus.set(event.src, { - written: event.written, - percent: event.percent - }); - - progressEmitter.emit('progress', { - totalFiles: files.length, - percent: completedFiles / files.length, - completedFiles, - completedSize - }); - } - }; - - return pAll(files.map(sourcePath => { - return async () => { - const from = preprocessSourcePath(sourcePath, options); - const to = preprocessDestinationPath(sourcePath, destination, options); - - try { - await cpFile(from, to, options).on('progress', fileProgressHandler); - } catch (error) { - throw new CpyError(`Cannot copy from \`${from}\` to \`${to}\`: ${error.message}`, error); - } - - return to; - }; - }), {concurrency}); - })(); - - promise.on = (...arguments_) => { - progressEmitter.on(...arguments_); - return promise; - }; - - return promise; -}; - - -/***/ }), -/* 708 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -const pMap = __webpack_require__(709); - -module.exports = (iterable, options) => pMap(iterable, element => element(), options); -// TODO: Remove this for the next major release -module.exports.default = module.exports; - - -/***/ }), -/* 709 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -const pMap = (iterable, mapper, options) => new Promise((resolve, reject) => { - options = Object.assign({ - concurrency: Infinity - }, options); - - if (typeof mapper !== 'function') { - throw new TypeError('Mapper function is required'); - } - - const {concurrency} = options; - - if (!(typeof concurrency === 'number' && concurrency >= 1)) { - throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${concurrency}\` (${typeof concurrency})`); - } - - const ret = []; - const iterator = iterable[Symbol.iterator](); - let isRejected = false; - let isIterableDone = false; - let resolvingCount = 0; - let currentIndex = 0; - - const next = () => { - if (isRejected) { - return; - } - - const nextItem = iterator.next(); - const i = currentIndex; - currentIndex++; - - if (nextItem.done) { - isIterableDone = true; - - if (resolvingCount === 0) { - resolve(ret); - } - - return; - } - - resolvingCount++; - - Promise.resolve(nextItem.value) - .then(element => mapper(element, i)) - .then( - value => { - ret[i] = value; - resolvingCount--; - next(); - }, - error => { - isRejected = true; - reject(error); - } - ); - }; - - for (let i = 0; i < concurrency; i++) { - next(); - - if (isIterableDone) { - break; - } - } -}); - -module.exports = pMap; -// TODO: Remove this for the next major release -module.exports.default = pMap; - - /***/ }), /* 710 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; - -const arrify = value => { - if (value === null || value === undefined) { - return []; - } - - if (Array.isArray(value)) { - return value; - } - - if (typeof value === 'string') { - return [value]; - } - - if (typeof value[Symbol.iterator] === 'function') { - return [...value]; - } - - return [value]; -}; - -module.exports = arrify; - - -/***/ }), -/* 711 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - const fs = __webpack_require__(23); -const arrayUnion = __webpack_require__(712); -const glob = __webpack_require__(714); -const fastGlob = __webpack_require__(596); -const dirGlob = __webpack_require__(719); -const gitignore = __webpack_require__(722); +const arrayUnion = __webpack_require__(711); +const glob = __webpack_require__(713); +const fastGlob = __webpack_require__(718); +const dirGlob = __webpack_require__(906); +const gitignore = __webpack_require__(909); const DEFAULT_FILTER = () => false; @@ -80134,12 +79975,12 @@ module.exports.gitignore = gitignore; /***/ }), -/* 712 */ +/* 711 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var arrayUniq = __webpack_require__(713); +var arrayUniq = __webpack_require__(712); module.exports = function () { return arrayUniq([].concat.apply([], arguments)); @@ -80147,7 +79988,7 @@ module.exports = function () { /***/ }), -/* 713 */ +/* 712 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -80216,7 +80057,7 @@ if ('Set' in global) { /***/ }), -/* 714 */ +/* 713 */ /***/ (function(module, exports, __webpack_require__) { // Approach: @@ -80265,13 +80106,13 @@ var fs = __webpack_require__(23) var rp = __webpack_require__(503) var minimatch = __webpack_require__(505) var Minimatch = minimatch.Minimatch -var inherits = __webpack_require__(715) +var inherits = __webpack_require__(714) var EE = __webpack_require__(379).EventEmitter var path = __webpack_require__(16) var assert = __webpack_require__(30) var isAbsolute = __webpack_require__(511) -var globSync = __webpack_require__(717) -var common = __webpack_require__(718) +var globSync = __webpack_require__(716) +var common = __webpack_require__(717) var alphasort = common.alphasort var alphasorti = common.alphasorti var setopts = common.setopts @@ -81012,7 +80853,7 @@ Glob.prototype._stat2 = function (f, abs, er, stat, cb) { /***/ }), -/* 715 */ +/* 714 */ /***/ (function(module, exports, __webpack_require__) { try { @@ -81022,12 +80863,12 @@ try { module.exports = util.inherits; } catch (e) { /* istanbul ignore next */ - module.exports = __webpack_require__(716); + module.exports = __webpack_require__(715); } /***/ }), -/* 716 */ +/* 715 */ /***/ (function(module, exports) { if (typeof Object.create === 'function') { @@ -81060,7 +80901,7 @@ if (typeof Object.create === 'function') { /***/ }), -/* 717 */ +/* 716 */ /***/ (function(module, exports, __webpack_require__) { module.exports = globSync @@ -81070,12 +80911,12 @@ var fs = __webpack_require__(23) var rp = __webpack_require__(503) var minimatch = __webpack_require__(505) var Minimatch = minimatch.Minimatch -var Glob = __webpack_require__(714).Glob +var Glob = __webpack_require__(713).Glob var util = __webpack_require__(29) var path = __webpack_require__(16) var assert = __webpack_require__(30) var isAbsolute = __webpack_require__(511) -var common = __webpack_require__(718) +var common = __webpack_require__(717) var alphasort = common.alphasort var alphasorti = common.alphasorti var setopts = common.setopts @@ -81504,307 +81345,24461 @@ GlobSync.prototype._stat = function (f) { // if we know it exists, but not what it is. } - var exists - var stat = this.statCache[abs] - if (!stat) { - var lstat - try { - lstat = fs.lstatSync(abs) - } catch (er) { - if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) { - this.statCache[abs] = false - return false - } - } + var exists + var stat = this.statCache[abs] + if (!stat) { + var lstat + try { + lstat = fs.lstatSync(abs) + } catch (er) { + if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) { + this.statCache[abs] = false + return false + } + } + + if (lstat && lstat.isSymbolicLink()) { + try { + stat = fs.statSync(abs) + } catch (er) { + stat = lstat + } + } else { + stat = lstat + } + } + + this.statCache[abs] = stat + + var c = true + if (stat) + c = stat.isDirectory() ? 'DIR' : 'FILE' + + this.cache[abs] = this.cache[abs] || c + + if (needDir && c === 'FILE') + return false + + return c +} + +GlobSync.prototype._mark = function (p) { + return common.mark(this, p) +} + +GlobSync.prototype._makeAbs = function (f) { + return common.makeAbs(this, f) +} + + +/***/ }), +/* 717 */ +/***/ (function(module, exports, __webpack_require__) { + +exports.alphasort = alphasort +exports.alphasorti = alphasorti +exports.setopts = setopts +exports.ownProp = ownProp +exports.makeAbs = makeAbs +exports.finish = finish +exports.mark = mark +exports.isIgnored = isIgnored +exports.childrenIgnored = childrenIgnored + +function ownProp (obj, field) { + return Object.prototype.hasOwnProperty.call(obj, field) +} + +var path = __webpack_require__(16) +var minimatch = __webpack_require__(505) +var isAbsolute = __webpack_require__(511) +var Minimatch = minimatch.Minimatch + +function alphasorti (a, b) { + return a.toLowerCase().localeCompare(b.toLowerCase()) +} + +function alphasort (a, b) { + return a.localeCompare(b) +} + +function setupIgnores (self, options) { + self.ignore = options.ignore || [] + + if (!Array.isArray(self.ignore)) + self.ignore = [self.ignore] + + if (self.ignore.length) { + self.ignore = self.ignore.map(ignoreMap) + } +} + +// ignore patterns are always in dot:true mode. +function ignoreMap (pattern) { + var gmatcher = null + if (pattern.slice(-3) === '/**') { + var gpattern = pattern.replace(/(\/\*\*)+$/, '') + gmatcher = new Minimatch(gpattern, { dot: true }) + } + + return { + matcher: new Minimatch(pattern, { dot: true }), + gmatcher: gmatcher + } +} + +function setopts (self, pattern, options) { + if (!options) + options = {} + + // base-matching: just use globstar for that. + if (options.matchBase && -1 === pattern.indexOf("/")) { + if (options.noglobstar) { + throw new Error("base matching requires globstar") + } + pattern = "**/" + pattern + } + + self.silent = !!options.silent + self.pattern = pattern + self.strict = options.strict !== false + self.realpath = !!options.realpath + self.realpathCache = options.realpathCache || Object.create(null) + self.follow = !!options.follow + self.dot = !!options.dot + self.mark = !!options.mark + self.nodir = !!options.nodir + if (self.nodir) + self.mark = true + self.sync = !!options.sync + self.nounique = !!options.nounique + self.nonull = !!options.nonull + self.nosort = !!options.nosort + self.nocase = !!options.nocase + self.stat = !!options.stat + self.noprocess = !!options.noprocess + self.absolute = !!options.absolute + + self.maxLength = options.maxLength || Infinity + self.cache = options.cache || Object.create(null) + self.statCache = options.statCache || Object.create(null) + self.symlinks = options.symlinks || Object.create(null) + + setupIgnores(self, options) + + self.changedCwd = false + var cwd = process.cwd() + if (!ownProp(options, "cwd")) + self.cwd = cwd + else { + self.cwd = path.resolve(options.cwd) + self.changedCwd = self.cwd !== cwd + } + + self.root = options.root || path.resolve(self.cwd, "/") + self.root = path.resolve(self.root) + if (process.platform === "win32") + self.root = self.root.replace(/\\/g, "/") + + // TODO: is an absolute `cwd` supposed to be resolved against `root`? + // e.g. { cwd: '/test', root: __dirname } === path.join(__dirname, '/test') + self.cwdAbs = isAbsolute(self.cwd) ? self.cwd : makeAbs(self, self.cwd) + if (process.platform === "win32") + self.cwdAbs = self.cwdAbs.replace(/\\/g, "/") + self.nomount = !!options.nomount + + // disable comments and negation in Minimatch. + // Note that they are not supported in Glob itself anyway. + options.nonegate = true + options.nocomment = true + + self.minimatch = new Minimatch(pattern, options) + self.options = self.minimatch.options +} + +function finish (self) { + var nou = self.nounique + var all = nou ? [] : Object.create(null) + + for (var i = 0, l = self.matches.length; i < l; i ++) { + var matches = self.matches[i] + if (!matches || Object.keys(matches).length === 0) { + if (self.nonull) { + // do like the shell, and spit out the literal glob + var literal = self.minimatch.globSet[i] + if (nou) + all.push(literal) + else + all[literal] = true + } + } else { + // had matches + var m = Object.keys(matches) + if (nou) + all.push.apply(all, m) + else + m.forEach(function (m) { + all[m] = true + }) + } + } + + if (!nou) + all = Object.keys(all) + + if (!self.nosort) + all = all.sort(self.nocase ? alphasorti : alphasort) + + // at *some* point we statted all of these + if (self.mark) { + for (var i = 0; i < all.length; i++) { + all[i] = self._mark(all[i]) + } + if (self.nodir) { + all = all.filter(function (e) { + var notDir = !(/\/$/.test(e)) + var c = self.cache[e] || self.cache[makeAbs(self, e)] + if (notDir && c) + notDir = c !== 'DIR' && !Array.isArray(c) + return notDir + }) + } + } + + if (self.ignore.length) + all = all.filter(function(m) { + return !isIgnored(self, m) + }) + + self.found = all +} + +function mark (self, p) { + var abs = makeAbs(self, p) + var c = self.cache[abs] + var m = p + if (c) { + var isDir = c === 'DIR' || Array.isArray(c) + var slash = p.slice(-1) === '/' + + if (isDir && !slash) + m += '/' + else if (!isDir && slash) + m = m.slice(0, -1) + + if (m !== p) { + var mabs = makeAbs(self, m) + self.statCache[mabs] = self.statCache[abs] + self.cache[mabs] = self.cache[abs] + } + } + + return m +} + +// lotta situps... +function makeAbs (self, f) { + var abs = f + if (f.charAt(0) === '/') { + abs = path.join(self.root, f) + } else if (isAbsolute(f) || f === '') { + abs = f + } else if (self.changedCwd) { + abs = path.resolve(self.cwd, f) + } else { + abs = path.resolve(f) + } + + if (process.platform === 'win32') + abs = abs.replace(/\\/g, '/') + + return abs +} + + +// Return true, if pattern ends with globstar '**', for the accompanying parent directory. +// Ex:- If node_modules/** is the pattern, add 'node_modules' to ignore list along with it's contents +function isIgnored (self, path) { + if (!self.ignore.length) + return false + + return self.ignore.some(function(item) { + return item.matcher.match(path) || !!(item.gmatcher && item.gmatcher.match(path)) + }) +} + +function childrenIgnored (self, path) { + if (!self.ignore.length) + return false + + return self.ignore.some(function(item) { + return !!(item.gmatcher && item.gmatcher.match(path)) + }) +} + + +/***/ }), +/* 718 */ +/***/ (function(module, exports, __webpack_require__) { + +const pkg = __webpack_require__(719); + +module.exports = pkg.async; +module.exports.default = pkg.async; + +module.exports.async = pkg.async; +module.exports.sync = pkg.sync; +module.exports.stream = pkg.stream; + +module.exports.generateTasks = pkg.generateTasks; + + +/***/ }), +/* 719 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var optionsManager = __webpack_require__(720); +var taskManager = __webpack_require__(721); +var reader_async_1 = __webpack_require__(877); +var reader_stream_1 = __webpack_require__(901); +var reader_sync_1 = __webpack_require__(902); +var arrayUtils = __webpack_require__(904); +var streamUtils = __webpack_require__(905); +/** + * Synchronous API. + */ +function sync(source, opts) { + assertPatternsInput(source); + var works = getWorks(source, reader_sync_1.default, opts); + return arrayUtils.flatten(works); +} +exports.sync = sync; +/** + * Asynchronous API. + */ +function async(source, opts) { + try { + assertPatternsInput(source); + } + catch (error) { + return Promise.reject(error); + } + var works = getWorks(source, reader_async_1.default, opts); + return Promise.all(works).then(arrayUtils.flatten); +} +exports.async = async; +/** + * Stream API. + */ +function stream(source, opts) { + assertPatternsInput(source); + var works = getWorks(source, reader_stream_1.default, opts); + return streamUtils.merge(works); +} +exports.stream = stream; +/** + * Return a set of tasks based on provided patterns. + */ +function generateTasks(source, opts) { + assertPatternsInput(source); + var patterns = [].concat(source); + var options = optionsManager.prepare(opts); + return taskManager.generate(patterns, options); +} +exports.generateTasks = generateTasks; +/** + * Returns a set of works based on provided tasks and class of the reader. + */ +function getWorks(source, _Reader, opts) { + var patterns = [].concat(source); + var options = optionsManager.prepare(opts); + var tasks = taskManager.generate(patterns, options); + var reader = new _Reader(options); + return tasks.map(reader.read, reader); +} +function assertPatternsInput(source) { + if ([].concat(source).every(isString)) { + return; + } + throw new TypeError('Patterns must be a string or an array of strings'); +} +function isString(source) { + /* tslint:disable-next-line strict-type-predicates */ + return typeof source === 'string'; +} + + +/***/ }), +/* 720 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +var __assign = (this && this.__assign) || function () { + __assign = Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +function prepare(options) { + var opts = __assign({ cwd: process.cwd(), deep: true, ignore: [], dot: false, stats: false, onlyFiles: true, onlyDirectories: false, followSymlinkedDirectories: true, unique: true, markDirectories: false, absolute: false, nobrace: false, brace: true, noglobstar: false, globstar: true, noext: false, extension: true, nocase: false, case: true, matchBase: false, transform: null }, options); + if (opts.onlyDirectories) { + opts.onlyFiles = false; + } + opts.brace = !opts.nobrace; + opts.globstar = !opts.noglobstar; + opts.extension = !opts.noext; + opts.case = !opts.nocase; + if (options) { + opts.brace = ('brace' in options ? options.brace : opts.brace); + opts.globstar = ('globstar' in options ? options.globstar : opts.globstar); + opts.extension = ('extension' in options ? options.extension : opts.extension); + opts.case = ('case' in options ? options.case : opts.case); + } + return opts; +} +exports.prepare = prepare; + + +/***/ }), +/* 721 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var patternUtils = __webpack_require__(722); +/** + * Generate tasks based on parent directory of each pattern. + */ +function generate(patterns, options) { + var unixPatterns = patterns.map(patternUtils.unixifyPattern); + var unixIgnore = options.ignore.map(patternUtils.unixifyPattern); + var positivePatterns = getPositivePatterns(unixPatterns); + var negativePatterns = getNegativePatternsAsPositive(unixPatterns, unixIgnore); + /** + * When the `case` option is disabled, all patterns must be marked as dynamic, because we cannot check filepath + * directly (without read directory). + */ + var staticPatterns = !options.case ? [] : positivePatterns.filter(patternUtils.isStaticPattern); + var dynamicPatterns = !options.case ? positivePatterns : positivePatterns.filter(patternUtils.isDynamicPattern); + var staticTasks = convertPatternsToTasks(staticPatterns, negativePatterns, /* dynamic */ false); + var dynamicTasks = convertPatternsToTasks(dynamicPatterns, negativePatterns, /* dynamic */ true); + return staticTasks.concat(dynamicTasks); +} +exports.generate = generate; +/** + * Convert patterns to tasks based on parent directory of each pattern. + */ +function convertPatternsToTasks(positive, negative, dynamic) { + var positivePatternsGroup = groupPatternsByBaseDirectory(positive); + // When we have a global group – there is no reason to divide the patterns into independent tasks. + // In this case, the global task covers the rest. + if ('.' in positivePatternsGroup) { + var task = convertPatternGroupToTask('.', positive, negative, dynamic); + return [task]; + } + return convertPatternGroupsToTasks(positivePatternsGroup, negative, dynamic); +} +exports.convertPatternsToTasks = convertPatternsToTasks; +/** + * Return only positive patterns. + */ +function getPositivePatterns(patterns) { + return patternUtils.getPositivePatterns(patterns); +} +exports.getPositivePatterns = getPositivePatterns; +/** + * Return only negative patterns. + */ +function getNegativePatternsAsPositive(patterns, ignore) { + var negative = patternUtils.getNegativePatterns(patterns).concat(ignore); + var positive = negative.map(patternUtils.convertToPositivePattern); + return positive; +} +exports.getNegativePatternsAsPositive = getNegativePatternsAsPositive; +/** + * Group patterns by base directory of each pattern. + */ +function groupPatternsByBaseDirectory(patterns) { + return patterns.reduce(function (collection, pattern) { + var base = patternUtils.getBaseDirectory(pattern); + if (base in collection) { + collection[base].push(pattern); + } + else { + collection[base] = [pattern]; + } + return collection; + }, {}); +} +exports.groupPatternsByBaseDirectory = groupPatternsByBaseDirectory; +/** + * Convert group of patterns to tasks. + */ +function convertPatternGroupsToTasks(positive, negative, dynamic) { + return Object.keys(positive).map(function (base) { + return convertPatternGroupToTask(base, positive[base], negative, dynamic); + }); +} +exports.convertPatternGroupsToTasks = convertPatternGroupsToTasks; +/** + * Create a task for positive and negative patterns. + */ +function convertPatternGroupToTask(base, positive, negative, dynamic) { + return { + base: base, + dynamic: dynamic, + positive: positive, + negative: negative, + patterns: [].concat(positive, negative.map(patternUtils.convertToNegativePattern)) + }; +} +exports.convertPatternGroupToTask = convertPatternGroupToTask; + + +/***/ }), +/* 722 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var path = __webpack_require__(16); +var globParent = __webpack_require__(723); +var isGlob = __webpack_require__(726); +var micromatch = __webpack_require__(727); +var GLOBSTAR = '**'; +/** + * Return true for static pattern. + */ +function isStaticPattern(pattern) { + return !isDynamicPattern(pattern); +} +exports.isStaticPattern = isStaticPattern; +/** + * Return true for pattern that looks like glob. + */ +function isDynamicPattern(pattern) { + return isGlob(pattern, { strict: false }); +} +exports.isDynamicPattern = isDynamicPattern; +/** + * Convert a windows «path» to a unix-style «path». + */ +function unixifyPattern(pattern) { + return pattern.replace(/\\/g, '/'); +} +exports.unixifyPattern = unixifyPattern; +/** + * Returns negative pattern as positive pattern. + */ +function convertToPositivePattern(pattern) { + return isNegativePattern(pattern) ? pattern.slice(1) : pattern; +} +exports.convertToPositivePattern = convertToPositivePattern; +/** + * Returns positive pattern as negative pattern. + */ +function convertToNegativePattern(pattern) { + return '!' + pattern; +} +exports.convertToNegativePattern = convertToNegativePattern; +/** + * Return true if provided pattern is negative pattern. + */ +function isNegativePattern(pattern) { + return pattern.startsWith('!') && pattern[1] !== '('; +} +exports.isNegativePattern = isNegativePattern; +/** + * Return true if provided pattern is positive pattern. + */ +function isPositivePattern(pattern) { + return !isNegativePattern(pattern); +} +exports.isPositivePattern = isPositivePattern; +/** + * Extracts negative patterns from array of patterns. + */ +function getNegativePatterns(patterns) { + return patterns.filter(isNegativePattern); +} +exports.getNegativePatterns = getNegativePatterns; +/** + * Extracts positive patterns from array of patterns. + */ +function getPositivePatterns(patterns) { + return patterns.filter(isPositivePattern); +} +exports.getPositivePatterns = getPositivePatterns; +/** + * Extract base directory from provided pattern. + */ +function getBaseDirectory(pattern) { + return globParent(pattern); +} +exports.getBaseDirectory = getBaseDirectory; +/** + * Return true if provided pattern has globstar. + */ +function hasGlobStar(pattern) { + return pattern.indexOf(GLOBSTAR) !== -1; +} +exports.hasGlobStar = hasGlobStar; +/** + * Return true if provided pattern ends with slash and globstar. + */ +function endsWithSlashGlobStar(pattern) { + return pattern.endsWith('/' + GLOBSTAR); +} +exports.endsWithSlashGlobStar = endsWithSlashGlobStar; +/** + * Returns «true» when pattern ends with a slash and globstar or the last partial of the pattern is static pattern. + */ +function isAffectDepthOfReadingPattern(pattern) { + var basename = path.basename(pattern); + return endsWithSlashGlobStar(pattern) || isStaticPattern(basename); +} +exports.isAffectDepthOfReadingPattern = isAffectDepthOfReadingPattern; +/** + * Return naive depth of provided pattern without depth of the base directory. + */ +function getNaiveDepth(pattern) { + var base = getBaseDirectory(pattern); + var patternDepth = pattern.split('/').length; + var patternBaseDepth = base.split('/').length; + /** + * This is a hack for pattern that has no base directory. + * + * This is related to the `*\something\*` pattern. + */ + if (base === '.') { + return patternDepth - patternBaseDepth; + } + return patternDepth - patternBaseDepth - 1; +} +exports.getNaiveDepth = getNaiveDepth; +/** + * Return max naive depth of provided patterns without depth of the base directory. + */ +function getMaxNaivePatternsDepth(patterns) { + return patterns.reduce(function (max, pattern) { + var depth = getNaiveDepth(pattern); + return depth > max ? depth : max; + }, 0); +} +exports.getMaxNaivePatternsDepth = getMaxNaivePatternsDepth; +/** + * Make RegExp for provided pattern. + */ +function makeRe(pattern, options) { + return micromatch.makeRe(pattern, options); +} +exports.makeRe = makeRe; +/** + * Convert patterns to regexps. + */ +function convertPatternsToRe(patterns, options) { + return patterns.map(function (pattern) { return makeRe(pattern, options); }); +} +exports.convertPatternsToRe = convertPatternsToRe; +/** + * Returns true if the entry match any of the given RegExp's. + */ +function matchAny(entry, patternsRe) { + return patternsRe.some(function (patternRe) { return patternRe.test(entry); }); +} +exports.matchAny = matchAny; + + +/***/ }), +/* 723 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var path = __webpack_require__(16); +var isglob = __webpack_require__(724); +var pathDirname = __webpack_require__(725); +var isWin32 = __webpack_require__(11).platform() === 'win32'; + +module.exports = function globParent(str) { + // flip windows path separators + if (isWin32 && str.indexOf('/') < 0) str = str.split('\\').join('/'); + + // special case for strings ending in enclosure containing path separator + if (/[\{\[].*[\/]*.*[\}\]]$/.test(str)) str += '/'; + + // preserves full path in case of trailing path separator + str += 'a'; + + // remove path parts that are globby + do {str = pathDirname.posix(str)} + while (isglob(str) || /(^|[^\\])([\{\[]|\([^\)]+$)/.test(str)); + + // remove escape chars and return result + return str.replace(/\\([\*\?\|\[\]\(\)\{\}])/g, '$1'); +}; + + +/***/ }), +/* 724 */ +/***/ (function(module, exports, __webpack_require__) { + +/*! + * is-glob + * + * Copyright (c) 2014-2016, Jon Schlinkert. + * Licensed under the MIT License. + */ + +var isExtglob = __webpack_require__(606); + +module.exports = function isGlob(str) { + if (typeof str !== 'string' || str === '') { + return false; + } + + if (isExtglob(str)) return true; + + var regex = /(\\).|([*?]|\[.*\]|\{.*\}|\(.*\|.*\)|^!)/; + var match; + + while ((match = regex.exec(str))) { + if (match[2]) return true; + str = str.slice(match.index + match[0].length); + } + return false; +}; + + +/***/ }), +/* 725 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var path = __webpack_require__(16); +var inspect = __webpack_require__(29).inspect; + +function assertPath(path) { + if (typeof path !== 'string') { + throw new TypeError('Path must be a string. Received ' + inspect(path)); + } +} + +function posix(path) { + assertPath(path); + if (path.length === 0) + return '.'; + var code = path.charCodeAt(0); + var hasRoot = (code === 47/*/*/); + var end = -1; + var matchedSlash = true; + for (var i = path.length - 1; i >= 1; --i) { + code = path.charCodeAt(i); + if (code === 47/*/*/) { + if (!matchedSlash) { + end = i; + break; + } + } else { + // We saw the first non-path separator + matchedSlash = false; + } + } + + if (end === -1) + return hasRoot ? '/' : '.'; + if (hasRoot && end === 1) + return '//'; + return path.slice(0, end); +} + +function win32(path) { + assertPath(path); + var len = path.length; + if (len === 0) + return '.'; + var rootEnd = -1; + var end = -1; + var matchedSlash = true; + var offset = 0; + var code = path.charCodeAt(0); + + // Try to match a root + if (len > 1) { + if (code === 47/*/*/ || code === 92/*\*/) { + // Possible UNC root + + rootEnd = offset = 1; + + code = path.charCodeAt(1); + if (code === 47/*/*/ || code === 92/*\*/) { + // Matched double path separator at beginning + var j = 2; + var last = j; + // Match 1 or more non-path separators + for (; j < len; ++j) { + code = path.charCodeAt(j); + if (code === 47/*/*/ || code === 92/*\*/) + break; + } + if (j < len && j !== last) { + // Matched! + last = j; + // Match 1 or more path separators + for (; j < len; ++j) { + code = path.charCodeAt(j); + if (code !== 47/*/*/ && code !== 92/*\*/) + break; + } + if (j < len && j !== last) { + // Matched! + last = j; + // Match 1 or more non-path separators + for (; j < len; ++j) { + code = path.charCodeAt(j); + if (code === 47/*/*/ || code === 92/*\*/) + break; + } + if (j === len) { + // We matched a UNC root only + return path; + } + if (j !== last) { + // We matched a UNC root with leftovers + + // Offset by 1 to include the separator after the UNC root to + // treat it as a "normal root" on top of a (UNC) root + rootEnd = offset = j + 1; + } + } + } + } + } else if ((code >= 65/*A*/ && code <= 90/*Z*/) || + (code >= 97/*a*/ && code <= 122/*z*/)) { + // Possible device root + + code = path.charCodeAt(1); + if (path.charCodeAt(1) === 58/*:*/) { + rootEnd = offset = 2; + if (len > 2) { + code = path.charCodeAt(2); + if (code === 47/*/*/ || code === 92/*\*/) + rootEnd = offset = 3; + } + } + } + } else if (code === 47/*/*/ || code === 92/*\*/) { + return path[0]; + } + + for (var i = len - 1; i >= offset; --i) { + code = path.charCodeAt(i); + if (code === 47/*/*/ || code === 92/*\*/) { + if (!matchedSlash) { + end = i; + break; + } + } else { + // We saw the first non-path separator + matchedSlash = false; + } + } + + if (end === -1) { + if (rootEnd === -1) + return '.'; + else + end = rootEnd; + } + return path.slice(0, end); +} + +module.exports = process.platform === 'win32' ? win32 : posix; +module.exports.posix = posix; +module.exports.win32 = win32; + + +/***/ }), +/* 726 */ +/***/ (function(module, exports, __webpack_require__) { + +/*! + * is-glob + * + * Copyright (c) 2014-2017, Jon Schlinkert. + * Released under the MIT License. + */ + +var isExtglob = __webpack_require__(606); +var chars = { '{': '}', '(': ')', '[': ']'}; + +module.exports = function isGlob(str, options) { + if (typeof str !== 'string' || str === '') { + return false; + } + + if (isExtglob(str)) { + return true; + } + + var regex = /\\(.)|(^!|\*|[\].+)]\?|\[[^\\\]]+\]|\{[^\\}]+\}|\(\?[:!=][^\\)]+\)|\([^|]+\|[^\\)]+\))/; + var match; + + // optionally relax regex + if (options && options.strict === false) { + regex = /\\(.)|(^!|[*?{}()[\]]|\(\?)/; + } + + while ((match = regex.exec(str))) { + if (match[2]) return true; + var idx = match.index + match[0].length; + + // if an open bracket/brace/paren is escaped, + // set the index to the next closing character + var open = match[1]; + var close = open ? chars[open] : null; + if (open && close) { + var n = str.indexOf(close, idx); + if (n !== -1) { + idx = n + 1; + } + } + + str = str.slice(idx); + } + return false; +}; + + +/***/ }), +/* 727 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/** + * Module dependencies + */ + +var util = __webpack_require__(29); +var braces = __webpack_require__(728); +var toRegex = __webpack_require__(830); +var extend = __webpack_require__(838); + +/** + * Local dependencies + */ + +var compilers = __webpack_require__(841); +var parsers = __webpack_require__(873); +var cache = __webpack_require__(874); +var utils = __webpack_require__(875); +var MAX_LENGTH = 1024 * 64; + +/** + * The main function takes a list of strings and one or more + * glob patterns to use for matching. + * + * ```js + * var mm = require('micromatch'); + * mm(list, patterns[, options]); + * + * console.log(mm(['a.js', 'a.txt'], ['*.js'])); + * //=> [ 'a.js' ] + * ``` + * @param {Array} `list` A list of strings to match + * @param {String|Array} `patterns` One or more glob patterns to use for matching. + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Array} Returns an array of matches + * @summary false + * @api public + */ + +function micromatch(list, patterns, options) { + patterns = utils.arrayify(patterns); + list = utils.arrayify(list); + + var len = patterns.length; + if (list.length === 0 || len === 0) { + return []; + } + + if (len === 1) { + return micromatch.match(list, patterns[0], options); + } + + var omit = []; + var keep = []; + var idx = -1; + + while (++idx < len) { + var pattern = patterns[idx]; + + if (typeof pattern === 'string' && pattern.charCodeAt(0) === 33 /* ! */) { + omit.push.apply(omit, micromatch.match(list, pattern.slice(1), options)); + } else { + keep.push.apply(keep, micromatch.match(list, pattern, options)); + } + } + + var matches = utils.diff(keep, omit); + if (!options || options.nodupes !== false) { + return utils.unique(matches); + } + + return matches; +} + +/** + * Similar to the main function, but `pattern` must be a string. + * + * ```js + * var mm = require('micromatch'); + * mm.match(list, pattern[, options]); + * + * console.log(mm.match(['a.a', 'a.aa', 'a.b', 'a.c'], '*.a')); + * //=> ['a.a', 'a.aa'] + * ``` + * @param {Array} `list` Array of strings to match + * @param {String} `pattern` Glob pattern to use for matching. + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Array} Returns an array of matches + * @api public + */ + +micromatch.match = function(list, pattern, options) { + if (Array.isArray(pattern)) { + throw new TypeError('expected pattern to be a string'); + } + + var unixify = utils.unixify(options); + var isMatch = memoize('match', pattern, options, micromatch.matcher); + var matches = []; + + list = utils.arrayify(list); + var len = list.length; + var idx = -1; + + while (++idx < len) { + var ele = list[idx]; + if (ele === pattern || isMatch(ele)) { + matches.push(utils.value(ele, unixify, options)); + } + } + + // if no options were passed, uniquify results and return + if (typeof options === 'undefined') { + return utils.unique(matches); + } + + if (matches.length === 0) { + if (options.failglob === true) { + throw new Error('no matches found for "' + pattern + '"'); + } + if (options.nonull === true || options.nullglob === true) { + return [options.unescape ? utils.unescape(pattern) : pattern]; + } + } + + // if `opts.ignore` was defined, diff ignored list + if (options.ignore) { + matches = micromatch.not(matches, options.ignore, options); + } + + return options.nodupes !== false ? utils.unique(matches) : matches; +}; + +/** + * Returns true if the specified `string` matches the given glob `pattern`. + * + * ```js + * var mm = require('micromatch'); + * mm.isMatch(string, pattern[, options]); + * + * console.log(mm.isMatch('a.a', '*.a')); + * //=> true + * console.log(mm.isMatch('a.b', '*.a')); + * //=> false + * ``` + * @param {String} `string` String to match + * @param {String} `pattern` Glob pattern to use for matching. + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Boolean} Returns true if the string matches the glob pattern. + * @api public + */ + +micromatch.isMatch = function(str, pattern, options) { + if (typeof str !== 'string') { + throw new TypeError('expected a string: "' + util.inspect(str) + '"'); + } + + if (isEmptyString(str) || isEmptyString(pattern)) { + return false; + } + + var equals = utils.equalsPattern(options); + if (equals(str)) { + return true; + } + + var isMatch = memoize('isMatch', pattern, options, micromatch.matcher); + return isMatch(str); +}; + +/** + * Returns true if some of the strings in the given `list` match any of the + * given glob `patterns`. + * + * ```js + * var mm = require('micromatch'); + * mm.some(list, patterns[, options]); + * + * console.log(mm.some(['foo.js', 'bar.js'], ['*.js', '!foo.js'])); + * // true + * console.log(mm.some(['foo.js'], ['*.js', '!foo.js'])); + * // false + * ``` + * @param {String|Array} `list` The string or array of strings to test. Returns as soon as the first match is found. + * @param {String|Array} `patterns` One or more glob patterns to use for matching. + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Boolean} Returns true if any patterns match `str` + * @api public + */ + +micromatch.some = function(list, patterns, options) { + if (typeof list === 'string') { + list = [list]; + } + for (var i = 0; i < list.length; i++) { + if (micromatch(list[i], patterns, options).length === 1) { + return true; + } + } + return false; +}; + +/** + * Returns true if every string in the given `list` matches + * any of the given glob `patterns`. + * + * ```js + * var mm = require('micromatch'); + * mm.every(list, patterns[, options]); + * + * console.log(mm.every('foo.js', ['foo.js'])); + * // true + * console.log(mm.every(['foo.js', 'bar.js'], ['*.js'])); + * // true + * console.log(mm.every(['foo.js', 'bar.js'], ['*.js', '!foo.js'])); + * // false + * console.log(mm.every(['foo.js'], ['*.js', '!foo.js'])); + * // false + * ``` + * @param {String|Array} `list` The string or array of strings to test. + * @param {String|Array} `patterns` One or more glob patterns to use for matching. + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Boolean} Returns true if any patterns match `str` + * @api public + */ + +micromatch.every = function(list, patterns, options) { + if (typeof list === 'string') { + list = [list]; + } + for (var i = 0; i < list.length; i++) { + if (micromatch(list[i], patterns, options).length !== 1) { + return false; + } + } + return true; +}; + +/** + * Returns true if **any** of the given glob `patterns` + * match the specified `string`. + * + * ```js + * var mm = require('micromatch'); + * mm.any(string, patterns[, options]); + * + * console.log(mm.any('a.a', ['b.*', '*.a'])); + * //=> true + * console.log(mm.any('a.a', 'b.*')); + * //=> false + * ``` + * @param {String|Array} `str` The string to test. + * @param {String|Array} `patterns` One or more glob patterns to use for matching. + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Boolean} Returns true if any patterns match `str` + * @api public + */ + +micromatch.any = function(str, patterns, options) { + if (typeof str !== 'string') { + throw new TypeError('expected a string: "' + util.inspect(str) + '"'); + } + + if (isEmptyString(str) || isEmptyString(patterns)) { + return false; + } + + if (typeof patterns === 'string') { + patterns = [patterns]; + } + + for (var i = 0; i < patterns.length; i++) { + if (micromatch.isMatch(str, patterns[i], options)) { + return true; + } + } + return false; +}; + +/** + * Returns true if **all** of the given `patterns` match + * the specified string. + * + * ```js + * var mm = require('micromatch'); + * mm.all(string, patterns[, options]); + * + * console.log(mm.all('foo.js', ['foo.js'])); + * // true + * + * console.log(mm.all('foo.js', ['*.js', '!foo.js'])); + * // false + * + * console.log(mm.all('foo.js', ['*.js', 'foo.js'])); + * // true + * + * console.log(mm.all('foo.js', ['*.js', 'f*', '*o*', '*o.js'])); + * // true + * ``` + * @param {String|Array} `str` The string to test. + * @param {String|Array} `patterns` One or more glob patterns to use for matching. + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Boolean} Returns true if any patterns match `str` + * @api public + */ + +micromatch.all = function(str, patterns, options) { + if (typeof str !== 'string') { + throw new TypeError('expected a string: "' + util.inspect(str) + '"'); + } + if (typeof patterns === 'string') { + patterns = [patterns]; + } + for (var i = 0; i < patterns.length; i++) { + if (!micromatch.isMatch(str, patterns[i], options)) { + return false; + } + } + return true; +}; + +/** + * Returns a list of strings that _**do not match any**_ of the given `patterns`. + * + * ```js + * var mm = require('micromatch'); + * mm.not(list, patterns[, options]); + * + * console.log(mm.not(['a.a', 'b.b', 'c.c'], '*.a')); + * //=> ['b.b', 'c.c'] + * ``` + * @param {Array} `list` Array of strings to match. + * @param {String|Array} `patterns` One or more glob pattern to use for matching. + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Array} Returns an array of strings that **do not match** the given patterns. + * @api public + */ + +micromatch.not = function(list, patterns, options) { + var opts = extend({}, options); + var ignore = opts.ignore; + delete opts.ignore; + + var unixify = utils.unixify(opts); + list = utils.arrayify(list).map(unixify); + + var matches = utils.diff(list, micromatch(list, patterns, opts)); + if (ignore) { + matches = utils.diff(matches, micromatch(list, ignore)); + } + + return opts.nodupes !== false ? utils.unique(matches) : matches; +}; + +/** + * Returns true if the given `string` contains the given pattern. Similar + * to [.isMatch](#isMatch) but the pattern can match any part of the string. + * + * ```js + * var mm = require('micromatch'); + * mm.contains(string, pattern[, options]); + * + * console.log(mm.contains('aa/bb/cc', '*b')); + * //=> true + * console.log(mm.contains('aa/bb/cc', '*d')); + * //=> false + * ``` + * @param {String} `str` The string to match. + * @param {String|Array} `patterns` Glob pattern to use for matching. + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Boolean} Returns true if the patter matches any part of `str`. + * @api public + */ + +micromatch.contains = function(str, patterns, options) { + if (typeof str !== 'string') { + throw new TypeError('expected a string: "' + util.inspect(str) + '"'); + } + + if (typeof patterns === 'string') { + if (isEmptyString(str) || isEmptyString(patterns)) { + return false; + } + + var equals = utils.equalsPattern(patterns, options); + if (equals(str)) { + return true; + } + var contains = utils.containsPattern(patterns, options); + if (contains(str)) { + return true; + } + } + + var opts = extend({}, options, {contains: true}); + return micromatch.any(str, patterns, opts); +}; + +/** + * Returns true if the given pattern and options should enable + * the `matchBase` option. + * @return {Boolean} + * @api private + */ + +micromatch.matchBase = function(pattern, options) { + if (pattern && pattern.indexOf('/') !== -1 || !options) return false; + return options.basename === true || options.matchBase === true; +}; + +/** + * Filter the keys of the given object with the given `glob` pattern + * and `options`. Does not attempt to match nested keys. If you need this feature, + * use [glob-object][] instead. + * + * ```js + * var mm = require('micromatch'); + * mm.matchKeys(object, patterns[, options]); + * + * var obj = { aa: 'a', ab: 'b', ac: 'c' }; + * console.log(mm.matchKeys(obj, '*b')); + * //=> { ab: 'b' } + * ``` + * @param {Object} `object` The object with keys to filter. + * @param {String|Array} `patterns` One or more glob patterns to use for matching. + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Object} Returns an object with only keys that match the given patterns. + * @api public + */ + +micromatch.matchKeys = function(obj, patterns, options) { + if (!utils.isObject(obj)) { + throw new TypeError('expected the first argument to be an object'); + } + var keys = micromatch(Object.keys(obj), patterns, options); + return utils.pick(obj, keys); +}; + +/** + * Returns a memoized matcher function from the given glob `pattern` and `options`. + * The returned function takes a string to match as its only argument and returns + * true if the string is a match. + * + * ```js + * var mm = require('micromatch'); + * mm.matcher(pattern[, options]); + * + * var isMatch = mm.matcher('*.!(*a)'); + * console.log(isMatch('a.a')); + * //=> false + * console.log(isMatch('a.b')); + * //=> true + * ``` + * @param {String} `pattern` Glob pattern + * @param {Object} `options` See available [options](#options) for changing how matches are performed. + * @return {Function} Returns a matcher function. + * @api public + */ + +micromatch.matcher = function matcher(pattern, options) { + if (Array.isArray(pattern)) { + return compose(pattern, options, matcher); + } + + // if pattern is a regex + if (pattern instanceof RegExp) { + return test(pattern); + } + + // if pattern is invalid + if (!utils.isString(pattern)) { + throw new TypeError('expected pattern to be an array, string or regex'); + } + + // if pattern is a non-glob string + if (!utils.hasSpecialChars(pattern)) { + if (options && options.nocase === true) { + pattern = pattern.toLowerCase(); + } + return utils.matchPath(pattern, options); + } + + // if pattern is a glob string + var re = micromatch.makeRe(pattern, options); + + // if `options.matchBase` or `options.basename` is defined + if (micromatch.matchBase(pattern, options)) { + return utils.matchBasename(re, options); + } + + function test(regex) { + var equals = utils.equalsPattern(options); + var unixify = utils.unixify(options); + + return function(str) { + if (equals(str)) { + return true; + } + + if (regex.test(unixify(str))) { + return true; + } + return false; + }; + } + + var fn = test(re); + Object.defineProperty(fn, 'result', { + configurable: true, + enumerable: false, + value: re.result + }); + return fn; +}; + +/** + * Returns an array of matches captured by `pattern` in `string, or `null` if the pattern did not match. + * + * ```js + * var mm = require('micromatch'); + * mm.capture(pattern, string[, options]); + * + * console.log(mm.capture('test/*.js', 'test/foo.js')); + * //=> ['foo'] + * console.log(mm.capture('test/*.js', 'foo/bar.css')); + * //=> null + * ``` + * @param {String} `pattern` Glob pattern to use for matching. + * @param {String} `string` String to match + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Boolean} Returns an array of captures if the string matches the glob pattern, otherwise `null`. + * @api public + */ + +micromatch.capture = function(pattern, str, options) { + var re = micromatch.makeRe(pattern, extend({capture: true}, options)); + var unixify = utils.unixify(options); + + function match() { + return function(string) { + var match = re.exec(unixify(string)); + if (!match) { + return null; + } + + return match.slice(1); + }; + } + + var capture = memoize('capture', pattern, options, match); + return capture(str); +}; + +/** + * Create a regular expression from the given glob `pattern`. + * + * ```js + * var mm = require('micromatch'); + * mm.makeRe(pattern[, options]); + * + * console.log(mm.makeRe('*.js')); + * //=> /^(?:(\.[\\\/])?(?!\.)(?=.)[^\/]*?\.js)$/ + * ``` + * @param {String} `pattern` A glob pattern to convert to regex. + * @param {Object} `options` See available [options](#options) for changing how matches are performed. + * @return {RegExp} Returns a regex created from the given pattern. + * @api public + */ + +micromatch.makeRe = function(pattern, options) { + if (typeof pattern !== 'string') { + throw new TypeError('expected pattern to be a string'); + } + + if (pattern.length > MAX_LENGTH) { + throw new Error('expected pattern to be less than ' + MAX_LENGTH + ' characters'); + } + + function makeRe() { + var result = micromatch.create(pattern, options); + var ast_array = []; + var output = result.map(function(obj) { + obj.ast.state = obj.state; + ast_array.push(obj.ast); + return obj.output; + }); + + var regex = toRegex(output.join('|'), options); + Object.defineProperty(regex, 'result', { + configurable: true, + enumerable: false, + value: ast_array + }); + return regex; + } + + return memoize('makeRe', pattern, options, makeRe); +}; + +/** + * Expand the given brace `pattern`. + * + * ```js + * var mm = require('micromatch'); + * console.log(mm.braces('foo/{a,b}/bar')); + * //=> ['foo/(a|b)/bar'] + * + * console.log(mm.braces('foo/{a,b}/bar', {expand: true})); + * //=> ['foo/(a|b)/bar'] + * ``` + * @param {String} `pattern` String with brace pattern to expand. + * @param {Object} `options` Any [options](#options) to change how expansion is performed. See the [braces][] library for all available options. + * @return {Array} + * @api public + */ + +micromatch.braces = function(pattern, options) { + if (typeof pattern !== 'string' && !Array.isArray(pattern)) { + throw new TypeError('expected pattern to be an array or string'); + } + + function expand() { + if (options && options.nobrace === true || !/\{.*\}/.test(pattern)) { + return utils.arrayify(pattern); + } + return braces(pattern, options); + } + + return memoize('braces', pattern, options, expand); +}; + +/** + * Proxy to the [micromatch.braces](#method), for parity with + * minimatch. + */ + +micromatch.braceExpand = function(pattern, options) { + var opts = extend({}, options, {expand: true}); + return micromatch.braces(pattern, opts); +}; + +/** + * Parses the given glob `pattern` and returns an array of abstract syntax + * trees (ASTs), with the compiled `output` and optional source `map` on + * each AST. + * + * ```js + * var mm = require('micromatch'); + * mm.create(pattern[, options]); + * + * console.log(mm.create('abc/*.js')); + * // [{ options: { source: 'string', sourcemap: true }, + * // state: {}, + * // compilers: + * // { ... }, + * // output: '(\\.[\\\\\\/])?abc\\/(?!\\.)(?=.)[^\\/]*?\\.js', + * // ast: + * // { type: 'root', + * // errors: [], + * // nodes: + * // [ ... ], + * // dot: false, + * // input: 'abc/*.js' }, + * // parsingErrors: [], + * // map: + * // { version: 3, + * // sources: [ 'string' ], + * // names: [], + * // mappings: 'AAAA,GAAG,EAAC,kBAAC,EAAC,EAAE', + * // sourcesContent: [ 'abc/*.js' ] }, + * // position: { line: 1, column: 28 }, + * // content: {}, + * // files: {}, + * // idx: 6 }] + * ``` + * @param {String} `pattern` Glob pattern to parse and compile. + * @param {Object} `options` Any [options](#options) to change how parsing and compiling is performed. + * @return {Object} Returns an object with the parsed AST, compiled string and optional source map. + * @api public + */ + +micromatch.create = function(pattern, options) { + return memoize('create', pattern, options, function() { + function create(str, opts) { + return micromatch.compile(micromatch.parse(str, opts), opts); + } + + pattern = micromatch.braces(pattern, options); + var len = pattern.length; + var idx = -1; + var res = []; + + while (++idx < len) { + res.push(create(pattern[idx], options)); + } + return res; + }); +}; + +/** + * Parse the given `str` with the given `options`. + * + * ```js + * var mm = require('micromatch'); + * mm.parse(pattern[, options]); + * + * var ast = mm.parse('a/{b,c}/d'); + * console.log(ast); + * // { type: 'root', + * // errors: [], + * // input: 'a/{b,c}/d', + * // nodes: + * // [ { type: 'bos', val: '' }, + * // { type: 'text', val: 'a/' }, + * // { type: 'brace', + * // nodes: + * // [ { type: 'brace.open', val: '{' }, + * // { type: 'text', val: 'b,c' }, + * // { type: 'brace.close', val: '}' } ] }, + * // { type: 'text', val: '/d' }, + * // { type: 'eos', val: '' } ] } + * ``` + * @param {String} `str` + * @param {Object} `options` + * @return {Object} Returns an AST + * @api public + */ + +micromatch.parse = function(pattern, options) { + if (typeof pattern !== 'string') { + throw new TypeError('expected a string'); + } + + function parse() { + var snapdragon = utils.instantiate(null, options); + parsers(snapdragon, options); + + var ast = snapdragon.parse(pattern, options); + utils.define(ast, 'snapdragon', snapdragon); + ast.input = pattern; + return ast; + } + + return memoize('parse', pattern, options, parse); +}; + +/** + * Compile the given `ast` or string with the given `options`. + * + * ```js + * var mm = require('micromatch'); + * mm.compile(ast[, options]); + * + * var ast = mm.parse('a/{b,c}/d'); + * console.log(mm.compile(ast)); + * // { options: { source: 'string' }, + * // state: {}, + * // compilers: + * // { eos: [Function], + * // noop: [Function], + * // bos: [Function], + * // brace: [Function], + * // 'brace.open': [Function], + * // text: [Function], + * // 'brace.close': [Function] }, + * // output: [ 'a/(b|c)/d' ], + * // ast: + * // { ... }, + * // parsingErrors: [] } + * ``` + * @param {Object|String} `ast` + * @param {Object} `options` + * @return {Object} Returns an object that has an `output` property with the compiled string. + * @api public + */ + +micromatch.compile = function(ast, options) { + if (typeof ast === 'string') { + ast = micromatch.parse(ast, options); + } + + return memoize('compile', ast.input, options, function() { + var snapdragon = utils.instantiate(ast, options); + compilers(snapdragon, options); + return snapdragon.compile(ast, options); + }); +}; + +/** + * Clear the regex cache. + * + * ```js + * mm.clearCache(); + * ``` + * @api public + */ + +micromatch.clearCache = function() { + micromatch.cache.caches = {}; +}; + +/** + * Returns true if the given value is effectively an empty string + */ + +function isEmptyString(val) { + return String(val) === '' || String(val) === './'; +} + +/** + * Compose a matcher function with the given patterns. + * This allows matcher functions to be compiled once and + * called multiple times. + */ + +function compose(patterns, options, matcher) { + var matchers; + + return memoize('compose', String(patterns), options, function() { + return function(file) { + // delay composition until it's invoked the first time, + // after that it won't be called again + if (!matchers) { + matchers = []; + for (var i = 0; i < patterns.length; i++) { + matchers.push(matcher(patterns[i], options)); + } + } + + var len = matchers.length; + while (len--) { + if (matchers[len](file) === true) { + return true; + } + } + return false; + }; + }); +} + +/** + * Memoize a generated regex or function. A unique key is generated + * from the `type` (usually method name), the `pattern`, and + * user-defined options. + */ + +function memoize(type, pattern, options, fn) { + var key = utils.createKey(type + '=' + pattern, options); + + if (options && options.cache === false) { + return fn(pattern, options); + } + + if (cache.has(type, key)) { + return cache.get(type, key); + } + + var val = fn(pattern, options); + cache.set(type, key, val); + return val; +} + +/** + * Expose compiler, parser and cache on `micromatch` + */ + +micromatch.compilers = compilers; +micromatch.parsers = parsers; +micromatch.caches = cache.caches; + +/** + * Expose `micromatch` + * @type {Function} + */ + +module.exports = micromatch; + + +/***/ }), +/* 728 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/** + * Module dependencies + */ + +var toRegex = __webpack_require__(729); +var unique = __webpack_require__(741); +var extend = __webpack_require__(738); + +/** + * Local dependencies + */ + +var compilers = __webpack_require__(742); +var parsers = __webpack_require__(757); +var Braces = __webpack_require__(767); +var utils = __webpack_require__(743); +var MAX_LENGTH = 1024 * 64; +var cache = {}; + +/** + * Convert the given `braces` pattern into a regex-compatible string. By default, only one string is generated for every input string. Set `options.expand` to true to return an array of patterns (similar to Bash or minimatch. Before using `options.expand`, it's recommended that you read the [performance notes](#performance)). + * + * ```js + * var braces = require('braces'); + * console.log(braces('{a,b,c}')); + * //=> ['(a|b|c)'] + * + * console.log(braces('{a,b,c}', {expand: true})); + * //=> ['a', 'b', 'c'] + * ``` + * @param {String} `str` + * @param {Object} `options` + * @return {String} + * @api public + */ + +function braces(pattern, options) { + var key = utils.createKey(String(pattern), options); + var arr = []; + + var disabled = options && options.cache === false; + if (!disabled && cache.hasOwnProperty(key)) { + return cache[key]; + } + + if (Array.isArray(pattern)) { + for (var i = 0; i < pattern.length; i++) { + arr.push.apply(arr, braces.create(pattern[i], options)); + } + } else { + arr = braces.create(pattern, options); + } + + if (options && options.nodupes === true) { + arr = unique(arr); + } + + if (!disabled) { + cache[key] = arr; + } + return arr; +} + +/** + * Expands a brace pattern into an array. This method is called by the main [braces](#braces) function when `options.expand` is true. Before using this method it's recommended that you read the [performance notes](#performance)) and advantages of using [.optimize](#optimize) instead. + * + * ```js + * var braces = require('braces'); + * console.log(braces.expand('a/{b,c}/d')); + * //=> ['a/b/d', 'a/c/d']; + * ``` + * @param {String} `pattern` Brace pattern + * @param {Object} `options` + * @return {Array} Returns an array of expanded values. + * @api public + */ + +braces.expand = function(pattern, options) { + return braces.create(pattern, extend({}, options, {expand: true})); +}; + +/** + * Expands a brace pattern into a regex-compatible, optimized string. This method is called by the main [braces](#braces) function by default. + * + * ```js + * var braces = require('braces'); + * console.log(braces.expand('a/{b,c}/d')); + * //=> ['a/(b|c)/d'] + * ``` + * @param {String} `pattern` Brace pattern + * @param {Object} `options` + * @return {Array} Returns an array of expanded values. + * @api public + */ + +braces.optimize = function(pattern, options) { + return braces.create(pattern, options); +}; + +/** + * Processes a brace pattern and returns either an expanded array (if `options.expand` is true), a highly optimized regex-compatible string. This method is called by the main [braces](#braces) function. + * + * ```js + * var braces = require('braces'); + * console.log(braces.create('user-{200..300}/project-{a,b,c}-{1..10}')) + * //=> 'user-(20[0-9]|2[1-9][0-9]|300)/project-(a|b|c)-([1-9]|10)' + * ``` + * @param {String} `pattern` Brace pattern + * @param {Object} `options` + * @return {Array} Returns an array of expanded values. + * @api public + */ + +braces.create = function(pattern, options) { + if (typeof pattern !== 'string') { + throw new TypeError('expected a string'); + } + + var maxLength = (options && options.maxLength) || MAX_LENGTH; + if (pattern.length >= maxLength) { + throw new Error('expected pattern to be less than ' + maxLength + ' characters'); + } + + function create() { + if (pattern === '' || pattern.length < 3) { + return [pattern]; + } + + if (utils.isEmptySets(pattern)) { + return []; + } + + if (utils.isQuotedString(pattern)) { + return [pattern.slice(1, -1)]; + } + + var proto = new Braces(options); + var result = !options || options.expand !== true + ? proto.optimize(pattern, options) + : proto.expand(pattern, options); + + // get the generated pattern(s) + var arr = result.output; + + // filter out empty strings if specified + if (options && options.noempty === true) { + arr = arr.filter(Boolean); + } + + // filter out duplicates if specified + if (options && options.nodupes === true) { + arr = unique(arr); + } + + Object.defineProperty(arr, 'result', { + enumerable: false, + value: result + }); + + return arr; + } + + return memoize('create', pattern, options, create); +}; + +/** + * Create a regular expression from the given string `pattern`. + * + * ```js + * var braces = require('braces'); + * + * console.log(braces.makeRe('id-{200..300}')); + * //=> /^(?:id-(20[0-9]|2[1-9][0-9]|300))$/ + * ``` + * @param {String} `pattern` The pattern to convert to regex. + * @param {Object} `options` + * @return {RegExp} + * @api public + */ + +braces.makeRe = function(pattern, options) { + if (typeof pattern !== 'string') { + throw new TypeError('expected a string'); + } + + var maxLength = (options && options.maxLength) || MAX_LENGTH; + if (pattern.length >= maxLength) { + throw new Error('expected pattern to be less than ' + maxLength + ' characters'); + } + + function makeRe() { + var arr = braces(pattern, options); + var opts = extend({strictErrors: false}, options); + return toRegex(arr, opts); + } + + return memoize('makeRe', pattern, options, makeRe); +}; + +/** + * Parse the given `str` with the given `options`. + * + * ```js + * var braces = require('braces'); + * var ast = braces.parse('a/{b,c}/d'); + * console.log(ast); + * // { type: 'root', + * // errors: [], + * // input: 'a/{b,c}/d', + * // nodes: + * // [ { type: 'bos', val: '' }, + * // { type: 'text', val: 'a/' }, + * // { type: 'brace', + * // nodes: + * // [ { type: 'brace.open', val: '{' }, + * // { type: 'text', val: 'b,c' }, + * // { type: 'brace.close', val: '}' } ] }, + * // { type: 'text', val: '/d' }, + * // { type: 'eos', val: '' } ] } + * ``` + * @param {String} `pattern` Brace pattern to parse + * @param {Object} `options` + * @return {Object} Returns an AST + * @api public + */ + +braces.parse = function(pattern, options) { + var proto = new Braces(options); + return proto.parse(pattern, options); +}; + +/** + * Compile the given `ast` or string with the given `options`. + * + * ```js + * var braces = require('braces'); + * var ast = braces.parse('a/{b,c}/d'); + * console.log(braces.compile(ast)); + * // { options: { source: 'string' }, + * // state: {}, + * // compilers: + * // { eos: [Function], + * // noop: [Function], + * // bos: [Function], + * // brace: [Function], + * // 'brace.open': [Function], + * // text: [Function], + * // 'brace.close': [Function] }, + * // output: [ 'a/(b|c)/d' ], + * // ast: + * // { ... }, + * // parsingErrors: [] } + * ``` + * @param {Object|String} `ast` AST from [.parse](#parse). If a string is passed it will be parsed first. + * @param {Object} `options` + * @return {Object} Returns an object that has an `output` property with the compiled string. + * @api public + */ + +braces.compile = function(ast, options) { + var proto = new Braces(options); + return proto.compile(ast, options); +}; + +/** + * Clear the regex cache. + * + * ```js + * braces.clearCache(); + * ``` + * @api public + */ + +braces.clearCache = function() { + cache = braces.cache = {}; +}; + +/** + * Memoize a generated regex or function. A unique key is generated + * from the method name, pattern, and user-defined options. Set + * options.memoize to false to disable. + */ + +function memoize(type, pattern, options, fn) { + var key = utils.createKey(type + ':' + pattern, options); + var disabled = options && options.cache === false; + if (disabled) { + braces.clearCache(); + return fn(pattern, options); + } + + if (cache.hasOwnProperty(key)) { + return cache[key]; + } + + var res = fn(pattern, options); + cache[key] = res; + return res; +} + +/** + * Expose `Braces` constructor and methods + * @type {Function} + */ + +braces.Braces = Braces; +braces.compilers = compilers; +braces.parsers = parsers; +braces.cache = cache; + +/** + * Expose `braces` + * @type {Function} + */ + +module.exports = braces; + + +/***/ }), +/* 729 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var define = __webpack_require__(730); +var extend = __webpack_require__(738); +var not = __webpack_require__(740); +var MAX_LENGTH = 1024 * 64; + +/** + * Session cache + */ + +var cache = {}; + +/** + * Create a regular expression from the given `pattern` string. + * + * @param {String|RegExp} `pattern` Pattern can be a string or regular expression. + * @param {Object} `options` + * @return {RegExp} + * @api public + */ + +module.exports = function(patterns, options) { + if (!Array.isArray(patterns)) { + return makeRe(patterns, options); + } + return makeRe(patterns.join('|'), options); +}; + +/** + * Create a regular expression from the given `pattern` string. + * + * @param {String|RegExp} `pattern` Pattern can be a string or regular expression. + * @param {Object} `options` + * @return {RegExp} + * @api public + */ + +function makeRe(pattern, options) { + if (pattern instanceof RegExp) { + return pattern; + } + + if (typeof pattern !== 'string') { + throw new TypeError('expected a string'); + } + + if (pattern.length > MAX_LENGTH) { + throw new Error('expected pattern to be less than ' + MAX_LENGTH + ' characters'); + } + + var key = pattern; + // do this before shallow cloning options, it's a lot faster + if (!options || (options && options.cache !== false)) { + key = createKey(pattern, options); + + if (cache.hasOwnProperty(key)) { + return cache[key]; + } + } + + var opts = extend({}, options); + if (opts.contains === true) { + if (opts.negate === true) { + opts.strictNegate = false; + } else { + opts.strict = false; + } + } + + if (opts.strict === false) { + opts.strictOpen = false; + opts.strictClose = false; + } + + var open = opts.strictOpen !== false ? '^' : ''; + var close = opts.strictClose !== false ? '$' : ''; + var flags = opts.flags || ''; + var regex; + + if (opts.nocase === true && !/i/.test(flags)) { + flags += 'i'; + } + + try { + if (opts.negate || typeof opts.strictNegate === 'boolean') { + pattern = not.create(pattern, opts); + } + var str = open + '(?:' + pattern + ')' + close; + regex = new RegExp(str, flags); + } catch (err) { + if (opts.strictErrors === true) { + err.key = key; + err.pattern = pattern; + err.originalOptions = options; + err.createdOptions = opts; + throw err; + } + + try { + regex = new RegExp('^' + pattern.replace(/(\W)/g, '\\$1') + '$'); + } catch (err) { + regex = /.^/; //<= match nothing + } + } + + if (opts.cache !== false) { + cacheRegex(regex, key, pattern, opts); + } + return regex; +} + +/** + * Cache generated regex. This can result in dramatic speed improvements + * and simplify debugging by adding options and pattern to the regex. It can be + * disabled by passing setting `options.cache` to false. + */ + +function cacheRegex(regex, key, pattern, options) { + define(regex, 'cached', true); + define(regex, 'pattern', pattern); + define(regex, 'options', options); + define(regex, 'key', key); + cache[key] = regex; +} + +/** + * Create the key to use for memoization. The key is generated + * by iterating over the options and concatenating key-value pairs + * to the pattern string. + */ + +function createKey(pattern, options) { + if (!options) return pattern; + var key = pattern; + for (var prop in options) { + if (options.hasOwnProperty(prop)) { + key += ';' + prop + '=' + String(options[prop]); + } + } + return key; +} + +/** + * Expose `makeRe` + */ + +module.exports.makeRe = makeRe; + + +/***/ }), +/* 730 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/*! + * define-property + * + * Copyright (c) 2015, Jon Schlinkert. + * Licensed under the MIT License. + */ + + + +var isDescriptor = __webpack_require__(731); + +module.exports = function defineProperty(obj, prop, val) { + if (typeof obj !== 'object' && typeof obj !== 'function') { + throw new TypeError('expected an object or function.'); + } + + if (typeof prop !== 'string') { + throw new TypeError('expected `prop` to be a string.'); + } + + if (isDescriptor(val) && ('set' in val || 'get' in val)) { + return Object.defineProperty(obj, prop, val); + } + + return Object.defineProperty(obj, prop, { + configurable: true, + enumerable: false, + writable: true, + value: val + }); +}; + + +/***/ }), +/* 731 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/*! + * is-descriptor + * + * Copyright (c) 2015-2017, Jon Schlinkert. + * Released under the MIT License. + */ + + + +var typeOf = __webpack_require__(732); +var isAccessor = __webpack_require__(733); +var isData = __webpack_require__(736); + +module.exports = function isDescriptor(obj, key) { + if (typeOf(obj) !== 'object') { + return false; + } + if ('get' in obj) { + return isAccessor(obj, key); + } + return isData(obj, key); +}; + + +/***/ }), +/* 732 */ +/***/ (function(module, exports) { + +var toString = Object.prototype.toString; + +/** + * Get the native `typeof` a value. + * + * @param {*} `val` + * @return {*} Native javascript type + */ + +module.exports = function kindOf(val) { + var type = typeof val; + + // primitivies + if (type === 'undefined') { + return 'undefined'; + } + if (val === null) { + return 'null'; + } + if (val === true || val === false || val instanceof Boolean) { + return 'boolean'; + } + if (type === 'string' || val instanceof String) { + return 'string'; + } + if (type === 'number' || val instanceof Number) { + return 'number'; + } + + // functions + if (type === 'function' || val instanceof Function) { + if (typeof val.constructor.name !== 'undefined' && val.constructor.name.slice(0, 9) === 'Generator') { + return 'generatorfunction'; + } + return 'function'; + } + + // array + if (typeof Array.isArray !== 'undefined' && Array.isArray(val)) { + return 'array'; + } + + // check for instances of RegExp and Date before calling `toString` + if (val instanceof RegExp) { + return 'regexp'; + } + if (val instanceof Date) { + return 'date'; + } + + // other objects + type = toString.call(val); + + if (type === '[object RegExp]') { + return 'regexp'; + } + if (type === '[object Date]') { + return 'date'; + } + if (type === '[object Arguments]') { + return 'arguments'; + } + if (type === '[object Error]') { + return 'error'; + } + if (type === '[object Promise]') { + return 'promise'; + } + + // buffer + if (isBuffer(val)) { + return 'buffer'; + } + + // es6: Map, WeakMap, Set, WeakSet + if (type === '[object Set]') { + return 'set'; + } + if (type === '[object WeakSet]') { + return 'weakset'; + } + if (type === '[object Map]') { + return 'map'; + } + if (type === '[object WeakMap]') { + return 'weakmap'; + } + if (type === '[object Symbol]') { + return 'symbol'; + } + + if (type === '[object Map Iterator]') { + return 'mapiterator'; + } + if (type === '[object Set Iterator]') { + return 'setiterator'; + } + if (type === '[object String Iterator]') { + return 'stringiterator'; + } + if (type === '[object Array Iterator]') { + return 'arrayiterator'; + } + + // typed arrays + if (type === '[object Int8Array]') { + return 'int8array'; + } + if (type === '[object Uint8Array]') { + return 'uint8array'; + } + if (type === '[object Uint8ClampedArray]') { + return 'uint8clampedarray'; + } + if (type === '[object Int16Array]') { + return 'int16array'; + } + if (type === '[object Uint16Array]') { + return 'uint16array'; + } + if (type === '[object Int32Array]') { + return 'int32array'; + } + if (type === '[object Uint32Array]') { + return 'uint32array'; + } + if (type === '[object Float32Array]') { + return 'float32array'; + } + if (type === '[object Float64Array]') { + return 'float64array'; + } + + // must be a plain object + return 'object'; +}; + +/** + * If you need to support Safari 5-7 (8-10 yr-old browser), + * take a look at https://github.com/feross/is-buffer + */ + +function isBuffer(val) { + return val.constructor + && typeof val.constructor.isBuffer === 'function' + && val.constructor.isBuffer(val); +} + + +/***/ }), +/* 733 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/*! + * is-accessor-descriptor + * + * Copyright (c) 2015, Jon Schlinkert. + * Licensed under the MIT License. + */ + + + +var typeOf = __webpack_require__(734); + +// accessor descriptor properties +var accessor = { + get: 'function', + set: 'function', + configurable: 'boolean', + enumerable: 'boolean' +}; + +function isAccessorDescriptor(obj, prop) { + if (typeof prop === 'string') { + var val = Object.getOwnPropertyDescriptor(obj, prop); + return typeof val !== 'undefined'; + } + + if (typeOf(obj) !== 'object') { + return false; + } + + if (has(obj, 'value') || has(obj, 'writable')) { + return false; + } + + if (!has(obj, 'get') || typeof obj.get !== 'function') { + return false; + } + + // tldr: it's valid to have "set" be undefined + // "set" might be undefined if `Object.getOwnPropertyDescriptor` + // was used to get the value, and only `get` was defined by the user + if (has(obj, 'set') && typeof obj[key] !== 'function' && typeof obj[key] !== 'undefined') { + return false; + } + + for (var key in obj) { + if (!accessor.hasOwnProperty(key)) { + continue; + } + + if (typeOf(obj[key]) === accessor[key]) { + continue; + } + + if (typeof obj[key] !== 'undefined') { + return false; + } + } + return true; +} + +function has(obj, key) { + return {}.hasOwnProperty.call(obj, key); +} + +/** + * Expose `isAccessorDescriptor` + */ + +module.exports = isAccessorDescriptor; + + +/***/ }), +/* 734 */ +/***/ (function(module, exports, __webpack_require__) { + +var isBuffer = __webpack_require__(735); +var toString = Object.prototype.toString; + +/** + * Get the native `typeof` a value. + * + * @param {*} `val` + * @return {*} Native javascript type + */ + +module.exports = function kindOf(val) { + // primitivies + if (typeof val === 'undefined') { + return 'undefined'; + } + if (val === null) { + return 'null'; + } + if (val === true || val === false || val instanceof Boolean) { + return 'boolean'; + } + if (typeof val === 'string' || val instanceof String) { + return 'string'; + } + if (typeof val === 'number' || val instanceof Number) { + return 'number'; + } + + // functions + if (typeof val === 'function' || val instanceof Function) { + return 'function'; + } + + // array + if (typeof Array.isArray !== 'undefined' && Array.isArray(val)) { + return 'array'; + } + + // check for instances of RegExp and Date before calling `toString` + if (val instanceof RegExp) { + return 'regexp'; + } + if (val instanceof Date) { + return 'date'; + } + + // other objects + var type = toString.call(val); + + if (type === '[object RegExp]') { + return 'regexp'; + } + if (type === '[object Date]') { + return 'date'; + } + if (type === '[object Arguments]') { + return 'arguments'; + } + if (type === '[object Error]') { + return 'error'; + } + + // buffer + if (isBuffer(val)) { + return 'buffer'; + } + + // es6: Map, WeakMap, Set, WeakSet + if (type === '[object Set]') { + return 'set'; + } + if (type === '[object WeakSet]') { + return 'weakset'; + } + if (type === '[object Map]') { + return 'map'; + } + if (type === '[object WeakMap]') { + return 'weakmap'; + } + if (type === '[object Symbol]') { + return 'symbol'; + } + + // typed arrays + if (type === '[object Int8Array]') { + return 'int8array'; + } + if (type === '[object Uint8Array]') { + return 'uint8array'; + } + if (type === '[object Uint8ClampedArray]') { + return 'uint8clampedarray'; + } + if (type === '[object Int16Array]') { + return 'int16array'; + } + if (type === '[object Uint16Array]') { + return 'uint16array'; + } + if (type === '[object Int32Array]') { + return 'int32array'; + } + if (type === '[object Uint32Array]') { + return 'uint32array'; + } + if (type === '[object Float32Array]') { + return 'float32array'; + } + if (type === '[object Float64Array]') { + return 'float64array'; + } + + // must be a plain object + return 'object'; +}; + + +/***/ }), +/* 735 */ +/***/ (function(module, exports) { + +/*! + * Determine if an object is a Buffer + * + * @author Feross Aboukhadijeh + * @license MIT + */ + +// The _isBuffer check is for Safari 5-7 support, because it's missing +// Object.prototype.constructor. Remove this eventually +module.exports = function (obj) { + return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer) +} + +function isBuffer (obj) { + return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj) +} + +// For Node v0.10 support. Remove this eventually. +function isSlowBuffer (obj) { + return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0)) +} + + +/***/ }), +/* 736 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/*! + * is-data-descriptor + * + * Copyright (c) 2015, Jon Schlinkert. + * Licensed under the MIT License. + */ + + + +var typeOf = __webpack_require__(737); + +// data descriptor properties +var data = { + configurable: 'boolean', + enumerable: 'boolean', + writable: 'boolean' +}; + +function isDataDescriptor(obj, prop) { + if (typeOf(obj) !== 'object') { + return false; + } + + if (typeof prop === 'string') { + var val = Object.getOwnPropertyDescriptor(obj, prop); + return typeof val !== 'undefined'; + } + + if (!('value' in obj) && !('writable' in obj)) { + return false; + } + + for (var key in obj) { + if (key === 'value') continue; + + if (!data.hasOwnProperty(key)) { + continue; + } + + if (typeOf(obj[key]) === data[key]) { + continue; + } + + if (typeof obj[key] !== 'undefined') { + return false; + } + } + return true; +} + +/** + * Expose `isDataDescriptor` + */ + +module.exports = isDataDescriptor; + + +/***/ }), +/* 737 */ +/***/ (function(module, exports, __webpack_require__) { + +var isBuffer = __webpack_require__(735); +var toString = Object.prototype.toString; + +/** + * Get the native `typeof` a value. + * + * @param {*} `val` + * @return {*} Native javascript type + */ + +module.exports = function kindOf(val) { + // primitivies + if (typeof val === 'undefined') { + return 'undefined'; + } + if (val === null) { + return 'null'; + } + if (val === true || val === false || val instanceof Boolean) { + return 'boolean'; + } + if (typeof val === 'string' || val instanceof String) { + return 'string'; + } + if (typeof val === 'number' || val instanceof Number) { + return 'number'; + } + + // functions + if (typeof val === 'function' || val instanceof Function) { + return 'function'; + } + + // array + if (typeof Array.isArray !== 'undefined' && Array.isArray(val)) { + return 'array'; + } + + // check for instances of RegExp and Date before calling `toString` + if (val instanceof RegExp) { + return 'regexp'; + } + if (val instanceof Date) { + return 'date'; + } + + // other objects + var type = toString.call(val); + + if (type === '[object RegExp]') { + return 'regexp'; + } + if (type === '[object Date]') { + return 'date'; + } + if (type === '[object Arguments]') { + return 'arguments'; + } + if (type === '[object Error]') { + return 'error'; + } + + // buffer + if (isBuffer(val)) { + return 'buffer'; + } + + // es6: Map, WeakMap, Set, WeakSet + if (type === '[object Set]') { + return 'set'; + } + if (type === '[object WeakSet]') { + return 'weakset'; + } + if (type === '[object Map]') { + return 'map'; + } + if (type === '[object WeakMap]') { + return 'weakmap'; + } + if (type === '[object Symbol]') { + return 'symbol'; + } + + // typed arrays + if (type === '[object Int8Array]') { + return 'int8array'; + } + if (type === '[object Uint8Array]') { + return 'uint8array'; + } + if (type === '[object Uint8ClampedArray]') { + return 'uint8clampedarray'; + } + if (type === '[object Int16Array]') { + return 'int16array'; + } + if (type === '[object Uint16Array]') { + return 'uint16array'; + } + if (type === '[object Int32Array]') { + return 'int32array'; + } + if (type === '[object Uint32Array]') { + return 'uint32array'; + } + if (type === '[object Float32Array]') { + return 'float32array'; + } + if (type === '[object Float64Array]') { + return 'float64array'; + } + + // must be a plain object + return 'object'; +}; + + +/***/ }), +/* 738 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var isObject = __webpack_require__(739); + +module.exports = function extend(o/*, objects*/) { + if (!isObject(o)) { o = {}; } + + var len = arguments.length; + for (var i = 1; i < len; i++) { + var obj = arguments[i]; + + if (isObject(obj)) { + assign(o, obj); + } + } + return o; +}; + +function assign(a, b) { + for (var key in b) { + if (hasOwn(b, key)) { + a[key] = b[key]; + } + } +} + +/** + * Returns true if the given `key` is an own property of `obj`. + */ + +function hasOwn(obj, key) { + return Object.prototype.hasOwnProperty.call(obj, key); +} + + +/***/ }), +/* 739 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/*! + * is-extendable + * + * Copyright (c) 2015, Jon Schlinkert. + * Licensed under the MIT License. + */ + + + +module.exports = function isExtendable(val) { + return typeof val !== 'undefined' && val !== null + && (typeof val === 'object' || typeof val === 'function'); +}; + + +/***/ }), +/* 740 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var extend = __webpack_require__(738); + +/** + * The main export is a function that takes a `pattern` string and an `options` object. + * + * ```js + & var not = require('regex-not'); + & console.log(not('foo')); + & //=> /^(?:(?!^(?:foo)$).)*$/ + * ``` + * + * @param {String} `pattern` + * @param {Object} `options` + * @return {RegExp} Converts the given `pattern` to a regex using the specified `options`. + * @api public + */ + +function toRegex(pattern, options) { + return new RegExp(toRegex.create(pattern, options)); +} + +/** + * Create a regex-compatible string from the given `pattern` and `options`. + * + * ```js + & var not = require('regex-not'); + & console.log(not.create('foo')); + & //=> '^(?:(?!^(?:foo)$).)*$' + * ``` + * @param {String} `pattern` + * @param {Object} `options` + * @return {String} + * @api public + */ + +toRegex.create = function(pattern, options) { + if (typeof pattern !== 'string') { + throw new TypeError('expected a string'); + } + + var opts = extend({}, options); + if (opts && opts.contains === true) { + opts.strictNegate = false; + } + + var open = opts.strictOpen !== false ? '^' : ''; + var close = opts.strictClose !== false ? '$' : ''; + var endChar = opts.endChar ? opts.endChar : '+'; + var str = pattern; + + if (opts && opts.strictNegate === false) { + str = '(?:(?!(?:' + pattern + ')).)' + endChar; + } else { + str = '(?:(?!^(?:' + pattern + ')$).)' + endChar; + } + + return open + str + close; +}; + +/** + * Expose `toRegex` + */ + +module.exports = toRegex; + + +/***/ }), +/* 741 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/*! + * array-unique + * + * Copyright (c) 2014-2015, Jon Schlinkert. + * Licensed under the MIT License. + */ + + + +module.exports = function unique(arr) { + if (!Array.isArray(arr)) { + throw new TypeError('array-unique expects an array.'); + } + + var len = arr.length; + var i = -1; + + while (i++ < len) { + var j = i + 1; + + for (; j < arr.length; ++j) { + if (arr[i] === arr[j]) { + arr.splice(j--, 1); + } + } + } + return arr; +}; + +module.exports.immutable = function uniqueImmutable(arr) { + if (!Array.isArray(arr)) { + throw new TypeError('array-unique expects an array.'); + } + + var arrLen = arr.length; + var newArr = new Array(arrLen); + + for (var i = 0; i < arrLen; i++) { + newArr[i] = arr[i]; + } + + return module.exports(newArr); +}; + + +/***/ }), +/* 742 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var utils = __webpack_require__(743); + +module.exports = function(braces, options) { + braces.compiler + + /** + * bos + */ + + .set('bos', function() { + if (this.output) return; + this.ast.queue = isEscaped(this.ast) ? [this.ast.val] : []; + this.ast.count = 1; + }) + + /** + * Square brackets + */ + + .set('bracket', function(node) { + var close = node.close; + var open = !node.escaped ? '[' : '\\['; + var negated = node.negated; + var inner = node.inner; + + inner = inner.replace(/\\(?=[\\\w]|$)/g, '\\\\'); + if (inner === ']-') { + inner = '\\]\\-'; + } + + if (negated && inner.indexOf('.') === -1) { + inner += '.'; + } + if (negated && inner.indexOf('/') === -1) { + inner += '/'; + } + + var val = open + negated + inner + close; + var queue = node.parent.queue; + var last = utils.arrayify(queue.pop()); + + queue.push(utils.join(last, val)); + queue.push.apply(queue, []); + }) + + /** + * Brace + */ + + .set('brace', function(node) { + node.queue = isEscaped(node) ? [node.val] : []; + node.count = 1; + return this.mapVisit(node.nodes); + }) + + /** + * Open + */ + + .set('brace.open', function(node) { + node.parent.open = node.val; + }) + + /** + * Inner + */ + + .set('text', function(node) { + var queue = node.parent.queue; + var escaped = node.escaped; + var segs = [node.val]; + + if (node.optimize === false) { + options = utils.extend({}, options, {optimize: false}); + } + + if (node.multiplier > 1) { + node.parent.count *= node.multiplier; + } + + if (options.quantifiers === true && utils.isQuantifier(node.val)) { + escaped = true; + + } else if (node.val.length > 1) { + if (isType(node.parent, 'brace') && !isEscaped(node)) { + var expanded = utils.expand(node.val, options); + segs = expanded.segs; + + if (expanded.isOptimized) { + node.parent.isOptimized = true; + } + + // if nothing was expanded, we probably have a literal brace + if (!segs.length) { + var val = (expanded.val || node.val); + if (options.unescape !== false) { + // unescape unexpanded brace sequence/set separators + val = val.replace(/\\([,.])/g, '$1'); + // strip quotes + val = val.replace(/["'`]/g, ''); + } + + segs = [val]; + escaped = true; + } + } + + } else if (node.val === ',') { + if (options.expand) { + node.parent.queue.push(['']); + segs = ['']; + } else { + segs = ['|']; + } + } else { + escaped = true; + } + + if (escaped && isType(node.parent, 'brace')) { + if (node.parent.nodes.length <= 4 && node.parent.count === 1) { + node.parent.escaped = true; + } else if (node.parent.length <= 3) { + node.parent.escaped = true; + } + } + + if (!hasQueue(node.parent)) { + node.parent.queue = segs; + return; + } + + var last = utils.arrayify(queue.pop()); + if (node.parent.count > 1 && options.expand) { + last = multiply(last, node.parent.count); + node.parent.count = 1; + } + + queue.push(utils.join(utils.flatten(last), segs.shift())); + queue.push.apply(queue, segs); + }) + + /** + * Close + */ + + .set('brace.close', function(node) { + var queue = node.parent.queue; + var prev = node.parent.parent; + var last = prev.queue.pop(); + var open = node.parent.open; + var close = node.val; + + if (open && close && isOptimized(node, options)) { + open = '('; + close = ')'; + } + + // if a close brace exists, and the previous segment is one character + // don't wrap the result in braces or parens + var ele = utils.last(queue); + if (node.parent.count > 1 && options.expand) { + ele = multiply(queue.pop(), node.parent.count); + node.parent.count = 1; + queue.push(ele); + } + + if (close && typeof ele === 'string' && ele.length === 1) { + open = ''; + close = ''; + } + + if ((isLiteralBrace(node, options) || noInner(node)) && !node.parent.hasEmpty) { + queue.push(utils.join(open, queue.pop() || '')); + queue = utils.flatten(utils.join(queue, close)); + } + + if (typeof last === 'undefined') { + prev.queue = [queue]; + } else { + prev.queue.push(utils.flatten(utils.join(last, queue))); + } + }) + + /** + * eos + */ + + .set('eos', function(node) { + if (this.input) return; + + if (options.optimize !== false) { + this.output = utils.last(utils.flatten(this.ast.queue)); + } else if (Array.isArray(utils.last(this.ast.queue))) { + this.output = utils.flatten(this.ast.queue.pop()); + } else { + this.output = utils.flatten(this.ast.queue); + } + + if (node.parent.count > 1 && options.expand) { + this.output = multiply(this.output, node.parent.count); + } + + this.output = utils.arrayify(this.output); + this.ast.queue = []; + }); + +}; + +/** + * Multiply the segments in the current brace level + */ + +function multiply(queue, n, options) { + return utils.flatten(utils.repeat(utils.arrayify(queue), n)); +} + +/** + * Return true if `node` is escaped + */ + +function isEscaped(node) { + return node.escaped === true; +} + +/** + * Returns true if regex parens should be used for sets. If the parent `type` + * is not `brace`, then we're on a root node, which means we should never + * expand segments and open/close braces should be `{}` (since this indicates + * a brace is missing from the set) + */ + +function isOptimized(node, options) { + if (node.parent.isOptimized) return true; + return isType(node.parent, 'brace') + && !isEscaped(node.parent) + && options.expand !== true; +} + +/** + * Returns true if the value in `node` should be wrapped in a literal brace. + * @return {Boolean} + */ + +function isLiteralBrace(node, options) { + return isEscaped(node.parent) || options.optimize !== false; +} + +/** + * Returns true if the given `node` does not have an inner value. + * @return {Boolean} + */ + +function noInner(node, type) { + if (node.parent.queue.length === 1) { + return true; + } + var nodes = node.parent.nodes; + return nodes.length === 3 + && isType(nodes[0], 'brace.open') + && !isType(nodes[1], 'text') + && isType(nodes[2], 'brace.close'); +} + +/** + * Returns true if the given `node` is the given `type` + * @return {Boolean} + */ + +function isType(node, type) { + return typeof node !== 'undefined' && node.type === type; +} + +/** + * Returns true if the given `node` has a non-empty queue. + * @return {Boolean} + */ + +function hasQueue(node) { + return Array.isArray(node.queue) && node.queue.length; +} + + +/***/ }), +/* 743 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var splitString = __webpack_require__(744); +var utils = module.exports; + +/** + * Module dependencies + */ + +utils.extend = __webpack_require__(738); +utils.flatten = __webpack_require__(750); +utils.isObject = __webpack_require__(748); +utils.fillRange = __webpack_require__(751); +utils.repeat = __webpack_require__(756); +utils.unique = __webpack_require__(741); + +utils.define = function(obj, key, val) { + Object.defineProperty(obj, key, { + writable: true, + configurable: true, + enumerable: false, + value: val + }); +}; + +/** + * Returns true if the given string contains only empty brace sets. + */ + +utils.isEmptySets = function(str) { + return /^(?:\{,\})+$/.test(str); +}; + +/** + * Returns true if the given string contains only empty brace sets. + */ + +utils.isQuotedString = function(str) { + var open = str.charAt(0); + if (open === '\'' || open === '"' || open === '`') { + return str.slice(-1) === open; + } + return false; +}; + +/** + * Create the key to use for memoization. The unique key is generated + * by iterating over the options and concatenating key-value pairs + * to the pattern string. + */ + +utils.createKey = function(pattern, options) { + var id = pattern; + if (typeof options === 'undefined') { + return id; + } + var keys = Object.keys(options); + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + id += ';' + key + '=' + String(options[key]); + } + return id; +}; + +/** + * Normalize options + */ + +utils.createOptions = function(options) { + var opts = utils.extend.apply(null, arguments); + if (typeof opts.expand === 'boolean') { + opts.optimize = !opts.expand; + } + if (typeof opts.optimize === 'boolean') { + opts.expand = !opts.optimize; + } + if (opts.optimize === true) { + opts.makeRe = true; + } + return opts; +}; + +/** + * Join patterns in `a` to patterns in `b` + */ + +utils.join = function(a, b, options) { + options = options || {}; + a = utils.arrayify(a); + b = utils.arrayify(b); + + if (!a.length) return b; + if (!b.length) return a; + + var len = a.length; + var idx = -1; + var arr = []; + + while (++idx < len) { + var val = a[idx]; + if (Array.isArray(val)) { + for (var i = 0; i < val.length; i++) { + val[i] = utils.join(val[i], b, options); + } + arr.push(val); + continue; + } + + for (var j = 0; j < b.length; j++) { + var bval = b[j]; + + if (Array.isArray(bval)) { + arr.push(utils.join(val, bval, options)); + } else { + arr.push(val + bval); + } + } + } + return arr; +}; + +/** + * Split the given string on `,` if not escaped. + */ + +utils.split = function(str, options) { + var opts = utils.extend({sep: ','}, options); + if (typeof opts.keepQuotes !== 'boolean') { + opts.keepQuotes = true; + } + if (opts.unescape === false) { + opts.keepEscaping = true; + } + return splitString(str, opts, utils.escapeBrackets(opts)); +}; + +/** + * Expand ranges or sets in the given `pattern`. + * + * @param {String} `str` + * @param {Object} `options` + * @return {Object} + */ + +utils.expand = function(str, options) { + var opts = utils.extend({rangeLimit: 10000}, options); + var segs = utils.split(str, opts); + var tok = { segs: segs }; + + if (utils.isQuotedString(str)) { + return tok; + } + + if (opts.rangeLimit === true) { + opts.rangeLimit = 10000; + } + + if (segs.length > 1) { + if (opts.optimize === false) { + tok.val = segs[0]; + return tok; + } + + tok.segs = utils.stringifyArray(tok.segs); + } else if (segs.length === 1) { + var arr = str.split('..'); + + if (arr.length === 1) { + tok.val = tok.segs[tok.segs.length - 1] || tok.val || str; + tok.segs = []; + return tok; + } + + if (arr.length === 2 && arr[0] === arr[1]) { + tok.escaped = true; + tok.val = arr[0]; + tok.segs = []; + return tok; + } + + if (arr.length > 1) { + if (opts.optimize !== false) { + opts.optimize = true; + delete opts.expand; + } + + if (opts.optimize !== true) { + var min = Math.min(arr[0], arr[1]); + var max = Math.max(arr[0], arr[1]); + var step = arr[2] || 1; + + if (opts.rangeLimit !== false && ((max - min) / step >= opts.rangeLimit)) { + throw new RangeError('expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.'); + } + } + + arr.push(opts); + tok.segs = utils.fillRange.apply(null, arr); + + if (!tok.segs.length) { + tok.escaped = true; + tok.val = str; + return tok; + } + + if (opts.optimize === true) { + tok.segs = utils.stringifyArray(tok.segs); + } + + if (tok.segs === '') { + tok.val = str; + } else { + tok.val = tok.segs[0]; + } + return tok; + } + } else { + tok.val = str; + } + return tok; +}; + +/** + * Ensure commas inside brackets and parens are not split. + * @param {Object} `tok` Token from the `split-string` module + * @return {undefined} + */ + +utils.escapeBrackets = function(options) { + return function(tok) { + if (tok.escaped && tok.val === 'b') { + tok.val = '\\b'; + return; + } + + if (tok.val !== '(' && tok.val !== '[') return; + var opts = utils.extend({}, options); + var brackets = []; + var parens = []; + var stack = []; + var val = tok.val; + var str = tok.str; + var i = tok.idx - 1; + + while (++i < str.length) { + var ch = str[i]; + + if (ch === '\\') { + val += (opts.keepEscaping === false ? '' : ch) + str[++i]; + continue; + } + + if (ch === '(') { + parens.push(ch); + stack.push(ch); + } + + if (ch === '[') { + brackets.push(ch); + stack.push(ch); + } + + if (ch === ')') { + parens.pop(); + stack.pop(); + if (!stack.length) { + val += ch; + break; + } + } + + if (ch === ']') { + brackets.pop(); + stack.pop(); + if (!stack.length) { + val += ch; + break; + } + } + val += ch; + } + + tok.split = false; + tok.val = val.slice(1); + tok.idx = i; + }; +}; + +/** + * Returns true if the given string looks like a regex quantifier + * @return {Boolean} + */ + +utils.isQuantifier = function(str) { + return /^(?:[0-9]?,[0-9]|[0-9],)$/.test(str); +}; + +/** + * Cast `val` to an array. + * @param {*} `val` + */ + +utils.stringifyArray = function(arr) { + return [utils.arrayify(arr).join('|')]; +}; + +/** + * Cast `val` to an array. + * @param {*} `val` + */ + +utils.arrayify = function(arr) { + if (typeof arr === 'undefined') { + return []; + } + if (typeof arr === 'string') { + return [arr]; + } + return arr; +}; + +/** + * Returns true if the given `str` is a non-empty string + * @return {Boolean} + */ + +utils.isString = function(str) { + return str != null && typeof str === 'string'; +}; + +/** + * Get the last element from `array` + * @param {Array} `array` + * @return {*} + */ + +utils.last = function(arr, n) { + return arr[arr.length - (n || 1)]; +}; + +utils.escapeRegex = function(str) { + return str.replace(/\\?([!^*?()[\]{}+?/])/g, '\\$1'); +}; + + +/***/ }), +/* 744 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/*! + * split-string + * + * Copyright (c) 2015-2017, Jon Schlinkert. + * Released under the MIT License. + */ + + + +var extend = __webpack_require__(745); + +module.exports = function(str, options, fn) { + if (typeof str !== 'string') { + throw new TypeError('expected a string'); + } + + if (typeof options === 'function') { + fn = options; + options = null; + } + + // allow separator to be defined as a string + if (typeof options === 'string') { + options = { sep: options }; + } + + var opts = extend({sep: '.'}, options); + var quotes = opts.quotes || ['"', "'", '`']; + var brackets; + + if (opts.brackets === true) { + brackets = { + '<': '>', + '(': ')', + '[': ']', + '{': '}' + }; + } else if (opts.brackets) { + brackets = opts.brackets; + } + + var tokens = []; + var stack = []; + var arr = ['']; + var sep = opts.sep; + var len = str.length; + var idx = -1; + var closeIdx; + + function expected() { + if (brackets && stack.length) { + return brackets[stack[stack.length - 1]]; + } + } + + while (++idx < len) { + var ch = str[idx]; + var next = str[idx + 1]; + var tok = { val: ch, idx: idx, arr: arr, str: str }; + tokens.push(tok); + + if (ch === '\\') { + tok.val = keepEscaping(opts, str, idx) === true ? (ch + next) : next; + tok.escaped = true; + if (typeof fn === 'function') { + fn(tok); + } + arr[arr.length - 1] += tok.val; + idx++; + continue; + } + + if (brackets && brackets[ch]) { + stack.push(ch); + var e = expected(); + var i = idx + 1; + + if (str.indexOf(e, i + 1) !== -1) { + while (stack.length && i < len) { + var s = str[++i]; + if (s === '\\') { + s++; + continue; + } + + if (quotes.indexOf(s) !== -1) { + i = getClosingQuote(str, s, i + 1); + continue; + } + + e = expected(); + if (stack.length && str.indexOf(e, i + 1) === -1) { + break; + } + + if (brackets[s]) { + stack.push(s); + continue; + } + + if (e === s) { + stack.pop(); + } + } + } + + closeIdx = i; + if (closeIdx === -1) { + arr[arr.length - 1] += ch; + continue; + } + + ch = str.slice(idx, closeIdx + 1); + tok.val = ch; + tok.idx = idx = closeIdx; + } + + if (quotes.indexOf(ch) !== -1) { + closeIdx = getClosingQuote(str, ch, idx + 1); + if (closeIdx === -1) { + arr[arr.length - 1] += ch; + continue; + } + + if (keepQuotes(ch, opts) === true) { + ch = str.slice(idx, closeIdx + 1); + } else { + ch = str.slice(idx + 1, closeIdx); + } + + tok.val = ch; + tok.idx = idx = closeIdx; + } + + if (typeof fn === 'function') { + fn(tok, tokens); + ch = tok.val; + idx = tok.idx; + } + + if (tok.val === sep && tok.split !== false) { + arr.push(''); + continue; + } + + arr[arr.length - 1] += tok.val; + } + + return arr; +}; + +function getClosingQuote(str, ch, i, brackets) { + var idx = str.indexOf(ch, i); + if (str.charAt(idx - 1) === '\\') { + return getClosingQuote(str, ch, idx + 1); + } + return idx; +} + +function keepQuotes(ch, opts) { + if (opts.keepDoubleQuotes === true && ch === '"') return true; + if (opts.keepSingleQuotes === true && ch === "'") return true; + return opts.keepQuotes; +} + +function keepEscaping(opts, str, idx) { + if (typeof opts.keepEscaping === 'function') { + return opts.keepEscaping(str, idx); + } + return opts.keepEscaping === true || str[idx + 1] === '\\'; +} + + +/***/ }), +/* 745 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var isExtendable = __webpack_require__(746); +var assignSymbols = __webpack_require__(749); + +module.exports = Object.assign || function(obj/*, objects*/) { + if (obj === null || typeof obj === 'undefined') { + throw new TypeError('Cannot convert undefined or null to object'); + } + if (!isObject(obj)) { + obj = {}; + } + for (var i = 1; i < arguments.length; i++) { + var val = arguments[i]; + if (isString(val)) { + val = toObject(val); + } + if (isObject(val)) { + assign(obj, val); + assignSymbols(obj, val); + } + } + return obj; +}; + +function assign(a, b) { + for (var key in b) { + if (hasOwn(b, key)) { + a[key] = b[key]; + } + } +} + +function isString(val) { + return (val && typeof val === 'string'); +} + +function toObject(str) { + var obj = {}; + for (var i in str) { + obj[i] = str[i]; + } + return obj; +} + +function isObject(val) { + return (val && typeof val === 'object') || isExtendable(val); +} + +/** + * Returns true if the given `key` is an own property of `obj`. + */ + +function hasOwn(obj, key) { + return Object.prototype.hasOwnProperty.call(obj, key); +} + +function isEnum(obj, key) { + return Object.prototype.propertyIsEnumerable.call(obj, key); +} + + +/***/ }), +/* 746 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/*! + * is-extendable + * + * Copyright (c) 2015-2017, Jon Schlinkert. + * Released under the MIT License. + */ + + + +var isPlainObject = __webpack_require__(747); + +module.exports = function isExtendable(val) { + return isPlainObject(val) || typeof val === 'function' || Array.isArray(val); +}; + + +/***/ }), +/* 747 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/*! + * is-plain-object + * + * Copyright (c) 2014-2017, Jon Schlinkert. + * Released under the MIT License. + */ + + + +var isObject = __webpack_require__(748); + +function isObjectObject(o) { + return isObject(o) === true + && Object.prototype.toString.call(o) === '[object Object]'; +} + +module.exports = function isPlainObject(o) { + var ctor,prot; + + if (isObjectObject(o) === false) return false; + + // If has modified constructor + ctor = o.constructor; + if (typeof ctor !== 'function') return false; + + // If has modified prototype + prot = ctor.prototype; + if (isObjectObject(prot) === false) return false; + + // If constructor does not have an Object-specific method + if (prot.hasOwnProperty('isPrototypeOf') === false) { + return false; + } + + // Most likely a plain Object + return true; +}; + + +/***/ }), +/* 748 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/*! + * isobject + * + * Copyright (c) 2014-2017, Jon Schlinkert. + * Released under the MIT License. + */ + + + +module.exports = function isObject(val) { + return val != null && typeof val === 'object' && Array.isArray(val) === false; +}; + + +/***/ }), +/* 749 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/*! + * assign-symbols + * + * Copyright (c) 2015, Jon Schlinkert. + * Licensed under the MIT License. + */ + + + +module.exports = function(receiver, objects) { + if (receiver === null || typeof receiver === 'undefined') { + throw new TypeError('expected first argument to be an object.'); + } + + if (typeof objects === 'undefined' || typeof Symbol === 'undefined') { + return receiver; + } + + if (typeof Object.getOwnPropertySymbols !== 'function') { + return receiver; + } + + var isEnumerable = Object.prototype.propertyIsEnumerable; + var target = Object(receiver); + var len = arguments.length, i = 0; + + while (++i < len) { + var provider = Object(arguments[i]); + var names = Object.getOwnPropertySymbols(provider); + + for (var j = 0; j < names.length; j++) { + var key = names[j]; + + if (isEnumerable.call(provider, key)) { + target[key] = provider[key]; + } + } + } + return target; +}; + + +/***/ }), +/* 750 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/*! + * arr-flatten + * + * Copyright (c) 2014-2017, Jon Schlinkert. + * Released under the MIT License. + */ + + + +module.exports = function (arr) { + return flat(arr, []); +}; + +function flat(arr, res) { + var i = 0, cur; + var len = arr.length; + for (; i < len; i++) { + cur = arr[i]; + Array.isArray(cur) ? flat(cur, res) : res.push(cur); + } + return res; +} + + +/***/ }), +/* 751 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/*! + * fill-range + * + * Copyright (c) 2014-2015, 2017, Jon Schlinkert. + * Released under the MIT License. + */ + + + +var util = __webpack_require__(29); +var isNumber = __webpack_require__(752); +var extend = __webpack_require__(738); +var repeat = __webpack_require__(754); +var toRegex = __webpack_require__(755); + +/** + * Return a range of numbers or letters. + * + * @param {String} `start` Start of the range + * @param {String} `stop` End of the range + * @param {String} `step` Increment or decrement to use. + * @param {Function} `fn` Custom function to modify each element in the range. + * @return {Array} + */ + +function fillRange(start, stop, step, options) { + if (typeof start === 'undefined') { + return []; + } + + if (typeof stop === 'undefined' || start === stop) { + // special case, for handling negative zero + var isString = typeof start === 'string'; + if (isNumber(start) && !toNumber(start)) { + return [isString ? '0' : 0]; + } + return [start]; + } + + if (typeof step !== 'number' && typeof step !== 'string') { + options = step; + step = undefined; + } + + if (typeof options === 'function') { + options = { transform: options }; + } + + var opts = extend({step: step}, options); + if (opts.step && !isValidNumber(opts.step)) { + if (opts.strictRanges === true) { + throw new TypeError('expected options.step to be a number'); + } + return []; + } + + opts.isNumber = isValidNumber(start) && isValidNumber(stop); + if (!opts.isNumber && !isValid(start, stop)) { + if (opts.strictRanges === true) { + throw new RangeError('invalid range arguments: ' + util.inspect([start, stop])); + } + return []; + } + + opts.isPadded = isPadded(start) || isPadded(stop); + opts.toString = opts.stringify + || typeof opts.step === 'string' + || typeof start === 'string' + || typeof stop === 'string' + || !opts.isNumber; + + if (opts.isPadded) { + opts.maxLength = Math.max(String(start).length, String(stop).length); + } + + // support legacy minimatch/fill-range options + if (typeof opts.optimize === 'boolean') opts.toRegex = opts.optimize; + if (typeof opts.makeRe === 'boolean') opts.toRegex = opts.makeRe; + return expand(start, stop, opts); +} + +function expand(start, stop, options) { + var a = options.isNumber ? toNumber(start) : start.charCodeAt(0); + var b = options.isNumber ? toNumber(stop) : stop.charCodeAt(0); + + var step = Math.abs(toNumber(options.step)) || 1; + if (options.toRegex && step === 1) { + return toRange(a, b, start, stop, options); + } + + var zero = {greater: [], lesser: []}; + var asc = a < b; + var arr = new Array(Math.round((asc ? b - a : a - b) / step)); + var idx = 0; + + while (asc ? a <= b : a >= b) { + var val = options.isNumber ? a : String.fromCharCode(a); + if (options.toRegex && (val >= 0 || !options.isNumber)) { + zero.greater.push(val); + } else { + zero.lesser.push(Math.abs(val)); + } + + if (options.isPadded) { + val = zeros(val, options); + } + + if (options.toString) { + val = String(val); + } + + if (typeof options.transform === 'function') { + arr[idx++] = options.transform(val, a, b, step, idx, arr, options); + } else { + arr[idx++] = val; + } + + if (asc) { + a += step; + } else { + a -= step; + } + } + + if (options.toRegex === true) { + return toSequence(arr, zero, options); + } + return arr; +} + +function toRange(a, b, start, stop, options) { + if (options.isPadded) { + return toRegex(start, stop, options); + } + + if (options.isNumber) { + return toRegex(Math.min(a, b), Math.max(a, b), options); + } + + var start = String.fromCharCode(Math.min(a, b)); + var stop = String.fromCharCode(Math.max(a, b)); + return '[' + start + '-' + stop + ']'; +} + +function toSequence(arr, zeros, options) { + var greater = '', lesser = ''; + if (zeros.greater.length) { + greater = zeros.greater.join('|'); + } + if (zeros.lesser.length) { + lesser = '-(' + zeros.lesser.join('|') + ')'; + } + var res = greater && lesser + ? greater + '|' + lesser + : greater || lesser; + + if (options.capture) { + return '(' + res + ')'; + } + return res; +} + +function zeros(val, options) { + if (options.isPadded) { + var str = String(val); + var len = str.length; + var dash = ''; + if (str.charAt(0) === '-') { + dash = '-'; + str = str.slice(1); + } + var diff = options.maxLength - len; + var pad = repeat('0', diff); + val = (dash + pad + str); + } + if (options.stringify) { + return String(val); + } + return val; +} + +function toNumber(val) { + return Number(val) || 0; +} + +function isPadded(str) { + return /^-?0\d/.test(str); +} + +function isValid(min, max) { + return (isValidNumber(min) || isValidLetter(min)) + && (isValidNumber(max) || isValidLetter(max)); +} + +function isValidLetter(ch) { + return typeof ch === 'string' && ch.length === 1 && /^\w+$/.test(ch); +} + +function isValidNumber(n) { + return isNumber(n) && !/\./.test(n); +} + +/** + * Expose `fillRange` + * @type {Function} + */ + +module.exports = fillRange; + + +/***/ }), +/* 752 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/*! + * is-number + * + * Copyright (c) 2014-2015, Jon Schlinkert. + * Licensed under the MIT License. + */ + + + +var typeOf = __webpack_require__(753); + +module.exports = function isNumber(num) { + var type = typeOf(num); + + if (type === 'string') { + if (!num.trim()) return false; + } else if (type !== 'number') { + return false; + } + + return (num - num + 1) >= 0; +}; + + +/***/ }), +/* 753 */ +/***/ (function(module, exports, __webpack_require__) { + +var isBuffer = __webpack_require__(735); +var toString = Object.prototype.toString; + +/** + * Get the native `typeof` a value. + * + * @param {*} `val` + * @return {*} Native javascript type + */ + +module.exports = function kindOf(val) { + // primitivies + if (typeof val === 'undefined') { + return 'undefined'; + } + if (val === null) { + return 'null'; + } + if (val === true || val === false || val instanceof Boolean) { + return 'boolean'; + } + if (typeof val === 'string' || val instanceof String) { + return 'string'; + } + if (typeof val === 'number' || val instanceof Number) { + return 'number'; + } + + // functions + if (typeof val === 'function' || val instanceof Function) { + return 'function'; + } + + // array + if (typeof Array.isArray !== 'undefined' && Array.isArray(val)) { + return 'array'; + } + + // check for instances of RegExp and Date before calling `toString` + if (val instanceof RegExp) { + return 'regexp'; + } + if (val instanceof Date) { + return 'date'; + } + + // other objects + var type = toString.call(val); + + if (type === '[object RegExp]') { + return 'regexp'; + } + if (type === '[object Date]') { + return 'date'; + } + if (type === '[object Arguments]') { + return 'arguments'; + } + if (type === '[object Error]') { + return 'error'; + } + + // buffer + if (isBuffer(val)) { + return 'buffer'; + } + + // es6: Map, WeakMap, Set, WeakSet + if (type === '[object Set]') { + return 'set'; + } + if (type === '[object WeakSet]') { + return 'weakset'; + } + if (type === '[object Map]') { + return 'map'; + } + if (type === '[object WeakMap]') { + return 'weakmap'; + } + if (type === '[object Symbol]') { + return 'symbol'; + } + + // typed arrays + if (type === '[object Int8Array]') { + return 'int8array'; + } + if (type === '[object Uint8Array]') { + return 'uint8array'; + } + if (type === '[object Uint8ClampedArray]') { + return 'uint8clampedarray'; + } + if (type === '[object Int16Array]') { + return 'int16array'; + } + if (type === '[object Uint16Array]') { + return 'uint16array'; + } + if (type === '[object Int32Array]') { + return 'int32array'; + } + if (type === '[object Uint32Array]') { + return 'uint32array'; + } + if (type === '[object Float32Array]') { + return 'float32array'; + } + if (type === '[object Float64Array]') { + return 'float64array'; + } + + // must be a plain object + return 'object'; +}; + + +/***/ }), +/* 754 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/*! + * repeat-string + * + * Copyright (c) 2014-2015, Jon Schlinkert. + * Licensed under the MIT License. + */ + + + +/** + * Results cache + */ + +var res = ''; +var cache; + +/** + * Expose `repeat` + */ + +module.exports = repeat; + +/** + * Repeat the given `string` the specified `number` + * of times. + * + * **Example:** + * + * ```js + * var repeat = require('repeat-string'); + * repeat('A', 5); + * //=> AAAAA + * ``` + * + * @param {String} `string` The string to repeat + * @param {Number} `number` The number of times to repeat the string + * @return {String} Repeated string + * @api public + */ + +function repeat(str, num) { + if (typeof str !== 'string') { + throw new TypeError('expected a string'); + } + + // cover common, quick use cases + if (num === 1) return str; + if (num === 2) return str + str; + + var max = str.length * num; + if (cache !== str || typeof cache === 'undefined') { + cache = str; + res = ''; + } else if (res.length >= max) { + return res.substr(0, max); + } + + while (max > res.length && num > 1) { + if (num & 1) { + res += str; + } + + num >>= 1; + str += str; + } + + res += str; + res = res.substr(0, max); + return res; +} + + +/***/ }), +/* 755 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/*! + * to-regex-range + * + * Copyright (c) 2015, 2017, Jon Schlinkert. + * Released under the MIT License. + */ + + + +var repeat = __webpack_require__(754); +var isNumber = __webpack_require__(752); +var cache = {}; + +function toRegexRange(min, max, options) { + if (isNumber(min) === false) { + throw new RangeError('toRegexRange: first argument is invalid.'); + } + + if (typeof max === 'undefined' || min === max) { + return String(min); + } + + if (isNumber(max) === false) { + throw new RangeError('toRegexRange: second argument is invalid.'); + } + + options = options || {}; + var relax = String(options.relaxZeros); + var shorthand = String(options.shorthand); + var capture = String(options.capture); + var key = min + ':' + max + '=' + relax + shorthand + capture; + if (cache.hasOwnProperty(key)) { + return cache[key].result; + } + + var a = Math.min(min, max); + var b = Math.max(min, max); + + if (Math.abs(a - b) === 1) { + var result = min + '|' + max; + if (options.capture) { + return '(' + result + ')'; + } + return result; + } + + var isPadded = padding(min) || padding(max); + var positives = []; + var negatives = []; + + var tok = {min: min, max: max, a: a, b: b}; + if (isPadded) { + tok.isPadded = isPadded; + tok.maxLen = String(tok.max).length; + } + + if (a < 0) { + var newMin = b < 0 ? Math.abs(b) : 1; + var newMax = Math.abs(a); + negatives = splitToPatterns(newMin, newMax, tok, options); + a = tok.a = 0; + } + + if (b >= 0) { + positives = splitToPatterns(a, b, tok, options); + } + + tok.negatives = negatives; + tok.positives = positives; + tok.result = siftPatterns(negatives, positives, options); + + if (options.capture && (positives.length + negatives.length) > 1) { + tok.result = '(' + tok.result + ')'; + } + + cache[key] = tok; + return tok.result; +} + +function siftPatterns(neg, pos, options) { + var onlyNegative = filterPatterns(neg, pos, '-', false, options) || []; + var onlyPositive = filterPatterns(pos, neg, '', false, options) || []; + var intersected = filterPatterns(neg, pos, '-?', true, options) || []; + var subpatterns = onlyNegative.concat(intersected).concat(onlyPositive); + return subpatterns.join('|'); +} + +function splitToRanges(min, max) { + min = Number(min); + max = Number(max); + + var nines = 1; + var stops = [max]; + var stop = +countNines(min, nines); + + while (min <= stop && stop <= max) { + stops = push(stops, stop); + nines += 1; + stop = +countNines(min, nines); + } + + var zeros = 1; + stop = countZeros(max + 1, zeros) - 1; + + while (min < stop && stop <= max) { + stops = push(stops, stop); + zeros += 1; + stop = countZeros(max + 1, zeros) - 1; + } + + stops.sort(compare); + return stops; +} + +/** + * Convert a range to a regex pattern + * @param {Number} `start` + * @param {Number} `stop` + * @return {String} + */ + +function rangeToPattern(start, stop, options) { + if (start === stop) { + return {pattern: String(start), digits: []}; + } + + var zipped = zip(String(start), String(stop)); + var len = zipped.length, i = -1; + + var pattern = ''; + var digits = 0; + + while (++i < len) { + var numbers = zipped[i]; + var startDigit = numbers[0]; + var stopDigit = numbers[1]; + + if (startDigit === stopDigit) { + pattern += startDigit; + + } else if (startDigit !== '0' || stopDigit !== '9') { + pattern += toCharacterClass(startDigit, stopDigit); + + } else { + digits += 1; + } + } + + if (digits) { + pattern += options.shorthand ? '\\d' : '[0-9]'; + } + + return { pattern: pattern, digits: [digits] }; +} + +function splitToPatterns(min, max, tok, options) { + var ranges = splitToRanges(min, max); + var len = ranges.length; + var idx = -1; + + var tokens = []; + var start = min; + var prev; + + while (++idx < len) { + var range = ranges[idx]; + var obj = rangeToPattern(start, range, options); + var zeros = ''; + + if (!tok.isPadded && prev && prev.pattern === obj.pattern) { + if (prev.digits.length > 1) { + prev.digits.pop(); + } + prev.digits.push(obj.digits[0]); + prev.string = prev.pattern + toQuantifier(prev.digits); + start = range + 1; + continue; + } + + if (tok.isPadded) { + zeros = padZeros(range, tok); + } + + obj.string = zeros + obj.pattern + toQuantifier(obj.digits); + tokens.push(obj); + start = range + 1; + prev = obj; + } + + return tokens; +} + +function filterPatterns(arr, comparison, prefix, intersection, options) { + var res = []; + + for (var i = 0; i < arr.length; i++) { + var tok = arr[i]; + var ele = tok.string; + + if (options.relaxZeros !== false) { + if (prefix === '-' && ele.charAt(0) === '0') { + if (ele.charAt(1) === '{') { + ele = '0*' + ele.replace(/^0\{\d+\}/, ''); + } else { + ele = '0*' + ele.slice(1); + } + } + } + + if (!intersection && !contains(comparison, 'string', ele)) { + res.push(prefix + ele); + } + + if (intersection && contains(comparison, 'string', ele)) { + res.push(prefix + ele); + } + } + return res; +} + +/** + * Zip strings (`for in` can be used on string characters) + */ + +function zip(a, b) { + var arr = []; + for (var ch in a) arr.push([a[ch], b[ch]]); + return arr; +} + +function compare(a, b) { + return a > b ? 1 : b > a ? -1 : 0; +} + +function push(arr, ele) { + if (arr.indexOf(ele) === -1) arr.push(ele); + return arr; +} + +function contains(arr, key, val) { + for (var i = 0; i < arr.length; i++) { + if (arr[i][key] === val) { + return true; + } + } + return false; +} + +function countNines(min, len) { + return String(min).slice(0, -len) + repeat('9', len); +} + +function countZeros(integer, zeros) { + return integer - (integer % Math.pow(10, zeros)); +} + +function toQuantifier(digits) { + var start = digits[0]; + var stop = digits[1] ? (',' + digits[1]) : ''; + if (!stop && (!start || start === 1)) { + return ''; + } + return '{' + start + stop + '}'; +} + +function toCharacterClass(a, b) { + return '[' + a + ((b - a === 1) ? '' : '-') + b + ']'; +} + +function padding(str) { + return /^-?(0+)\d/.exec(str); +} + +function padZeros(val, tok) { + if (tok.isPadded) { + var diff = Math.abs(tok.maxLen - String(val).length); + switch (diff) { + case 0: + return ''; + case 1: + return '0'; + default: { + return '0{' + diff + '}'; + } + } + } + return val; +} + +/** + * Expose `toRegexRange` + */ + +module.exports = toRegexRange; + + +/***/ }), +/* 756 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/*! + * repeat-element + * + * Copyright (c) 2015 Jon Schlinkert. + * Licensed under the MIT license. + */ + + + +module.exports = function repeat(ele, num) { + var arr = new Array(num); + + for (var i = 0; i < num; i++) { + arr[i] = ele; + } + + return arr; +}; + + +/***/ }), +/* 757 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var Node = __webpack_require__(758); +var utils = __webpack_require__(743); + +/** + * Braces parsers + */ + +module.exports = function(braces, options) { + braces.parser + .set('bos', function() { + if (!this.parsed) { + this.ast = this.nodes[0] = new Node(this.ast); + } + }) + + /** + * Character parsers + */ + + .set('escape', function() { + var pos = this.position(); + var m = this.match(/^(?:\\(.)|\$\{)/); + if (!m) return; + + var prev = this.prev(); + var last = utils.last(prev.nodes); + + var node = pos(new Node({ + type: 'text', + multiplier: 1, + val: m[0] + })); + + if (node.val === '\\\\') { + return node; + } + + if (node.val === '${') { + var str = this.input; + var idx = -1; + var ch; + + while ((ch = str[++idx])) { + this.consume(1); + node.val += ch; + if (ch === '\\') { + node.val += str[++idx]; + continue; + } + if (ch === '}') { + break; + } + } + } + + if (this.options.unescape !== false) { + node.val = node.val.replace(/\\([{}])/g, '$1'); + } + + if (last.val === '"' && this.input.charAt(0) === '"') { + last.val = node.val; + this.consume(1); + return; + } + + return concatNodes.call(this, pos, node, prev, options); + }) + + /** + * Brackets: "[...]" (basic, this is overridden by + * other parsers in more advanced implementations) + */ + + .set('bracket', function() { + var isInside = this.isInside('brace'); + var pos = this.position(); + var m = this.match(/^(?:\[([!^]?)([^\]]{2,}|\]-)(\]|[^*+?]+)|\[)/); + if (!m) return; + + var prev = this.prev(); + var val = m[0]; + var negated = m[1] ? '^' : ''; + var inner = m[2] || ''; + var close = m[3] || ''; + + if (isInside && prev.type === 'brace') { + prev.text = prev.text || ''; + prev.text += val; + } + + var esc = this.input.slice(0, 2); + if (inner === '' && esc === '\\]') { + inner += esc; + this.consume(2); + + var str = this.input; + var idx = -1; + var ch; + + while ((ch = str[++idx])) { + this.consume(1); + if (ch === ']') { + close = ch; + break; + } + inner += ch; + } + } + + return pos(new Node({ + type: 'bracket', + val: val, + escaped: close !== ']', + negated: negated, + inner: inner, + close: close + })); + }) + + /** + * Empty braces (we capture these early to + * speed up processing in the compiler) + */ + + .set('multiplier', function() { + var isInside = this.isInside('brace'); + var pos = this.position(); + var m = this.match(/^\{((?:,|\{,+\})+)\}/); + if (!m) return; + + this.multiplier = true; + var prev = this.prev(); + var val = m[0]; + + if (isInside && prev.type === 'brace') { + prev.text = prev.text || ''; + prev.text += val; + } + + var node = pos(new Node({ + type: 'text', + multiplier: 1, + match: m, + val: val + })); + + return concatNodes.call(this, pos, node, prev, options); + }) + + /** + * Open + */ + + .set('brace.open', function() { + var pos = this.position(); + var m = this.match(/^\{(?!(?:[^\\}]?|,+)\})/); + if (!m) return; + + var prev = this.prev(); + var last = utils.last(prev.nodes); + + // if the last parsed character was an extglob character + // we need to _not optimize_ the brace pattern because + // it might be mistaken for an extglob by a downstream parser + if (last && last.val && isExtglobChar(last.val.slice(-1))) { + last.optimize = false; + } + + var open = pos(new Node({ + type: 'brace.open', + val: m[0] + })); + + var node = pos(new Node({ + type: 'brace', + nodes: [] + })); + + node.push(open); + prev.push(node); + this.push('brace', node); + }) + + /** + * Close + */ + + .set('brace.close', function() { + var pos = this.position(); + var m = this.match(/^\}/); + if (!m || !m[0]) return; + + var brace = this.pop('brace'); + var node = pos(new Node({ + type: 'brace.close', + val: m[0] + })); + + if (!this.isType(brace, 'brace')) { + if (this.options.strict) { + throw new Error('missing opening "{"'); + } + node.type = 'text'; + node.multiplier = 0; + node.escaped = true; + return node; + } + + var prev = this.prev(); + var last = utils.last(prev.nodes); + if (last.text) { + var lastNode = utils.last(last.nodes); + if (lastNode.val === ')' && /[!@*?+]\(/.test(last.text)) { + var open = last.nodes[0]; + var text = last.nodes[1]; + if (open.type === 'brace.open' && text && text.type === 'text') { + text.optimize = false; + } + } + } + + if (brace.nodes.length > 2) { + var first = brace.nodes[1]; + if (first.type === 'text' && first.val === ',') { + brace.nodes.splice(1, 1); + brace.nodes.push(first); + } + } + + brace.push(node); + }) + + /** + * Capture boundary characters + */ + + .set('boundary', function() { + var pos = this.position(); + var m = this.match(/^[$^](?!\{)/); + if (!m) return; + return pos(new Node({ + type: 'text', + val: m[0] + })); + }) + + /** + * One or zero, non-comma characters wrapped in braces + */ + + .set('nobrace', function() { + var isInside = this.isInside('brace'); + var pos = this.position(); + var m = this.match(/^\{[^,]?\}/); + if (!m) return; + + var prev = this.prev(); + var val = m[0]; + + if (isInside && prev.type === 'brace') { + prev.text = prev.text || ''; + prev.text += val; + } + + return pos(new Node({ + type: 'text', + multiplier: 0, + val: val + })); + }) + + /** + * Text + */ + + .set('text', function() { + var isInside = this.isInside('brace'); + var pos = this.position(); + var m = this.match(/^((?!\\)[^${}[\]])+/); + if (!m) return; + + var prev = this.prev(); + var val = m[0]; + + if (isInside && prev.type === 'brace') { + prev.text = prev.text || ''; + prev.text += val; + } + + var node = pos(new Node({ + type: 'text', + multiplier: 1, + val: val + })); + + return concatNodes.call(this, pos, node, prev, options); + }); +}; + +/** + * Returns true if the character is an extglob character. + */ + +function isExtglobChar(ch) { + return ch === '!' || ch === '@' || ch === '*' || ch === '?' || ch === '+'; +} + +/** + * Combine text nodes, and calculate empty sets (`{,,}`) + * @param {Function} `pos` Function to calculate node position + * @param {Object} `node` AST node + * @return {Object} + */ + +function concatNodes(pos, node, parent, options) { + node.orig = node.val; + var prev = this.prev(); + var last = utils.last(prev.nodes); + var isEscaped = false; + + if (node.val.length > 1) { + var a = node.val.charAt(0); + var b = node.val.slice(-1); + + isEscaped = (a === '"' && b === '"') + || (a === "'" && b === "'") + || (a === '`' && b === '`'); + } + + if (isEscaped && options.unescape !== false) { + node.val = node.val.slice(1, node.val.length - 1); + node.escaped = true; + } + + if (node.match) { + var match = node.match[1]; + if (!match || match.indexOf('}') === -1) { + match = node.match[0]; + } + + // replace each set with a single "," + var val = match.replace(/\{/g, ',').replace(/\}/g, ''); + node.multiplier *= val.length; + node.val = ''; + } + + var simpleText = last.type === 'text' + && last.multiplier === 1 + && node.multiplier === 1 + && node.val; + + if (simpleText) { + last.val += node.val; + return; + } + + prev.push(node); +} + + +/***/ }), +/* 758 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var isObject = __webpack_require__(748); +var define = __webpack_require__(759); +var utils = __webpack_require__(766); +var ownNames; + +/** + * Create a new AST `Node` with the given `val` and `type`. + * + * ```js + * var node = new Node('*', 'Star'); + * var node = new Node({type: 'star', val: '*'}); + * ``` + * @name Node + * @param {String|Object} `val` Pass a matched substring, or an object to merge onto the node. + * @param {String} `type` The node type to use when `val` is a string. + * @return {Object} node instance + * @api public + */ + +function Node(val, type, parent) { + if (typeof type !== 'string') { + parent = type; + type = null; + } + + define(this, 'parent', parent); + define(this, 'isNode', true); + define(this, 'expect', null); + + if (typeof type !== 'string' && isObject(val)) { + lazyKeys(); + var keys = Object.keys(val); + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + if (ownNames.indexOf(key) === -1) { + this[key] = val[key]; + } + } + } else { + this.type = type; + this.val = val; + } +} + +/** + * Returns true if the given value is a node. + * + * ```js + * var Node = require('snapdragon-node'); + * var node = new Node({type: 'foo'}); + * console.log(Node.isNode(node)); //=> true + * console.log(Node.isNode({})); //=> false + * ``` + * @param {Object} `node` + * @returns {Boolean} + * @api public + */ + +Node.isNode = function(node) { + return utils.isNode(node); +}; + +/** + * Define a non-enumberable property on the node instance. + * Useful for adding properties that shouldn't be extended + * or visible during debugging. + * + * ```js + * var node = new Node(); + * node.define('foo', 'something non-enumerable'); + * ``` + * @param {String} `name` + * @param {any} `val` + * @return {Object} returns the node instance + * @api public + */ + +Node.prototype.define = function(name, val) { + define(this, name, val); + return this; +}; + +/** + * Returns true if `node.val` is an empty string, or `node.nodes` does + * not contain any non-empty text nodes. + * + * ```js + * var node = new Node({type: 'text'}); + * node.isEmpty(); //=> true + * node.val = 'foo'; + * node.isEmpty(); //=> false + * ``` + * @param {Function} `fn` (optional) Filter function that is called on `node` and/or child nodes. `isEmpty` will return false immediately when the filter function returns false on any nodes. + * @return {Boolean} + * @api public + */ + +Node.prototype.isEmpty = function(fn) { + return utils.isEmpty(this, fn); +}; + +/** + * Given node `foo` and node `bar`, push node `bar` onto `foo.nodes`, and + * set `foo` as `bar.parent`. + * + * ```js + * var foo = new Node({type: 'foo'}); + * var bar = new Node({type: 'bar'}); + * foo.push(bar); + * ``` + * @param {Object} `node` + * @return {Number} Returns the length of `node.nodes` + * @api public + */ + +Node.prototype.push = function(node) { + assert(Node.isNode(node), 'expected node to be an instance of Node'); + define(node, 'parent', this); + + this.nodes = this.nodes || []; + return this.nodes.push(node); +}; + +/** + * Given node `foo` and node `bar`, unshift node `bar` onto `foo.nodes`, and + * set `foo` as `bar.parent`. + * + * ```js + * var foo = new Node({type: 'foo'}); + * var bar = new Node({type: 'bar'}); + * foo.unshift(bar); + * ``` + * @param {Object} `node` + * @return {Number} Returns the length of `node.nodes` + * @api public + */ + +Node.prototype.unshift = function(node) { + assert(Node.isNode(node), 'expected node to be an instance of Node'); + define(node, 'parent', this); + + this.nodes = this.nodes || []; + return this.nodes.unshift(node); +}; + +/** + * Pop a node from `node.nodes`. + * + * ```js + * var node = new Node({type: 'foo'}); + * node.push(new Node({type: 'a'})); + * node.push(new Node({type: 'b'})); + * node.push(new Node({type: 'c'})); + * node.push(new Node({type: 'd'})); + * console.log(node.nodes.length); + * //=> 4 + * node.pop(); + * console.log(node.nodes.length); + * //=> 3 + * ``` + * @return {Number} Returns the popped `node` + * @api public + */ + +Node.prototype.pop = function() { + return this.nodes && this.nodes.pop(); +}; + +/** + * Shift a node from `node.nodes`. + * + * ```js + * var node = new Node({type: 'foo'}); + * node.push(new Node({type: 'a'})); + * node.push(new Node({type: 'b'})); + * node.push(new Node({type: 'c'})); + * node.push(new Node({type: 'd'})); + * console.log(node.nodes.length); + * //=> 4 + * node.shift(); + * console.log(node.nodes.length); + * //=> 3 + * ``` + * @return {Object} Returns the shifted `node` + * @api public + */ + +Node.prototype.shift = function() { + return this.nodes && this.nodes.shift(); +}; + +/** + * Remove `node` from `node.nodes`. + * + * ```js + * node.remove(childNode); + * ``` + * @param {Object} `node` + * @return {Object} Returns the removed node. + * @api public + */ + +Node.prototype.remove = function(node) { + assert(Node.isNode(node), 'expected node to be an instance of Node'); + this.nodes = this.nodes || []; + var idx = node.index; + if (idx !== -1) { + node.index = -1; + return this.nodes.splice(idx, 1); + } + return null; +}; + +/** + * Get the first child node from `node.nodes` that matches the given `type`. + * If `type` is a number, the child node at that index is returned. + * + * ```js + * var child = node.find(1); //<= index of the node to get + * var child = node.find('foo'); //<= node.type of a child node + * var child = node.find(/^(foo|bar)$/); //<= regex to match node.type + * var child = node.find(['foo', 'bar']); //<= array of node.type(s) + * ``` + * @param {String} `type` + * @return {Object} Returns a child node or undefined. + * @api public + */ + +Node.prototype.find = function(type) { + return utils.findNode(this.nodes, type); +}; + +/** + * Return true if the node is the given `type`. + * + * ```js + * var node = new Node({type: 'bar'}); + * cosole.log(node.isType('foo')); // false + * cosole.log(node.isType(/^(foo|bar)$/)); // true + * cosole.log(node.isType(['foo', 'bar'])); // true + * ``` + * @param {String} `type` + * @return {Boolean} + * @api public + */ + +Node.prototype.isType = function(type) { + return utils.isType(this, type); +}; + +/** + * Return true if the `node.nodes` has the given `type`. + * + * ```js + * var foo = new Node({type: 'foo'}); + * var bar = new Node({type: 'bar'}); + * foo.push(bar); + * + * cosole.log(foo.hasType('qux')); // false + * cosole.log(foo.hasType(/^(qux|bar)$/)); // true + * cosole.log(foo.hasType(['qux', 'bar'])); // true + * ``` + * @param {String} `type` + * @return {Boolean} + * @api public + */ + +Node.prototype.hasType = function(type) { + return utils.hasType(this, type); +}; + +/** + * Get the siblings array, or `null` if it doesn't exist. + * + * ```js + * var foo = new Node({type: 'foo'}); + * var bar = new Node({type: 'bar'}); + * var baz = new Node({type: 'baz'}); + * foo.push(bar); + * foo.push(baz); + * + * console.log(bar.siblings.length) // 2 + * console.log(baz.siblings.length) // 2 + * ``` + * @return {Array} + * @api public + */ + +Object.defineProperty(Node.prototype, 'siblings', { + set: function() { + throw new Error('node.siblings is a getter and cannot be defined'); + }, + get: function() { + return this.parent ? this.parent.nodes : null; + } +}); + +/** + * Get the node's current index from `node.parent.nodes`. + * This should always be correct, even when the parent adds nodes. + * + * ```js + * var foo = new Node({type: 'foo'}); + * var bar = new Node({type: 'bar'}); + * var baz = new Node({type: 'baz'}); + * var qux = new Node({type: 'qux'}); + * foo.push(bar); + * foo.push(baz); + * foo.unshift(qux); + * + * console.log(bar.index) // 1 + * console.log(baz.index) // 2 + * console.log(qux.index) // 0 + * ``` + * @return {Number} + * @api public + */ + +Object.defineProperty(Node.prototype, 'index', { + set: function(index) { + define(this, 'idx', index); + }, + get: function() { + if (!Array.isArray(this.siblings)) { + return -1; + } + var tok = this.idx !== -1 ? this.siblings[this.idx] : null; + if (tok !== this) { + this.idx = this.siblings.indexOf(this); + } + return this.idx; + } +}); + +/** + * Get the previous node from the siblings array or `null`. + * + * ```js + * var foo = new Node({type: 'foo'}); + * var bar = new Node({type: 'bar'}); + * var baz = new Node({type: 'baz'}); + * foo.push(bar); + * foo.push(baz); + * + * console.log(baz.prev.type) // 'bar' + * ``` + * @return {Object} + * @api public + */ + +Object.defineProperty(Node.prototype, 'prev', { + set: function() { + throw new Error('node.prev is a getter and cannot be defined'); + }, + get: function() { + if (Array.isArray(this.siblings)) { + return this.siblings[this.index - 1] || this.parent.prev; + } + return null; + } +}); + +/** + * Get the siblings array, or `null` if it doesn't exist. + * + * ```js + * var foo = new Node({type: 'foo'}); + * var bar = new Node({type: 'bar'}); + * var baz = new Node({type: 'baz'}); + * foo.push(bar); + * foo.push(baz); + * + * console.log(bar.siblings.length) // 2 + * console.log(baz.siblings.length) // 2 + * ``` + * @return {Object} + * @api public + */ + +Object.defineProperty(Node.prototype, 'next', { + set: function() { + throw new Error('node.next is a getter and cannot be defined'); + }, + get: function() { + if (Array.isArray(this.siblings)) { + return this.siblings[this.index + 1] || this.parent.next; + } + return null; + } +}); + +/** + * Get the first node from `node.nodes`. + * + * ```js + * var foo = new Node({type: 'foo'}); + * var bar = new Node({type: 'bar'}); + * var baz = new Node({type: 'baz'}); + * var qux = new Node({type: 'qux'}); + * foo.push(bar); + * foo.push(baz); + * foo.push(qux); + * + * console.log(foo.first.type) // 'bar' + * ``` + * @return {Object} The first node, or undefiend + * @api public + */ + +Object.defineProperty(Node.prototype, 'first', { + get: function() { + return this.nodes ? this.nodes[0] : null; + } +}); + +/** + * Get the last node from `node.nodes`. + * + * ```js + * var foo = new Node({type: 'foo'}); + * var bar = new Node({type: 'bar'}); + * var baz = new Node({type: 'baz'}); + * var qux = new Node({type: 'qux'}); + * foo.push(bar); + * foo.push(baz); + * foo.push(qux); + * + * console.log(foo.last.type) // 'qux' + * ``` + * @return {Object} The last node, or undefiend + * @api public + */ + +Object.defineProperty(Node.prototype, 'last', { + get: function() { + return this.nodes ? utils.last(this.nodes) : null; + } +}); + +/** + * Get the last node from `node.nodes`. + * + * ```js + * var foo = new Node({type: 'foo'}); + * var bar = new Node({type: 'bar'}); + * var baz = new Node({type: 'baz'}); + * var qux = new Node({type: 'qux'}); + * foo.push(bar); + * foo.push(baz); + * foo.push(qux); + * + * console.log(foo.last.type) // 'qux' + * ``` + * @return {Object} The last node, or undefiend + * @api public + */ + +Object.defineProperty(Node.prototype, 'scope', { + get: function() { + if (this.isScope !== true) { + return this.parent ? this.parent.scope : this; + } + return this; + } +}); + +/** + * Get own property names from Node prototype, but only the + * first time `Node` is instantiated + */ + +function lazyKeys() { + if (!ownNames) { + ownNames = Object.getOwnPropertyNames(Node.prototype); + } +} + +/** + * Simplified assertion. Throws an error is `val` is falsey. + */ + +function assert(val, message) { + if (!val) throw new Error(message); +} + +/** + * Expose `Node` + */ + +exports = module.exports = Node; + + +/***/ }), +/* 759 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/*! + * define-property + * + * Copyright (c) 2015, 2017, Jon Schlinkert. + * Released under the MIT License. + */ + + + +var isDescriptor = __webpack_require__(760); + +module.exports = function defineProperty(obj, prop, val) { + if (typeof obj !== 'object' && typeof obj !== 'function') { + throw new TypeError('expected an object or function.'); + } + + if (typeof prop !== 'string') { + throw new TypeError('expected `prop` to be a string.'); + } + + if (isDescriptor(val) && ('set' in val || 'get' in val)) { + return Object.defineProperty(obj, prop, val); + } + + return Object.defineProperty(obj, prop, { + configurable: true, + enumerable: false, + writable: true, + value: val + }); +}; + + +/***/ }), +/* 760 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/*! + * is-descriptor + * + * Copyright (c) 2015-2017, Jon Schlinkert. + * Released under the MIT License. + */ + + + +var typeOf = __webpack_require__(761); +var isAccessor = __webpack_require__(762); +var isData = __webpack_require__(764); + +module.exports = function isDescriptor(obj, key) { + if (typeOf(obj) !== 'object') { + return false; + } + if ('get' in obj) { + return isAccessor(obj, key); + } + return isData(obj, key); +}; + + +/***/ }), +/* 761 */ +/***/ (function(module, exports) { + +var toString = Object.prototype.toString; + +module.exports = function kindOf(val) { + if (val === void 0) return 'undefined'; + if (val === null) return 'null'; + + var type = typeof val; + if (type === 'boolean') return 'boolean'; + if (type === 'string') return 'string'; + if (type === 'number') return 'number'; + if (type === 'symbol') return 'symbol'; + if (type === 'function') { + return isGeneratorFn(val) ? 'generatorfunction' : 'function'; + } + + if (isArray(val)) return 'array'; + if (isBuffer(val)) return 'buffer'; + if (isArguments(val)) return 'arguments'; + if (isDate(val)) return 'date'; + if (isError(val)) return 'error'; + if (isRegexp(val)) return 'regexp'; + + switch (ctorName(val)) { + case 'Symbol': return 'symbol'; + case 'Promise': return 'promise'; + + // Set, Map, WeakSet, WeakMap + case 'WeakMap': return 'weakmap'; + case 'WeakSet': return 'weakset'; + case 'Map': return 'map'; + case 'Set': return 'set'; + + // 8-bit typed arrays + case 'Int8Array': return 'int8array'; + case 'Uint8Array': return 'uint8array'; + case 'Uint8ClampedArray': return 'uint8clampedarray'; + + // 16-bit typed arrays + case 'Int16Array': return 'int16array'; + case 'Uint16Array': return 'uint16array'; + + // 32-bit typed arrays + case 'Int32Array': return 'int32array'; + case 'Uint32Array': return 'uint32array'; + case 'Float32Array': return 'float32array'; + case 'Float64Array': return 'float64array'; + } + + if (isGeneratorObj(val)) { + return 'generator'; + } + + // Non-plain objects + type = toString.call(val); + switch (type) { + case '[object Object]': return 'object'; + // iterators + case '[object Map Iterator]': return 'mapiterator'; + case '[object Set Iterator]': return 'setiterator'; + case '[object String Iterator]': return 'stringiterator'; + case '[object Array Iterator]': return 'arrayiterator'; + } + + // other + return type.slice(8, -1).toLowerCase().replace(/\s/g, ''); +}; + +function ctorName(val) { + return typeof val.constructor === 'function' ? val.constructor.name : null; +} + +function isArray(val) { + if (Array.isArray) return Array.isArray(val); + return val instanceof Array; +} + +function isError(val) { + return val instanceof Error || (typeof val.message === 'string' && val.constructor && typeof val.constructor.stackTraceLimit === 'number'); +} + +function isDate(val) { + if (val instanceof Date) return true; + return typeof val.toDateString === 'function' + && typeof val.getDate === 'function' + && typeof val.setDate === 'function'; +} + +function isRegexp(val) { + if (val instanceof RegExp) return true; + return typeof val.flags === 'string' + && typeof val.ignoreCase === 'boolean' + && typeof val.multiline === 'boolean' + && typeof val.global === 'boolean'; +} + +function isGeneratorFn(name, val) { + return ctorName(name) === 'GeneratorFunction'; +} + +function isGeneratorObj(val) { + return typeof val.throw === 'function' + && typeof val.return === 'function' + && typeof val.next === 'function'; +} + +function isArguments(val) { + try { + if (typeof val.length === 'number' && typeof val.callee === 'function') { + return true; + } + } catch (err) { + if (err.message.indexOf('callee') !== -1) { + return true; + } + } + return false; +} + +/** + * If you need to support Safari 5-7 (8-10 yr-old browser), + * take a look at https://github.com/feross/is-buffer + */ + +function isBuffer(val) { + if (val.constructor && typeof val.constructor.isBuffer === 'function') { + return val.constructor.isBuffer(val); + } + return false; +} + + +/***/ }), +/* 762 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/*! + * is-accessor-descriptor + * + * Copyright (c) 2015-2017, Jon Schlinkert. + * Released under the MIT License. + */ + + + +var typeOf = __webpack_require__(763); + +// accessor descriptor properties +var accessor = { + get: 'function', + set: 'function', + configurable: 'boolean', + enumerable: 'boolean' +}; + +function isAccessorDescriptor(obj, prop) { + if (typeof prop === 'string') { + var val = Object.getOwnPropertyDescriptor(obj, prop); + return typeof val !== 'undefined'; + } + + if (typeOf(obj) !== 'object') { + return false; + } + + if (has(obj, 'value') || has(obj, 'writable')) { + return false; + } + + if (!has(obj, 'get') || typeof obj.get !== 'function') { + return false; + } + + // tldr: it's valid to have "set" be undefined + // "set" might be undefined if `Object.getOwnPropertyDescriptor` + // was used to get the value, and only `get` was defined by the user + if (has(obj, 'set') && typeof obj[key] !== 'function' && typeof obj[key] !== 'undefined') { + return false; + } + + for (var key in obj) { + if (!accessor.hasOwnProperty(key)) { + continue; + } + + if (typeOf(obj[key]) === accessor[key]) { + continue; + } + + if (typeof obj[key] !== 'undefined') { + return false; + } + } + return true; +} + +function has(obj, key) { + return {}.hasOwnProperty.call(obj, key); +} + +/** + * Expose `isAccessorDescriptor` + */ + +module.exports = isAccessorDescriptor; + + +/***/ }), +/* 763 */ +/***/ (function(module, exports) { + +var toString = Object.prototype.toString; + +module.exports = function kindOf(val) { + if (val === void 0) return 'undefined'; + if (val === null) return 'null'; + + var type = typeof val; + if (type === 'boolean') return 'boolean'; + if (type === 'string') return 'string'; + if (type === 'number') return 'number'; + if (type === 'symbol') return 'symbol'; + if (type === 'function') { + return isGeneratorFn(val) ? 'generatorfunction' : 'function'; + } + + if (isArray(val)) return 'array'; + if (isBuffer(val)) return 'buffer'; + if (isArguments(val)) return 'arguments'; + if (isDate(val)) return 'date'; + if (isError(val)) return 'error'; + if (isRegexp(val)) return 'regexp'; + + switch (ctorName(val)) { + case 'Symbol': return 'symbol'; + case 'Promise': return 'promise'; + + // Set, Map, WeakSet, WeakMap + case 'WeakMap': return 'weakmap'; + case 'WeakSet': return 'weakset'; + case 'Map': return 'map'; + case 'Set': return 'set'; + + // 8-bit typed arrays + case 'Int8Array': return 'int8array'; + case 'Uint8Array': return 'uint8array'; + case 'Uint8ClampedArray': return 'uint8clampedarray'; + + // 16-bit typed arrays + case 'Int16Array': return 'int16array'; + case 'Uint16Array': return 'uint16array'; + + // 32-bit typed arrays + case 'Int32Array': return 'int32array'; + case 'Uint32Array': return 'uint32array'; + case 'Float32Array': return 'float32array'; + case 'Float64Array': return 'float64array'; + } + + if (isGeneratorObj(val)) { + return 'generator'; + } + + // Non-plain objects + type = toString.call(val); + switch (type) { + case '[object Object]': return 'object'; + // iterators + case '[object Map Iterator]': return 'mapiterator'; + case '[object Set Iterator]': return 'setiterator'; + case '[object String Iterator]': return 'stringiterator'; + case '[object Array Iterator]': return 'arrayiterator'; + } + + // other + return type.slice(8, -1).toLowerCase().replace(/\s/g, ''); +}; + +function ctorName(val) { + return typeof val.constructor === 'function' ? val.constructor.name : null; +} + +function isArray(val) { + if (Array.isArray) return Array.isArray(val); + return val instanceof Array; +} + +function isError(val) { + return val instanceof Error || (typeof val.message === 'string' && val.constructor && typeof val.constructor.stackTraceLimit === 'number'); +} + +function isDate(val) { + if (val instanceof Date) return true; + return typeof val.toDateString === 'function' + && typeof val.getDate === 'function' + && typeof val.setDate === 'function'; +} + +function isRegexp(val) { + if (val instanceof RegExp) return true; + return typeof val.flags === 'string' + && typeof val.ignoreCase === 'boolean' + && typeof val.multiline === 'boolean' + && typeof val.global === 'boolean'; +} + +function isGeneratorFn(name, val) { + return ctorName(name) === 'GeneratorFunction'; +} + +function isGeneratorObj(val) { + return typeof val.throw === 'function' + && typeof val.return === 'function' + && typeof val.next === 'function'; +} + +function isArguments(val) { + try { + if (typeof val.length === 'number' && typeof val.callee === 'function') { + return true; + } + } catch (err) { + if (err.message.indexOf('callee') !== -1) { + return true; + } + } + return false; +} + +/** + * If you need to support Safari 5-7 (8-10 yr-old browser), + * take a look at https://github.com/feross/is-buffer + */ + +function isBuffer(val) { + if (val.constructor && typeof val.constructor.isBuffer === 'function') { + return val.constructor.isBuffer(val); + } + return false; +} + + +/***/ }), +/* 764 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/*! + * is-data-descriptor + * + * Copyright (c) 2015-2017, Jon Schlinkert. + * Released under the MIT License. + */ + + + +var typeOf = __webpack_require__(765); + +module.exports = function isDataDescriptor(obj, prop) { + // data descriptor properties + var data = { + configurable: 'boolean', + enumerable: 'boolean', + writable: 'boolean' + }; + + if (typeOf(obj) !== 'object') { + return false; + } + + if (typeof prop === 'string') { + var val = Object.getOwnPropertyDescriptor(obj, prop); + return typeof val !== 'undefined'; + } + + if (!('value' in obj) && !('writable' in obj)) { + return false; + } + + for (var key in obj) { + if (key === 'value') continue; + + if (!data.hasOwnProperty(key)) { + continue; + } + + if (typeOf(obj[key]) === data[key]) { + continue; + } + + if (typeof obj[key] !== 'undefined') { + return false; + } + } + return true; +}; + + +/***/ }), +/* 765 */ +/***/ (function(module, exports) { + +var toString = Object.prototype.toString; + +module.exports = function kindOf(val) { + if (val === void 0) return 'undefined'; + if (val === null) return 'null'; + + var type = typeof val; + if (type === 'boolean') return 'boolean'; + if (type === 'string') return 'string'; + if (type === 'number') return 'number'; + if (type === 'symbol') return 'symbol'; + if (type === 'function') { + return isGeneratorFn(val) ? 'generatorfunction' : 'function'; + } + + if (isArray(val)) return 'array'; + if (isBuffer(val)) return 'buffer'; + if (isArguments(val)) return 'arguments'; + if (isDate(val)) return 'date'; + if (isError(val)) return 'error'; + if (isRegexp(val)) return 'regexp'; + + switch (ctorName(val)) { + case 'Symbol': return 'symbol'; + case 'Promise': return 'promise'; + + // Set, Map, WeakSet, WeakMap + case 'WeakMap': return 'weakmap'; + case 'WeakSet': return 'weakset'; + case 'Map': return 'map'; + case 'Set': return 'set'; + + // 8-bit typed arrays + case 'Int8Array': return 'int8array'; + case 'Uint8Array': return 'uint8array'; + case 'Uint8ClampedArray': return 'uint8clampedarray'; + + // 16-bit typed arrays + case 'Int16Array': return 'int16array'; + case 'Uint16Array': return 'uint16array'; + + // 32-bit typed arrays + case 'Int32Array': return 'int32array'; + case 'Uint32Array': return 'uint32array'; + case 'Float32Array': return 'float32array'; + case 'Float64Array': return 'float64array'; + } + + if (isGeneratorObj(val)) { + return 'generator'; + } + + // Non-plain objects + type = toString.call(val); + switch (type) { + case '[object Object]': return 'object'; + // iterators + case '[object Map Iterator]': return 'mapiterator'; + case '[object Set Iterator]': return 'setiterator'; + case '[object String Iterator]': return 'stringiterator'; + case '[object Array Iterator]': return 'arrayiterator'; + } + + // other + return type.slice(8, -1).toLowerCase().replace(/\s/g, ''); +}; + +function ctorName(val) { + return typeof val.constructor === 'function' ? val.constructor.name : null; +} + +function isArray(val) { + if (Array.isArray) return Array.isArray(val); + return val instanceof Array; +} + +function isError(val) { + return val instanceof Error || (typeof val.message === 'string' && val.constructor && typeof val.constructor.stackTraceLimit === 'number'); +} + +function isDate(val) { + if (val instanceof Date) return true; + return typeof val.toDateString === 'function' + && typeof val.getDate === 'function' + && typeof val.setDate === 'function'; +} + +function isRegexp(val) { + if (val instanceof RegExp) return true; + return typeof val.flags === 'string' + && typeof val.ignoreCase === 'boolean' + && typeof val.multiline === 'boolean' + && typeof val.global === 'boolean'; +} + +function isGeneratorFn(name, val) { + return ctorName(name) === 'GeneratorFunction'; +} + +function isGeneratorObj(val) { + return typeof val.throw === 'function' + && typeof val.return === 'function' + && typeof val.next === 'function'; +} + +function isArguments(val) { + try { + if (typeof val.length === 'number' && typeof val.callee === 'function') { + return true; + } + } catch (err) { + if (err.message.indexOf('callee') !== -1) { + return true; + } + } + return false; +} + +/** + * If you need to support Safari 5-7 (8-10 yr-old browser), + * take a look at https://github.com/feross/is-buffer + */ + +function isBuffer(val) { + if (val.constructor && typeof val.constructor.isBuffer === 'function') { + return val.constructor.isBuffer(val); + } + return false; +} + + +/***/ }), +/* 766 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var typeOf = __webpack_require__(753); +var utils = module.exports; + +/** + * Returns true if the given value is a node. + * + * ```js + * var Node = require('snapdragon-node'); + * var node = new Node({type: 'foo'}); + * console.log(utils.isNode(node)); //=> true + * console.log(utils.isNode({})); //=> false + * ``` + * @param {Object} `node` Instance of [snapdragon-node][] + * @returns {Boolean} + * @api public + */ + +utils.isNode = function(node) { + return typeOf(node) === 'object' && node.isNode === true; +}; + +/** + * Emit an empty string for the given `node`. + * + * ```js + * // do nothing for beginning-of-string + * snapdragon.compiler.set('bos', utils.noop); + * ``` + * @param {Object} `node` Instance of [snapdragon-node][] + * @returns {undefined} + * @api public + */ + +utils.noop = function(node) { + append(this, '', node); +}; + +/** + * Appdend `node.val` to `compiler.output`, exactly as it was created + * by the parser. + * + * ```js + * snapdragon.compiler.set('text', utils.identity); + * ``` + * @param {Object} `node` Instance of [snapdragon-node][] + * @returns {undefined} + * @api public + */ + +utils.identity = function(node) { + append(this, node.val, node); +}; + +/** + * Previously named `.emit`, this method appends the given `val` + * to `compiler.output` for the given node. Useful when you know + * what value should be appended advance, regardless of the actual + * value of `node.val`. + * + * ```js + * snapdragon.compiler + * .set('i', function(node) { + * this.mapVisit(node); + * }) + * .set('i.open', utils.append('')) + * .set('i.close', utils.append('')) + * ``` + * @param {Object} `node` Instance of [snapdragon-node][] + * @returns {Function} Returns a compiler middleware function. + * @api public + */ + +utils.append = function(val) { + return function(node) { + append(this, val, node); + }; +}; + +/** + * Used in compiler middleware, this onverts an AST node into + * an empty `text` node and deletes `node.nodes` if it exists. + * The advantage of this method is that, as opposed to completely + * removing the node, indices will not need to be re-calculated + * in sibling nodes, and nothing is appended to the output. + * + * ```js + * utils.toNoop(node); + * // convert `node.nodes` to the given value instead of deleting it + * utils.toNoop(node, []); + * ``` + * @param {Object} `node` Instance of [snapdragon-node][] + * @param {Array} `nodes` Optionally pass a new `nodes` value, to replace the existing `node.nodes` array. + * @api public + */ + +utils.toNoop = function(node, nodes) { + if (nodes) { + node.nodes = nodes; + } else { + delete node.nodes; + node.type = 'text'; + node.val = ''; + } +}; + +/** + * Visit `node` with the given `fn`. The built-in `.visit` method in snapdragon + * automatically calls registered compilers, this allows you to pass a visitor + * function. + * + * ```js + * snapdragon.compiler.set('i', function(node) { + * utils.visit(node, function(childNode) { + * // do stuff with "childNode" + * return childNode; + * }); + * }); + * ``` + * @param {Object} `node` Instance of [snapdragon-node][] + * @param {Function} `fn` + * @return {Object} returns the node after recursively visiting all child nodes. + * @api public + */ + +utils.visit = function(node, fn) { + assert(utils.isNode(node), 'expected node to be an instance of Node'); + assert(isFunction(fn), 'expected a visitor function'); + fn(node); + return node.nodes ? utils.mapVisit(node, fn) : node; +}; + +/** + * Map [visit](#visit) the given `fn` over `node.nodes`. This is called by + * [visit](#visit), use this method if you do not want `fn` to be called on + * the first node. + * + * ```js + * snapdragon.compiler.set('i', function(node) { + * utils.mapVisit(node, function(childNode) { + * // do stuff with "childNode" + * return childNode; + * }); + * }); + * ``` + * @param {Object} `node` Instance of [snapdragon-node][] + * @param {Object} `options` + * @param {Function} `fn` + * @return {Object} returns the node + * @api public + */ + +utils.mapVisit = function(node, fn) { + assert(utils.isNode(node), 'expected node to be an instance of Node'); + assert(isArray(node.nodes), 'expected node.nodes to be an array'); + assert(isFunction(fn), 'expected a visitor function'); + + for (var i = 0; i < node.nodes.length; i++) { + utils.visit(node.nodes[i], fn); + } + return node; +}; + +/** + * Unshift an `*.open` node onto `node.nodes`. + * + * ```js + * var Node = require('snapdragon-node'); + * snapdragon.parser.set('brace', function(node) { + * var match = this.match(/^{/); + * if (match) { + * var parent = new Node({type: 'brace'}); + * utils.addOpen(parent, Node); + * console.log(parent.nodes[0]): + * // { type: 'brace.open', val: '' }; + * + * // push the parent "brace" node onto the stack + * this.push(parent); + * + * // return the parent node, so it's also added to the AST + * return brace; + * } + * }); + * ``` + * @param {Object} `node` Instance of [snapdragon-node][] + * @param {Function} `Node` (required) Node constructor function from [snapdragon-node][]. + * @param {Function} `filter` Optionaly specify a filter function to exclude the node. + * @return {Object} Returns the created opening node. + * @api public + */ + +utils.addOpen = function(node, Node, val, filter) { + assert(utils.isNode(node), 'expected node to be an instance of Node'); + assert(isFunction(Node), 'expected Node to be a constructor function'); + + if (typeof val === 'function') { + filter = val; + val = ''; + } + + if (typeof filter === 'function' && !filter(node)) return; + var open = new Node({ type: node.type + '.open', val: val}); + var unshift = node.unshift || node.unshiftNode; + if (typeof unshift === 'function') { + unshift.call(node, open); + } else { + utils.unshiftNode(node, open); + } + return open; +}; + +/** + * Push a `*.close` node onto `node.nodes`. + * + * ```js + * var Node = require('snapdragon-node'); + * snapdragon.parser.set('brace', function(node) { + * var match = this.match(/^}/); + * if (match) { + * var parent = this.parent(); + * if (parent.type !== 'brace') { + * throw new Error('missing opening: ' + '}'); + * } + * + * utils.addClose(parent, Node); + * console.log(parent.nodes[parent.nodes.length - 1]): + * // { type: 'brace.close', val: '' }; + * + * // no need to return a node, since the parent + * // was already added to the AST + * return; + * } + * }); + * ``` + * @param {Object} `node` Instance of [snapdragon-node][] + * @param {Function} `Node` (required) Node constructor function from [snapdragon-node][]. + * @param {Function} `filter` Optionaly specify a filter function to exclude the node. + * @return {Object} Returns the created closing node. + * @api public + */ + +utils.addClose = function(node, Node, val, filter) { + assert(utils.isNode(node), 'expected node to be an instance of Node'); + assert(isFunction(Node), 'expected Node to be a constructor function'); + + if (typeof val === 'function') { + filter = val; + val = ''; + } + + if (typeof filter === 'function' && !filter(node)) return; + var close = new Node({ type: node.type + '.close', val: val}); + var push = node.push || node.pushNode; + if (typeof push === 'function') { + push.call(node, close); + } else { + utils.pushNode(node, close); + } + return close; +}; + +/** + * Wraps the given `node` with `*.open` and `*.close` nodes. + * + * @param {Object} `node` Instance of [snapdragon-node][] + * @param {Function} `Node` (required) Node constructor function from [snapdragon-node][]. + * @param {Function} `filter` Optionaly specify a filter function to exclude the node. + * @return {Object} Returns the node + * @api public + */ + +utils.wrapNodes = function(node, Node, filter) { + assert(utils.isNode(node), 'expected node to be an instance of Node'); + assert(isFunction(Node), 'expected Node to be a constructor function'); + + utils.addOpen(node, Node, filter); + utils.addClose(node, Node, filter); + return node; +}; + +/** + * Push the given `node` onto `parent.nodes`, and set `parent` as `node.parent. + * + * ```js + * var parent = new Node({type: 'foo'}); + * var node = new Node({type: 'bar'}); + * utils.pushNode(parent, node); + * console.log(parent.nodes[0].type) // 'bar' + * console.log(node.parent.type) // 'foo' + * ``` + * @param {Object} `parent` + * @param {Object} `node` Instance of [snapdragon-node][] + * @return {Object} Returns the child node + * @api public + */ + +utils.pushNode = function(parent, node) { + assert(utils.isNode(parent), 'expected parent node to be an instance of Node'); + assert(utils.isNode(node), 'expected node to be an instance of Node'); + + node.define('parent', parent); + parent.nodes = parent.nodes || []; + parent.nodes.push(node); + return node; +}; + +/** + * Unshift `node` onto `parent.nodes`, and set `parent` as `node.parent. + * + * ```js + * var parent = new Node({type: 'foo'}); + * var node = new Node({type: 'bar'}); + * utils.unshiftNode(parent, node); + * console.log(parent.nodes[0].type) // 'bar' + * console.log(node.parent.type) // 'foo' + * ``` + * @param {Object} `parent` + * @param {Object} `node` Instance of [snapdragon-node][] + * @return {undefined} + * @api public + */ + +utils.unshiftNode = function(parent, node) { + assert(utils.isNode(parent), 'expected parent node to be an instance of Node'); + assert(utils.isNode(node), 'expected node to be an instance of Node'); + + node.define('parent', parent); + parent.nodes = parent.nodes || []; + parent.nodes.unshift(node); +}; + +/** + * Pop the last `node` off of `parent.nodes`. The advantage of + * using this method is that it checks for `node.nodes` and works + * with any version of `snapdragon-node`. + * + * ```js + * var parent = new Node({type: 'foo'}); + * utils.pushNode(parent, new Node({type: 'foo'})); + * utils.pushNode(parent, new Node({type: 'bar'})); + * utils.pushNode(parent, new Node({type: 'baz'})); + * console.log(parent.nodes.length); //=> 3 + * utils.popNode(parent); + * console.log(parent.nodes.length); //=> 2 + * ``` + * @param {Object} `parent` + * @param {Object} `node` Instance of [snapdragon-node][] + * @return {Number|Undefined} Returns the length of `node.nodes` or undefined. + * @api public + */ + +utils.popNode = function(node) { + assert(utils.isNode(node), 'expected node to be an instance of Node'); + if (typeof node.pop === 'function') { + return node.pop(); + } + return node.nodes && node.nodes.pop(); +}; + +/** + * Shift the first `node` off of `parent.nodes`. The advantage of + * using this method is that it checks for `node.nodes` and works + * with any version of `snapdragon-node`. + * + * ```js + * var parent = new Node({type: 'foo'}); + * utils.pushNode(parent, new Node({type: 'foo'})); + * utils.pushNode(parent, new Node({type: 'bar'})); + * utils.pushNode(parent, new Node({type: 'baz'})); + * console.log(parent.nodes.length); //=> 3 + * utils.shiftNode(parent); + * console.log(parent.nodes.length); //=> 2 + * ``` + * @param {Object} `parent` + * @param {Object} `node` Instance of [snapdragon-node][] + * @return {Number|Undefined} Returns the length of `node.nodes` or undefined. + * @api public + */ + +utils.shiftNode = function(node) { + assert(utils.isNode(node), 'expected node to be an instance of Node'); + if (typeof node.shift === 'function') { + return node.shift(); + } + return node.nodes && node.nodes.shift(); +}; + +/** + * Remove the specified `node` from `parent.nodes`. + * + * ```js + * var parent = new Node({type: 'abc'}); + * var foo = new Node({type: 'foo'}); + * utils.pushNode(parent, foo); + * utils.pushNode(parent, new Node({type: 'bar'})); + * utils.pushNode(parent, new Node({type: 'baz'})); + * console.log(parent.nodes.length); //=> 3 + * utils.removeNode(parent, foo); + * console.log(parent.nodes.length); //=> 2 + * ``` + * @param {Object} `parent` + * @param {Object} `node` Instance of [snapdragon-node][] + * @return {Object|undefined} Returns the removed node, if successful, or undefined if it does not exist on `parent.nodes`. + * @api public + */ + +utils.removeNode = function(parent, node) { + assert(utils.isNode(parent), 'expected parent.node to be an instance of Node'); + assert(utils.isNode(node), 'expected node to be an instance of Node'); + + if (!parent.nodes) { + return null; + } + + if (typeof parent.remove === 'function') { + return parent.remove(node); + } + + var idx = parent.nodes.indexOf(node); + if (idx !== -1) { + return parent.nodes.splice(idx, 1); + } +}; + +/** + * Returns true if `node.type` matches the given `type`. Throws a + * `TypeError` if `node` is not an instance of `Node`. + * + * ```js + * var Node = require('snapdragon-node'); + * var node = new Node({type: 'foo'}); + * console.log(utils.isType(node, 'foo')); // false + * console.log(utils.isType(node, 'bar')); // true + * ``` + * @param {Object} `node` Instance of [snapdragon-node][] + * @param {String} `type` + * @return {Boolean} + * @api public + */ + +utils.isType = function(node, type) { + assert(utils.isNode(node), 'expected node to be an instance of Node'); + switch (typeOf(type)) { + case 'array': + var types = type.slice(); + for (var i = 0; i < types.length; i++) { + if (utils.isType(node, types[i])) { + return true; + } + } + return false; + case 'string': + return node.type === type; + case 'regexp': + return type.test(node.type); + default: { + throw new TypeError('expected "type" to be an array, string or regexp'); + } + } +}; + +/** + * Returns true if the given `node` has the given `type` in `node.nodes`. + * Throws a `TypeError` if `node` is not an instance of `Node`. + * + * ```js + * var Node = require('snapdragon-node'); + * var node = new Node({ + * type: 'foo', + * nodes: [ + * new Node({type: 'bar'}), + * new Node({type: 'baz'}) + * ] + * }); + * console.log(utils.hasType(node, 'xyz')); // false + * console.log(utils.hasType(node, 'baz')); // true + * ``` + * @param {Object} `node` Instance of [snapdragon-node][] + * @param {String} `type` + * @return {Boolean} + * @api public + */ + +utils.hasType = function(node, type) { + assert(utils.isNode(node), 'expected node to be an instance of Node'); + if (!Array.isArray(node.nodes)) return false; + for (var i = 0; i < node.nodes.length; i++) { + if (utils.isType(node.nodes[i], type)) { + return true; + } + } + return false; +}; + +/** + * Returns the first node from `node.nodes` of the given `type` + * + * ```js + * var node = new Node({ + * type: 'foo', + * nodes: [ + * new Node({type: 'text', val: 'abc'}), + * new Node({type: 'text', val: 'xyz'}) + * ] + * }); + * + * var textNode = utils.firstOfType(node.nodes, 'text'); + * console.log(textNode.val); + * //=> 'abc' + * ``` + * @param {Array} `nodes` + * @param {String} `type` + * @return {Object|undefined} Returns the first matching node or undefined. + * @api public + */ + +utils.firstOfType = function(nodes, type) { + for (var i = 0; i < nodes.length; i++) { + var node = nodes[i]; + if (utils.isType(node, type)) { + return node; + } + } +}; + +/** + * Returns the node at the specified index, or the first node of the + * given `type` from `node.nodes`. + * + * ```js + * var node = new Node({ + * type: 'foo', + * nodes: [ + * new Node({type: 'text', val: 'abc'}), + * new Node({type: 'text', val: 'xyz'}) + * ] + * }); + * + * var nodeOne = utils.findNode(node.nodes, 'text'); + * console.log(nodeOne.val); + * //=> 'abc' + * + * var nodeTwo = utils.findNode(node.nodes, 1); + * console.log(nodeTwo.val); + * //=> 'xyz' + * ``` + * + * @param {Array} `nodes` + * @param {String|Number} `type` Node type or index. + * @return {Object} Returns a node or undefined. + * @api public + */ + +utils.findNode = function(nodes, type) { + if (!Array.isArray(nodes)) { + return null; + } + if (typeof type === 'number') { + return nodes[type]; + } + return utils.firstOfType(nodes, type); +}; + +/** + * Returns true if the given node is an "*.open" node. + * + * ```js + * var Node = require('snapdragon-node'); + * var brace = new Node({type: 'brace'}); + * var open = new Node({type: 'brace.open'}); + * var close = new Node({type: 'brace.close'}); + * + * console.log(utils.isOpen(brace)); // false + * console.log(utils.isOpen(open)); // true + * console.log(utils.isOpen(close)); // false + * ``` + * @param {Object} `node` Instance of [snapdragon-node][] + * @return {Boolean} + * @api public + */ + +utils.isOpen = function(node) { + assert(utils.isNode(node), 'expected node to be an instance of Node'); + return node.type.slice(-5) === '.open'; +}; + +/** + * Returns true if the given node is a "*.close" node. + * + * ```js + * var Node = require('snapdragon-node'); + * var brace = new Node({type: 'brace'}); + * var open = new Node({type: 'brace.open'}); + * var close = new Node({type: 'brace.close'}); + * + * console.log(utils.isClose(brace)); // false + * console.log(utils.isClose(open)); // false + * console.log(utils.isClose(close)); // true + * ``` + * @param {Object} `node` Instance of [snapdragon-node][] + * @return {Boolean} + * @api public + */ + +utils.isClose = function(node) { + assert(utils.isNode(node), 'expected node to be an instance of Node'); + return node.type.slice(-6) === '.close'; +}; + +/** + * Returns true if `node.nodes` **has** an `.open` node + * + * ```js + * var Node = require('snapdragon-node'); + * var brace = new Node({ + * type: 'brace', + * nodes: [] + * }); + * + * var open = new Node({type: 'brace.open'}); + * console.log(utils.hasOpen(brace)); // false + * + * brace.pushNode(open); + * console.log(utils.hasOpen(brace)); // true + * ``` + * @param {Object} `node` Instance of [snapdragon-node][] + * @return {Boolean} + * @api public + */ + +utils.hasOpen = function(node) { + assert(utils.isNode(node), 'expected node to be an instance of Node'); + var first = node.first || node.nodes ? node.nodes[0] : null; + if (utils.isNode(first)) { + return first.type === node.type + '.open'; + } + return false; +}; + +/** + * Returns true if `node.nodes` **has** a `.close` node + * + * ```js + * var Node = require('snapdragon-node'); + * var brace = new Node({ + * type: 'brace', + * nodes: [] + * }); + * + * var close = new Node({type: 'brace.close'}); + * console.log(utils.hasClose(brace)); // false + * + * brace.pushNode(close); + * console.log(utils.hasClose(brace)); // true + * ``` + * @param {Object} `node` Instance of [snapdragon-node][] + * @return {Boolean} + * @api public + */ + +utils.hasClose = function(node) { + assert(utils.isNode(node), 'expected node to be an instance of Node'); + var last = node.last || node.nodes ? node.nodes[node.nodes.length - 1] : null; + if (utils.isNode(last)) { + return last.type === node.type + '.close'; + } + return false; +}; + +/** + * Returns true if `node.nodes` has both `.open` and `.close` nodes + * + * ```js + * var Node = require('snapdragon-node'); + * var brace = new Node({ + * type: 'brace', + * nodes: [] + * }); + * + * var open = new Node({type: 'brace.open'}); + * var close = new Node({type: 'brace.close'}); + * console.log(utils.hasOpen(brace)); // false + * console.log(utils.hasClose(brace)); // false + * + * brace.pushNode(open); + * brace.pushNode(close); + * console.log(utils.hasOpen(brace)); // true + * console.log(utils.hasClose(brace)); // true + * ``` + * @param {Object} `node` Instance of [snapdragon-node][] + * @return {Boolean} + * @api public + */ + +utils.hasOpenAndClose = function(node) { + return utils.hasOpen(node) && utils.hasClose(node); +}; + +/** + * Push the given `node` onto the `state.inside` array for the + * given type. This array is used as a specialized "stack" for + * only the given `node.type`. + * + * ```js + * var state = { inside: {}}; + * var node = new Node({type: 'brace'}); + * utils.addType(state, node); + * console.log(state.inside); + * //=> { brace: [{type: 'brace'}] } + * ``` + * @param {Object} `state` The `compiler.state` object or custom state object. + * @param {Object} `node` Instance of [snapdragon-node][] + * @return {Array} Returns the `state.inside` stack for the given type. + * @api public + */ + +utils.addType = function(state, node) { + assert(utils.isNode(node), 'expected node to be an instance of Node'); + assert(isObject(state), 'expected state to be an object'); + + var type = node.parent + ? node.parent.type + : node.type.replace(/\.open$/, ''); + + if (!state.hasOwnProperty('inside')) { + state.inside = {}; + } + if (!state.inside.hasOwnProperty(type)) { + state.inside[type] = []; + } + + var arr = state.inside[type]; + arr.push(node); + return arr; +}; + +/** + * Remove the given `node` from the `state.inside` array for the + * given type. This array is used as a specialized "stack" for + * only the given `node.type`. + * + * ```js + * var state = { inside: {}}; + * var node = new Node({type: 'brace'}); + * utils.addType(state, node); + * console.log(state.inside); + * //=> { brace: [{type: 'brace'}] } + * utils.removeType(state, node); + * //=> { brace: [] } + * ``` + * @param {Object} `state` The `compiler.state` object or custom state object. + * @param {Object} `node` Instance of [snapdragon-node][] + * @return {Array} Returns the `state.inside` stack for the given type. + * @api public + */ + +utils.removeType = function(state, node) { + assert(utils.isNode(node), 'expected node to be an instance of Node'); + assert(isObject(state), 'expected state to be an object'); + + var type = node.parent + ? node.parent.type + : node.type.replace(/\.close$/, ''); + + if (state.inside.hasOwnProperty(type)) { + return state.inside[type].pop(); + } +}; + +/** + * Returns true if `node.val` is an empty string, or `node.nodes` does + * not contain any non-empty text nodes. + * + * ```js + * var node = new Node({type: 'text'}); + * utils.isEmpty(node); //=> true + * node.val = 'foo'; + * utils.isEmpty(node); //=> false + * ``` + * @param {Object} `node` Instance of [snapdragon-node][] + * @param {Function} `fn` + * @return {Boolean} + * @api public + */ + +utils.isEmpty = function(node, fn) { + assert(utils.isNode(node), 'expected node to be an instance of Node'); + + if (!Array.isArray(node.nodes)) { + if (node.type !== 'text') { + return true; + } + if (typeof fn === 'function') { + return fn(node, node.parent); + } + return !utils.trim(node.val); + } + + for (var i = 0; i < node.nodes.length; i++) { + var child = node.nodes[i]; + if (utils.isOpen(child) || utils.isClose(child)) { + continue; + } + if (!utils.isEmpty(child, fn)) { + return false; + } + } + + return true; +}; + +/** + * Returns true if the `state.inside` stack for the given type exists + * and has one or more nodes on it. + * + * ```js + * var state = { inside: {}}; + * var node = new Node({type: 'brace'}); + * console.log(utils.isInsideType(state, 'brace')); //=> false + * utils.addType(state, node); + * console.log(utils.isInsideType(state, 'brace')); //=> true + * utils.removeType(state, node); + * console.log(utils.isInsideType(state, 'brace')); //=> false + * ``` + * @param {Object} `state` + * @param {String} `type` + * @return {Boolean} + * @api public + */ + +utils.isInsideType = function(state, type) { + assert(isObject(state), 'expected state to be an object'); + assert(isString(type), 'expected type to be a string'); + + if (!state.hasOwnProperty('inside')) { + return false; + } + + if (!state.inside.hasOwnProperty(type)) { + return false; + } + + return state.inside[type].length > 0; +}; + +/** + * Returns true if `node` is either a child or grand-child of the given `type`, + * or `state.inside[type]` is a non-empty array. + * + * ```js + * var state = { inside: {}}; + * var node = new Node({type: 'brace'}); + * var open = new Node({type: 'brace.open'}); + * console.log(utils.isInside(state, open, 'brace')); //=> false + * utils.pushNode(node, open); + * console.log(utils.isInside(state, open, 'brace')); //=> true + * ``` + * @param {Object} `state` Either the `compiler.state` object, if it exists, or a user-supplied state object. + * @param {Object} `node` Instance of [snapdragon-node][] + * @param {String} `type` The `node.type` to check for. + * @return {Boolean} + * @api public + */ + +utils.isInside = function(state, node, type) { + assert(utils.isNode(node), 'expected node to be an instance of Node'); + assert(isObject(state), 'expected state to be an object'); + + if (Array.isArray(type)) { + for (var i = 0; i < type.length; i++) { + if (utils.isInside(state, node, type[i])) { + return true; + } + } + return false; + } + + var parent = node.parent; + if (typeof type === 'string') { + return (parent && parent.type === type) || utils.isInsideType(state, type); + } + + if (typeOf(type) === 'regexp') { + if (parent && parent.type && type.test(parent.type)) { + return true; + } + + var keys = Object.keys(state.inside); + var len = keys.length; + var idx = -1; + while (++idx < len) { + var key = keys[idx]; + var val = state.inside[key]; + + if (Array.isArray(val) && val.length !== 0 && type.test(key)) { + return true; + } + } + } + return false; +}; + +/** + * Get the last `n` element from the given `array`. Used for getting + * a node from `node.nodes.` + * + * @param {Array} `array` + * @param {Number} `n` + * @return {undefined} + * @api public + */ + +utils.last = function(arr, n) { + return arr[arr.length - (n || 1)]; +}; + +/** + * Cast the given `val` to an array. + * + * ```js + * console.log(utils.arrayify('')); + * //=> [] + * console.log(utils.arrayify('foo')); + * //=> ['foo'] + * console.log(utils.arrayify(['foo'])); + * //=> ['foo'] + * ``` + * @param {any} `val` + * @return {Array} + * @api public + */ + +utils.arrayify = function(val) { + if (typeof val === 'string' && val !== '') { + return [val]; + } + if (!Array.isArray(val)) { + return []; + } + return val; +}; + +/** + * Convert the given `val` to a string by joining with `,`. Useful + * for creating a cheerio/CSS/DOM-style selector from a list of strings. + * + * @param {any} `val` + * @return {Array} + * @api public + */ + +utils.stringify = function(val) { + return utils.arrayify(val).join(','); +}; + +/** + * Ensure that the given value is a string and call `.trim()` on it, + * or return an empty string. + * + * @param {String} `str` + * @return {String} + * @api public + */ + +utils.trim = function(str) { + return typeof str === 'string' ? str.trim() : ''; +}; + +/** + * Return true if val is an object + */ + +function isObject(val) { + return typeOf(val) === 'object'; +} + +/** + * Return true if val is a string + */ + +function isString(val) { + return typeof val === 'string'; +} + +/** + * Return true if val is a function + */ + +function isFunction(val) { + return typeof val === 'function'; +} + +/** + * Return true if val is an array + */ + +function isArray(val) { + return Array.isArray(val); +} + +/** + * Shim to ensure the `.append` methods work with any version of snapdragon + */ + +function append(compiler, val, node) { + if (typeof compiler.append !== 'function') { + return compiler.emit(val, node); + } + return compiler.append(val, node); +} + +/** + * Simplified assertion. Throws an error is `val` is falsey. + */ + +function assert(val, message) { + if (!val) throw new Error(message); +} + + +/***/ }), +/* 767 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var extend = __webpack_require__(738); +var Snapdragon = __webpack_require__(768); +var compilers = __webpack_require__(742); +var parsers = __webpack_require__(757); +var utils = __webpack_require__(743); + +/** + * Customize Snapdragon parser and renderer + */ + +function Braces(options) { + this.options = extend({}, options); +} + +/** + * Initialize braces + */ + +Braces.prototype.init = function(options) { + if (this.isInitialized) return; + this.isInitialized = true; + var opts = utils.createOptions({}, this.options, options); + this.snapdragon = this.options.snapdragon || new Snapdragon(opts); + this.compiler = this.snapdragon.compiler; + this.parser = this.snapdragon.parser; + + compilers(this.snapdragon, opts); + parsers(this.snapdragon, opts); + + /** + * Call Snapdragon `.parse` method. When AST is returned, we check to + * see if any unclosed braces are left on the stack and, if so, we iterate + * over the stack and correct the AST so that compilers are called in the correct + * order and unbalance braces are properly escaped. + */ + + utils.define(this.snapdragon, 'parse', function(pattern, options) { + var parsed = Snapdragon.prototype.parse.apply(this, arguments); + this.parser.ast.input = pattern; + + var stack = this.parser.stack; + while (stack.length) { + addParent({type: 'brace.close', val: ''}, stack.pop()); + } + + function addParent(node, parent) { + utils.define(node, 'parent', parent); + parent.nodes.push(node); + } + + // add non-enumerable parser reference + utils.define(parsed, 'parser', this.parser); + return parsed; + }); +}; + +/** + * Decorate `.parse` method + */ + +Braces.prototype.parse = function(ast, options) { + if (ast && typeof ast === 'object' && ast.nodes) return ast; + this.init(options); + return this.snapdragon.parse(ast, options); +}; + +/** + * Decorate `.compile` method + */ + +Braces.prototype.compile = function(ast, options) { + if (typeof ast === 'string') { + ast = this.parse(ast, options); + } else { + this.init(options); + } + return this.snapdragon.compile(ast, options); +}; + +/** + * Expand + */ + +Braces.prototype.expand = function(pattern) { + var ast = this.parse(pattern, {expand: true}); + return this.compile(ast, {expand: true}); +}; + +/** + * Optimize + */ + +Braces.prototype.optimize = function(pattern) { + var ast = this.parse(pattern, {optimize: true}); + return this.compile(ast, {optimize: true}); +}; + +/** + * Expose `Braces` + */ + +module.exports = Braces; + + +/***/ }), +/* 768 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var Base = __webpack_require__(769); +var define = __webpack_require__(730); +var Compiler = __webpack_require__(798); +var Parser = __webpack_require__(827); +var utils = __webpack_require__(807); +var regexCache = {}; +var cache = {}; + +/** + * Create a new instance of `Snapdragon` with the given `options`. + * + * ```js + * var snapdragon = new Snapdragon(); + * ``` + * + * @param {Object} `options` + * @api public + */ + +function Snapdragon(options) { + Base.call(this, null, options); + this.options = utils.extend({source: 'string'}, this.options); + this.compiler = new Compiler(this.options); + this.parser = new Parser(this.options); + + Object.defineProperty(this, 'compilers', { + get: function() { + return this.compiler.compilers; + } + }); + + Object.defineProperty(this, 'parsers', { + get: function() { + return this.parser.parsers; + } + }); + + Object.defineProperty(this, 'regex', { + get: function() { + return this.parser.regex; + } + }); +} + +/** + * Inherit Base + */ + +Base.extend(Snapdragon); + +/** + * Add a parser to `snapdragon.parsers` for capturing the given `type` using + * the specified regex or parser function. A function is useful if you need + * to customize how the token is created and/or have access to the parser + * instance to check options, etc. + * + * ```js + * snapdragon + * .capture('slash', /^\//) + * .capture('dot', function() { + * var pos = this.position(); + * var m = this.match(/^\./); + * if (!m) return; + * return pos({ + * type: 'dot', + * val: m[0] + * }); + * }); + * ``` + * @param {String} `type` + * @param {RegExp|Function} `regex` + * @return {Object} Returns the parser instance for chaining + * @api public + */ + +Snapdragon.prototype.capture = function() { + return this.parser.capture.apply(this.parser, arguments); +}; + +/** + * Register a plugin `fn`. + * + * ```js + * var snapdragon = new Snapdgragon([options]); + * snapdragon.use(function() { + * console.log(this); //<= snapdragon instance + * console.log(this.parser); //<= parser instance + * console.log(this.compiler); //<= compiler instance + * }); + * ``` + * @param {Object} `fn` + * @api public + */ + +Snapdragon.prototype.use = function(fn) { + fn.call(this, this); + return this; +}; + +/** + * Parse the given `str`. + * + * ```js + * var snapdragon = new Snapdgragon([options]); + * // register parsers + * snapdragon.parser.use(function() {}); + * + * // parse + * var ast = snapdragon.parse('foo/bar'); + * console.log(ast); + * ``` + * @param {String} `str` + * @param {Object} `options` Set `options.sourcemap` to true to enable source maps. + * @return {Object} Returns an AST. + * @api public + */ + +Snapdragon.prototype.parse = function(str, options) { + this.options = utils.extend({}, this.options, options); + var parsed = this.parser.parse(str, this.options); + + // add non-enumerable parser reference + define(parsed, 'parser', this.parser); + return parsed; +}; + +/** + * Compile the given `AST`. + * + * ```js + * var snapdragon = new Snapdgragon([options]); + * // register plugins + * snapdragon.use(function() {}); + * // register parser plugins + * snapdragon.parser.use(function() {}); + * // register compiler plugins + * snapdragon.compiler.use(function() {}); + * + * // parse + * var ast = snapdragon.parse('foo/bar'); + * + * // compile + * var res = snapdragon.compile(ast); + * console.log(res.output); + * ``` + * @param {Object} `ast` + * @param {Object} `options` + * @return {Object} Returns an object with an `output` property with the rendered string. + * @api public + */ + +Snapdragon.prototype.compile = function(ast, options) { + this.options = utils.extend({}, this.options, options); + var compiled = this.compiler.compile(ast, this.options); + + // add non-enumerable compiler reference + define(compiled, 'compiler', this.compiler); + return compiled; +}; + +/** + * Expose `Snapdragon` + */ + +module.exports = Snapdragon; + +/** + * Expose `Parser` and `Compiler` + */ + +module.exports.Compiler = Compiler; +module.exports.Parser = Parser; + + +/***/ }), +/* 769 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var util = __webpack_require__(29); +var define = __webpack_require__(770); +var CacheBase = __webpack_require__(771); +var Emitter = __webpack_require__(772); +var isObject = __webpack_require__(748); +var merge = __webpack_require__(789); +var pascal = __webpack_require__(792); +var cu = __webpack_require__(793); + +/** + * Optionally define a custom `cache` namespace to use. + */ + +function namespace(name) { + var Cache = name ? CacheBase.namespace(name) : CacheBase; + var fns = []; + + /** + * Create an instance of `Base` with the given `config` and `options`. + * + * ```js + * // initialize with `config` and `options` + * var app = new Base({isApp: true}, {abc: true}); + * app.set('foo', 'bar'); + * + * // values defined with the given `config` object will be on the root of the instance + * console.log(app.baz); //=> undefined + * console.log(app.foo); //=> 'bar' + * // or use `.get` + * console.log(app.get('isApp')); //=> true + * console.log(app.get('foo')); //=> 'bar' + * + * // values defined with the given `options` object will be on `app.options + * console.log(app.options.abc); //=> true + * ``` + * + * @param {Object} `config` If supplied, this object is passed to [cache-base][] to merge onto the the instance upon instantiation. + * @param {Object} `options` If supplied, this object is used to initialize the `base.options` object. + * @api public + */ + + function Base(config, options) { + if (!(this instanceof Base)) { + return new Base(config, options); + } + Cache.call(this, config); + this.is('base'); + this.initBase(config, options); + } + + /** + * Inherit cache-base + */ + + util.inherits(Base, Cache); + + /** + * Add static emitter methods + */ + + Emitter(Base); + + /** + * Initialize `Base` defaults with the given `config` object + */ + + Base.prototype.initBase = function(config, options) { + this.options = merge({}, this.options, options); + this.cache = this.cache || {}; + this.define('registered', {}); + if (name) this[name] = {}; + + // make `app._callbacks` non-enumerable + this.define('_callbacks', this._callbacks); + if (isObject(config)) { + this.visit('set', config); + } + Base.run(this, 'use', fns); + }; + + /** + * Set the given `name` on `app._name` and `app.is*` properties. Used for doing + * lookups in plugins. + * + * ```js + * app.is('foo'); + * console.log(app._name); + * //=> 'foo' + * console.log(app.isFoo); + * //=> true + * app.is('bar'); + * console.log(app.isFoo); + * //=> true + * console.log(app.isBar); + * //=> true + * console.log(app._name); + * //=> 'bar' + * ``` + * @name .is + * @param {String} `name` + * @return {Boolean} + * @api public + */ + + Base.prototype.is = function(name) { + if (typeof name !== 'string') { + throw new TypeError('expected name to be a string'); + } + this.define('is' + pascal(name), true); + this.define('_name', name); + this.define('_appname', name); + return this; + }; + + /** + * Returns true if a plugin has already been registered on an instance. + * + * Plugin implementors are encouraged to use this first thing in a plugin + * to prevent the plugin from being called more than once on the same + * instance. + * + * ```js + * var base = new Base(); + * base.use(function(app) { + * if (app.isRegistered('myPlugin')) return; + * // do stuff to `app` + * }); + * + * // to also record the plugin as being registered + * base.use(function(app) { + * if (app.isRegistered('myPlugin', true)) return; + * // do stuff to `app` + * }); + * ``` + * @name .isRegistered + * @emits `plugin` Emits the name of the plugin being registered. Useful for unit tests, to ensure plugins are only registered once. + * @param {String} `name` The plugin name. + * @param {Boolean} `register` If the plugin if not already registered, to record it as being registered pass `true` as the second argument. + * @return {Boolean} Returns true if a plugin is already registered. + * @api public + */ + + Base.prototype.isRegistered = function(name, register) { + if (this.registered.hasOwnProperty(name)) { + return true; + } + if (register !== false) { + this.registered[name] = true; + this.emit('plugin', name); + } + return false; + }; + + /** + * Define a plugin function to be called immediately upon init. Plugins are chainable + * and expose the following arguments to the plugin function: + * + * - `app`: the current instance of `Base` + * - `base`: the [first ancestor instance](#base) of `Base` + * + * ```js + * var app = new Base() + * .use(foo) + * .use(bar) + * .use(baz) + * ``` + * @name .use + * @param {Function} `fn` plugin function to call + * @return {Object} Returns the item instance for chaining. + * @api public + */ + + Base.prototype.use = function(fn) { + fn.call(this, this); + return this; + }; + + /** + * The `.define` method is used for adding non-enumerable property on the instance. + * Dot-notation is **not supported** with `define`. + * + * ```js + * // arbitrary `render` function using lodash `template` + * app.define('render', function(str, locals) { + * return _.template(str)(locals); + * }); + * ``` + * @name .define + * @param {String} `key` The name of the property to define. + * @param {any} `value` + * @return {Object} Returns the instance for chaining. + * @api public + */ + + Base.prototype.define = function(key, val) { + if (isObject(key)) { + return this.visit('define', key); + } + define(this, key, val); + return this; + }; + + /** + * Mix property `key` onto the Base prototype. If base is inherited using + * `Base.extend` this method will be overridden by a new `mixin` method that will + * only add properties to the prototype of the inheriting application. + * + * ```js + * app.mixin('foo', function() { + * // do stuff + * }); + * ``` + * @name .mixin + * @param {String} `key` + * @param {Object|Array} `val` + * @return {Object} Returns the `base` instance for chaining. + * @api public + */ + + Base.prototype.mixin = function(key, val) { + Base.prototype[key] = val; + return this; + }; + + /** + * Non-enumberable mixin array, used by the static [Base.mixin]() method. + */ + + Base.prototype.mixins = Base.prototype.mixins || []; + + /** + * Getter/setter used when creating nested instances of `Base`, for storing a reference + * to the first ancestor instance. This works by setting an instance of `Base` on the `parent` + * property of a "child" instance. The `base` property defaults to the current instance if + * no `parent` property is defined. + * + * ```js + * // create an instance of `Base`, this is our first ("base") instance + * var first = new Base(); + * first.foo = 'bar'; // arbitrary property, to make it easier to see what's happening later + * + * // create another instance + * var second = new Base(); + * // create a reference to the first instance (`first`) + * second.parent = first; + * + * // create another instance + * var third = new Base(); + * // create a reference to the previous instance (`second`) + * // repeat this pattern every time a "child" instance is created + * third.parent = second; + * + * // we can always access the first instance using the `base` property + * console.log(first.base.foo); + * //=> 'bar' + * console.log(second.base.foo); + * //=> 'bar' + * console.log(third.base.foo); + * //=> 'bar' + * // and now you know how to get to third base ;) + * ``` + * @name .base + * @api public + */ + + Object.defineProperty(Base.prototype, 'base', { + configurable: true, + get: function() { + return this.parent ? this.parent.base : this; + } + }); + + /** + * Static method for adding global plugin functions that will + * be added to an instance when created. + * + * ```js + * Base.use(function(app) { + * app.foo = 'bar'; + * }); + * var app = new Base(); + * console.log(app.foo); + * //=> 'bar' + * ``` + * @name #use + * @param {Function} `fn` Plugin function to use on each instance. + * @return {Object} Returns the `Base` constructor for chaining + * @api public + */ + + define(Base, 'use', function(fn) { + fns.push(fn); + return Base; + }); + + /** + * Run an array of functions by passing each function + * to a method on the given object specified by the given property. + * + * @param {Object} `obj` Object containing method to use. + * @param {String} `prop` Name of the method on the object to use. + * @param {Array} `arr` Array of functions to pass to the method. + */ + + define(Base, 'run', function(obj, prop, arr) { + var len = arr.length, i = 0; + while (len--) { + obj[prop](arr[i++]); + } + return Base; + }); + + /** + * Static method for inheriting the prototype and static methods of the `Base` class. + * This method greatly simplifies the process of creating inheritance-based applications. + * See [static-extend][] for more details. + * + * ```js + * var extend = cu.extend(Parent); + * Parent.extend(Child); + * + * // optional methods + * Parent.extend(Child, { + * foo: function() {}, + * bar: function() {} + * }); + * ``` + * @name #extend + * @param {Function} `Ctor` constructor to extend + * @param {Object} `methods` Optional prototype properties to mix in. + * @return {Object} Returns the `Base` constructor for chaining + * @api public + */ + + define(Base, 'extend', cu.extend(Base, function(Ctor, Parent) { + Ctor.prototype.mixins = Ctor.prototype.mixins || []; + + define(Ctor, 'mixin', function(fn) { + var mixin = fn(Ctor.prototype, Ctor); + if (typeof mixin === 'function') { + Ctor.prototype.mixins.push(mixin); + } + return Ctor; + }); + + define(Ctor, 'mixins', function(Child) { + Base.run(Child, 'mixin', Ctor.prototype.mixins); + return Ctor; + }); + + Ctor.prototype.mixin = function(key, value) { + Ctor.prototype[key] = value; + return this; + }; + return Base; + })); + + /** + * Used for adding methods to the `Base` prototype, and/or to the prototype of child instances. + * When a mixin function returns a function, the returned function is pushed onto the `.mixins` + * array, making it available to be used on inheriting classes whenever `Base.mixins()` is + * called (e.g. `Base.mixins(Child)`). + * + * ```js + * Base.mixin(function(proto) { + * proto.foo = function(msg) { + * return 'foo ' + msg; + * }; + * }); + * ``` + * @name #mixin + * @param {Function} `fn` Function to call + * @return {Object} Returns the `Base` constructor for chaining + * @api public + */ + + define(Base, 'mixin', function(fn) { + var mixin = fn(Base.prototype, Base); + if (typeof mixin === 'function') { + Base.prototype.mixins.push(mixin); + } + return Base; + }); + + /** + * Static method for running global mixin functions against a child constructor. + * Mixins must be registered before calling this method. + * + * ```js + * Base.extend(Child); + * Base.mixins(Child); + * ``` + * @name #mixins + * @param {Function} `Child` Constructor function of a child class + * @return {Object} Returns the `Base` constructor for chaining + * @api public + */ + + define(Base, 'mixins', function(Child) { + Base.run(Child, 'mixin', Base.prototype.mixins); + return Base; + }); + + /** + * Similar to `util.inherit`, but copies all static properties, prototype properties, and + * getters/setters from `Provider` to `Receiver`. See [class-utils][]{#inherit} for more details. + * + * ```js + * Base.inherit(Foo, Bar); + * ``` + * @name #inherit + * @param {Function} `Receiver` Receiving (child) constructor + * @param {Function} `Provider` Providing (parent) constructor + * @return {Object} Returns the `Base` constructor for chaining + * @api public + */ + + define(Base, 'inherit', cu.inherit); + define(Base, 'bubble', cu.bubble); + return Base; +} + +/** + * Expose `Base` with default settings + */ + +module.exports = namespace(); + +/** + * Allow users to define a namespace + */ + +module.exports.namespace = namespace; + + +/***/ }), +/* 770 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/*! + * define-property + * + * Copyright (c) 2015, 2017, Jon Schlinkert. + * Released under the MIT License. + */ + + + +var isDescriptor = __webpack_require__(760); + +module.exports = function defineProperty(obj, prop, val) { + if (typeof obj !== 'object' && typeof obj !== 'function') { + throw new TypeError('expected an object or function.'); + } + + if (typeof prop !== 'string') { + throw new TypeError('expected `prop` to be a string.'); + } + + if (isDescriptor(val) && ('set' in val || 'get' in val)) { + return Object.defineProperty(obj, prop, val); + } + + return Object.defineProperty(obj, prop, { + configurable: true, + enumerable: false, + writable: true, + value: val + }); +}; + + +/***/ }), +/* 771 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var isObject = __webpack_require__(748); +var Emitter = __webpack_require__(772); +var visit = __webpack_require__(773); +var toPath = __webpack_require__(776); +var union = __webpack_require__(777); +var del = __webpack_require__(781); +var get = __webpack_require__(779); +var has = __webpack_require__(786); +var set = __webpack_require__(780); + +/** + * Create a `Cache` constructor that when instantiated will + * store values on the given `prop`. + * + * ```js + * var Cache = require('cache-base').namespace('data'); + * var cache = new Cache(); + * + * cache.set('foo', 'bar'); + * //=> {data: {foo: 'bar'}} + * ``` + * @param {String} `prop` The property name to use for storing values. + * @return {Function} Returns a custom `Cache` constructor + * @api public + */ + +function namespace(prop) { + + /** + * Create a new `Cache`. Internally the `Cache` constructor is created using + * the `namespace` function, with `cache` defined as the storage object. + * + * ```js + * var app = new Cache(); + * ``` + * @param {Object} `cache` Optionally pass an object to initialize with. + * @constructor + * @api public + */ + + function Cache(cache) { + if (prop) { + this[prop] = {}; + } + if (cache) { + this.set(cache); + } + } + + /** + * Inherit Emitter + */ + + Emitter(Cache.prototype); + + /** + * Assign `value` to `key`. Also emits `set` with + * the key and value. + * + * ```js + * app.on('set', function(key, val) { + * // do something when `set` is emitted + * }); + * + * app.set(key, value); + * + * // also takes an object or array + * app.set({name: 'Halle'}); + * app.set([{foo: 'bar'}, {baz: 'quux'}]); + * console.log(app); + * //=> {name: 'Halle', foo: 'bar', baz: 'quux'} + * ``` + * + * @name .set + * @emits `set` with `key` and `value` as arguments. + * @param {String} `key` + * @param {any} `value` + * @return {Object} Returns the instance for chaining. + * @api public + */ + + Cache.prototype.set = function(key, val) { + if (Array.isArray(key) && arguments.length === 2) { + key = toPath(key); + } + if (isObject(key) || Array.isArray(key)) { + this.visit('set', key); + } else { + set(prop ? this[prop] : this, key, val); + this.emit('set', key, val); + } + return this; + }; + + /** + * Union `array` to `key`. Also emits `set` with + * the key and value. + * + * ```js + * app.union('a.b', ['foo']); + * app.union('a.b', ['bar']); + * console.log(app.get('a')); + * //=> {b: ['foo', 'bar']} + * ``` + * @name .union + * @param {String} `key` + * @param {any} `value` + * @return {Object} Returns the instance for chaining. + * @api public + */ + + Cache.prototype.union = function(key, val) { + if (Array.isArray(key) && arguments.length === 2) { + key = toPath(key); + } + var ctx = prop ? this[prop] : this; + union(ctx, key, arrayify(val)); + this.emit('union', val); + return this; + }; + + /** + * Return the value of `key`. Dot notation may be used + * to get [nested property values][get-value]. + * + * ```js + * app.set('a.b.c', 'd'); + * app.get('a.b'); + * //=> {c: 'd'} + * + * app.get(['a', 'b']); + * //=> {c: 'd'} + * ``` + * + * @name .get + * @emits `get` with `key` and `value` as arguments. + * @param {String} `key` The name of the property to get. Dot-notation may be used. + * @return {any} Returns the value of `key` + * @api public + */ + + Cache.prototype.get = function(key) { + key = toPath(arguments); + + var ctx = prop ? this[prop] : this; + var val = get(ctx, key); + + this.emit('get', key, val); + return val; + }; + + /** + * Return true if app has a stored value for `key`, + * false only if value is `undefined`. + * + * ```js + * app.set('foo', 'bar'); + * app.has('foo'); + * //=> true + * ``` + * + * @name .has + * @emits `has` with `key` and true or false as arguments. + * @param {String} `key` + * @return {Boolean} + * @api public + */ + + Cache.prototype.has = function(key) { + key = toPath(arguments); + + var ctx = prop ? this[prop] : this; + var val = get(ctx, key); + + var has = typeof val !== 'undefined'; + this.emit('has', key, has); + return has; + }; + + /** + * Delete one or more properties from the instance. + * + * ```js + * app.del(); // delete all + * // or + * app.del('foo'); + * // or + * app.del(['foo', 'bar']); + * ``` + * @name .del + * @emits `del` with the `key` as the only argument. + * @param {String|Array} `key` Property name or array of property names. + * @return {Object} Returns the instance for chaining. + * @api public + */ + + Cache.prototype.del = function(key) { + if (Array.isArray(key)) { + this.visit('del', key); + } else { + del(prop ? this[prop] : this, key); + this.emit('del', key); + } + return this; + }; + + /** + * Reset the entire cache to an empty object. + * + * ```js + * app.clear(); + * ``` + * @api public + */ + + Cache.prototype.clear = function() { + if (prop) { + this[prop] = {}; + } + }; + + /** + * Visit `method` over the properties in the given object, or map + * visit over the object-elements in an array. + * + * @name .visit + * @param {String} `method` The name of the `base` method to call. + * @param {Object|Array} `val` The object or array to iterate over. + * @return {Object} Returns the instance for chaining. + * @api public + */ + + Cache.prototype.visit = function(method, val) { + visit(this, method, val); + return this; + }; + + return Cache; +} + +/** + * Cast val to an array + */ + +function arrayify(val) { + return val ? (Array.isArray(val) ? val : [val]) : []; +} + +/** + * Expose `Cache` + */ + +module.exports = namespace(); + +/** + * Expose `Cache.namespace` + */ + +module.exports.namespace = namespace; + + +/***/ }), +/* 772 */ +/***/ (function(module, exports, __webpack_require__) { + + +/** + * Expose `Emitter`. + */ + +if (true) { + module.exports = Emitter; +} + +/** + * Initialize a new `Emitter`. + * + * @api public + */ + +function Emitter(obj) { + if (obj) return mixin(obj); +}; + +/** + * Mixin the emitter properties. + * + * @param {Object} obj + * @return {Object} + * @api private + */ + +function mixin(obj) { + for (var key in Emitter.prototype) { + obj[key] = Emitter.prototype[key]; + } + return obj; +} + +/** + * Listen on the given `event` with `fn`. + * + * @param {String} event + * @param {Function} fn + * @return {Emitter} + * @api public + */ + +Emitter.prototype.on = +Emitter.prototype.addEventListener = function(event, fn){ + this._callbacks = this._callbacks || {}; + (this._callbacks['$' + event] = this._callbacks['$' + event] || []) + .push(fn); + return this; +}; + +/** + * Adds an `event` listener that will be invoked a single + * time then automatically removed. + * + * @param {String} event + * @param {Function} fn + * @return {Emitter} + * @api public + */ + +Emitter.prototype.once = function(event, fn){ + function on() { + this.off(event, on); + fn.apply(this, arguments); + } + + on.fn = fn; + this.on(event, on); + return this; +}; + +/** + * Remove the given callback for `event` or all + * registered callbacks. + * + * @param {String} event + * @param {Function} fn + * @return {Emitter} + * @api public + */ + +Emitter.prototype.off = +Emitter.prototype.removeListener = +Emitter.prototype.removeAllListeners = +Emitter.prototype.removeEventListener = function(event, fn){ + this._callbacks = this._callbacks || {}; + + // all + if (0 == arguments.length) { + this._callbacks = {}; + return this; + } + + // specific event + var callbacks = this._callbacks['$' + event]; + if (!callbacks) return this; + + // remove all handlers + if (1 == arguments.length) { + delete this._callbacks['$' + event]; + return this; + } + + // remove specific handler + var cb; + for (var i = 0; i < callbacks.length; i++) { + cb = callbacks[i]; + if (cb === fn || cb.fn === fn) { + callbacks.splice(i, 1); + break; + } + } + return this; +}; + +/** + * Emit `event` with the given args. + * + * @param {String} event + * @param {Mixed} ... + * @return {Emitter} + */ + +Emitter.prototype.emit = function(event){ + this._callbacks = this._callbacks || {}; + var args = [].slice.call(arguments, 1) + , callbacks = this._callbacks['$' + event]; + + if (callbacks) { + callbacks = callbacks.slice(0); + for (var i = 0, len = callbacks.length; i < len; ++i) { + callbacks[i].apply(this, args); + } + } + + return this; +}; + +/** + * Return array of callbacks for `event`. + * + * @param {String} event + * @return {Array} + * @api public + */ + +Emitter.prototype.listeners = function(event){ + this._callbacks = this._callbacks || {}; + return this._callbacks['$' + event] || []; +}; + +/** + * Check if this emitter has `event` handlers. + * + * @param {String} event + * @return {Boolean} + * @api public + */ + +Emitter.prototype.hasListeners = function(event){ + return !! this.listeners(event).length; +}; + + +/***/ }), +/* 773 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/*! + * collection-visit + * + * Copyright (c) 2015, 2017, Jon Schlinkert. + * Released under the MIT License. + */ + + + +var visit = __webpack_require__(774); +var mapVisit = __webpack_require__(775); + +module.exports = function(collection, method, val) { + var result; + + if (typeof val === 'string' && (method in collection)) { + var args = [].slice.call(arguments, 2); + result = collection[method].apply(collection, args); + } else if (Array.isArray(val)) { + result = mapVisit.apply(null, arguments); + } else { + result = visit.apply(null, arguments); + } + + if (typeof result !== 'undefined') { + return result; + } + + return collection; +}; + + +/***/ }), +/* 774 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/*! + * object-visit + * + * Copyright (c) 2015, 2017, Jon Schlinkert. + * Released under the MIT License. + */ + + + +var isObject = __webpack_require__(748); + +module.exports = function visit(thisArg, method, target, val) { + if (!isObject(thisArg) && typeof thisArg !== 'function') { + throw new Error('object-visit expects `thisArg` to be an object.'); + } + + if (typeof method !== 'string') { + throw new Error('object-visit expects `method` name to be a string'); + } + + if (typeof thisArg[method] !== 'function') { + return thisArg; + } + + var args = [].slice.call(arguments, 3); + target = target || {}; + + for (var key in target) { + var arr = [key, target[key]].concat(args); + thisArg[method].apply(thisArg, arr); + } + return thisArg; +}; + + +/***/ }), +/* 775 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var util = __webpack_require__(29); +var visit = __webpack_require__(774); + +/** + * Map `visit` over an array of objects. + * + * @param {Object} `collection` The context in which to invoke `method` + * @param {String} `method` Name of the method to call on `collection` + * @param {Object} `arr` Array of objects. + */ + +module.exports = function mapVisit(collection, method, val) { + if (isObject(val)) { + return visit.apply(null, arguments); + } + + if (!Array.isArray(val)) { + throw new TypeError('expected an array: ' + util.inspect(val)); + } + + var args = [].slice.call(arguments, 3); + + for (var i = 0; i < val.length; i++) { + var ele = val[i]; + if (isObject(ele)) { + visit.apply(null, [collection, method, ele].concat(args)); + } else { + collection[method].apply(collection, [ele].concat(args)); + } + } +}; + +function isObject(val) { + return val && (typeof val === 'function' || (!Array.isArray(val) && typeof val === 'object')); +} + + +/***/ }), +/* 776 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/*! + * to-object-path + * + * Copyright (c) 2015, Jon Schlinkert. + * Licensed under the MIT License. + */ + + + +var typeOf = __webpack_require__(753); + +module.exports = function toPath(args) { + if (typeOf(args) !== 'arguments') { + args = arguments; + } + return filter(args).join('.'); +}; + +function filter(arr) { + var len = arr.length; + var idx = -1; + var res = []; + + while (++idx < len) { + var ele = arr[idx]; + if (typeOf(ele) === 'arguments' || Array.isArray(ele)) { + res.push.apply(res, filter(ele)); + } else if (typeof ele === 'string') { + res.push(ele); + } + } + return res; +} + + +/***/ }), +/* 777 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var isObject = __webpack_require__(739); +var union = __webpack_require__(778); +var get = __webpack_require__(779); +var set = __webpack_require__(780); + +module.exports = function unionValue(obj, prop, value) { + if (!isObject(obj)) { + throw new TypeError('union-value expects the first argument to be an object.'); + } + + if (typeof prop !== 'string') { + throw new TypeError('union-value expects `prop` to be a string.'); + } + + var arr = arrayify(get(obj, prop)); + set(obj, prop, union(arr, arrayify(value))); + return obj; +}; + +function arrayify(val) { + if (val === null || typeof val === 'undefined') { + return []; + } + if (Array.isArray(val)) { + return val; + } + return [val]; +} + + +/***/ }), +/* 778 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +module.exports = function union(init) { + if (!Array.isArray(init)) { + throw new TypeError('arr-union expects the first argument to be an array.'); + } + + var len = arguments.length; + var i = 0; + + while (++i < len) { + var arg = arguments[i]; + if (!arg) continue; + + if (!Array.isArray(arg)) { + arg = [arg]; + } + + for (var j = 0; j < arg.length; j++) { + var ele = arg[j]; + + if (init.indexOf(ele) >= 0) { + continue; + } + init.push(ele); + } + } + return init; +}; + + +/***/ }), +/* 779 */ +/***/ (function(module, exports) { + +/*! + * get-value + * + * Copyright (c) 2014-2015, Jon Schlinkert. + * Licensed under the MIT License. + */ + +module.exports = function(obj, prop, a, b, c) { + if (!isObject(obj) || !prop) { + return obj; + } + + prop = toString(prop); + + // allowing for multiple properties to be passed as + // a string or array, but much faster (3-4x) than doing + // `[].slice.call(arguments)` + if (a) prop += '.' + toString(a); + if (b) prop += '.' + toString(b); + if (c) prop += '.' + toString(c); + + if (prop in obj) { + return obj[prop]; + } + + var segs = prop.split('.'); + var len = segs.length; + var i = -1; + + while (obj && (++i < len)) { + var key = segs[i]; + while (key[key.length - 1] === '\\') { + key = key.slice(0, -1) + '.' + segs[++i]; + } + obj = obj[key]; + } + return obj; +}; + +function isObject(val) { + return val !== null && (typeof val === 'object' || typeof val === 'function'); +} + +function toString(val) { + if (!val) return ''; + if (Array.isArray(val)) { + return val.join('.'); + } + return val; +} + + +/***/ }), +/* 780 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/*! + * set-value + * + * Copyright (c) 2014-2015, 2017, Jon Schlinkert. + * Released under the MIT License. + */ + + + +var split = __webpack_require__(744); +var extend = __webpack_require__(738); +var isPlainObject = __webpack_require__(747); +var isObject = __webpack_require__(739); + +module.exports = function(obj, prop, val) { + if (!isObject(obj)) { + return obj; + } + + if (Array.isArray(prop)) { + prop = [].concat.apply([], prop).join('.'); + } + + if (typeof prop !== 'string') { + return obj; + } + + var keys = split(prop, {sep: '.', brackets: true}).filter(isValidKey); + var len = keys.length; + var idx = -1; + var current = obj; + + while (++idx < len) { + var key = keys[idx]; + if (idx !== len - 1) { + if (!isObject(current[key])) { + current[key] = {}; + } + current = current[key]; + continue; + } + + if (isPlainObject(current[key]) && isPlainObject(val)) { + current[key] = extend({}, current[key], val); + } else { + current[key] = val; + } + } + + return obj; +}; + +function isValidKey(key) { + return key !== '__proto__' && key !== 'constructor' && key !== 'prototype'; +} + + +/***/ }), +/* 781 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/*! + * unset-value + * + * Copyright (c) 2015, 2017, Jon Schlinkert. + * Released under the MIT License. + */ + + + +var isObject = __webpack_require__(748); +var has = __webpack_require__(782); + +module.exports = function unset(obj, prop) { + if (!isObject(obj)) { + throw new TypeError('expected an object.'); + } + if (obj.hasOwnProperty(prop)) { + delete obj[prop]; + return true; + } + + if (has(obj, prop)) { + var segs = prop.split('.'); + var last = segs.pop(); + while (segs.length && segs[segs.length - 1].slice(-1) === '\\') { + last = segs.pop().slice(0, -1) + '.' + last; + } + while (segs.length) obj = obj[prop = segs.shift()]; + return (delete obj[last]); + } + return true; +}; + + +/***/ }), +/* 782 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/*! + * has-value + * + * Copyright (c) 2014-2016, Jon Schlinkert. + * Licensed under the MIT License. + */ + + + +var isObject = __webpack_require__(783); +var hasValues = __webpack_require__(785); +var get = __webpack_require__(779); + +module.exports = function(obj, prop, noZero) { + if (isObject(obj)) { + return hasValues(get(obj, prop), noZero); + } + return hasValues(obj, prop); +}; + + +/***/ }), +/* 783 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/*! + * isobject + * + * Copyright (c) 2014-2015, Jon Schlinkert. + * Licensed under the MIT License. + */ + + + +var isArray = __webpack_require__(784); + +module.exports = function isObject(val) { + return val != null && typeof val === 'object' && isArray(val) === false; +}; + + +/***/ }), +/* 784 */ +/***/ (function(module, exports) { + +var toString = {}.toString; + +module.exports = Array.isArray || function (arr) { + return toString.call(arr) == '[object Array]'; +}; + + +/***/ }), +/* 785 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/*! + * has-values + * + * Copyright (c) 2014-2015, Jon Schlinkert. + * Licensed under the MIT License. + */ + + + +module.exports = function hasValue(o, noZero) { + if (o === null || o === undefined) { + return false; + } + + if (typeof o === 'boolean') { + return true; + } + + if (typeof o === 'number') { + if (o === 0 && noZero === true) { + return false; + } + return true; + } + + if (o.length !== undefined) { + return o.length !== 0; + } + + for (var key in o) { + if (o.hasOwnProperty(key)) { + return true; + } + } + return false; +}; + + +/***/ }), +/* 786 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/*! + * has-value + * + * Copyright (c) 2014-2017, Jon Schlinkert. + * Licensed under the MIT License. + */ + + + +var isObject = __webpack_require__(748); +var hasValues = __webpack_require__(787); +var get = __webpack_require__(779); + +module.exports = function(val, prop) { + return hasValues(isObject(val) && prop ? get(val, prop) : val); +}; + + +/***/ }), +/* 787 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/*! + * has-values + * + * Copyright (c) 2014-2015, 2017, Jon Schlinkert. + * Released under the MIT License. + */ + + + +var typeOf = __webpack_require__(788); +var isNumber = __webpack_require__(752); + +module.exports = function hasValue(val) { + // is-number checks for NaN and other edge cases + if (isNumber(val)) { + return true; + } + + switch (typeOf(val)) { + case 'null': + case 'boolean': + case 'function': + return true; + case 'string': + case 'arguments': + return val.length !== 0; + case 'error': + return val.message !== ''; + case 'array': + var len = val.length; + if (len === 0) { + return false; + } + for (var i = 0; i < len; i++) { + if (hasValue(val[i])) { + return true; + } + } + return false; + case 'file': + case 'map': + case 'set': + return val.size !== 0; + case 'object': + var keys = Object.keys(val); + if (keys.length === 0) { + return false; + } + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + if (hasValue(val[key])) { + return true; + } + } + return false; + default: { + return false; + } + } +}; + + +/***/ }), +/* 788 */ +/***/ (function(module, exports, __webpack_require__) { + +var isBuffer = __webpack_require__(735); +var toString = Object.prototype.toString; + +/** + * Get the native `typeof` a value. + * + * @param {*} `val` + * @return {*} Native javascript type + */ + +module.exports = function kindOf(val) { + // primitivies + if (typeof val === 'undefined') { + return 'undefined'; + } + if (val === null) { + return 'null'; + } + if (val === true || val === false || val instanceof Boolean) { + return 'boolean'; + } + if (typeof val === 'string' || val instanceof String) { + return 'string'; + } + if (typeof val === 'number' || val instanceof Number) { + return 'number'; + } + + // functions + if (typeof val === 'function' || val instanceof Function) { + return 'function'; + } + + // array + if (typeof Array.isArray !== 'undefined' && Array.isArray(val)) { + return 'array'; + } + + // check for instances of RegExp and Date before calling `toString` + if (val instanceof RegExp) { + return 'regexp'; + } + if (val instanceof Date) { + return 'date'; + } + + // other objects + var type = toString.call(val); + + if (type === '[object RegExp]') { + return 'regexp'; + } + if (type === '[object Date]') { + return 'date'; + } + if (type === '[object Arguments]') { + return 'arguments'; + } + if (type === '[object Error]') { + return 'error'; + } + if (type === '[object Promise]') { + return 'promise'; + } + + // buffer + if (isBuffer(val)) { + return 'buffer'; + } + + // es6: Map, WeakMap, Set, WeakSet + if (type === '[object Set]') { + return 'set'; + } + if (type === '[object WeakSet]') { + return 'weakset'; + } + if (type === '[object Map]') { + return 'map'; + } + if (type === '[object WeakMap]') { + return 'weakmap'; + } + if (type === '[object Symbol]') { + return 'symbol'; + } + + // typed arrays + if (type === '[object Int8Array]') { + return 'int8array'; + } + if (type === '[object Uint8Array]') { + return 'uint8array'; + } + if (type === '[object Uint8ClampedArray]') { + return 'uint8clampedarray'; + } + if (type === '[object Int16Array]') { + return 'int16array'; + } + if (type === '[object Uint16Array]') { + return 'uint16array'; + } + if (type === '[object Int32Array]') { + return 'int32array'; + } + if (type === '[object Uint32Array]') { + return 'uint32array'; + } + if (type === '[object Float32Array]') { + return 'float32array'; + } + if (type === '[object Float64Array]') { + return 'float64array'; + } + + // must be a plain object + return 'object'; +}; + + +/***/ }), +/* 789 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var isExtendable = __webpack_require__(790); +var forIn = __webpack_require__(791); + +function mixinDeep(target, objects) { + var len = arguments.length, i = 0; + while (++i < len) { + var obj = arguments[i]; + if (isObject(obj)) { + forIn(obj, copy, target); + } + } + return target; +} + +/** + * Copy properties from the source object to the + * target object. + * + * @param {*} `val` + * @param {String} `key` + */ + +function copy(val, key) { + if (!isValidKey(key)) { + return; + } + + var obj = this[key]; + if (isObject(val) && isObject(obj)) { + mixinDeep(obj, val); + } else { + this[key] = val; + } +} + +/** + * Returns true if `val` is an object or function. + * + * @param {any} val + * @return {Boolean} + */ + +function isObject(val) { + return isExtendable(val) && !Array.isArray(val); +} + +/** + * Returns true if `key` is a valid key to use when extending objects. + * + * @param {String} `key` + * @return {Boolean} + */ + +function isValidKey(key) { + return key !== '__proto__' && key !== 'constructor' && key !== 'prototype'; +}; + +/** + * Expose `mixinDeep` + */ + +module.exports = mixinDeep; + + +/***/ }), +/* 790 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/*! + * is-extendable + * + * Copyright (c) 2015-2017, Jon Schlinkert. + * Released under the MIT License. + */ + + + +var isPlainObject = __webpack_require__(747); + +module.exports = function isExtendable(val) { + return isPlainObject(val) || typeof val === 'function' || Array.isArray(val); +}; + + +/***/ }), +/* 791 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/*! + * for-in + * + * Copyright (c) 2014-2017, Jon Schlinkert. + * Released under the MIT License. + */ + + + +module.exports = function forIn(obj, fn, thisArg) { + for (var key in obj) { + if (fn.call(thisArg, obj[key], key, obj) === false) { + break; + } + } +}; + + +/***/ }), +/* 792 */ +/***/ (function(module, exports) { + +/*! + * pascalcase + * + * Copyright (c) 2015, Jon Schlinkert. + * Licensed under the MIT License. + */ + +function pascalcase(str) { + if (typeof str !== 'string') { + throw new TypeError('expected a string.'); + } + str = str.replace(/([A-Z])/g, ' $1'); + if (str.length === 1) { return str.toUpperCase(); } + str = str.replace(/^[\W_]+|[\W_]+$/g, '').toLowerCase(); + str = str.charAt(0).toUpperCase() + str.slice(1); + return str.replace(/[\W_]+(\w|$)/g, function (_, ch) { + return ch.toUpperCase(); + }); +} + +module.exports = pascalcase; + + +/***/ }), +/* 793 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var util = __webpack_require__(29); +var utils = __webpack_require__(794); + +/** + * Expose class utils + */ + +var cu = module.exports; + +/** + * Expose class utils: `cu` + */ + +cu.isObject = function isObject(val) { + return utils.isObj(val) || typeof val === 'function'; +}; + +/** + * Returns true if an array has any of the given elements, or an + * object has any of the give keys. + * + * ```js + * cu.has(['a', 'b', 'c'], 'c'); + * //=> true + * + * cu.has(['a', 'b', 'c'], ['c', 'z']); + * //=> true + * + * cu.has({a: 'b', c: 'd'}, ['c', 'z']); + * //=> true + * ``` + * @param {Object} `obj` + * @param {String|Array} `val` + * @return {Boolean} + * @api public + */ + +cu.has = function has(obj, val) { + val = cu.arrayify(val); + var len = val.length; + + if (cu.isObject(obj)) { + for (var key in obj) { + if (val.indexOf(key) > -1) { + return true; + } + } + + var keys = cu.nativeKeys(obj); + return cu.has(keys, val); + } + + if (Array.isArray(obj)) { + var arr = obj; + while (len--) { + if (arr.indexOf(val[len]) > -1) { + return true; + } + } + return false; + } + + throw new TypeError('expected an array or object.'); +}; + +/** + * Returns true if an array or object has all of the given values. + * + * ```js + * cu.hasAll(['a', 'b', 'c'], 'c'); + * //=> true + * + * cu.hasAll(['a', 'b', 'c'], ['c', 'z']); + * //=> false + * + * cu.hasAll({a: 'b', c: 'd'}, ['c', 'z']); + * //=> false + * ``` + * @param {Object|Array} `val` + * @param {String|Array} `values` + * @return {Boolean} + * @api public + */ + +cu.hasAll = function hasAll(val, values) { + values = cu.arrayify(values); + var len = values.length; + while (len--) { + if (!cu.has(val, values[len])) { + return false; + } + } + return true; +}; + +/** + * Cast the given value to an array. + * + * ```js + * cu.arrayify('foo'); + * //=> ['foo'] + * + * cu.arrayify(['foo']); + * //=> ['foo'] + * ``` + * + * @param {String|Array} `val` + * @return {Array} + * @api public + */ + +cu.arrayify = function arrayify(val) { + return val ? (Array.isArray(val) ? val : [val]) : []; +}; + +/** + * Noop + */ + +cu.noop = function noop() { + return; +}; + +/** + * Returns the first argument passed to the function. + */ + +cu.identity = function identity(val) { + return val; +}; + +/** + * Returns true if a value has a `contructor` + * + * ```js + * cu.hasConstructor({}); + * //=> true + * + * cu.hasConstructor(Object.create(null)); + * //=> false + * ``` + * @param {Object} `value` + * @return {Boolean} + * @api public + */ + +cu.hasConstructor = function hasConstructor(val) { + return cu.isObject(val) && typeof val.constructor !== 'undefined'; +}; + +/** + * Get the native `ownPropertyNames` from the constructor of the + * given `object`. An empty array is returned if the object does + * not have a constructor. + * + * ```js + * cu.nativeKeys({a: 'b', b: 'c', c: 'd'}) + * //=> ['a', 'b', 'c'] + * + * cu.nativeKeys(function(){}) + * //=> ['length', 'caller'] + * ``` + * + * @param {Object} `obj` Object that has a `constructor`. + * @return {Array} Array of keys. + * @api public + */ + +cu.nativeKeys = function nativeKeys(val) { + if (!cu.hasConstructor(val)) return []; + return Object.getOwnPropertyNames(val); +}; + +/** + * Returns property descriptor `key` if it's an "own" property + * of the given object. + * + * ```js + * function App() {} + * Object.defineProperty(App.prototype, 'count', { + * get: function() { + * return Object.keys(this).length; + * } + * }); + * cu.getDescriptor(App.prototype, 'count'); + * // returns: + * // { + * // get: [Function], + * // set: undefined, + * // enumerable: false, + * // configurable: false + * // } + * ``` + * + * @param {Object} `obj` + * @param {String} `key` + * @return {Object} Returns descriptor `key` + * @api public + */ + +cu.getDescriptor = function getDescriptor(obj, key) { + if (!cu.isObject(obj)) { + throw new TypeError('expected an object.'); + } + if (typeof key !== 'string') { + throw new TypeError('expected key to be a string.'); + } + return Object.getOwnPropertyDescriptor(obj, key); +}; + +/** + * Copy a descriptor from one object to another. + * + * ```js + * function App() {} + * Object.defineProperty(App.prototype, 'count', { + * get: function() { + * return Object.keys(this).length; + * } + * }); + * var obj = {}; + * cu.copyDescriptor(obj, App.prototype, 'count'); + * ``` + * @param {Object} `receiver` + * @param {Object} `provider` + * @param {String} `name` + * @return {Object} + * @api public + */ + +cu.copyDescriptor = function copyDescriptor(receiver, provider, name) { + if (!cu.isObject(receiver)) { + throw new TypeError('expected receiving object to be an object.'); + } + if (!cu.isObject(provider)) { + throw new TypeError('expected providing object to be an object.'); + } + if (typeof name !== 'string') { + throw new TypeError('expected name to be a string.'); + } + + var val = cu.getDescriptor(provider, name); + if (val) Object.defineProperty(receiver, name, val); +}; + +/** + * Copy static properties, prototype properties, and descriptors + * from one object to another. + * + * @param {Object} `receiver` + * @param {Object} `provider` + * @param {String|Array} `omit` One or more properties to omit + * @return {Object} + * @api public + */ + +cu.copy = function copy(receiver, provider, omit) { + if (!cu.isObject(receiver)) { + throw new TypeError('expected receiving object to be an object.'); + } + if (!cu.isObject(provider)) { + throw new TypeError('expected providing object to be an object.'); + } + var props = Object.getOwnPropertyNames(provider); + var keys = Object.keys(provider); + var len = props.length, + key; + omit = cu.arrayify(omit); + + while (len--) { + key = props[len]; + + if (cu.has(keys, key)) { + utils.define(receiver, key, provider[key]); + } else if (!(key in receiver) && !cu.has(omit, key)) { + cu.copyDescriptor(receiver, provider, key); + } + } +}; + +/** + * Inherit the static properties, prototype properties, and descriptors + * from of an object. + * + * @param {Object} `receiver` + * @param {Object} `provider` + * @param {String|Array} `omit` One or more properties to omit + * @return {Object} + * @api public + */ + +cu.inherit = function inherit(receiver, provider, omit) { + if (!cu.isObject(receiver)) { + throw new TypeError('expected receiving object to be an object.'); + } + if (!cu.isObject(provider)) { + throw new TypeError('expected providing object to be an object.'); + } + + var keys = []; + for (var key in provider) { + keys.push(key); + receiver[key] = provider[key]; + } + + keys = keys.concat(cu.arrayify(omit)); + + var a = provider.prototype || provider; + var b = receiver.prototype || receiver; + cu.copy(b, a, keys); +}; + +/** + * Returns a function for extending the static properties, + * prototype properties, and descriptors from the `Parent` + * constructor onto `Child` constructors. + * + * ```js + * var extend = cu.extend(Parent); + * Parent.extend(Child); + * + * // optional methods + * Parent.extend(Child, { + * foo: function() {}, + * bar: function() {} + * }); + * ``` + * @param {Function} `Parent` Parent ctor + * @param {Function} `extend` Optional extend function to handle custom extensions. Useful when updating methods that require a specific prototype. + * @param {Function} `Child` Child ctor + * @param {Object} `proto` Optionally pass additional prototype properties to inherit. + * @return {Object} + * @api public + */ + +cu.extend = function() { + // keep it lazy, instead of assigning to `cu.extend` + return utils.staticExtend.apply(null, arguments); +}; + +/** + * Bubble up events emitted from static methods on the Parent ctor. + * + * @param {Object} `Parent` + * @param {Array} `events` Event names to bubble up + * @api public + */ + +cu.bubble = function(Parent, events) { + events = events || []; + Parent.bubble = function(Child, arr) { + if (Array.isArray(arr)) { + events = utils.union([], events, arr); + } + var len = events.length; + var idx = -1; + while (++idx < len) { + var name = events[idx]; + Parent.on(name, Child.emit.bind(Child, name)); + } + cu.bubble(Child, events); + }; +}; + + +/***/ }), +/* 794 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var utils = {}; + + + +/** + * Lazily required module dependencies + */ + +utils.union = __webpack_require__(778); +utils.define = __webpack_require__(730); +utils.isObj = __webpack_require__(748); +utils.staticExtend = __webpack_require__(795); + + +/** + * Expose `utils` + */ + +module.exports = utils; + + +/***/ }), +/* 795 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/*! + * static-extend + * + * Copyright (c) 2016, Jon Schlinkert. + * Licensed under the MIT License. + */ + + + +var copy = __webpack_require__(796); +var define = __webpack_require__(730); +var util = __webpack_require__(29); + +/** + * Returns a function for extending the static properties, + * prototype properties, and descriptors from the `Parent` + * constructor onto `Child` constructors. + * + * ```js + * var extend = require('static-extend'); + * Parent.extend = extend(Parent); + * + * // optionally pass a custom merge function as the second arg + * Parent.extend = extend(Parent, function(Child) { + * Child.prototype.mixin = function(key, val) { + * Child.prototype[key] = val; + * }; + * }); + * + * // extend "child" constructors + * Parent.extend(Child); + * + * // optionally define prototype methods as the second arg + * Parent.extend(Child, { + * foo: function() {}, + * bar: function() {} + * }); + * ``` + * @param {Function} `Parent` Parent ctor + * @param {Function} `extendFn` Optional extend function for handling any necessary custom merging. Useful when updating methods that require a specific prototype. + * @param {Function} `Child` Child ctor + * @param {Object} `proto` Optionally pass additional prototype properties to inherit. + * @return {Object} + * @api public + */ + +function extend(Parent, extendFn) { + if (typeof Parent !== 'function') { + throw new TypeError('expected Parent to be a function.'); + } + + return function(Ctor, proto) { + if (typeof Ctor !== 'function') { + throw new TypeError('expected Ctor to be a function.'); + } + + util.inherits(Ctor, Parent); + copy(Ctor, Parent); + + // proto can be null or a plain object + if (typeof proto === 'object') { + var obj = Object.create(proto); + + for (var k in obj) { + Ctor.prototype[k] = obj[k]; + } + } + + // keep a reference to the parent prototype + define(Ctor.prototype, '_parent_', { + configurable: true, + set: function() {}, + get: function() { + return Parent.prototype; + } + }); + + if (typeof extendFn === 'function') { + extendFn(Ctor, Parent); + } + + Ctor.extend = extend(Ctor, extendFn); + }; +}; + +/** + * Expose `extend` + */ + +module.exports = extend; + + +/***/ }), +/* 796 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var typeOf = __webpack_require__(753); +var copyDescriptor = __webpack_require__(797); +var define = __webpack_require__(730); + +/** + * Copy static properties, prototype properties, and descriptors from one object to another. + * + * ```js + * function App() {} + * var proto = App.prototype; + * App.prototype.set = function() {}; + * App.prototype.get = function() {}; + * + * var obj = {}; + * copy(obj, proto); + * ``` + * @param {Object} `receiver` + * @param {Object} `provider` + * @param {String|Array} `omit` One or more properties to omit + * @return {Object} + * @api public + */ + +function copy(receiver, provider, omit) { + if (!isObject(receiver)) { + throw new TypeError('expected receiving object to be an object.'); + } + if (!isObject(provider)) { + throw new TypeError('expected providing object to be an object.'); + } + + var props = nativeKeys(provider); + var keys = Object.keys(provider); + var len = props.length; + omit = arrayify(omit); + + while (len--) { + var key = props[len]; + + if (has(keys, key)) { + define(receiver, key, provider[key]); + } else if (!(key in receiver) && !has(omit, key)) { + copyDescriptor(receiver, provider, key); + } + } +}; + +/** + * Return true if the given value is an object or function + */ + +function isObject(val) { + return typeOf(val) === 'object' || typeof val === 'function'; +} + +/** + * Returns true if an array has any of the given elements, or an + * object has any of the give keys. + * + * ```js + * has(['a', 'b', 'c'], 'c'); + * //=> true + * + * has(['a', 'b', 'c'], ['c', 'z']); + * //=> true + * + * has({a: 'b', c: 'd'}, ['c', 'z']); + * //=> true + * ``` + * @param {Object} `obj` + * @param {String|Array} `val` + * @return {Boolean} + */ + +function has(obj, val) { + val = arrayify(val); + var len = val.length; + + if (isObject(obj)) { + for (var key in obj) { + if (val.indexOf(key) > -1) { + return true; + } + } + + var keys = nativeKeys(obj); + return has(keys, val); + } + + if (Array.isArray(obj)) { + var arr = obj; + while (len--) { + if (arr.indexOf(val[len]) > -1) { + return true; + } + } + return false; + } + + throw new TypeError('expected an array or object.'); +} + +/** + * Cast the given value to an array. + * + * ```js + * arrayify('foo'); + * //=> ['foo'] + * + * arrayify(['foo']); + * //=> ['foo'] + * ``` + * + * @param {String|Array} `val` + * @return {Array} + */ + +function arrayify(val) { + return val ? (Array.isArray(val) ? val : [val]) : []; +} + +/** + * Returns true if a value has a `contructor` + * + * ```js + * hasConstructor({}); + * //=> true + * + * hasConstructor(Object.create(null)); + * //=> false + * ``` + * @param {Object} `value` + * @return {Boolean} + */ + +function hasConstructor(val) { + return isObject(val) && typeof val.constructor !== 'undefined'; +} + +/** + * Get the native `ownPropertyNames` from the constructor of the + * given `object`. An empty array is returned if the object does + * not have a constructor. + * + * ```js + * nativeKeys({a: 'b', b: 'c', c: 'd'}) + * //=> ['a', 'b', 'c'] + * + * nativeKeys(function(){}) + * //=> ['length', 'caller'] + * ``` + * + * @param {Object} `obj` Object that has a `constructor`. + * @return {Array} Array of keys. + */ + +function nativeKeys(val) { + if (!hasConstructor(val)) return []; + return Object.getOwnPropertyNames(val); +} + +/** + * Expose `copy` + */ + +module.exports = copy; + +/** + * Expose `copy.has` for tests + */ + +module.exports.has = has; + + +/***/ }), +/* 797 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/*! + * copy-descriptor + * + * Copyright (c) 2015, Jon Schlinkert. + * Licensed under the MIT License. + */ + + + +/** + * Copy a descriptor from one object to another. + * + * ```js + * function App() { + * this.cache = {}; + * } + * App.prototype.set = function(key, val) { + * this.cache[key] = val; + * return this; + * }; + * Object.defineProperty(App.prototype, 'count', { + * get: function() { + * return Object.keys(this.cache).length; + * } + * }); + * + * copy(App.prototype, 'count', 'len'); + * + * // create an instance + * var app = new App(); + * + * app.set('a', true); + * app.set('b', true); + * app.set('c', true); + * + * console.log(app.count); + * //=> 3 + * console.log(app.len); + * //=> 3 + * ``` + * @name copy + * @param {Object} `receiver` The target object + * @param {Object} `provider` The provider object + * @param {String} `from` The key to copy on provider. + * @param {String} `to` Optionally specify a new key name to use. + * @return {Object} + * @api public + */ + +module.exports = function copyDescriptor(receiver, provider, from, to) { + if (!isObject(provider) && typeof provider !== 'function') { + to = from; + from = provider; + provider = receiver; + } + if (!isObject(receiver) && typeof receiver !== 'function') { + throw new TypeError('expected the first argument to be an object'); + } + if (!isObject(provider) && typeof provider !== 'function') { + throw new TypeError('expected provider to be an object'); + } + + if (typeof to !== 'string') { + to = from; + } + if (typeof from !== 'string') { + throw new TypeError('expected key to be a string'); + } + + if (!(from in provider)) { + throw new Error('property "' + from + '" does not exist'); + } + + var val = Object.getOwnPropertyDescriptor(provider, from); + if (val) Object.defineProperty(receiver, to, val); +}; + +function isObject(val) { + return {}.toString.call(val) === '[object Object]'; +} + + + +/***/ }), +/* 798 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var use = __webpack_require__(799); +var define = __webpack_require__(730); +var debug = __webpack_require__(801)('snapdragon:compiler'); +var utils = __webpack_require__(807); + +/** + * Create a new `Compiler` with the given `options`. + * @param {Object} `options` + */ + +function Compiler(options, state) { + debug('initializing', __filename); + this.options = utils.extend({source: 'string'}, options); + this.state = state || {}; + this.compilers = {}; + this.output = ''; + this.set('eos', function(node) { + return this.emit(node.val, node); + }); + this.set('noop', function(node) { + return this.emit(node.val, node); + }); + this.set('bos', function(node) { + return this.emit(node.val, node); + }); + use(this); +} + +/** + * Prototype methods + */ + +Compiler.prototype = { + + /** + * Throw an error message with details including the cursor position. + * @param {String} `msg` Message to use in the Error. + */ + + error: function(msg, node) { + var pos = node.position || {start: {column: 0}}; + var message = this.options.source + ' column:' + pos.start.column + ': ' + msg; + + var err = new Error(message); + err.reason = msg; + err.column = pos.start.column; + err.source = this.pattern; + + if (this.options.silent) { + this.errors.push(err); + } else { + throw err; + } + }, + + /** + * Define a non-enumberable property on the `Compiler` instance. + * + * ```js + * compiler.define('foo', 'bar'); + * ``` + * @name .define + * @param {String} `key` propery name + * @param {any} `val` property value + * @return {Object} Returns the Compiler instance for chaining. + * @api public + */ + + define: function(key, val) { + define(this, key, val); + return this; + }, + + /** + * Emit `node.val` + */ + + emit: function(str, node) { + this.output += str; + return str; + }, + + /** + * Add a compiler `fn` with the given `name` + */ + + set: function(name, fn) { + this.compilers[name] = fn; + return this; + }, + + /** + * Get compiler `name`. + */ + + get: function(name) { + return this.compilers[name]; + }, + + /** + * Get the previous AST node. + */ + + prev: function(n) { + return this.ast.nodes[this.idx - (n || 1)] || { type: 'bos', val: '' }; + }, + + /** + * Get the next AST node. + */ + + next: function(n) { + return this.ast.nodes[this.idx + (n || 1)] || { type: 'eos', val: '' }; + }, + + /** + * Visit `node`. + */ + + visit: function(node, nodes, i) { + var fn = this.compilers[node.type]; + this.idx = i; + + if (typeof fn !== 'function') { + throw this.error('compiler "' + node.type + '" is not registered', node); + } + return fn.call(this, node, nodes, i); + }, + + /** + * Map visit over array of `nodes`. + */ + + mapVisit: function(nodes) { + if (!Array.isArray(nodes)) { + throw new TypeError('expected an array'); + } + var len = nodes.length; + var idx = -1; + while (++idx < len) { + this.visit(nodes[idx], nodes, idx); + } + return this; + }, + + /** + * Compile `ast`. + */ + + compile: function(ast, options) { + var opts = utils.extend({}, this.options, options); + this.ast = ast; + this.parsingErrors = this.ast.errors; + this.output = ''; + + // source map support + if (opts.sourcemap) { + var sourcemaps = __webpack_require__(826); + sourcemaps(this); + this.mapVisit(this.ast.nodes); + this.applySourceMaps(); + this.map = opts.sourcemap === 'generator' ? this.map : this.map.toJSON(); + return this; + } + + this.mapVisit(this.ast.nodes); + return this; + } +}; + +/** + * Expose `Compiler` + */ + +module.exports = Compiler; + + +/***/ }), +/* 799 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/*! + * use + * + * Copyright (c) 2015, 2017, Jon Schlinkert. + * Released under the MIT License. + */ + + + +var utils = __webpack_require__(800); + +module.exports = function base(app, opts) { + if (!utils.isObject(app) && typeof app !== 'function') { + throw new TypeError('use: expect `app` be an object or function'); + } + + if (!utils.isObject(opts)) { + opts = {}; + } + + var prop = utils.isString(opts.prop) ? opts.prop : 'fns'; + if (!Array.isArray(app[prop])) { + utils.define(app, prop, []); + } + + /** + * Define a plugin function to be passed to use. The only + * parameter exposed to the plugin is `app`, the object or function. + * passed to `use(app)`. `app` is also exposed as `this` in plugins. + * + * Additionally, **if a plugin returns a function, the function will + * be pushed onto the `fns` array**, allowing the plugin to be + * called at a later point by the `run` method. + * + * ```js + * var use = require('use'); + * + * // define a plugin + * function foo(app) { + * // do stuff + * } + * + * var app = function(){}; + * use(app); + * + * // register plugins + * app.use(foo); + * app.use(bar); + * app.use(baz); + * ``` + * @name .use + * @param {Function} `fn` plugin function to call + * @api public + */ + + utils.define(app, 'use', use); + + /** + * Run all plugins on `fns`. Any plugin that returns a function + * when called by `use` is pushed onto the `fns` array. + * + * ```js + * var config = {}; + * app.run(config); + * ``` + * @name .run + * @param {Object} `value` Object to be modified by plugins. + * @return {Object} Returns the object passed to `run` + * @api public + */ + + utils.define(app, 'run', function(val) { + if (!utils.isObject(val)) return; + decorate(val); + + var self = this || app; + var fns = self[prop]; + var len = fns.length; + var idx = -1; + + while (++idx < len) { + val.use(fns[idx]); + } + return val; + }); + + /** + * Call plugin `fn`. If a function is returned push it into the + * `fns` array to be called by the `run` method. + */ + + function use(fn, options) { + if (typeof fn !== 'function') { + throw new TypeError('.use expects `fn` be a function'); + } + + var self = this || app; + if (typeof opts.fn === 'function') { + opts.fn.call(self, self, options); + } + + var plugin = fn.call(self, self); + if (typeof plugin === 'function') { + var fns = self[prop]; + fns.push(plugin); + } + return self; + } + + /** + * Ensure the `.use` method exists on `val` + */ + + function decorate(val) { + if (!val.use || !val.run) { + base(val); + } + } + + return app; +}; + + +/***/ }), +/* 800 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var utils = {}; + + + +/** + * Lazily required module dependencies + */ + +utils.define = __webpack_require__(730); +utils.isObject = __webpack_require__(748); + + +utils.isString = function(val) { + return val && typeof val === 'string'; +}; + +/** + * Expose `utils` modules + */ + +module.exports = utils; + + +/***/ }), +/* 801 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * Detect Electron renderer process, which is node, but we should + * treat as a browser. + */ + +if (typeof process !== 'undefined' && process.type === 'renderer') { + module.exports = __webpack_require__(802); +} else { + module.exports = __webpack_require__(805); +} + + +/***/ }), +/* 802 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * This is the web browser implementation of `debug()`. + * + * Expose `debug()` as the module. + */ + +exports = module.exports = __webpack_require__(803); +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.storage = 'undefined' != typeof chrome + && 'undefined' != typeof chrome.storage + ? chrome.storage.local + : localstorage(); + +/** + * Colors. + */ + +exports.colors = [ + 'lightseagreen', + 'forestgreen', + 'goldenrod', + 'dodgerblue', + 'darkorchid', + 'crimson' +]; + +/** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ + +function useColors() { + // NB: In an Electron preload script, document will be defined but not fully + // initialized. Since we know we're in Chrome, we'll just detect this case + // explicitly + if (typeof window !== 'undefined' && window.process && window.process.type === 'renderer') { + return true; + } + + // is webkit? http://stackoverflow.com/a/16459606/376773 + // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 + return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) || + // is firebug? http://stackoverflow.com/a/398120/376773 + (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) || + // is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) || + // double check webkit in userAgent just in case we are in a worker + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)); +} + +/** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + +exports.formatters.j = function(v) { + try { + return JSON.stringify(v); + } catch (err) { + return '[UnexpectedJSONParseError]: ' + err.message; + } +}; + + +/** + * Colorize log arguments if enabled. + * + * @api public + */ + +function formatArgs(args) { + var useColors = this.useColors; + + args[0] = (useColors ? '%c' : '') + + this.namespace + + (useColors ? ' %c' : ' ') + + args[0] + + (useColors ? '%c ' : ' ') + + '+' + exports.humanize(this.diff); + + if (!useColors) return; + + var c = 'color: ' + this.color; + args.splice(1, 0, c, 'color: inherit') + + // the final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + var index = 0; + var lastC = 0; + args[0].replace(/%[a-zA-Z%]/g, function(match) { + if ('%%' === match) return; + index++; + if ('%c' === match) { + // we only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + + args.splice(lastC, 0, c); +} + +/** + * Invokes `console.log()` when available. + * No-op when `console.log` is not a "function". + * + * @api public + */ + +function log() { + // this hackery is required for IE8/9, where + // the `console.log` function doesn't have 'apply' + return 'object' === typeof console + && console.log + && Function.prototype.apply.call(console.log, console, arguments); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ + +function save(namespaces) { + try { + if (null == namespaces) { + exports.storage.removeItem('debug'); + } else { + exports.storage.debug = namespaces; + } + } catch(e) {} +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + +function load() { + var r; + try { + r = exports.storage.debug; + } catch(e) {} + + // If debug isn't set in LS, and we're in Electron, try to load $DEBUG + if (!r && typeof process !== 'undefined' && 'env' in process) { + r = process.env.DEBUG; + } + + return r; +} + +/** + * Enable namespaces listed in `localStorage.debug` initially. + */ + +exports.enable(load()); + +/** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + +function localstorage() { + try { + return window.localStorage; + } catch (e) {} +} + + +/***/ }), +/* 803 */ +/***/ (function(module, exports, __webpack_require__) { + + +/** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + * + * Expose `debug()` as the module. + */ + +exports = module.exports = createDebug.debug = createDebug['default'] = createDebug; +exports.coerce = coerce; +exports.disable = disable; +exports.enable = enable; +exports.enabled = enabled; +exports.humanize = __webpack_require__(804); + +/** + * The currently active debug mode names, and names to skip. + */ + +exports.names = []; +exports.skips = []; + +/** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". + */ + +exports.formatters = {}; + +/** + * Previous log timestamp. + */ + +var prevTime; + +/** + * Select a color. + * @param {String} namespace + * @return {Number} + * @api private + */ + +function selectColor(namespace) { + var hash = 0, i; + + for (i in namespace) { + hash = ((hash << 5) - hash) + namespace.charCodeAt(i); + hash |= 0; // Convert to 32bit integer + } + + return exports.colors[Math.abs(hash) % exports.colors.length]; +} + +/** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + +function createDebug(namespace) { + + function debug() { + // disabled? + if (!debug.enabled) return; + + var self = debug; + + // set `diff` timestamp + var curr = +new Date(); + var ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + + // turn the `arguments` into a proper Array + var args = new Array(arguments.length); + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i]; + } + + args[0] = exports.coerce(args[0]); + + if ('string' !== typeof args[0]) { + // anything else let's inspect with %O + args.unshift('%O'); + } + + // apply any `formatters` transformations + var index = 0; + args[0] = args[0].replace(/%([a-zA-Z%])/g, function(match, format) { + // if we encounter an escaped % then don't increase the array index + if (match === '%%') return match; + index++; + var formatter = exports.formatters[format]; + if ('function' === typeof formatter) { + var val = args[index]; + match = formatter.call(self, val); + + // now we need to remove `args[index]` since it's inlined in the `format` + args.splice(index, 1); + index--; + } + return match; + }); + + // apply env-specific formatting (colors, etc.) + exports.formatArgs.call(self, args); + + var logFn = debug.log || exports.log || console.log.bind(console); + logFn.apply(self, args); + } + + debug.namespace = namespace; + debug.enabled = exports.enabled(namespace); + debug.useColors = exports.useColors(); + debug.color = selectColor(namespace); + + // env-specific initialization logic for debug instances + if ('function' === typeof exports.init) { + exports.init(debug); + } + + return debug; +} + +/** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + +function enable(namespaces) { + exports.save(namespaces); + + exports.names = []; + exports.skips = []; + + var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); + var len = split.length; + + for (var i = 0; i < len; i++) { + if (!split[i]) continue; // ignore empty strings + namespaces = split[i].replace(/\*/g, '.*?'); + if (namespaces[0] === '-') { + exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); + } else { + exports.names.push(new RegExp('^' + namespaces + '$')); + } + } +} + +/** + * Disable debug output. + * + * @api public + */ + +function disable() { + exports.enable(''); +} + +/** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + +function enabled(name) { + var i, len; + for (i = 0, len = exports.skips.length; i < len; i++) { + if (exports.skips[i].test(name)) { + return false; + } + } + for (i = 0, len = exports.names.length; i < len; i++) { + if (exports.names[i].test(name)) { + return true; + } + } + return false; +} + +/** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + +function coerce(val) { + if (val instanceof Error) return val.stack || val.message; + return val; +} + + +/***/ }), +/* 804 */ +/***/ (function(module, exports) { + +/** + * Helpers. + */ + +var s = 1000; +var m = s * 60; +var h = m * 60; +var d = h * 24; +var y = d * 365.25; + +/** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} [options] + * @throws {Error} throw an error if val is not a non-empty string or a number + * @return {String|Number} + * @api public + */ + +module.exports = function(val, options) { + options = options || {}; + var type = typeof val; + if (type === 'string' && val.length > 0) { + return parse(val); + } else if (type === 'number' && isNaN(val) === false) { + return options.long ? fmtLong(val) : fmtShort(val); + } + throw new Error( + 'val is not a non-empty string or a valid number. val=' + + JSON.stringify(val) + ); +}; + +/** + * Parse the given `str` and return milliseconds. + * + * @param {String} str + * @return {Number} + * @api private + */ + +function parse(str) { + str = String(str); + if (str.length > 100) { + return; + } + var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec( + str + ); + if (!match) { + return; + } + var n = parseFloat(match[1]); + var type = (match[2] || 'ms').toLowerCase(); + switch (type) { + case 'years': + case 'year': + case 'yrs': + case 'yr': + case 'y': + return n * y; + case 'days': + case 'day': + case 'd': + return n * d; + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h; + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m; + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s; + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + default: + return undefined; + } +} + +/** + * Short format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtShort(ms) { + if (ms >= d) { + return Math.round(ms / d) + 'd'; + } + if (ms >= h) { + return Math.round(ms / h) + 'h'; + } + if (ms >= m) { + return Math.round(ms / m) + 'm'; + } + if (ms >= s) { + return Math.round(ms / s) + 's'; + } + return ms + 'ms'; +} + +/** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtLong(ms) { + return plural(ms, d, 'day') || + plural(ms, h, 'hour') || + plural(ms, m, 'minute') || + plural(ms, s, 'second') || + ms + ' ms'; +} + +/** + * Pluralization helper. + */ + +function plural(ms, n, name) { + if (ms < n) { + return; + } + if (ms < n * 1.5) { + return Math.floor(ms / n) + ' ' + name; + } + return Math.ceil(ms / n) + ' ' + name + 's'; +} + + +/***/ }), +/* 805 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * Module dependencies. + */ + +var tty = __webpack_require__(480); +var util = __webpack_require__(29); + +/** + * This is the Node.js implementation of `debug()`. + * + * Expose `debug()` as the module. + */ + +exports = module.exports = __webpack_require__(803); +exports.init = init; +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; + +/** + * Colors. + */ + +exports.colors = [6, 2, 3, 4, 5, 1]; + +/** + * Build up the default `inspectOpts` object from the environment variables. + * + * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js + */ + +exports.inspectOpts = Object.keys(process.env).filter(function (key) { + return /^debug_/i.test(key); +}).reduce(function (obj, key) { + // camel-case + var prop = key + .substring(6) + .toLowerCase() + .replace(/_([a-z])/g, function (_, k) { return k.toUpperCase() }); + + // coerce string value into JS value + var val = process.env[key]; + if (/^(yes|on|true|enabled)$/i.test(val)) val = true; + else if (/^(no|off|false|disabled)$/i.test(val)) val = false; + else if (val === 'null') val = null; + else val = Number(val); + + obj[prop] = val; + return obj; +}, {}); + +/** + * The file descriptor to write the `debug()` calls to. + * Set the `DEBUG_FD` env variable to override with another value. i.e.: + * + * $ DEBUG_FD=3 node script.js 3>debug.log + */ + +var fd = parseInt(process.env.DEBUG_FD, 10) || 2; + +if (1 !== fd && 2 !== fd) { + util.deprecate(function(){}, 'except for stderr(2) and stdout(1), any other usage of DEBUG_FD is deprecated. Override debug.log if you want to use a different log function (https://git.io/debug_fd)')() +} + +var stream = 1 === fd ? process.stdout : + 2 === fd ? process.stderr : + createWritableStdioStream(fd); + +/** + * Is stdout a TTY? Colored output is enabled when `true`. + */ + +function useColors() { + return 'colors' in exports.inspectOpts + ? Boolean(exports.inspectOpts.colors) + : tty.isatty(fd); +} + +/** + * Map %o to `util.inspect()`, all on a single line. + */ + +exports.formatters.o = function(v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts) + .split('\n').map(function(str) { + return str.trim() + }).join(' '); +}; + +/** + * Map %o to `util.inspect()`, allowing multiple lines if needed. + */ + +exports.formatters.O = function(v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts); +}; + +/** + * Adds ANSI color escape codes if enabled. + * + * @api public + */ + +function formatArgs(args) { + var name = this.namespace; + var useColors = this.useColors; + + if (useColors) { + var c = this.color; + var prefix = ' \u001b[3' + c + ';1m' + name + ' ' + '\u001b[0m'; + + args[0] = prefix + args[0].split('\n').join('\n' + prefix); + args.push('\u001b[3' + c + 'm+' + exports.humanize(this.diff) + '\u001b[0m'); + } else { + args[0] = new Date().toUTCString() + + ' ' + name + ' ' + args[0]; + } +} + +/** + * Invokes `util.format()` with the specified arguments and writes to `stream`. + */ + +function log() { + return stream.write(util.format.apply(util, arguments) + '\n'); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ + +function save(namespaces) { + if (null == namespaces) { + // If you set a process.env field to null or undefined, it gets cast to the + // string 'null' or 'undefined'. Just delete instead. + delete process.env.DEBUG; + } else { + process.env.DEBUG = namespaces; + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + +function load() { + return process.env.DEBUG; +} + +/** + * Copied from `node/src/node.js`. + * + * XXX: It's lame that node doesn't expose this API out-of-the-box. It also + * relies on the undocumented `tty_wrap.guessHandleType()` which is also lame. + */ + +function createWritableStdioStream (fd) { + var stream; + var tty_wrap = process.binding('tty_wrap'); + + // Note stream._type is used for test-module-load-list.js + + switch (tty_wrap.guessHandleType(fd)) { + case 'TTY': + stream = new tty.WriteStream(fd); + stream._type = 'tty'; + + // Hack to have stream not keep the event loop alive. + // See https://github.com/joyent/node/issues/1726 + if (stream._handle && stream._handle.unref) { + stream._handle.unref(); + } + break; + + case 'FILE': + var fs = __webpack_require__(23); + stream = new fs.SyncWriteStream(fd, { autoClose: false }); + stream._type = 'fs'; + break; + + case 'PIPE': + case 'TCP': + var net = __webpack_require__(806); + stream = new net.Socket({ + fd: fd, + readable: false, + writable: true + }); + + // FIXME Should probably have an option in net.Socket to create a + // stream from an existing fd which is writable only. But for now + // we'll just add this hack and set the `readable` member to false. + // Test: ./node test/fixtures/echo.js < /etc/passwd + stream.readable = false; + stream.read = null; + stream._type = 'pipe'; + + // FIXME Hack to have stream not keep the event loop alive. + // See https://github.com/joyent/node/issues/1726 + if (stream._handle && stream._handle.unref) { + stream._handle.unref(); + } + break; + + default: + // Probably an error on in uv_guess_handle() + throw new Error('Implement me. Unknown stream file type!'); + } + + // For supporting legacy API we put the FD here. + stream.fd = fd; + + stream._isStdio = true; + + return stream; +} + +/** + * Init logic for `debug` instances. + * + * Create a new `inspectOpts` object in case `useColors` is set + * differently for a particular `debug` instance. + */ + +function init (debug) { + debug.inspectOpts = {}; + + var keys = Object.keys(exports.inspectOpts); + for (var i = 0; i < keys.length; i++) { + debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]]; + } +} + +/** + * Enable namespaces listed in `process.env.DEBUG` initially. + */ + +exports.enable(load()); + + +/***/ }), +/* 806 */ +/***/ (function(module, exports) { + +module.exports = require("net"); + +/***/ }), +/* 807 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/** + * Module dependencies + */ + +exports.extend = __webpack_require__(738); +exports.SourceMap = __webpack_require__(808); +exports.sourceMapResolve = __webpack_require__(819); + +/** + * Convert backslash in the given string to forward slashes + */ + +exports.unixify = function(fp) { + return fp.split(/\\+/).join('/'); +}; + +/** + * Return true if `val` is a non-empty string + * + * @param {String} `str` + * @return {Boolean} + */ + +exports.isString = function(str) { + return str && typeof str === 'string'; +}; + +/** + * Cast `val` to an array + * @return {Array} + */ + +exports.arrayify = function(val) { + if (typeof val === 'string') return [val]; + return val ? (Array.isArray(val) ? val : [val]) : []; +}; + +/** + * Get the last `n` element from the given `array` + * @param {Array} `array` + * @return {*} + */ + +exports.last = function(arr, n) { + return arr[arr.length - (n || 1)]; +}; + + +/***/ }), +/* 808 */ +/***/ (function(module, exports, __webpack_require__) { + +/* + * Copyright 2009-2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE.txt or: + * http://opensource.org/licenses/BSD-3-Clause + */ +exports.SourceMapGenerator = __webpack_require__(809).SourceMapGenerator; +exports.SourceMapConsumer = __webpack_require__(815).SourceMapConsumer; +exports.SourceNode = __webpack_require__(818).SourceNode; + + +/***/ }), +/* 809 */ +/***/ (function(module, exports, __webpack_require__) { + +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +var base64VLQ = __webpack_require__(810); +var util = __webpack_require__(812); +var ArraySet = __webpack_require__(813).ArraySet; +var MappingList = __webpack_require__(814).MappingList; + +/** + * An instance of the SourceMapGenerator represents a source map which is + * being built incrementally. You may pass an object with the following + * properties: + * + * - file: The filename of the generated source. + * - sourceRoot: A root for all relative URLs in this source map. + */ +function SourceMapGenerator(aArgs) { + if (!aArgs) { + aArgs = {}; + } + this._file = util.getArg(aArgs, 'file', null); + this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null); + this._skipValidation = util.getArg(aArgs, 'skipValidation', false); + this._sources = new ArraySet(); + this._names = new ArraySet(); + this._mappings = new MappingList(); + this._sourcesContents = null; +} + +SourceMapGenerator.prototype._version = 3; + +/** + * Creates a new SourceMapGenerator based on a SourceMapConsumer + * + * @param aSourceMapConsumer The SourceMap. + */ +SourceMapGenerator.fromSourceMap = + function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) { + var sourceRoot = aSourceMapConsumer.sourceRoot; + var generator = new SourceMapGenerator({ + file: aSourceMapConsumer.file, + sourceRoot: sourceRoot + }); + aSourceMapConsumer.eachMapping(function (mapping) { + var newMapping = { + generated: { + line: mapping.generatedLine, + column: mapping.generatedColumn + } + }; + + if (mapping.source != null) { + newMapping.source = mapping.source; + if (sourceRoot != null) { + newMapping.source = util.relative(sourceRoot, newMapping.source); + } + + newMapping.original = { + line: mapping.originalLine, + column: mapping.originalColumn + }; + + if (mapping.name != null) { + newMapping.name = mapping.name; + } + } + + generator.addMapping(newMapping); + }); + aSourceMapConsumer.sources.forEach(function (sourceFile) { + var content = aSourceMapConsumer.sourceContentFor(sourceFile); + if (content != null) { + generator.setSourceContent(sourceFile, content); + } + }); + return generator; + }; + +/** + * Add a single mapping from original source line and column to the generated + * source's line and column for this source map being created. The mapping + * object should have the following properties: + * + * - generated: An object with the generated line and column positions. + * - original: An object with the original line and column positions. + * - source: The original source file (relative to the sourceRoot). + * - name: An optional original token name for this mapping. + */ +SourceMapGenerator.prototype.addMapping = + function SourceMapGenerator_addMapping(aArgs) { + var generated = util.getArg(aArgs, 'generated'); + var original = util.getArg(aArgs, 'original', null); + var source = util.getArg(aArgs, 'source', null); + var name = util.getArg(aArgs, 'name', null); + + if (!this._skipValidation) { + this._validateMapping(generated, original, source, name); + } + + if (source != null) { + source = String(source); + if (!this._sources.has(source)) { + this._sources.add(source); + } + } + + if (name != null) { + name = String(name); + if (!this._names.has(name)) { + this._names.add(name); + } + } + + this._mappings.add({ + generatedLine: generated.line, + generatedColumn: generated.column, + originalLine: original != null && original.line, + originalColumn: original != null && original.column, + source: source, + name: name + }); + }; + +/** + * Set the source content for a source file. + */ +SourceMapGenerator.prototype.setSourceContent = + function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) { + var source = aSourceFile; + if (this._sourceRoot != null) { + source = util.relative(this._sourceRoot, source); + } + + if (aSourceContent != null) { + // Add the source content to the _sourcesContents map. + // Create a new _sourcesContents map if the property is null. + if (!this._sourcesContents) { + this._sourcesContents = Object.create(null); + } + this._sourcesContents[util.toSetString(source)] = aSourceContent; + } else if (this._sourcesContents) { + // Remove the source file from the _sourcesContents map. + // If the _sourcesContents map is empty, set the property to null. + delete this._sourcesContents[util.toSetString(source)]; + if (Object.keys(this._sourcesContents).length === 0) { + this._sourcesContents = null; + } + } + }; + +/** + * Applies the mappings of a sub-source-map for a specific source file to the + * source map being generated. Each mapping to the supplied source file is + * rewritten using the supplied source map. Note: The resolution for the + * resulting mappings is the minimium of this map and the supplied map. + * + * @param aSourceMapConsumer The source map to be applied. + * @param aSourceFile Optional. The filename of the source file. + * If omitted, SourceMapConsumer's file property will be used. + * @param aSourceMapPath Optional. The dirname of the path to the source map + * to be applied. If relative, it is relative to the SourceMapConsumer. + * This parameter is needed when the two source maps aren't in the same + * directory, and the source map to be applied contains relative source + * paths. If so, those relative source paths need to be rewritten + * relative to the SourceMapGenerator. + */ +SourceMapGenerator.prototype.applySourceMap = + function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) { + var sourceFile = aSourceFile; + // If aSourceFile is omitted, we will use the file property of the SourceMap + if (aSourceFile == null) { + if (aSourceMapConsumer.file == null) { + throw new Error( + 'SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' + + 'or the source map\'s "file" property. Both were omitted.' + ); + } + sourceFile = aSourceMapConsumer.file; + } + var sourceRoot = this._sourceRoot; + // Make "sourceFile" relative if an absolute Url is passed. + if (sourceRoot != null) { + sourceFile = util.relative(sourceRoot, sourceFile); + } + // Applying the SourceMap can add and remove items from the sources and + // the names array. + var newSources = new ArraySet(); + var newNames = new ArraySet(); + + // Find mappings for the "sourceFile" + this._mappings.unsortedForEach(function (mapping) { + if (mapping.source === sourceFile && mapping.originalLine != null) { + // Check if it can be mapped by the source map, then update the mapping. + var original = aSourceMapConsumer.originalPositionFor({ + line: mapping.originalLine, + column: mapping.originalColumn + }); + if (original.source != null) { + // Copy mapping + mapping.source = original.source; + if (aSourceMapPath != null) { + mapping.source = util.join(aSourceMapPath, mapping.source) + } + if (sourceRoot != null) { + mapping.source = util.relative(sourceRoot, mapping.source); + } + mapping.originalLine = original.line; + mapping.originalColumn = original.column; + if (original.name != null) { + mapping.name = original.name; + } + } + } + + var source = mapping.source; + if (source != null && !newSources.has(source)) { + newSources.add(source); + } + + var name = mapping.name; + if (name != null && !newNames.has(name)) { + newNames.add(name); + } + + }, this); + this._sources = newSources; + this._names = newNames; + + // Copy sourcesContents of applied map. + aSourceMapConsumer.sources.forEach(function (sourceFile) { + var content = aSourceMapConsumer.sourceContentFor(sourceFile); + if (content != null) { + if (aSourceMapPath != null) { + sourceFile = util.join(aSourceMapPath, sourceFile); + } + if (sourceRoot != null) { + sourceFile = util.relative(sourceRoot, sourceFile); + } + this.setSourceContent(sourceFile, content); + } + }, this); + }; + +/** + * A mapping can have one of the three levels of data: + * + * 1. Just the generated position. + * 2. The Generated position, original position, and original source. + * 3. Generated and original position, original source, as well as a name + * token. + * + * To maintain consistency, we validate that any new mapping being added falls + * in to one of these categories. + */ +SourceMapGenerator.prototype._validateMapping = + function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource, + aName) { + // When aOriginal is truthy but has empty values for .line and .column, + // it is most likely a programmer error. In this case we throw a very + // specific error message to try to guide them the right way. + // For example: https://github.com/Polymer/polymer-bundler/pull/519 + if (aOriginal && typeof aOriginal.line !== 'number' && typeof aOriginal.column !== 'number') { + throw new Error( + 'original.line and original.column are not numbers -- you probably meant to omit ' + + 'the original mapping entirely and only map the generated position. If so, pass ' + + 'null for the original mapping instead of an object with empty or null values.' + ); + } + + if (aGenerated && 'line' in aGenerated && 'column' in aGenerated + && aGenerated.line > 0 && aGenerated.column >= 0 + && !aOriginal && !aSource && !aName) { + // Case 1. + return; + } + else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated + && aOriginal && 'line' in aOriginal && 'column' in aOriginal + && aGenerated.line > 0 && aGenerated.column >= 0 + && aOriginal.line > 0 && aOriginal.column >= 0 + && aSource) { + // Cases 2 and 3. + return; + } + else { + throw new Error('Invalid mapping: ' + JSON.stringify({ + generated: aGenerated, + source: aSource, + original: aOriginal, + name: aName + })); + } + }; + +/** + * Serialize the accumulated mappings in to the stream of base 64 VLQs + * specified by the source map format. + */ +SourceMapGenerator.prototype._serializeMappings = + function SourceMapGenerator_serializeMappings() { + var previousGeneratedColumn = 0; + var previousGeneratedLine = 1; + var previousOriginalColumn = 0; + var previousOriginalLine = 0; + var previousName = 0; + var previousSource = 0; + var result = ''; + var next; + var mapping; + var nameIdx; + var sourceIdx; + + var mappings = this._mappings.toArray(); + for (var i = 0, len = mappings.length; i < len; i++) { + mapping = mappings[i]; + next = '' + + if (mapping.generatedLine !== previousGeneratedLine) { + previousGeneratedColumn = 0; + while (mapping.generatedLine !== previousGeneratedLine) { + next += ';'; + previousGeneratedLine++; + } + } + else { + if (i > 0) { + if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) { + continue; + } + next += ','; + } + } + + next += base64VLQ.encode(mapping.generatedColumn + - previousGeneratedColumn); + previousGeneratedColumn = mapping.generatedColumn; + + if (mapping.source != null) { + sourceIdx = this._sources.indexOf(mapping.source); + next += base64VLQ.encode(sourceIdx - previousSource); + previousSource = sourceIdx; + + // lines are stored 0-based in SourceMap spec version 3 + next += base64VLQ.encode(mapping.originalLine - 1 + - previousOriginalLine); + previousOriginalLine = mapping.originalLine - 1; + + next += base64VLQ.encode(mapping.originalColumn + - previousOriginalColumn); + previousOriginalColumn = mapping.originalColumn; + + if (mapping.name != null) { + nameIdx = this._names.indexOf(mapping.name); + next += base64VLQ.encode(nameIdx - previousName); + previousName = nameIdx; + } + } + + result += next; + } + + return result; + }; + +SourceMapGenerator.prototype._generateSourcesContent = + function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) { + return aSources.map(function (source) { + if (!this._sourcesContents) { + return null; + } + if (aSourceRoot != null) { + source = util.relative(aSourceRoot, source); + } + var key = util.toSetString(source); + return Object.prototype.hasOwnProperty.call(this._sourcesContents, key) + ? this._sourcesContents[key] + : null; + }, this); + }; + +/** + * Externalize the source map. + */ +SourceMapGenerator.prototype.toJSON = + function SourceMapGenerator_toJSON() { + var map = { + version: this._version, + sources: this._sources.toArray(), + names: this._names.toArray(), + mappings: this._serializeMappings() + }; + if (this._file != null) { + map.file = this._file; + } + if (this._sourceRoot != null) { + map.sourceRoot = this._sourceRoot; + } + if (this._sourcesContents) { + map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot); + } + + return map; + }; + +/** + * Render the source map being generated to a string. + */ +SourceMapGenerator.prototype.toString = + function SourceMapGenerator_toString() { + return JSON.stringify(this.toJSON()); + }; + +exports.SourceMapGenerator = SourceMapGenerator; + + +/***/ }), +/* 810 */ +/***/ (function(module, exports, __webpack_require__) { + +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + * + * Based on the Base 64 VLQ implementation in Closure Compiler: + * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java + * + * Copyright 2011 The Closure Compiler Authors. All rights reserved. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +var base64 = __webpack_require__(811); + +// A single base 64 digit can contain 6 bits of data. For the base 64 variable +// length quantities we use in the source map spec, the first bit is the sign, +// the next four bits are the actual value, and the 6th bit is the +// continuation bit. The continuation bit tells us whether there are more +// digits in this value following this digit. +// +// Continuation +// | Sign +// | | +// V V +// 101011 + +var VLQ_BASE_SHIFT = 5; + +// binary: 100000 +var VLQ_BASE = 1 << VLQ_BASE_SHIFT; + +// binary: 011111 +var VLQ_BASE_MASK = VLQ_BASE - 1; + +// binary: 100000 +var VLQ_CONTINUATION_BIT = VLQ_BASE; + +/** + * Converts from a two-complement value to a value where the sign bit is + * placed in the least significant bit. For example, as decimals: + * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary) + * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary) + */ +function toVLQSigned(aValue) { + return aValue < 0 + ? ((-aValue) << 1) + 1 + : (aValue << 1) + 0; +} + +/** + * Converts to a two-complement value from a value where the sign bit is + * placed in the least significant bit. For example, as decimals: + * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1 + * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2 + */ +function fromVLQSigned(aValue) { + var isNegative = (aValue & 1) === 1; + var shifted = aValue >> 1; + return isNegative + ? -shifted + : shifted; +} + +/** + * Returns the base 64 VLQ encoded value. + */ +exports.encode = function base64VLQ_encode(aValue) { + var encoded = ""; + var digit; + + var vlq = toVLQSigned(aValue); + + do { + digit = vlq & VLQ_BASE_MASK; + vlq >>>= VLQ_BASE_SHIFT; + if (vlq > 0) { + // There are still more digits in this value, so we must make sure the + // continuation bit is marked. + digit |= VLQ_CONTINUATION_BIT; + } + encoded += base64.encode(digit); + } while (vlq > 0); + + return encoded; +}; + +/** + * Decodes the next base 64 VLQ value from the given string and returns the + * value and the rest of the string via the out parameter. + */ +exports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) { + var strLen = aStr.length; + var result = 0; + var shift = 0; + var continuation, digit; + + do { + if (aIndex >= strLen) { + throw new Error("Expected more digits in base 64 VLQ value."); + } + + digit = base64.decode(aStr.charCodeAt(aIndex++)); + if (digit === -1) { + throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1)); + } + + continuation = !!(digit & VLQ_CONTINUATION_BIT); + digit &= VLQ_BASE_MASK; + result = result + (digit << shift); + shift += VLQ_BASE_SHIFT; + } while (continuation); + + aOutParam.value = fromVLQSigned(result); + aOutParam.rest = aIndex; +}; + + +/***/ }), +/* 811 */ +/***/ (function(module, exports) { + +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split(''); + +/** + * Encode an integer in the range of 0 to 63 to a single base 64 digit. + */ +exports.encode = function (number) { + if (0 <= number && number < intToCharMap.length) { + return intToCharMap[number]; + } + throw new TypeError("Must be between 0 and 63: " + number); +}; + +/** + * Decode a single base 64 character code digit to an integer. Returns -1 on + * failure. + */ +exports.decode = function (charCode) { + var bigA = 65; // 'A' + var bigZ = 90; // 'Z' + + var littleA = 97; // 'a' + var littleZ = 122; // 'z' + + var zero = 48; // '0' + var nine = 57; // '9' + + var plus = 43; // '+' + var slash = 47; // '/' + + var littleOffset = 26; + var numberOffset = 52; + + // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ + if (bigA <= charCode && charCode <= bigZ) { + return (charCode - bigA); + } + + // 26 - 51: abcdefghijklmnopqrstuvwxyz + if (littleA <= charCode && charCode <= littleZ) { + return (charCode - littleA + littleOffset); + } + + // 52 - 61: 0123456789 + if (zero <= charCode && charCode <= nine) { + return (charCode - zero + numberOffset); + } + + // 62: + + if (charCode == plus) { + return 62; + } + + // 63: / + if (charCode == slash) { + return 63; + } + + // Invalid base64 digit. + return -1; +}; + + +/***/ }), +/* 812 */ +/***/ (function(module, exports) { + +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +/** + * This is a helper function for getting values from parameter/options + * objects. + * + * @param args The object we are extracting values from + * @param name The name of the property we are getting. + * @param defaultValue An optional value to return if the property is missing + * from the object. If this is not specified and the property is missing, an + * error will be thrown. + */ +function getArg(aArgs, aName, aDefaultValue) { + if (aName in aArgs) { + return aArgs[aName]; + } else if (arguments.length === 3) { + return aDefaultValue; + } else { + throw new Error('"' + aName + '" is a required argument.'); + } +} +exports.getArg = getArg; + +var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/; +var dataUrlRegexp = /^data:.+\,.+$/; + +function urlParse(aUrl) { + var match = aUrl.match(urlRegexp); + if (!match) { + return null; + } + return { + scheme: match[1], + auth: match[2], + host: match[3], + port: match[4], + path: match[5] + }; +} +exports.urlParse = urlParse; + +function urlGenerate(aParsedUrl) { + var url = ''; + if (aParsedUrl.scheme) { + url += aParsedUrl.scheme + ':'; + } + url += '//'; + if (aParsedUrl.auth) { + url += aParsedUrl.auth + '@'; + } + if (aParsedUrl.host) { + url += aParsedUrl.host; + } + if (aParsedUrl.port) { + url += ":" + aParsedUrl.port + } + if (aParsedUrl.path) { + url += aParsedUrl.path; + } + return url; +} +exports.urlGenerate = urlGenerate; + +/** + * Normalizes a path, or the path portion of a URL: + * + * - Replaces consecutive slashes with one slash. + * - Removes unnecessary '.' parts. + * - Removes unnecessary '

/..' parts. + * + * Based on code in the Node.js 'path' core module. + * + * @param aPath The path or url to normalize. + */ +function normalize(aPath) { + var path = aPath; + var url = urlParse(aPath); + if (url) { + if (!url.path) { + return aPath; + } + path = url.path; + } + var isAbsolute = exports.isAbsolute(path); + + var parts = path.split(/\/+/); + for (var part, up = 0, i = parts.length - 1; i >= 0; i--) { + part = parts[i]; + if (part === '.') { + parts.splice(i, 1); + } else if (part === '..') { + up++; + } else if (up > 0) { + if (part === '') { + // The first part is blank if the path is absolute. Trying to go + // above the root is a no-op. Therefore we can remove all '..' parts + // directly after the root. + parts.splice(i + 1, up); + up = 0; + } else { + parts.splice(i, 2); + up--; + } + } + } + path = parts.join('/'); + + if (path === '') { + path = isAbsolute ? '/' : '.'; + } + + if (url) { + url.path = path; + return urlGenerate(url); + } + return path; +} +exports.normalize = normalize; + +/** + * Joins two paths/URLs. + * + * @param aRoot The root path or URL. + * @param aPath The path or URL to be joined with the root. + * + * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a + * scheme-relative URL: Then the scheme of aRoot, if any, is prepended + * first. + * - Otherwise aPath is a path. If aRoot is a URL, then its path portion + * is updated with the result and aRoot is returned. Otherwise the result + * is returned. + * - If aPath is absolute, the result is aPath. + * - Otherwise the two paths are joined with a slash. + * - Joining for example 'http://' and 'www.example.com' is also supported. + */ +function join(aRoot, aPath) { + if (aRoot === "") { + aRoot = "."; + } + if (aPath === "") { + aPath = "."; + } + var aPathUrl = urlParse(aPath); + var aRootUrl = urlParse(aRoot); + if (aRootUrl) { + aRoot = aRootUrl.path || '/'; + } + + // `join(foo, '//www.example.org')` + if (aPathUrl && !aPathUrl.scheme) { + if (aRootUrl) { + aPathUrl.scheme = aRootUrl.scheme; + } + return urlGenerate(aPathUrl); + } + + if (aPathUrl || aPath.match(dataUrlRegexp)) { + return aPath; + } + + // `join('http://', 'www.example.com')` + if (aRootUrl && !aRootUrl.host && !aRootUrl.path) { + aRootUrl.host = aPath; + return urlGenerate(aRootUrl); + } + + var joined = aPath.charAt(0) === '/' + ? aPath + : normalize(aRoot.replace(/\/+$/, '') + '/' + aPath); + + if (aRootUrl) { + aRootUrl.path = joined; + return urlGenerate(aRootUrl); + } + return joined; +} +exports.join = join; + +exports.isAbsolute = function (aPath) { + return aPath.charAt(0) === '/' || !!aPath.match(urlRegexp); +}; + +/** + * Make a path relative to a URL or another path. + * + * @param aRoot The root path or URL. + * @param aPath The path or URL to be made relative to aRoot. + */ +function relative(aRoot, aPath) { + if (aRoot === "") { + aRoot = "."; + } + + aRoot = aRoot.replace(/\/$/, ''); + + // It is possible for the path to be above the root. In this case, simply + // checking whether the root is a prefix of the path won't work. Instead, we + // need to remove components from the root one by one, until either we find + // a prefix that fits, or we run out of components to remove. + var level = 0; + while (aPath.indexOf(aRoot + '/') !== 0) { + var index = aRoot.lastIndexOf("/"); + if (index < 0) { + return aPath; + } + + // If the only part of the root that is left is the scheme (i.e. http://, + // file:///, etc.), one or more slashes (/), or simply nothing at all, we + // have exhausted all components, so the path is not relative to the root. + aRoot = aRoot.slice(0, index); + if (aRoot.match(/^([^\/]+:\/)?\/*$/)) { + return aPath; + } + + ++level; + } + + // Make sure we add a "../" for each component we removed from the root. + return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1); +} +exports.relative = relative; + +var supportsNullProto = (function () { + var obj = Object.create(null); + return !('__proto__' in obj); +}()); + +function identity (s) { + return s; +} + +/** + * Because behavior goes wacky when you set `__proto__` on objects, we + * have to prefix all the strings in our set with an arbitrary character. + * + * See https://github.com/mozilla/source-map/pull/31 and + * https://github.com/mozilla/source-map/issues/30 + * + * @param String aStr + */ +function toSetString(aStr) { + if (isProtoString(aStr)) { + return '$' + aStr; + } + + return aStr; +} +exports.toSetString = supportsNullProto ? identity : toSetString; + +function fromSetString(aStr) { + if (isProtoString(aStr)) { + return aStr.slice(1); + } + + return aStr; +} +exports.fromSetString = supportsNullProto ? identity : fromSetString; + +function isProtoString(s) { + if (!s) { + return false; + } + + var length = s.length; + + if (length < 9 /* "__proto__".length */) { + return false; + } + + if (s.charCodeAt(length - 1) !== 95 /* '_' */ || + s.charCodeAt(length - 2) !== 95 /* '_' */ || + s.charCodeAt(length - 3) !== 111 /* 'o' */ || + s.charCodeAt(length - 4) !== 116 /* 't' */ || + s.charCodeAt(length - 5) !== 111 /* 'o' */ || + s.charCodeAt(length - 6) !== 114 /* 'r' */ || + s.charCodeAt(length - 7) !== 112 /* 'p' */ || + s.charCodeAt(length - 8) !== 95 /* '_' */ || + s.charCodeAt(length - 9) !== 95 /* '_' */) { + return false; + } + + for (var i = length - 10; i >= 0; i--) { + if (s.charCodeAt(i) !== 36 /* '$' */) { + return false; + } + } + + return true; +} + +/** + * Comparator between two mappings where the original positions are compared. + * + * Optionally pass in `true` as `onlyCompareGenerated` to consider two + * mappings with the same original source/line/column, but different generated + * line and column the same. Useful when searching for a mapping with a + * stubbed out mapping. + */ +function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) { + var cmp = mappingA.source - mappingB.source; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalLine - mappingB.originalLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalColumn - mappingB.originalColumn; + if (cmp !== 0 || onlyCompareOriginal) { + return cmp; + } + + cmp = mappingA.generatedColumn - mappingB.generatedColumn; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.generatedLine - mappingB.generatedLine; + if (cmp !== 0) { + return cmp; + } + + return mappingA.name - mappingB.name; +} +exports.compareByOriginalPositions = compareByOriginalPositions; + +/** + * Comparator between two mappings with deflated source and name indices where + * the generated positions are compared. + * + * Optionally pass in `true` as `onlyCompareGenerated` to consider two + * mappings with the same generated line and column, but different + * source/name/original line and column the same. Useful when searching for a + * mapping with a stubbed out mapping. + */ +function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) { + var cmp = mappingA.generatedLine - mappingB.generatedLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.generatedColumn - mappingB.generatedColumn; + if (cmp !== 0 || onlyCompareGenerated) { + return cmp; + } + + cmp = mappingA.source - mappingB.source; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalLine - mappingB.originalLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalColumn - mappingB.originalColumn; + if (cmp !== 0) { + return cmp; + } + + return mappingA.name - mappingB.name; +} +exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated; + +function strcmp(aStr1, aStr2) { + if (aStr1 === aStr2) { + return 0; + } + + if (aStr1 > aStr2) { + return 1; + } + + return -1; +} + +/** + * Comparator between two mappings with inflated source and name strings where + * the generated positions are compared. + */ +function compareByGeneratedPositionsInflated(mappingA, mappingB) { + var cmp = mappingA.generatedLine - mappingB.generatedLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.generatedColumn - mappingB.generatedColumn; + if (cmp !== 0) { + return cmp; + } + + cmp = strcmp(mappingA.source, mappingB.source); + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalLine - mappingB.originalLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalColumn - mappingB.originalColumn; + if (cmp !== 0) { + return cmp; + } + + return strcmp(mappingA.name, mappingB.name); +} +exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated; + + +/***/ }), +/* 813 */ +/***/ (function(module, exports, __webpack_require__) { + +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +var util = __webpack_require__(812); +var has = Object.prototype.hasOwnProperty; +var hasNativeMap = typeof Map !== "undefined"; + +/** + * A data structure which is a combination of an array and a set. Adding a new + * member is O(1), testing for membership is O(1), and finding the index of an + * element is O(1). Removing elements from the set is not supported. Only + * strings are supported for membership. + */ +function ArraySet() { + this._array = []; + this._set = hasNativeMap ? new Map() : Object.create(null); +} + +/** + * Static method for creating ArraySet instances from an existing array. + */ +ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) { + var set = new ArraySet(); + for (var i = 0, len = aArray.length; i < len; i++) { + set.add(aArray[i], aAllowDuplicates); + } + return set; +}; + +/** + * Return how many unique items are in this ArraySet. If duplicates have been + * added, than those do not count towards the size. + * + * @returns Number + */ +ArraySet.prototype.size = function ArraySet_size() { + return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length; +}; + +/** + * Add the given string to this set. + * + * @param String aStr + */ +ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) { + var sStr = hasNativeMap ? aStr : util.toSetString(aStr); + var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr); + var idx = this._array.length; + if (!isDuplicate || aAllowDuplicates) { + this._array.push(aStr); + } + if (!isDuplicate) { + if (hasNativeMap) { + this._set.set(aStr, idx); + } else { + this._set[sStr] = idx; + } + } +}; + +/** + * Is the given string a member of this set? + * + * @param String aStr + */ +ArraySet.prototype.has = function ArraySet_has(aStr) { + if (hasNativeMap) { + return this._set.has(aStr); + } else { + var sStr = util.toSetString(aStr); + return has.call(this._set, sStr); + } +}; + +/** + * What is the index of the given string in the array? + * + * @param String aStr + */ +ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) { + if (hasNativeMap) { + var idx = this._set.get(aStr); + if (idx >= 0) { + return idx; + } + } else { + var sStr = util.toSetString(aStr); + if (has.call(this._set, sStr)) { + return this._set[sStr]; + } + } + + throw new Error('"' + aStr + '" is not in the set.'); +}; + +/** + * What is the element at the given index? + * + * @param Number aIdx + */ +ArraySet.prototype.at = function ArraySet_at(aIdx) { + if (aIdx >= 0 && aIdx < this._array.length) { + return this._array[aIdx]; + } + throw new Error('No element indexed by ' + aIdx); +}; + +/** + * Returns the array representation of this set (which has the proper indices + * indicated by indexOf). Note that this is a copy of the internal array used + * for storing the members so that no one can mess with internal state. + */ +ArraySet.prototype.toArray = function ArraySet_toArray() { + return this._array.slice(); +}; + +exports.ArraySet = ArraySet; + + +/***/ }), +/* 814 */ +/***/ (function(module, exports, __webpack_require__) { + +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2014 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +var util = __webpack_require__(812); + +/** + * Determine whether mappingB is after mappingA with respect to generated + * position. + */ +function generatedPositionAfter(mappingA, mappingB) { + // Optimized for most common case + var lineA = mappingA.generatedLine; + var lineB = mappingB.generatedLine; + var columnA = mappingA.generatedColumn; + var columnB = mappingB.generatedColumn; + return lineB > lineA || lineB == lineA && columnB >= columnA || + util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0; +} + +/** + * A data structure to provide a sorted view of accumulated mappings in a + * performance conscious manner. It trades a neglibable overhead in general + * case for a large speedup in case of mappings being added in order. + */ +function MappingList() { + this._array = []; + this._sorted = true; + // Serves as infimum + this._last = {generatedLine: -1, generatedColumn: 0}; +} + +/** + * Iterate through internal items. This method takes the same arguments that + * `Array.prototype.forEach` takes. + * + * NOTE: The order of the mappings is NOT guaranteed. + */ +MappingList.prototype.unsortedForEach = + function MappingList_forEach(aCallback, aThisArg) { + this._array.forEach(aCallback, aThisArg); + }; + +/** + * Add the given source mapping. + * + * @param Object aMapping + */ +MappingList.prototype.add = function MappingList_add(aMapping) { + if (generatedPositionAfter(this._last, aMapping)) { + this._last = aMapping; + this._array.push(aMapping); + } else { + this._sorted = false; + this._array.push(aMapping); + } +}; + +/** + * Returns the flat, sorted array of mappings. The mappings are sorted by + * generated position. + * + * WARNING: This method returns internal data without copying, for + * performance. The return value must NOT be mutated, and should be treated as + * an immutable borrow. If you want to take ownership, you must make your own + * copy. + */ +MappingList.prototype.toArray = function MappingList_toArray() { + if (!this._sorted) { + this._array.sort(util.compareByGeneratedPositionsInflated); + this._sorted = true; + } + return this._array; +}; + +exports.MappingList = MappingList; + + +/***/ }), +/* 815 */ +/***/ (function(module, exports, __webpack_require__) { + +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +var util = __webpack_require__(812); +var binarySearch = __webpack_require__(816); +var ArraySet = __webpack_require__(813).ArraySet; +var base64VLQ = __webpack_require__(810); +var quickSort = __webpack_require__(817).quickSort; + +function SourceMapConsumer(aSourceMap) { + var sourceMap = aSourceMap; + if (typeof aSourceMap === 'string') { + sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, '')); + } + + return sourceMap.sections != null + ? new IndexedSourceMapConsumer(sourceMap) + : new BasicSourceMapConsumer(sourceMap); +} + +SourceMapConsumer.fromSourceMap = function(aSourceMap) { + return BasicSourceMapConsumer.fromSourceMap(aSourceMap); +} + +/** + * The version of the source mapping spec that we are consuming. + */ +SourceMapConsumer.prototype._version = 3; + +// `__generatedMappings` and `__originalMappings` are arrays that hold the +// parsed mapping coordinates from the source map's "mappings" attribute. They +// are lazily instantiated, accessed via the `_generatedMappings` and +// `_originalMappings` getters respectively, and we only parse the mappings +// and create these arrays once queried for a source location. We jump through +// these hoops because there can be many thousands of mappings, and parsing +// them is expensive, so we only want to do it if we must. +// +// Each object in the arrays is of the form: +// +// { +// generatedLine: The line number in the generated code, +// generatedColumn: The column number in the generated code, +// source: The path to the original source file that generated this +// chunk of code, +// originalLine: The line number in the original source that +// corresponds to this chunk of generated code, +// originalColumn: The column number in the original source that +// corresponds to this chunk of generated code, +// name: The name of the original symbol which generated this chunk of +// code. +// } +// +// All properties except for `generatedLine` and `generatedColumn` can be +// `null`. +// +// `_generatedMappings` is ordered by the generated positions. +// +// `_originalMappings` is ordered by the original positions. + +SourceMapConsumer.prototype.__generatedMappings = null; +Object.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', { + get: function () { + if (!this.__generatedMappings) { + this._parseMappings(this._mappings, this.sourceRoot); + } + + return this.__generatedMappings; + } +}); + +SourceMapConsumer.prototype.__originalMappings = null; +Object.defineProperty(SourceMapConsumer.prototype, '_originalMappings', { + get: function () { + if (!this.__originalMappings) { + this._parseMappings(this._mappings, this.sourceRoot); + } + + return this.__originalMappings; + } +}); + +SourceMapConsumer.prototype._charIsMappingSeparator = + function SourceMapConsumer_charIsMappingSeparator(aStr, index) { + var c = aStr.charAt(index); + return c === ";" || c === ","; + }; + +/** + * Parse the mappings in a string in to a data structure which we can easily + * query (the ordered arrays in the `this.__generatedMappings` and + * `this.__originalMappings` properties). + */ +SourceMapConsumer.prototype._parseMappings = + function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { + throw new Error("Subclasses must implement _parseMappings"); + }; + +SourceMapConsumer.GENERATED_ORDER = 1; +SourceMapConsumer.ORIGINAL_ORDER = 2; + +SourceMapConsumer.GREATEST_LOWER_BOUND = 1; +SourceMapConsumer.LEAST_UPPER_BOUND = 2; + +/** + * Iterate over each mapping between an original source/line/column and a + * generated line/column in this source map. + * + * @param Function aCallback + * The function that is called with each mapping. + * @param Object aContext + * Optional. If specified, this object will be the value of `this` every + * time that `aCallback` is called. + * @param aOrder + * Either `SourceMapConsumer.GENERATED_ORDER` or + * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to + * iterate over the mappings sorted by the generated file's line/column + * order or the original's source/line/column order, respectively. Defaults to + * `SourceMapConsumer.GENERATED_ORDER`. + */ +SourceMapConsumer.prototype.eachMapping = + function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) { + var context = aContext || null; + var order = aOrder || SourceMapConsumer.GENERATED_ORDER; + + var mappings; + switch (order) { + case SourceMapConsumer.GENERATED_ORDER: + mappings = this._generatedMappings; + break; + case SourceMapConsumer.ORIGINAL_ORDER: + mappings = this._originalMappings; + break; + default: + throw new Error("Unknown order of iteration."); + } + + var sourceRoot = this.sourceRoot; + mappings.map(function (mapping) { + var source = mapping.source === null ? null : this._sources.at(mapping.source); + if (source != null && sourceRoot != null) { + source = util.join(sourceRoot, source); + } + return { + source: source, + generatedLine: mapping.generatedLine, + generatedColumn: mapping.generatedColumn, + originalLine: mapping.originalLine, + originalColumn: mapping.originalColumn, + name: mapping.name === null ? null : this._names.at(mapping.name) + }; + }, this).forEach(aCallback, context); + }; + +/** + * Returns all generated line and column information for the original source, + * line, and column provided. If no column is provided, returns all mappings + * corresponding to a either the line we are searching for or the next + * closest line that has any mappings. Otherwise, returns all mappings + * corresponding to the given line and either the column we are searching for + * or the next closest column that has any offsets. + * + * The only argument is an object with the following properties: + * + * - source: The filename of the original source. + * - line: The line number in the original source. + * - column: Optional. the column number in the original source. + * + * and an array of objects is returned, each with the following properties: + * + * - line: The line number in the generated source, or null. + * - column: The column number in the generated source, or null. + */ +SourceMapConsumer.prototype.allGeneratedPositionsFor = + function SourceMapConsumer_allGeneratedPositionsFor(aArgs) { + var line = util.getArg(aArgs, 'line'); + + // When there is no exact match, BasicSourceMapConsumer.prototype._findMapping + // returns the index of the closest mapping less than the needle. By + // setting needle.originalColumn to 0, we thus find the last mapping for + // the given line, provided such a mapping exists. + var needle = { + source: util.getArg(aArgs, 'source'), + originalLine: line, + originalColumn: util.getArg(aArgs, 'column', 0) + }; + + if (this.sourceRoot != null) { + needle.source = util.relative(this.sourceRoot, needle.source); + } + if (!this._sources.has(needle.source)) { + return []; + } + needle.source = this._sources.indexOf(needle.source); + + var mappings = []; + + var index = this._findMapping(needle, + this._originalMappings, + "originalLine", + "originalColumn", + util.compareByOriginalPositions, + binarySearch.LEAST_UPPER_BOUND); + if (index >= 0) { + var mapping = this._originalMappings[index]; + + if (aArgs.column === undefined) { + var originalLine = mapping.originalLine; + + // Iterate until either we run out of mappings, or we run into + // a mapping for a different line than the one we found. Since + // mappings are sorted, this is guaranteed to find all mappings for + // the line we found. + while (mapping && mapping.originalLine === originalLine) { + mappings.push({ + line: util.getArg(mapping, 'generatedLine', null), + column: util.getArg(mapping, 'generatedColumn', null), + lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) + }); + + mapping = this._originalMappings[++index]; + } + } else { + var originalColumn = mapping.originalColumn; + + // Iterate until either we run out of mappings, or we run into + // a mapping for a different line than the one we were searching for. + // Since mappings are sorted, this is guaranteed to find all mappings for + // the line we are searching for. + while (mapping && + mapping.originalLine === line && + mapping.originalColumn == originalColumn) { + mappings.push({ + line: util.getArg(mapping, 'generatedLine', null), + column: util.getArg(mapping, 'generatedColumn', null), + lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) + }); + + mapping = this._originalMappings[++index]; + } + } + } + + return mappings; + }; + +exports.SourceMapConsumer = SourceMapConsumer; + +/** + * A BasicSourceMapConsumer instance represents a parsed source map which we can + * query for information about the original file positions by giving it a file + * position in the generated source. + * + * The only parameter is the raw source map (either as a JSON string, or + * already parsed to an object). According to the spec, source maps have the + * following attributes: + * + * - version: Which version of the source map spec this map is following. + * - sources: An array of URLs to the original source files. + * - names: An array of identifiers which can be referrenced by individual mappings. + * - sourceRoot: Optional. The URL root from which all sources are relative. + * - sourcesContent: Optional. An array of contents of the original source files. + * - mappings: A string of base64 VLQs which contain the actual mappings. + * - file: Optional. The generated file this source map is associated with. + * + * Here is an example source map, taken from the source map spec[0]: + * + * { + * version : 3, + * file: "out.js", + * sourceRoot : "", + * sources: ["foo.js", "bar.js"], + * names: ["src", "maps", "are", "fun"], + * mappings: "AA,AB;;ABCDE;" + * } + * + * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1# + */ +function BasicSourceMapConsumer(aSourceMap) { + var sourceMap = aSourceMap; + if (typeof aSourceMap === 'string') { + sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, '')); + } + + var version = util.getArg(sourceMap, 'version'); + var sources = util.getArg(sourceMap, 'sources'); + // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which + // requires the array) to play nice here. + var names = util.getArg(sourceMap, 'names', []); + var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null); + var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null); + var mappings = util.getArg(sourceMap, 'mappings'); + var file = util.getArg(sourceMap, 'file', null); + + // Once again, Sass deviates from the spec and supplies the version as a + // string rather than a number, so we use loose equality checking here. + if (version != this._version) { + throw new Error('Unsupported version: ' + version); + } + + sources = sources + .map(String) + // Some source maps produce relative source paths like "./foo.js" instead of + // "foo.js". Normalize these first so that future comparisons will succeed. + // See bugzil.la/1090768. + .map(util.normalize) + // Always ensure that absolute sources are internally stored relative to + // the source root, if the source root is absolute. Not doing this would + // be particularly problematic when the source root is a prefix of the + // source (valid, but why??). See github issue #199 and bugzil.la/1188982. + .map(function (source) { + return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source) + ? util.relative(sourceRoot, source) + : source; + }); + + // Pass `true` below to allow duplicate names and sources. While source maps + // are intended to be compressed and deduplicated, the TypeScript compiler + // sometimes generates source maps with duplicates in them. See Github issue + // #72 and bugzil.la/889492. + this._names = ArraySet.fromArray(names.map(String), true); + this._sources = ArraySet.fromArray(sources, true); + + this.sourceRoot = sourceRoot; + this.sourcesContent = sourcesContent; + this._mappings = mappings; + this.file = file; +} + +BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); +BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer; + +/** + * Create a BasicSourceMapConsumer from a SourceMapGenerator. + * + * @param SourceMapGenerator aSourceMap + * The source map that will be consumed. + * @returns BasicSourceMapConsumer + */ +BasicSourceMapConsumer.fromSourceMap = + function SourceMapConsumer_fromSourceMap(aSourceMap) { + var smc = Object.create(BasicSourceMapConsumer.prototype); + + var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true); + var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true); + smc.sourceRoot = aSourceMap._sourceRoot; + smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(), + smc.sourceRoot); + smc.file = aSourceMap._file; + + // Because we are modifying the entries (by converting string sources and + // names to indices into the sources and names ArraySets), we have to make + // a copy of the entry or else bad things happen. Shared mutable state + // strikes again! See github issue #191. + + var generatedMappings = aSourceMap._mappings.toArray().slice(); + var destGeneratedMappings = smc.__generatedMappings = []; + var destOriginalMappings = smc.__originalMappings = []; + + for (var i = 0, length = generatedMappings.length; i < length; i++) { + var srcMapping = generatedMappings[i]; + var destMapping = new Mapping; + destMapping.generatedLine = srcMapping.generatedLine; + destMapping.generatedColumn = srcMapping.generatedColumn; + + if (srcMapping.source) { + destMapping.source = sources.indexOf(srcMapping.source); + destMapping.originalLine = srcMapping.originalLine; + destMapping.originalColumn = srcMapping.originalColumn; + + if (srcMapping.name) { + destMapping.name = names.indexOf(srcMapping.name); + } + + destOriginalMappings.push(destMapping); + } + + destGeneratedMappings.push(destMapping); + } + + quickSort(smc.__originalMappings, util.compareByOriginalPositions); + + return smc; + }; + +/** + * The version of the source mapping spec that we are consuming. + */ +BasicSourceMapConsumer.prototype._version = 3; + +/** + * The list of original sources. + */ +Object.defineProperty(BasicSourceMapConsumer.prototype, 'sources', { + get: function () { + return this._sources.toArray().map(function (s) { + return this.sourceRoot != null ? util.join(this.sourceRoot, s) : s; + }, this); + } +}); + +/** + * Provide the JIT with a nice shape / hidden class. + */ +function Mapping() { + this.generatedLine = 0; + this.generatedColumn = 0; + this.source = null; + this.originalLine = null; + this.originalColumn = null; + this.name = null; +} + +/** + * Parse the mappings in a string in to a data structure which we can easily + * query (the ordered arrays in the `this.__generatedMappings` and + * `this.__originalMappings` properties). + */ +BasicSourceMapConsumer.prototype._parseMappings = + function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { + var generatedLine = 1; + var previousGeneratedColumn = 0; + var previousOriginalLine = 0; + var previousOriginalColumn = 0; + var previousSource = 0; + var previousName = 0; + var length = aStr.length; + var index = 0; + var cachedSegments = {}; + var temp = {}; + var originalMappings = []; + var generatedMappings = []; + var mapping, str, segment, end, value; + + while (index < length) { + if (aStr.charAt(index) === ';') { + generatedLine++; + index++; + previousGeneratedColumn = 0; + } + else if (aStr.charAt(index) === ',') { + index++; + } + else { + mapping = new Mapping(); + mapping.generatedLine = generatedLine; + + // Because each offset is encoded relative to the previous one, + // many segments often have the same encoding. We can exploit this + // fact by caching the parsed variable length fields of each segment, + // allowing us to avoid a second parse if we encounter the same + // segment again. + for (end = index; end < length; end++) { + if (this._charIsMappingSeparator(aStr, end)) { + break; + } + } + str = aStr.slice(index, end); + + segment = cachedSegments[str]; + if (segment) { + index += str.length; + } else { + segment = []; + while (index < end) { + base64VLQ.decode(aStr, index, temp); + value = temp.value; + index = temp.rest; + segment.push(value); + } + + if (segment.length === 2) { + throw new Error('Found a source, but no line and column'); + } + + if (segment.length === 3) { + throw new Error('Found a source and line, but no column'); + } + + cachedSegments[str] = segment; + } + + // Generated column. + mapping.generatedColumn = previousGeneratedColumn + segment[0]; + previousGeneratedColumn = mapping.generatedColumn; + + if (segment.length > 1) { + // Original source. + mapping.source = previousSource + segment[1]; + previousSource += segment[1]; + + // Original line. + mapping.originalLine = previousOriginalLine + segment[2]; + previousOriginalLine = mapping.originalLine; + // Lines are stored 0-based + mapping.originalLine += 1; + + // Original column. + mapping.originalColumn = previousOriginalColumn + segment[3]; + previousOriginalColumn = mapping.originalColumn; + + if (segment.length > 4) { + // Original name. + mapping.name = previousName + segment[4]; + previousName += segment[4]; + } + } + + generatedMappings.push(mapping); + if (typeof mapping.originalLine === 'number') { + originalMappings.push(mapping); + } + } + } + + quickSort(generatedMappings, util.compareByGeneratedPositionsDeflated); + this.__generatedMappings = generatedMappings; + + quickSort(originalMappings, util.compareByOriginalPositions); + this.__originalMappings = originalMappings; + }; + +/** + * Find the mapping that best matches the hypothetical "needle" mapping that + * we are searching for in the given "haystack" of mappings. + */ +BasicSourceMapConsumer.prototype._findMapping = + function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName, + aColumnName, aComparator, aBias) { + // To return the position we are searching for, we must first find the + // mapping for the given position and then return the opposite position it + // points to. Because the mappings are sorted, we can use binary search to + // find the best mapping. + + if (aNeedle[aLineName] <= 0) { + throw new TypeError('Line must be greater than or equal to 1, got ' + + aNeedle[aLineName]); + } + if (aNeedle[aColumnName] < 0) { + throw new TypeError('Column must be greater than or equal to 0, got ' + + aNeedle[aColumnName]); + } + + return binarySearch.search(aNeedle, aMappings, aComparator, aBias); + }; + +/** + * Compute the last column for each generated mapping. The last column is + * inclusive. + */ +BasicSourceMapConsumer.prototype.computeColumnSpans = + function SourceMapConsumer_computeColumnSpans() { + for (var index = 0; index < this._generatedMappings.length; ++index) { + var mapping = this._generatedMappings[index]; + + // Mappings do not contain a field for the last generated columnt. We + // can come up with an optimistic estimate, however, by assuming that + // mappings are contiguous (i.e. given two consecutive mappings, the + // first mapping ends where the second one starts). + if (index + 1 < this._generatedMappings.length) { + var nextMapping = this._generatedMappings[index + 1]; + + if (mapping.generatedLine === nextMapping.generatedLine) { + mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1; + continue; + } + } + + // The last mapping for each line spans the entire line. + mapping.lastGeneratedColumn = Infinity; + } + }; + +/** + * Returns the original source, line, and column information for the generated + * source's line and column positions provided. The only argument is an object + * with the following properties: + * + * - line: The line number in the generated source. + * - column: The column number in the generated source. + * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or + * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the + * closest element that is smaller than or greater than the one we are + * searching for, respectively, if the exact element cannot be found. + * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. + * + * and an object is returned with the following properties: + * + * - source: The original source file, or null. + * - line: The line number in the original source, or null. + * - column: The column number in the original source, or null. + * - name: The original identifier, or null. + */ +BasicSourceMapConsumer.prototype.originalPositionFor = + function SourceMapConsumer_originalPositionFor(aArgs) { + var needle = { + generatedLine: util.getArg(aArgs, 'line'), + generatedColumn: util.getArg(aArgs, 'column') + }; + + var index = this._findMapping( + needle, + this._generatedMappings, + "generatedLine", + "generatedColumn", + util.compareByGeneratedPositionsDeflated, + util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND) + ); + + if (index >= 0) { + var mapping = this._generatedMappings[index]; + + if (mapping.generatedLine === needle.generatedLine) { + var source = util.getArg(mapping, 'source', null); + if (source !== null) { + source = this._sources.at(source); + if (this.sourceRoot != null) { + source = util.join(this.sourceRoot, source); + } + } + var name = util.getArg(mapping, 'name', null); + if (name !== null) { + name = this._names.at(name); + } + return { + source: source, + line: util.getArg(mapping, 'originalLine', null), + column: util.getArg(mapping, 'originalColumn', null), + name: name + }; + } + } + + return { + source: null, + line: null, + column: null, + name: null + }; + }; + +/** + * Return true if we have the source content for every source in the source + * map, false otherwise. + */ +BasicSourceMapConsumer.prototype.hasContentsOfAllSources = + function BasicSourceMapConsumer_hasContentsOfAllSources() { + if (!this.sourcesContent) { + return false; + } + return this.sourcesContent.length >= this._sources.size() && + !this.sourcesContent.some(function (sc) { return sc == null; }); + }; + +/** + * Returns the original source content. The only argument is the url of the + * original source file. Returns null if no original source content is + * available. + */ +BasicSourceMapConsumer.prototype.sourceContentFor = + function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { + if (!this.sourcesContent) { + return null; + } + + if (this.sourceRoot != null) { + aSource = util.relative(this.sourceRoot, aSource); + } + + if (this._sources.has(aSource)) { + return this.sourcesContent[this._sources.indexOf(aSource)]; + } + + var url; + if (this.sourceRoot != null + && (url = util.urlParse(this.sourceRoot))) { + // XXX: file:// URIs and absolute paths lead to unexpected behavior for + // many users. We can help them out when they expect file:// URIs to + // behave like it would if they were running a local HTTP server. See + // https://bugzilla.mozilla.org/show_bug.cgi?id=885597. + var fileUriAbsPath = aSource.replace(/^file:\/\//, ""); + if (url.scheme == "file" + && this._sources.has(fileUriAbsPath)) { + return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)] + } + + if ((!url.path || url.path == "/") + && this._sources.has("/" + aSource)) { + return this.sourcesContent[this._sources.indexOf("/" + aSource)]; + } + } + + // This function is used recursively from + // IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we + // don't want to throw if we can't find the source - we just want to + // return null, so we provide a flag to exit gracefully. + if (nullOnMissing) { + return null; + } + else { + throw new Error('"' + aSource + '" is not in the SourceMap.'); + } + }; + +/** + * Returns the generated line and column information for the original source, + * line, and column positions provided. The only argument is an object with + * the following properties: + * + * - source: The filename of the original source. + * - line: The line number in the original source. + * - column: The column number in the original source. + * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or + * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the + * closest element that is smaller than or greater than the one we are + * searching for, respectively, if the exact element cannot be found. + * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. + * + * and an object is returned with the following properties: + * + * - line: The line number in the generated source, or null. + * - column: The column number in the generated source, or null. + */ +BasicSourceMapConsumer.prototype.generatedPositionFor = + function SourceMapConsumer_generatedPositionFor(aArgs) { + var source = util.getArg(aArgs, 'source'); + if (this.sourceRoot != null) { + source = util.relative(this.sourceRoot, source); + } + if (!this._sources.has(source)) { + return { + line: null, + column: null, + lastColumn: null + }; + } + source = this._sources.indexOf(source); + + var needle = { + source: source, + originalLine: util.getArg(aArgs, 'line'), + originalColumn: util.getArg(aArgs, 'column') + }; + + var index = this._findMapping( + needle, + this._originalMappings, + "originalLine", + "originalColumn", + util.compareByOriginalPositions, + util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND) + ); + + if (index >= 0) { + var mapping = this._originalMappings[index]; + + if (mapping.source === needle.source) { + return { + line: util.getArg(mapping, 'generatedLine', null), + column: util.getArg(mapping, 'generatedColumn', null), + lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) + }; + } + } + + return { + line: null, + column: null, + lastColumn: null + }; + }; + +exports.BasicSourceMapConsumer = BasicSourceMapConsumer; + +/** + * An IndexedSourceMapConsumer instance represents a parsed source map which + * we can query for information. It differs from BasicSourceMapConsumer in + * that it takes "indexed" source maps (i.e. ones with a "sections" field) as + * input. + * + * The only parameter is a raw source map (either as a JSON string, or already + * parsed to an object). According to the spec for indexed source maps, they + * have the following attributes: + * + * - version: Which version of the source map spec this map is following. + * - file: Optional. The generated file this source map is associated with. + * - sections: A list of section definitions. + * + * Each value under the "sections" field has two fields: + * - offset: The offset into the original specified at which this section + * begins to apply, defined as an object with a "line" and "column" + * field. + * - map: A source map definition. This source map could also be indexed, + * but doesn't have to be. + * + * Instead of the "map" field, it's also possible to have a "url" field + * specifying a URL to retrieve a source map from, but that's currently + * unsupported. + * + * Here's an example source map, taken from the source map spec[0], but + * modified to omit a section which uses the "url" field. + * + * { + * version : 3, + * file: "app.js", + * sections: [{ + * offset: {line:100, column:10}, + * map: { + * version : 3, + * file: "section.js", + * sources: ["foo.js", "bar.js"], + * names: ["src", "maps", "are", "fun"], + * mappings: "AAAA,E;;ABCDE;" + * } + * }], + * } + * + * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt + */ +function IndexedSourceMapConsumer(aSourceMap) { + var sourceMap = aSourceMap; + if (typeof aSourceMap === 'string') { + sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, '')); + } + + var version = util.getArg(sourceMap, 'version'); + var sections = util.getArg(sourceMap, 'sections'); + + if (version != this._version) { + throw new Error('Unsupported version: ' + version); + } + + this._sources = new ArraySet(); + this._names = new ArraySet(); + + var lastOffset = { + line: -1, + column: 0 + }; + this._sections = sections.map(function (s) { + if (s.url) { + // The url field will require support for asynchronicity. + // See https://github.com/mozilla/source-map/issues/16 + throw new Error('Support for url field in sections not implemented.'); + } + var offset = util.getArg(s, 'offset'); + var offsetLine = util.getArg(offset, 'line'); + var offsetColumn = util.getArg(offset, 'column'); + + if (offsetLine < lastOffset.line || + (offsetLine === lastOffset.line && offsetColumn < lastOffset.column)) { + throw new Error('Section offsets must be ordered and non-overlapping.'); + } + lastOffset = offset; + + return { + generatedOffset: { + // The offset fields are 0-based, but we use 1-based indices when + // encoding/decoding from VLQ. + generatedLine: offsetLine + 1, + generatedColumn: offsetColumn + 1 + }, + consumer: new SourceMapConsumer(util.getArg(s, 'map')) + } + }); +} + +IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); +IndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer; + +/** + * The version of the source mapping spec that we are consuming. + */ +IndexedSourceMapConsumer.prototype._version = 3; + +/** + * The list of original sources. + */ +Object.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', { + get: function () { + var sources = []; + for (var i = 0; i < this._sections.length; i++) { + for (var j = 0; j < this._sections[i].consumer.sources.length; j++) { + sources.push(this._sections[i].consumer.sources[j]); + } + } + return sources; + } +}); + +/** + * Returns the original source, line, and column information for the generated + * source's line and column positions provided. The only argument is an object + * with the following properties: + * + * - line: The line number in the generated source. + * - column: The column number in the generated source. + * + * and an object is returned with the following properties: + * + * - source: The original source file, or null. + * - line: The line number in the original source, or null. + * - column: The column number in the original source, or null. + * - name: The original identifier, or null. + */ +IndexedSourceMapConsumer.prototype.originalPositionFor = + function IndexedSourceMapConsumer_originalPositionFor(aArgs) { + var needle = { + generatedLine: util.getArg(aArgs, 'line'), + generatedColumn: util.getArg(aArgs, 'column') + }; + + // Find the section containing the generated position we're trying to map + // to an original position. + var sectionIndex = binarySearch.search(needle, this._sections, + function(needle, section) { + var cmp = needle.generatedLine - section.generatedOffset.generatedLine; + if (cmp) { + return cmp; + } + + return (needle.generatedColumn - + section.generatedOffset.generatedColumn); + }); + var section = this._sections[sectionIndex]; + + if (!section) { + return { + source: null, + line: null, + column: null, + name: null + }; + } + + return section.consumer.originalPositionFor({ + line: needle.generatedLine - + (section.generatedOffset.generatedLine - 1), + column: needle.generatedColumn - + (section.generatedOffset.generatedLine === needle.generatedLine + ? section.generatedOffset.generatedColumn - 1 + : 0), + bias: aArgs.bias + }); + }; + +/** + * Return true if we have the source content for every source in the source + * map, false otherwise. + */ +IndexedSourceMapConsumer.prototype.hasContentsOfAllSources = + function IndexedSourceMapConsumer_hasContentsOfAllSources() { + return this._sections.every(function (s) { + return s.consumer.hasContentsOfAllSources(); + }); + }; + +/** + * Returns the original source content. The only argument is the url of the + * original source file. Returns null if no original source content is + * available. + */ +IndexedSourceMapConsumer.prototype.sourceContentFor = + function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { + for (var i = 0; i < this._sections.length; i++) { + var section = this._sections[i]; + + var content = section.consumer.sourceContentFor(aSource, true); + if (content) { + return content; + } + } + if (nullOnMissing) { + return null; + } + else { + throw new Error('"' + aSource + '" is not in the SourceMap.'); + } + }; + +/** + * Returns the generated line and column information for the original source, + * line, and column positions provided. The only argument is an object with + * the following properties: + * + * - source: The filename of the original source. + * - line: The line number in the original source. + * - column: The column number in the original source. + * + * and an object is returned with the following properties: + * + * - line: The line number in the generated source, or null. + * - column: The column number in the generated source, or null. + */ +IndexedSourceMapConsumer.prototype.generatedPositionFor = + function IndexedSourceMapConsumer_generatedPositionFor(aArgs) { + for (var i = 0; i < this._sections.length; i++) { + var section = this._sections[i]; + + // Only consider this section if the requested source is in the list of + // sources of the consumer. + if (section.consumer.sources.indexOf(util.getArg(aArgs, 'source')) === -1) { + continue; + } + var generatedPosition = section.consumer.generatedPositionFor(aArgs); + if (generatedPosition) { + var ret = { + line: generatedPosition.line + + (section.generatedOffset.generatedLine - 1), + column: generatedPosition.column + + (section.generatedOffset.generatedLine === generatedPosition.line + ? section.generatedOffset.generatedColumn - 1 + : 0) + }; + return ret; + } + } + + return { + line: null, + column: null + }; + }; + +/** + * Parse the mappings in a string in to a data structure which we can easily + * query (the ordered arrays in the `this.__generatedMappings` and + * `this.__originalMappings` properties). + */ +IndexedSourceMapConsumer.prototype._parseMappings = + function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) { + this.__generatedMappings = []; + this.__originalMappings = []; + for (var i = 0; i < this._sections.length; i++) { + var section = this._sections[i]; + var sectionMappings = section.consumer._generatedMappings; + for (var j = 0; j < sectionMappings.length; j++) { + var mapping = sectionMappings[j]; + + var source = section.consumer._sources.at(mapping.source); + if (section.consumer.sourceRoot !== null) { + source = util.join(section.consumer.sourceRoot, source); + } + this._sources.add(source); + source = this._sources.indexOf(source); + + var name = section.consumer._names.at(mapping.name); + this._names.add(name); + name = this._names.indexOf(name); + + // The mappings coming from the consumer for the section have + // generated positions relative to the start of the section, so we + // need to offset them to be relative to the start of the concatenated + // generated file. + var adjustedMapping = { + source: source, + generatedLine: mapping.generatedLine + + (section.generatedOffset.generatedLine - 1), + generatedColumn: mapping.generatedColumn + + (section.generatedOffset.generatedLine === mapping.generatedLine + ? section.generatedOffset.generatedColumn - 1 + : 0), + originalLine: mapping.originalLine, + originalColumn: mapping.originalColumn, + name: name + }; + + this.__generatedMappings.push(adjustedMapping); + if (typeof adjustedMapping.originalLine === 'number') { + this.__originalMappings.push(adjustedMapping); + } + } + } + + quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated); + quickSort(this.__originalMappings, util.compareByOriginalPositions); + }; + +exports.IndexedSourceMapConsumer = IndexedSourceMapConsumer; + + +/***/ }), +/* 816 */ +/***/ (function(module, exports) { + +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +exports.GREATEST_LOWER_BOUND = 1; +exports.LEAST_UPPER_BOUND = 2; + +/** + * Recursive implementation of binary search. + * + * @param aLow Indices here and lower do not contain the needle. + * @param aHigh Indices here and higher do not contain the needle. + * @param aNeedle The element being searched for. + * @param aHaystack The non-empty array being searched. + * @param aCompare Function which takes two elements and returns -1, 0, or 1. + * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or + * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the + * closest element that is smaller than or greater than the one we are + * searching for, respectively, if the exact element cannot be found. + */ +function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) { + // This function terminates when one of the following is true: + // + // 1. We find the exact element we are looking for. + // + // 2. We did not find the exact element, but we can return the index of + // the next-closest element. + // + // 3. We did not find the exact element, and there is no next-closest + // element than the one we are searching for, so we return -1. + var mid = Math.floor((aHigh - aLow) / 2) + aLow; + var cmp = aCompare(aNeedle, aHaystack[mid], true); + if (cmp === 0) { + // Found the element we are looking for. + return mid; + } + else if (cmp > 0) { + // Our needle is greater than aHaystack[mid]. + if (aHigh - mid > 1) { + // The element is in the upper half. + return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias); + } + + // The exact needle element was not found in this haystack. Determine if + // we are in termination case (3) or (2) and return the appropriate thing. + if (aBias == exports.LEAST_UPPER_BOUND) { + return aHigh < aHaystack.length ? aHigh : -1; + } else { + return mid; + } + } + else { + // Our needle is less than aHaystack[mid]. + if (mid - aLow > 1) { + // The element is in the lower half. + return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias); + } + + // we are in termination case (3) or (2) and return the appropriate thing. + if (aBias == exports.LEAST_UPPER_BOUND) { + return mid; + } else { + return aLow < 0 ? -1 : aLow; + } + } +} + +/** + * This is an implementation of binary search which will always try and return + * the index of the closest element if there is no exact hit. This is because + * mappings between original and generated line/col pairs are single points, + * and there is an implicit region between each of them, so a miss just means + * that you aren't on the very start of a region. + * + * @param aNeedle The element you are looking for. + * @param aHaystack The array that is being searched. + * @param aCompare A function which takes the needle and an element in the + * array and returns -1, 0, or 1 depending on whether the needle is less + * than, equal to, or greater than the element, respectively. + * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or + * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the + * closest element that is smaller than or greater than the one we are + * searching for, respectively, if the exact element cannot be found. + * Defaults to 'binarySearch.GREATEST_LOWER_BOUND'. + */ +exports.search = function search(aNeedle, aHaystack, aCompare, aBias) { + if (aHaystack.length === 0) { + return -1; + } + + var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack, + aCompare, aBias || exports.GREATEST_LOWER_BOUND); + if (index < 0) { + return -1; + } + + // We have found either the exact element, or the next-closest element than + // the one we are searching for. However, there may be more than one such + // element. Make sure we always return the smallest of these. + while (index - 1 >= 0) { + if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) { + break; + } + --index; + } + + return index; +}; + + +/***/ }), +/* 817 */ +/***/ (function(module, exports) { + +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +// It turns out that some (most?) JavaScript engines don't self-host +// `Array.prototype.sort`. This makes sense because C++ will likely remain +// faster than JS when doing raw CPU-intensive sorting. However, when using a +// custom comparator function, calling back and forth between the VM's C++ and +// JIT'd JS is rather slow *and* loses JIT type information, resulting in +// worse generated code for the comparator function than would be optimal. In +// fact, when sorting with a comparator, these costs outweigh the benefits of +// sorting in C++. By using our own JS-implemented Quick Sort (below), we get +// a ~3500ms mean speed-up in `bench/bench.html`. + +/** + * Swap the elements indexed by `x` and `y` in the array `ary`. + * + * @param {Array} ary + * The array. + * @param {Number} x + * The index of the first item. + * @param {Number} y + * The index of the second item. + */ +function swap(ary, x, y) { + var temp = ary[x]; + ary[x] = ary[y]; + ary[y] = temp; +} + +/** + * Returns a random integer within the range `low .. high` inclusive. + * + * @param {Number} low + * The lower bound on the range. + * @param {Number} high + * The upper bound on the range. + */ +function randomIntInRange(low, high) { + return Math.round(low + (Math.random() * (high - low))); +} + +/** + * The Quick Sort algorithm. + * + * @param {Array} ary + * An array to sort. + * @param {function} comparator + * Function to use to compare two items. + * @param {Number} p + * Start index of the array + * @param {Number} r + * End index of the array + */ +function doQuickSort(ary, comparator, p, r) { + // If our lower bound is less than our upper bound, we (1) partition the + // array into two pieces and (2) recurse on each half. If it is not, this is + // the empty array and our base case. + + if (p < r) { + // (1) Partitioning. + // + // The partitioning chooses a pivot between `p` and `r` and moves all + // elements that are less than or equal to the pivot to the before it, and + // all the elements that are greater than it after it. The effect is that + // once partition is done, the pivot is in the exact place it will be when + // the array is put in sorted order, and it will not need to be moved + // again. This runs in O(n) time. + + // Always choose a random pivot so that an input array which is reverse + // sorted does not cause O(n^2) running time. + var pivotIndex = randomIntInRange(p, r); + var i = p - 1; + + swap(ary, pivotIndex, r); + var pivot = ary[r]; + + // Immediately after `j` is incremented in this loop, the following hold + // true: + // + // * Every element in `ary[p .. i]` is less than or equal to the pivot. + // + // * Every element in `ary[i+1 .. j-1]` is greater than the pivot. + for (var j = p; j < r; j++) { + if (comparator(ary[j], pivot) <= 0) { + i += 1; + swap(ary, i, j); + } + } + + swap(ary, i + 1, j); + var q = i + 1; + + // (2) Recurse on each half. + + doQuickSort(ary, comparator, p, q - 1); + doQuickSort(ary, comparator, q + 1, r); + } +} + +/** + * Sort the given array in-place with the given comparator function. + * + * @param {Array} ary + * An array to sort. + * @param {function} comparator + * Function to use to compare two items. + */ +exports.quickSort = function (ary, comparator) { + doQuickSort(ary, comparator, 0, ary.length - 1); +}; + + +/***/ }), +/* 818 */ +/***/ (function(module, exports, __webpack_require__) { + +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +var SourceMapGenerator = __webpack_require__(809).SourceMapGenerator; +var util = __webpack_require__(812); + +// Matches a Windows-style `\r\n` newline or a `\n` newline used by all other +// operating systems these days (capturing the result). +var REGEX_NEWLINE = /(\r?\n)/; + +// Newline character code for charCodeAt() comparisons +var NEWLINE_CODE = 10; + +// Private symbol for identifying `SourceNode`s when multiple versions of +// the source-map library are loaded. This MUST NOT CHANGE across +// versions! +var isSourceNode = "$$$isSourceNode$$$"; + +/** + * SourceNodes provide a way to abstract over interpolating/concatenating + * snippets of generated JavaScript source code while maintaining the line and + * column information associated with the original source code. + * + * @param aLine The original line number. + * @param aColumn The original column number. + * @param aSource The original source's filename. + * @param aChunks Optional. An array of strings which are snippets of + * generated JS, or other SourceNodes. + * @param aName The original identifier. + */ +function SourceNode(aLine, aColumn, aSource, aChunks, aName) { + this.children = []; + this.sourceContents = {}; + this.line = aLine == null ? null : aLine; + this.column = aColumn == null ? null : aColumn; + this.source = aSource == null ? null : aSource; + this.name = aName == null ? null : aName; + this[isSourceNode] = true; + if (aChunks != null) this.add(aChunks); +} + +/** + * Creates a SourceNode from generated code and a SourceMapConsumer. + * + * @param aGeneratedCode The generated code + * @param aSourceMapConsumer The SourceMap for the generated code + * @param aRelativePath Optional. The path that relative sources in the + * SourceMapConsumer should be relative to. + */ +SourceNode.fromStringWithSourceMap = + function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) { + // The SourceNode we want to fill with the generated code + // and the SourceMap + var node = new SourceNode(); + + // All even indices of this array are one line of the generated code, + // while all odd indices are the newlines between two adjacent lines + // (since `REGEX_NEWLINE` captures its match). + // Processed fragments are accessed by calling `shiftNextLine`. + var remainingLines = aGeneratedCode.split(REGEX_NEWLINE); + var remainingLinesIndex = 0; + var shiftNextLine = function() { + var lineContents = getNextLine(); + // The last line of a file might not have a newline. + var newLine = getNextLine() || ""; + return lineContents + newLine; + + function getNextLine() { + return remainingLinesIndex < remainingLines.length ? + remainingLines[remainingLinesIndex++] : undefined; + } + }; + + // We need to remember the position of "remainingLines" + var lastGeneratedLine = 1, lastGeneratedColumn = 0; + + // The generate SourceNodes we need a code range. + // To extract it current and last mapping is used. + // Here we store the last mapping. + var lastMapping = null; + + aSourceMapConsumer.eachMapping(function (mapping) { + if (lastMapping !== null) { + // We add the code from "lastMapping" to "mapping": + // First check if there is a new line in between. + if (lastGeneratedLine < mapping.generatedLine) { + // Associate first line with "lastMapping" + addMappingWithCode(lastMapping, shiftNextLine()); + lastGeneratedLine++; + lastGeneratedColumn = 0; + // The remaining code is added without mapping + } else { + // There is no new line in between. + // Associate the code between "lastGeneratedColumn" and + // "mapping.generatedColumn" with "lastMapping" + var nextLine = remainingLines[remainingLinesIndex]; + var code = nextLine.substr(0, mapping.generatedColumn - + lastGeneratedColumn); + remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn - + lastGeneratedColumn); + lastGeneratedColumn = mapping.generatedColumn; + addMappingWithCode(lastMapping, code); + // No more remaining code, continue + lastMapping = mapping; + return; + } + } + // We add the generated code until the first mapping + // to the SourceNode without any mapping. + // Each line is added as separate string. + while (lastGeneratedLine < mapping.generatedLine) { + node.add(shiftNextLine()); + lastGeneratedLine++; + } + if (lastGeneratedColumn < mapping.generatedColumn) { + var nextLine = remainingLines[remainingLinesIndex]; + node.add(nextLine.substr(0, mapping.generatedColumn)); + remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn); + lastGeneratedColumn = mapping.generatedColumn; + } + lastMapping = mapping; + }, this); + // We have processed all mappings. + if (remainingLinesIndex < remainingLines.length) { + if (lastMapping) { + // Associate the remaining code in the current line with "lastMapping" + addMappingWithCode(lastMapping, shiftNextLine()); + } + // and add the remaining lines without any mapping + node.add(remainingLines.splice(remainingLinesIndex).join("")); + } + + // Copy sourcesContent into SourceNode + aSourceMapConsumer.sources.forEach(function (sourceFile) { + var content = aSourceMapConsumer.sourceContentFor(sourceFile); + if (content != null) { + if (aRelativePath != null) { + sourceFile = util.join(aRelativePath, sourceFile); + } + node.setSourceContent(sourceFile, content); + } + }); + + return node; + + function addMappingWithCode(mapping, code) { + if (mapping === null || mapping.source === undefined) { + node.add(code); + } else { + var source = aRelativePath + ? util.join(aRelativePath, mapping.source) + : mapping.source; + node.add(new SourceNode(mapping.originalLine, + mapping.originalColumn, + source, + code, + mapping.name)); + } + } + }; + +/** + * Add a chunk of generated JS to this source node. + * + * @param aChunk A string snippet of generated JS code, another instance of + * SourceNode, or an array where each member is one of those things. + */ +SourceNode.prototype.add = function SourceNode_add(aChunk) { + if (Array.isArray(aChunk)) { + aChunk.forEach(function (chunk) { + this.add(chunk); + }, this); + } + else if (aChunk[isSourceNode] || typeof aChunk === "string") { + if (aChunk) { + this.children.push(aChunk); + } + } + else { + throw new TypeError( + "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk + ); + } + return this; +}; + +/** + * Add a chunk of generated JS to the beginning of this source node. + * + * @param aChunk A string snippet of generated JS code, another instance of + * SourceNode, or an array where each member is one of those things. + */ +SourceNode.prototype.prepend = function SourceNode_prepend(aChunk) { + if (Array.isArray(aChunk)) { + for (var i = aChunk.length-1; i >= 0; i--) { + this.prepend(aChunk[i]); + } + } + else if (aChunk[isSourceNode] || typeof aChunk === "string") { + this.children.unshift(aChunk); + } + else { + throw new TypeError( + "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk + ); + } + return this; +}; + +/** + * Walk over the tree of JS snippets in this node and its children. The + * walking function is called once for each snippet of JS and is passed that + * snippet and the its original associated source's line/column location. + * + * @param aFn The traversal function. + */ +SourceNode.prototype.walk = function SourceNode_walk(aFn) { + var chunk; + for (var i = 0, len = this.children.length; i < len; i++) { + chunk = this.children[i]; + if (chunk[isSourceNode]) { + chunk.walk(aFn); + } + else { + if (chunk !== '') { + aFn(chunk, { source: this.source, + line: this.line, + column: this.column, + name: this.name }); + } + } + } +}; + +/** + * Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between + * each of `this.children`. + * + * @param aSep The separator. + */ +SourceNode.prototype.join = function SourceNode_join(aSep) { + var newChildren; + var i; + var len = this.children.length; + if (len > 0) { + newChildren = []; + for (i = 0; i < len-1; i++) { + newChildren.push(this.children[i]); + newChildren.push(aSep); + } + newChildren.push(this.children[i]); + this.children = newChildren; + } + return this; +}; + +/** + * Call String.prototype.replace on the very right-most source snippet. Useful + * for trimming whitespace from the end of a source node, etc. + * + * @param aPattern The pattern to replace. + * @param aReplacement The thing to replace the pattern with. + */ +SourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) { + var lastChild = this.children[this.children.length - 1]; + if (lastChild[isSourceNode]) { + lastChild.replaceRight(aPattern, aReplacement); + } + else if (typeof lastChild === 'string') { + this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement); + } + else { + this.children.push(''.replace(aPattern, aReplacement)); + } + return this; +}; + +/** + * Set the source content for a source file. This will be added to the SourceMapGenerator + * in the sourcesContent field. + * + * @param aSourceFile The filename of the source file + * @param aSourceContent The content of the source file + */ +SourceNode.prototype.setSourceContent = + function SourceNode_setSourceContent(aSourceFile, aSourceContent) { + this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent; + }; + +/** + * Walk over the tree of SourceNodes. The walking function is called for each + * source file content and is passed the filename and source content. + * + * @param aFn The traversal function. + */ +SourceNode.prototype.walkSourceContents = + function SourceNode_walkSourceContents(aFn) { + for (var i = 0, len = this.children.length; i < len; i++) { + if (this.children[i][isSourceNode]) { + this.children[i].walkSourceContents(aFn); + } + } + + var sources = Object.keys(this.sourceContents); + for (var i = 0, len = sources.length; i < len; i++) { + aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]); + } + }; + +/** + * Return the string representation of this source node. Walks over the tree + * and concatenates all the various snippets together to one string. + */ +SourceNode.prototype.toString = function SourceNode_toString() { + var str = ""; + this.walk(function (chunk) { + str += chunk; + }); + return str; +}; + +/** + * Returns the string representation of this source node along with a source + * map. + */ +SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) { + var generated = { + code: "", + line: 1, + column: 0 + }; + var map = new SourceMapGenerator(aArgs); + var sourceMappingActive = false; + var lastOriginalSource = null; + var lastOriginalLine = null; + var lastOriginalColumn = null; + var lastOriginalName = null; + this.walk(function (chunk, original) { + generated.code += chunk; + if (original.source !== null + && original.line !== null + && original.column !== null) { + if(lastOriginalSource !== original.source + || lastOriginalLine !== original.line + || lastOriginalColumn !== original.column + || lastOriginalName !== original.name) { + map.addMapping({ + source: original.source, + original: { + line: original.line, + column: original.column + }, + generated: { + line: generated.line, + column: generated.column + }, + name: original.name + }); + } + lastOriginalSource = original.source; + lastOriginalLine = original.line; + lastOriginalColumn = original.column; + lastOriginalName = original.name; + sourceMappingActive = true; + } else if (sourceMappingActive) { + map.addMapping({ + generated: { + line: generated.line, + column: generated.column + } + }); + lastOriginalSource = null; + sourceMappingActive = false; + } + for (var idx = 0, length = chunk.length; idx < length; idx++) { + if (chunk.charCodeAt(idx) === NEWLINE_CODE) { + generated.line++; + generated.column = 0; + // Mappings end at eol + if (idx + 1 === length) { + lastOriginalSource = null; + sourceMappingActive = false; + } else if (sourceMappingActive) { + map.addMapping({ + source: original.source, + original: { + line: original.line, + column: original.column + }, + generated: { + line: generated.line, + column: generated.column + }, + name: original.name + }); + } + } else { + generated.column++; + } + } + }); + this.walkSourceContents(function (sourceFile, sourceContent) { + map.setSourceContent(sourceFile, sourceContent); + }); + + return { code: generated.code, map: map }; +}; + +exports.SourceNode = SourceNode; + + +/***/ }), +/* 819 */ +/***/ (function(module, exports, __webpack_require__) { + +// Copyright 2014, 2015, 2016, 2017 Simon Lydell +// X11 (“MIT”) Licensed. (See LICENSE.) + +var sourceMappingURL = __webpack_require__(820) +var resolveUrl = __webpack_require__(821) +var decodeUriComponent = __webpack_require__(822) +var urix = __webpack_require__(824) +var atob = __webpack_require__(825) + + + +function callbackAsync(callback, error, result) { + setImmediate(function() { callback(error, result) }) +} + +function parseMapToJSON(string, data) { + try { + return JSON.parse(string.replace(/^\)\]\}'/, "")) + } catch (error) { + error.sourceMapData = data + throw error + } +} + +function readSync(read, url, data) { + var readUrl = decodeUriComponent(url) + try { + return String(read(readUrl)) + } catch (error) { + error.sourceMapData = data + throw error + } +} + + + +function resolveSourceMap(code, codeUrl, read, callback) { + var mapData + try { + mapData = resolveSourceMapHelper(code, codeUrl) + } catch (error) { + return callbackAsync(callback, error) + } + if (!mapData || mapData.map) { + return callbackAsync(callback, null, mapData) + } + var readUrl = decodeUriComponent(mapData.url) + read(readUrl, function(error, result) { + if (error) { + error.sourceMapData = mapData + return callback(error) + } + mapData.map = String(result) + try { + mapData.map = parseMapToJSON(mapData.map, mapData) + } catch (error) { + return callback(error) + } + callback(null, mapData) + }) +} + +function resolveSourceMapSync(code, codeUrl, read) { + var mapData = resolveSourceMapHelper(code, codeUrl) + if (!mapData || mapData.map) { + return mapData + } + mapData.map = readSync(read, mapData.url, mapData) + mapData.map = parseMapToJSON(mapData.map, mapData) + return mapData +} + +var dataUriRegex = /^data:([^,;]*)(;[^,;]*)*(?:,(.*))?$/ +var jsonMimeTypeRegex = /^(?:application|text)\/json$/ + +function resolveSourceMapHelper(code, codeUrl) { + codeUrl = urix(codeUrl) + + var url = sourceMappingURL.getFrom(code) + if (!url) { + return null + } + + var dataUri = url.match(dataUriRegex) + if (dataUri) { + var mimeType = dataUri[1] + var lastParameter = dataUri[2] || "" + var encoded = dataUri[3] || "" + var data = { + sourceMappingURL: url, + url: null, + sourcesRelativeTo: codeUrl, + map: encoded + } + if (!jsonMimeTypeRegex.test(mimeType)) { + var error = new Error("Unuseful data uri mime type: " + (mimeType || "text/plain")) + error.sourceMapData = data + throw error + } + data.map = parseMapToJSON( + lastParameter === ";base64" ? atob(encoded) : decodeURIComponent(encoded), + data + ) + return data + } + + var mapUrl = resolveUrl(codeUrl, url) + return { + sourceMappingURL: url, + url: mapUrl, + sourcesRelativeTo: mapUrl, + map: null + } +} + + + +function resolveSources(map, mapUrl, read, options, callback) { + if (typeof options === "function") { + callback = options + options = {} + } + var pending = map.sources ? map.sources.length : 0 + var result = { + sourcesResolved: [], + sourcesContent: [] + } + + if (pending === 0) { + callbackAsync(callback, null, result) + return + } + + var done = function() { + pending-- + if (pending === 0) { + callback(null, result) + } + } + + resolveSourcesHelper(map, mapUrl, options, function(fullUrl, sourceContent, index) { + result.sourcesResolved[index] = fullUrl + if (typeof sourceContent === "string") { + result.sourcesContent[index] = sourceContent + callbackAsync(done, null) + } else { + var readUrl = decodeUriComponent(fullUrl) + read(readUrl, function(error, source) { + result.sourcesContent[index] = error ? error : String(source) + done() + }) + } + }) +} + +function resolveSourcesSync(map, mapUrl, read, options) { + var result = { + sourcesResolved: [], + sourcesContent: [] + } + + if (!map.sources || map.sources.length === 0) { + return result + } + + resolveSourcesHelper(map, mapUrl, options, function(fullUrl, sourceContent, index) { + result.sourcesResolved[index] = fullUrl + if (read !== null) { + if (typeof sourceContent === "string") { + result.sourcesContent[index] = sourceContent + } else { + var readUrl = decodeUriComponent(fullUrl) + try { + result.sourcesContent[index] = String(read(readUrl)) + } catch (error) { + result.sourcesContent[index] = error + } + } + } + }) + + return result +} + +var endingSlash = /\/?$/ + +function resolveSourcesHelper(map, mapUrl, options, fn) { + options = options || {} + mapUrl = urix(mapUrl) + var fullUrl + var sourceContent + var sourceRoot + for (var index = 0, len = map.sources.length; index < len; index++) { + sourceRoot = null + if (typeof options.sourceRoot === "string") { + sourceRoot = options.sourceRoot + } else if (typeof map.sourceRoot === "string" && options.sourceRoot !== false) { + sourceRoot = map.sourceRoot + } + // If the sourceRoot is the empty string, it is equivalent to not setting + // the property at all. + if (sourceRoot === null || sourceRoot === '') { + fullUrl = resolveUrl(mapUrl, map.sources[index]) + } else { + // Make sure that the sourceRoot ends with a slash, so that `/scripts/subdir` becomes + // `/scripts/subdir/`, not `/scripts/`. Pointing to a file as source root + // does not make sense. + fullUrl = resolveUrl(mapUrl, sourceRoot.replace(endingSlash, "/"), map.sources[index]) + } + sourceContent = (map.sourcesContent || [])[index] + fn(fullUrl, sourceContent, index) + } +} + + + +function resolve(code, codeUrl, read, options, callback) { + if (typeof options === "function") { + callback = options + options = {} + } + if (code === null) { + var mapUrl = codeUrl + var data = { + sourceMappingURL: null, + url: mapUrl, + sourcesRelativeTo: mapUrl, + map: null + } + var readUrl = decodeUriComponent(mapUrl) + read(readUrl, function(error, result) { + if (error) { + error.sourceMapData = data + return callback(error) + } + data.map = String(result) + try { + data.map = parseMapToJSON(data.map, data) + } catch (error) { + return callback(error) + } + _resolveSources(data) + }) + } else { + resolveSourceMap(code, codeUrl, read, function(error, mapData) { + if (error) { + return callback(error) + } + if (!mapData) { + return callback(null, null) + } + _resolveSources(mapData) + }) + } + + function _resolveSources(mapData) { + resolveSources(mapData.map, mapData.sourcesRelativeTo, read, options, function(error, result) { + if (error) { + return callback(error) + } + mapData.sourcesResolved = result.sourcesResolved + mapData.sourcesContent = result.sourcesContent + callback(null, mapData) + }) + } +} + +function resolveSync(code, codeUrl, read, options) { + var mapData + if (code === null) { + var mapUrl = codeUrl + mapData = { + sourceMappingURL: null, + url: mapUrl, + sourcesRelativeTo: mapUrl, + map: null + } + mapData.map = readSync(read, mapUrl, mapData) + mapData.map = parseMapToJSON(mapData.map, mapData) + } else { + mapData = resolveSourceMapSync(code, codeUrl, read) + if (!mapData) { + return null + } + } + var result = resolveSourcesSync(mapData.map, mapData.sourcesRelativeTo, read, options) + mapData.sourcesResolved = result.sourcesResolved + mapData.sourcesContent = result.sourcesContent + return mapData +} + + + +module.exports = { + resolveSourceMap: resolveSourceMap, + resolveSourceMapSync: resolveSourceMapSync, + resolveSources: resolveSources, + resolveSourcesSync: resolveSourcesSync, + resolve: resolve, + resolveSync: resolveSync, + parseMapToJSON: parseMapToJSON +} + + +/***/ }), +/* 820 */ +/***/ (function(module, exports, __webpack_require__) { + +var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;// Copyright 2014 Simon Lydell +// X11 (“MIT”) Licensed. (See LICENSE.) + +void (function(root, factory) { + if (true) { + !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory), + __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? + (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) : + __WEBPACK_AMD_DEFINE_FACTORY__), + __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) + } else {} +}(this, function() { + + var innerRegex = /[#@] sourceMappingURL=([^\s'"]*)/ + + var regex = RegExp( + "(?:" + + "/\\*" + + "(?:\\s*\r?\n(?://)?)?" + + "(?:" + innerRegex.source + ")" + + "\\s*" + + "\\*/" + + "|" + + "//(?:" + innerRegex.source + ")" + + ")" + + "\\s*" + ) + + return { + + regex: regex, + _innerRegex: innerRegex, + + getFrom: function(code) { + var match = code.match(regex) + return (match ? match[1] || match[2] || "" : null) + }, + + existsIn: function(code) { + return regex.test(code) + }, + + removeFrom: function(code) { + return code.replace(regex, "") + }, + + insertBefore: function(code, string) { + var match = code.match(regex) + if (match) { + return code.slice(0, match.index) + string + code.slice(match.index) + } else { + return code + string + } + } + } + +})); + + +/***/ }), +/* 821 */ +/***/ (function(module, exports, __webpack_require__) { + +// Copyright 2014 Simon Lydell +// X11 (“MIT”) Licensed. (See LICENSE.) + +var url = __webpack_require__(454) + +function resolveUrl(/* ...urls */) { + return Array.prototype.reduce.call(arguments, function(resolved, nextUrl) { + return url.resolve(resolved, nextUrl) + }) +} + +module.exports = resolveUrl + + +/***/ }), +/* 822 */ +/***/ (function(module, exports, __webpack_require__) { + +// Copyright 2017 Simon Lydell +// X11 (“MIT”) Licensed. (See LICENSE.) + +var decodeUriComponent = __webpack_require__(823) + +function customDecodeUriComponent(string) { + // `decodeUriComponent` turns `+` into ` `, but that's not wanted. + return decodeUriComponent(string.replace(/\+/g, "%2B")) +} + +module.exports = customDecodeUriComponent + + +/***/ }), +/* 823 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +var token = '%[a-f0-9]{2}'; +var singleMatcher = new RegExp(token, 'gi'); +var multiMatcher = new RegExp('(' + token + ')+', 'gi'); + +function decodeComponents(components, split) { + try { + // Try to decode the entire string first + return decodeURIComponent(components.join('')); + } catch (err) { + // Do nothing + } + + if (components.length === 1) { + return components; + } + + split = split || 1; + + // Split the array in 2 parts + var left = components.slice(0, split); + var right = components.slice(split); + + return Array.prototype.concat.call([], decodeComponents(left), decodeComponents(right)); +} + +function decode(input) { + try { + return decodeURIComponent(input); + } catch (err) { + var tokens = input.match(singleMatcher); + + for (var i = 1; i < tokens.length; i++) { + input = decodeComponents(tokens, i).join(''); + + tokens = input.match(singleMatcher); + } + + return input; + } +} + +function customDecodeURIComponent(input) { + // Keep track of all the replacements and prefill the map with the `BOM` + var replaceMap = { + '%FE%FF': '\uFFFD\uFFFD', + '%FF%FE': '\uFFFD\uFFFD' + }; + + var match = multiMatcher.exec(input); + while (match) { + try { + // Decode as big chunks as possible + replaceMap[match[0]] = decodeURIComponent(match[0]); + } catch (err) { + var result = decode(match[0]); + + if (result !== match[0]) { + replaceMap[match[0]] = result; + } + } + + match = multiMatcher.exec(input); + } + + // Add `%C2` at the end of the map to make sure it does not replace the combinator before everything else + replaceMap['%C2'] = '\uFFFD'; + + var entries = Object.keys(replaceMap); + + for (var i = 0; i < entries.length; i++) { + // Replace all decoded components + var key = entries[i]; + input = input.replace(new RegExp(key, 'g'), replaceMap[key]); + } + + return input; +} + +module.exports = function (encodedURI) { + if (typeof encodedURI !== 'string') { + throw new TypeError('Expected `encodedURI` to be of type `string`, got `' + typeof encodedURI + '`'); + } + + try { + encodedURI = encodedURI.replace(/\+/g, ' '); + + // Try the built in decoder first + return decodeURIComponent(encodedURI); + } catch (err) { + // Fallback to a more advanced decoder + return customDecodeURIComponent(encodedURI); + } +}; + + +/***/ }), +/* 824 */ +/***/ (function(module, exports, __webpack_require__) { + +// Copyright 2014 Simon Lydell +// X11 (“MIT”) Licensed. (See LICENSE.) + +var path = __webpack_require__(16) + +"use strict" + +function urix(aPath) { + if (path.sep === "\\") { + return aPath + .replace(/\\/g, "/") + .replace(/^[a-z]:\/?/i, "/") + } + return aPath +} + +module.exports = urix + + +/***/ }), +/* 825 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +function atob(str) { + return Buffer.from(str, 'base64').toString('binary'); +} + +module.exports = atob.atob = atob; + + +/***/ }), +/* 826 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var fs = __webpack_require__(23); +var path = __webpack_require__(16); +var define = __webpack_require__(730); +var utils = __webpack_require__(807); + +/** + * Expose `mixin()`. + * This code is based on `source-maps-support.js` in reworkcss/css + * https://github.com/reworkcss/css/blob/master/lib/stringify/source-map-support.js + * Copyright (c) 2012 TJ Holowaychuk + */ + +module.exports = mixin; + +/** + * Mixin source map support into `compiler`. + * + * @param {Object} `compiler` + * @api public + */ + +function mixin(compiler) { + define(compiler, '_comment', compiler.comment); + compiler.map = new utils.SourceMap.SourceMapGenerator(); + compiler.position = { line: 1, column: 1 }; + compiler.content = {}; + compiler.files = {}; + + for (var key in exports) { + define(compiler, key, exports[key]); + } +} + +/** + * Update position. + * + * @param {String} str + */ + +exports.updatePosition = function(str) { + var lines = str.match(/\n/g); + if (lines) this.position.line += lines.length; + var i = str.lastIndexOf('\n'); + this.position.column = ~i ? str.length - i : this.position.column + str.length; +}; + +/** + * Emit `str` with `position`. + * + * @param {String} str + * @param {Object} [pos] + * @return {String} + */ + +exports.emit = function(str, node) { + var position = node.position || {}; + var source = position.source; + if (source) { + if (position.filepath) { + source = utils.unixify(position.filepath); + } + + this.map.addMapping({ + source: source, + generated: { + line: this.position.line, + column: Math.max(this.position.column - 1, 0) + }, + original: { + line: position.start.line, + column: position.start.column - 1 + } + }); + + if (position.content) { + this.addContent(source, position); + } + if (position.filepath) { + this.addFile(source, position); + } + + this.updatePosition(str); + this.output += str; + } + return str; +}; + +/** + * Adds a file to the source map output if it has not already been added + * @param {String} `file` + * @param {Object} `pos` + */ + +exports.addFile = function(file, position) { + if (typeof position.content !== 'string') return; + if (Object.prototype.hasOwnProperty.call(this.files, file)) return; + this.files[file] = position.content; +}; + +/** + * Adds a content source to the source map output if it has not already been added + * @param {String} `source` + * @param {Object} `position` + */ + +exports.addContent = function(source, position) { + if (typeof position.content !== 'string') return; + if (Object.prototype.hasOwnProperty.call(this.content, source)) return; + this.map.setSourceContent(source, position.content); +}; + +/** + * Applies any original source maps to the output and embeds the source file + * contents in the source map. + */ + +exports.applySourceMaps = function() { + Object.keys(this.files).forEach(function(file) { + var content = this.files[file]; + this.map.setSourceContent(file, content); + + if (this.options.inputSourcemaps === true) { + var originalMap = utils.sourceMapResolve.resolveSync(content, file, fs.readFileSync); + if (originalMap) { + var map = new utils.SourceMap.SourceMapConsumer(originalMap.map); + var relativeTo = originalMap.sourcesRelativeTo; + this.map.applySourceMap(map, file, utils.unixify(path.dirname(relativeTo))); + } + } + }, this); +}; + +/** + * Process comments, drops sourceMap comments. + * @param {Object} node + */ + +exports.comment = function(node) { + if (/^# sourceMappingURL=/.test(node.comment)) { + return this.emit('', node.position); + } + return this._comment(node); +}; + + +/***/ }), +/* 827 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var use = __webpack_require__(799); +var util = __webpack_require__(29); +var Cache = __webpack_require__(828); +var define = __webpack_require__(730); +var debug = __webpack_require__(801)('snapdragon:parser'); +var Position = __webpack_require__(829); +var utils = __webpack_require__(807); + +/** + * Create a new `Parser` with the given `input` and `options`. + * @param {String} `input` + * @param {Object} `options` + * @api public + */ + +function Parser(options) { + debug('initializing', __filename); + this.options = utils.extend({source: 'string'}, options); + this.init(this.options); + use(this); +} + +/** + * Prototype methods + */ + +Parser.prototype = { + constructor: Parser, + + init: function(options) { + this.orig = ''; + this.input = ''; + this.parsed = ''; + + this.column = 1; + this.line = 1; + + this.regex = new Cache(); + this.errors = this.errors || []; + this.parsers = this.parsers || {}; + this.types = this.types || []; + this.sets = this.sets || {}; + this.fns = this.fns || []; + this.currentType = 'root'; + + var pos = this.position(); + this.bos = pos({type: 'bos', val: ''}); + + this.ast = { + type: 'root', + errors: this.errors, + nodes: [this.bos] + }; + + define(this.bos, 'parent', this.ast); + this.nodes = [this.ast]; + + this.count = 0; + this.setCount = 0; + this.stack = []; + }, + + /** + * Throw a formatted error with the cursor column and `msg`. + * @param {String} `msg` Message to use in the Error. + */ + + error: function(msg, node) { + var pos = node.position || {start: {column: 0, line: 0}}; + var line = pos.start.line; + var column = pos.start.column; + var source = this.options.source; + + var message = source + ' : ' + msg; + var err = new Error(message); + err.source = source; + err.reason = msg; + err.pos = pos; + + if (this.options.silent) { + this.errors.push(err); + } else { + throw err; + } + }, + + /** + * Define a non-enumberable property on the `Parser` instance. + * + * ```js + * parser.define('foo', 'bar'); + * ``` + * @name .define + * @param {String} `key` propery name + * @param {any} `val` property value + * @return {Object} Returns the Parser instance for chaining. + * @api public + */ + + define: function(key, val) { + define(this, key, val); + return this; + }, + + /** + * Mark position and patch `node.position`. + */ + + position: function() { + var start = { line: this.line, column: this.column }; + var self = this; + + return function(node) { + define(node, 'position', new Position(start, self)); + return node; + }; + }, + + /** + * Set parser `name` with the given `fn` + * @param {String} `name` + * @param {Function} `fn` + * @api public + */ + + set: function(type, fn) { + if (this.types.indexOf(type) === -1) { + this.types.push(type); + } + this.parsers[type] = fn.bind(this); + return this; + }, + + /** + * Get parser `name` + * @param {String} `name` + * @api public + */ + + get: function(name) { + return this.parsers[name]; + }, + + /** + * Push a `token` onto the `type` stack. + * + * @param {String} `type` + * @return {Object} `token` + * @api public + */ + + push: function(type, token) { + this.sets[type] = this.sets[type] || []; + this.count++; + this.stack.push(token); + return this.sets[type].push(token); + }, + + /** + * Pop a token off of the `type` stack + * @param {String} `type` + * @returns {Object} Returns a token + * @api public + */ + + pop: function(type) { + this.sets[type] = this.sets[type] || []; + this.count--; + this.stack.pop(); + return this.sets[type].pop(); + }, + + /** + * Return true if inside a `stack` node. Types are `braces`, `parens` or `brackets`. + * + * @param {String} `type` + * @return {Boolean} + * @api public + */ + + isInside: function(type) { + this.sets[type] = this.sets[type] || []; + return this.sets[type].length > 0; + }, + + /** + * Return true if `node` is the given `type`. + * + * ```js + * parser.isType(node, 'brace'); + * ``` + * @param {Object} `node` + * @param {String} `type` + * @return {Boolean} + * @api public + */ + + isType: function(node, type) { + return node && node.type === type; + }, + + /** + * Get the previous AST node + * @return {Object} + */ + + prev: function(n) { + return this.stack.length > 0 + ? utils.last(this.stack, n) + : utils.last(this.nodes, n); + }, + + /** + * Update line and column based on `str`. + */ + + consume: function(len) { + this.input = this.input.substr(len); + }, + + /** + * Update column based on `str`. + */ + + updatePosition: function(str, len) { + var lines = str.match(/\n/g); + if (lines) this.line += lines.length; + var i = str.lastIndexOf('\n'); + this.column = ~i ? len - i : this.column + len; + this.parsed += str; + this.consume(len); + }, + + /** + * Match `regex`, return captures, and update the cursor position by `match[0]` length. + * @param {RegExp} `regex` + * @return {Object} + */ + + match: function(regex) { + var m = regex.exec(this.input); + if (m) { + this.updatePosition(m[0], m[0].length); + return m; + } + }, + + /** + * Capture `type` with the given regex. + * @param {String} `type` + * @param {RegExp} `regex` + * @return {Function} + */ + + capture: function(type, regex) { + if (typeof regex === 'function') { + return this.set.apply(this, arguments); + } + + this.regex.set(type, regex); + this.set(type, function() { + var parsed = this.parsed; + var pos = this.position(); + var m = this.match(regex); + if (!m || !m[0]) return; + + var prev = this.prev(); + var node = pos({ + type: type, + val: m[0], + parsed: parsed, + rest: this.input + }); + + if (m[1]) { + node.inner = m[1]; + } + + define(node, 'inside', this.stack.length > 0); + define(node, 'parent', prev); + prev.nodes.push(node); + }.bind(this)); + return this; + }, + + /** + * Create a parser with open and close for parens, + * brackets or braces + */ + + capturePair: function(type, openRegex, closeRegex, fn) { + this.sets[type] = this.sets[type] || []; + + /** + * Open + */ + + this.set(type + '.open', function() { + var parsed = this.parsed; + var pos = this.position(); + var m = this.match(openRegex); + if (!m || !m[0]) return; + + var val = m[0]; + this.setCount++; + this.specialChars = true; + var open = pos({ + type: type + '.open', + val: val, + rest: this.input + }); + + if (typeof m[1] !== 'undefined') { + open.inner = m[1]; + } + + var prev = this.prev(); + var node = pos({ + type: type, + nodes: [open] + }); + + define(node, 'rest', this.input); + define(node, 'parsed', parsed); + define(node, 'prefix', m[1]); + define(node, 'parent', prev); + define(open, 'parent', node); + + if (typeof fn === 'function') { + fn.call(this, open, node); + } + + this.push(type, node); + prev.nodes.push(node); + }); + + /** + * Close + */ + + this.set(type + '.close', function() { + var pos = this.position(); + var m = this.match(closeRegex); + if (!m || !m[0]) return; + + var parent = this.pop(type); + var node = pos({ + type: type + '.close', + rest: this.input, + suffix: m[1], + val: m[0] + }); + + if (!this.isType(parent, type)) { + if (this.options.strict) { + throw new Error('missing opening "' + type + '"'); + } + + this.setCount--; + node.escaped = true; + return node; + } + + if (node.suffix === '\\') { + parent.escaped = true; + node.escaped = true; + } + + parent.nodes.push(node); + define(node, 'parent', parent); + }); + + return this; + }, + + /** + * Capture end-of-string + */ + + eos: function() { + var pos = this.position(); + if (this.input) return; + var prev = this.prev(); + + while (prev.type !== 'root' && !prev.visited) { + if (this.options.strict === true) { + throw new SyntaxError('invalid syntax:' + util.inspect(prev, null, 2)); + } + + if (!hasDelims(prev)) { + prev.parent.escaped = true; + prev.escaped = true; + } + + visit(prev, function(node) { + if (!hasDelims(node.parent)) { + node.parent.escaped = true; + node.escaped = true; + } + }); + + prev = prev.parent; + } + + var tok = pos({ + type: 'eos', + val: this.append || '' + }); + + define(tok, 'parent', this.ast); + return tok; + }, + + /** + * Run parsers to advance the cursor position + */ + + next: function() { + var parsed = this.parsed; + var len = this.types.length; + var idx = -1; + var tok; + + while (++idx < len) { + if ((tok = this.parsers[this.types[idx]].call(this))) { + define(tok, 'rest', this.input); + define(tok, 'parsed', parsed); + this.last = tok; + return tok; + } + } + }, + + /** + * Parse the given string. + * @return {Array} + */ + + parse: function(input) { + if (typeof input !== 'string') { + throw new TypeError('expected a string'); + } + + this.init(this.options); + this.orig = input; + this.input = input; + var self = this; + + function parse() { + // check input before calling `.next()` + input = self.input; + + // get the next AST ndoe + var node = self.next(); + if (node) { + var prev = self.prev(); + if (prev) { + define(node, 'parent', prev); + if (prev.nodes) { + prev.nodes.push(node); + } + } + + if (self.sets.hasOwnProperty(prev.type)) { + self.currentType = prev.type; + } + } + + // if we got here but input is not changed, throw an error + if (self.input && input === self.input) { + throw new Error('no parsers registered for: "' + self.input.slice(0, 5) + '"'); + } + } + + while (this.input) parse(); + if (this.stack.length && this.options.strict) { + var node = this.stack.pop(); + throw this.error('missing opening ' + node.type + ': "' + this.orig + '"'); + } + + var eos = this.eos(); + var tok = this.prev(); + if (tok.type !== 'eos') { + this.ast.nodes.push(eos); + } + + return this.ast; + } +}; + +/** + * Visit `node` with the given `fn` + */ + +function visit(node, fn) { + if (!node.visited) { + define(node, 'visited', true); + return node.nodes ? mapVisit(node.nodes, fn) : fn(node); + } + return node; +} + +/** + * Map visit over array of `nodes`. + */ + +function mapVisit(nodes, fn) { + var len = nodes.length; + var idx = -1; + while (++idx < len) { + visit(nodes[idx], fn); + } +} + +function hasOpen(node) { + return node.nodes && node.nodes[0].type === (node.type + '.open'); +} + +function hasClose(node) { + return node.nodes && utils.last(node.nodes).type === (node.type + '.close'); +} + +function hasDelims(node) { + return hasOpen(node) && hasClose(node); +} + +/** + * Expose `Parser` + */ + +module.exports = Parser; + + +/***/ }), +/* 828 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/*! + * map-cache + * + * Copyright (c) 2015, Jon Schlinkert. + * Licensed under the MIT License. + */ + + + +var hasOwn = Object.prototype.hasOwnProperty; + +/** + * Expose `MapCache` + */ + +module.exports = MapCache; + +/** + * Creates a cache object to store key/value pairs. + * + * ```js + * var cache = new MapCache(); + * ``` + * + * @api public + */ + +function MapCache(data) { + this.__data__ = data || {}; +} + +/** + * Adds `value` to `key` on the cache. + * + * ```js + * cache.set('foo', 'bar'); + * ``` + * + * @param {String} `key` The key of the value to cache. + * @param {*} `value` The value to cache. + * @returns {Object} Returns the `Cache` object for chaining. + * @api public + */ + +MapCache.prototype.set = function mapSet(key, value) { + if (key !== '__proto__') { + this.__data__[key] = value; + } + return this; +}; + +/** + * Gets the cached value for `key`. + * + * ```js + * cache.get('foo'); + * //=> 'bar' + * ``` + * + * @param {String} `key` The key of the value to get. + * @returns {*} Returns the cached value. + * @api public + */ + +MapCache.prototype.get = function mapGet(key) { + return key === '__proto__' ? undefined : this.__data__[key]; +}; + +/** + * Checks if a cached value for `key` exists. + * + * ```js + * cache.has('foo'); + * //=> true + * ``` + * + * @param {String} `key` The key of the entry to check. + * @returns {Boolean} Returns `true` if an entry for `key` exists, else `false`. + * @api public + */ + +MapCache.prototype.has = function mapHas(key) { + return key !== '__proto__' && hasOwn.call(this.__data__, key); +}; + +/** + * Removes `key` and its value from the cache. + * + * ```js + * cache.del('foo'); + * ``` + * @title .del + * @param {String} `key` The key of the value to remove. + * @returns {Boolean} Returns `true` if the entry was removed successfully, else `false`. + * @api public + */ + +MapCache.prototype.del = function mapDelete(key) { + return this.has(key) && delete this.__data__[key]; +}; + + +/***/ }), +/* 829 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var define = __webpack_require__(730); + +/** + * Store position for a node + */ + +module.exports = function Position(start, parser) { + this.start = start; + this.end = { line: parser.line, column: parser.column }; + define(this, 'content', parser.orig); + define(this, 'source', parser.options.source); +}; + + +/***/ }), +/* 830 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var safe = __webpack_require__(831); +var define = __webpack_require__(837); +var extend = __webpack_require__(838); +var not = __webpack_require__(840); +var MAX_LENGTH = 1024 * 64; + +/** + * Session cache + */ + +var cache = {}; + +/** + * Create a regular expression from the given `pattern` string. + * + * @param {String|RegExp} `pattern` Pattern can be a string or regular expression. + * @param {Object} `options` + * @return {RegExp} + * @api public + */ + +module.exports = function(patterns, options) { + if (!Array.isArray(patterns)) { + return makeRe(patterns, options); + } + return makeRe(patterns.join('|'), options); +}; + +/** + * Create a regular expression from the given `pattern` string. + * + * @param {String|RegExp} `pattern` Pattern can be a string or regular expression. + * @param {Object} `options` + * @return {RegExp} + * @api public + */ + +function makeRe(pattern, options) { + if (pattern instanceof RegExp) { + return pattern; + } + + if (typeof pattern !== 'string') { + throw new TypeError('expected a string'); + } + + if (pattern.length > MAX_LENGTH) { + throw new Error('expected pattern to be less than ' + MAX_LENGTH + ' characters'); + } + + var key = pattern; + // do this before shallow cloning options, it's a lot faster + if (!options || (options && options.cache !== false)) { + key = createKey(pattern, options); + + if (cache.hasOwnProperty(key)) { + return cache[key]; + } + } + + var opts = extend({}, options); + if (opts.contains === true) { + if (opts.negate === true) { + opts.strictNegate = false; + } else { + opts.strict = false; + } + } + + if (opts.strict === false) { + opts.strictOpen = false; + opts.strictClose = false; + } + + var open = opts.strictOpen !== false ? '^' : ''; + var close = opts.strictClose !== false ? '$' : ''; + var flags = opts.flags || ''; + var regex; + + if (opts.nocase === true && !/i/.test(flags)) { + flags += 'i'; + } + + try { + if (opts.negate || typeof opts.strictNegate === 'boolean') { + pattern = not.create(pattern, opts); + } + + var str = open + '(?:' + pattern + ')' + close; + regex = new RegExp(str, flags); + + if (opts.safe === true && safe(regex) === false) { + throw new Error('potentially unsafe regular expression: ' + regex.source); + } + + } catch (err) { + if (opts.strictErrors === true || opts.safe === true) { + err.key = key; + err.pattern = pattern; + err.originalOptions = options; + err.createdOptions = opts; + throw err; + } + + try { + regex = new RegExp('^' + pattern.replace(/(\W)/g, '\\$1') + '$'); + } catch (err) { + regex = /.^/; //<= match nothing + } + } + + if (opts.cache !== false) { + memoize(regex, key, pattern, opts); + } + return regex; +} + +/** + * Memoize generated regex. This can result in dramatic speed improvements + * and simplify debugging by adding options and pattern to the regex. It can be + * disabled by passing setting `options.cache` to false. + */ + +function memoize(regex, key, pattern, options) { + define(regex, 'cached', true); + define(regex, 'pattern', pattern); + define(regex, 'options', options); + define(regex, 'key', key); + cache[key] = regex; +} + +/** + * Create the key to use for memoization. The key is generated + * by iterating over the options and concatenating key-value pairs + * to the pattern string. + */ + +function createKey(pattern, options) { + if (!options) return pattern; + var key = pattern; + for (var prop in options) { + if (options.hasOwnProperty(prop)) { + key += ';' + prop + '=' + String(options[prop]); + } + } + return key; +} + +/** + * Expose `makeRe` + */ + +module.exports.makeRe = makeRe; + + +/***/ }), +/* 831 */ +/***/ (function(module, exports, __webpack_require__) { + +var parse = __webpack_require__(832); +var types = parse.types; + +module.exports = function (re, opts) { + if (!opts) opts = {}; + var replimit = opts.limit === undefined ? 25 : opts.limit; + + if (isRegExp(re)) re = re.source; + else if (typeof re !== 'string') re = String(re); + + try { re = parse(re) } + catch (err) { return false } + + var reps = 0; + return (function walk (node, starHeight) { + if (node.type === types.REPETITION) { + starHeight ++; + reps ++; + if (starHeight > 1) return false; + if (reps > replimit) return false; + } + + if (node.options) { + for (var i = 0, len = node.options.length; i < len; i++) { + var ok = walk({ stack: node.options[i] }, starHeight); + if (!ok) return false; + } + } + var stack = node.stack || (node.value && node.value.stack); + if (!stack) return true; + + for (var i = 0; i < stack.length; i++) { + var ok = walk(stack[i], starHeight); + if (!ok) return false; + } + + return true; + })(re, 0); +}; + +function isRegExp (x) { + return {}.toString.call(x) === '[object RegExp]'; +} + + +/***/ }), +/* 832 */ +/***/ (function(module, exports, __webpack_require__) { + +var util = __webpack_require__(833); +var types = __webpack_require__(834); +var sets = __webpack_require__(835); +var positions = __webpack_require__(836); + + +module.exports = function(regexpStr) { + var i = 0, l, c, + start = { type: types.ROOT, stack: []}, + + // Keep track of last clause/group and stack. + lastGroup = start, + last = start.stack, + groupStack = []; + + + var repeatErr = function(i) { + util.error(regexpStr, 'Nothing to repeat at column ' + (i - 1)); + }; + + // Decode a few escaped characters. + var str = util.strToChars(regexpStr); + l = str.length; + + // Iterate through each character in string. + while (i < l) { + c = str[i++]; + + switch (c) { + // Handle escaped characters, inclues a few sets. + case '\\': + c = str[i++]; + + switch (c) { + case 'b': + last.push(positions.wordBoundary()); + break; + + case 'B': + last.push(positions.nonWordBoundary()); + break; + + case 'w': + last.push(sets.words()); + break; + + case 'W': + last.push(sets.notWords()); + break; + + case 'd': + last.push(sets.ints()); + break; + + case 'D': + last.push(sets.notInts()); + break; + + case 's': + last.push(sets.whitespace()); + break; + + case 'S': + last.push(sets.notWhitespace()); + break; + + default: + // Check if c is integer. + // In which case it's a reference. + if (/\d/.test(c)) { + last.push({ type: types.REFERENCE, value: parseInt(c, 10) }); + + // Escaped character. + } else { + last.push({ type: types.CHAR, value: c.charCodeAt(0) }); + } + } + + break; + + + // Positionals. + case '^': + last.push(positions.begin()); + break; + + case '$': + last.push(positions.end()); + break; + + + // Handle custom sets. + case '[': + // Check if this class is 'anti' i.e. [^abc]. + var not; + if (str[i] === '^') { + not = true; + i++; + } else { + not = false; + } + + // Get all the characters in class. + var classTokens = util.tokenizeClass(str.slice(i), regexpStr); + + // Increase index by length of class. + i += classTokens[1]; + last.push({ + type: types.SET, + set: classTokens[0], + not: not, + }); + + break; + + + // Class of any character except \n. + case '.': + last.push(sets.anyChar()); + break; + + + // Push group onto stack. + case '(': + // Create group. + var group = { + type: types.GROUP, + stack: [], + remember: true, + }; + + c = str[i]; + + // If if this is a special kind of group. + if (c === '?') { + c = str[i + 1]; + i += 2; + + // Match if followed by. + if (c === '=') { + group.followedBy = true; + + // Match if not followed by. + } else if (c === '!') { + group.notFollowedBy = true; + + } else if (c !== ':') { + util.error(regexpStr, + 'Invalid group, character \'' + c + + '\' after \'?\' at column ' + (i - 1)); + } + + group.remember = false; + } + + // Insert subgroup into current group stack. + last.push(group); + + // Remember the current group for when the group closes. + groupStack.push(lastGroup); + + // Make this new group the current group. + lastGroup = group; + last = group.stack; + break; + + + // Pop group out of stack. + case ')': + if (groupStack.length === 0) { + util.error(regexpStr, 'Unmatched ) at column ' + (i - 1)); + } + lastGroup = groupStack.pop(); + + // Check if this group has a PIPE. + // To get back the correct last stack. + last = lastGroup.options ? + lastGroup.options[lastGroup.options.length - 1] : lastGroup.stack; + break; + + + // Use pipe character to give more choices. + case '|': + // Create array where options are if this is the first PIPE + // in this clause. + if (!lastGroup.options) { + lastGroup.options = [lastGroup.stack]; + delete lastGroup.stack; + } + + // Create a new stack and add to options for rest of clause. + var stack = []; + lastGroup.options.push(stack); + last = stack; + break; + + + // Repetition. + // For every repetition, remove last element from last stack + // then insert back a RANGE object. + // This design is chosen because there could be more than + // one repetition symbols in a regex i.e. `a?+{2,3}`. + case '{': + var rs = /^(\d+)(,(\d+)?)?\}/.exec(str.slice(i)), min, max; + if (rs !== null) { + if (last.length === 0) { + repeatErr(i); + } + min = parseInt(rs[1], 10); + max = rs[2] ? rs[3] ? parseInt(rs[3], 10) : Infinity : min; + i += rs[0].length; + + last.push({ + type: types.REPETITION, + min: min, + max: max, + value: last.pop(), + }); + } else { + last.push({ + type: types.CHAR, + value: 123, + }); + } + break; + + case '?': + if (last.length === 0) { + repeatErr(i); + } + last.push({ + type: types.REPETITION, + min: 0, + max: 1, + value: last.pop(), + }); + break; + + case '+': + if (last.length === 0) { + repeatErr(i); + } + last.push({ + type: types.REPETITION, + min: 1, + max: Infinity, + value: last.pop(), + }); + break; + + case '*': + if (last.length === 0) { + repeatErr(i); + } + last.push({ + type: types.REPETITION, + min: 0, + max: Infinity, + value: last.pop(), + }); + break; + + + // Default is a character that is not `\[](){}?+*^$`. + default: + last.push({ + type: types.CHAR, + value: c.charCodeAt(0), + }); + } + + } + + // Check if any groups have not been closed. + if (groupStack.length !== 0) { + util.error(regexpStr, 'Unterminated group'); + } + + return start; +}; + +module.exports.types = types; + + +/***/ }), +/* 833 */ +/***/ (function(module, exports, __webpack_require__) { + +var types = __webpack_require__(834); +var sets = __webpack_require__(835); + + +// All of these are private and only used by randexp. +// It's assumed that they will always be called with the correct input. + +var CTRL = '@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^ ?'; +var SLSH = { '0': 0, 't': 9, 'n': 10, 'v': 11, 'f': 12, 'r': 13 }; + +/** + * Finds character representations in str and convert all to + * their respective characters + * + * @param {String} str + * @return {String} + */ +exports.strToChars = function(str) { + /* jshint maxlen: false */ + var chars_regex = /(\[\\b\])|(\\)?\\(?:u([A-F0-9]{4})|x([A-F0-9]{2})|(0?[0-7]{2})|c([@A-Z\[\\\]\^?])|([0tnvfr]))/g; + str = str.replace(chars_regex, function(s, b, lbs, a16, b16, c8, dctrl, eslsh) { + if (lbs) { + return s; + } + + var code = b ? 8 : + a16 ? parseInt(a16, 16) : + b16 ? parseInt(b16, 16) : + c8 ? parseInt(c8, 8) : + dctrl ? CTRL.indexOf(dctrl) : + SLSH[eslsh]; + + var c = String.fromCharCode(code); + + // Escape special regex characters. + if (/[\[\]{}\^$.|?*+()]/.test(c)) { + c = '\\' + c; + } + + return c; + }); + + return str; +}; + + +/** + * turns class into tokens + * reads str until it encounters a ] not preceeded by a \ + * + * @param {String} str + * @param {String} regexpStr + * @return {Array., Number>} + */ +exports.tokenizeClass = function(str, regexpStr) { + /* jshint maxlen: false */ + var tokens = []; + var regexp = /\\(?:(w)|(d)|(s)|(W)|(D)|(S))|((?:(?:\\)(.)|([^\]\\]))-(?:\\)?([^\]]))|(\])|(?:\\)?(.)/g; + var rs, c; + + + while ((rs = regexp.exec(str)) != null) { + if (rs[1]) { + tokens.push(sets.words()); + + } else if (rs[2]) { + tokens.push(sets.ints()); + + } else if (rs[3]) { + tokens.push(sets.whitespace()); + + } else if (rs[4]) { + tokens.push(sets.notWords()); + + } else if (rs[5]) { + tokens.push(sets.notInts()); + + } else if (rs[6]) { + tokens.push(sets.notWhitespace()); + + } else if (rs[7]) { + tokens.push({ + type: types.RANGE, + from: (rs[8] || rs[9]).charCodeAt(0), + to: rs[10].charCodeAt(0), + }); + + } else if (c = rs[12]) { + tokens.push({ + type: types.CHAR, + value: c.charCodeAt(0), + }); + + } else { + return [tokens, regexp.lastIndex]; + } + } + + exports.error(regexpStr, 'Unterminated character class'); +}; + + +/** + * Shortcut to throw errors. + * + * @param {String} regexp + * @param {String} msg + */ +exports.error = function(regexp, msg) { + throw new SyntaxError('Invalid regular expression: /' + regexp + '/: ' + msg); +}; + + +/***/ }), +/* 834 */ +/***/ (function(module, exports) { + +module.exports = { + ROOT : 0, + GROUP : 1, + POSITION : 2, + SET : 3, + RANGE : 4, + REPETITION : 5, + REFERENCE : 6, + CHAR : 7, +}; + + +/***/ }), +/* 835 */ +/***/ (function(module, exports, __webpack_require__) { + +var types = __webpack_require__(834); + +var INTS = function() { + return [{ type: types.RANGE , from: 48, to: 57 }]; +}; + +var WORDS = function() { + return [ + { type: types.CHAR, value: 95 }, + { type: types.RANGE, from: 97, to: 122 }, + { type: types.RANGE, from: 65, to: 90 } + ].concat(INTS()); +}; + +var WHITESPACE = function() { + return [ + { type: types.CHAR, value: 9 }, + { type: types.CHAR, value: 10 }, + { type: types.CHAR, value: 11 }, + { type: types.CHAR, value: 12 }, + { type: types.CHAR, value: 13 }, + { type: types.CHAR, value: 32 }, + { type: types.CHAR, value: 160 }, + { type: types.CHAR, value: 5760 }, + { type: types.CHAR, value: 6158 }, + { type: types.CHAR, value: 8192 }, + { type: types.CHAR, value: 8193 }, + { type: types.CHAR, value: 8194 }, + { type: types.CHAR, value: 8195 }, + { type: types.CHAR, value: 8196 }, + { type: types.CHAR, value: 8197 }, + { type: types.CHAR, value: 8198 }, + { type: types.CHAR, value: 8199 }, + { type: types.CHAR, value: 8200 }, + { type: types.CHAR, value: 8201 }, + { type: types.CHAR, value: 8202 }, + { type: types.CHAR, value: 8232 }, + { type: types.CHAR, value: 8233 }, + { type: types.CHAR, value: 8239 }, + { type: types.CHAR, value: 8287 }, + { type: types.CHAR, value: 12288 }, + { type: types.CHAR, value: 65279 } + ]; +}; + +var NOTANYCHAR = function() { + return [ + { type: types.CHAR, value: 10 }, + { type: types.CHAR, value: 13 }, + { type: types.CHAR, value: 8232 }, + { type: types.CHAR, value: 8233 }, + ]; +}; + +// Predefined class objects. +exports.words = function() { + return { type: types.SET, set: WORDS(), not: false }; +}; + +exports.notWords = function() { + return { type: types.SET, set: WORDS(), not: true }; +}; + +exports.ints = function() { + return { type: types.SET, set: INTS(), not: false }; +}; + +exports.notInts = function() { + return { type: types.SET, set: INTS(), not: true }; +}; + +exports.whitespace = function() { + return { type: types.SET, set: WHITESPACE(), not: false }; +}; + +exports.notWhitespace = function() { + return { type: types.SET, set: WHITESPACE(), not: true }; +}; + +exports.anyChar = function() { + return { type: types.SET, set: NOTANYCHAR(), not: true }; +}; + + +/***/ }), +/* 836 */ +/***/ (function(module, exports, __webpack_require__) { + +var types = __webpack_require__(834); + +exports.wordBoundary = function() { + return { type: types.POSITION, value: 'b' }; +}; + +exports.nonWordBoundary = function() { + return { type: types.POSITION, value: 'B' }; +}; + +exports.begin = function() { + return { type: types.POSITION, value: '^' }; +}; + +exports.end = function() { + return { type: types.POSITION, value: '$' }; +}; + + +/***/ }), +/* 837 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/*! + * define-property + * + * Copyright (c) 2015-2018, Jon Schlinkert. + * Released under the MIT License. + */ + + + +var isobject = __webpack_require__(748); +var isDescriptor = __webpack_require__(760); +var define = (typeof Reflect !== 'undefined' && Reflect.defineProperty) + ? Reflect.defineProperty + : Object.defineProperty; + +module.exports = function defineProperty(obj, key, val) { + if (!isobject(obj) && typeof obj !== 'function' && !Array.isArray(obj)) { + throw new TypeError('expected an object, function, or array'); + } + + if (typeof key !== 'string') { + throw new TypeError('expected "key" to be a string'); + } + + if (isDescriptor(val)) { + define(obj, key, val); + return obj; + } + + define(obj, key, { + configurable: true, + enumerable: false, + writable: true, + value: val + }); + + return obj; +}; + + +/***/ }), +/* 838 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var isExtendable = __webpack_require__(839); +var assignSymbols = __webpack_require__(749); + +module.exports = Object.assign || function(obj/*, objects*/) { + if (obj === null || typeof obj === 'undefined') { + throw new TypeError('Cannot convert undefined or null to object'); + } + if (!isObject(obj)) { + obj = {}; + } + for (var i = 1; i < arguments.length; i++) { + var val = arguments[i]; + if (isString(val)) { + val = toObject(val); + } + if (isObject(val)) { + assign(obj, val); + assignSymbols(obj, val); + } + } + return obj; +}; + +function assign(a, b) { + for (var key in b) { + if (hasOwn(b, key)) { + a[key] = b[key]; + } + } +} + +function isString(val) { + return (val && typeof val === 'string'); +} + +function toObject(str) { + var obj = {}; + for (var i in str) { + obj[i] = str[i]; + } + return obj; +} + +function isObject(val) { + return (val && typeof val === 'object') || isExtendable(val); +} + +/** + * Returns true if the given `key` is an own property of `obj`. + */ + +function hasOwn(obj, key) { + return Object.prototype.hasOwnProperty.call(obj, key); +} + +function isEnum(obj, key) { + return Object.prototype.propertyIsEnumerable.call(obj, key); +} + + +/***/ }), +/* 839 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/*! + * is-extendable + * + * Copyright (c) 2015-2017, Jon Schlinkert. + * Released under the MIT License. + */ + + + +var isPlainObject = __webpack_require__(747); + +module.exports = function isExtendable(val) { + return isPlainObject(val) || typeof val === 'function' || Array.isArray(val); +}; + + +/***/ }), +/* 840 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var extend = __webpack_require__(838); +var safe = __webpack_require__(831); + +/** + * The main export is a function that takes a `pattern` string and an `options` object. + * + * ```js + & var not = require('regex-not'); + & console.log(not('foo')); + & //=> /^(?:(?!^(?:foo)$).)*$/ + * ``` + * + * @param {String} `pattern` + * @param {Object} `options` + * @return {RegExp} Converts the given `pattern` to a regex using the specified `options`. + * @api public + */ + +function toRegex(pattern, options) { + return new RegExp(toRegex.create(pattern, options)); +} + +/** + * Create a regex-compatible string from the given `pattern` and `options`. + * + * ```js + & var not = require('regex-not'); + & console.log(not.create('foo')); + & //=> '^(?:(?!^(?:foo)$).)*$' + * ``` + * @param {String} `pattern` + * @param {Object} `options` + * @return {String} + * @api public + */ + +toRegex.create = function(pattern, options) { + if (typeof pattern !== 'string') { + throw new TypeError('expected a string'); + } + + var opts = extend({}, options); + if (opts.contains === true) { + opts.strictNegate = false; + } + + var open = opts.strictOpen !== false ? '^' : ''; + var close = opts.strictClose !== false ? '$' : ''; + var endChar = opts.endChar ? opts.endChar : '+'; + var str = pattern; + + if (opts.strictNegate === false) { + str = '(?:(?!(?:' + pattern + ')).)' + endChar; + } else { + str = '(?:(?!^(?:' + pattern + ')$).)' + endChar; + } + + var res = open + str + close; + if (opts.safe === true && safe(res) === false) { + throw new Error('potentially unsafe regular expression: ' + res); + } + + return res; +}; + +/** + * Expose `toRegex` + */ + +module.exports = toRegex; + + +/***/ }), +/* 841 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var nanomatch = __webpack_require__(842); +var extglob = __webpack_require__(857); + +module.exports = function(snapdragon) { + var compilers = snapdragon.compiler.compilers; + var opts = snapdragon.options; + + // register nanomatch compilers + snapdragon.use(nanomatch.compilers); + + // get references to some specific nanomatch compilers before they + // are overridden by the extglob and/or custom compilers + var escape = compilers.escape; + var qmark = compilers.qmark; + var slash = compilers.slash; + var star = compilers.star; + var text = compilers.text; + var plus = compilers.plus; + var dot = compilers.dot; + + // register extglob compilers or escape exglobs if disabled + if (opts.extglob === false || opts.noext === true) { + snapdragon.compiler.use(escapeExtglobs); + } else { + snapdragon.use(extglob.compilers); + } + + snapdragon.use(function() { + this.options.star = this.options.star || function(/*node*/) { + return '[^\\\\/]*?'; + }; + }); + + // custom micromatch compilers + snapdragon.compiler + + // reset referenced compiler + .set('dot', dot) + .set('escape', escape) + .set('plus', plus) + .set('slash', slash) + .set('qmark', qmark) + .set('star', star) + .set('text', text); +}; + +function escapeExtglobs(compiler) { + compiler.set('paren', function(node) { + var val = ''; + visit(node, function(tok) { + if (tok.val) val += (/^\W/.test(tok.val) ? '\\' : '') + tok.val; + }); + return this.emit(val, node); + }); + + /** + * Visit `node` with the given `fn` + */ + + function visit(node, fn) { + return node.nodes ? mapVisit(node.nodes, fn) : fn(node); + } + + /** + * Map visit over array of `nodes`. + */ + + function mapVisit(nodes, fn) { + var len = nodes.length; + var idx = -1; + while (++idx < len) { + visit(nodes[idx], fn); + } + } +} + + +/***/ }), +/* 842 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/** + * Module dependencies + */ + +var util = __webpack_require__(29); +var toRegex = __webpack_require__(729); +var extend = __webpack_require__(843); + +/** + * Local dependencies + */ + +var compilers = __webpack_require__(845); +var parsers = __webpack_require__(846); +var cache = __webpack_require__(849); +var utils = __webpack_require__(851); +var MAX_LENGTH = 1024 * 64; + +/** + * The main function takes a list of strings and one or more + * glob patterns to use for matching. + * + * ```js + * var nm = require('nanomatch'); + * nm(list, patterns[, options]); + * + * console.log(nm(['a.js', 'a.txt'], ['*.js'])); + * //=> [ 'a.js' ] + * ``` + * @param {Array} `list` A list of strings to match + * @param {String|Array} `patterns` One or more glob patterns to use for matching. + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Array} Returns an array of matches + * @summary false + * @api public + */ + +function nanomatch(list, patterns, options) { + patterns = utils.arrayify(patterns); + list = utils.arrayify(list); + + var len = patterns.length; + if (list.length === 0 || len === 0) { + return []; + } + + if (len === 1) { + return nanomatch.match(list, patterns[0], options); + } + + var negated = false; + var omit = []; + var keep = []; + var idx = -1; + + while (++idx < len) { + var pattern = patterns[idx]; + + if (typeof pattern === 'string' && pattern.charCodeAt(0) === 33 /* ! */) { + omit.push.apply(omit, nanomatch.match(list, pattern.slice(1), options)); + negated = true; + } else { + keep.push.apply(keep, nanomatch.match(list, pattern, options)); + } + } + + // minimatch.match parity + if (negated && keep.length === 0) { + if (options && options.unixify === false) { + keep = list.slice(); + } else { + var unixify = utils.unixify(options); + for (var i = 0; i < list.length; i++) { + keep.push(unixify(list[i])); + } + } + } + + var matches = utils.diff(keep, omit); + if (!options || options.nodupes !== false) { + return utils.unique(matches); + } + + return matches; +} + +/** + * Similar to the main function, but `pattern` must be a string. + * + * ```js + * var nm = require('nanomatch'); + * nm.match(list, pattern[, options]); + * + * console.log(nm.match(['a.a', 'a.aa', 'a.b', 'a.c'], '*.a')); + * //=> ['a.a', 'a.aa'] + * ``` + * @param {Array} `list` Array of strings to match + * @param {String} `pattern` Glob pattern to use for matching. + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Array} Returns an array of matches + * @api public + */ + +nanomatch.match = function(list, pattern, options) { + if (Array.isArray(pattern)) { + throw new TypeError('expected pattern to be a string'); + } + + var unixify = utils.unixify(options); + var isMatch = memoize('match', pattern, options, nanomatch.matcher); + var matches = []; + + list = utils.arrayify(list); + var len = list.length; + var idx = -1; + + while (++idx < len) { + var ele = list[idx]; + if (ele === pattern || isMatch(ele)) { + matches.push(utils.value(ele, unixify, options)); + } + } + + // if no options were passed, uniquify results and return + if (typeof options === 'undefined') { + return utils.unique(matches); + } + + if (matches.length === 0) { + if (options.failglob === true) { + throw new Error('no matches found for "' + pattern + '"'); + } + if (options.nonull === true || options.nullglob === true) { + return [options.unescape ? utils.unescape(pattern) : pattern]; + } + } + + // if `opts.ignore` was defined, diff ignored list + if (options.ignore) { + matches = nanomatch.not(matches, options.ignore, options); + } + + return options.nodupes !== false ? utils.unique(matches) : matches; +}; + +/** + * Returns true if the specified `string` matches the given glob `pattern`. + * + * ```js + * var nm = require('nanomatch'); + * nm.isMatch(string, pattern[, options]); + * + * console.log(nm.isMatch('a.a', '*.a')); + * //=> true + * console.log(nm.isMatch('a.b', '*.a')); + * //=> false + * ``` + * @param {String} `string` String to match + * @param {String} `pattern` Glob pattern to use for matching. + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Boolean} Returns true if the string matches the glob pattern. + * @api public + */ + +nanomatch.isMatch = function(str, pattern, options) { + if (typeof str !== 'string') { + throw new TypeError('expected a string: "' + util.inspect(str) + '"'); + } + + if (utils.isEmptyString(str) || utils.isEmptyString(pattern)) { + return false; + } + + var equals = utils.equalsPattern(options); + if (equals(str)) { + return true; + } + + var isMatch = memoize('isMatch', pattern, options, nanomatch.matcher); + return isMatch(str); +}; + +/** + * Returns true if some of the elements in the given `list` match any of the + * given glob `patterns`. + * + * ```js + * var nm = require('nanomatch'); + * nm.some(list, patterns[, options]); + * + * console.log(nm.some(['foo.js', 'bar.js'], ['*.js', '!foo.js'])); + * // true + * console.log(nm.some(['foo.js'], ['*.js', '!foo.js'])); + * // false + * ``` + * @param {String|Array} `list` The string or array of strings to test. Returns as soon as the first match is found. + * @param {String|Array} `patterns` One or more glob patterns to use for matching. + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Boolean} Returns true if any patterns match `str` + * @api public + */ + +nanomatch.some = function(list, patterns, options) { + if (typeof list === 'string') { + list = [list]; + } + + for (var i = 0; i < list.length; i++) { + if (nanomatch(list[i], patterns, options).length === 1) { + return true; + } + } + + return false; +}; + +/** + * Returns true if every element in the given `list` matches + * at least one of the given glob `patterns`. + * + * ```js + * var nm = require('nanomatch'); + * nm.every(list, patterns[, options]); + * + * console.log(nm.every('foo.js', ['foo.js'])); + * // true + * console.log(nm.every(['foo.js', 'bar.js'], ['*.js'])); + * // true + * console.log(nm.every(['foo.js', 'bar.js'], ['*.js', '!foo.js'])); + * // false + * console.log(nm.every(['foo.js'], ['*.js', '!foo.js'])); + * // false + * ``` + * @param {String|Array} `list` The string or array of strings to test. + * @param {String|Array} `patterns` One or more glob patterns to use for matching. + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Boolean} Returns true if any patterns match `str` + * @api public + */ + +nanomatch.every = function(list, patterns, options) { + if (typeof list === 'string') { + list = [list]; + } + + for (var i = 0; i < list.length; i++) { + if (nanomatch(list[i], patterns, options).length !== 1) { + return false; + } + } + + return true; +}; + +/** + * Returns true if **any** of the given glob `patterns` + * match the specified `string`. + * + * ```js + * var nm = require('nanomatch'); + * nm.any(string, patterns[, options]); + * + * console.log(nm.any('a.a', ['b.*', '*.a'])); + * //=> true + * console.log(nm.any('a.a', 'b.*')); + * //=> false + * ``` + * @param {String|Array} `str` The string to test. + * @param {String|Array} `patterns` One or more glob patterns to use for matching. + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Boolean} Returns true if any patterns match `str` + * @api public + */ + +nanomatch.any = function(str, patterns, options) { + if (typeof str !== 'string') { + throw new TypeError('expected a string: "' + util.inspect(str) + '"'); + } + + if (utils.isEmptyString(str) || utils.isEmptyString(patterns)) { + return false; + } + + if (typeof patterns === 'string') { + patterns = [patterns]; + } + + for (var i = 0; i < patterns.length; i++) { + if (nanomatch.isMatch(str, patterns[i], options)) { + return true; + } + } + return false; +}; + +/** + * Returns true if **all** of the given `patterns` + * match the specified string. + * + * ```js + * var nm = require('nanomatch'); + * nm.all(string, patterns[, options]); + * + * console.log(nm.all('foo.js', ['foo.js'])); + * // true + * + * console.log(nm.all('foo.js', ['*.js', '!foo.js'])); + * // false + * + * console.log(nm.all('foo.js', ['*.js', 'foo.js'])); + * // true + * + * console.log(nm.all('foo.js', ['*.js', 'f*', '*o*', '*o.js'])); + * // true + * ``` + * @param {String|Array} `str` The string to test. + * @param {String|Array} `patterns` One or more glob patterns to use for matching. + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Boolean} Returns true if any patterns match `str` + * @api public + */ + +nanomatch.all = function(str, patterns, options) { + if (typeof str !== 'string') { + throw new TypeError('expected a string: "' + util.inspect(str) + '"'); + } + + if (typeof patterns === 'string') { + patterns = [patterns]; + } + + for (var i = 0; i < patterns.length; i++) { + if (!nanomatch.isMatch(str, patterns[i], options)) { + return false; + } + } + return true; +}; + +/** + * Returns a list of strings that _**do not match any**_ of the given `patterns`. + * + * ```js + * var nm = require('nanomatch'); + * nm.not(list, patterns[, options]); + * + * console.log(nm.not(['a.a', 'b.b', 'c.c'], '*.a')); + * //=> ['b.b', 'c.c'] + * ``` + * @param {Array} `list` Array of strings to match. + * @param {String|Array} `patterns` One or more glob pattern to use for matching. + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Array} Returns an array of strings that **do not match** the given patterns. + * @api public + */ + +nanomatch.not = function(list, patterns, options) { + var opts = extend({}, options); + var ignore = opts.ignore; + delete opts.ignore; + + list = utils.arrayify(list); + + var matches = utils.diff(list, nanomatch(list, patterns, opts)); + if (ignore) { + matches = utils.diff(matches, nanomatch(list, ignore)); + } + + return opts.nodupes !== false ? utils.unique(matches) : matches; +}; + +/** + * Returns true if the given `string` contains the given pattern. Similar + * to [.isMatch](#isMatch) but the pattern can match any part of the string. + * + * ```js + * var nm = require('nanomatch'); + * nm.contains(string, pattern[, options]); + * + * console.log(nm.contains('aa/bb/cc', '*b')); + * //=> true + * console.log(nm.contains('aa/bb/cc', '*d')); + * //=> false + * ``` + * @param {String} `str` The string to match. + * @param {String|Array} `patterns` Glob pattern to use for matching. + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Boolean} Returns true if the patter matches any part of `str`. + * @api public + */ + +nanomatch.contains = function(str, patterns, options) { + if (typeof str !== 'string') { + throw new TypeError('expected a string: "' + util.inspect(str) + '"'); + } + + if (typeof patterns === 'string') { + if (utils.isEmptyString(str) || utils.isEmptyString(patterns)) { + return false; + } + + var equals = utils.equalsPattern(patterns, options); + if (equals(str)) { + return true; + } + var contains = utils.containsPattern(patterns, options); + if (contains(str)) { + return true; + } + } + + var opts = extend({}, options, {contains: true}); + return nanomatch.any(str, patterns, opts); +}; + +/** + * Returns true if the given pattern and options should enable + * the `matchBase` option. + * @return {Boolean} + * @api private + */ + +nanomatch.matchBase = function(pattern, options) { + if (pattern && pattern.indexOf('/') !== -1 || !options) return false; + return options.basename === true || options.matchBase === true; +}; + +/** + * Filter the keys of the given object with the given `glob` pattern + * and `options`. Does not attempt to match nested keys. If you need this feature, + * use [glob-object][] instead. + * + * ```js + * var nm = require('nanomatch'); + * nm.matchKeys(object, patterns[, options]); + * + * var obj = { aa: 'a', ab: 'b', ac: 'c' }; + * console.log(nm.matchKeys(obj, '*b')); + * //=> { ab: 'b' } + * ``` + * @param {Object} `object` The object with keys to filter. + * @param {String|Array} `patterns` One or more glob patterns to use for matching. + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Object} Returns an object with only keys that match the given patterns. + * @api public + */ + +nanomatch.matchKeys = function(obj, patterns, options) { + if (!utils.isObject(obj)) { + throw new TypeError('expected the first argument to be an object'); + } + var keys = nanomatch(Object.keys(obj), patterns, options); + return utils.pick(obj, keys); +}; + +/** + * Returns a memoized matcher function from the given glob `pattern` and `options`. + * The returned function takes a string to match as its only argument and returns + * true if the string is a match. + * + * ```js + * var nm = require('nanomatch'); + * nm.matcher(pattern[, options]); + * + * var isMatch = nm.matcher('*.!(*a)'); + * console.log(isMatch('a.a')); + * //=> false + * console.log(isMatch('a.b')); + * //=> true + * ``` + * @param {String} `pattern` Glob pattern + * @param {Object} `options` See available [options](#options) for changing how matches are performed. + * @return {Function} Returns a matcher function. + * @api public + */ + +nanomatch.matcher = function matcher(pattern, options) { + if (utils.isEmptyString(pattern)) { + return function() { + return false; + }; + } + + if (Array.isArray(pattern)) { + return compose(pattern, options, matcher); + } + + // if pattern is a regex + if (pattern instanceof RegExp) { + return test(pattern); + } + + // if pattern is invalid + if (!utils.isString(pattern)) { + throw new TypeError('expected pattern to be an array, string or regex'); + } + + // if pattern is a non-glob string + if (!utils.hasSpecialChars(pattern)) { + if (options && options.nocase === true) { + pattern = pattern.toLowerCase(); + } + return utils.matchPath(pattern, options); + } + + // if pattern is a glob string + var re = nanomatch.makeRe(pattern, options); + + // if `options.matchBase` or `options.basename` is defined + if (nanomatch.matchBase(pattern, options)) { + return utils.matchBasename(re, options); + } + + function test(regex) { + var equals = utils.equalsPattern(options); + var unixify = utils.unixify(options); + + return function(str) { + if (equals(str)) { + return true; + } + + if (regex.test(unixify(str))) { + return true; + } + return false; + }; + } + + // create matcher function + var matcherFn = test(re); + // set result object from compiler on matcher function, + // as a non-enumerable property. useful for debugging + utils.define(matcherFn, 'result', re.result); + return matcherFn; +}; + +/** + * Returns an array of matches captured by `pattern` in `string, or + * `null` if the pattern did not match. + * + * ```js + * var nm = require('nanomatch'); + * nm.capture(pattern, string[, options]); + * + * console.log(nm.capture('test/*.js', 'test/foo.js')); + * //=> ['foo'] + * console.log(nm.capture('test/*.js', 'foo/bar.css')); + * //=> null + * ``` + * @param {String} `pattern` Glob pattern to use for matching. + * @param {String} `string` String to match + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Boolean} Returns an array of captures if the string matches the glob pattern, otherwise `null`. + * @api public + */ + +nanomatch.capture = function(pattern, str, options) { + var re = nanomatch.makeRe(pattern, extend({capture: true}, options)); + var unixify = utils.unixify(options); + + function match() { + return function(string) { + var match = re.exec(unixify(string)); + if (!match) { + return null; + } + + return match.slice(1); + }; + } + + var capture = memoize('capture', pattern, options, match); + return capture(str); +}; + +/** + * Create a regular expression from the given glob `pattern`. + * + * ```js + * var nm = require('nanomatch'); + * nm.makeRe(pattern[, options]); + * + * console.log(nm.makeRe('*.js')); + * //=> /^(?:(\.[\\\/])?(?!\.)(?=.)[^\/]*?\.js)$/ + * ``` + * @param {String} `pattern` A glob pattern to convert to regex. + * @param {Object} `options` See available [options](#options) for changing how matches are performed. + * @return {RegExp} Returns a regex created from the given pattern. + * @api public + */ + +nanomatch.makeRe = function(pattern, options) { + if (pattern instanceof RegExp) { + return pattern; + } + + if (typeof pattern !== 'string') { + throw new TypeError('expected pattern to be a string'); + } + + if (pattern.length > MAX_LENGTH) { + throw new Error('expected pattern to be less than ' + MAX_LENGTH + ' characters'); + } + + function makeRe() { + var opts = utils.extend({wrap: false}, options); + var result = nanomatch.create(pattern, opts); + var regex = toRegex(result.output, opts); + utils.define(regex, 'result', result); + return regex; + } + + return memoize('makeRe', pattern, options, makeRe); +}; + +/** + * Parses the given glob `pattern` and returns an object with the compiled `output` + * and optional source `map`. + * + * ```js + * var nm = require('nanomatch'); + * nm.create(pattern[, options]); + * + * console.log(nm.create('abc/*.js')); + * // { options: { source: 'string', sourcemap: true }, + * // state: {}, + * // compilers: + * // { ... }, + * // output: '(\\.[\\\\\\/])?abc\\/(?!\\.)(?=.)[^\\/]*?\\.js', + * // ast: + * // { type: 'root', + * // errors: [], + * // nodes: + * // [ ... ], + * // dot: false, + * // input: 'abc/*.js' }, + * // parsingErrors: [], + * // map: + * // { version: 3, + * // sources: [ 'string' ], + * // names: [], + * // mappings: 'AAAA,GAAG,EAAC,kBAAC,EAAC,EAAE', + * // sourcesContent: [ 'abc/*.js' ] }, + * // position: { line: 1, column: 28 }, + * // content: {}, + * // files: {}, + * // idx: 6 } + * ``` + * @param {String} `pattern` Glob pattern to parse and compile. + * @param {Object} `options` Any [options](#options) to change how parsing and compiling is performed. + * @return {Object} Returns an object with the parsed AST, compiled string and optional source map. + * @api public + */ + +nanomatch.create = function(pattern, options) { + if (typeof pattern !== 'string') { + throw new TypeError('expected a string'); + } + function create() { + return nanomatch.compile(nanomatch.parse(pattern, options), options); + } + return memoize('create', pattern, options, create); +}; + +/** + * Parse the given `str` with the given `options`. + * + * ```js + * var nm = require('nanomatch'); + * nm.parse(pattern[, options]); + * + * var ast = nm.parse('a/{b,c}/d'); + * console.log(ast); + * // { type: 'root', + * // errors: [], + * // input: 'a/{b,c}/d', + * // nodes: + * // [ { type: 'bos', val: '' }, + * // { type: 'text', val: 'a/' }, + * // { type: 'brace', + * // nodes: + * // [ { type: 'brace.open', val: '{' }, + * // { type: 'text', val: 'b,c' }, + * // { type: 'brace.close', val: '}' } ] }, + * // { type: 'text', val: '/d' }, + * // { type: 'eos', val: '' } ] } + * ``` + * @param {String} `str` + * @param {Object} `options` + * @return {Object} Returns an AST + * @api public + */ + +nanomatch.parse = function(pattern, options) { + if (typeof pattern !== 'string') { + throw new TypeError('expected a string'); + } + + function parse() { + var snapdragon = utils.instantiate(null, options); + parsers(snapdragon, options); + + var ast = snapdragon.parse(pattern, options); + utils.define(ast, 'snapdragon', snapdragon); + ast.input = pattern; + return ast; + } + + return memoize('parse', pattern, options, parse); +}; + +/** + * Compile the given `ast` or string with the given `options`. + * + * ```js + * var nm = require('nanomatch'); + * nm.compile(ast[, options]); + * + * var ast = nm.parse('a/{b,c}/d'); + * console.log(nm.compile(ast)); + * // { options: { source: 'string' }, + * // state: {}, + * // compilers: + * // { eos: [Function], + * // noop: [Function], + * // bos: [Function], + * // brace: [Function], + * // 'brace.open': [Function], + * // text: [Function], + * // 'brace.close': [Function] }, + * // output: [ 'a/(b|c)/d' ], + * // ast: + * // { ... }, + * // parsingErrors: [] } + * ``` + * @param {Object|String} `ast` + * @param {Object} `options` + * @return {Object} Returns an object that has an `output` property with the compiled string. + * @api public + */ + +nanomatch.compile = function(ast, options) { + if (typeof ast === 'string') { + ast = nanomatch.parse(ast, options); + } + + function compile() { + var snapdragon = utils.instantiate(ast, options); + compilers(snapdragon, options); + return snapdragon.compile(ast, options); + } + + return memoize('compile', ast.input, options, compile); +}; + +/** + * Clear the regex cache. + * + * ```js + * nm.clearCache(); + * ``` + * @api public + */ + +nanomatch.clearCache = function() { + nanomatch.cache.__data__ = {}; +}; + +/** + * Compose a matcher function with the given patterns. + * This allows matcher functions to be compiled once and + * called multiple times. + */ + +function compose(patterns, options, matcher) { + var matchers; + + return memoize('compose', String(patterns), options, function() { + return function(file) { + // delay composition until it's invoked the first time, + // after that it won't be called again + if (!matchers) { + matchers = []; + for (var i = 0; i < patterns.length; i++) { + matchers.push(matcher(patterns[i], options)); + } + } + + var len = matchers.length; + while (len--) { + if (matchers[len](file) === true) { + return true; + } + } + return false; + }; + }); +} + +/** + * Memoize a generated regex or function. A unique key is generated + * from the `type` (usually method name), the `pattern`, and + * user-defined options. + */ + +function memoize(type, pattern, options, fn) { + var key = utils.createKey(type + '=' + pattern, options); + + if (options && options.cache === false) { + return fn(pattern, options); + } + + if (cache.has(type, key)) { + return cache.get(type, key); + } + + var val = fn(pattern, options); + cache.set(type, key, val); + return val; +} + +/** + * Expose compiler, parser and cache on `nanomatch` + */ + +nanomatch.compilers = compilers; +nanomatch.parsers = parsers; +nanomatch.cache = cache; + +/** + * Expose `nanomatch` + * @type {Function} + */ + +module.exports = nanomatch; + + +/***/ }), +/* 843 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var isExtendable = __webpack_require__(844); +var assignSymbols = __webpack_require__(749); + +module.exports = Object.assign || function(obj/*, objects*/) { + if (obj === null || typeof obj === 'undefined') { + throw new TypeError('Cannot convert undefined or null to object'); + } + if (!isObject(obj)) { + obj = {}; + } + for (var i = 1; i < arguments.length; i++) { + var val = arguments[i]; + if (isString(val)) { + val = toObject(val); + } + if (isObject(val)) { + assign(obj, val); + assignSymbols(obj, val); + } + } + return obj; +}; + +function assign(a, b) { + for (var key in b) { + if (hasOwn(b, key)) { + a[key] = b[key]; + } + } +} + +function isString(val) { + return (val && typeof val === 'string'); +} + +function toObject(str) { + var obj = {}; + for (var i in str) { + obj[i] = str[i]; + } + return obj; +} + +function isObject(val) { + return (val && typeof val === 'object') || isExtendable(val); +} + +/** + * Returns true if the given `key` is an own property of `obj`. + */ + +function hasOwn(obj, key) { + return Object.prototype.hasOwnProperty.call(obj, key); +} + +function isEnum(obj, key) { + return Object.prototype.propertyIsEnumerable.call(obj, key); +} + + +/***/ }), +/* 844 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/*! + * is-extendable + * + * Copyright (c) 2015-2017, Jon Schlinkert. + * Released under the MIT License. + */ + + + +var isPlainObject = __webpack_require__(747); + +module.exports = function isExtendable(val) { + return isPlainObject(val) || typeof val === 'function' || Array.isArray(val); +}; + + +/***/ }), +/* 845 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/** +* Nanomatch compilers +*/ + +module.exports = function(nanomatch, options) { + function slash() { + if (options && typeof options.slash === 'string') { + return options.slash; + } + if (options && typeof options.slash === 'function') { + return options.slash.call(nanomatch); + } + return '\\\\/'; + } + + function star() { + if (options && typeof options.star === 'string') { + return options.star; + } + if (options && typeof options.star === 'function') { + return options.star.call(nanomatch); + } + return '[^' + slash() + ']*?'; + } + + var ast = nanomatch.ast = nanomatch.parser.ast; + ast.state = nanomatch.parser.state; + nanomatch.compiler.state = ast.state; + nanomatch.compiler + + /** + * Negation / escaping + */ + + .set('not', function(node) { + var prev = this.prev(); + if (this.options.nonegate === true || prev.type !== 'bos') { + return this.emit('\\' + node.val, node); + } + return this.emit(node.val, node); + }) + .set('escape', function(node) { + if (this.options.unescape && /^[-\w_.]/.test(node.val)) { + return this.emit(node.val, node); + } + return this.emit('\\' + node.val, node); + }) + .set('quoted', function(node) { + return this.emit(node.val, node); + }) + + /** + * Regex + */ + + .set('dollar', function(node) { + if (node.parent.type === 'bracket') { + return this.emit(node.val, node); + } + return this.emit('\\' + node.val, node); + }) + + /** + * Dot: "." + */ + + .set('dot', function(node) { + if (node.dotfiles === true) this.dotfiles = true; + return this.emit('\\' + node.val, node); + }) + + /** + * Slashes: "/" and "\" + */ + + .set('backslash', function(node) { + return this.emit(node.val, node); + }) + .set('slash', function(node, nodes, i) { + var val = '[' + slash() + ']'; + var parent = node.parent; + var prev = this.prev(); + + // set "node.hasSlash" to true on all ancestor parens nodes + while (parent.type === 'paren' && !parent.hasSlash) { + parent.hasSlash = true; + parent = parent.parent; + } + + if (prev.addQmark) { + val += '?'; + } + + // word boundary + if (node.rest.slice(0, 2) === '\\b') { + return this.emit(val, node); + } + + // globstars + if (node.parsed === '**' || node.parsed === './**') { + this.output = '(?:' + this.output; + return this.emit(val + ')?', node); + } + + // negation + if (node.parsed === '!**' && this.options.nonegate !== true) { + return this.emit(val + '?\\b', node); + } + return this.emit(val, node); + }) + + /** + * Square brackets + */ + + .set('bracket', function(node) { + var close = node.close; + var open = !node.escaped ? '[' : '\\['; + var negated = node.negated; + var inner = node.inner; + var val = node.val; + + if (node.escaped === true) { + inner = inner.replace(/\\?(\W)/g, '\\$1'); + negated = ''; + } + + if (inner === ']-') { + inner = '\\]\\-'; + } + + if (negated && inner.indexOf('.') === -1) { + inner += '.'; + } + if (negated && inner.indexOf('/') === -1) { + inner += '/'; + } + + val = open + negated + inner + close; + return this.emit(val, node); + }) + + /** + * Square: "[.]" (only matches a single character in brackets) + */ + + .set('square', function(node) { + var val = (/^\W/.test(node.val) ? '\\' : '') + node.val; + return this.emit(val, node); + }) + + /** + * Question mark: "?" + */ + + .set('qmark', function(node) { + var prev = this.prev(); + // don't use "slash" variable so that we always avoid + // matching backslashes and slashes with a qmark + var val = '[^.\\\\/]'; + if (this.options.dot || (prev.type !== 'bos' && prev.type !== 'slash')) { + val = '[^\\\\/]'; + } + + if (node.parsed.slice(-1) === '(') { + var ch = node.rest.charAt(0); + if (ch === '!' || ch === '=' || ch === ':') { + return this.emit(node.val, node); + } + } + + if (node.val.length > 1) { + val += '{' + node.val.length + '}'; + } + return this.emit(val, node); + }) + + /** + * Plus + */ + + .set('plus', function(node) { + var prev = node.parsed.slice(-1); + if (prev === ']' || prev === ')') { + return this.emit(node.val, node); + } + if (!this.output || (/[?*+]/.test(ch) && node.parent.type !== 'bracket')) { + return this.emit('\\+', node); + } + var ch = this.output.slice(-1); + if (/\w/.test(ch) && !node.inside) { + return this.emit('+\\+?', node); + } + return this.emit('+', node); + }) + + /** + * globstar: '**' + */ + + .set('globstar', function(node, nodes, i) { + if (!this.output) { + this.state.leadingGlobstar = true; + } + + var prev = this.prev(); + var before = this.prev(2); + var next = this.next(); + var after = this.next(2); + var type = prev.type; + var val = node.val; + + if (prev.type === 'slash' && next.type === 'slash') { + if (before.type === 'text') { + this.output += '?'; + + if (after.type !== 'text') { + this.output += '\\b'; + } + } + } + + var parsed = node.parsed; + if (parsed.charAt(0) === '!') { + parsed = parsed.slice(1); + } + + var isInside = node.isInside.paren || node.isInside.brace; + if (parsed && type !== 'slash' && type !== 'bos' && !isInside) { + val = star(); + } else { + val = this.options.dot !== true + ? '(?:(?!(?:[' + slash() + ']|^)\\.).)*?' + : '(?:(?!(?:[' + slash() + ']|^)(?:\\.{1,2})($|[' + slash() + ']))(?!\\.{2}).)*?'; + } + + if ((type === 'slash' || type === 'bos') && this.options.dot !== true) { + val = '(?!\\.)' + val; + } + + if (prev.type === 'slash' && next.type === 'slash' && before.type !== 'text') { + if (after.type === 'text' || after.type === 'star') { + node.addQmark = true; + } + } + + if (this.options.capture) { + val = '(' + val + ')'; + } + + return this.emit(val, node); + }) + + /** + * Star: "*" + */ + + .set('star', function(node, nodes, i) { + var prior = nodes[i - 2] || {}; + var prev = this.prev(); + var next = this.next(); + var type = prev.type; + + function isStart(n) { + return n.type === 'bos' || n.type === 'slash'; + } + + if (this.output === '' && this.options.contains !== true) { + this.output = '(?![' + slash() + '])'; + } + + if (type === 'bracket' && this.options.bash === false) { + var str = next && next.type === 'bracket' ? star() : '*?'; + if (!prev.nodes || prev.nodes[1].type !== 'posix') { + return this.emit(str, node); + } + } + + var prefix = !this.dotfiles && type !== 'text' && type !== 'escape' + ? (this.options.dot ? '(?!(?:^|[' + slash() + '])\\.{1,2}(?:$|[' + slash() + ']))' : '(?!\\.)') + : ''; + + if (isStart(prev) || (isStart(prior) && type === 'not')) { + if (prefix !== '(?!\\.)') { + prefix += '(?!(\\.{2}|\\.[' + slash() + ']))(?=.)'; + } else { + prefix += '(?=.)'; + } + } else if (prefix === '(?!\\.)') { + prefix = ''; + } + + if (prev.type === 'not' && prior.type === 'bos' && this.options.dot === true) { + this.output = '(?!\\.)' + this.output; + } + + var output = prefix + star(); + if (this.options.capture) { + output = '(' + output + ')'; + } + + return this.emit(output, node); + }) + + /** + * Text + */ + + .set('text', function(node) { + return this.emit(node.val, node); + }) + + /** + * End-of-string + */ + + .set('eos', function(node) { + var prev = this.prev(); + var val = node.val; + + this.output = '(?:\\.[' + slash() + '](?=.))?' + this.output; + if (this.state.metachar && prev.type !== 'qmark' && prev.type !== 'slash') { + val += (this.options.contains ? '[' + slash() + ']?' : '(?:[' + slash() + ']|$)'); + } + + return this.emit(val, node); + }); + + /** + * Allow custom compilers to be passed on options + */ + + if (options && typeof options.compilers === 'function') { + options.compilers(nanomatch.compiler); + } +}; + + + +/***/ }), +/* 846 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var regexNot = __webpack_require__(740); +var toRegex = __webpack_require__(729); +var isOdd = __webpack_require__(847); + +/** + * Characters to use in negation regex (we want to "not" match + * characters that are matched by other parsers) + */ + +var cached; +var NOT_REGEX = '[\\[!*+?$^"\'.\\\\/]+'; +var not = createTextRegex(NOT_REGEX); + +/** + * Nanomatch parsers + */ + +module.exports = function(nanomatch, options) { + var parser = nanomatch.parser; + var opts = parser.options; + + parser.state = { + slashes: 0, + paths: [] + }; + + parser.ast.state = parser.state; + parser + + /** + * Beginning-of-string + */ + + .capture('prefix', function() { + if (this.parsed) return; + var m = this.match(/^\.[\\/]/); + if (!m) return; + this.state.strictOpen = !!this.options.strictOpen; + this.state.addPrefix = true; + }) + + /** + * Escape: "\\." + */ + + .capture('escape', function() { + if (this.isInside('bracket')) return; + var pos = this.position(); + var m = this.match(/^(?:\\(.)|([$^]))/); + if (!m) return; + + return pos({ + type: 'escape', + val: m[2] || m[1] + }); + }) + + /** + * Quoted strings + */ + + .capture('quoted', function() { + var pos = this.position(); + var m = this.match(/^["']/); + if (!m) return; + + var quote = m[0]; + if (this.input.indexOf(quote) === -1) { + return pos({ + type: 'escape', + val: quote + }); + } + + var tok = advanceTo(this.input, quote); + this.consume(tok.len); + + return pos({ + type: 'quoted', + val: tok.esc + }); + }) + + /** + * Negations: "!" + */ + + .capture('not', function() { + var parsed = this.parsed; + var pos = this.position(); + var m = this.match(this.notRegex || /^!+/); + if (!m) return; + var val = m[0]; + + var isNegated = isOdd(val.length); + if (parsed === '' && !isNegated) { + val = ''; + } + + // if nothing has been parsed, we know `!` is at the start, + // so we need to wrap the result in a negation regex + if (parsed === '' && isNegated && this.options.nonegate !== true) { + this.bos.val = '(?!^(?:'; + this.append = ')$).*'; + val = ''; + } + return pos({ + type: 'not', + val: val + }); + }) + + /** + * Dot: "." + */ + + .capture('dot', function() { + var parsed = this.parsed; + var pos = this.position(); + var m = this.match(/^\.+/); + if (!m) return; + + var val = m[0]; + this.state.dot = val === '.' && (parsed === '' || parsed.slice(-1) === '/'); + + return pos({ + type: 'dot', + dotfiles: this.state.dot, + val: val + }); + }) + + /** + * Plus: "+" + */ + + .capture('plus', /^\+(?!\()/) + + /** + * Question mark: "?" + */ + + .capture('qmark', function() { + var parsed = this.parsed; + var pos = this.position(); + var m = this.match(/^\?+(?!\()/); + if (!m) return; + + this.state.metachar = true; + this.state.qmark = true; + + return pos({ + type: 'qmark', + parsed: parsed, + val: m[0] + }); + }) + + /** + * Globstar: "**" + */ + + .capture('globstar', function() { + var parsed = this.parsed; + var pos = this.position(); + var m = this.match(/^\*{2}(?![*(])(?=[,)/]|$)/); + if (!m) return; + + var type = opts.noglobstar !== true ? 'globstar' : 'star'; + var node = pos({type: type, parsed: parsed}); + this.state.metachar = true; + + while (this.input.slice(0, 4) === '/**/') { + this.input = this.input.slice(3); + } + + node.isInside = { + brace: this.isInside('brace'), + paren: this.isInside('paren') + }; + + if (type === 'globstar') { + this.state.globstar = true; + node.val = '**'; + + } else { + this.state.star = true; + node.val = '*'; + } + + return node; + }) + + /** + * Star: "*" + */ + + .capture('star', function() { + var pos = this.position(); + var starRe = /^(?:\*(?![*(])|[*]{3,}(?!\()|[*]{2}(?![(/]|$)|\*(?=\*\())/; + var m = this.match(starRe); + if (!m) return; + + this.state.metachar = true; + this.state.star = true; + return pos({ + type: 'star', + val: m[0] + }); + }) + + /** + * Slash: "/" + */ + + .capture('slash', function() { + var pos = this.position(); + var m = this.match(/^\//); + if (!m) return; + + this.state.slashes++; + return pos({ + type: 'slash', + val: m[0] + }); + }) + + /** + * Backslash: "\\" + */ + + .capture('backslash', function() { + var pos = this.position(); + var m = this.match(/^\\(?![*+?(){}[\]'"])/); + if (!m) return; + + var val = m[0]; + + if (this.isInside('bracket')) { + val = '\\'; + } else if (val.length > 1) { + val = '\\\\'; + } + + return pos({ + type: 'backslash', + val: val + }); + }) + + /** + * Square: "[.]" + */ + + .capture('square', function() { + if (this.isInside('bracket')) return; + var pos = this.position(); + var m = this.match(/^\[([^!^\\])\]/); + if (!m) return; + + return pos({ + type: 'square', + val: m[1] + }); + }) + + /** + * Brackets: "[...]" (basic, this can be overridden by other parsers) + */ + + .capture('bracket', function() { + var pos = this.position(); + var m = this.match(/^(?:\[([!^]?)([^\]]+|\]-)(\]|[^*+?]+)|\[)/); + if (!m) return; + + var val = m[0]; + var negated = m[1] ? '^' : ''; + var inner = (m[2] || '').replace(/\\\\+/, '\\\\'); + var close = m[3] || ''; + + if (m[2] && inner.length < m[2].length) { + val = val.replace(/\\\\+/, '\\\\'); + } + + var esc = this.input.slice(0, 2); + if (inner === '' && esc === '\\]') { + inner += esc; + this.consume(2); + + var str = this.input; + var idx = -1; + var ch; + + while ((ch = str[++idx])) { + this.consume(1); + if (ch === ']') { + close = ch; + break; + } + inner += ch; + } + } + + return pos({ + type: 'bracket', + val: val, + escaped: close !== ']', + negated: negated, + inner: inner, + close: close + }); + }) + + /** + * Text + */ + + .capture('text', function() { + if (this.isInside('bracket')) return; + var pos = this.position(); + var m = this.match(not); + if (!m || !m[0]) return; + + return pos({ + type: 'text', + val: m[0] + }); + }); + + /** + * Allow custom parsers to be passed on options + */ + + if (options && typeof options.parsers === 'function') { + options.parsers(nanomatch.parser); + } +}; + +/** + * Advance to the next non-escaped character + */ + +function advanceTo(input, endChar) { + var ch = input.charAt(0); + var tok = { len: 1, val: '', esc: '' }; + var idx = 0; + + function advance() { + if (ch !== '\\') { + tok.esc += '\\' + ch; + tok.val += ch; + } + + ch = input.charAt(++idx); + tok.len++; + + if (ch === '\\') { + advance(); + advance(); + } + } + + while (ch && ch !== endChar) { + advance(); + } + return tok; +} + +/** + * Create text regex + */ + +function createTextRegex(pattern) { + if (cached) return cached; + var opts = {contains: true, strictClose: false}; + var not = regexNot.create(pattern, opts); + var re = toRegex('^(?:[*]\\((?=.)|' + not + ')', opts); + return (cached = re); +} + +/** + * Expose negation string + */ + +module.exports.not = NOT_REGEX; + + +/***/ }), +/* 847 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/*! + * is-odd + * + * Copyright (c) 2015-2017, Jon Schlinkert. + * Released under the MIT License. + */ + + + +var isNumber = __webpack_require__(848); + +module.exports = function isOdd(i) { + if (!isNumber(i)) { + throw new TypeError('is-odd expects a number.'); + } + if (Number(i) !== Math.floor(i)) { + throw new RangeError('is-odd expects an integer.'); + } + return !!(~~i & 1); +}; + + +/***/ }), +/* 848 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/*! + * is-number + * + * Copyright (c) 2014-2017, Jon Schlinkert. + * Released under the MIT License. + */ + + + +module.exports = function isNumber(num) { + var type = typeof num; + + if (type === 'string' || num instanceof String) { + // an empty string would be coerced to true with the below logic + if (!num.trim()) return false; + } else if (type !== 'number' && !(num instanceof Number)) { + return false; + } + + return (num - num + 1) >= 0; +}; + + +/***/ }), +/* 849 */ +/***/ (function(module, exports, __webpack_require__) { + +module.exports = new (__webpack_require__(850))(); + + +/***/ }), +/* 850 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/*! + * fragment-cache + * + * Copyright (c) 2016-2017, Jon Schlinkert. + * Released under the MIT License. + */ + + + +var MapCache = __webpack_require__(828); + +/** + * Create a new `FragmentCache` with an optional object to use for `caches`. + * + * ```js + * var fragment = new FragmentCache(); + * ``` + * @name FragmentCache + * @param {String} `cacheName` + * @return {Object} Returns the [map-cache][] instance. + * @api public + */ + +function FragmentCache(caches) { + this.caches = caches || {}; +} + +/** + * Prototype + */ + +FragmentCache.prototype = { + + /** + * Get cache `name` from the `fragment.caches` object. Creates a new + * `MapCache` if it doesn't already exist. + * + * ```js + * var cache = fragment.cache('files'); + * console.log(fragment.caches.hasOwnProperty('files')); + * //=> true + * ``` + * @name .cache + * @param {String} `cacheName` + * @return {Object} Returns the [map-cache][] instance. + * @api public + */ + + cache: function(cacheName) { + return this.caches[cacheName] || (this.caches[cacheName] = new MapCache()); + }, + + /** + * Set a value for property `key` on cache `name` + * + * ```js + * fragment.set('files', 'somefile.js', new File({path: 'somefile.js'})); + * ``` + * @name .set + * @param {String} `name` + * @param {String} `key` Property name to set + * @param {any} `val` The value of `key` + * @return {Object} The cache instance for chaining + * @api public + */ + + set: function(cacheName, key, val) { + var cache = this.cache(cacheName); + cache.set(key, val); + return cache; + }, + + /** + * Returns true if a non-undefined value is set for `key` on fragment cache `name`. + * + * ```js + * var cache = fragment.cache('files'); + * cache.set('somefile.js'); + * + * console.log(cache.has('somefile.js')); + * //=> true + * + * console.log(cache.has('some-other-file.js')); + * //=> false + * ``` + * @name .has + * @param {String} `name` Cache name + * @param {String} `key` Optionally specify a property to check for on cache `name` + * @return {Boolean} + * @api public + */ + + has: function(cacheName, key) { + return typeof this.get(cacheName, key) !== 'undefined'; + }, + + /** + * Get `name`, or if specified, the value of `key`. Invokes the [cache]() method, + * so that cache `name` will be created it doesn't already exist. If `key` is not passed, + * the entire cache (`name`) is returned. + * + * ```js + * var Vinyl = require('vinyl'); + * var cache = fragment.cache('files'); + * cache.set('somefile.js', new Vinyl({path: 'somefile.js'})); + * console.log(cache.get('somefile.js')); + * //=> + * ``` + * @name .get + * @param {String} `name` + * @return {Object} Returns cache `name`, or the value of `key` if specified + * @api public + */ + + get: function(name, key) { + var cache = this.cache(name); + if (typeof key === 'string') { + return cache.get(key); + } + return cache; + } +}; + +/** + * Expose `FragmentCache` + */ + +exports = module.exports = FragmentCache; + + +/***/ }), +/* 851 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var utils = module.exports; +var path = __webpack_require__(16); + +/** + * Module dependencies + */ + +var isWindows = __webpack_require__(852)(); +var Snapdragon = __webpack_require__(768); +utils.define = __webpack_require__(853); +utils.diff = __webpack_require__(854); +utils.extend = __webpack_require__(843); +utils.pick = __webpack_require__(855); +utils.typeOf = __webpack_require__(856); +utils.unique = __webpack_require__(741); + +/** + * Returns true if the given value is effectively an empty string + */ + +utils.isEmptyString = function(val) { + return String(val) === '' || String(val) === './'; +}; + +/** + * Returns true if the platform is windows, or `path.sep` is `\\`. + * This is defined as a function to allow `path.sep` to be set in unit tests, + * or by the user, if there is a reason to do so. + * @return {Boolean} + */ + +utils.isWindows = function() { + return path.sep === '\\' || isWindows === true; +}; + +/** + * Return the last element from an array + */ + +utils.last = function(arr, n) { + return arr[arr.length - (n || 1)]; +}; + +/** + * Get the `Snapdragon` instance to use + */ + +utils.instantiate = function(ast, options) { + var snapdragon; + // if an instance was created by `.parse`, use that instance + if (utils.typeOf(ast) === 'object' && ast.snapdragon) { + snapdragon = ast.snapdragon; + // if the user supplies an instance on options, use that instance + } else if (utils.typeOf(options) === 'object' && options.snapdragon) { + snapdragon = options.snapdragon; + // create a new instance + } else { + snapdragon = new Snapdragon(options); + } + + utils.define(snapdragon, 'parse', function(str, options) { + var parsed = Snapdragon.prototype.parse.call(this, str, options); + parsed.input = str; + + // escape unmatched brace/bracket/parens + var last = this.parser.stack.pop(); + if (last && this.options.strictErrors !== true) { + var open = last.nodes[0]; + var inner = last.nodes[1]; + if (last.type === 'bracket') { + if (inner.val.charAt(0) === '[') { + inner.val = '\\' + inner.val; + } + + } else { + open.val = '\\' + open.val; + var sibling = open.parent.nodes[1]; + if (sibling.type === 'star') { + sibling.loose = true; + } + } + } + + // add non-enumerable parser reference + utils.define(parsed, 'parser', this.parser); + return parsed; + }); + + return snapdragon; +}; + +/** + * Create the key to use for memoization. The key is generated + * by iterating over the options and concatenating key-value pairs + * to the pattern string. + */ + +utils.createKey = function(pattern, options) { + if (typeof options === 'undefined') { + return pattern; + } + var key = pattern; + for (var prop in options) { + if (options.hasOwnProperty(prop)) { + key += ';' + prop + '=' + String(options[prop]); + } + } + return key; +}; + +/** + * Cast `val` to an array + * @return {Array} + */ + +utils.arrayify = function(val) { + if (typeof val === 'string') return [val]; + return val ? (Array.isArray(val) ? val : [val]) : []; +}; + +/** + * Return true if `val` is a non-empty string + */ + +utils.isString = function(val) { + return typeof val === 'string'; +}; + +/** + * Return true if `val` is a non-empty string + */ + +utils.isRegex = function(val) { + return utils.typeOf(val) === 'regexp'; +}; + +/** + * Return true if `val` is a non-empty string + */ + +utils.isObject = function(val) { + return utils.typeOf(val) === 'object'; +}; + +/** + * Escape regex characters in the given string + */ + +utils.escapeRegex = function(str) { + return str.replace(/[-[\]{}()^$|*+?.\\/\s]/g, '\\$&'); +}; + +/** + * Combines duplicate characters in the provided `input` string. + * @param {String} `input` + * @returns {String} + */ + +utils.combineDupes = function(input, patterns) { + patterns = utils.arrayify(patterns).join('|').split('|'); + patterns = patterns.map(function(s) { + return s.replace(/\\?([+*\\/])/g, '\\$1'); + }); + var substr = patterns.join('|'); + var regex = new RegExp('(' + substr + ')(?=\\1)', 'g'); + return input.replace(regex, ''); +}; + +/** + * Returns true if the given `str` has special characters + */ + +utils.hasSpecialChars = function(str) { + return /(?:(?:(^|\/)[!.])|[*?+()|[\]{}]|[+@]\()/.test(str); +}; + +/** + * Normalize slashes in the given filepath. + * + * @param {String} `filepath` + * @return {String} + */ + +utils.toPosixPath = function(str) { + return str.replace(/\\+/g, '/'); +}; + +/** + * Strip backslashes before special characters in a string. + * + * @param {String} `str` + * @return {String} + */ + +utils.unescape = function(str) { + return utils.toPosixPath(str.replace(/\\(?=[*+?!.])/g, '')); +}; + +/** + * Strip the drive letter from a windows filepath + * @param {String} `fp` + * @return {String} + */ + +utils.stripDrive = function(fp) { + return utils.isWindows() ? fp.replace(/^[a-z]:[\\/]+?/i, '/') : fp; +}; + +/** + * Strip the prefix from a filepath + * @param {String} `fp` + * @return {String} + */ + +utils.stripPrefix = function(str) { + if (str.charAt(0) === '.' && (str.charAt(1) === '/' || str.charAt(1) === '\\')) { + return str.slice(2); + } + return str; +}; + +/** + * Returns true if `str` is a common character that doesn't need + * to be processed to be used for matching. + * @param {String} `str` + * @return {Boolean} + */ + +utils.isSimpleChar = function(str) { + return str.trim() === '' || str === '.'; +}; + +/** + * Returns true if the given str is an escaped or + * unescaped path character + */ + +utils.isSlash = function(str) { + return str === '/' || str === '\\/' || str === '\\' || str === '\\\\'; +}; + +/** + * Returns a function that returns true if the given + * pattern matches or contains a `filepath` + * + * @param {String} `pattern` + * @return {Function} + */ + +utils.matchPath = function(pattern, options) { + return (options && options.contains) + ? utils.containsPattern(pattern, options) + : utils.equalsPattern(pattern, options); +}; + +/** + * Returns true if the given (original) filepath or unixified path are equal + * to the given pattern. + */ + +utils._equals = function(filepath, unixPath, pattern) { + return pattern === filepath || pattern === unixPath; +}; + +/** + * Returns true if the given (original) filepath or unixified path contain + * the given pattern. + */ + +utils._contains = function(filepath, unixPath, pattern) { + return filepath.indexOf(pattern) !== -1 || unixPath.indexOf(pattern) !== -1; +}; + +/** + * Returns a function that returns true if the given + * pattern is the same as a given `filepath` + * + * @param {String} `pattern` + * @return {Function} + */ + +utils.equalsPattern = function(pattern, options) { + var unixify = utils.unixify(options); + options = options || {}; + + return function fn(filepath) { + var equal = utils._equals(filepath, unixify(filepath), pattern); + if (equal === true || options.nocase !== true) { + return equal; + } + var lower = filepath.toLowerCase(); + return utils._equals(lower, unixify(lower), pattern); + }; +}; + +/** + * Returns a function that returns true if the given + * pattern contains a `filepath` + * + * @param {String} `pattern` + * @return {Function} + */ + +utils.containsPattern = function(pattern, options) { + var unixify = utils.unixify(options); + options = options || {}; + + return function(filepath) { + var contains = utils._contains(filepath, unixify(filepath), pattern); + if (contains === true || options.nocase !== true) { + return contains; + } + var lower = filepath.toLowerCase(); + return utils._contains(lower, unixify(lower), pattern); + }; +}; + +/** + * Returns a function that returns true if the given + * regex matches the `filename` of a file path. + * + * @param {RegExp} `re` Matching regex + * @return {Function} + */ + +utils.matchBasename = function(re) { + return function(filepath) { + return re.test(filepath) || re.test(path.basename(filepath)); + }; +}; + +/** + * Returns the given value unchanced. + * @return {any} + */ + +utils.identity = function(val) { + return val; +}; + +/** + * Determines the filepath to return based on the provided options. + * @return {any} + */ + +utils.value = function(str, unixify, options) { + if (options && options.unixify === false) { + return str; + } + if (options && typeof options.unixify === 'function') { + return options.unixify(str); + } + return unixify(str); +}; + +/** + * Returns a function that normalizes slashes in a string to forward + * slashes, strips `./` from beginning of paths, and optionally unescapes + * special characters. + * @return {Function} + */ + +utils.unixify = function(options) { + var opts = options || {}; + return function(filepath) { + if (opts.stripPrefix !== false) { + filepath = utils.stripPrefix(filepath); + } + if (opts.unescape === true) { + filepath = utils.unescape(filepath); + } + if (opts.unixify === true || utils.isWindows()) { + filepath = utils.toPosixPath(filepath); + } + return filepath; + }; +}; + + +/***/ }), +/* 852 */ +/***/ (function(module, exports, __webpack_require__) { + +var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! + * is-windows + * + * Copyright © 2015-2018, Jon Schlinkert. + * Released under the MIT License. + */ + +(function(factory) { + if (exports && typeof exports === 'object' && typeof module !== 'undefined') { + module.exports = factory(); + } else if (true) { + !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), + __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? + (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), + __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); + } else {} +})(function() { + 'use strict'; + return function isWindows() { + return process && (process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE)); + }; +}); + + +/***/ }), +/* 853 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/*! + * define-property + * + * Copyright (c) 2015-2018, Jon Schlinkert. + * Released under the MIT License. + */ + + + +var isobject = __webpack_require__(748); +var isDescriptor = __webpack_require__(760); +var define = (typeof Reflect !== 'undefined' && Reflect.defineProperty) + ? Reflect.defineProperty + : Object.defineProperty; + +module.exports = function defineProperty(obj, key, val) { + if (!isobject(obj) && typeof obj !== 'function' && !Array.isArray(obj)) { + throw new TypeError('expected an object, function, or array'); + } + + if (typeof key !== 'string') { + throw new TypeError('expected "key" to be a string'); + } + + if (isDescriptor(val)) { + define(obj, key, val); + return obj; + } + + define(obj, key, { + configurable: true, + enumerable: false, + writable: true, + value: val + }); + + return obj; +}; + + +/***/ }), +/* 854 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/*! + * arr-diff + * + * Copyright (c) 2014-2017, Jon Schlinkert. + * Released under the MIT License. + */ + + + +module.exports = function diff(arr/*, arrays*/) { + var len = arguments.length; + var idx = 0; + while (++idx < len) { + arr = diffArray(arr, arguments[idx]); + } + return arr; +}; + +function diffArray(one, two) { + if (!Array.isArray(two)) { + return one.slice(); + } + + var tlen = two.length + var olen = one.length; + var idx = -1; + var arr = []; + + while (++idx < olen) { + var ele = one[idx]; + + var hasEle = false; + for (var i = 0; i < tlen; i++) { + var val = two[i]; + + if (ele === val) { + hasEle = true; + break; + } + } + + if (hasEle === false) { + arr.push(ele); + } + } + return arr; +} + + +/***/ }), +/* 855 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/*! + * object.pick + * + * Copyright (c) 2014-2015 Jon Schlinkert, contributors. + * Licensed under the MIT License + */ + + + +var isObject = __webpack_require__(748); + +module.exports = function pick(obj, keys) { + if (!isObject(obj) && typeof obj !== 'function') { + return {}; + } + + var res = {}; + if (typeof keys === 'string') { + if (keys in obj) { + res[keys] = obj[keys]; + } + return res; + } + + var len = keys.length; + var idx = -1; + + while (++idx < len) { + var key = keys[idx]; + if (key in obj) { + res[key] = obj[key]; + } + } + return res; +}; + + +/***/ }), +/* 856 */ +/***/ (function(module, exports) { + +var toString = Object.prototype.toString; + +module.exports = function kindOf(val) { + if (val === void 0) return 'undefined'; + if (val === null) return 'null'; + + var type = typeof val; + if (type === 'boolean') return 'boolean'; + if (type === 'string') return 'string'; + if (type === 'number') return 'number'; + if (type === 'symbol') return 'symbol'; + if (type === 'function') { + return isGeneratorFn(val) ? 'generatorfunction' : 'function'; + } + + if (isArray(val)) return 'array'; + if (isBuffer(val)) return 'buffer'; + if (isArguments(val)) return 'arguments'; + if (isDate(val)) return 'date'; + if (isError(val)) return 'error'; + if (isRegexp(val)) return 'regexp'; + + switch (ctorName(val)) { + case 'Symbol': return 'symbol'; + case 'Promise': return 'promise'; + + // Set, Map, WeakSet, WeakMap + case 'WeakMap': return 'weakmap'; + case 'WeakSet': return 'weakset'; + case 'Map': return 'map'; + case 'Set': return 'set'; + + // 8-bit typed arrays + case 'Int8Array': return 'int8array'; + case 'Uint8Array': return 'uint8array'; + case 'Uint8ClampedArray': return 'uint8clampedarray'; + + // 16-bit typed arrays + case 'Int16Array': return 'int16array'; + case 'Uint16Array': return 'uint16array'; + + // 32-bit typed arrays + case 'Int32Array': return 'int32array'; + case 'Uint32Array': return 'uint32array'; + case 'Float32Array': return 'float32array'; + case 'Float64Array': return 'float64array'; + } + + if (isGeneratorObj(val)) { + return 'generator'; + } + + // Non-plain objects + type = toString.call(val); + switch (type) { + case '[object Object]': return 'object'; + // iterators + case '[object Map Iterator]': return 'mapiterator'; + case '[object Set Iterator]': return 'setiterator'; + case '[object String Iterator]': return 'stringiterator'; + case '[object Array Iterator]': return 'arrayiterator'; + } + + // other + return type.slice(8, -1).toLowerCase().replace(/\s/g, ''); +}; + +function ctorName(val) { + return typeof val.constructor === 'function' ? val.constructor.name : null; +} + +function isArray(val) { + if (Array.isArray) return Array.isArray(val); + return val instanceof Array; +} + +function isError(val) { + return val instanceof Error || (typeof val.message === 'string' && val.constructor && typeof val.constructor.stackTraceLimit === 'number'); +} + +function isDate(val) { + if (val instanceof Date) return true; + return typeof val.toDateString === 'function' + && typeof val.getDate === 'function' + && typeof val.setDate === 'function'; +} + +function isRegexp(val) { + if (val instanceof RegExp) return true; + return typeof val.flags === 'string' + && typeof val.ignoreCase === 'boolean' + && typeof val.multiline === 'boolean' + && typeof val.global === 'boolean'; +} + +function isGeneratorFn(name, val) { + return ctorName(name) === 'GeneratorFunction'; +} + +function isGeneratorObj(val) { + return typeof val.throw === 'function' + && typeof val.return === 'function' + && typeof val.next === 'function'; +} + +function isArguments(val) { + try { + if (typeof val.length === 'number' && typeof val.callee === 'function') { + return true; + } + } catch (err) { + if (err.message.indexOf('callee') !== -1) { + return true; + } + } + return false; +} + +/** + * If you need to support Safari 5-7 (8-10 yr-old browser), + * take a look at https://github.com/feross/is-buffer + */ + +function isBuffer(val) { + if (val.constructor && typeof val.constructor.isBuffer === 'function') { + return val.constructor.isBuffer(val); + } + return false; +} + + +/***/ }), +/* 857 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/** + * Module dependencies + */ + +var extend = __webpack_require__(738); +var unique = __webpack_require__(741); +var toRegex = __webpack_require__(729); + +/** + * Local dependencies + */ + +var compilers = __webpack_require__(858); +var parsers = __webpack_require__(869); +var Extglob = __webpack_require__(872); +var utils = __webpack_require__(871); +var MAX_LENGTH = 1024 * 64; + +/** + * Convert the given `extglob` pattern into a regex-compatible string. Returns + * an object with the compiled result and the parsed AST. + * + * ```js + * var extglob = require('extglob'); + * console.log(extglob('*.!(*a)')); + * //=> '(?!\\.)[^/]*?\\.(?!(?!\\.)[^/]*?a\\b).*?' + * ``` + * @param {String} `pattern` + * @param {Object} `options` + * @return {String} + * @api public + */ + +function extglob(pattern, options) { + return extglob.create(pattern, options).output; +} + +/** + * Takes an array of strings and an extglob pattern and returns a new + * array that contains only the strings that match the pattern. + * + * ```js + * var extglob = require('extglob'); + * console.log(extglob.match(['a.a', 'a.b', 'a.c'], '*.!(*a)')); + * //=> ['a.b', 'a.c'] + * ``` + * @param {Array} `list` Array of strings to match + * @param {String} `pattern` Extglob pattern + * @param {Object} `options` + * @return {Array} Returns an array of matches + * @api public + */ + +extglob.match = function(list, pattern, options) { + if (typeof pattern !== 'string') { + throw new TypeError('expected pattern to be a string'); + } + + list = utils.arrayify(list); + var isMatch = extglob.matcher(pattern, options); + var len = list.length; + var idx = -1; + var matches = []; + + while (++idx < len) { + var ele = list[idx]; + + if (isMatch(ele)) { + matches.push(ele); + } + } + + // if no options were passed, uniquify results and return + if (typeof options === 'undefined') { + return unique(matches); + } + + if (matches.length === 0) { + if (options.failglob === true) { + throw new Error('no matches found for "' + pattern + '"'); + } + if (options.nonull === true || options.nullglob === true) { + return [pattern.split('\\').join('')]; + } + } + + return options.nodupes !== false ? unique(matches) : matches; +}; + +/** + * Returns true if the specified `string` matches the given + * extglob `pattern`. + * + * ```js + * var extglob = require('extglob'); + * + * console.log(extglob.isMatch('a.a', '*.!(*a)')); + * //=> false + * console.log(extglob.isMatch('a.b', '*.!(*a)')); + * //=> true + * ``` + * @param {String} `string` String to match + * @param {String} `pattern` Extglob pattern + * @param {String} `options` + * @return {Boolean} + * @api public + */ + +extglob.isMatch = function(str, pattern, options) { + if (typeof pattern !== 'string') { + throw new TypeError('expected pattern to be a string'); + } + + if (typeof str !== 'string') { + throw new TypeError('expected a string'); + } + + if (pattern === str) { + return true; + } + + if (pattern === '' || pattern === ' ' || pattern === '.') { + return pattern === str; + } + + var isMatch = utils.memoize('isMatch', pattern, options, extglob.matcher); + return isMatch(str); +}; + +/** + * Returns true if the given `string` contains the given pattern. Similar to `.isMatch` but + * the pattern can match any part of the string. + * + * ```js + * var extglob = require('extglob'); + * console.log(extglob.contains('aa/bb/cc', '*b')); + * //=> true + * console.log(extglob.contains('aa/bb/cc', '*d')); + * //=> false + * ``` + * @param {String} `str` The string to match. + * @param {String} `pattern` Glob pattern to use for matching. + * @param {Object} `options` + * @return {Boolean} Returns true if the patter matches any part of `str`. + * @api public + */ + +extglob.contains = function(str, pattern, options) { + if (typeof str !== 'string') { + throw new TypeError('expected a string'); + } + + if (pattern === '' || pattern === ' ' || pattern === '.') { + return pattern === str; + } + + var opts = extend({}, options, {contains: true}); + opts.strictClose = false; + opts.strictOpen = false; + return extglob.isMatch(str, pattern, opts); +}; + +/** + * Takes an extglob pattern and returns a matcher function. The returned + * function takes the string to match as its only argument. + * + * ```js + * var extglob = require('extglob'); + * var isMatch = extglob.matcher('*.!(*a)'); + * + * console.log(isMatch('a.a')); + * //=> false + * console.log(isMatch('a.b')); + * //=> true + * ``` + * @param {String} `pattern` Extglob pattern + * @param {String} `options` + * @return {Boolean} + * @api public + */ + +extglob.matcher = function(pattern, options) { + if (typeof pattern !== 'string') { + throw new TypeError('expected pattern to be a string'); + } + + function matcher() { + var re = extglob.makeRe(pattern, options); + return function(str) { + return re.test(str); + }; + } + + return utils.memoize('matcher', pattern, options, matcher); +}; + +/** + * Convert the given `extglob` pattern into a regex-compatible string. Returns + * an object with the compiled result and the parsed AST. + * + * ```js + * var extglob = require('extglob'); + * console.log(extglob.create('*.!(*a)').output); + * //=> '(?!\\.)[^/]*?\\.(?!(?!\\.)[^/]*?a\\b).*?' + * ``` + * @param {String} `str` + * @param {Object} `options` + * @return {String} + * @api public + */ + +extglob.create = function(pattern, options) { + if (typeof pattern !== 'string') { + throw new TypeError('expected pattern to be a string'); + } + + function create() { + var ext = new Extglob(options); + var ast = ext.parse(pattern, options); + return ext.compile(ast, options); + } + + return utils.memoize('create', pattern, options, create); +}; + +/** + * Returns an array of matches captured by `pattern` in `string`, or `null` + * if the pattern did not match. + * + * ```js + * var extglob = require('extglob'); + * extglob.capture(pattern, string[, options]); + * + * console.log(extglob.capture('test/*.js', 'test/foo.js')); + * //=> ['foo'] + * console.log(extglob.capture('test/*.js', 'foo/bar.css')); + * //=> null + * ``` + * @param {String} `pattern` Glob pattern to use for matching. + * @param {String} `string` String to match + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Boolean} Returns an array of captures if the string matches the glob pattern, otherwise `null`. + * @api public + */ + +extglob.capture = function(pattern, str, options) { + var re = extglob.makeRe(pattern, extend({capture: true}, options)); + + function match() { + return function(string) { + var match = re.exec(string); + if (!match) { + return null; + } + + return match.slice(1); + }; + } + + var capture = utils.memoize('capture', pattern, options, match); + return capture(str); +}; + +/** + * Create a regular expression from the given `pattern` and `options`. + * + * ```js + * var extglob = require('extglob'); + * var re = extglob.makeRe('*.!(*a)'); + * console.log(re); + * //=> /^[^\/]*?\.(?![^\/]*?a)[^\/]*?$/ + * ``` + * @param {String} `pattern` The pattern to convert to regex. + * @param {Object} `options` + * @return {RegExp} + * @api public + */ + +extglob.makeRe = function(pattern, options) { + if (pattern instanceof RegExp) { + return pattern; + } + + if (typeof pattern !== 'string') { + throw new TypeError('expected pattern to be a string'); + } + + if (pattern.length > MAX_LENGTH) { + throw new Error('expected pattern to be less than ' + MAX_LENGTH + ' characters'); + } + + function makeRe() { + var opts = extend({strictErrors: false}, options); + if (opts.strictErrors === true) opts.strict = true; + var res = extglob.create(pattern, opts); + return toRegex(res.output, opts); + } + + var regex = utils.memoize('makeRe', pattern, options, makeRe); + if (regex.source.length > MAX_LENGTH) { + throw new SyntaxError('potentially malicious regex detected'); + } + + return regex; +}; + +/** + * Cache + */ + +extglob.cache = utils.cache; +extglob.clearCache = function() { + extglob.cache.__data__ = {}; +}; + +/** + * Expose `Extglob` constructor, parsers and compilers + */ + +extglob.Extglob = Extglob; +extglob.compilers = compilers; +extglob.parsers = parsers; + +/** + * Expose `extglob` + * @type {Function} + */ + +module.exports = extglob; + + +/***/ }), +/* 858 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var brackets = __webpack_require__(859); + +/** + * Extglob compilers + */ + +module.exports = function(extglob) { + function star() { + if (typeof extglob.options.star === 'function') { + return extglob.options.star.apply(this, arguments); + } + if (typeof extglob.options.star === 'string') { + return extglob.options.star; + } + return '.*?'; + } + + /** + * Use `expand-brackets` compilers + */ + + extglob.use(brackets.compilers); + extglob.compiler + + /** + * Escaped: "\\*" + */ + + .set('escape', function(node) { + return this.emit(node.val, node); + }) + + /** + * Dot: "." + */ + + .set('dot', function(node) { + return this.emit('\\' + node.val, node); + }) + + /** + * Question mark: "?" + */ + + .set('qmark', function(node) { + var val = '[^\\\\/.]'; + var prev = this.prev(); + + if (node.parsed.slice(-1) === '(') { + var ch = node.rest.charAt(0); + if (ch !== '!' && ch !== '=' && ch !== ':') { + return this.emit(val, node); + } + return this.emit(node.val, node); + } + + if (prev.type === 'text' && prev.val) { + return this.emit(val, node); + } + + if (node.val.length > 1) { + val += '{' + node.val.length + '}'; + } + return this.emit(val, node); + }) + + /** + * Plus: "+" + */ + + .set('plus', function(node) { + var prev = node.parsed.slice(-1); + if (prev === ']' || prev === ')') { + return this.emit(node.val, node); + } + var ch = this.output.slice(-1); + if (!this.output || (/[?*+]/.test(ch) && node.parent.type !== 'bracket')) { + return this.emit('\\+', node); + } + if (/\w/.test(ch) && !node.inside) { + return this.emit('+\\+?', node); + } + return this.emit('+', node); + }) + + /** + * Star: "*" + */ + + .set('star', function(node) { + var prev = this.prev(); + var prefix = prev.type !== 'text' && prev.type !== 'escape' + ? '(?!\\.)' + : ''; + + return this.emit(prefix + star.call(this, node), node); + }) + + /** + * Parens + */ + + .set('paren', function(node) { + return this.mapVisit(node.nodes); + }) + .set('paren.open', function(node) { + var capture = this.options.capture ? '(' : ''; + + switch (node.parent.prefix) { + case '!': + case '^': + return this.emit(capture + '(?:(?!(?:', node); + case '*': + case '+': + case '?': + case '@': + return this.emit(capture + '(?:', node); + default: { + var val = node.val; + if (this.options.bash === true) { + val = '\\' + val; + } else if (!this.options.capture && val === '(' && node.parent.rest[0] !== '?') { + val += '?:'; + } + + return this.emit(val, node); + } + } + }) + .set('paren.close', function(node) { + var capture = this.options.capture ? ')' : ''; + + switch (node.prefix) { + case '!': + case '^': + var prefix = /^(\)|$)/.test(node.rest) ? '$' : ''; + var str = star.call(this, node); + + // if the extglob has a slash explicitly defined, we know the user wants + // to match slashes, so we need to ensure the "star" regex allows for it + if (node.parent.hasSlash && !this.options.star && this.options.slash !== false) { + str = '.*?'; + } + + return this.emit(prefix + ('))' + str + ')') + capture, node); + case '*': + case '+': + case '?': + return this.emit(')' + node.prefix + capture, node); + case '@': + return this.emit(')' + capture, node); + default: { + var val = (this.options.bash === true ? '\\' : '') + ')'; + return this.emit(val, node); + } + } + }) + + /** + * Text + */ + + .set('text', function(node) { + var val = node.val.replace(/[\[\]]/g, '\\$&'); + return this.emit(val, node); + }); +}; + + +/***/ }), +/* 859 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/** + * Local dependencies + */ + +var compilers = __webpack_require__(860); +var parsers = __webpack_require__(862); + +/** + * Module dependencies + */ + +var debug = __webpack_require__(864)('expand-brackets'); +var extend = __webpack_require__(738); +var Snapdragon = __webpack_require__(768); +var toRegex = __webpack_require__(729); + +/** + * Parses the given POSIX character class `pattern` and returns a + * string that can be used for creating regular expressions for matching. + * + * @param {String} `pattern` + * @param {Object} `options` + * @return {Object} + * @api public + */ + +function brackets(pattern, options) { + debug('initializing from <%s>', __filename); + var res = brackets.create(pattern, options); + return res.output; +} + +/** + * Takes an array of strings and a POSIX character class pattern, and returns a new + * array with only the strings that matched the pattern. + * + * ```js + * var brackets = require('expand-brackets'); + * console.log(brackets.match(['1', 'a', 'ab'], '[[:alpha:]]')); + * //=> ['a'] + * + * console.log(brackets.match(['1', 'a', 'ab'], '[[:alpha:]]+')); + * //=> ['a', 'ab'] + * ``` + * @param {Array} `arr` Array of strings to match + * @param {String} `pattern` POSIX character class pattern(s) + * @param {Object} `options` + * @return {Array} + * @api public + */ + +brackets.match = function(arr, pattern, options) { + arr = [].concat(arr); + var opts = extend({}, options); + var isMatch = brackets.matcher(pattern, opts); + var len = arr.length; + var idx = -1; + var res = []; + + while (++idx < len) { + var ele = arr[idx]; + if (isMatch(ele)) { + res.push(ele); + } + } + + if (res.length === 0) { + if (opts.failglob === true) { + throw new Error('no matches found for "' + pattern + '"'); + } + + if (opts.nonull === true || opts.nullglob === true) { + return [pattern.split('\\').join('')]; + } + } + return res; +}; + +/** + * Returns true if the specified `string` matches the given + * brackets `pattern`. + * + * ```js + * var brackets = require('expand-brackets'); + * + * console.log(brackets.isMatch('a.a', '[[:alpha:]].[[:alpha:]]')); + * //=> true + * console.log(brackets.isMatch('1.2', '[[:alpha:]].[[:alpha:]]')); + * //=> false + * ``` + * @param {String} `string` String to match + * @param {String} `pattern` Poxis pattern + * @param {String} `options` + * @return {Boolean} + * @api public + */ + +brackets.isMatch = function(str, pattern, options) { + return brackets.matcher(pattern, options)(str); +}; + +/** + * Takes a POSIX character class pattern and returns a matcher function. The returned + * function takes the string to match as its only argument. + * + * ```js + * var brackets = require('expand-brackets'); + * var isMatch = brackets.matcher('[[:lower:]].[[:upper:]]'); + * + * console.log(isMatch('a.a')); + * //=> false + * console.log(isMatch('a.A')); + * //=> true + * ``` + * @param {String} `pattern` Poxis pattern + * @param {String} `options` + * @return {Boolean} + * @api public + */ + +brackets.matcher = function(pattern, options) { + var re = brackets.makeRe(pattern, options); + return function(str) { + return re.test(str); + }; +}; + +/** + * Create a regular expression from the given `pattern`. + * + * ```js + * var brackets = require('expand-brackets'); + * var re = brackets.makeRe('[[:alpha:]]'); + * console.log(re); + * //=> /^(?:[a-zA-Z])$/ + * ``` + * @param {String} `pattern` The pattern to convert to regex. + * @param {Object} `options` + * @return {RegExp} + * @api public + */ + +brackets.makeRe = function(pattern, options) { + var res = brackets.create(pattern, options); + var opts = extend({strictErrors: false}, options); + return toRegex(res.output, opts); +}; + +/** + * Parses the given POSIX character class `pattern` and returns an object + * with the compiled `output` and optional source `map`. + * + * ```js + * var brackets = require('expand-brackets'); + * console.log(brackets('[[:alpha:]]')); + * // { options: { source: 'string' }, + * // input: '[[:alpha:]]', + * // state: {}, + * // compilers: + * // { eos: [Function], + * // noop: [Function], + * // bos: [Function], + * // not: [Function], + * // escape: [Function], + * // text: [Function], + * // posix: [Function], + * // bracket: [Function], + * // 'bracket.open': [Function], + * // 'bracket.inner': [Function], + * // 'bracket.literal': [Function], + * // 'bracket.close': [Function] }, + * // output: '[a-zA-Z]', + * // ast: + * // { type: 'root', + * // errors: [], + * // nodes: [ [Object], [Object], [Object] ] }, + * // parsingErrors: [] } + * ``` + * @param {String} `pattern` + * @param {Object} `options` + * @return {Object} + * @api public + */ + +brackets.create = function(pattern, options) { + var snapdragon = (options && options.snapdragon) || new Snapdragon(options); + compilers(snapdragon); + parsers(snapdragon); + + var ast = snapdragon.parse(pattern, options); + ast.input = pattern; + var res = snapdragon.compile(ast, options); + res.input = pattern; + return res; +}; + +/** + * Expose `brackets` constructor, parsers and compilers + */ + +brackets.compilers = compilers; +brackets.parsers = parsers; + +/** + * Expose `brackets` + * @type {Function} + */ + +module.exports = brackets; + + +/***/ }), +/* 860 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var posix = __webpack_require__(861); + +module.exports = function(brackets) { + brackets.compiler + + /** + * Escaped characters + */ + + .set('escape', function(node) { + return this.emit('\\' + node.val.replace(/^\\/, ''), node); + }) + + /** + * Text + */ + + .set('text', function(node) { + return this.emit(node.val.replace(/([{}])/g, '\\$1'), node); + }) + + /** + * POSIX character classes + */ + + .set('posix', function(node) { + if (node.val === '[::]') { + return this.emit('\\[::\\]', node); + } + + var val = posix[node.inner]; + if (typeof val === 'undefined') { + val = '[' + node.inner + ']'; + } + return this.emit(val, node); + }) + + /** + * Non-posix brackets + */ + + .set('bracket', function(node) { + return this.mapVisit(node.nodes); + }) + .set('bracket.open', function(node) { + return this.emit(node.val, node); + }) + .set('bracket.inner', function(node) { + var inner = node.val; + + if (inner === '[' || inner === ']') { + return this.emit('\\' + node.val, node); + } + if (inner === '^]') { + return this.emit('^\\]', node); + } + if (inner === '^') { + return this.emit('^', node); + } + + if (/-/.test(inner) && !/(\d-\d|\w-\w)/.test(inner)) { + inner = inner.split('-').join('\\-'); + } + + var isNegated = inner.charAt(0) === '^'; + // add slashes to negated brackets, per spec + if (isNegated && inner.indexOf('/') === -1) { + inner += '/'; + } + if (isNegated && inner.indexOf('.') === -1) { + inner += '.'; + } + + // don't unescape `0` (octal literal) + inner = inner.replace(/\\([1-9])/g, '$1'); + return this.emit(inner, node); + }) + .set('bracket.close', function(node) { + var val = node.val.replace(/^\\/, ''); + if (node.parent.escaped === true) { + return this.emit('\\' + val, node); + } + return this.emit(val, node); + }); +}; + + +/***/ }), +/* 861 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/** + * POSIX character classes + */ + +module.exports = { + alnum: 'a-zA-Z0-9', + alpha: 'a-zA-Z', + ascii: '\\x00-\\x7F', + blank: ' \\t', + cntrl: '\\x00-\\x1F\\x7F', + digit: '0-9', + graph: '\\x21-\\x7E', + lower: 'a-z', + print: '\\x20-\\x7E ', + punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~', + space: ' \\t\\r\\n\\v\\f', + upper: 'A-Z', + word: 'A-Za-z0-9_', + xdigit: 'A-Fa-f0-9' +}; + + +/***/ }), +/* 862 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var utils = __webpack_require__(863); +var define = __webpack_require__(730); + +/** + * Text regex + */ + +var TEXT_REGEX = '(\\[(?=.*\\])|\\])+'; +var not = utils.createRegex(TEXT_REGEX); + +/** + * Brackets parsers + */ + +function parsers(brackets) { + brackets.state = brackets.state || {}; + brackets.parser.sets.bracket = brackets.parser.sets.bracket || []; + brackets.parser + + .capture('escape', function() { + if (this.isInside('bracket')) return; + var pos = this.position(); + var m = this.match(/^\\(.)/); + if (!m) return; + + return pos({ + type: 'escape', + val: m[0] + }); + }) + + /** + * Text parser + */ + + .capture('text', function() { + if (this.isInside('bracket')) return; + var pos = this.position(); + var m = this.match(not); + if (!m || !m[0]) return; + + return pos({ + type: 'text', + val: m[0] + }); + }) + + /** + * POSIX character classes: "[[:alpha:][:digits:]]" + */ + + .capture('posix', function() { + var pos = this.position(); + var m = this.match(/^\[:(.*?):\](?=.*\])/); + if (!m) return; + + var inside = this.isInside('bracket'); + if (inside) { + brackets.posix++; + } + + return pos({ + type: 'posix', + insideBracket: inside, + inner: m[1], + val: m[0] + }); + }) + + /** + * Bracket (noop) + */ + + .capture('bracket', function() {}) + + /** + * Open: '[' + */ + + .capture('bracket.open', function() { + var parsed = this.parsed; + var pos = this.position(); + var m = this.match(/^\[(?=.*\])/); + if (!m) return; + + var prev = this.prev(); + var last = utils.last(prev.nodes); + + if (parsed.slice(-1) === '\\' && !this.isInside('bracket')) { + last.val = last.val.slice(0, last.val.length - 1); + return pos({ + type: 'escape', + val: m[0] + }); + } + + var open = pos({ + type: 'bracket.open', + val: m[0] + }); + + if (last.type === 'bracket.open' || this.isInside('bracket')) { + open.val = '\\' + open.val; + open.type = 'bracket.inner'; + open.escaped = true; + return open; + } + + var node = pos({ + type: 'bracket', + nodes: [open] + }); + + define(node, 'parent', prev); + define(open, 'parent', node); + this.push('bracket', node); + prev.nodes.push(node); + }) + + /** + * Bracket text + */ + + .capture('bracket.inner', function() { + if (!this.isInside('bracket')) return; + var pos = this.position(); + var m = this.match(not); + if (!m || !m[0]) return; + + var next = this.input.charAt(0); + var val = m[0]; + + var node = pos({ + type: 'bracket.inner', + val: val + }); + + if (val === '\\\\') { + return node; + } + + var first = val.charAt(0); + var last = val.slice(-1); + + if (first === '!') { + val = '^' + val.slice(1); + } + + if (last === '\\' || (val === '^' && next === ']')) { + val += this.input[0]; + this.consume(1); + } + + node.val = val; + return node; + }) + + /** + * Close: ']' + */ + + .capture('bracket.close', function() { + var parsed = this.parsed; + var pos = this.position(); + var m = this.match(/^\]/); + if (!m) return; + + var prev = this.prev(); + var last = utils.last(prev.nodes); + + if (parsed.slice(-1) === '\\' && !this.isInside('bracket')) { + last.val = last.val.slice(0, last.val.length - 1); + + return pos({ + type: 'escape', + val: m[0] + }); + } + + var node = pos({ + type: 'bracket.close', + rest: this.input, + val: m[0] + }); + + if (last.type === 'bracket.open') { + node.type = 'bracket.inner'; + node.escaped = true; + return node; + } + + var bracket = this.pop('bracket'); + if (!this.isType(bracket, 'bracket')) { + if (this.options.strict) { + throw new Error('missing opening "["'); + } + node.type = 'bracket.inner'; + node.escaped = true; + return node; + } + + bracket.nodes.push(node); + define(node, 'parent', bracket); + }); +} + +/** + * Brackets parsers + */ + +module.exports = parsers; + +/** + * Expose text regex + */ + +module.exports.TEXT_REGEX = TEXT_REGEX; + + +/***/ }), +/* 863 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var toRegex = __webpack_require__(729); +var regexNot = __webpack_require__(740); +var cached; + +/** + * Get the last element from `array` + * @param {Array} `array` + * @return {*} + */ + +exports.last = function(arr) { + return arr[arr.length - 1]; +}; + +/** + * Create and cache regex to use for text nodes + */ + +exports.createRegex = function(pattern, include) { + if (cached) return cached; + var opts = {contains: true, strictClose: false}; + var not = regexNot.create(pattern, opts); + var re; + + if (typeof include === 'string') { + re = toRegex('^(?:' + include + '|' + not + ')', opts); + } else { + re = toRegex(not, opts); + } + + return (cached = re); +}; + + +/***/ }), +/* 864 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * Detect Electron renderer process, which is node, but we should + * treat as a browser. + */ + +if (typeof process !== 'undefined' && process.type === 'renderer') { + module.exports = __webpack_require__(865); +} else { + module.exports = __webpack_require__(868); +} + + +/***/ }), +/* 865 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * This is the web browser implementation of `debug()`. + * + * Expose `debug()` as the module. + */ + +exports = module.exports = __webpack_require__(866); +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.storage = 'undefined' != typeof chrome + && 'undefined' != typeof chrome.storage + ? chrome.storage.local + : localstorage(); + +/** + * Colors. + */ + +exports.colors = [ + 'lightseagreen', + 'forestgreen', + 'goldenrod', + 'dodgerblue', + 'darkorchid', + 'crimson' +]; + +/** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ + +function useColors() { + // NB: In an Electron preload script, document will be defined but not fully + // initialized. Since we know we're in Chrome, we'll just detect this case + // explicitly + if (typeof window !== 'undefined' && window.process && window.process.type === 'renderer') { + return true; + } + + // is webkit? http://stackoverflow.com/a/16459606/376773 + // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 + return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) || + // is firebug? http://stackoverflow.com/a/398120/376773 + (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) || + // is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) || + // double check webkit in userAgent just in case we are in a worker + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)); +} + +/** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + +exports.formatters.j = function(v) { + try { + return JSON.stringify(v); + } catch (err) { + return '[UnexpectedJSONParseError]: ' + err.message; + } +}; + + +/** + * Colorize log arguments if enabled. + * + * @api public + */ + +function formatArgs(args) { + var useColors = this.useColors; + + args[0] = (useColors ? '%c' : '') + + this.namespace + + (useColors ? ' %c' : ' ') + + args[0] + + (useColors ? '%c ' : ' ') + + '+' + exports.humanize(this.diff); + + if (!useColors) return; + + var c = 'color: ' + this.color; + args.splice(1, 0, c, 'color: inherit') + + // the final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + var index = 0; + var lastC = 0; + args[0].replace(/%[a-zA-Z%]/g, function(match) { + if ('%%' === match) return; + index++; + if ('%c' === match) { + // we only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + + args.splice(lastC, 0, c); +} + +/** + * Invokes `console.log()` when available. + * No-op when `console.log` is not a "function". + * + * @api public + */ + +function log() { + // this hackery is required for IE8/9, where + // the `console.log` function doesn't have 'apply' + return 'object' === typeof console + && console.log + && Function.prototype.apply.call(console.log, console, arguments); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ + +function save(namespaces) { + try { + if (null == namespaces) { + exports.storage.removeItem('debug'); + } else { + exports.storage.debug = namespaces; + } + } catch(e) {} +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + +function load() { + var r; + try { + r = exports.storage.debug; + } catch(e) {} + + // If debug isn't set in LS, and we're in Electron, try to load $DEBUG + if (!r && typeof process !== 'undefined' && 'env' in process) { + r = process.env.DEBUG; + } + + return r; +} + +/** + * Enable namespaces listed in `localStorage.debug` initially. + */ + +exports.enable(load()); + +/** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + +function localstorage() { + try { + return window.localStorage; + } catch (e) {} +} + + +/***/ }), +/* 866 */ +/***/ (function(module, exports, __webpack_require__) { + + +/** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + * + * Expose `debug()` as the module. + */ + +exports = module.exports = createDebug.debug = createDebug['default'] = createDebug; +exports.coerce = coerce; +exports.disable = disable; +exports.enable = enable; +exports.enabled = enabled; +exports.humanize = __webpack_require__(867); + +/** + * The currently active debug mode names, and names to skip. + */ + +exports.names = []; +exports.skips = []; + +/** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". + */ + +exports.formatters = {}; + +/** + * Previous log timestamp. + */ + +var prevTime; + +/** + * Select a color. + * @param {String} namespace + * @return {Number} + * @api private + */ + +function selectColor(namespace) { + var hash = 0, i; + + for (i in namespace) { + hash = ((hash << 5) - hash) + namespace.charCodeAt(i); + hash |= 0; // Convert to 32bit integer + } + + return exports.colors[Math.abs(hash) % exports.colors.length]; +} + +/** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + +function createDebug(namespace) { + + function debug() { + // disabled? + if (!debug.enabled) return; + + var self = debug; + + // set `diff` timestamp + var curr = +new Date(); + var ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + + // turn the `arguments` into a proper Array + var args = new Array(arguments.length); + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i]; + } + + args[0] = exports.coerce(args[0]); + + if ('string' !== typeof args[0]) { + // anything else let's inspect with %O + args.unshift('%O'); + } + + // apply any `formatters` transformations + var index = 0; + args[0] = args[0].replace(/%([a-zA-Z%])/g, function(match, format) { + // if we encounter an escaped % then don't increase the array index + if (match === '%%') return match; + index++; + var formatter = exports.formatters[format]; + if ('function' === typeof formatter) { + var val = args[index]; + match = formatter.call(self, val); + + // now we need to remove `args[index]` since it's inlined in the `format` + args.splice(index, 1); + index--; + } + return match; + }); + + // apply env-specific formatting (colors, etc.) + exports.formatArgs.call(self, args); + + var logFn = debug.log || exports.log || console.log.bind(console); + logFn.apply(self, args); + } + + debug.namespace = namespace; + debug.enabled = exports.enabled(namespace); + debug.useColors = exports.useColors(); + debug.color = selectColor(namespace); + + // env-specific initialization logic for debug instances + if ('function' === typeof exports.init) { + exports.init(debug); + } + + return debug; +} + +/** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + +function enable(namespaces) { + exports.save(namespaces); + + exports.names = []; + exports.skips = []; + + var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); + var len = split.length; + + for (var i = 0; i < len; i++) { + if (!split[i]) continue; // ignore empty strings + namespaces = split[i].replace(/\*/g, '.*?'); + if (namespaces[0] === '-') { + exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); + } else { + exports.names.push(new RegExp('^' + namespaces + '$')); + } + } +} + +/** + * Disable debug output. + * + * @api public + */ + +function disable() { + exports.enable(''); +} + +/** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + +function enabled(name) { + var i, len; + for (i = 0, len = exports.skips.length; i < len; i++) { + if (exports.skips[i].test(name)) { + return false; + } + } + for (i = 0, len = exports.names.length; i < len; i++) { + if (exports.names[i].test(name)) { + return true; + } + } + return false; +} + +/** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + +function coerce(val) { + if (val instanceof Error) return val.stack || val.message; + return val; +} + + +/***/ }), +/* 867 */ +/***/ (function(module, exports) { + +/** + * Helpers. + */ + +var s = 1000; +var m = s * 60; +var h = m * 60; +var d = h * 24; +var y = d * 365.25; + +/** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} [options] + * @throws {Error} throw an error if val is not a non-empty string or a number + * @return {String|Number} + * @api public + */ + +module.exports = function(val, options) { + options = options || {}; + var type = typeof val; + if (type === 'string' && val.length > 0) { + return parse(val); + } else if (type === 'number' && isNaN(val) === false) { + return options.long ? fmtLong(val) : fmtShort(val); + } + throw new Error( + 'val is not a non-empty string or a valid number. val=' + + JSON.stringify(val) + ); +}; + +/** + * Parse the given `str` and return milliseconds. + * + * @param {String} str + * @return {Number} + * @api private + */ + +function parse(str) { + str = String(str); + if (str.length > 100) { + return; + } + var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec( + str + ); + if (!match) { + return; + } + var n = parseFloat(match[1]); + var type = (match[2] || 'ms').toLowerCase(); + switch (type) { + case 'years': + case 'year': + case 'yrs': + case 'yr': + case 'y': + return n * y; + case 'days': + case 'day': + case 'd': + return n * d; + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h; + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m; + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s; + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + default: + return undefined; + } +} + +/** + * Short format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtShort(ms) { + if (ms >= d) { + return Math.round(ms / d) + 'd'; + } + if (ms >= h) { + return Math.round(ms / h) + 'h'; + } + if (ms >= m) { + return Math.round(ms / m) + 'm'; + } + if (ms >= s) { + return Math.round(ms / s) + 's'; + } + return ms + 'ms'; +} + +/** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtLong(ms) { + return plural(ms, d, 'day') || + plural(ms, h, 'hour') || + plural(ms, m, 'minute') || + plural(ms, s, 'second') || + ms + ' ms'; +} + +/** + * Pluralization helper. + */ + +function plural(ms, n, name) { + if (ms < n) { + return; + } + if (ms < n * 1.5) { + return Math.floor(ms / n) + ' ' + name; + } + return Math.ceil(ms / n) + ' ' + name + 's'; +} + + +/***/ }), +/* 868 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * Module dependencies. + */ + +var tty = __webpack_require__(480); +var util = __webpack_require__(29); + +/** + * This is the Node.js implementation of `debug()`. + * + * Expose `debug()` as the module. + */ + +exports = module.exports = __webpack_require__(866); +exports.init = init; +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; + +/** + * Colors. + */ + +exports.colors = [6, 2, 3, 4, 5, 1]; + +/** + * Build up the default `inspectOpts` object from the environment variables. + * + * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js + */ + +exports.inspectOpts = Object.keys(process.env).filter(function (key) { + return /^debug_/i.test(key); +}).reduce(function (obj, key) { + // camel-case + var prop = key + .substring(6) + .toLowerCase() + .replace(/_([a-z])/g, function (_, k) { return k.toUpperCase() }); + + // coerce string value into JS value + var val = process.env[key]; + if (/^(yes|on|true|enabled)$/i.test(val)) val = true; + else if (/^(no|off|false|disabled)$/i.test(val)) val = false; + else if (val === 'null') val = null; + else val = Number(val); + + obj[prop] = val; + return obj; +}, {}); + +/** + * The file descriptor to write the `debug()` calls to. + * Set the `DEBUG_FD` env variable to override with another value. i.e.: + * + * $ DEBUG_FD=3 node script.js 3>debug.log + */ + +var fd = parseInt(process.env.DEBUG_FD, 10) || 2; + +if (1 !== fd && 2 !== fd) { + util.deprecate(function(){}, 'except for stderr(2) and stdout(1), any other usage of DEBUG_FD is deprecated. Override debug.log if you want to use a different log function (https://git.io/debug_fd)')() +} + +var stream = 1 === fd ? process.stdout : + 2 === fd ? process.stderr : + createWritableStdioStream(fd); + +/** + * Is stdout a TTY? Colored output is enabled when `true`. + */ + +function useColors() { + return 'colors' in exports.inspectOpts + ? Boolean(exports.inspectOpts.colors) + : tty.isatty(fd); +} + +/** + * Map %o to `util.inspect()`, all on a single line. + */ + +exports.formatters.o = function(v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts) + .split('\n').map(function(str) { + return str.trim() + }).join(' '); +}; + +/** + * Map %o to `util.inspect()`, allowing multiple lines if needed. + */ + +exports.formatters.O = function(v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts); +}; + +/** + * Adds ANSI color escape codes if enabled. + * + * @api public + */ + +function formatArgs(args) { + var name = this.namespace; + var useColors = this.useColors; + + if (useColors) { + var c = this.color; + var prefix = ' \u001b[3' + c + ';1m' + name + ' ' + '\u001b[0m'; + + args[0] = prefix + args[0].split('\n').join('\n' + prefix); + args.push('\u001b[3' + c + 'm+' + exports.humanize(this.diff) + '\u001b[0m'); + } else { + args[0] = new Date().toUTCString() + + ' ' + name + ' ' + args[0]; + } +} + +/** + * Invokes `util.format()` with the specified arguments and writes to `stream`. + */ + +function log() { + return stream.write(util.format.apply(util, arguments) + '\n'); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ + +function save(namespaces) { + if (null == namespaces) { + // If you set a process.env field to null or undefined, it gets cast to the + // string 'null' or 'undefined'. Just delete instead. + delete process.env.DEBUG; + } else { + process.env.DEBUG = namespaces; + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + +function load() { + return process.env.DEBUG; +} + +/** + * Copied from `node/src/node.js`. + * + * XXX: It's lame that node doesn't expose this API out-of-the-box. It also + * relies on the undocumented `tty_wrap.guessHandleType()` which is also lame. + */ + +function createWritableStdioStream (fd) { + var stream; + var tty_wrap = process.binding('tty_wrap'); + + // Note stream._type is used for test-module-load-list.js + + switch (tty_wrap.guessHandleType(fd)) { + case 'TTY': + stream = new tty.WriteStream(fd); + stream._type = 'tty'; + + // Hack to have stream not keep the event loop alive. + // See https://github.com/joyent/node/issues/1726 + if (stream._handle && stream._handle.unref) { + stream._handle.unref(); + } + break; + + case 'FILE': + var fs = __webpack_require__(23); + stream = new fs.SyncWriteStream(fd, { autoClose: false }); + stream._type = 'fs'; + break; + + case 'PIPE': + case 'TCP': + var net = __webpack_require__(806); + stream = new net.Socket({ + fd: fd, + readable: false, + writable: true + }); + + // FIXME Should probably have an option in net.Socket to create a + // stream from an existing fd which is writable only. But for now + // we'll just add this hack and set the `readable` member to false. + // Test: ./node test/fixtures/echo.js < /etc/passwd + stream.readable = false; + stream.read = null; + stream._type = 'pipe'; + + // FIXME Hack to have stream not keep the event loop alive. + // See https://github.com/joyent/node/issues/1726 + if (stream._handle && stream._handle.unref) { + stream._handle.unref(); + } + break; + + default: + // Probably an error on in uv_guess_handle() + throw new Error('Implement me. Unknown stream file type!'); + } + + // For supporting legacy API we put the FD here. + stream.fd = fd; + + stream._isStdio = true; + + return stream; +} + +/** + * Init logic for `debug` instances. + * + * Create a new `inspectOpts` object in case `useColors` is set + * differently for a particular `debug` instance. + */ + +function init (debug) { + debug.inspectOpts = {}; + + var keys = Object.keys(exports.inspectOpts); + for (var i = 0; i < keys.length; i++) { + debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]]; + } +} + +/** + * Enable namespaces listed in `process.env.DEBUG` initially. + */ + +exports.enable(load()); + + +/***/ }), +/* 869 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var brackets = __webpack_require__(859); +var define = __webpack_require__(870); +var utils = __webpack_require__(871); + +/** + * Characters to use in text regex (we want to "not" match + * characters that are matched by other parsers) + */ + +var TEXT_REGEX = '([!@*?+]?\\(|\\)|[*?.+\\\\]|\\[:?(?=.*\\])|:?\\])+'; +var not = utils.createRegex(TEXT_REGEX); + +/** + * Extglob parsers + */ + +function parsers(extglob) { + extglob.state = extglob.state || {}; + + /** + * Use `expand-brackets` parsers + */ + + extglob.use(brackets.parsers); + extglob.parser.sets.paren = extglob.parser.sets.paren || []; + extglob.parser + + /** + * Extglob open: "*(" + */ + + .capture('paren.open', function() { + var parsed = this.parsed; + var pos = this.position(); + var m = this.match(/^([!@*?+])?\(/); + if (!m) return; + + var prev = this.prev(); + var prefix = m[1]; + var val = m[0]; + + var open = pos({ + type: 'paren.open', + parsed: parsed, + val: val + }); + + var node = pos({ + type: 'paren', + prefix: prefix, + nodes: [open] + }); + + // if nested negation extglobs, just cancel them out to simplify + if (prefix === '!' && prev.type === 'paren' && prev.prefix === '!') { + prev.prefix = '@'; + node.prefix = '@'; + } + + define(node, 'rest', this.input); + define(node, 'parsed', parsed); + define(node, 'parent', prev); + define(open, 'parent', node); + + this.push('paren', node); + prev.nodes.push(node); + }) + + /** + * Extglob close: ")" + */ + + .capture('paren.close', function() { + var parsed = this.parsed; + var pos = this.position(); + var m = this.match(/^\)/); + if (!m) return; + + var parent = this.pop('paren'); + var node = pos({ + type: 'paren.close', + rest: this.input, + parsed: parsed, + val: m[0] + }); + + if (!this.isType(parent, 'paren')) { + if (this.options.strict) { + throw new Error('missing opening paren: "("'); + } + node.escaped = true; + return node; + } + + node.prefix = parent.prefix; + parent.nodes.push(node); + define(node, 'parent', parent); + }) + + /** + * Escape: "\\." + */ + + .capture('escape', function() { + var pos = this.position(); + var m = this.match(/^\\(.)/); + if (!m) return; + + return pos({ + type: 'escape', + val: m[0], + ch: m[1] + }); + }) + + /** + * Question marks: "?" + */ + + .capture('qmark', function() { + var parsed = this.parsed; + var pos = this.position(); + var m = this.match(/^\?+(?!\()/); + if (!m) return; + extglob.state.metachar = true; + return pos({ + type: 'qmark', + rest: this.input, + parsed: parsed, + val: m[0] + }); + }) + + /** + * Character parsers + */ + + .capture('star', /^\*(?!\()/) + .capture('plus', /^\+(?!\()/) + .capture('dot', /^\./) + .capture('text', not); +}; + +/** + * Expose text regex string + */ + +module.exports.TEXT_REGEX = TEXT_REGEX; + +/** + * Extglob parsers + */ + +module.exports = parsers; + + +/***/ }), +/* 870 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/*! + * define-property + * + * Copyright (c) 2015, 2017, Jon Schlinkert. + * Released under the MIT License. + */ + + + +var isDescriptor = __webpack_require__(760); + +module.exports = function defineProperty(obj, prop, val) { + if (typeof obj !== 'object' && typeof obj !== 'function') { + throw new TypeError('expected an object or function.'); + } + + if (typeof prop !== 'string') { + throw new TypeError('expected `prop` to be a string.'); + } + + if (isDescriptor(val) && ('set' in val || 'get' in val)) { + return Object.defineProperty(obj, prop, val); + } + + return Object.defineProperty(obj, prop, { + configurable: true, + enumerable: false, + writable: true, + value: val + }); +}; + + +/***/ }), +/* 871 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var regex = __webpack_require__(740); +var Cache = __webpack_require__(850); + +/** + * Utils + */ + +var utils = module.exports; +var cache = utils.cache = new Cache(); + +/** + * Cast `val` to an array + * @return {Array} + */ + +utils.arrayify = function(val) { + if (!Array.isArray(val)) { + return [val]; + } + return val; +}; + +/** + * Memoize a generated regex or function + */ + +utils.memoize = function(type, pattern, options, fn) { + var key = utils.createKey(type + pattern, options); + + if (cache.has(type, key)) { + return cache.get(type, key); + } + + var val = fn(pattern, options); + if (options && options.cache === false) { + return val; + } + + cache.set(type, key, val); + return val; +}; + +/** + * Create the key to use for memoization. The key is generated + * by iterating over the options and concatenating key-value pairs + * to the pattern string. + */ + +utils.createKey = function(pattern, options) { + var key = pattern; + if (typeof options === 'undefined') { + return key; + } + for (var prop in options) { + key += ';' + prop + '=' + String(options[prop]); + } + return key; +}; + +/** + * Create the regex to use for matching text + */ + +utils.createRegex = function(str) { + var opts = {contains: true, strictClose: false}; + return regex(str, opts); +}; + + +/***/ }), +/* 872 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/** + * Module dependencies + */ + +var Snapdragon = __webpack_require__(768); +var define = __webpack_require__(870); +var extend = __webpack_require__(738); + +/** + * Local dependencies + */ + +var compilers = __webpack_require__(858); +var parsers = __webpack_require__(869); + +/** + * Customize Snapdragon parser and renderer + */ + +function Extglob(options) { + this.options = extend({source: 'extglob'}, options); + this.snapdragon = this.options.snapdragon || new Snapdragon(this.options); + this.snapdragon.patterns = this.snapdragon.patterns || {}; + this.compiler = this.snapdragon.compiler; + this.parser = this.snapdragon.parser; + + compilers(this.snapdragon); + parsers(this.snapdragon); + + /** + * Override Snapdragon `.parse` method + */ + + define(this.snapdragon, 'parse', function(str, options) { + var parsed = Snapdragon.prototype.parse.apply(this, arguments); + parsed.input = str; + + // escape unmatched brace/bracket/parens + var last = this.parser.stack.pop(); + if (last && this.options.strict !== true) { + var node = last.nodes[0]; + node.val = '\\' + node.val; + var sibling = node.parent.nodes[1]; + if (sibling.type === 'star') { + sibling.loose = true; + } + } + + // add non-enumerable parser reference + define(parsed, 'parser', this.parser); + return parsed; + }); + + /** + * Decorate `.parse` method + */ + + define(this, 'parse', function(ast, options) { + return this.snapdragon.parse.apply(this.snapdragon, arguments); + }); + + /** + * Decorate `.compile` method + */ + + define(this, 'compile', function(ast, options) { + return this.snapdragon.compile.apply(this.snapdragon, arguments); + }); + +} + +/** + * Expose `Extglob` + */ + +module.exports = Extglob; + + +/***/ }), +/* 873 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var extglob = __webpack_require__(857); +var nanomatch = __webpack_require__(842); +var regexNot = __webpack_require__(740); +var toRegex = __webpack_require__(830); +var not; + +/** + * Characters to use in negation regex (we want to "not" match + * characters that are matched by other parsers) + */ + +var TEXT = '([!@*?+]?\\(|\\)|\\[:?(?=.*?:?\\])|:?\\]|[*+?!^$.\\\\/])+'; +var createNotRegex = function(opts) { + return not || (not = textRegex(TEXT)); +}; + +/** + * Parsers + */ + +module.exports = function(snapdragon) { + var parsers = snapdragon.parser.parsers; + + // register nanomatch parsers + snapdragon.use(nanomatch.parsers); + + // get references to some specific nanomatch parsers before they + // are overridden by the extglob and/or parsers + var escape = parsers.escape; + var slash = parsers.slash; + var qmark = parsers.qmark; + var plus = parsers.plus; + var star = parsers.star; + var dot = parsers.dot; + + // register extglob parsers + snapdragon.use(extglob.parsers); + + // custom micromatch parsers + snapdragon.parser + .use(function() { + // override "notRegex" created in nanomatch parser + this.notRegex = /^\!+(?!\()/; + }) + // reset the referenced parsers + .capture('escape', escape) + .capture('slash', slash) + .capture('qmark', qmark) + .capture('star', star) + .capture('plus', plus) + .capture('dot', dot) + + /** + * Override `text` parser + */ + + .capture('text', function() { + if (this.isInside('bracket')) return; + var pos = this.position(); + var m = this.match(createNotRegex(this.options)); + if (!m || !m[0]) return; + + // escape regex boundary characters and simple brackets + var val = m[0].replace(/([[\]^$])/g, '\\$1'); + + return pos({ + type: 'text', + val: val + }); + }); +}; + +/** + * Create text regex + */ + +function textRegex(pattern) { + var notStr = regexNot.create(pattern, {contains: true, strictClose: false}); + var prefix = '(?:[\\^]|\\\\|'; + return toRegex(prefix + notStr + ')', {strictClose: false}); +} + + +/***/ }), +/* 874 */ +/***/ (function(module, exports, __webpack_require__) { + +module.exports = new (__webpack_require__(850))(); + + +/***/ }), +/* 875 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var utils = module.exports; +var path = __webpack_require__(16); + +/** + * Module dependencies + */ + +var Snapdragon = __webpack_require__(768); +utils.define = __webpack_require__(837); +utils.diff = __webpack_require__(854); +utils.extend = __webpack_require__(838); +utils.pick = __webpack_require__(855); +utils.typeOf = __webpack_require__(876); +utils.unique = __webpack_require__(741); + +/** + * Returns true if the platform is windows, or `path.sep` is `\\`. + * This is defined as a function to allow `path.sep` to be set in unit tests, + * or by the user, if there is a reason to do so. + * @return {Boolean} + */ + +utils.isWindows = function() { + return path.sep === '\\' || process.platform === 'win32'; +}; + +/** + * Get the `Snapdragon` instance to use + */ + +utils.instantiate = function(ast, options) { + var snapdragon; + // if an instance was created by `.parse`, use that instance + if (utils.typeOf(ast) === 'object' && ast.snapdragon) { + snapdragon = ast.snapdragon; + // if the user supplies an instance on options, use that instance + } else if (utils.typeOf(options) === 'object' && options.snapdragon) { + snapdragon = options.snapdragon; + // create a new instance + } else { + snapdragon = new Snapdragon(options); + } + + utils.define(snapdragon, 'parse', function(str, options) { + var parsed = Snapdragon.prototype.parse.apply(this, arguments); + parsed.input = str; + + // escape unmatched brace/bracket/parens + var last = this.parser.stack.pop(); + if (last && this.options.strictErrors !== true) { + var open = last.nodes[0]; + var inner = last.nodes[1]; + if (last.type === 'bracket') { + if (inner.val.charAt(0) === '[') { + inner.val = '\\' + inner.val; + } + + } else { + open.val = '\\' + open.val; + var sibling = open.parent.nodes[1]; + if (sibling.type === 'star') { + sibling.loose = true; + } + } + } + + // add non-enumerable parser reference + utils.define(parsed, 'parser', this.parser); + return parsed; + }); + + return snapdragon; +}; + +/** + * Create the key to use for memoization. The key is generated + * by iterating over the options and concatenating key-value pairs + * to the pattern string. + */ + +utils.createKey = function(pattern, options) { + if (utils.typeOf(options) !== 'object') { + return pattern; + } + var val = pattern; + var keys = Object.keys(options); + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + val += ';' + key + '=' + String(options[key]); + } + return val; +}; + +/** + * Cast `val` to an array + * @return {Array} + */ + +utils.arrayify = function(val) { + if (typeof val === 'string') return [val]; + return val ? (Array.isArray(val) ? val : [val]) : []; +}; + +/** + * Return true if `val` is a non-empty string + */ + +utils.isString = function(val) { + return typeof val === 'string'; +}; + +/** + * Return true if `val` is a non-empty string + */ + +utils.isObject = function(val) { + return utils.typeOf(val) === 'object'; +}; + +/** + * Returns true if the given `str` has special characters + */ + +utils.hasSpecialChars = function(str) { + return /(?:(?:(^|\/)[!.])|[*?+()|\[\]{}]|[+@]\()/.test(str); +}; + +/** + * Escape regex characters in the given string + */ + +utils.escapeRegex = function(str) { + return str.replace(/[-[\]{}()^$|*+?.\\\/\s]/g, '\\$&'); +}; + +/** + * Normalize slashes in the given filepath. + * + * @param {String} `filepath` + * @return {String} + */ + +utils.toPosixPath = function(str) { + return str.replace(/\\+/g, '/'); +}; + +/** + * Strip backslashes before special characters in a string. + * + * @param {String} `str` + * @return {String} + */ + +utils.unescape = function(str) { + return utils.toPosixPath(str.replace(/\\(?=[*+?!.])/g, '')); +}; + +/** + * Strip the prefix from a filepath + * @param {String} `fp` + * @return {String} + */ + +utils.stripPrefix = function(str) { + if (str.charAt(0) !== '.') { + return str; + } + var ch = str.charAt(1); + if (utils.isSlash(ch)) { + return str.slice(2); + } + return str; +}; + +/** + * Returns true if the given str is an escaped or + * unescaped path character + */ + +utils.isSlash = function(str) { + return str === '/' || str === '\\/' || str === '\\' || str === '\\\\'; +}; + +/** + * Returns a function that returns true if the given + * pattern matches or contains a `filepath` + * + * @param {String} `pattern` + * @return {Function} + */ + +utils.matchPath = function(pattern, options) { + return (options && options.contains) + ? utils.containsPattern(pattern, options) + : utils.equalsPattern(pattern, options); +}; + +/** + * Returns true if the given (original) filepath or unixified path are equal + * to the given pattern. + */ + +utils._equals = function(filepath, unixPath, pattern) { + return pattern === filepath || pattern === unixPath; +}; + +/** + * Returns true if the given (original) filepath or unixified path contain + * the given pattern. + */ + +utils._contains = function(filepath, unixPath, pattern) { + return filepath.indexOf(pattern) !== -1 || unixPath.indexOf(pattern) !== -1; +}; + +/** + * Returns a function that returns true if the given + * pattern is the same as a given `filepath` + * + * @param {String} `pattern` + * @return {Function} + */ + +utils.equalsPattern = function(pattern, options) { + var unixify = utils.unixify(options); + options = options || {}; + + return function fn(filepath) { + var equal = utils._equals(filepath, unixify(filepath), pattern); + if (equal === true || options.nocase !== true) { + return equal; + } + var lower = filepath.toLowerCase(); + return utils._equals(lower, unixify(lower), pattern); + }; +}; + +/** + * Returns a function that returns true if the given + * pattern contains a `filepath` + * + * @param {String} `pattern` + * @return {Function} + */ + +utils.containsPattern = function(pattern, options) { + var unixify = utils.unixify(options); + options = options || {}; + + return function(filepath) { + var contains = utils._contains(filepath, unixify(filepath), pattern); + if (contains === true || options.nocase !== true) { + return contains; + } + var lower = filepath.toLowerCase(); + return utils._contains(lower, unixify(lower), pattern); + }; +}; + +/** + * Returns a function that returns true if the given + * regex matches the `filename` of a file path. + * + * @param {RegExp} `re` Matching regex + * @return {Function} + */ + +utils.matchBasename = function(re) { + return function(filepath) { + return re.test(path.basename(filepath)); + }; +}; + +/** + * Determines the filepath to return based on the provided options. + * @return {any} + */ + +utils.value = function(str, unixify, options) { + if (options && options.unixify === false) { + return str; + } + return unixify(str); +}; + +/** + * Returns a function that normalizes slashes in a string to forward + * slashes, strips `./` from beginning of paths, and optionally unescapes + * special characters. + * @return {Function} + */ + +utils.unixify = function(options) { + options = options || {}; + return function(filepath) { + if (utils.isWindows() || options.unixify === true) { + filepath = utils.toPosixPath(filepath); + } + if (options.stripPrefix !== false) { + filepath = utils.stripPrefix(filepath); + } + if (options.unescape === true) { + filepath = utils.unescape(filepath); + } + return filepath; + }; +}; + + +/***/ }), +/* 876 */ +/***/ (function(module, exports) { + +var toString = Object.prototype.toString; + +module.exports = function kindOf(val) { + if (val === void 0) return 'undefined'; + if (val === null) return 'null'; + + var type = typeof val; + if (type === 'boolean') return 'boolean'; + if (type === 'string') return 'string'; + if (type === 'number') return 'number'; + if (type === 'symbol') return 'symbol'; + if (type === 'function') { + return isGeneratorFn(val) ? 'generatorfunction' : 'function'; + } + + if (isArray(val)) return 'array'; + if (isBuffer(val)) return 'buffer'; + if (isArguments(val)) return 'arguments'; + if (isDate(val)) return 'date'; + if (isError(val)) return 'error'; + if (isRegexp(val)) return 'regexp'; + + switch (ctorName(val)) { + case 'Symbol': return 'symbol'; + case 'Promise': return 'promise'; + + // Set, Map, WeakSet, WeakMap + case 'WeakMap': return 'weakmap'; + case 'WeakSet': return 'weakset'; + case 'Map': return 'map'; + case 'Set': return 'set'; + + // 8-bit typed arrays + case 'Int8Array': return 'int8array'; + case 'Uint8Array': return 'uint8array'; + case 'Uint8ClampedArray': return 'uint8clampedarray'; + + // 16-bit typed arrays + case 'Int16Array': return 'int16array'; + case 'Uint16Array': return 'uint16array'; + + // 32-bit typed arrays + case 'Int32Array': return 'int32array'; + case 'Uint32Array': return 'uint32array'; + case 'Float32Array': return 'float32array'; + case 'Float64Array': return 'float64array'; + } + + if (isGeneratorObj(val)) { + return 'generator'; + } + + // Non-plain objects + type = toString.call(val); + switch (type) { + case '[object Object]': return 'object'; + // iterators + case '[object Map Iterator]': return 'mapiterator'; + case '[object Set Iterator]': return 'setiterator'; + case '[object String Iterator]': return 'stringiterator'; + case '[object Array Iterator]': return 'arrayiterator'; + } + + // other + return type.slice(8, -1).toLowerCase().replace(/\s/g, ''); +}; + +function ctorName(val) { + return typeof val.constructor === 'function' ? val.constructor.name : null; +} + +function isArray(val) { + if (Array.isArray) return Array.isArray(val); + return val instanceof Array; +} + +function isError(val) { + return val instanceof Error || (typeof val.message === 'string' && val.constructor && typeof val.constructor.stackTraceLimit === 'number'); +} + +function isDate(val) { + if (val instanceof Date) return true; + return typeof val.toDateString === 'function' + && typeof val.getDate === 'function' + && typeof val.setDate === 'function'; +} + +function isRegexp(val) { + if (val instanceof RegExp) return true; + return typeof val.flags === 'string' + && typeof val.ignoreCase === 'boolean' + && typeof val.multiline === 'boolean' + && typeof val.global === 'boolean'; +} + +function isGeneratorFn(name, val) { + return ctorName(name) === 'GeneratorFunction'; +} + +function isGeneratorObj(val) { + return typeof val.throw === 'function' + && typeof val.return === 'function' + && typeof val.next === 'function'; +} + +function isArguments(val) { + try { + if (typeof val.length === 'number' && typeof val.callee === 'function') { + return true; + } + } catch (err) { + if (err.message.indexOf('callee') !== -1) { + return true; + } + } + return false; +} + +/** + * If you need to support Safari 5-7 (8-10 yr-old browser), + * take a look at https://github.com/feross/is-buffer + */ + +function isBuffer(val) { + if (val.constructor && typeof val.constructor.isBuffer === 'function') { + return val.constructor.isBuffer(val); + } + return false; +} + + +/***/ }), +/* 877 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var readdir = __webpack_require__(878); +var reader_1 = __webpack_require__(891); +var fs_stream_1 = __webpack_require__(895); +var ReaderAsync = /** @class */ (function (_super) { + __extends(ReaderAsync, _super); + function ReaderAsync() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(ReaderAsync.prototype, "fsAdapter", { + /** + * Returns FileSystem adapter. + */ + get: function () { + return new fs_stream_1.default(this.options); + }, + enumerable: true, + configurable: true + }); + /** + * Use async API to read entries for Task. + */ + ReaderAsync.prototype.read = function (task) { + var _this = this; + var root = this.getRootDirectory(task); + var options = this.getReaderOptions(task); + var entries = []; + return new Promise(function (resolve, reject) { + var stream = _this.api(root, task, options); + stream.on('error', function (err) { + _this.isEnoentCodeError(err) ? resolve([]) : reject(err); + stream.pause(); + }); + stream.on('data', function (entry) { return entries.push(_this.transform(entry)); }); + stream.on('end', function () { return resolve(entries); }); + }); + }; + /** + * Returns founded paths. + */ + ReaderAsync.prototype.api = function (root, task, options) { + if (task.dynamic) { + return this.dynamicApi(root, options); + } + return this.staticApi(task, options); + }; + /** + * Api for dynamic tasks. + */ + ReaderAsync.prototype.dynamicApi = function (root, options) { + return readdir.readdirStreamStat(root, options); + }; + /** + * Api for static tasks. + */ + ReaderAsync.prototype.staticApi = function (task, options) { + return this.fsAdapter.read(task.patterns, options.filter); + }; + return ReaderAsync; +}(reader_1.default)); +exports.default = ReaderAsync; + + +/***/ }), +/* 878 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +const readdirSync = __webpack_require__(879); +const readdirAsync = __webpack_require__(887); +const readdirStream = __webpack_require__(890); + +module.exports = exports = readdirAsyncPath; +exports.readdir = exports.readdirAsync = exports.async = readdirAsyncPath; +exports.readdirAsyncStat = exports.async.stat = readdirAsyncStat; +exports.readdirStream = exports.stream = readdirStreamPath; +exports.readdirStreamStat = exports.stream.stat = readdirStreamStat; +exports.readdirSync = exports.sync = readdirSyncPath; +exports.readdirSyncStat = exports.sync.stat = readdirSyncStat; + +/** + * Synchronous readdir that returns an array of string paths. + * + * @param {string} dir + * @param {object} [options] + * @returns {string[]} + */ +function readdirSyncPath (dir, options) { + return readdirSync(dir, options, {}); +} + +/** + * Synchronous readdir that returns results as an array of {@link fs.Stats} objects + * + * @param {string} dir + * @param {object} [options] + * @returns {fs.Stats[]} + */ +function readdirSyncStat (dir, options) { + return readdirSync(dir, options, { stats: true }); +} + +/** + * Aynchronous readdir (accepts an error-first callback or returns a {@link Promise}). + * Results are an array of path strings. + * + * @param {string} dir + * @param {object} [options] + * @param {function} [callback] + * @returns {Promise} + */ +function readdirAsyncPath (dir, options, callback) { + return readdirAsync(dir, options, callback, {}); +} + +/** + * Aynchronous readdir (accepts an error-first callback or returns a {@link Promise}). + * Results are an array of {@link fs.Stats} objects. + * + * @param {string} dir + * @param {object} [options] + * @param {function} [callback] + * @returns {Promise} + */ +function readdirAsyncStat (dir, options, callback) { + return readdirAsync(dir, options, callback, { stats: true }); +} + +/** + * Aynchronous readdir that returns a {@link stream.Readable} (which is also an {@link EventEmitter}). + * All stream data events ("data", "file", "directory", "symlink") are passed a path string. + * + * @param {string} dir + * @param {object} [options] + * @returns {stream.Readable} + */ +function readdirStreamPath (dir, options) { + return readdirStream(dir, options, {}); +} + +/** + * Aynchronous readdir that returns a {@link stream.Readable} (which is also an {@link EventEmitter}) + * All stream data events ("data", "file", "directory", "symlink") are passed an {@link fs.Stats} object. + * + * @param {string} dir + * @param {object} [options] + * @returns {stream.Readable} + */ +function readdirStreamStat (dir, options) { + return readdirStream(dir, options, { stats: true }); +} + + +/***/ }), +/* 879 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +module.exports = readdirSync; + +const DirectoryReader = __webpack_require__(880); + +let syncFacade = { + fs: __webpack_require__(885), + forEach: __webpack_require__(886), + sync: true +}; + +/** + * Returns the buffered output from a synchronous {@link DirectoryReader}. + * + * @param {string} dir + * @param {object} [options] + * @param {object} internalOptions + */ +function readdirSync (dir, options, internalOptions) { + internalOptions.facade = syncFacade; + + let reader = new DirectoryReader(dir, options, internalOptions); + let stream = reader.stream; + + let results = []; + let data = stream.read(); + while (data !== null) { + results.push(data); + data = stream.read(); + } + + return results; +} + + +/***/ }), +/* 880 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +const Readable = __webpack_require__(27).Readable; +const EventEmitter = __webpack_require__(379).EventEmitter; +const path = __webpack_require__(16); +const normalizeOptions = __webpack_require__(881); +const stat = __webpack_require__(883); +const call = __webpack_require__(884); + +/** + * Asynchronously reads the contents of a directory and streams the results + * via a {@link stream.Readable}. + */ +class DirectoryReader { + /** + * @param {string} dir - The absolute or relative directory path to read + * @param {object} [options] - User-specified options, if any (see {@link normalizeOptions}) + * @param {object} internalOptions - Internal options that aren't part of the public API + * @class + */ + constructor (dir, options, internalOptions) { + this.options = options = normalizeOptions(options, internalOptions); + + // Indicates whether we should keep reading + // This is set false if stream.Readable.push() returns false. + this.shouldRead = true; + + // The directories to read + // (initialized with the top-level directory) + this.queue = [{ + path: dir, + basePath: options.basePath, + posixBasePath: options.posixBasePath, + depth: 0 + }]; + + // The number of directories that are currently being processed + this.pending = 0; + + // The data that has been read, but not yet emitted + this.buffer = []; + + this.stream = new Readable({ objectMode: true }); + this.stream._read = () => { + // Start (or resume) reading + this.shouldRead = true; + + // If we have data in the buffer, then send the next chunk + if (this.buffer.length > 0) { + this.pushFromBuffer(); + } + + // If we have directories queued, then start processing the next one + if (this.queue.length > 0) { + if (this.options.facade.sync) { + while (this.queue.length > 0) { + this.readNextDirectory(); + } + } + else { + this.readNextDirectory(); + } + } + + this.checkForEOF(); + }; + } + + /** + * Reads the next directory in the queue + */ + readNextDirectory () { + let facade = this.options.facade; + let dir = this.queue.shift(); + this.pending++; + + // Read the directory listing + call.safe(facade.fs.readdir, dir.path, (err, items) => { + if (err) { + // fs.readdir threw an error + this.emit('error', err); + return this.finishedReadingDirectory(); + } + + try { + // Process each item in the directory (simultaneously, if async) + facade.forEach( + items, + this.processItem.bind(this, dir), + this.finishedReadingDirectory.bind(this, dir) + ); + } + catch (err2) { + // facade.forEach threw an error + // (probably because fs.readdir returned an invalid result) + this.emit('error', err2); + this.finishedReadingDirectory(); + } + }); + } + + /** + * This method is called after all items in a directory have been processed. + * + * NOTE: This does not necessarily mean that the reader is finished, since there may still + * be other directories queued or pending. + */ + finishedReadingDirectory () { + this.pending--; + + if (this.shouldRead) { + // If we have directories queued, then start processing the next one + if (this.queue.length > 0 && this.options.facade.async) { + this.readNextDirectory(); + } + + this.checkForEOF(); + } + } + + /** + * Determines whether the reader has finished processing all items in all directories. + * If so, then the "end" event is fired (via {@Readable#push}) + */ + checkForEOF () { + if (this.buffer.length === 0 && // The stuff we've already read + this.pending === 0 && // The stuff we're currently reading + this.queue.length === 0) { // The stuff we haven't read yet + // There's no more stuff! + this.stream.push(null); + } + } + + /** + * Processes a single item in a directory. + * + * If the item is a directory, and `option.deep` is enabled, then the item will be added + * to the directory queue. + * + * If the item meets the filter criteria, then it will be emitted to the reader's stream. + * + * @param {object} dir - A directory object from the queue + * @param {string} item - The name of the item (name only, no path) + * @param {function} done - A callback function that is called after the item has been processed + */ + processItem (dir, item, done) { + let stream = this.stream; + let options = this.options; + + let itemPath = dir.basePath + item; + let posixPath = dir.posixBasePath + item; + let fullPath = path.join(dir.path, item); + + // If `options.deep` is a number, and we've already recursed to the max depth, + // then there's no need to check fs.Stats to know if it's a directory. + // If `options.deep` is a function, then we'll need fs.Stats + let maxDepthReached = dir.depth >= options.recurseDepth; + + // Do we need to call `fs.stat`? + let needStats = + !maxDepthReached || // we need the fs.Stats to know if it's a directory + options.stats || // the user wants fs.Stats objects returned + options.recurseFn || // we need fs.Stats for the recurse function + options.filterFn || // we need fs.Stats for the filter function + EventEmitter.listenerCount(stream, 'file') || // we need the fs.Stats to know if it's a file + EventEmitter.listenerCount(stream, 'directory') || // we need the fs.Stats to know if it's a directory + EventEmitter.listenerCount(stream, 'symlink'); // we need the fs.Stats to know if it's a symlink + + // If we don't need stats, then exit early + if (!needStats) { + if (this.filter(itemPath, posixPath)) { + this.pushOrBuffer({ data: itemPath }); + } + return done(); + } + + // Get the fs.Stats object for this path + stat(options.facade.fs, fullPath, (err, stats) => { + if (err) { + // fs.stat threw an error + this.emit('error', err); + return done(); + } + + try { + // Add the item's path to the fs.Stats object + // The base of this path, and its separators are determined by the options + // (i.e. options.basePath and options.sep) + stats.path = itemPath; + + // Add depth of the path to the fs.Stats object for use this in the filter function + stats.depth = dir.depth; + + if (this.shouldRecurse(stats, posixPath, maxDepthReached)) { + // Add this subdirectory to the queue + this.queue.push({ + path: fullPath, + basePath: itemPath + options.sep, + posixBasePath: posixPath + '/', + depth: dir.depth + 1, + }); + } + + // Determine whether this item matches the filter criteria + if (this.filter(stats, posixPath)) { + this.pushOrBuffer({ + data: options.stats ? stats : itemPath, + file: stats.isFile(), + directory: stats.isDirectory(), + symlink: stats.isSymbolicLink(), + }); + } + + done(); + } + catch (err2) { + // An error occurred while processing the item + // (probably during a user-specified function, such as options.deep, options.filter, etc.) + this.emit('error', err2); + done(); + } + }); + } + + /** + * Pushes the given chunk of data to the stream, or adds it to the buffer, + * depending on the state of the stream. + * + * @param {object} chunk + */ + pushOrBuffer (chunk) { + // Add the chunk to the buffer + this.buffer.push(chunk); + + // If we're still reading, then immediately emit the next chunk in the buffer + // (which may or may not be the chunk that we just added) + if (this.shouldRead) { + this.pushFromBuffer(); + } + } + + /** + * Immediately pushes the next chunk in the buffer to the reader's stream. + * The "data" event will always be fired (via {@link Readable#push}). + * In addition, the "file", "directory", and/or "symlink" events may be fired, + * depending on the type of properties of the chunk. + */ + pushFromBuffer () { + let stream = this.stream; + let chunk = this.buffer.shift(); + + // Stream the data + try { + this.shouldRead = stream.push(chunk.data); + } + catch (err) { + this.emit('error', err); + } + + // Also emit specific events, based on the type of chunk + chunk.file && this.emit('file', chunk.data); + chunk.symlink && this.emit('symlink', chunk.data); + chunk.directory && this.emit('directory', chunk.data); + } + + /** + * Determines whether the given directory meets the user-specified recursion criteria. + * If the user didn't specify recursion criteria, then this function will default to true. + * + * @param {fs.Stats} stats - The directory's {@link fs.Stats} object + * @param {string} posixPath - The item's POSIX path (used for glob matching) + * @param {boolean} maxDepthReached - Whether we've already crawled the user-specified depth + * @returns {boolean} + */ + shouldRecurse (stats, posixPath, maxDepthReached) { + let options = this.options; + + if (maxDepthReached) { + // We've already crawled to the maximum depth. So no more recursion. + return false; + } + else if (!stats.isDirectory()) { + // It's not a directory. So don't try to crawl it. + return false; + } + else if (options.recurseGlob) { + // Glob patterns are always tested against the POSIX path, even on Windows + // https://github.com/isaacs/node-glob#windows + return options.recurseGlob.test(posixPath); + } + else if (options.recurseRegExp) { + // Regular expressions are tested against the normal path + // (based on the OS or options.sep) + return options.recurseRegExp.test(stats.path); + } + else if (options.recurseFn) { + try { + // Run the user-specified recursion criteria + return options.recurseFn.call(null, stats); + } + catch (err) { + // An error occurred in the user's code. + // In Sync and Async modes, this will return an error. + // In Streaming mode, we emit an "error" event, but continue processing + this.emit('error', err); + } + } + else { + // No recursion function was specified, and we're within the maximum depth. + // So crawl this directory. + return true; + } + } + + /** + * Determines whether the given item meets the user-specified filter criteria. + * If the user didn't specify a filter, then this function will always return true. + * + * @param {string|fs.Stats} value - Either the item's path, or the item's {@link fs.Stats} object + * @param {string} posixPath - The item's POSIX path (used for glob matching) + * @returns {boolean} + */ + filter (value, posixPath) { + let options = this.options; + + if (options.filterGlob) { + // Glob patterns are always tested against the POSIX path, even on Windows + // https://github.com/isaacs/node-glob#windows + return options.filterGlob.test(posixPath); + } + else if (options.filterRegExp) { + // Regular expressions are tested against the normal path + // (based on the OS or options.sep) + return options.filterRegExp.test(value.path || value); + } + else if (options.filterFn) { + try { + // Run the user-specified filter function + return options.filterFn.call(null, value); + } + catch (err) { + // An error occurred in the user's code. + // In Sync and Async modes, this will return an error. + // In Streaming mode, we emit an "error" event, but continue processing + this.emit('error', err); + } + } + else { + // No filter was specified, so match everything + return true; + } + } + + /** + * Emits an event. If one of the event listeners throws an error, + * then an "error" event is emitted. + * + * @param {string} eventName + * @param {*} data + */ + emit (eventName, data) { + let stream = this.stream; + + try { + stream.emit(eventName, data); + } + catch (err) { + if (eventName === 'error') { + // Don't recursively emit "error" events. + // If the first one fails, then just throw + throw err; + } + else { + stream.emit('error', err); + } + } + } +} + +module.exports = DirectoryReader; + + +/***/ }), +/* 881 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +const path = __webpack_require__(16); +const globToRegExp = __webpack_require__(882); + +module.exports = normalizeOptions; + +let isWindows = /^win/.test(process.platform); + +/** + * @typedef {Object} FSFacade + * @property {fs.readdir} readdir + * @property {fs.stat} stat + * @property {fs.lstat} lstat + */ + +/** + * Validates and normalizes the options argument + * + * @param {object} [options] - User-specified options, if any + * @param {object} internalOptions - Internal options that aren't part of the public API + * + * @param {number|boolean|function} [options.deep] + * The number of directories to recursively traverse. Any falsy value or negative number will + * default to zero, so only the top-level contents will be returned. Set to `true` or `Infinity` + * to traverse all subdirectories. Or provide a function that accepts a {@link fs.Stats} object + * and returns a truthy value if the directory's contents should be crawled. + * + * @param {function|string|RegExp} [options.filter] + * A function that accepts a {@link fs.Stats} object and returns a truthy value if the data should + * be returned. Or a RegExp or glob string pattern, to filter by file name. + * + * @param {string} [options.sep] + * The path separator to use. By default, the OS-specific separator will be used, but this can be + * set to a specific value to ensure consistency across platforms. + * + * @param {string} [options.basePath] + * The base path to prepend to each result. If empty, then all results will be relative to `dir`. + * + * @param {FSFacade} [options.fs] + * Synchronous or asynchronous facades for Node.js File System module + * + * @param {object} [internalOptions.facade] + * Synchronous or asynchronous facades for various methods, including for the Node.js File System module + * + * @param {boolean} [internalOptions.emit] + * Indicates whether the reader should emit "file", "directory", and "symlink" events + * + * @param {boolean} [internalOptions.stats] + * Indicates whether the reader should emit {@link fs.Stats} objects instead of path strings + * + * @returns {object} + */ +function normalizeOptions (options, internalOptions) { + if (options === null || options === undefined) { + options = {}; + } + else if (typeof options !== 'object') { + throw new TypeError('options must be an object'); + } + + let recurseDepth, recurseFn, recurseRegExp, recurseGlob, deep = options.deep; + if (deep === null || deep === undefined) { + recurseDepth = 0; + } + else if (typeof deep === 'boolean') { + recurseDepth = deep ? Infinity : 0; + } + else if (typeof deep === 'number') { + if (deep < 0 || isNaN(deep)) { + throw new Error('options.deep must be a positive number'); + } + else if (Math.floor(deep) !== deep) { + throw new Error('options.deep must be an integer'); + } + else { + recurseDepth = deep; + } + } + else if (typeof deep === 'function') { + recurseDepth = Infinity; + recurseFn = deep; + } + else if (deep instanceof RegExp) { + recurseDepth = Infinity; + recurseRegExp = deep; + } + else if (typeof deep === 'string' && deep.length > 0) { + recurseDepth = Infinity; + recurseGlob = globToRegExp(deep, { extended: true, globstar: true }); + } + else { + throw new TypeError('options.deep must be a boolean, number, function, regular expression, or glob pattern'); + } + + let filterFn, filterRegExp, filterGlob, filter = options.filter; + if (filter !== null && filter !== undefined) { + if (typeof filter === 'function') { + filterFn = filter; + } + else if (filter instanceof RegExp) { + filterRegExp = filter; + } + else if (typeof filter === 'string' && filter.length > 0) { + filterGlob = globToRegExp(filter, { extended: true, globstar: true }); + } + else { + throw new TypeError('options.filter must be a function, regular expression, or glob pattern'); + } + } + + let sep = options.sep; + if (sep === null || sep === undefined) { + sep = path.sep; + } + else if (typeof sep !== 'string') { + throw new TypeError('options.sep must be a string'); + } + + let basePath = options.basePath; + if (basePath === null || basePath === undefined) { + basePath = ''; + } + else if (typeof basePath === 'string') { + // Append a path separator to the basePath, if necessary + if (basePath && basePath.substr(-1) !== sep) { + basePath += sep; + } + } + else { + throw new TypeError('options.basePath must be a string'); + } + + // Convert the basePath to POSIX (forward slashes) + // so that glob pattern matching works consistently, even on Windows + let posixBasePath = basePath; + if (posixBasePath && sep !== '/') { + posixBasePath = posixBasePath.replace(new RegExp('\\' + sep, 'g'), '/'); + + /* istanbul ignore if */ + if (isWindows) { + // Convert Windows root paths (C:\) and UNCs (\\) to POSIX root paths + posixBasePath = posixBasePath.replace(/^([a-zA-Z]\:\/|\/\/)/, '/'); + } + } + + // Determine which facade methods to use + let facade; + if (options.fs === null || options.fs === undefined) { + // The user didn't provide their own facades, so use our internal ones + facade = internalOptions.facade; + } + else if (typeof options.fs === 'object') { + // Merge the internal facade methods with the user-provided `fs` facades + facade = Object.assign({}, internalOptions.facade); + facade.fs = Object.assign({}, internalOptions.facade.fs, options.fs); + } + else { + throw new TypeError('options.fs must be an object'); + } + + return { + recurseDepth, + recurseFn, + recurseRegExp, + recurseGlob, + filterFn, + filterRegExp, + filterGlob, + sep, + basePath, + posixBasePath, + facade, + emit: !!internalOptions.emit, + stats: !!internalOptions.stats, + }; +} + + +/***/ }), +/* 882 */ +/***/ (function(module, exports) { + +module.exports = function (glob, opts) { + if (typeof glob !== 'string') { + throw new TypeError('Expected a string'); + } + + var str = String(glob); + + // The regexp we are building, as a string. + var reStr = ""; + + // Whether we are matching so called "extended" globs (like bash) and should + // support single character matching, matching ranges of characters, group + // matching, etc. + var extended = opts ? !!opts.extended : false; + + // When globstar is _false_ (default), '/foo/*' is translated a regexp like + // '^\/foo\/.*$' which will match any string beginning with '/foo/' + // When globstar is _true_, '/foo/*' is translated to regexp like + // '^\/foo\/[^/]*$' which will match any string beginning with '/foo/' BUT + // which does not have a '/' to the right of it. + // E.g. with '/foo/*' these will match: '/foo/bar', '/foo/bar.txt' but + // these will not '/foo/bar/baz', '/foo/bar/baz.txt' + // Lastely, when globstar is _true_, '/foo/**' is equivelant to '/foo/*' when + // globstar is _false_ + var globstar = opts ? !!opts.globstar : false; + + // If we are doing extended matching, this boolean is true when we are inside + // a group (eg {*.html,*.js}), and false otherwise. + var inGroup = false; + + // RegExp flags (eg "i" ) to pass in to RegExp constructor. + var flags = opts && typeof( opts.flags ) === "string" ? opts.flags : ""; + + var c; + for (var i = 0, len = str.length; i < len; i++) { + c = str[i]; + + switch (c) { + case "\\": + case "/": + case "$": + case "^": + case "+": + case ".": + case "(": + case ")": + case "=": + case "!": + case "|": + reStr += "\\" + c; + break; + + case "?": + if (extended) { + reStr += "."; + break; + } + + case "[": + case "]": + if (extended) { + reStr += c; + break; + } + + case "{": + if (extended) { + inGroup = true; + reStr += "("; + break; + } + + case "}": + if (extended) { + inGroup = false; + reStr += ")"; + break; + } + + case ",": + if (inGroup) { + reStr += "|"; + break; + } + reStr += "\\" + c; + break; + + case "*": + // Move over all consecutive "*"'s. + // Also store the previous and next characters + var prevChar = str[i - 1]; + var starCount = 1; + while(str[i + 1] === "*") { + starCount++; + i++; + } + var nextChar = str[i + 1]; + + if (!globstar) { + // globstar is disabled, so treat any number of "*" as one + reStr += ".*"; + } else { + // globstar is enabled, so determine if this is a globstar segment + var isGlobstar = starCount > 1 // multiple "*"'s + && (prevChar === "/" || prevChar === undefined) // from the start of the segment + && (nextChar === "/" || nextChar === undefined) // to the end of the segment + + if (isGlobstar) { + // it's a globstar, so match zero or more path segments + reStr += "(?:[^/]*(?:\/|$))*"; + i++; // move over the "/" + } else { + // it's not a globstar, so only match one path segment + reStr += "[^/]*"; + } + } + break; + + default: + reStr += c; + } + } + + // When regexp 'g' flag is specified don't + // constrain the regular expression with ^ & $ + if (!flags || !~flags.indexOf('g')) { + reStr = "^" + reStr + "$"; + } + + return new RegExp(reStr, flags); +}; + + +/***/ }), +/* 883 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +const call = __webpack_require__(884); + +module.exports = stat; + +/** + * Retrieves the {@link fs.Stats} for the given path. If the path is a symbolic link, + * then the Stats of the symlink's target are returned instead. If the symlink is broken, + * then the Stats of the symlink itself are returned. + * + * @param {object} fs - Synchronous or Asynchronouse facade for the "fs" module + * @param {string} path - The path to return stats for + * @param {function} callback + */ +function stat (fs, path, callback) { + let isSymLink = false; + + call.safe(fs.lstat, path, (err, lstats) => { + if (err) { + // fs.lstat threw an eror + return callback(err); + } + + try { + isSymLink = lstats.isSymbolicLink(); + } + catch (err2) { + // lstats.isSymbolicLink() threw an error + // (probably because fs.lstat returned an invalid result) + return callback(err2); + } + + if (isSymLink) { + // Try to resolve the symlink + symlinkStat(fs, path, lstats, callback); + } + else { + // It's not a symlink, so return the stats as-is + callback(null, lstats); + } + }); +} + +/** + * Retrieves the {@link fs.Stats} for the target of the given symlink. + * If the symlink is broken, then the Stats of the symlink itself are returned. + * + * @param {object} fs - Synchronous or Asynchronouse facade for the "fs" module + * @param {string} path - The path of the symlink to return stats for + * @param {object} lstats - The stats of the symlink + * @param {function} callback + */ +function symlinkStat (fs, path, lstats, callback) { + call.safe(fs.stat, path, (err, stats) => { + if (err) { + // The symlink is broken, so return the stats for the link itself + return callback(null, lstats); + } + + try { + // Return the stats for the resolved symlink target, + // and override the `isSymbolicLink` method to indicate that it's a symlink + stats.isSymbolicLink = () => true; + } + catch (err2) { + // Setting stats.isSymbolicLink threw an error + // (probably because fs.stat returned an invalid result) + return callback(err2); + } + + callback(null, stats); + }); +} + + +/***/ }), +/* 884 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +let call = module.exports = { + safe: safeCall, + once: callOnce, +}; + +/** + * Calls a function with the given arguments, and ensures that the error-first callback is _always_ + * invoked exactly once, even if the function throws an error. + * + * @param {function} fn - The function to invoke + * @param {...*} args - The arguments to pass to the function. The final argument must be a callback function. + */ +function safeCall (fn, args) { + // Get the function arguments as an array + args = Array.prototype.slice.call(arguments, 1); + + // Replace the callback function with a wrapper that ensures it will only be called once + let callback = call.once(args.pop()); + args.push(callback); + + try { + fn.apply(null, args); + } + catch (err) { + callback(err); + } +} + +/** + * Returns a wrapper function that ensures the given callback function is only called once. + * Subsequent calls are ignored, unless the first argument is an Error, in which case the + * error is thrown. + * + * @param {function} fn - The function that should only be called once + * @returns {function} + */ +function callOnce (fn) { + let fulfilled = false; + + return function onceWrapper (err) { + if (!fulfilled) { + fulfilled = true; + return fn.apply(this, arguments); + } + else if (err) { + // The callback has already been called, but now an error has occurred + // (most likely inside the callback function). So re-throw the error, + // so it gets handled further up the call stack + throw err; + } + }; +} + + +/***/ }), +/* 885 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +const fs = __webpack_require__(23); +const call = __webpack_require__(884); + +/** + * A facade around {@link fs.readdirSync} that allows it to be called + * the same way as {@link fs.readdir}. + * + * @param {string} dir + * @param {function} callback + */ +exports.readdir = function (dir, callback) { + // Make sure the callback is only called once + callback = call.once(callback); + + try { + let items = fs.readdirSync(dir); + callback(null, items); + } + catch (err) { + callback(err); + } +}; + +/** + * A facade around {@link fs.statSync} that allows it to be called + * the same way as {@link fs.stat}. + * + * @param {string} path + * @param {function} callback + */ +exports.stat = function (path, callback) { + // Make sure the callback is only called once + callback = call.once(callback); + + try { + let stats = fs.statSync(path); + callback(null, stats); + } + catch (err) { + callback(err); + } +}; + +/** + * A facade around {@link fs.lstatSync} that allows it to be called + * the same way as {@link fs.lstat}. + * + * @param {string} path + * @param {function} callback + */ +exports.lstat = function (path, callback) { + // Make sure the callback is only called once + callback = call.once(callback); + + try { + let stats = fs.lstatSync(path); + callback(null, stats); + } + catch (err) { + callback(err); + } +}; + + +/***/ }), +/* 886 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +module.exports = syncForEach; + +/** + * A facade that allows {@link Array.forEach} to be called as though it were asynchronous. + * + * @param {array} array - The array to iterate over + * @param {function} iterator - The function to call for each item in the array + * @param {function} done - The function to call when all iterators have completed + */ +function syncForEach (array, iterator, done) { + array.forEach(item => { + iterator(item, () => { + // Note: No error-handling here because this is currently only ever called + // by DirectoryReader, which never passes an `error` parameter to the callback. + // Instead, DirectoryReader emits an "error" event if an error occurs. + }); + }); + + done(); +} + + +/***/ }), +/* 887 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +module.exports = readdirAsync; + +const maybe = __webpack_require__(888); +const DirectoryReader = __webpack_require__(880); + +let asyncFacade = { + fs: __webpack_require__(23), + forEach: __webpack_require__(889), + async: true +}; + +/** + * Returns the buffered output from an asynchronous {@link DirectoryReader}, + * via an error-first callback or a {@link Promise}. + * + * @param {string} dir + * @param {object} [options] + * @param {function} [callback] + * @param {object} internalOptions + */ +function readdirAsync (dir, options, callback, internalOptions) { + if (typeof options === 'function') { + callback = options; + options = undefined; + } + + return maybe(callback, new Promise(((resolve, reject) => { + let results = []; + + internalOptions.facade = asyncFacade; + + let reader = new DirectoryReader(dir, options, internalOptions); + let stream = reader.stream; + + stream.on('error', err => { + reject(err); + stream.pause(); + }); + stream.on('data', result => { + results.push(result); + }); + stream.on('end', () => { + resolve(results); + }); + }))); +} + + +/***/ }), +/* 888 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var next = (global.process && process.nextTick) || global.setImmediate || function (f) { + setTimeout(f, 0) +} + +module.exports = function maybe (cb, promise) { + if (cb) { + promise + .then(function (result) { + next(function () { cb(null, result) }) + }, function (err) { + next(function () { cb(err) }) + }) + return undefined + } + else { + return promise + } +} + + +/***/ }), +/* 889 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +module.exports = asyncForEach; + +/** + * Simultaneously processes all items in the given array. + * + * @param {array} array - The array to iterate over + * @param {function} iterator - The function to call for each item in the array + * @param {function} done - The function to call when all iterators have completed + */ +function asyncForEach (array, iterator, done) { + if (array.length === 0) { + // NOTE: Normally a bad idea to mix sync and async, but it's safe here because + // of the way that this method is currently used by DirectoryReader. + done(); + return; + } + + // Simultaneously process all items in the array. + let pending = array.length; + array.forEach(item => { + iterator(item, () => { + if (--pending === 0) { + done(); + } + }); + }); +} + + +/***/ }), +/* 890 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +module.exports = readdirStream; + +const DirectoryReader = __webpack_require__(880); + +let streamFacade = { + fs: __webpack_require__(23), + forEach: __webpack_require__(889), + async: true +}; + +/** + * Returns the {@link stream.Readable} of an asynchronous {@link DirectoryReader}. + * + * @param {string} dir + * @param {object} [options] + * @param {object} internalOptions + */ +function readdirStream (dir, options, internalOptions) { + internalOptions.facade = streamFacade; + + let reader = new DirectoryReader(dir, options, internalOptions); + return reader.stream; +} + + +/***/ }), +/* 891 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var path = __webpack_require__(16); +var deep_1 = __webpack_require__(892); +var entry_1 = __webpack_require__(894); +var pathUtil = __webpack_require__(893); +var Reader = /** @class */ (function () { + function Reader(options) { + this.options = options; + this.micromatchOptions = this.getMicromatchOptions(); + this.entryFilter = new entry_1.default(options, this.micromatchOptions); + this.deepFilter = new deep_1.default(options, this.micromatchOptions); + } + /** + * Returns root path to scanner. + */ + Reader.prototype.getRootDirectory = function (task) { + return path.resolve(this.options.cwd, task.base); + }; + /** + * Returns options for reader. + */ + Reader.prototype.getReaderOptions = function (task) { + return { + basePath: task.base === '.' ? '' : task.base, + filter: this.entryFilter.getFilter(task.positive, task.negative), + deep: this.deepFilter.getFilter(task.positive, task.negative), + sep: '/' + }; + }; + /** + * Returns options for micromatch. + */ + Reader.prototype.getMicromatchOptions = function () { + return { + dot: this.options.dot, + nobrace: !this.options.brace, + noglobstar: !this.options.globstar, + noext: !this.options.extension, + nocase: !this.options.case, + matchBase: this.options.matchBase + }; + }; + /** + * Returns transformed entry. + */ + Reader.prototype.transform = function (entry) { + if (this.options.absolute) { + entry.path = pathUtil.makeAbsolute(this.options.cwd, entry.path); + } + if (this.options.markDirectories && entry.isDirectory()) { + entry.path += '/'; + } + var item = this.options.stats ? entry : entry.path; + if (this.options.transform === null) { + return item; + } + return this.options.transform(item); + }; + /** + * Returns true if error has ENOENT code. + */ + Reader.prototype.isEnoentCodeError = function (err) { + return err.code === 'ENOENT'; + }; + return Reader; +}()); +exports.default = Reader; + + +/***/ }), +/* 892 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var pathUtils = __webpack_require__(893); +var patternUtils = __webpack_require__(722); +var DeepFilter = /** @class */ (function () { + function DeepFilter(options, micromatchOptions) { + this.options = options; + this.micromatchOptions = micromatchOptions; + } + /** + * Returns filter for directories. + */ + DeepFilter.prototype.getFilter = function (positive, negative) { + var _this = this; + var maxPatternDepth = this.getMaxPatternDepth(positive); + var negativeRe = this.getNegativePatternsRe(negative); + return function (entry) { return _this.filter(entry, negativeRe, maxPatternDepth); }; + }; + /** + * Returns max depth of the provided patterns. + */ + DeepFilter.prototype.getMaxPatternDepth = function (patterns) { + var globstar = patterns.some(patternUtils.hasGlobStar); + return globstar ? Infinity : patternUtils.getMaxNaivePatternsDepth(patterns); + }; + /** + * Returns RegExp's for patterns that can affect the depth of reading. + */ + DeepFilter.prototype.getNegativePatternsRe = function (patterns) { + var affectDepthOfReadingPatterns = patterns.filter(patternUtils.isAffectDepthOfReadingPattern); + return patternUtils.convertPatternsToRe(affectDepthOfReadingPatterns, this.micromatchOptions); + }; + /** + * Returns «true» for directory that should be read. + */ + DeepFilter.prototype.filter = function (entry, negativeRe, maxPatternDepth) { + if (this.isSkippedByDeepOption(entry.depth)) { + return false; + } + if (this.isSkippedByMaxPatternDepth(entry.depth, maxPatternDepth)) { + return false; + } + if (this.isSkippedSymlinkedDirectory(entry)) { + return false; + } + if (this.isSkippedDotDirectory(entry)) { + return false; + } + return this.isSkippedByNegativePatterns(entry, negativeRe); + }; + /** + * Returns «true» when the «deep» option is disabled or number and depth of the entry is greater that the option value. + */ + DeepFilter.prototype.isSkippedByDeepOption = function (entryDepth) { + return !this.options.deep || (typeof this.options.deep === 'number' && entryDepth >= this.options.deep); + }; + /** + * Returns «true» when depth parameter is not an Infinity and entry depth greater that the parameter value. + */ + DeepFilter.prototype.isSkippedByMaxPatternDepth = function (entryDepth, maxPatternDepth) { + return maxPatternDepth !== Infinity && entryDepth >= maxPatternDepth; + }; + /** + * Returns «true» for symlinked directory if the «followSymlinkedDirectories» option is disabled. + */ + DeepFilter.prototype.isSkippedSymlinkedDirectory = function (entry) { + return !this.options.followSymlinkedDirectories && entry.isSymbolicLink(); + }; + /** + * Returns «true» for a directory whose name starts with a period if «dot» option is disabled. + */ + DeepFilter.prototype.isSkippedDotDirectory = function (entry) { + return !this.options.dot && pathUtils.isDotDirectory(entry.path); + }; + /** + * Returns «true» for a directory whose path math to any negative pattern. + */ + DeepFilter.prototype.isSkippedByNegativePatterns = function (entry, negativeRe) { + return !patternUtils.matchAny(entry.path, negativeRe); + }; + return DeepFilter; +}()); +exports.default = DeepFilter; + - if (lstat && lstat.isSymbolicLink()) { - try { - stat = fs.statSync(abs) - } catch (er) { - stat = lstat - } - } else { - stat = lstat - } - } +/***/ }), +/* 893 */ +/***/ (function(module, exports, __webpack_require__) { - this.statCache[abs] = stat +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var path = __webpack_require__(16); +/** + * Returns «true» if the last partial of the path starting with a period. + */ +function isDotDirectory(filepath) { + return path.basename(filepath).startsWith('.'); +} +exports.isDotDirectory = isDotDirectory; +/** + * Convert a windows-like path to a unix-style path. + */ +function normalize(filepath) { + return filepath.replace(/\\/g, '/'); +} +exports.normalize = normalize; +/** + * Returns normalized absolute path of provided filepath. + */ +function makeAbsolute(cwd, filepath) { + return normalize(path.resolve(cwd, filepath)); +} +exports.makeAbsolute = makeAbsolute; - var c = true - if (stat) - c = stat.isDirectory() ? 'DIR' : 'FILE' - this.cache[abs] = this.cache[abs] || c +/***/ }), +/* 894 */ +/***/ (function(module, exports, __webpack_require__) { - if (needDir && c === 'FILE') - return false +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var pathUtils = __webpack_require__(893); +var patternUtils = __webpack_require__(722); +var EntryFilter = /** @class */ (function () { + function EntryFilter(options, micromatchOptions) { + this.options = options; + this.micromatchOptions = micromatchOptions; + this.index = new Map(); + } + /** + * Returns filter for directories. + */ + EntryFilter.prototype.getFilter = function (positive, negative) { + var _this = this; + var positiveRe = patternUtils.convertPatternsToRe(positive, this.micromatchOptions); + var negativeRe = patternUtils.convertPatternsToRe(negative, this.micromatchOptions); + return function (entry) { return _this.filter(entry, positiveRe, negativeRe); }; + }; + /** + * Returns true if entry must be added to result. + */ + EntryFilter.prototype.filter = function (entry, positiveRe, negativeRe) { + // Exclude duplicate results + if (this.options.unique) { + if (this.isDuplicateEntry(entry)) { + return false; + } + this.createIndexRecord(entry); + } + // Filter files and directories by options + if (this.onlyFileFilter(entry) || this.onlyDirectoryFilter(entry)) { + return false; + } + if (this.isSkippedByAbsoluteNegativePatterns(entry, negativeRe)) { + return false; + } + return this.isMatchToPatterns(entry.path, positiveRe) && !this.isMatchToPatterns(entry.path, negativeRe); + }; + /** + * Return true if the entry already has in the cross reader index. + */ + EntryFilter.prototype.isDuplicateEntry = function (entry) { + return this.index.has(entry.path); + }; + /** + * Create record in the cross reader index. + */ + EntryFilter.prototype.createIndexRecord = function (entry) { + this.index.set(entry.path, undefined); + }; + /** + * Returns true for non-files if the «onlyFiles» option is enabled. + */ + EntryFilter.prototype.onlyFileFilter = function (entry) { + return this.options.onlyFiles && !entry.isFile(); + }; + /** + * Returns true for non-directories if the «onlyDirectories» option is enabled. + */ + EntryFilter.prototype.onlyDirectoryFilter = function (entry) { + return this.options.onlyDirectories && !entry.isDirectory(); + }; + /** + * Return true when `absolute` option is enabled and matched to the negative patterns. + */ + EntryFilter.prototype.isSkippedByAbsoluteNegativePatterns = function (entry, negativeRe) { + if (!this.options.absolute) { + return false; + } + var fullpath = pathUtils.makeAbsolute(this.options.cwd, entry.path); + return this.isMatchToPatterns(fullpath, negativeRe); + }; + /** + * Return true when entry match to provided patterns. + * + * First, just trying to apply patterns to the path. + * Second, trying to apply patterns to the path with final slash (need to micromatch to support «directory/**» patterns). + */ + EntryFilter.prototype.isMatchToPatterns = function (filepath, patternsRe) { + return patternUtils.matchAny(filepath, patternsRe) || patternUtils.matchAny(filepath + '/', patternsRe); + }; + return EntryFilter; +}()); +exports.default = EntryFilter; - return c -} -GlobSync.prototype._mark = function (p) { - return common.mark(this, p) -} +/***/ }), +/* 895 */ +/***/ (function(module, exports, __webpack_require__) { -GlobSync.prototype._makeAbs = function (f) { - return common.makeAbs(this, f) -} +"use strict"; + +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var stream = __webpack_require__(27); +var fsStat = __webpack_require__(896); +var fs_1 = __webpack_require__(900); +var FileSystemStream = /** @class */ (function (_super) { + __extends(FileSystemStream, _super); + function FileSystemStream() { + return _super !== null && _super.apply(this, arguments) || this; + } + /** + * Use stream API to read entries for Task. + */ + FileSystemStream.prototype.read = function (patterns, filter) { + var _this = this; + var filepaths = patterns.map(this.getFullEntryPath, this); + var transform = new stream.Transform({ objectMode: true }); + transform._transform = function (index, _enc, done) { + return _this.getEntry(filepaths[index], patterns[index]).then(function (entry) { + if (entry !== null && filter(entry)) { + transform.push(entry); + } + if (index === filepaths.length - 1) { + transform.end(); + } + done(); + }); + }; + for (var i = 0; i < filepaths.length; i++) { + transform.write(i); + } + return transform; + }; + /** + * Return entry for the provided path. + */ + FileSystemStream.prototype.getEntry = function (filepath, pattern) { + var _this = this; + return this.getStat(filepath) + .then(function (stat) { return _this.makeEntry(stat, pattern); }) + .catch(function () { return null; }); + }; + /** + * Return fs.Stats for the provided path. + */ + FileSystemStream.prototype.getStat = function (filepath) { + return fsStat.stat(filepath, { throwErrorOnBrokenSymlinks: false }); + }; + return FileSystemStream; +}(fs_1.default)); +exports.default = FileSystemStream; /***/ }), -/* 718 */ +/* 896 */ /***/ (function(module, exports, __webpack_require__) { -exports.alphasort = alphasort -exports.alphasorti = alphasorti -exports.setopts = setopts -exports.ownProp = ownProp -exports.makeAbs = makeAbs -exports.finish = finish -exports.mark = mark -exports.isIgnored = isIgnored -exports.childrenIgnored = childrenIgnored +"use strict"; -function ownProp (obj, field) { - return Object.prototype.hasOwnProperty.call(obj, field) +Object.defineProperty(exports, "__esModule", { value: true }); +const optionsManager = __webpack_require__(897); +const statProvider = __webpack_require__(899); +/** + * Asynchronous API. + */ +function stat(path, opts) { + return new Promise((resolve, reject) => { + statProvider.async(path, optionsManager.prepare(opts), (err, stats) => err ? reject(err) : resolve(stats)); + }); } - -var path = __webpack_require__(16) -var minimatch = __webpack_require__(505) -var isAbsolute = __webpack_require__(511) -var Minimatch = minimatch.Minimatch - -function alphasorti (a, b) { - return a.toLowerCase().localeCompare(b.toLowerCase()) +exports.stat = stat; +function statCallback(path, optsOrCallback, callback) { + if (typeof optsOrCallback === 'function') { + callback = optsOrCallback; /* tslint:disable-line: no-parameter-reassignment */ + optsOrCallback = undefined; /* tslint:disable-line: no-parameter-reassignment */ + } + if (typeof callback === 'undefined') { + throw new TypeError('The "callback" argument must be of type Function.'); + } + statProvider.async(path, optionsManager.prepare(optsOrCallback), callback); } - -function alphasort (a, b) { - return a.localeCompare(b) +exports.statCallback = statCallback; +/** + * Synchronous API. + */ +function statSync(path, opts) { + return statProvider.sync(path, optionsManager.prepare(opts)); } +exports.statSync = statSync; -function setupIgnores (self, options) { - self.ignore = options.ignore || [] - - if (!Array.isArray(self.ignore)) - self.ignore = [self.ignore] - if (self.ignore.length) { - self.ignore = self.ignore.map(ignoreMap) - } -} +/***/ }), +/* 897 */ +/***/ (function(module, exports, __webpack_require__) { -// ignore patterns are always in dot:true mode. -function ignoreMap (pattern) { - var gmatcher = null - if (pattern.slice(-3) === '/**') { - var gpattern = pattern.replace(/(\/\*\*)+$/, '') - gmatcher = new Minimatch(gpattern, { dot: true }) - } +"use strict"; - return { - matcher: new Minimatch(pattern, { dot: true }), - gmatcher: gmatcher - } +Object.defineProperty(exports, "__esModule", { value: true }); +const fsAdapter = __webpack_require__(898); +function prepare(opts) { + const options = Object.assign({ + fs: fsAdapter.getFileSystemAdapter(opts ? opts.fs : undefined), + throwErrorOnBrokenSymlinks: true, + followSymlinks: true + }, opts); + return options; } +exports.prepare = prepare; -function setopts (self, pattern, options) { - if (!options) - options = {} - - // base-matching: just use globstar for that. - if (options.matchBase && -1 === pattern.indexOf("/")) { - if (options.noglobstar) { - throw new Error("base matching requires globstar") - } - pattern = "**/" + pattern - } - - self.silent = !!options.silent - self.pattern = pattern - self.strict = options.strict !== false - self.realpath = !!options.realpath - self.realpathCache = options.realpathCache || Object.create(null) - self.follow = !!options.follow - self.dot = !!options.dot - self.mark = !!options.mark - self.nodir = !!options.nodir - if (self.nodir) - self.mark = true - self.sync = !!options.sync - self.nounique = !!options.nounique - self.nonull = !!options.nonull - self.nosort = !!options.nosort - self.nocase = !!options.nocase - self.stat = !!options.stat - self.noprocess = !!options.noprocess - self.absolute = !!options.absolute - self.maxLength = options.maxLength || Infinity - self.cache = options.cache || Object.create(null) - self.statCache = options.statCache || Object.create(null) - self.symlinks = options.symlinks || Object.create(null) +/***/ }), +/* 898 */ +/***/ (function(module, exports, __webpack_require__) { - setupIgnores(self, options) +"use strict"; - self.changedCwd = false - var cwd = process.cwd() - if (!ownProp(options, "cwd")) - self.cwd = cwd - else { - self.cwd = path.resolve(options.cwd) - self.changedCwd = self.cwd !== cwd - } +Object.defineProperty(exports, "__esModule", { value: true }); +const fs = __webpack_require__(23); +exports.FILE_SYSTEM_ADAPTER = { + lstat: fs.lstat, + stat: fs.stat, + lstatSync: fs.lstatSync, + statSync: fs.statSync +}; +function getFileSystemAdapter(fsMethods) { + if (!fsMethods) { + return exports.FILE_SYSTEM_ADAPTER; + } + return Object.assign({}, exports.FILE_SYSTEM_ADAPTER, fsMethods); +} +exports.getFileSystemAdapter = getFileSystemAdapter; - self.root = options.root || path.resolve(self.cwd, "/") - self.root = path.resolve(self.root) - if (process.platform === "win32") - self.root = self.root.replace(/\\/g, "/") - // TODO: is an absolute `cwd` supposed to be resolved against `root`? - // e.g. { cwd: '/test', root: __dirname } === path.join(__dirname, '/test') - self.cwdAbs = isAbsolute(self.cwd) ? self.cwd : makeAbs(self, self.cwd) - if (process.platform === "win32") - self.cwdAbs = self.cwdAbs.replace(/\\/g, "/") - self.nomount = !!options.nomount +/***/ }), +/* 899 */ +/***/ (function(module, exports, __webpack_require__) { - // disable comments and negation in Minimatch. - // Note that they are not supported in Glob itself anyway. - options.nonegate = true - options.nocomment = true +"use strict"; - self.minimatch = new Minimatch(pattern, options) - self.options = self.minimatch.options +Object.defineProperty(exports, "__esModule", { value: true }); +function sync(path, options) { + const lstat = options.fs.lstatSync(path); + if (!isFollowedSymlink(lstat, options)) { + return lstat; + } + try { + const stat = options.fs.statSync(path); + stat.isSymbolicLink = () => true; + return stat; + } + catch (err) { + if (!options.throwErrorOnBrokenSymlinks) { + return lstat; + } + throw err; + } } +exports.sync = sync; +function async(path, options, callback) { + options.fs.lstat(path, (err0, lstat) => { + if (err0) { + return callback(err0, undefined); + } + if (!isFollowedSymlink(lstat, options)) { + return callback(null, lstat); + } + options.fs.stat(path, (err1, stat) => { + if (err1) { + return options.throwErrorOnBrokenSymlinks ? callback(err1) : callback(null, lstat); + } + stat.isSymbolicLink = () => true; + callback(null, stat); + }); + }); +} +exports.async = async; +/** + * Returns `true` for followed symlink. + */ +function isFollowedSymlink(stat, options) { + return stat.isSymbolicLink() && options.followSymlinks; +} +exports.isFollowedSymlink = isFollowedSymlink; -function finish (self) { - var nou = self.nounique - var all = nou ? [] : Object.create(null) - - for (var i = 0, l = self.matches.length; i < l; i ++) { - var matches = self.matches[i] - if (!matches || Object.keys(matches).length === 0) { - if (self.nonull) { - // do like the shell, and spit out the literal glob - var literal = self.minimatch.globSet[i] - if (nou) - all.push(literal) - else - all[literal] = true - } - } else { - // had matches - var m = Object.keys(matches) - if (nou) - all.push.apply(all, m) - else - m.forEach(function (m) { - all[m] = true - }) - } - } - if (!nou) - all = Object.keys(all) +/***/ }), +/* 900 */ +/***/ (function(module, exports, __webpack_require__) { - if (!self.nosort) - all = all.sort(self.nocase ? alphasorti : alphasort) +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var path = __webpack_require__(16); +var FileSystem = /** @class */ (function () { + function FileSystem(options) { + this.options = options; + } + /** + * Return full path to entry. + */ + FileSystem.prototype.getFullEntryPath = function (filepath) { + return path.resolve(this.options.cwd, filepath); + }; + /** + * Return an implementation of the Entry interface. + */ + FileSystem.prototype.makeEntry = function (stat, pattern) { + stat.path = pattern; + stat.depth = pattern.split('/').length; + return stat; + }; + return FileSystem; +}()); +exports.default = FileSystem; - // at *some* point we statted all of these - if (self.mark) { - for (var i = 0; i < all.length; i++) { - all[i] = self._mark(all[i]) - } - if (self.nodir) { - all = all.filter(function (e) { - var notDir = !(/\/$/.test(e)) - var c = self.cache[e] || self.cache[makeAbs(self, e)] - if (notDir && c) - notDir = c !== 'DIR' && !Array.isArray(c) - return notDir - }) - } - } - if (self.ignore.length) - all = all.filter(function(m) { - return !isIgnored(self, m) - }) +/***/ }), +/* 901 */ +/***/ (function(module, exports, __webpack_require__) { - self.found = all -} +"use strict"; + +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var stream = __webpack_require__(27); +var readdir = __webpack_require__(878); +var reader_1 = __webpack_require__(891); +var fs_stream_1 = __webpack_require__(895); +var TransformStream = /** @class */ (function (_super) { + __extends(TransformStream, _super); + function TransformStream(reader) { + var _this = _super.call(this, { objectMode: true }) || this; + _this.reader = reader; + return _this; + } + TransformStream.prototype._transform = function (entry, _encoding, callback) { + callback(null, this.reader.transform(entry)); + }; + return TransformStream; +}(stream.Transform)); +var ReaderStream = /** @class */ (function (_super) { + __extends(ReaderStream, _super); + function ReaderStream() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(ReaderStream.prototype, "fsAdapter", { + /** + * Returns FileSystem adapter. + */ + get: function () { + return new fs_stream_1.default(this.options); + }, + enumerable: true, + configurable: true + }); + /** + * Use stream API to read entries for Task. + */ + ReaderStream.prototype.read = function (task) { + var _this = this; + var root = this.getRootDirectory(task); + var options = this.getReaderOptions(task); + var transform = new TransformStream(this); + var readable = this.api(root, task, options); + return readable + .on('error', function (err) { return _this.isEnoentCodeError(err) ? null : transform.emit('error', err); }) + .pipe(transform); + }; + /** + * Returns founded paths. + */ + ReaderStream.prototype.api = function (root, task, options) { + if (task.dynamic) { + return this.dynamicApi(root, options); + } + return this.staticApi(task, options); + }; + /** + * Api for dynamic tasks. + */ + ReaderStream.prototype.dynamicApi = function (root, options) { + return readdir.readdirStreamStat(root, options); + }; + /** + * Api for static tasks. + */ + ReaderStream.prototype.staticApi = function (task, options) { + return this.fsAdapter.read(task.patterns, options.filter); + }; + return ReaderStream; +}(reader_1.default)); +exports.default = ReaderStream; -function mark (self, p) { - var abs = makeAbs(self, p) - var c = self.cache[abs] - var m = p - if (c) { - var isDir = c === 'DIR' || Array.isArray(c) - var slash = p.slice(-1) === '/' - if (isDir && !slash) - m += '/' - else if (!isDir && slash) - m = m.slice(0, -1) +/***/ }), +/* 902 */ +/***/ (function(module, exports, __webpack_require__) { - if (m !== p) { - var mabs = makeAbs(self, m) - self.statCache[mabs] = self.statCache[abs] - self.cache[mabs] = self.cache[abs] - } - } +"use strict"; + +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var readdir = __webpack_require__(878); +var reader_1 = __webpack_require__(891); +var fs_sync_1 = __webpack_require__(903); +var ReaderSync = /** @class */ (function (_super) { + __extends(ReaderSync, _super); + function ReaderSync() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(ReaderSync.prototype, "fsAdapter", { + /** + * Returns FileSystem adapter. + */ + get: function () { + return new fs_sync_1.default(this.options); + }, + enumerable: true, + configurable: true + }); + /** + * Use sync API to read entries for Task. + */ + ReaderSync.prototype.read = function (task) { + var root = this.getRootDirectory(task); + var options = this.getReaderOptions(task); + try { + var entries = this.api(root, task, options); + return entries.map(this.transform, this); + } + catch (err) { + if (this.isEnoentCodeError(err)) { + return []; + } + throw err; + } + }; + /** + * Returns founded paths. + */ + ReaderSync.prototype.api = function (root, task, options) { + if (task.dynamic) { + return this.dynamicApi(root, options); + } + return this.staticApi(task, options); + }; + /** + * Api for dynamic tasks. + */ + ReaderSync.prototype.dynamicApi = function (root, options) { + return readdir.readdirSyncStat(root, options); + }; + /** + * Api for static tasks. + */ + ReaderSync.prototype.staticApi = function (task, options) { + return this.fsAdapter.read(task.patterns, options.filter); + }; + return ReaderSync; +}(reader_1.default)); +exports.default = ReaderSync; - return m -} -// lotta situps... -function makeAbs (self, f) { - var abs = f - if (f.charAt(0) === '/') { - abs = path.join(self.root, f) - } else if (isAbsolute(f) || f === '') { - abs = f - } else if (self.changedCwd) { - abs = path.resolve(self.cwd, f) - } else { - abs = path.resolve(f) - } +/***/ }), +/* 903 */ +/***/ (function(module, exports, __webpack_require__) { - if (process.platform === 'win32') - abs = abs.replace(/\\/g, '/') +"use strict"; + +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var fsStat = __webpack_require__(896); +var fs_1 = __webpack_require__(900); +var FileSystemSync = /** @class */ (function (_super) { + __extends(FileSystemSync, _super); + function FileSystemSync() { + return _super !== null && _super.apply(this, arguments) || this; + } + /** + * Use sync API to read entries for Task. + */ + FileSystemSync.prototype.read = function (patterns, filter) { + var _this = this; + var entries = []; + patterns.forEach(function (pattern) { + var filepath = _this.getFullEntryPath(pattern); + var entry = _this.getEntry(filepath, pattern); + if (entry === null || !filter(entry)) { + return; + } + entries.push(entry); + }); + return entries; + }; + /** + * Return entry for the provided path. + */ + FileSystemSync.prototype.getEntry = function (filepath, pattern) { + try { + var stat = this.getStat(filepath); + return this.makeEntry(stat, pattern); + } + catch (err) { + return null; + } + }; + /** + * Return fs.Stats for the provided path. + */ + FileSystemSync.prototype.getStat = function (filepath) { + return fsStat.statSync(filepath, { throwErrorOnBrokenSymlinks: false }); + }; + return FileSystemSync; +}(fs_1.default)); +exports.default = FileSystemSync; - return abs -} +/***/ }), +/* 904 */ +/***/ (function(module, exports, __webpack_require__) { -// Return true, if pattern ends with globstar '**', for the accompanying parent directory. -// Ex:- If node_modules/** is the pattern, add 'node_modules' to ignore list along with it's contents -function isIgnored (self, path) { - if (!self.ignore.length) - return false +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +/** + * Flatten nested arrays (max depth is 2) into a non-nested array of non-array items. + */ +function flatten(items) { + return items.reduce(function (collection, item) { return [].concat(collection, item); }, []); +} +exports.flatten = flatten; - return self.ignore.some(function(item) { - return item.matcher.match(path) || !!(item.gmatcher && item.gmatcher.match(path)) - }) -} -function childrenIgnored (self, path) { - if (!self.ignore.length) - return false +/***/ }), +/* 905 */ +/***/ (function(module, exports, __webpack_require__) { - return self.ignore.some(function(item) { - return !!(item.gmatcher && item.gmatcher.match(path)) - }) -} +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var merge2 = __webpack_require__(590); +/** + * Merge multiple streams and propagate their errors into one stream in parallel. + */ +function merge(streams) { + var mergedStream = merge2(streams); + streams.forEach(function (stream) { + stream.on('error', function (err) { return mergedStream.emit('error', err); }); + }); + return mergedStream; +} +exports.merge = merge; /***/ }), -/* 719 */ +/* 906 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; const path = __webpack_require__(16); -const pathType = __webpack_require__(720); +const pathType = __webpack_require__(907); const getExtensions = extensions => extensions.length > 1 ? `{${extensions.join(',')}}` : extensions[0]; @@ -81870,13 +105865,13 @@ module.exports.sync = (input, opts) => { /***/ }), -/* 720 */ +/* 907 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; const fs = __webpack_require__(23); -const pify = __webpack_require__(721); +const pify = __webpack_require__(908); function type(fn, fn2, fp) { if (typeof fp !== 'string') { @@ -81919,7 +105914,7 @@ exports.symlinkSync = typeSync.bind(null, 'lstatSync', 'isSymbolicLink'); /***/ }), -/* 721 */ +/* 908 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -82010,17 +106005,17 @@ module.exports = (obj, opts) => { /***/ }), -/* 722 */ +/* 909 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; const fs = __webpack_require__(23); const path = __webpack_require__(16); -const fastGlob = __webpack_require__(596); -const gitIgnore = __webpack_require__(723); -const pify = __webpack_require__(724); -const slash = __webpack_require__(725); +const fastGlob = __webpack_require__(718); +const gitIgnore = __webpack_require__(910); +const pify = __webpack_require__(911); +const slash = __webpack_require__(912); const DEFAULT_IGNORE = [ '**/node_modules/**', @@ -82118,7 +106113,7 @@ module.exports.sync = options => { /***/ }), -/* 723 */ +/* 910 */ /***/ (function(module, exports) { // A simple implementation of make-array @@ -82587,7 +106582,7 @@ module.exports = options => new IgnoreBase(options) /***/ }), -/* 724 */ +/* 911 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -82662,7 +106657,7 @@ module.exports = (input, options) => { /***/ }), -/* 725 */ +/* 912 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -82680,17 +106675,17 @@ module.exports = input => { /***/ }), -/* 726 */ +/* 913 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; const path = __webpack_require__(16); const {constants: fsConstants} = __webpack_require__(23); -const pEvent = __webpack_require__(727); -const CpFileError = __webpack_require__(730); -const fs = __webpack_require__(734); -const ProgressEmitter = __webpack_require__(737); +const pEvent = __webpack_require__(914); +const CpFileError = __webpack_require__(917); +const fs = __webpack_require__(921); +const ProgressEmitter = __webpack_require__(924); const cpFileAsync = async (source, destination, options, progressEmitter) => { let readError; @@ -82804,12 +106799,12 @@ module.exports.sync = (source, destination, options) => { /***/ }), -/* 727 */ +/* 914 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const pTimeout = __webpack_require__(728); +const pTimeout = __webpack_require__(915); const symbolAsyncIterator = Symbol.asyncIterator || '@@asyncIterator'; @@ -83100,12 +107095,12 @@ module.exports.iterator = (emitter, event, options) => { /***/ }), -/* 728 */ +/* 915 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const pFinally = __webpack_require__(729); +const pFinally = __webpack_require__(916); class TimeoutError extends Error { constructor(message) { @@ -83151,7 +107146,7 @@ module.exports.TimeoutError = TimeoutError; /***/ }), -/* 729 */ +/* 916 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -83173,12 +107168,12 @@ module.exports = (promise, onFinally) => { /***/ }), -/* 730 */ +/* 917 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const NestedError = __webpack_require__(731); +const NestedError = __webpack_require__(918); class CpFileError extends NestedError { constructor(message, nested) { @@ -83192,10 +107187,10 @@ module.exports = CpFileError; /***/ }), -/* 731 */ +/* 918 */ /***/ (function(module, exports, __webpack_require__) { -var inherits = __webpack_require__(732); +var inherits = __webpack_require__(919); var NestedError = function (message, nested) { this.nested = nested; @@ -83246,7 +107241,7 @@ module.exports = NestedError; /***/ }), -/* 732 */ +/* 919 */ /***/ (function(module, exports, __webpack_require__) { try { @@ -83254,12 +107249,12 @@ try { if (typeof util.inherits !== 'function') throw ''; module.exports = util.inherits; } catch (e) { - module.exports = __webpack_require__(733); + module.exports = __webpack_require__(920); } /***/ }), -/* 733 */ +/* 920 */ /***/ (function(module, exports) { if (typeof Object.create === 'function') { @@ -83288,16 +107283,16 @@ if (typeof Object.create === 'function') { /***/ }), -/* 734 */ +/* 921 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; const {promisify} = __webpack_require__(29); const fs = __webpack_require__(22); -const makeDir = __webpack_require__(735); -const pEvent = __webpack_require__(727); -const CpFileError = __webpack_require__(730); +const makeDir = __webpack_require__(922); +const pEvent = __webpack_require__(914); +const CpFileError = __webpack_require__(917); const stat = promisify(fs.stat); const lstat = promisify(fs.lstat); @@ -83394,7 +107389,7 @@ exports.copyFileSync = (source, destination, flags) => { /***/ }), -/* 735 */ +/* 922 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -83402,7 +107397,7 @@ exports.copyFileSync = (source, destination, flags) => { const fs = __webpack_require__(23); const path = __webpack_require__(16); const {promisify} = __webpack_require__(29); -const semver = __webpack_require__(736); +const semver = __webpack_require__(923); const defaults = { mode: 0o777 & (~process.umask()), @@ -83551,7 +107546,7 @@ module.exports.sync = (input, options) => { /***/ }), -/* 736 */ +/* 923 */ /***/ (function(module, exports) { exports = module.exports = SemVer @@ -85153,7 +109148,7 @@ function coerce (version, options) { /***/ }), -/* 737 */ +/* 924 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -85194,7 +109189,7 @@ module.exports = ProgressEmitter; /***/ }), -/* 738 */ +/* 925 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -85240,12 +109235,12 @@ exports.default = module.exports; /***/ }), -/* 739 */ +/* 926 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const NestedError = __webpack_require__(740); +const NestedError = __webpack_require__(927); class CpyError extends NestedError { constructor(message, nested) { @@ -85259,7 +109254,7 @@ module.exports = CpyError; /***/ }), -/* 740 */ +/* 927 */ /***/ (function(module, exports, __webpack_require__) { var inherits = __webpack_require__(29).inherits; @@ -85315,7 +109310,7 @@ module.exports = NestedError; /***/ }), -/* 741 */ +/* 928 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; diff --git a/x-pack/legacy/plugins/siem/common/graphql/root/schema.gql.ts b/x-pack/legacy/plugins/siem/common/graphql/root/schema.gql.ts index 721270d1d6fcd..1665334827e8e 100644 --- a/x-pack/legacy/plugins/siem/common/graphql/root/schema.gql.ts +++ b/x-pack/legacy/plugins/siem/common/graphql/root/schema.gql.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { gql } from '@apollo/client'; +import gql from 'graphql-tag'; export const rootSchema = gql` schema { diff --git a/x-pack/legacy/plugins/siem/common/graphql/shared/schema.gql.ts b/x-pack/legacy/plugins/siem/common/graphql/shared/schema.gql.ts index 43c87caa9f181..d043c1587d3c3 100644 --- a/x-pack/legacy/plugins/siem/common/graphql/shared/schema.gql.ts +++ b/x-pack/legacy/plugins/siem/common/graphql/shared/schema.gql.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { gql } from '@apollo/client'; +import gql from 'graphql-tag'; export const sharedSchema = gql` input TimerangeInput { diff --git a/x-pack/legacy/plugins/siem/public/app/app.tsx b/x-pack/legacy/plugins/siem/public/app/app.tsx index c65b016068f9d..7413aeab549db 100644 --- a/x-pack/legacy/plugins/siem/public/app/app.tsx +++ b/x-pack/legacy/plugins/siem/public/app/app.tsx @@ -6,7 +6,7 @@ import { createHashHistory, History } from 'history'; import React, { memo, useMemo, FC } from 'react'; -import { ApolloProvider } from '@apollo/client'; +import { ApolloProvider } from 'react-apollo'; import { Store } from 'redux'; import { Provider as ReduxStoreProvider } from 'react-redux'; import { ThemeProvider } from 'styled-components'; @@ -30,6 +30,8 @@ import { createStore, createInitialState } from '../store'; import { GlobalToaster, ManageGlobalToaster } from '../components/toasters'; import { MlCapabilitiesProvider } from '../components/ml/permissions/ml_capabilities_provider'; +import { ApolloClientContext } from '../utils/apollo_context'; + interface AppPluginRootComponentProps { apolloClient: AppApolloClient; history: History; @@ -46,13 +48,15 @@ const AppPluginRootComponent: React.FC = ({ - - - - - - - + + + + + + + + + diff --git a/x-pack/legacy/plugins/siem/public/components/drag_and_drop/drag_drop_context_wrapper.test.tsx b/x-pack/legacy/plugins/siem/public/components/drag_and_drop/drag_drop_context_wrapper.test.tsx index efe5aed46f16a..9e8bde8d9ff92 100644 --- a/x-pack/legacy/plugins/siem/public/components/drag_and_drop/drag_drop_context_wrapper.test.tsx +++ b/x-pack/legacy/plugins/siem/public/components/drag_and_drop/drag_drop_context_wrapper.test.tsx @@ -6,7 +6,7 @@ import { mount, shallow } from 'enzyme'; import React from 'react'; -import { MockedProvider } from '@apollo/client/testing'; +import { MockedProvider } from 'react-apollo/test-utils'; import { mockBrowserFields, mocksSource } from '../../containers/source/mock'; import { TestProviders } from '../../mock'; @@ -20,7 +20,7 @@ describe('DragDropContextWrapper', () => { const wrapper = shallow( - + {message} diff --git a/x-pack/legacy/plugins/siem/public/components/drag_and_drop/draggable_wrapper.test.tsx b/x-pack/legacy/plugins/siem/public/components/drag_and_drop/draggable_wrapper.test.tsx index 92adc1a9adb7a..e846c923c5cbe 100644 --- a/x-pack/legacy/plugins/siem/public/components/drag_and_drop/draggable_wrapper.test.tsx +++ b/x-pack/legacy/plugins/siem/public/components/drag_and_drop/draggable_wrapper.test.tsx @@ -6,7 +6,7 @@ import { shallow } from 'enzyme'; import React from 'react'; -import { MockedProvider } from '@apollo/client/testing'; +import { MockedProvider } from 'react-apollo/test-utils'; import { mockBrowserFields, mocksSource } from '../../containers/source/mock'; import { TestProviders } from '../../mock'; @@ -24,7 +24,7 @@ describe('DraggableWrapper', () => { test('it renders against the snapshot', () => { const wrapper = shallow( - + message} /> diff --git a/x-pack/legacy/plugins/siem/public/components/drag_and_drop/droppable_wrapper.test.tsx b/x-pack/legacy/plugins/siem/public/components/drag_and_drop/droppable_wrapper.test.tsx index aa3ad8f47af21..bd2f01721290f 100644 --- a/x-pack/legacy/plugins/siem/public/components/drag_and_drop/droppable_wrapper.test.tsx +++ b/x-pack/legacy/plugins/siem/public/components/drag_and_drop/droppable_wrapper.test.tsx @@ -6,7 +6,7 @@ import { shallow } from 'enzyme'; import React from 'react'; -import { MockedProvider } from '@apollo/client/testing'; +import { MockedProvider } from 'react-apollo/test-utils'; import { mockBrowserFields, mocksSource } from '../../containers/source/mock'; import { TestProviders } from '../../mock'; @@ -24,7 +24,7 @@ describe('DroppableWrapper', () => { const wrapper = shallow( - + {message} diff --git a/x-pack/legacy/plugins/siem/public/components/event_details/columns.tsx b/x-pack/legacy/plugins/siem/public/components/event_details/columns.tsx index c62f44e1c5e31..e9903ce66d799 100644 --- a/x-pack/legacy/plugins/siem/public/components/event_details/columns.tsx +++ b/x-pack/legacy/plugins/siem/public/components/event_details/columns.tsx @@ -20,7 +20,7 @@ import { Draggable } from 'react-beautiful-dnd'; import styled from 'styled-components'; import { BrowserFields } from '../../containers/source'; -import { Scalars } from '../../graphql/types'; +import { ToStringArray } from '../../graphql/types'; import { WithCopyToClipboard } from '../../lib/clipboard/with_copy_to_clipboard'; import { ColumnHeaderOptions } from '../../store/timeline/model'; import { DragEffects } from '../drag_and_drop/draggable_wrapper'; @@ -159,7 +159,7 @@ export const getColumns = ({ name: i18n.VALUE, sortable: true, truncateText: false, - render: (values: Scalars['ToStringArray'] | null | undefined, data: EventFieldsData) => ( + render: (values: ToStringArray | null | undefined, data: EventFieldsData) => ( {values != null && values.map((value, i) => ( diff --git a/x-pack/legacy/plugins/siem/public/components/event_details/helpers.tsx b/x-pack/legacy/plugins/siem/public/components/event_details/helpers.tsx index ef002abbd252d..5d9c9d82490bb 100644 --- a/x-pack/legacy/plugins/siem/public/components/event_details/helpers.tsx +++ b/x-pack/legacy/plugins/siem/public/components/event_details/helpers.tsx @@ -12,7 +12,7 @@ import { DEFAULT_DATE_COLUMN_MIN_WIDTH, DEFAULT_COLUMN_MIN_WIDTH, } from '../timeline/body/constants'; -import { Scalars } from '../../graphql/types'; +import { ToStringArray } from '../../graphql/types'; import * as i18n from './translations'; @@ -40,7 +40,7 @@ export interface Item { field: JSX.Element; fieldId: string; type: string; - values: Scalars['ToStringArray']; + values: ToStringArray; } export const getColumnHeaderFromBrowserField = ({ diff --git a/x-pack/legacy/plugins/siem/public/components/events_viewer/events_viewer.test.tsx b/x-pack/legacy/plugins/siem/public/components/events_viewer/events_viewer.test.tsx index 756944b83c316..d3cdf9886e469 100644 --- a/x-pack/legacy/plugins/siem/public/components/events_viewer/events_viewer.test.tsx +++ b/x-pack/legacy/plugins/siem/public/components/events_viewer/events_viewer.test.tsx @@ -5,8 +5,7 @@ */ import React from 'react'; -import { MockedProvider } from '@apollo/client/testing'; -import { act } from '@testing-library/react'; +import { MockedProvider } from 'react-apollo/test-utils'; import useResizeObserver from 'use-resize-observer/polyfilled'; import { mockIndexPattern, TestProviders } from '../../mock'; @@ -53,7 +52,7 @@ describe('EventsViewer', () => { ); - await act(() => wait()); + await wait(); wrapper.update(); expect( @@ -78,7 +77,7 @@ describe('EventsViewer', () => { ); - await act(() => wait()); + await wait(); wrapper.update(); expect( @@ -103,7 +102,7 @@ describe('EventsViewer', () => { ); - await act(() => wait()); + await wait(); wrapper.update(); expect( @@ -129,7 +128,7 @@ describe('EventsViewer', () => { ); - await act(() => wait()); + await wait(); wrapper.update(); defaultHeaders.forEach(h => diff --git a/x-pack/legacy/plugins/siem/public/components/events_viewer/events_viewer.tsx b/x-pack/legacy/plugins/siem/public/components/events_viewer/events_viewer.tsx index f460ea24d5447..a913186d9ad3b 100644 --- a/x-pack/legacy/plugins/siem/public/components/events_viewer/events_viewer.tsx +++ b/x-pack/legacy/plugins/siem/public/components/events_viewer/events_viewer.tsx @@ -201,6 +201,7 @@ const EventsViewerComponent: React.FC = ({ getUpdatedAt={getUpdatedAt} hasNextPage={getOr(false, 'hasNextPage', pageInfo)!} height={footerHeight} + isEventViewer={true} isLive={isLive} isLoading={loading} itemsCount={events.length} @@ -242,7 +243,7 @@ export const EventsViewer = React.memo( prevProps.kqlMode === nextProps.kqlMode && deepEqual(prevProps.query, nextProps.query) && prevProps.start === nextProps.start && - deepEqual(prevProps.sort, nextProps.sort) && + prevProps.sort === nextProps.sort && deepEqual(prevProps.timelineTypeContext, nextProps.timelineTypeContext) && prevProps.utilityBar === nextProps.utilityBar ); diff --git a/x-pack/legacy/plugins/siem/public/components/events_viewer/index.test.tsx b/x-pack/legacy/plugins/siem/public/components/events_viewer/index.test.tsx index 034579b9d157e..6f614c1e32f65 100644 --- a/x-pack/legacy/plugins/siem/public/components/events_viewer/index.test.tsx +++ b/x-pack/legacy/plugins/siem/public/components/events_viewer/index.test.tsx @@ -5,8 +5,7 @@ */ import React from 'react'; -import { MockedProvider } from '@apollo/client/testing'; -import { act } from '@testing-library/react'; +import { MockedProvider } from 'react-apollo/test-utils'; import useResizeObserver from 'use-resize-observer/polyfilled'; import { wait } from '../../lib/helpers'; @@ -52,7 +51,7 @@ describe('StatefulEventsViewer', () => { ); - await act(() => wait()); + await wait(); wrapper.update(); expect( @@ -78,7 +77,7 @@ describe('StatefulEventsViewer', () => { ); - await act(() => wait()); + await wait(); wrapper.update(); expect(wrapper.find(`InspectButtonContainer`).exists()).toBe(true); diff --git a/x-pack/legacy/plugins/siem/public/components/flyout/index.tsx b/x-pack/legacy/plugins/siem/public/components/flyout/index.tsx index 139dcd1943fad..22fc9f27ce26c 100644 --- a/x-pack/legacy/plugins/siem/public/components/flyout/index.tsx +++ b/x-pack/legacy/plugins/siem/public/components/flyout/index.tsx @@ -9,7 +9,6 @@ import { defaultTo, getOr } from 'lodash/fp'; import React, { useCallback } from 'react'; import { connect, ConnectedProps } from 'react-redux'; import styled from 'styled-components'; -import deepEqual from 'fast-deep-equal'; import { State, timelineSelectors } from '../../store'; import { DataProvider } from '../timeline/data_providers/data_provider'; @@ -91,17 +90,7 @@ export const FlyoutComponent = React.memo( /> ); - }, - (prevProps, nextProps) => - prevProps.children === nextProps.children && - deepEqual(prevProps.dataProviders, nextProps.dataProviders) && - prevProps.flyoutHeight === nextProps.flyoutHeight && - prevProps.headerHeight === nextProps.headerHeight && - prevProps.show === nextProps.show && - prevProps.showTimeline === nextProps.showTimeline && - prevProps.timelineId === nextProps.timelineId && - prevProps.usersViewing === nextProps.usersViewing && - prevProps.width === nextProps.width + } ); FlyoutComponent.displayName = 'FlyoutComponent'; diff --git a/x-pack/legacy/plugins/siem/public/components/header_global/__snapshots__/index.test.tsx.snap b/x-pack/legacy/plugins/siem/public/components/header_global/__snapshots__/index.test.tsx.snap index 6b4af62586c19..25374c63fa897 100644 --- a/x-pack/legacy/plugins/siem/public/components/header_global/__snapshots__/index.test.tsx.snap +++ b/x-pack/legacy/plugins/siem/public/components/header_global/__snapshots__/index.test.tsx.snap @@ -9,106 +9,11 @@ exports[`HeaderGlobal it renders 1`] = ` justifyContent="spaceBetween" wrap={true} > - - - - - - - - - - - - - - - - - - - - Add data - - - - + + `; diff --git a/x-pack/legacy/plugins/siem/public/components/header_global/index.test.tsx b/x-pack/legacy/plugins/siem/public/components/header_global/index.test.tsx index 6c20daeab4cbc..098de39bbfef5 100644 --- a/x-pack/legacy/plugins/siem/public/components/header_global/index.test.tsx +++ b/x-pack/legacy/plugins/siem/public/components/header_global/index.test.tsx @@ -17,15 +17,10 @@ jest.mock('ui/new_platform'); jest.mock('../search_bar', () => ({ SiemSearchBar: () => null, })); -jest.mock('../../containers/source', () => ({ - useWithSource: () => ({ - contentAvailable: true, - }), -})); describe('HeaderGlobal', () => { test('it renders', () => { - const wrapper = shallow(); + const wrapper = shallow(); expect(wrapper).toMatchSnapshot(); }); diff --git a/x-pack/legacy/plugins/siem/public/components/header_global/index.tsx b/x-pack/legacy/plugins/siem/public/components/header_global/index.tsx index 55c67a5af69ea..a12fab8a4f5d9 100644 --- a/x-pack/legacy/plugins/siem/public/components/header_global/index.tsx +++ b/x-pack/legacy/plugins/siem/public/components/header_global/index.tsx @@ -16,6 +16,7 @@ import { getOverviewUrl } from '../link_to'; import { MlPopover } from '../ml_popover/ml_popover'; import { SiemNavigation } from '../navigation'; import * as i18n from './translations'; +import { indicesExistOrDataTemporarilyUnavailable, WithSource } from '../../containers/source'; const Wrapper = styled.header` ${({ theme }) => css` @@ -33,64 +34,65 @@ const FlexItem = styled(EuiFlexItem)` FlexItem.displayName = 'FlexItem'; interface HeaderGlobalProps { - contentAvailable: boolean; hideDetectionEngine?: boolean; } -export const HeaderGlobal = React.memo( - ({ contentAvailable, hideDetectionEngine = false }) => ( - - - <> - - - - - - - +export const HeaderGlobal = React.memo(({ hideDetectionEngine = false }) => ( + + + + {({ indicesExist }) => ( + <> + + + + + + + - - {contentAvailable ? ( - key !== SiemPageName.detections, navTabs) - : navTabs - } - /> - ) : ( - key === SiemPageName.overview, navTabs)} - /> + + {indicesExistOrDataTemporarilyUnavailable(indicesExist) ? ( + key !== SiemPageName.detections, navTabs) + : navTabs + } + /> + ) : ( + key === SiemPageName.overview, navTabs)} + /> + )} + + + + + + + {indicesExistOrDataTemporarilyUnavailable(indicesExist) && ( + + + )} - - - - - - {contentAvailable && ( - + + {i18n.BUTTON_ADD_DATA} + - )} - - - - {i18n.BUTTON_ADD_DATA} - - - - - - - - ) -); + + + + )} + + + +)); HeaderGlobal.displayName = 'HeaderGlobal'; diff --git a/x-pack/legacy/plugins/siem/public/components/link_to/index.ts b/x-pack/legacy/plugins/siem/public/components/link_to/index.ts index a1c1f78e398e3..c93b415e017bb 100644 --- a/x-pack/legacy/plugins/siem/public/components/link_to/index.ts +++ b/x-pack/legacy/plugins/siem/public/components/link_to/index.ts @@ -17,8 +17,6 @@ export { getCaseDetailsUrl, getCaseUrl, getCreateCaseUrl, - getConfigureCasesUrl, RedirectToCasePage, RedirectToCreatePage, - RedirectToConfigureCasesPage, } from './redirect_to_case'; diff --git a/x-pack/legacy/plugins/siem/public/components/link_to/link_to.tsx b/x-pack/legacy/plugins/siem/public/components/link_to/link_to.tsx index 08e4d1a3494e0..c08b429dc4625 100644 --- a/x-pack/legacy/plugins/siem/public/components/link_to/link_to.tsx +++ b/x-pack/legacy/plugins/siem/public/components/link_to/link_to.tsx @@ -20,11 +20,7 @@ import { RedirectToHostsPage, RedirectToHostDetailsPage } from './redirect_to_ho import { RedirectToNetworkPage } from './redirect_to_network'; import { RedirectToOverviewPage } from './redirect_to_overview'; import { RedirectToTimelinesPage } from './redirect_to_timelines'; -import { - RedirectToCasePage, - RedirectToCreatePage, - RedirectToConfigureCasesPage, -} from './redirect_to_case'; +import { RedirectToCasePage, RedirectToCreatePage } from './redirect_to_case'; import { DetectionEngineTab } from '../../pages/detection_engine/types'; interface LinkToPageProps { @@ -47,11 +43,6 @@ export const LinkToPage = React.memo(({ match }) => ( component={RedirectToCreatePage} path={`${match.url}/:pageName(${SiemPageName.case})/create`} /> - ; -export const RedirectToConfigureCasesPage = () => ( - -); const baseCaseUrl = `#/link-to/${SiemPageName.case}`; export const getCaseUrl = () => baseCaseUrl; export const getCaseDetailsUrl = (detailName: string) => `${baseCaseUrl}/${detailName}`; export const getCreateCaseUrl = () => `${baseCaseUrl}/create`; -export const getConfigureCasesUrl = () => `${baseCaseUrl}/configure`; diff --git a/x-pack/legacy/plugins/siem/public/components/open_timeline/helpers.ts b/x-pack/legacy/plugins/siem/public/components/open_timeline/helpers.ts index 3dd1b145e7d09..4f7d6cd64f1d9 100644 --- a/x-pack/legacy/plugins/siem/public/components/open_timeline/helpers.ts +++ b/x-pack/legacy/plugins/siem/public/components/open_timeline/helpers.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { ApolloClient } from '@apollo/client'; +import ApolloClient from 'apollo-client'; import { getOr, set } from 'lodash/fp'; import { Action } from 'typescript-fsa'; diff --git a/x-pack/legacy/plugins/siem/public/components/open_timeline/index.test.tsx b/x-pack/legacy/plugins/siem/public/components/open_timeline/index.test.tsx index d3911fdf18f09..520e2094fb336 100644 --- a/x-pack/legacy/plugins/siem/public/components/open_timeline/index.test.tsx +++ b/x-pack/legacy/plugins/siem/public/components/open_timeline/index.test.tsx @@ -6,15 +6,14 @@ import euiDarkVars from '@elastic/eui/dist/eui_theme_dark.json'; import { mount } from 'enzyme'; -import { MockedProvider } from '@apollo/client/testing'; +import { MockedProvider } from 'react-apollo/test-utils'; import React from 'react'; import { ThemeProvider } from 'styled-components'; -import { act } from '@testing-library/react'; import { wait } from '../../lib/helpers'; -import { TestProviderWithoutDragAndDrop } from '../../mock/test_providers'; -import { mockOpenTimelineQueryResults, MockedProvidedQuery } from '../../mock/timeline_results'; -import { DEFAULT_SEARCH_RESULTS_PER_PAGE } from '../../pages/timelines'; +import { TestProviderWithoutDragAndDrop, apolloClient } from '../../mock/test_providers'; +import { mockOpenTimelineQueryResults } from '../../mock/timeline_results'; +import { DEFAULT_SEARCH_RESULTS_PER_PAGE } from '../../pages/timelines/timelines_page'; import { StatefulOpenTimeline } from '.'; import { NotePreviews } from './note_previews'; @@ -25,19 +24,15 @@ jest.mock('../../lib/kibana'); describe('StatefulOpenTimeline', () => { const theme = () => ({ eui: euiDarkVars, darkMode: true }); const title = 'All Timelines / Open Timelines'; - let mocks: MockedProvidedQuery[]; - - beforeEach(() => { - mocks = mockOpenTimelineQueryResults; - }); test('it has the expected initial state', () => { const wrapper = mount( - + { }); describe('#onQueryChange', () => { - test('it updates the query state with the expected trimmed value when the user enters a query', async () => { + test('it updates the query state with the expected trimmed value when the user enters a query', () => { const wrapper = mount( - + { ); - wrapper .find('[data-test-subj="search-bar"] input') .simulate('keyup', { keyCode: 13, target: { value: ' abcd ' } }); - expect( wrapper .find('[data-test-subj="search-row"]') @@ -98,8 +92,9 @@ describe('StatefulOpenTimeline', () => { const wrapper = mount( - + { ); - await act(() => wait()); + await wait(); wrapper .find('[data-test-subj="search-bar"] input') @@ -127,8 +122,9 @@ describe('StatefulOpenTimeline', () => { const wrapper = mount( - + { ); - await act(() => wait()); + await wait(); wrapper .find('[data-test-subj="search-bar"] input') @@ -158,8 +154,9 @@ describe('StatefulOpenTimeline', () => { const wrapper = mount( - + { ); - await act(() => wait()); + await wait(); expect( wrapper @@ -188,8 +185,9 @@ describe('StatefulOpenTimeline', () => { const wrapper = mount( - + { ); - await act(() => wait()); + await wait(); wrapper .find('.euiCheckbox__input') @@ -233,8 +231,9 @@ describe('StatefulOpenTimeline', () => { const wrapper = mount( - + { ); - await act(() => wait()); + await wait(); wrapper .find('.euiCheckbox__input') @@ -275,9 +274,10 @@ describe('StatefulOpenTimeline', () => { const wrapper = mount( - + { ); - await act(() => wait()); + await wait(); wrapper .find('.euiCheckbox__input') @@ -308,9 +308,10 @@ describe('StatefulOpenTimeline', () => { const wrapper = mount( - + { const wrapper = mount( - + { const wrapper = mount( - + { ); - await act(() => wait()); + await wait(); wrapper.update(); expect( @@ -420,11 +423,10 @@ describe('StatefulOpenTimeline', () => { '10849df0-7b44-11e9-a608-ab3d811609': ( ({ - ...note, - savedObjectId: note.noteId, - })) + mockOpenTimelineQueryResults[0].result.data!.getAllTimeline.timeline[0].notes != null + ? mockOpenTimelineQueryResults[0].result.data!.getAllTimeline.timeline[0].notes.map( + note => ({ ...note, savedObjectId: note.noteId }) + ) : [] } /> @@ -436,9 +438,10 @@ describe('StatefulOpenTimeline', () => { const wrapper = mount( - + { ); - await act(() => wait()); + await wait(); wrapper.update(); @@ -471,9 +474,10 @@ describe('StatefulOpenTimeline', () => { const wrapper = mount( - + { ); - await act(() => wait()); + await wait(); expect( wrapper @@ -493,14 +497,15 @@ describe('StatefulOpenTimeline', () => { ).toEqual(title); }); - describe.skip('#resetSelectionState', () => { + describe('#resetSelectionState', () => { test('when the user deletes selected timelines, resetSelectionState is invoked to clear the selection state', async () => { const wrapper = mount( - + { .find('[data-test-subj="open-timeline"]') .last() .prop('selectedItems'); - await act(() => wait()); + await wait(); expect(getSelectedItem().length).toEqual(0); wrapper .find('.euiCheckbox__input') @@ -532,10 +537,11 @@ describe('StatefulOpenTimeline', () => { test('it renders the expected count of matching timelines when no query has been entered', async () => { const wrapper = mount( - + { ); - await act(() => wait()); + await wait(); wrapper.update(); - await act(() => wait()); - expect( wrapper .find('[data-test-subj="query-message"]') @@ -566,9 +570,10 @@ describe('StatefulOpenTimeline', () => { const wrapper = mount( - + { ); - await act(() => wait()); + await wait(); wrapper .find( - `[data-test-subj="title-${mocks[0].result.data!.getAllTimeline.timeline[0].savedObjectId}"]` + `[data-test-subj="title-${ + mockOpenTimelineQueryResults[0].result.data!.getAllTimeline.timeline[0].savedObjectId + }"]` ) .first() .simulate('click'); expect(onOpenTimeline).toHaveBeenCalledWith({ duplicate: false, - timelineId: mocks[0].result.data!.getAllTimeline.timeline[0].savedObjectId, + timelineId: mockOpenTimelineQueryResults[0].result.data!.getAllTimeline.timeline[0] + .savedObjectId, }); }); @@ -600,9 +608,10 @@ describe('StatefulOpenTimeline', () => { const wrapper = mount( - + { ); - await act(() => wait()); + await wait(); wrapper .find('[data-test-subj="open-duplicate"]') diff --git a/x-pack/legacy/plugins/siem/public/components/open_timeline/index.tsx b/x-pack/legacy/plugins/siem/public/components/open_timeline/index.tsx index 455a60b89b9ab..26a7487fee52b 100644 --- a/x-pack/legacy/plugins/siem/public/components/open_timeline/index.tsx +++ b/x-pack/legacy/plugins/siem/public/components/open_timeline/index.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { useApolloClient } from '@apollo/client'; +import ApolloClient from 'apollo-client'; import React, { useEffect, useState, useCallback } from 'react'; import { connect, ConnectedProps } from 'react-redux'; @@ -43,6 +43,7 @@ import { import { DEFAULT_SORT_FIELD, DEFAULT_SORT_DIRECTION } from './constants'; interface OwnProps { + apolloClient: ApolloClient; /** Displays open timeline in modal */ isModal: boolean; closeModalTimeline?: () => void; @@ -67,6 +68,7 @@ export const getSelectedTimelineIds = (selectedItems: OpenTimelineResult[]): str /** Manages the state (e.g table selection) of the (pure) `OpenTimeline` component */ export const StatefulOpenTimelineComponent = React.memo( ({ + apolloClient, closeModalTimeline, createNewTimeline, defaultPageSize, @@ -78,7 +80,6 @@ export const StatefulOpenTimelineComponent = React.memo( updateTimeline, updateIsLoading, }) => { - const apolloClient = useApolloClient(); /** Required by EuiTable for expandable rows: a map of `TimelineResult.savedObjectId` to rendered notes */ const [itemIdToExpandedNotesRowMap, setItemIdToExpandedNotesRowMap] = useState< Record diff --git a/x-pack/legacy/plugins/siem/public/components/open_timeline/open_timeline.test.tsx b/x-pack/legacy/plugins/siem/public/components/open_timeline/open_timeline.test.tsx index 6df1039b68716..a1ca7812bba34 100644 --- a/x-pack/legacy/plugins/siem/public/components/open_timeline/open_timeline.test.tsx +++ b/x-pack/legacy/plugins/siem/public/components/open_timeline/open_timeline.test.tsx @@ -10,7 +10,7 @@ import { mountWithIntl } from 'test_utils/enzyme_helpers'; import React from 'react'; import { ThemeProvider } from 'styled-components'; -import { DEFAULT_SEARCH_RESULTS_PER_PAGE } from '../../pages/timelines'; +import { DEFAULT_SEARCH_RESULTS_PER_PAGE } from '../../pages/timelines/timelines_page'; import { OpenTimelineResult } from './types'; import { TimelinesTableProps } from './timelines_table'; import { mockTimelineResults } from '../../mock/timeline_results'; diff --git a/x-pack/legacy/plugins/siem/public/components/open_timeline/open_timeline_modal/index.test.tsx b/x-pack/legacy/plugins/siem/public/components/open_timeline/open_timeline_modal/index.test.tsx index 4d9ecd0d6052f..ca8fa50c572fe 100644 --- a/x-pack/legacy/plugins/siem/public/components/open_timeline/open_timeline_modal/index.test.tsx +++ b/x-pack/legacy/plugins/siem/public/components/open_timeline/open_timeline_modal/index.test.tsx @@ -7,9 +7,8 @@ import euiDarkVars from '@elastic/eui/dist/eui_theme_dark.json'; import { mount } from 'enzyme'; import React from 'react'; -import { MockedProvider } from '@apollo/client/testing'; +import { MockedProvider } from 'react-apollo/test-utils'; import { ThemeProvider } from 'styled-components'; -import { act } from '@testing-library/react'; import { wait } from '../../../lib/helpers'; import { TestProviderWithoutDragAndDrop } from '../../../mock/test_providers'; @@ -18,6 +17,9 @@ import { mockOpenTimelineQueryResults } from '../../../mock/timeline_results'; import { OpenTimelineModal } from '.'; jest.mock('../../../lib/kibana'); +jest.mock('../../../utils/apollo_context', () => ({ + useApolloClient: () => ({}), +})); describe('OpenTimelineModal', () => { const theme = () => ({ eui: euiDarkVars, darkMode: true }); @@ -33,7 +35,7 @@ describe('OpenTimelineModal', () => { ); - await act(() => wait()); + await wait(); wrapper.update(); diff --git a/x-pack/legacy/plugins/siem/public/components/open_timeline/open_timeline_modal/index.tsx b/x-pack/legacy/plugins/siem/public/components/open_timeline/open_timeline_modal/index.tsx index 5f5792efc1eb8..c530929a3c96e 100644 --- a/x-pack/legacy/plugins/siem/public/components/open_timeline/open_timeline_modal/index.tsx +++ b/x-pack/legacy/plugins/siem/public/components/open_timeline/open_timeline_modal/index.tsx @@ -8,6 +8,7 @@ import { EuiModal, EuiOverlayMask } from '@elastic/eui'; import React from 'react'; import { TimelineModel } from '../../../store/timeline/model'; +import { useApolloClient } from '../../../utils/apollo_context'; import * as i18n from '../translations'; import { ActionTimelineToShow } from '../types'; @@ -24,24 +25,31 @@ const DEFAULT_SEARCH_RESULTS_PER_PAGE = 10; const OPEN_TIMELINE_MODAL_WIDTH = 1000; // px export const OpenTimelineModal = React.memo( - ({ hideActions = [], modalTitle, onClose, onOpen }) => ( - - - - - - ) + ({ hideActions = [], modalTitle, onClose, onOpen }) => { + const apolloClient = useApolloClient(); + + if (!apolloClient) return null; + + return ( + + + + + + ); + } ); OpenTimelineModal.displayName = 'OpenTimelineModal'; diff --git a/x-pack/legacy/plugins/siem/public/components/open_timeline/open_timeline_modal/open_timeline_modal_body.test.tsx b/x-pack/legacy/plugins/siem/public/components/open_timeline/open_timeline_modal/open_timeline_modal_body.test.tsx index df24a43057a18..2c3adb138b7ac 100644 --- a/x-pack/legacy/plugins/siem/public/components/open_timeline/open_timeline_modal/open_timeline_modal_body.test.tsx +++ b/x-pack/legacy/plugins/siem/public/components/open_timeline/open_timeline_modal/open_timeline_modal_body.test.tsx @@ -10,7 +10,7 @@ import { mountWithIntl } from 'test_utils/enzyme_helpers'; import React from 'react'; import { ThemeProvider } from 'styled-components'; -import { DEFAULT_SEARCH_RESULTS_PER_PAGE } from '../../../pages/timelines'; +import { DEFAULT_SEARCH_RESULTS_PER_PAGE } from '../../../pages/timelines/timelines_page'; import { OpenTimelineResult } from '../types'; import { TimelinesTableProps } from '../timelines_table'; import { mockTimelineResults } from '../../../mock/timeline_results'; diff --git a/x-pack/legacy/plugins/siem/public/components/open_timeline/open_timeline_modal/open_timeline_modal_button.test.tsx b/x-pack/legacy/plugins/siem/public/components/open_timeline/open_timeline_modal/open_timeline_modal_button.test.tsx index cafcc031f7a81..66947a313f5e5 100644 --- a/x-pack/legacy/plugins/siem/public/components/open_timeline/open_timeline_modal/open_timeline_modal_button.test.tsx +++ b/x-pack/legacy/plugins/siem/public/components/open_timeline/open_timeline_modal/open_timeline_modal_button.test.tsx @@ -7,9 +7,8 @@ import euiDarkVars from '@elastic/eui/dist/eui_theme_dark.json'; import { mount } from 'enzyme'; import React from 'react'; -import { MockedProvider } from '@apollo/client/testing'; +import { MockedProvider } from 'react-apollo/test-utils'; import { ThemeProvider } from 'styled-components'; -import { act } from '@testing-library/react'; import { wait } from '../../../lib/helpers'; import { TestProviderWithoutDragAndDrop } from '../../../mock/test_providers'; @@ -30,7 +29,7 @@ describe('OpenTimelineModalButton', () => { ); - await act(() => wait()); + await wait(); wrapper.update(); @@ -55,7 +54,7 @@ describe('OpenTimelineModalButton', () => { ); - await act(() => wait()); + await wait(); wrapper .find('[data-test-subj="open-timeline-button"]') diff --git a/x-pack/legacy/plugins/siem/public/components/open_timeline/timelines_table/actions_columns.test.tsx b/x-pack/legacy/plugins/siem/public/components/open_timeline/timelines_table/actions_columns.test.tsx index 26e0aa1ff5751..eec11f571328f 100644 --- a/x-pack/legacy/plugins/siem/public/components/open_timeline/timelines_table/actions_columns.test.tsx +++ b/x-pack/legacy/plugins/siem/public/components/open_timeline/timelines_table/actions_columns.test.tsx @@ -11,7 +11,7 @@ import { mountWithIntl } from 'test_utils/enzyme_helpers'; import React from 'react'; import { ThemeProvider } from 'styled-components'; -import { DEFAULT_SEARCH_RESULTS_PER_PAGE } from '../../../pages/timelines'; +import { DEFAULT_SEARCH_RESULTS_PER_PAGE } from '../../../pages/timelines/timelines_page'; import { mockTimelineResults } from '../../../mock/timeline_results'; import { OpenTimelineResult } from '../types'; import { TimelinesTable } from '.'; diff --git a/x-pack/legacy/plugins/siem/public/components/open_timeline/timelines_table/common_columns.test.tsx b/x-pack/legacy/plugins/siem/public/components/open_timeline/timelines_table/common_columns.test.tsx index bd5da06a37bbc..0f2cda9d79f0b 100644 --- a/x-pack/legacy/plugins/siem/public/components/open_timeline/timelines_table/common_columns.test.tsx +++ b/x-pack/legacy/plugins/siem/public/components/open_timeline/timelines_table/common_columns.test.tsx @@ -11,7 +11,7 @@ import React from 'react'; import { ThemeProvider } from 'styled-components'; import { mountWithIntl } from 'test_utils/enzyme_helpers'; -import { DEFAULT_SEARCH_RESULTS_PER_PAGE } from '../../../pages/timelines'; +import { DEFAULT_SEARCH_RESULTS_PER_PAGE } from '../../../pages/timelines/timelines_page'; import { getEmptyValue } from '../../empty_value'; import { OpenTimelineResult } from '../types'; import { mockTimelineResults } from '../../../mock/timeline_results'; diff --git a/x-pack/legacy/plugins/siem/public/components/open_timeline/timelines_table/extended_columns.test.tsx b/x-pack/legacy/plugins/siem/public/components/open_timeline/timelines_table/extended_columns.test.tsx index b6554aa794f9c..4cbe1e45c473b 100644 --- a/x-pack/legacy/plugins/siem/public/components/open_timeline/timelines_table/extended_columns.test.tsx +++ b/x-pack/legacy/plugins/siem/public/components/open_timeline/timelines_table/extended_columns.test.tsx @@ -10,7 +10,7 @@ import { mountWithIntl } from 'test_utils/enzyme_helpers'; import React from 'react'; import { ThemeProvider } from 'styled-components'; -import { DEFAULT_SEARCH_RESULTS_PER_PAGE } from '../../../pages/timelines'; +import { DEFAULT_SEARCH_RESULTS_PER_PAGE } from '../../../pages/timelines/timelines_page'; import { getEmptyValue } from '../../empty_value'; import { mockTimelineResults } from '../../../mock/timeline_results'; import { OpenTimelineResult } from '../types'; diff --git a/x-pack/legacy/plugins/siem/public/components/open_timeline/timelines_table/icon_header_columns.test.tsx b/x-pack/legacy/plugins/siem/public/components/open_timeline/timelines_table/icon_header_columns.test.tsx index 3f06fbeb5921c..31377d176acac 100644 --- a/x-pack/legacy/plugins/siem/public/components/open_timeline/timelines_table/icon_header_columns.test.tsx +++ b/x-pack/legacy/plugins/siem/public/components/open_timeline/timelines_table/icon_header_columns.test.tsx @@ -10,7 +10,7 @@ import { mountWithIntl } from 'test_utils/enzyme_helpers'; import React from 'react'; import { ThemeProvider } from 'styled-components'; -import { DEFAULT_SEARCH_RESULTS_PER_PAGE } from '../../../pages/timelines'; +import { DEFAULT_SEARCH_RESULTS_PER_PAGE } from '../../../pages/timelines/timelines_page'; import { mockTimelineResults } from '../../../mock/timeline_results'; import { TimelinesTable } from '.'; import { OpenTimelineResult } from '../types'; diff --git a/x-pack/legacy/plugins/siem/public/components/open_timeline/timelines_table/index.test.tsx b/x-pack/legacy/plugins/siem/public/components/open_timeline/timelines_table/index.test.tsx index 9dc75e4c4534b..26d9607a91fcd 100644 --- a/x-pack/legacy/plugins/siem/public/components/open_timeline/timelines_table/index.test.tsx +++ b/x-pack/legacy/plugins/siem/public/components/open_timeline/timelines_table/index.test.tsx @@ -10,7 +10,7 @@ import { mountWithIntl } from 'test_utils/enzyme_helpers'; import React from 'react'; import { ThemeProvider } from 'styled-components'; -import { DEFAULT_SEARCH_RESULTS_PER_PAGE } from '../../../pages/timelines'; +import { DEFAULT_SEARCH_RESULTS_PER_PAGE } from '../../../pages/timelines/timelines_page'; import { mockTimelineResults } from '../../../mock/timeline_results'; import { OpenTimelineResult } from '../types'; import { TimelinesTable, TimelinesTableProps } from '.'; diff --git a/x-pack/legacy/plugins/siem/public/components/page/hosts/first_last_seen_host/index.test.tsx b/x-pack/legacy/plugins/siem/public/components/page/hosts/first_last_seen_host/index.test.tsx index a378c007cf56f..4a836333f3311 100644 --- a/x-pack/legacy/plugins/siem/public/components/page/hosts/first_last_seen_host/index.test.tsx +++ b/x-pack/legacy/plugins/siem/public/components/page/hosts/first_last_seen_host/index.test.tsx @@ -6,7 +6,7 @@ import { cloneDeep } from 'lodash/fp'; import React from 'react'; -import { MockedProvider } from '@apollo/client/testing'; +import { MockedProvider } from 'react-apollo/test-utils'; import { render, act } from '@testing-library/react'; import { mockFirstLastSeenHostQuery } from '../../../../containers/hosts/first_last_seen/mock'; @@ -19,6 +19,16 @@ describe('FirstLastSeen Component', () => { const firstSeen = 'Apr 8, 2019 @ 16:09:40.692'; const lastSeen = 'Apr 8, 2019 @ 18:35:45.064'; + // Suppress warnings about "react-apollo" until we migrate to apollo@3 + /* eslint-disable no-console */ + const originalError = console.error; + beforeAll(() => { + console.error = jest.fn(); + }); + afterAll(() => { + console.error = originalError; + }); + test('Loading', async () => { const { container } = render( diff --git a/x-pack/legacy/plugins/siem/public/components/page/hosts/first_last_seen_host/index.tsx b/x-pack/legacy/plugins/siem/public/components/page/hosts/first_last_seen_host/index.tsx index 3c162c559fe2f..70dff5eda5939 100644 --- a/x-pack/legacy/plugins/siem/public/components/page/hosts/first_last_seen_host/index.tsx +++ b/x-pack/legacy/plugins/siem/public/components/page/hosts/first_last_seen_host/index.tsx @@ -6,6 +6,7 @@ import { EuiIcon, EuiLoadingSpinner, EuiText, EuiToolTip } from '@elastic/eui'; import React from 'react'; +import { ApolloConsumer } from 'react-apollo'; import { useFirstLastSeenHostQuery } from '../../../../containers/hosts/first_last_seen'; import { getEmptyTagValue } from '../../../empty_value'; @@ -18,37 +19,44 @@ export enum FirstLastSeenHostType { export const FirstLastSeenHost = React.memo<{ hostname: string; type: FirstLastSeenHostType }>( ({ hostname, type }) => { - const { loading, firstSeen, lastSeen, errorMessage } = useFirstLastSeenHostQuery( - hostname, - 'default' - ); - if (errorMessage != null) { - return ( - - - - ); - } - const valueSeen = type === FirstLastSeenHostType.FIRST_SEEN ? firstSeen : lastSeen; return ( - <> - {loading && } - {!loading && valueSeen != null && new Date(valueSeen).toString() === 'Invalid Date' - ? valueSeen - : !loading && - valueSeen != null && ( - - - - )} - {!loading && valueSeen == null && getEmptyTagValue()} - + + {client => { + const { loading, firstSeen, lastSeen, errorMessage } = useFirstLastSeenHostQuery( + hostname, + 'default', + client + ); + if (errorMessage != null) { + return ( + + + + ); + } + const valueSeen = type === FirstLastSeenHostType.FIRST_SEEN ? firstSeen : lastSeen; + return ( + <> + {loading && } + {!loading && valueSeen != null && new Date(valueSeen).toString() === 'Invalid Date' + ? valueSeen + : !loading && + valueSeen != null && ( + + + + )} + {!loading && valueSeen == null && getEmptyTagValue()} + + ); + }} + ); } ); diff --git a/x-pack/legacy/plugins/siem/public/components/page/hosts/hosts_table/__snapshots__/index.test.tsx.snap b/x-pack/legacy/plugins/siem/public/components/page/hosts/hosts_table/__snapshots__/index.test.tsx.snap index 1d70f4f72ac8b..3143e680913b2 100644 --- a/x-pack/legacy/plugins/siem/public/components/page/hosts/hosts_table/__snapshots__/index.test.tsx.snap +++ b/x-pack/legacy/plugins/siem/public/components/page/hosts/hosts_table/__snapshots__/index.test.tsx.snap @@ -68,6 +68,97 @@ exports[`Hosts Table rendering it renders the default Hosts table 1`] = ` } fakeTotalCount={50} id="hostsQuery" + indexPattern={ + Object { + "fields": Array [ + Object { + "aggregatable": true, + "name": "@timestamp", + "searchable": true, + "type": "date", + }, + Object { + "aggregatable": true, + "name": "@version", + "searchable": true, + "type": "string", + }, + Object { + "aggregatable": true, + "name": "agent.ephemeral_id", + "searchable": true, + "type": "string", + }, + Object { + "aggregatable": true, + "name": "agent.hostname", + "searchable": true, + "type": "string", + }, + Object { + "aggregatable": true, + "name": "agent.id", + "searchable": true, + "type": "string", + }, + Object { + "aggregatable": true, + "name": "agent.test1", + "searchable": true, + "type": "string", + }, + Object { + "aggregatable": true, + "name": "agent.test2", + "searchable": true, + "type": "string", + }, + Object { + "aggregatable": true, + "name": "agent.test3", + "searchable": true, + "type": "string", + }, + Object { + "aggregatable": true, + "name": "agent.test4", + "searchable": true, + "type": "string", + }, + Object { + "aggregatable": true, + "name": "agent.test5", + "searchable": true, + "type": "string", + }, + Object { + "aggregatable": true, + "name": "agent.test6", + "searchable": true, + "type": "string", + }, + Object { + "aggregatable": true, + "name": "agent.test7", + "searchable": true, + "type": "string", + }, + Object { + "aggregatable": true, + "name": "agent.test8", + "searchable": true, + "type": "string", + }, + Object { + "aggregatable": true, + "name": "host.name", + "searchable": true, + "type": "string", + }, + ], + "title": "filebeat-*,auditbeat-*,packetbeat-*", + } + } isInspect={false} loadPage={[MockFunction]} loading={false} diff --git a/x-pack/legacy/plugins/siem/public/components/page/hosts/hosts_table/index.test.tsx b/x-pack/legacy/plugins/siem/public/components/page/hosts/hosts_table/index.test.tsx index cb70be5bc962c..e561594013dea 100644 --- a/x-pack/legacy/plugins/siem/public/components/page/hosts/hosts_table/index.test.tsx +++ b/x-pack/legacy/plugins/siem/public/components/page/hosts/hosts_table/index.test.tsx @@ -7,9 +7,14 @@ import { shallow } from 'enzyme'; import { getOr } from 'lodash/fp'; import React from 'react'; -import { MockedProvider } from '@apollo/client/testing'; +import { MockedProvider } from 'react-apollo/test-utils'; -import { apolloClientObservable, mockGlobalState, TestProviders } from '../../../../mock'; +import { + apolloClientObservable, + mockIndexPattern, + mockGlobalState, + TestProviders, +} from '../../../../mock'; import { useMountAppended } from '../../../../utils/use_mount_appended'; import { createStore, hostsModel, State } from '../../../../store'; import { HostsTableType } from '../../../../store/hosts/model'; @@ -44,6 +49,7 @@ describe('Hosts Table', () => { data={mockData.Hosts.edges} id="hostsQuery" isInspect={false} + indexPattern={mockIndexPattern} fakeTotalCount={getOr(50, 'fakeTotalCount', mockData.Hosts.pageInfo)} loading={false} loadPage={loadPage} @@ -66,6 +72,7 @@ describe('Hosts Table', () => { void; @@ -75,6 +78,7 @@ const HostsTableComponent = React.memo( direction, fakeTotalCount, id, + indexPattern, isInspect, limit, loading, diff --git a/x-pack/legacy/plugins/siem/public/components/page/hosts/kpi_hosts/index.tsx b/x-pack/legacy/plugins/siem/public/components/page/hosts/kpi_hosts/index.tsx index ae6c22afc53d7..65d5924821844 100644 --- a/x-pack/legacy/plugins/siem/public/components/page/hosts/kpi_hosts/index.tsx +++ b/x-pack/legacy/plugins/siem/public/components/page/hosts/kpi_hosts/index.tsx @@ -33,7 +33,9 @@ interface KpiHostDetailsProps extends GenericKpiHostProps { } const FlexGroupSpinner = styled(EuiFlexGroup)` - min-height: ${kpiWidgetHeight}px; + { + min-height: ${kpiWidgetHeight}px; + } `; FlexGroupSpinner.displayName = 'FlexGroupSpinner'; diff --git a/x-pack/legacy/plugins/siem/public/components/page/network/network_dns_table/index.test.tsx b/x-pack/legacy/plugins/siem/public/components/page/network/network_dns_table/index.test.tsx index db0121298f2f9..e425057dd0f75 100644 --- a/x-pack/legacy/plugins/siem/public/components/page/network/network_dns_table/index.test.tsx +++ b/x-pack/legacy/plugins/siem/public/components/page/network/network_dns_table/index.test.tsx @@ -7,7 +7,7 @@ import { shallow } from 'enzyme'; import { getOr } from 'lodash/fp'; import React from 'react'; -import { MockedProvider } from '@apollo/client/testing'; +import { MockedProvider } from 'react-apollo/test-utils'; import { Provider as ReduxStoreProvider } from 'react-redux'; import { apolloClientObservable, mockGlobalState, TestProviders } from '../../../../mock'; diff --git a/x-pack/legacy/plugins/siem/public/components/page/network/network_http_table/index.test.tsx b/x-pack/legacy/plugins/siem/public/components/page/network/network_http_table/index.test.tsx index e28cfa0ab6755..c4596ada5c74d 100644 --- a/x-pack/legacy/plugins/siem/public/components/page/network/network_http_table/index.test.tsx +++ b/x-pack/legacy/plugins/siem/public/components/page/network/network_http_table/index.test.tsx @@ -7,7 +7,7 @@ import { shallow } from 'enzyme'; import { getOr } from 'lodash/fp'; import React from 'react'; -import { MockedProvider } from '@apollo/client/testing'; +import { MockedProvider } from 'react-apollo/test-utils'; import { Provider as ReduxStoreProvider } from 'react-redux'; import { apolloClientObservable, mockGlobalState, TestProviders } from '../../../../mock'; diff --git a/x-pack/legacy/plugins/siem/public/components/page/network/network_top_countries_table/index.test.tsx b/x-pack/legacy/plugins/siem/public/components/page/network/network_top_countries_table/index.test.tsx index f73c4e1a02f8f..764e440a5a4be 100644 --- a/x-pack/legacy/plugins/siem/public/components/page/network/network_top_countries_table/index.test.tsx +++ b/x-pack/legacy/plugins/siem/public/components/page/network/network_top_countries_table/index.test.tsx @@ -7,7 +7,7 @@ import { shallow } from 'enzyme'; import { getOr } from 'lodash/fp'; import React from 'react'; -import { MockedProvider } from '@apollo/client/testing'; +import { MockedProvider } from 'react-apollo/test-utils'; import { Provider as ReduxStoreProvider } from 'react-redux'; import { FlowTargetSourceDest } from '../../../../graphql/types'; diff --git a/x-pack/legacy/plugins/siem/public/components/page/network/network_top_n_flow_table/index.test.tsx b/x-pack/legacy/plugins/siem/public/components/page/network/network_top_n_flow_table/index.test.tsx index 179ff4e2060bb..78e8b15005f43 100644 --- a/x-pack/legacy/plugins/siem/public/components/page/network/network_top_n_flow_table/index.test.tsx +++ b/x-pack/legacy/plugins/siem/public/components/page/network/network_top_n_flow_table/index.test.tsx @@ -7,7 +7,7 @@ import { shallow } from 'enzyme'; import { getOr } from 'lodash/fp'; import React from 'react'; -import { MockedProvider } from '@apollo/client/testing'; +import { MockedProvider } from 'react-apollo/test-utils'; import { Provider as ReduxStoreProvider } from 'react-redux'; import { FlowTargetSourceDest } from '../../../../graphql/types'; diff --git a/x-pack/legacy/plugins/siem/public/components/page/network/tls_table/index.test.tsx b/x-pack/legacy/plugins/siem/public/components/page/network/tls_table/index.test.tsx index bb35eb638fe55..81a472f3175e5 100644 --- a/x-pack/legacy/plugins/siem/public/components/page/network/tls_table/index.test.tsx +++ b/x-pack/legacy/plugins/siem/public/components/page/network/tls_table/index.test.tsx @@ -7,7 +7,7 @@ import { shallow } from 'enzyme'; import { getOr } from 'lodash/fp'; import React from 'react'; -import { MockedProvider } from '@apollo/client/testing'; +import { MockedProvider } from 'react-apollo/test-utils'; import { Provider as ReduxStoreProvider } from 'react-redux'; import { apolloClientObservable, mockGlobalState, TestProviders } from '../../../../mock'; diff --git a/x-pack/legacy/plugins/siem/public/components/page/network/users_table/index.test.tsx b/x-pack/legacy/plugins/siem/public/components/page/network/users_table/index.test.tsx index b4b88fb48da8a..8dc3704a089ea 100644 --- a/x-pack/legacy/plugins/siem/public/components/page/network/users_table/index.test.tsx +++ b/x-pack/legacy/plugins/siem/public/components/page/network/users_table/index.test.tsx @@ -7,7 +7,7 @@ import { shallow } from 'enzyme'; import { getOr } from 'lodash/fp'; import React from 'react'; -import { MockedProvider } from '@apollo/client/testing'; +import { MockedProvider } from 'react-apollo/test-utils'; import { Provider as ReduxStoreProvider } from 'react-redux'; import { FlowTarget } from '../../../../graphql/types'; diff --git a/x-pack/legacy/plugins/siem/public/components/page/overview/overview_host/index.test.tsx b/x-pack/legacy/plugins/siem/public/components/page/overview/overview_host/index.test.tsx index 2167ddd7b78a3..568cf032fb01c 100644 --- a/x-pack/legacy/plugins/siem/public/components/page/overview/overview_host/index.test.tsx +++ b/x-pack/legacy/plugins/siem/public/components/page/overview/overview_host/index.test.tsx @@ -7,13 +7,14 @@ import { cloneDeep } from 'lodash/fp'; import { mount } from 'enzyme'; import React from 'react'; -import { MockedResponse, MockedProvider } from '@apollo/client/testing'; import { apolloClientObservable, mockGlobalState, TestProviders } from '../../../../mock'; import { OverviewHost } from '.'; import { createStore, State } from '../../../../store'; import { overviewHostQuery } from '../../../../containers/overview/overview_host/index.gql_query'; +import { GetOverviewHostQuery } from '../../../../graphql/types'; +import { MockedProvider } from 'react-apollo/test-utils'; import { wait } from '../../../../lib/helpers'; jest.mock('../../../../lib/kibana'); @@ -21,7 +22,12 @@ jest.mock('../../../../lib/kibana'); const startDate = 1579553397080; const endDate = 1579639797080; -interface MockedProvidedQuery extends MockedResponse { +interface MockedProvidedQuery { + request: { + query: GetOverviewHostQuery.Query; + fetchPolicy: string; + variables: GetOverviewHostQuery.Variables; + }; result: { data: { source: unknown; @@ -33,6 +39,7 @@ const mockOpenTimelineQueryResults: MockedProvidedQuery[] = [ { request: { query: overviewHostQuery, + fetchPolicy: 'cache-and-network', variables: { sourceId: 'default', timerange: { interval: '12h', from: startDate, to: endDate }, diff --git a/x-pack/legacy/plugins/siem/public/components/page/overview/overview_network/index.test.tsx b/x-pack/legacy/plugins/siem/public/components/page/overview/overview_network/index.test.tsx index 9cefddd3c41a2..151bb444cfe75 100644 --- a/x-pack/legacy/plugins/siem/public/components/page/overview/overview_network/index.test.tsx +++ b/x-pack/legacy/plugins/siem/public/components/page/overview/overview_network/index.test.tsx @@ -7,13 +7,14 @@ import { cloneDeep } from 'lodash/fp'; import { mount } from 'enzyme'; import React from 'react'; -import { MockedProvider, MockedResponse } from '@apollo/client/testing'; import { apolloClientObservable, mockGlobalState, TestProviders } from '../../../../mock'; import { OverviewNetwork } from '.'; import { createStore, State } from '../../../../store'; import { overviewNetworkQuery } from '../../../../containers/overview/overview_network/index.gql_query'; +import { GetOverviewHostQuery } from '../../../../graphql/types'; +import { MockedProvider } from 'react-apollo/test-utils'; import { wait } from '../../../../lib/helpers'; jest.mock('../../../../lib/kibana'); @@ -21,7 +22,12 @@ jest.mock('../../../../lib/kibana'); const startDate = 1579553397080; const endDate = 1579639797080; -interface MockedProvidedQuery extends MockedResponse { +interface MockedProvidedQuery { + request: { + query: GetOverviewHostQuery.Query; + fetchPolicy: string; + variables: GetOverviewHostQuery.Variables; + }; result: { data: { source: unknown; @@ -33,6 +39,7 @@ const mockOpenTimelineQueryResults: MockedProvidedQuery[] = [ { request: { query: overviewNetworkQuery, + fetchPolicy: 'cache-and-network', variables: { sourceId: 'default', timerange: { interval: '12h', from: startDate, to: endDate }, diff --git a/x-pack/legacy/plugins/siem/public/components/page/overview/overview_network/index.tsx b/x-pack/legacy/plugins/siem/public/components/page/overview/overview_network/index.tsx index 8c6c96f6e233b..100abd997ee6b 100644 --- a/x-pack/legacy/plugins/siem/public/components/page/overview/overview_network/index.tsx +++ b/x-pack/legacy/plugins/siem/public/components/page/overview/overview_network/index.tsx @@ -50,9 +50,6 @@ const OverviewNetworkComponent: React.FC = ({ setQuery, }) => { const [defaultNumberFormat] = useUiSetting$(DEFAULT_NUMBER_FORMAT); - const title = ( - - ); return ( @@ -92,7 +89,12 @@ const OverviewNetworkComponent: React.FC = ({ <>{''} ) } - title={title} + title={ + + } > ; filterBy: FilterMode; } export type Props = OwnProps & PropsFromRedux; const StatefulRecentTimelinesComponent = React.memo( - ({ filterBy, updateIsLoading, updateTimeline }) => { - const apolloClient = useApolloClient(); + ({ apolloClient, filterBy, updateIsLoading, updateTimeline }) => { const actionDispatcher = updateIsLoading as ActionCreator<{ id: string; isLoading: boolean }>; const onOpenTimeline: OnOpenTimeline = useCallback( ({ duplicate, timelineId }: { duplicate: boolean; timelineId: string }) => { diff --git a/x-pack/legacy/plugins/siem/public/components/search_bar/index.tsx b/x-pack/legacy/plugins/siem/public/components/search_bar/index.tsx index 7f6c157fcabd6..2513004af84dd 100644 --- a/x-pack/legacy/plugins/siem/public/components/search_bar/index.tsx +++ b/x-pack/legacy/plugins/siem/public/components/search_bar/index.tsx @@ -372,7 +372,7 @@ const mapDispatchToProps = (dispatch: Dispatch) => ({ dispatch(inputsActions.setSearchBarFilter({ id, filters })), }); -const connector = connect(makeMapStateToProps, mapDispatchToProps); +export const connector = connect(makeMapStateToProps, mapDispatchToProps); type PropsFromRedux = ConnectedProps; diff --git a/x-pack/legacy/plugins/siem/public/components/stat_items/index.tsx b/x-pack/legacy/plugins/siem/public/components/stat_items/index.tsx index 17a8e961836ce..3ebcba0a85a40 100644 --- a/x-pack/legacy/plugins/siem/public/components/stat_items/index.tsx +++ b/x-pack/legacy/plugins/siem/public/components/stat_items/index.tsx @@ -18,7 +18,7 @@ import { get, getOr } from 'lodash/fp'; import React, { useState, useEffect } from 'react'; import styled from 'styled-components'; -import { KpiHostsData, KpiHostDetailsData, KpiNetworkData } from '../../graphql/types'; +import { KpiHostsData, KpiNetworkData } from '../../graphql/types'; import { AreaChart } from '../charts/areachart'; import { BarChart } from '../charts/barchart'; import { ChartSeriesData, ChartData, ChartSeriesConfigs, UpdateDateRange } from '../charts/common'; @@ -112,12 +112,12 @@ export const barchartConfigs = (config?: { onElementClick?: ElementClickListener export const addValueToFields = ( fields: StatItem[], - data: KpiHostsData | KpiHostDetailsData | KpiNetworkData + data: KpiHostsData | KpiNetworkData ): StatItem[] => fields.map(field => ({ ...field, value: get(field.key, data) })); export const addValueToAreaChart = ( fields: StatItem[], - data: KpiHostsData | KpiHostDetailsData | KpiNetworkData + data: KpiHostsData | KpiNetworkData ): ChartSeriesData[] => fields .filter(field => get(`${field.key}Histogram`, data) != null) @@ -129,7 +129,7 @@ export const addValueToAreaChart = ( export const addValueToBarChart = ( fields: StatItem[], - data: KpiHostsData | KpiHostDetailsData | KpiNetworkData + data: KpiHostsData | KpiNetworkData ): ChartSeriesData[] => { if (fields.length === 0) return []; return fields.reduce((acc: ChartSeriesData[], field: StatItem, idx: number) => { @@ -158,7 +158,7 @@ export const addValueToBarChart = ( export const useKpiMatrixStatus = ( mappings: Readonly, - data: KpiHostsData | KpiHostDetailsData | KpiNetworkData, + data: KpiHostsData | KpiNetworkData, id: string, from: number, to: number, diff --git a/x-pack/legacy/plugins/siem/public/components/super_date_picker/index.tsx b/x-pack/legacy/plugins/siem/public/components/super_date_picker/index.tsx index ff79351271cca..ad38a7d61bcba 100644 --- a/x-pack/legacy/plugins/siem/public/components/super_date_picker/index.tsx +++ b/x-pack/legacy/plugins/siem/public/components/super_date_picker/index.tsx @@ -306,7 +306,7 @@ const mapDispatchToProps = (dispatch: Dispatch) => ({ updateReduxTime: dispatchUpdateReduxTime(dispatch), }); -const connector = connect(makeMapStateToProps, mapDispatchToProps); +export const connector = connect(makeMapStateToProps, mapDispatchToProps); type PropsFromRedux = ConnectedProps; diff --git a/x-pack/legacy/plugins/siem/public/components/timeline/body/helpers.test.ts b/x-pack/legacy/plugins/siem/public/components/timeline/body/helpers.test.ts index ced2f3f76f9f0..f021bf38b56c2 100644 --- a/x-pack/legacy/plugins/siem/public/components/timeline/body/helpers.test.ts +++ b/x-pack/legacy/plugins/siem/public/components/timeline/body/helpers.test.ts @@ -11,7 +11,7 @@ import { eventHasNotes, eventIsPinned, getPinTooltip, stringifyEvent } from './h describe('helpers', () => { describe('stringifyEvent', () => { test('it omits __typename when it appears at arbitrary levels', () => { - const toStringify: Ecs = ({ + const toStringify: Ecs = { __typename: 'level 0', _id: '4', timestamp: '2018-11-08T19:03:25.937Z', @@ -54,7 +54,7 @@ describe('helpers', () => { region_name: ['neither'], country_iso_code: ['sasquatch'], }, - } as unknown) as Ecs; // as cast so that `__typename` can be added for the tests even though it is not part of ECS + } as Ecs; // as cast so that `__typename` can be added for the tests even though it is not part of ECS const expected: Ecs = { _id: '4', timestamp: '2018-11-08T19:03:25.937Z', diff --git a/x-pack/legacy/plugins/siem/public/components/timeline/body/stateful_body.tsx b/x-pack/legacy/plugins/siem/public/components/timeline/body/stateful_body.tsx index 6bea791ebd9ea..d06dcbb84ad78 100644 --- a/x-pack/legacy/plugins/siem/public/components/timeline/body/stateful_body.tsx +++ b/x-pack/legacy/plugins/siem/public/components/timeline/body/stateful_body.tsx @@ -8,7 +8,6 @@ import { noop } from 'lodash/fp'; import memoizeOne from 'memoize-one'; import React, { useCallback, useEffect } from 'react'; import { connect, ConnectedProps } from 'react-redux'; -import deepEqual from 'fast-deep-equal'; import { BrowserFields } from '../../../containers/source'; import { TimelineItem } from '../../../graphql/types'; @@ -194,7 +193,7 @@ const StatefulBodyComponent = React.memo( return ( prevProps.browserFields === nextProps.browserFields && prevProps.columnHeaders === nextProps.columnHeaders && - deepEqual(prevProps.data, nextProps.data) && + prevProps.data === nextProps.data && prevProps.eventIdToNoteIds === nextProps.eventIdToNoteIds && prevProps.notesById === nextProps.notesById && prevProps.height === nextProps.height && diff --git a/x-pack/legacy/plugins/siem/public/components/timeline/fetch_kql_timeline.tsx b/x-pack/legacy/plugins/siem/public/components/timeline/fetch_kql_timeline.tsx index 0689472cd5b96..65c539d77a16b 100644 --- a/x-pack/legacy/plugins/siem/public/components/timeline/fetch_kql_timeline.tsx +++ b/x-pack/legacy/plugins/siem/public/components/timeline/fetch_kql_timeline.tsx @@ -7,7 +7,6 @@ import { memo, useEffect } from 'react'; import { connect, ConnectedProps } from 'react-redux'; import { IIndexPattern } from 'src/plugins/data/public'; -import deepEqual from 'fast-deep-equal'; import { timelineSelectors, State } from '../../store'; import { inputsActions } from '../../store/actions'; @@ -40,14 +39,7 @@ const TimelineKqlFetchComponent = memo( }); }, [kueryFilterQueryDraft, kueryFilterQuery, id]); return null; - }, - (prevProps, nextProps) => - prevProps.id === nextProps.id && - deepEqual(prevProps.indexPattern, nextProps.indexPattern) && - prevProps.inputId === nextProps.inputId && - prevProps.kueryFilterQuery === nextProps.kueryFilterQuery && - prevProps.kueryFilterQueryDraft === nextProps.kueryFilterQueryDraft && - prevProps.setTimelineQuery === nextProps.setTimelineQuery + } ); const makeMapStateToProps = () => { @@ -66,7 +58,7 @@ const mapDispatchToProps = { setTimelineQuery: inputsActions.setQuery, }; -const connector = connect(makeMapStateToProps, mapDispatchToProps); +export const connector = connect(makeMapStateToProps, mapDispatchToProps); type PropsFromRedux = ConnectedProps; diff --git a/x-pack/legacy/plugins/siem/public/components/timeline/footer/index.tsx b/x-pack/legacy/plugins/siem/public/components/timeline/footer/index.tsx index efcc6a2b71dc9..1fcc4382c1798 100644 --- a/x-pack/legacy/plugins/siem/public/components/timeline/footer/index.tsx +++ b/x-pack/legacy/plugins/siem/public/components/timeline/footer/index.tsx @@ -177,6 +177,7 @@ interface FooterProps { getUpdatedAt: () => number; hasNextPage: boolean; height: number; + isEventViewer?: boolean; isLive: boolean; isLoading: boolean; itemsCount: number; @@ -195,6 +196,7 @@ export const FooterComponent = ({ getUpdatedAt, hasNextPage, height, + isEventViewer, isLive, isLoading, itemsCount, @@ -343,6 +345,7 @@ export const Footer = React.memo( prevProps.compact === nextProps.compact && prevProps.hasNextPage === nextProps.hasNextPage && prevProps.height === nextProps.height && + prevProps.isEventViewer === nextProps.isEventViewer && prevProps.isLive === nextProps.isLive && prevProps.isLoading === nextProps.isLoading && prevProps.itemsCount === nextProps.itemsCount && diff --git a/x-pack/legacy/plugins/siem/public/components/timeline/header/index.tsx b/x-pack/legacy/plugins/siem/public/components/timeline/header/index.tsx index bb9ee6efb9c78..81eef0efbfa5b 100644 --- a/x-pack/legacy/plugins/siem/public/components/timeline/header/index.tsx +++ b/x-pack/legacy/plugins/siem/public/components/timeline/header/index.tsx @@ -8,7 +8,6 @@ import { EuiCallOut } from '@elastic/eui'; import React from 'react'; import styled from 'styled-components'; import { IIndexPattern } from 'src/plugins/data/public'; -import deepEqual from 'fast-deep-equal'; import { Sort } from '../body/sort'; import { DataProviders } from '../data_providers'; @@ -92,19 +91,4 @@ export const TimelineHeaderComponent: React.FC = ({ ); -export const TimelineHeader = React.memo( - TimelineHeaderComponent, - (prevProps, nextProps) => - deepEqual(prevProps.browserFields, nextProps.browserFields) && - prevProps.id === nextProps.id && - deepEqual(prevProps.indexPattern, nextProps.indexPattern) && - deepEqual(prevProps.dataProviders, nextProps.dataProviders) && - prevProps.onChangeDataProviderKqlQuery === nextProps.onChangeDataProviderKqlQuery && - prevProps.onChangeDroppableAndProvider === nextProps.onChangeDroppableAndProvider && - prevProps.onDataProviderEdited === nextProps.onDataProviderEdited && - prevProps.onDataProviderRemoved === nextProps.onDataProviderRemoved && - prevProps.onToggleDataProviderEnabled === nextProps.onToggleDataProviderEnabled && - prevProps.onToggleDataProviderExcluded === nextProps.onToggleDataProviderExcluded && - prevProps.show === nextProps.show && - prevProps.showCallOutUnauthorizedMsg === nextProps.showCallOutUnauthorizedMsg -); +export const TimelineHeader = React.memo(TimelineHeaderComponent); diff --git a/x-pack/legacy/plugins/siem/public/components/timeline/helpers.tsx b/x-pack/legacy/plugins/siem/public/components/timeline/helpers.tsx index c2a571d8086a7..611d08e61be22 100644 --- a/x-pack/legacy/plugins/siem/public/components/timeline/helpers.tsx +++ b/x-pack/legacy/plugins/siem/public/components/timeline/helpers.tsx @@ -6,7 +6,6 @@ import { isEmpty, isNumber, get } from 'lodash/fp'; import memoizeOne from 'memoize-one'; -import deepEqual from 'fast-deep-equal'; import { escapeQueryValue, convertToBuildEsQuery } from '../../lib/keury'; @@ -94,68 +93,65 @@ export const buildGlobalQuery = (dataProviders: DataProvider[], browserFields: B }, '') .trim(); -export const combineQueries = memoizeOne( - ({ - config, - dataProviders, - indexPattern, - browserFields, - filters = [], - kqlQuery, - kqlMode, - start, - end, - isEventViewer, - }: { - config: EsQueryConfig; - dataProviders: DataProvider[]; - indexPattern: IIndexPattern; - browserFields: BrowserFields; - filters: Filter[]; - kqlQuery: Query; - kqlMode: string; - start: number; - end: number; - isEventViewer?: boolean; - }): { filterQuery: string } | null => { - const kuery: Query = { query: '', language: kqlQuery.language }; - if (isEmpty(dataProviders) && isEmpty(kqlQuery.query) && isEmpty(filters) && !isEventViewer) { - return null; - } else if (isEmpty(dataProviders) && isEmpty(kqlQuery.query) && isEventViewer) { - kuery.query = `@timestamp >= ${start} and @timestamp <= ${end}`; - return { - filterQuery: convertToBuildEsQuery({ config, queries: [kuery], indexPattern, filters }), - }; - } else if (isEmpty(dataProviders) && isEmpty(kqlQuery.query) && !isEmpty(filters)) { - kuery.query = `@timestamp >= ${start} and @timestamp <= ${end}`; - return { - filterQuery: convertToBuildEsQuery({ config, queries: [kuery], indexPattern, filters }), - }; - } else if (isEmpty(dataProviders) && !isEmpty(kqlQuery.query)) { - kuery.query = `(${kqlQuery.query}) and @timestamp >= ${start} and @timestamp <= ${end}`; - return { - filterQuery: convertToBuildEsQuery({ config, queries: [kuery], indexPattern, filters }), - }; - } else if (!isEmpty(dataProviders) && isEmpty(kqlQuery)) { - kuery.query = `(${buildGlobalQuery( - dataProviders, - browserFields - )}) and @timestamp >= ${start} and @timestamp <= ${end}`; - return { - filterQuery: convertToBuildEsQuery({ config, queries: [kuery], indexPattern, filters }), - }; - } - const operatorKqlQuery = kqlMode === 'filter' ? 'and' : 'or'; - const postpend = (q: string) => `${!isEmpty(q) ? ` ${operatorKqlQuery} (${q})` : ''}`; - kuery.query = `((${buildGlobalQuery(dataProviders, browserFields)})${postpend( - kqlQuery.query as string +export const combineQueries = ({ + config, + dataProviders, + indexPattern, + browserFields, + filters = [], + kqlQuery, + kqlMode, + start, + end, + isEventViewer, +}: { + config: EsQueryConfig; + dataProviders: DataProvider[]; + indexPattern: IIndexPattern; + browserFields: BrowserFields; + filters: Filter[]; + kqlQuery: Query; + kqlMode: string; + start: number; + end: number; + isEventViewer?: boolean; +}): { filterQuery: string } | null => { + const kuery: Query = { query: '', language: kqlQuery.language }; + if (isEmpty(dataProviders) && isEmpty(kqlQuery.query) && isEmpty(filters) && !isEventViewer) { + return null; + } else if (isEmpty(dataProviders) && isEmpty(kqlQuery.query) && isEventViewer) { + kuery.query = `@timestamp >= ${start} and @timestamp <= ${end}`; + return { + filterQuery: convertToBuildEsQuery({ config, queries: [kuery], indexPattern, filters }), + }; + } else if (isEmpty(dataProviders) && isEmpty(kqlQuery.query) && !isEmpty(filters)) { + kuery.query = `@timestamp >= ${start} and @timestamp <= ${end}`; + return { + filterQuery: convertToBuildEsQuery({ config, queries: [kuery], indexPattern, filters }), + }; + } else if (isEmpty(dataProviders) && !isEmpty(kqlQuery.query)) { + kuery.query = `(${kqlQuery.query}) and @timestamp >= ${start} and @timestamp <= ${end}`; + return { + filterQuery: convertToBuildEsQuery({ config, queries: [kuery], indexPattern, filters }), + }; + } else if (!isEmpty(dataProviders) && isEmpty(kqlQuery)) { + kuery.query = `(${buildGlobalQuery( + dataProviders, + browserFields )}) and @timestamp >= ${start} and @timestamp <= ${end}`; return { filterQuery: convertToBuildEsQuery({ config, queries: [kuery], indexPattern, filters }), }; - }, - deepEqual -); + } + const operatorKqlQuery = kqlMode === 'filter' ? 'and' : 'or'; + const postpend = (q: string) => `${!isEmpty(q) ? ` ${operatorKqlQuery} (${q})` : ''}`; + kuery.query = `((${buildGlobalQuery(dataProviders, browserFields)})${postpend( + kqlQuery.query as string + )}) and @timestamp >= ${start} and @timestamp <= ${end}`; + return { + filterQuery: convertToBuildEsQuery({ config, queries: [kuery], indexPattern, filters }), + }; +}; interface CalculateBodyHeightParams { /** The the height of the flyout container, which is typically the entire "page", not including the standard Kibana navigation */ @@ -168,15 +164,13 @@ interface CalculateBodyHeightParams { timelineFooterHeight?: number; } -export const calculateBodyHeight = memoizeOne( - ({ - flyoutHeight = 0, - flyoutHeaderHeight = 0, - timelineHeaderHeight = 0, - timelineFooterHeight = 0, - }: CalculateBodyHeightParams): number => - flyoutHeight - (flyoutHeaderHeight + timelineHeaderHeight + timelineFooterHeight) -); +export const calculateBodyHeight = ({ + flyoutHeight = 0, + flyoutHeaderHeight = 0, + timelineHeaderHeight = 0, + timelineFooterHeight = 0, +}: CalculateBodyHeightParams): number => + flyoutHeight - (flyoutHeaderHeight + timelineHeaderHeight + timelineFooterHeight); /** * The CSS class name of a "stateful event", which appears in both diff --git a/x-pack/legacy/plugins/siem/public/components/timeline/index.tsx b/x-pack/legacy/plugins/siem/public/components/timeline/index.tsx index 24bf36b954afe..0ce6bc16f1325 100644 --- a/x-pack/legacy/plugins/siem/public/components/timeline/index.tsx +++ b/x-pack/legacy/plugins/siem/public/components/timeline/index.tsx @@ -8,7 +8,7 @@ import React, { useEffect, useCallback, useMemo } from 'react'; import { connect, ConnectedProps } from 'react-redux'; import deepEqual from 'fast-deep-equal'; -import { useWithSource } from '../../containers/source'; +import { WithSource } from '../../containers/source'; import { useSignalIndex } from '../../containers/detection_engine/signals/use_signal_index'; import { inputsModel, inputsSelectors, State, timelineSelectors } from '../../store'; import { timelineActions } from '../../store/actions'; @@ -34,8 +34,6 @@ export interface OwnProps { type Props = OwnProps & PropsFromRedux; -const EMPTY_INDEX_TO_ADD: string[] = []; - const StatefulTimelineComponent = React.memo( ({ columns, @@ -77,7 +75,7 @@ const StatefulTimelineComponent = React.memo( ) { return [signalIndexName]; } - return EMPTY_INDEX_TO_ADD; + return []; }, [eventType, signalIndexExists, signalIndexName]); const onDataProviderRemoved: OnDataProviderRemoved = useCallback( @@ -165,40 +163,42 @@ const StatefulTimelineComponent = React.memo( } }, []); - const { indexPattern, browserFields } = useWithSource(indexToAdd); - return ( - + + {({ indexPattern, browserFields }) => ( + + )} + ); }, (prevProps, nextProps) => { diff --git a/x-pack/legacy/plugins/siem/public/components/timeline/search_or_filter/index.tsx b/x-pack/legacy/plugins/siem/public/components/timeline/search_or_filter/index.tsx index 614085d87c76e..87061bdbb5d02 100644 --- a/x-pack/legacy/plugins/siem/public/components/timeline/search_or_filter/index.tsx +++ b/x-pack/legacy/plugins/siem/public/components/timeline/search_or_filter/index.tsx @@ -228,7 +228,7 @@ const mapDispatchToProps = (dispatch: Dispatch) => ({ updateReduxTime: dispatchUpdateReduxTime(dispatch), }); -const connector = connect(makeMapStateToProps, mapDispatchToProps); +export const connector = connect(makeMapStateToProps, mapDispatchToProps); type PropsFromRedux = ConnectedProps; diff --git a/x-pack/legacy/plugins/siem/public/components/timeline/timeline.test.tsx b/x-pack/legacy/plugins/siem/public/components/timeline/timeline.test.tsx index 6bfb775496396..4c5238d213e43 100644 --- a/x-pack/legacy/plugins/siem/public/components/timeline/timeline.test.tsx +++ b/x-pack/legacy/plugins/siem/public/components/timeline/timeline.test.tsx @@ -6,7 +6,7 @@ import { shallow } from 'enzyme'; import React from 'react'; -import { MockedProvider } from '@apollo/client/testing'; +import { MockedProvider } from 'react-apollo/test-utils'; import useResizeObserver from 'use-resize-observer/polyfilled'; import { timelineQuery } from '../../containers/timeline/index.gql_query'; diff --git a/x-pack/legacy/plugins/siem/public/components/timeline/timeline.tsx b/x-pack/legacy/plugins/siem/public/components/timeline/timeline.tsx index fe6fad6ed0bca..58bbbef328ddf 100644 --- a/x-pack/legacy/plugins/siem/public/components/timeline/timeline.tsx +++ b/x-pack/legacy/plugins/siem/public/components/timeline/timeline.tsx @@ -6,7 +6,7 @@ import { EuiFlexGroup } from '@elastic/eui'; import { getOr, isEmpty } from 'lodash/fp'; -import React, { useMemo } from 'react'; +import React from 'react'; import styled from 'styled-components'; import useResizeObserver from 'use-resize-observer/polyfilled'; @@ -121,12 +121,6 @@ export const TimelineComponent: React.FC = ({ const { ref: measureRef, width = 0, height: timelineHeaderHeight = 0 } = useResizeObserver< HTMLDivElement >({}); - const bodyHeight = calculateBodyHeight({ - flyoutHeight, - flyoutHeaderHeight, - timelineHeaderHeight, - timelineFooterHeight: footerHeight, - }); const kibana = useKibana(); const combinedQueries = combineQueries({ config: esQuery.getEsQueryConfig(kibana.services.uiSettings), @@ -139,14 +133,7 @@ export const TimelineComponent: React.FC = ({ start, end, }); - const sortField = { - sortFieldId: sort.columnId, - direction: sort.sortDirection as Direction, - }; - const timelineQueryFields = useMemo(() => { - const columnsHeader = isEmpty(columns) ? defaultHeaders : columns; - return columnsHeader.map(c => c.id); - }, [columns]); + const columnsHeader = isEmpty(columns) ? defaultHeaders : columns; return ( = ({ eventType={eventType} id={id} indexToAdd={indexToAdd} - fields={timelineQueryFields} + fields={columnsHeader.map(c => c.id)} sourceId="default" limit={itemsPerPage} filterQuery={combinedQueries.filterQuery} - sortField={sortField} + sortField={{ + sortFieldId: sort.columnId, + direction: sort.sortDirection as Direction, + }} > {({ events, @@ -206,7 +196,12 @@ export const TimelineComponent: React.FC = ({ browserFields={browserFields} data={events} id={id} - height={bodyHeight} + height={calculateBodyHeight({ + flyoutHeight, + flyoutHeaderHeight, + timelineHeaderHeight, + timelineFooterHeight: footerHeight, + })} sort={sort} toggleColumn={toggleColumn} /> diff --git a/x-pack/legacy/plugins/siem/public/components/url_state/index.test.tsx b/x-pack/legacy/plugins/siem/public/components/url_state/index.test.tsx index 879c7f4553bc6..10aa388449d91 100644 --- a/x-pack/legacy/plugins/siem/public/components/url_state/index.test.tsx +++ b/x-pack/legacy/plugins/siem/public/components/url_state/index.test.tsx @@ -6,7 +6,6 @@ import { mount } from 'enzyme'; import React from 'react'; -import { MockedProvider } from '@apollo/client/testing'; import { HookWrapper } from '../../mock'; import { SiemPageName } from '../../pages/home/types'; @@ -73,11 +72,7 @@ describe('UrlStateContainer', () => { pageName, detailName, }).relativeTimeSearch.undefinedQuery; - mount( - - useUrlStateHooks(args)} /> - - ); + mount( useUrlStateHooks(args)} />); expect(mockSetRelativeRangeDatePicker.mock.calls[1][0]).toEqual({ from: 11223344556677, @@ -106,11 +101,7 @@ describe('UrlStateContainer', () => { (page, namespaceLower, namespaceUpper, examplePath, type, pageName, detailName) => { mockProps = getMockPropsObj({ page, examplePath, namespaceLower, pageName, detailName }) .absoluteTimeSearch.undefinedQuery; - mount( - - useUrlStateHooks(args)} /> - - ); + mount( useUrlStateHooks(args)} />); expect(mockSetAbsoluteRangeDatePicker.mock.calls[1][0]).toEqual({ from: 1556736012685, @@ -135,11 +126,7 @@ describe('UrlStateContainer', () => { (page, namespaceLower, namespaceUpper, examplePath, type, pageName, detailName) => { mockProps = getMockPropsObj({ page, examplePath, namespaceLower, pageName, detailName }) .relativeTimeSearch.undefinedQuery; - mount( - - useUrlStateHooks(args)} /> - - ); + mount( useUrlStateHooks(args)} />); expect(mockSetFilterQuery.mock.calls[0][0]).toEqual({ id: 'global', @@ -163,11 +150,7 @@ describe('UrlStateContainer', () => { pageName, detailName, }).noSearch.definedQuery; - mount( - - useUrlStateHooks(args)} /> - - ); + mount( useUrlStateHooks(args)} />); expect( mockHistory.replace.mock.calls[mockHistory.replace.mock.calls.length - 1][0] @@ -197,9 +180,7 @@ describe('UrlStateContainer', () => { detailName, }).relativeTimeSearch.undefinedQuery; const wrapper = mount( - - useUrlStateHooks(args)} /> - + useUrlStateHooks(args)} /> ); wrapper.setProps({ diff --git a/x-pack/legacy/plugins/siem/public/components/url_state/index.tsx b/x-pack/legacy/plugins/siem/public/components/url_state/index.tsx index 362a398999393..294e41a1faa7b 100644 --- a/x-pack/legacy/plugins/siem/public/components/url_state/index.tsx +++ b/x-pack/legacy/plugins/siem/public/components/url_state/index.tsx @@ -52,4 +52,4 @@ const UseUrlStateComponent: React.FC = props => { return ; }; -export const UseUrlState = React.memo(UseUrlStateComponent, deepEqual); +export const UseUrlState = React.memo(UseUrlStateComponent); diff --git a/x-pack/legacy/plugins/siem/public/components/url_state/index_mocked.test.tsx b/x-pack/legacy/plugins/siem/public/components/url_state/index_mocked.test.tsx index 60c253dcaf936..4adc17b32e189 100644 --- a/x-pack/legacy/plugins/siem/public/components/url_state/index_mocked.test.tsx +++ b/x-pack/legacy/plugins/siem/public/components/url_state/index_mocked.test.tsx @@ -6,7 +6,6 @@ import { mount } from 'enzyme'; import React from 'react'; -import { MockedProvider } from '@apollo/client/testing'; import { HookWrapper } from '../../mock/hook_wrapper'; import { SiemPageName } from '../../pages/home/types'; @@ -47,8 +46,7 @@ describe('UrlStateContainer - lodash.throttle mocked to test update url', () => detailName: undefined, }).noSearch.definedQuery; const wrapper = mount( - useUrlStateHooks(args)} />, - { wrappingComponent: MockedProvider } + useUrlStateHooks(args)} /> ); const newUrlState = { @@ -99,8 +97,7 @@ describe('UrlStateContainer - lodash.throttle mocked to test update url', () => detailName: undefined, }).noSearch.undefinedQuery; const wrapper = mount( - useUrlStateHooks(args)} />, - { wrappingComponent: MockedProvider } + useUrlStateHooks(args)} /> ); const newUrlState = { ...mockProps.urlState, @@ -132,8 +129,7 @@ describe('UrlStateContainer - lodash.throttle mocked to test update url', () => }).noSearch.undefinedQuery; const wrapper = mount( - useUrlStateHooks(args)} />, - { wrappingComponent: MockedProvider } + useUrlStateHooks(args)} /> ); const newUrlState = { ...mockProps.urlState, @@ -165,9 +161,7 @@ describe('UrlStateContainer - lodash.throttle mocked to test update url', () => (page, namespaceLower, namespaceUpper, examplePath, type, pageName, detailName) => { mockProps = getMockPropsObj({ page, examplePath, namespaceLower, pageName, detailName }) .noSearch.undefinedQuery; - mount( useUrlStateHooks(args)} />, { - wrappingComponent: MockedProvider, - }); + mount( useUrlStateHooks(args)} />); expect(mockHistory.replace.mock.calls[0][0]).toEqual({ hash: '', @@ -204,8 +198,7 @@ describe('UrlStateContainer - lodash.throttle mocked to test update url', () => detailName: undefined, }).noSearch.definedQuery; const wrapper = mount( - useUrlStateHooks(args)} />, - { wrappingComponent: MockedProvider } + useUrlStateHooks(args)} /> ); expect( diff --git a/x-pack/legacy/plugins/siem/public/components/url_state/types.ts b/x-pack/legacy/plugins/siem/public/components/url_state/types.ts index ebd18cdd31732..2cb1b0c96ad79 100644 --- a/x-pack/legacy/plugins/siem/public/components/url_state/types.ts +++ b/x-pack/legacy/plugins/siem/public/components/url_state/types.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { ApolloClient } from '@apollo/client'; +import ApolloClient from 'apollo-client'; import * as H from 'history'; import { ActionCreator } from 'typescript-fsa'; import { @@ -88,6 +88,9 @@ export type KeyUrlState = keyof UrlState; export interface UrlStateProps { navTabs: Record; indexPattern?: IIndexPattern; + mapToUrlState?: (value: string) => UrlState; + onChange?: (urlState: UrlState, previousUrlState: UrlState) => void; + onInitialize?: (urlState: UrlState) => void; } export interface UrlStateStateToPropsType { diff --git a/x-pack/legacy/plugins/siem/public/components/url_state/use_url_state.tsx b/x-pack/legacy/plugins/siem/public/components/url_state/use_url_state.tsx index 9d4d42e681a75..a7704e0e86970 100644 --- a/x-pack/legacy/plugins/siem/public/components/url_state/use_url_state.tsx +++ b/x-pack/legacy/plugins/siem/public/components/url_state/use_url_state.tsx @@ -6,10 +6,10 @@ import { difference, isEmpty } from 'lodash/fp'; import { useEffect, useRef, useState } from 'react'; -import { useApolloClient } from '@apollo/client'; import deepEqual from 'fast-deep-equal'; import { useKibana } from '../../lib/kibana'; +import { useApolloClient } from '../../utils/apollo_context'; import { CONSTANTS, UrlStateType } from './constants'; import { getQueryStringFromLocation, diff --git a/x-pack/legacy/plugins/siem/public/containers/authentications/index.gql_query.ts b/x-pack/legacy/plugins/siem/public/containers/authentications/index.gql_query.ts index 1e0b080af4cf1..eee35730cfdbb 100644 --- a/x-pack/legacy/plugins/siem/public/containers/authentications/index.gql_query.ts +++ b/x-pack/legacy/plugins/siem/public/containers/authentications/index.gql_query.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { gql } from '@apollo/client'; +import gql from 'graphql-tag'; export const authenticationsQuery = gql` query GetAuthenticationsQuery( diff --git a/x-pack/legacy/plugins/siem/public/containers/authentications/index.tsx b/x-pack/legacy/plugins/siem/public/containers/authentications/index.tsx index 5ada3f171e96c..6d4a88c45a768 100644 --- a/x-pack/legacy/plugins/siem/public/containers/authentications/index.tsx +++ b/x-pack/legacy/plugins/siem/public/containers/authentications/index.tsx @@ -6,6 +6,7 @@ import { getOr } from 'lodash/fp'; import React from 'react'; +import { Query } from 'react-apollo'; import { connect } from 'react-redux'; import { compose } from 'redux'; @@ -13,7 +14,6 @@ import { DEFAULT_INDEX_KEY } from '../../../common/constants'; import { AuthenticationsEdges, GetAuthenticationsQuery, - GetAuthenticationsQueryComponent, PageInfoPaginated, } from '../../graphql/types'; import { hostsModel, hostsSelectors, inputsModel, State, inputsSelectors } from '../../store'; @@ -22,6 +22,8 @@ import { generateTablePaginationOptions } from '../../components/paginated_table import { withKibana, WithKibanaProps } from '../../lib/kibana'; import { QueryTemplatePaginated, QueryTemplatePaginatedProps } from '../query_template_paginated'; +import { authenticationsQuery } from './index.gql_query'; + const ID = 'authenticationQuery'; export interface AuthenticationArgs { @@ -37,7 +39,7 @@ export interface AuthenticationArgs { } export interface OwnProps extends QueryTemplatePaginatedProps { - children: (args: AuthenticationArgs) => React.ReactElement; + children: (args: AuthenticationArgs) => React.ReactNode; type: hostsModel.HostsType; } @@ -81,7 +83,8 @@ class AuthenticationsComponentQuery extends QueryTemplatePaginated< inspect: isInspected, }; return ( - + query={authenticationsQuery} fetchPolicy={getDefaultFetchPolicy()} notifyOnNetworkStatusChange skip={skip} @@ -123,7 +126,7 @@ class AuthenticationsComponentQuery extends QueryTemplatePaginated< totalCount: getOr(-1, 'source.Authentications.totalCount', data), }); }} - + ); } } diff --git a/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/fetch_index_patterns.test.tsx b/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/fetch_index_patterns.test.tsx index bf5e60847a045..cad78ac565903 100644 --- a/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/fetch_index_patterns.test.tsx +++ b/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/fetch_index_patterns.test.tsx @@ -5,15 +5,15 @@ */ import { renderHook, act } from '@testing-library/react-hooks'; -import { useApolloClient } from '@apollo/client'; import { defaultIndexPattern } from '../../../../default_index_pattern'; +import { useApolloClient } from '../../../utils/apollo_context'; import { mocksSource } from '../../source/mock'; import { useFetchIndexPatterns, Return } from './fetch_index_patterns'; const mockUseApolloClient = useApolloClient as jest.Mock; -jest.mock('@apollo/client'); +jest.mock('../../../utils/apollo_context'); describe('useFetchIndexPatterns', () => { beforeEach(() => { diff --git a/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/fetch_index_patterns.tsx b/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/fetch_index_patterns.tsx index 1aee0e4c36807..06c4d1054bca4 100644 --- a/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/fetch_index_patterns.tsx +++ b/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/fetch_index_patterns.tsx @@ -6,7 +6,6 @@ import { isEmpty, get } from 'lodash/fp'; import { useEffect, useState, Dispatch, SetStateAction } from 'react'; -import { useApolloClient } from '@apollo/client'; import deepEqual from 'fast-deep-equal'; import { IIndexPattern } from '../../../../../../../../src/plugins/data/public'; @@ -19,6 +18,7 @@ import { import { useStateToaster } from '../../../components/toasters'; import { errorToToaster } from '../../../components/ml/api/error_to_toaster'; import { SourceQuery } from '../../../graphql/types'; +import { useApolloClient } from '../../../utils/apollo_context'; import * as i18n from './translations'; diff --git a/x-pack/legacy/plugins/siem/public/containers/errors/index.test.tsx b/x-pack/legacy/plugins/siem/public/containers/errors/index.test.tsx index 81ccb76c83fb5..e1b192df104d7 100644 --- a/x-pack/legacy/plugins/siem/public/containers/errors/index.test.tsx +++ b/x-pack/legacy/plugins/siem/public/containers/errors/index.test.tsx @@ -5,7 +5,8 @@ */ import { reTryOneTimeOnErrorHandler, errorLinkHandler } from '.'; -import { ServerError, Operation } from '@apollo/client'; +import { ServerError } from 'apollo-link-http-common'; +import { Operation } from 'apollo-link'; import { GraphQLError } from 'graphql'; import * as store from '../../store'; import { onError } from 'apollo-link-error'; diff --git a/x-pack/legacy/plugins/siem/public/containers/events/last_event_time/index.ts b/x-pack/legacy/plugins/siem/public/containers/events/last_event_time/index.ts index b4ec108c69922..9cae503d30940 100644 --- a/x-pack/legacy/plugins/siem/public/containers/events/last_event_time/index.ts +++ b/x-pack/legacy/plugins/siem/public/containers/events/last_event_time/index.ts @@ -5,18 +5,16 @@ */ import { get } from 'lodash/fp'; -import { FetchPolicy } from '@apollo/client'; +import React, { useEffect, useState } from 'react'; import { DEFAULT_INDEX_KEY } from '../../../../common/constants'; -import { - LastEventIndexKey, - LastTimeDetails, - useGetLastEventTimeQueryQuery, -} from '../../../graphql/types'; +import { GetLastEventTimeQuery, LastEventIndexKey, LastTimeDetails } from '../../../graphql/types'; import { inputsModel } from '../../../store'; +import { QueryTemplateProps } from '../../query_template'; import { useUiSetting$ } from '../../../lib/kibana'; import { LastEventTimeGqlQuery } from './last_event_time.gql_query'; +import { useApolloClient } from '../../../utils/apollo_context'; export interface LastEventTimeArgs { id: string; @@ -26,29 +24,63 @@ export interface LastEventTimeArgs { refetch: inputsModel.Refetch; } -export const useLastEventTimeQuery = ( +export interface OwnProps extends QueryTemplateProps { + children: (args: LastEventTimeArgs) => React.ReactNode; + indexKey: LastEventIndexKey; +} + +export function useLastEventTimeQuery( indexKey: LastEventIndexKey, details: LastTimeDetails, sourceId: string -) => { +) { + const [loading, updateLoading] = useState(false); + const [lastSeen, updateLastSeen] = useState(null); + const [errorMessage, updateErrorMessage] = useState(null); + const [currentIndexKey, updateCurrentIndexKey] = useState(null); const [defaultIndex] = useUiSetting$(DEFAULT_INDEX_KEY); - const options = { - query: LastEventTimeGqlQuery, - fetchPolicy: 'cache-first' as FetchPolicy, - variables: { - sourceId, - indexKey, - details, - defaultIndex, - }, - }; - - const { data, loading, error } = useGetLastEventTimeQueryQuery(options); - const lastSeen = get('source.LastEventTime.lastSeen', data); - - return { - lastSeen, - loading, - errorMessage: error?.message, - }; -}; + const apolloClient = useApolloClient(); + async function fetchLastEventTime(signal: AbortSignal) { + updateLoading(true); + if (apolloClient) { + apolloClient + .query({ + query: LastEventTimeGqlQuery, + fetchPolicy: 'cache-first', + variables: { + sourceId, + indexKey, + details, + defaultIndex, + }, + context: { + fetchOptions: { + signal, + }, + }, + }) + .then( + result => { + updateLoading(false); + updateLastSeen(get('data.source.LastEventTime.lastSeen', result)); + updateErrorMessage(null); + updateCurrentIndexKey(currentIndexKey); + }, + error => { + updateLoading(false); + updateLastSeen(null); + updateErrorMessage(error.message); + } + ); + } + } + + useEffect(() => { + const abortCtrl = new AbortController(); + const signal = abortCtrl.signal; + fetchLastEventTime(signal); + return () => abortCtrl.abort(); + }, [apolloClient, indexKey, details.hostName, details.ip]); + + return { lastSeen, loading, errorMessage }; +} diff --git a/x-pack/legacy/plugins/siem/public/containers/events/last_event_time/last_event_time.gql_query.ts b/x-pack/legacy/plugins/siem/public/containers/events/last_event_time/last_event_time.gql_query.ts index 22f56014cfb46..049c73b607b7e 100644 --- a/x-pack/legacy/plugins/siem/public/containers/events/last_event_time/last_event_time.gql_query.ts +++ b/x-pack/legacy/plugins/siem/public/containers/events/last_event_time/last_event_time.gql_query.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { gql } from '@apollo/client'; +import gql from 'graphql-tag'; export const LastEventTimeGqlQuery = gql` query GetLastEventTimeQuery( diff --git a/x-pack/legacy/plugins/siem/public/containers/events/last_event_time/mock.ts b/x-pack/legacy/plugins/siem/public/containers/events/last_event_time/mock.ts index 5e7f473b87748..ca8786077851f 100644 --- a/x-pack/legacy/plugins/siem/public/containers/events/last_event_time/mock.ts +++ b/x-pack/legacy/plugins/siem/public/containers/events/last_event_time/mock.ts @@ -4,14 +4,16 @@ * you may not use this file except in compliance with the Elastic License. */ -import { MockedResponse } from '@apollo/client/testing'; - import { defaultIndexPattern } from '../../../../default_index_pattern'; -import { LastEventIndexKey } from '../../../graphql/types'; +import { GetLastEventTimeQuery, LastEventIndexKey } from '../../../graphql/types'; import { LastEventTimeGqlQuery } from './last_event_time.gql_query'; -interface MockLastEventTimeQuery extends MockedResponse { +interface MockLastEventTimeQuery { + request: { + query: GetLastEventTimeQuery.Query; + variables: GetLastEventTimeQuery.Variables; + }; result: { data?: { source: { @@ -22,6 +24,7 @@ interface MockLastEventTimeQuery extends MockedResponse { }; }; }; + errors?: [{ message: string }]; }; } diff --git a/x-pack/legacy/plugins/siem/public/containers/global_time/index.tsx b/x-pack/legacy/plugins/siem/public/containers/global_time/index.tsx index 14cdc65ee7bb0..4632e9aee3fdd 100644 --- a/x-pack/legacy/plugins/siem/public/containers/global_time/index.tsx +++ b/x-pack/legacy/plugins/siem/public/containers/global_time/index.tsx @@ -4,10 +4,10 @@ * you may not use this file except in compliance with the Elastic License. */ -import { useCallback, useState, useEffect } from 'react'; -import { useDispatch, useSelector } from 'react-redux'; +import React, { useCallback, useState, useEffect } from 'react'; +import { connect, ConnectedProps } from 'react-redux'; -import { inputsModel, inputsSelectors } from '../../store'; +import { inputsModel, inputsSelectors, State } from '../../store'; import { inputsActions } from '../../store/actions'; interface SetQuery { @@ -25,24 +25,31 @@ export interface GlobalTimeArgs { isInitializing: boolean; } -export const useGlobalTime = () => { - const [isInitializing, setIsInitializing] = useState(true); - const dispatch = useDispatch(); - const { from, to } = useSelector(inputsSelectors.globalTimeRangeSelector); +interface OwnProps { + children: (args: GlobalTimeArgs) => React.ReactNode; +} + +type GlobalTimeProps = OwnProps & PropsFromRedux; - const deleteAllQuery = useCallback(props => dispatch(inputsActions.deleteAllQuery(props)), [ - dispatch, - ]); +export const GlobalTimeComponent: React.FC = ({ + children, + deleteAllQuery, + deleteOneQuery, + from, + to, + setGlobalQuery, +}) => { + const [isInitializing, setIsInitializing] = useState(true); const setQuery = useCallback( ({ id, inspect, loading, refetch }: SetQuery) => - dispatch(inputsActions.setQuery({ inputId: 'global', id, inspect, loading, refetch })), - [dispatch] + setGlobalQuery({ inputId: 'global', id, inspect, loading, refetch }), + [setGlobalQuery] ); const deleteQuery = useCallback( - ({ id }: { id: string }) => dispatch(inputsActions.deleteOneQuery({ inputId: 'global', id })), - [dispatch] + ({ id }: { id: string }) => deleteOneQuery({ inputId: 'global', id }), + [deleteOneQuery] ); useEffect(() => { @@ -52,13 +59,37 @@ export const useGlobalTime = () => { return () => { deleteAllQuery({ id: 'global' }); }; - }, [isInitializing, deleteAllQuery]); + }, []); + + return ( + <> + {children({ + isInitializing, + from, + to, + setQuery, + deleteQuery, + })} + + ); +}; +const mapStateToProps = (state: State) => { + const timerange: inputsModel.TimeRange = inputsSelectors.globalTimeRangeSelector(state); return { - isInitializing, - from, - to, - setQuery, - deleteQuery, + from: timerange.from, + to: timerange.to, }; }; + +const mapDispatchToProps = { + deleteAllQuery: inputsActions.deleteAllQuery, + deleteOneQuery: inputsActions.deleteOneQuery, + setGlobalQuery: inputsActions.setQuery, +}; + +export const connector = connect(mapStateToProps, mapDispatchToProps); + +type PropsFromRedux = ConnectedProps; + +export const GlobalTime = connector(React.memo(GlobalTimeComponent)); diff --git a/x-pack/legacy/plugins/siem/public/containers/helpers.ts b/x-pack/legacy/plugins/siem/public/containers/helpers.ts index a43c1c066db73..5f66e3f4b88d4 100644 --- a/x-pack/legacy/plugins/siem/public/containers/helpers.ts +++ b/x-pack/legacy/plugins/siem/public/containers/helpers.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { WatchQueryFetchPolicy } from '@apollo/client'; +import { FetchPolicy } from 'apollo-client'; import { isString } from 'lodash/fp'; import { ESQuery } from '../../common/typed_json'; @@ -12,4 +12,4 @@ import { ESQuery } from '../../common/typed_json'; export const createFilter = (filterQuery: ESQuery | string | undefined) => isString(filterQuery) ? filterQuery : JSON.stringify(filterQuery); -export const getDefaultFetchPolicy = (): WatchQueryFetchPolicy => 'cache-and-network'; +export const getDefaultFetchPolicy = (): FetchPolicy => 'cache-and-network'; diff --git a/x-pack/legacy/plugins/siem/public/containers/hosts/first_last_seen/first_last_seen.gql_query.ts b/x-pack/legacy/plugins/siem/public/containers/hosts/first_last_seen/first_last_seen.gql_query.ts index 1a794bb53bdf7..7db4f138c7794 100644 --- a/x-pack/legacy/plugins/siem/public/containers/hosts/first_last_seen/first_last_seen.gql_query.ts +++ b/x-pack/legacy/plugins/siem/public/containers/hosts/first_last_seen/first_last_seen.gql_query.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { gql } from '@apollo/client'; +import gql from 'graphql-tag'; export const HostFirstLastSeenGqlQuery = gql` query GetHostFirstLastSeenQuery($sourceId: ID!, $hostName: String!, $defaultIndex: [String!]!) { diff --git a/x-pack/legacy/plugins/siem/public/containers/hosts/first_last_seen/index.ts b/x-pack/legacy/plugins/siem/public/containers/hosts/first_last_seen/index.ts index 2fb60ebce86f7..e36da5bfbe4ee 100644 --- a/x-pack/legacy/plugins/siem/public/containers/hosts/first_last_seen/index.ts +++ b/x-pack/legacy/plugins/siem/public/containers/hosts/first_last_seen/index.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { useApolloClient } from '@apollo/client'; +import ApolloClient from 'apollo-client'; import { get } from 'lodash/fp'; import React, { useEffect, useState } from 'react'; @@ -26,16 +26,19 @@ export interface FirstLastSeenHostArgs { } export interface OwnProps extends QueryTemplateProps { - children: (args: FirstLastSeenHostArgs) => React.ReactElement; + children: (args: FirstLastSeenHostArgs) => React.ReactNode; hostName: string; } -export function useFirstLastSeenHostQuery(hostName: string, sourceId: string) { +export function useFirstLastSeenHostQuery( + hostName: string, + sourceId: string, + apolloClient: ApolloClient +) { const [loading, updateLoading] = useState(false); const [firstSeen, updateFirstSeen] = useState(null); const [lastSeen, updateLastSeen] = useState(null); const [errorMessage, updateErrorMessage] = useState(null); - const apolloClient = useApolloClient(); const [defaultIndex] = useUiSetting$(DEFAULT_INDEX_KEY); async function fetchFirstLastSeenHost(signal: AbortSignal) { diff --git a/x-pack/legacy/plugins/siem/public/containers/hosts/first_last_seen/mock.ts b/x-pack/legacy/plugins/siem/public/containers/hosts/first_last_seen/mock.ts index 22080c7a86101..2c9d418763e8e 100644 --- a/x-pack/legacy/plugins/siem/public/containers/hosts/first_last_seen/mock.ts +++ b/x-pack/legacy/plugins/siem/public/containers/hosts/first_last_seen/mock.ts @@ -4,12 +4,16 @@ * you may not use this file except in compliance with the Elastic License. */ -import { MockedResponse } from '@apollo/client/testing'; import { defaultIndexPattern } from '../../../../default_index_pattern'; +import { GetHostFirstLastSeenQuery } from '../../../graphql/types'; import { HostFirstLastSeenGqlQuery } from './first_last_seen.gql_query'; -interface MockedProvidedQuery extends MockedResponse { +interface MockedProvidedQuery { + request: { + query: GetHostFirstLastSeenQuery.Query; + variables: GetHostFirstLastSeenQuery.Variables; + }; result: { data?: { source: { @@ -20,9 +24,9 @@ interface MockedProvidedQuery extends MockedResponse { }; }; }; + errors?: [{ message: string }]; }; } - export const mockFirstLastSeenHostQuery: MockedProvidedQuery[] = [ { request: { diff --git a/x-pack/legacy/plugins/siem/public/containers/hosts/hosts_table.gql_query.ts b/x-pack/legacy/plugins/siem/public/containers/hosts/hosts_table.gql_query.ts index 555d4ede5bfcd..672ea70b09ad2 100644 --- a/x-pack/legacy/plugins/siem/public/containers/hosts/hosts_table.gql_query.ts +++ b/x-pack/legacy/plugins/siem/public/containers/hosts/hosts_table.gql_query.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { gql } from '@apollo/client'; +import gql from 'graphql-tag'; export const HostsTableQuery = gql` query GetHostsTableQuery( diff --git a/x-pack/legacy/plugins/siem/public/containers/hosts/index.tsx b/x-pack/legacy/plugins/siem/public/containers/hosts/index.tsx index ccd51534ec794..733c2224d840a 100644 --- a/x-pack/legacy/plugins/siem/public/containers/hosts/index.tsx +++ b/x-pack/legacy/plugins/siem/public/containers/hosts/index.tsx @@ -7,6 +7,7 @@ import { get, getOr } from 'lodash/fp'; import memoizeOne from 'memoize-one'; import React from 'react'; +import { Query } from 'react-apollo'; import { connect } from 'react-redux'; import { compose } from 'redux'; @@ -14,7 +15,6 @@ import { DEFAULT_INDEX_KEY } from '../../../common/constants'; import { Direction, GetHostsTableQuery, - GetHostsTableQueryComponent, HostsEdges, HostsFields, PageInfoPaginated, @@ -24,6 +24,7 @@ import { createFilter, getDefaultFetchPolicy } from '../helpers'; import { QueryTemplatePaginated, QueryTemplatePaginatedProps } from '../query_template_paginated'; import { withKibana, WithKibanaProps } from '../../lib/kibana'; +import { HostsTableQuery } from './hosts_table.gql_query'; import { generateTablePaginationOptions } from '../../components/paginated_table/helpers'; const ID = 'hostsQuery'; @@ -43,7 +44,7 @@ export interface HostsArgs { } export interface OwnProps extends QueryTemplatePaginatedProps { - children: (args: HostsArgs) => React.ReactElement; + children: (args: HostsArgs) => React.ReactNode; type: hostsModel.HostsType; startDate: number; endDate: number; @@ -109,7 +110,8 @@ class HostsComponentQuery extends QueryTemplatePaginated< inspect: isInspected, }; return ( - + query={HostsTableQuery} fetchPolicy={getDefaultFetchPolicy()} notifyOnNetworkStatusChange variables={variables} @@ -152,7 +154,7 @@ class HostsComponentQuery extends QueryTemplatePaginated< totalCount: getOr(-1, 'source.Hosts.totalCount', data), }); }} - + ); } diff --git a/x-pack/legacy/plugins/siem/public/containers/hosts/overview/host_overview.gql_query.ts b/x-pack/legacy/plugins/siem/public/containers/hosts/overview/host_overview.gql_query.ts index 7427352b49523..46794816dbf2a 100644 --- a/x-pack/legacy/plugins/siem/public/containers/hosts/overview/host_overview.gql_query.ts +++ b/x-pack/legacy/plugins/siem/public/containers/hosts/overview/host_overview.gql_query.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { gql } from '@apollo/client'; +import gql from 'graphql-tag'; export const HostOverviewQuery = gql` query GetHostOverviewQuery( diff --git a/x-pack/legacy/plugins/siem/public/containers/hosts/overview/index.tsx b/x-pack/legacy/plugins/siem/public/containers/hosts/overview/index.tsx index 14e2591f5650b..5057e872b5313 100644 --- a/x-pack/legacy/plugins/siem/public/containers/hosts/overview/index.tsx +++ b/x-pack/legacy/plugins/siem/public/containers/hosts/overview/index.tsx @@ -6,6 +6,7 @@ import { getOr } from 'lodash/fp'; import React from 'react'; +import { Query } from 'react-apollo'; import { connect } from 'react-redux'; import { compose } from 'redux'; @@ -15,11 +16,8 @@ import { getDefaultFetchPolicy } from '../../helpers'; import { QueryTemplate, QueryTemplateProps } from '../../query_template'; import { withKibana, WithKibanaProps } from '../../../lib/kibana'; -import { - GetHostOverviewQuery, - GetHostOverviewQueryComponent, - HostItem, -} from '../../../graphql/types'; +import { HostOverviewQuery } from './host_overview.gql_query'; +import { GetHostOverviewQuery, HostItem } from '../../../graphql/types'; const ID = 'hostOverviewQuery'; @@ -38,7 +36,7 @@ export interface HostOverviewReduxProps { } export interface OwnProps extends QueryTemplateProps { - children: (args: HostOverviewArgs) => React.ReactElement; + children: (args: HostOverviewArgs) => React.ReactNode; hostName: string; startDate: number; endDate: number; @@ -64,7 +62,8 @@ class HostOverviewByNameComponentQuery extends QueryTemplate< endDate, } = this.props; return ( - + query={HostOverviewQuery} fetchPolicy={getDefaultFetchPolicy()} notifyOnNetworkStatusChange skip={skip} @@ -92,7 +91,7 @@ class HostOverviewByNameComponentQuery extends QueryTemplate< endDate, }); }} - + ); } } diff --git a/x-pack/legacy/plugins/siem/public/containers/ip_overview/index.gql_query.ts b/x-pack/legacy/plugins/siem/public/containers/ip_overview/index.gql_query.ts index 875413f4cac0d..3733cd780a4f7 100644 --- a/x-pack/legacy/plugins/siem/public/containers/ip_overview/index.gql_query.ts +++ b/x-pack/legacy/plugins/siem/public/containers/ip_overview/index.gql_query.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { gql } from '@apollo/client'; +import gql from 'graphql-tag'; export const ipOverviewQuery = gql` query GetIpOverviewQuery( diff --git a/x-pack/legacy/plugins/siem/public/containers/ip_overview/index.tsx b/x-pack/legacy/plugins/siem/public/containers/ip_overview/index.tsx index 9d83af620b730..ade94c430c6ef 100644 --- a/x-pack/legacy/plugins/siem/public/containers/ip_overview/index.tsx +++ b/x-pack/legacy/plugins/siem/public/containers/ip_overview/index.tsx @@ -6,15 +6,18 @@ import { getOr } from 'lodash/fp'; import React from 'react'; +import { Query } from 'react-apollo'; import { connect, ConnectedProps } from 'react-redux'; import { DEFAULT_INDEX_KEY } from '../../../common/constants'; -import { GetIpOverviewQueryComponent, IpOverviewData } from '../../graphql/types'; +import { GetIpOverviewQuery, IpOverviewData } from '../../graphql/types'; import { networkModel, inputsModel, inputsSelectors, State } from '../../store'; import { useUiSetting } from '../../lib/kibana'; import { createFilter, getDefaultFetchPolicy } from '../helpers'; import { QueryTemplateProps } from '../query_template'; +import { ipOverviewQuery } from './index.gql_query'; + const ID = 'ipOverviewQuery'; export interface IpOverviewArgs { @@ -26,14 +29,15 @@ export interface IpOverviewArgs { } export interface IpOverviewProps extends QueryTemplateProps { - children: (args: IpOverviewArgs) => React.ReactElement; + children: (args: IpOverviewArgs) => React.ReactNode; type: networkModel.NetworkType; ip: string; } const IpOverviewComponentQuery = React.memo( ({ id = ID, isInspected, children, filterQuery, skip, sourceId, ip }) => ( - + query={ipOverviewQuery} fetchPolicy={getDefaultFetchPolicy()} notifyOnNetworkStatusChange skip={skip} @@ -56,7 +60,7 @@ const IpOverviewComponentQuery = React.memo( refetch, }); }} - + ) ); diff --git a/x-pack/legacy/plugins/siem/public/containers/kpi_host_details/index.gql_query.ts b/x-pack/legacy/plugins/siem/public/containers/kpi_host_details/index.gql_query.tsx similarity index 97% rename from x-pack/legacy/plugins/siem/public/containers/kpi_host_details/index.gql_query.ts rename to x-pack/legacy/plugins/siem/public/containers/kpi_host_details/index.gql_query.tsx index 3b847d1b71560..077f49c4bdfa6 100644 --- a/x-pack/legacy/plugins/siem/public/containers/kpi_host_details/index.gql_query.ts +++ b/x-pack/legacy/plugins/siem/public/containers/kpi_host_details/index.gql_query.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { gql } from '@apollo/client'; +import gql from 'graphql-tag'; export const kpiHostDetailsQuery = gql` fragment KpiHostDetailsChartFields on KpiHostHistogramData { diff --git a/x-pack/legacy/plugins/siem/public/containers/kpi_host_details/index.tsx b/x-pack/legacy/plugins/siem/public/containers/kpi_host_details/index.tsx index 1568cf60586d7..de9d54b1a185c 100644 --- a/x-pack/legacy/plugins/siem/public/containers/kpi_host_details/index.tsx +++ b/x-pack/legacy/plugins/siem/public/containers/kpi_host_details/index.tsx @@ -6,15 +6,18 @@ import { getOr } from 'lodash/fp'; import React from 'react'; +import { Query } from 'react-apollo'; import { connect, ConnectedProps } from 'react-redux'; import { DEFAULT_INDEX_KEY } from '../../../common/constants'; -import { KpiHostDetailsData, GetKpiHostDetailsQueryComponent } from '../../graphql/types'; +import { KpiHostDetailsData, GetKpiHostDetailsQuery } from '../../graphql/types'; import { inputsModel, inputsSelectors, State } from '../../store'; import { useUiSetting } from '../../lib/kibana'; import { createFilter, getDefaultFetchPolicy } from '../helpers'; import { QueryTemplateProps } from '../query_template'; +import { kpiHostDetailsQuery } from './index.gql_query'; + const ID = 'kpiHostDetailsQuery'; export interface KpiHostDetailsArgs { @@ -26,12 +29,13 @@ export interface KpiHostDetailsArgs { } export interface QueryKpiHostDetailsProps extends QueryTemplateProps { - children: (args: KpiHostDetailsArgs) => React.ReactElement; + children: (args: KpiHostDetailsArgs) => React.ReactNode; } const KpiHostDetailsComponentQuery = React.memo( ({ id = ID, children, endDate, filterQuery, isInspected, skip, sourceId, startDate }) => ( - + query={kpiHostDetailsQuery} fetchPolicy={getDefaultFetchPolicy()} notifyOnNetworkStatusChange skip={skip} @@ -57,7 +61,7 @@ const KpiHostDetailsComponentQuery = React.memo + ) ); diff --git a/x-pack/legacy/plugins/siem/public/containers/kpi_hosts/index.gql_query.ts b/x-pack/legacy/plugins/siem/public/containers/kpi_hosts/index.gql_query.ts index e359adf2a354f..37d54455db1fd 100644 --- a/x-pack/legacy/plugins/siem/public/containers/kpi_hosts/index.gql_query.ts +++ b/x-pack/legacy/plugins/siem/public/containers/kpi_hosts/index.gql_query.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { gql } from '@apollo/client'; +import gql from 'graphql-tag'; export const kpiHostsQuery = gql` fragment KpiHostChartFields on KpiHostHistogramData { diff --git a/x-pack/legacy/plugins/siem/public/containers/kpi_hosts/index.tsx b/x-pack/legacy/plugins/siem/public/containers/kpi_hosts/index.tsx index 543a2b6035b81..5be2423e8a162 100644 --- a/x-pack/legacy/plugins/siem/public/containers/kpi_hosts/index.tsx +++ b/x-pack/legacy/plugins/siem/public/containers/kpi_hosts/index.tsx @@ -6,15 +6,18 @@ import { getOr } from 'lodash/fp'; import React from 'react'; +import { Query } from 'react-apollo'; import { connect, ConnectedProps } from 'react-redux'; import { DEFAULT_INDEX_KEY } from '../../../common/constants'; -import { GetKpiHostsQueryComponent, KpiHostsData } from '../../graphql/types'; +import { GetKpiHostsQuery, KpiHostsData } from '../../graphql/types'; import { inputsModel, inputsSelectors, State } from '../../store'; import { useUiSetting } from '../../lib/kibana'; import { createFilter, getDefaultFetchPolicy } from '../helpers'; import { QueryTemplateProps } from '../query_template'; +import { kpiHostsQuery } from './index.gql_query'; + const ID = 'kpiHostsQuery'; export interface KpiHostsArgs { @@ -26,12 +29,13 @@ export interface KpiHostsArgs { } export interface KpiHostsProps extends QueryTemplateProps { - children: (args: KpiHostsArgs) => React.ReactElement; + children: (args: KpiHostsArgs) => React.ReactNode; } const KpiHostsComponentQuery = React.memo( ({ id = ID, children, endDate, filterQuery, isInspected, skip, sourceId, startDate }) => ( - + query={kpiHostsQuery} fetchPolicy={getDefaultFetchPolicy()} notifyOnNetworkStatusChange skip={skip} @@ -57,7 +61,7 @@ const KpiHostsComponentQuery = React.memo( refetch, }); }} - + ) ); diff --git a/x-pack/legacy/plugins/siem/public/containers/kpi_network/index.gql_query.ts b/x-pack/legacy/plugins/siem/public/containers/kpi_network/index.gql_query.ts index 90f773fad229c..3c693f08b45f2 100644 --- a/x-pack/legacy/plugins/siem/public/containers/kpi_network/index.gql_query.ts +++ b/x-pack/legacy/plugins/siem/public/containers/kpi_network/index.gql_query.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { gql } from '@apollo/client'; +import gql from 'graphql-tag'; export const kpiNetworkQuery = gql` fragment KpiNetworkChartFields on KpiNetworkHistogramData { diff --git a/x-pack/legacy/plugins/siem/public/containers/kpi_network/index.tsx b/x-pack/legacy/plugins/siem/public/containers/kpi_network/index.tsx index 019cc718fd5be..338cdc39b178c 100644 --- a/x-pack/legacy/plugins/siem/public/containers/kpi_network/index.tsx +++ b/x-pack/legacy/plugins/siem/public/containers/kpi_network/index.tsx @@ -6,15 +6,18 @@ import { getOr } from 'lodash/fp'; import React from 'react'; +import { Query } from 'react-apollo'; import { connect, ConnectedProps } from 'react-redux'; import { DEFAULT_INDEX_KEY } from '../../../common/constants'; -import { GetKpiNetworkQueryComponent, KpiNetworkData } from '../../graphql/types'; +import { GetKpiNetworkQuery, KpiNetworkData } from '../../graphql/types'; import { inputsModel, inputsSelectors, State } from '../../store'; import { useUiSetting } from '../../lib/kibana'; import { createFilter, getDefaultFetchPolicy } from '../helpers'; import { QueryTemplateProps } from '../query_template'; +import { kpiNetworkQuery } from './index.gql_query'; + const ID = 'kpiNetworkQuery'; export interface KpiNetworkArgs { @@ -26,12 +29,13 @@ export interface KpiNetworkArgs { } export interface KpiNetworkProps extends QueryTemplateProps { - children: (args: KpiNetworkArgs) => React.ReactElement; + children: (args: KpiNetworkArgs) => React.ReactNode; } const KpiNetworkComponentQuery = React.memo( ({ id = ID, children, filterQuery, isInspected, skip, sourceId, startDate, endDate }) => ( - + query={kpiNetworkQuery} fetchPolicy={getDefaultFetchPolicy()} notifyOnNetworkStatusChange skip={skip} @@ -57,7 +61,7 @@ const KpiNetworkComponentQuery = React.memo( refetch, }); }} - + ) ); diff --git a/x-pack/legacy/plugins/siem/public/containers/matrix_histogram/index.gql_query.ts b/x-pack/legacy/plugins/siem/public/containers/matrix_histogram/index.gql_query.ts index 8c032c17a6b95..6fb729ca7e9a0 100644 --- a/x-pack/legacy/plugins/siem/public/containers/matrix_histogram/index.gql_query.ts +++ b/x-pack/legacy/plugins/siem/public/containers/matrix_histogram/index.gql_query.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { gql } from '@apollo/client'; +import gql from 'graphql-tag'; export const MatrixHistogramGqlQuery = gql` query GetMatrixHistogramQuery( diff --git a/x-pack/legacy/plugins/siem/public/containers/matrix_histogram/index.test.tsx b/x-pack/legacy/plugins/siem/public/containers/matrix_histogram/index.test.tsx index 141d986c5188b..06367ab8657a8 100644 --- a/x-pack/legacy/plugins/siem/public/containers/matrix_histogram/index.test.tsx +++ b/x-pack/legacy/plugins/siem/public/containers/matrix_histogram/index.test.tsx @@ -7,8 +7,7 @@ import { useQuery } from '.'; import { mount } from 'enzyme'; import React from 'react'; -import { useApolloClient } from '@apollo/client'; - +import { useApolloClient } from '../../utils/apollo_context'; import { errorToToaster } from '../../components/ml/api/error_to_toaster'; import { MatrixOverTimeHistogramData, HistogramType } from '../../graphql/types'; import { InspectQuery, Refetch } from '../../store/inputs/model'; @@ -26,7 +25,7 @@ const mockQuery = jest.fn().mockResolvedValue({ }); const mockRejectQuery = jest.fn().mockRejectedValue(new Error()); -jest.mock('@apollo/client', () => ({ +jest.mock('../../utils/apollo_context', () => ({ useApolloClient: jest.fn(), })); diff --git a/x-pack/legacy/plugins/siem/public/containers/matrix_histogram/index.ts b/x-pack/legacy/plugins/siem/public/containers/matrix_histogram/index.ts index c995e5065a3ec..683d5b68c305b 100644 --- a/x-pack/legacy/plugins/siem/public/containers/matrix_histogram/index.ts +++ b/x-pack/legacy/plugins/siem/public/containers/matrix_histogram/index.ts @@ -4,14 +4,13 @@ * you may not use this file except in compliance with the Elastic License. */ import { useEffect, useState, useRef } from 'react'; -import { useApolloClient } from '@apollo/client'; - import { MatrixHistogramQueryProps } from '../../components/matrix_histogram/types'; import { DEFAULT_INDEX_KEY } from '../../../common/constants'; import { useStateToaster } from '../../components/toasters'; import { errorToToaster } from '../../components/ml/api/error_to_toaster'; import { useUiSetting$ } from '../../lib/kibana'; import { createFilter } from '../helpers'; +import { useApolloClient } from '../../utils/apollo_context'; import { inputsModel } from '../../store'; import { MatrixHistogramGqlQuery } from './index.gql_query'; import { GetMatrixHistogramQuery, MatrixOverTimeHistogramData } from '../../graphql/types'; diff --git a/x-pack/legacy/plugins/siem/public/containers/network_dns/index.gql_query.ts b/x-pack/legacy/plugins/siem/public/containers/network_dns/index.gql_query.ts index ad272466d2370..a81d112fa4c50 100644 --- a/x-pack/legacy/plugins/siem/public/containers/network_dns/index.gql_query.ts +++ b/x-pack/legacy/plugins/siem/public/containers/network_dns/index.gql_query.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { gql } from '@apollo/client'; +import gql from 'graphql-tag'; export const networkDnsQuery = gql` query GetNetworkDnsQuery( diff --git a/x-pack/legacy/plugins/siem/public/containers/network_dns/index.tsx b/x-pack/legacy/plugins/siem/public/containers/network_dns/index.tsx index da6aeb34d33c6..04c8783c30a0f 100644 --- a/x-pack/legacy/plugins/siem/public/containers/network_dns/index.tsx +++ b/x-pack/legacy/plugins/siem/public/containers/network_dns/index.tsx @@ -6,6 +6,7 @@ import { getOr } from 'lodash/fp'; import React from 'react'; +import { Query } from 'react-apollo'; import { connect } from 'react-redux'; import { compose } from 'redux'; @@ -14,7 +15,6 @@ import { ScaleType } from '@elastic/charts'; import { DEFAULT_INDEX_KEY } from '../../../common/constants'; import { GetNetworkDnsQuery, - GetNetworkDnsQueryComponent, NetworkDnsEdges, NetworkDnsSortField, PageInfoPaginated, @@ -25,6 +25,7 @@ import { withKibana, WithKibanaProps } from '../../lib/kibana'; import { generateTablePaginationOptions } from '../../components/paginated_table/helpers'; import { createFilter, getDefaultFetchPolicy } from '../helpers'; import { QueryTemplatePaginated, QueryTemplatePaginatedProps } from '../query_template_paginated'; +import { networkDnsQuery } from './index.gql_query'; import { DEFAULT_TABLE_ACTIVE_PAGE, DEFAULT_TABLE_LIMIT } from '../../store/constants'; import { MatrixHistogram } from '../../components/matrix_histogram'; import { MatrixHistogramOption, GetSubTitle } from '../../components/matrix_histogram/types'; @@ -48,7 +49,7 @@ export interface NetworkDnsArgs { } export interface OwnProps extends QueryTemplatePaginatedProps { - children: (args: NetworkDnsArgs) => React.ReactElement; + children: (args: NetworkDnsArgs) => React.ReactNode; type: networkModel.NetworkType; } @@ -116,9 +117,10 @@ export class NetworkDnsComponentQuery extends QueryTemplatePaginated< }; return ( - fetchPolicy={getDefaultFetchPolicy()} notifyOnNetworkStatusChange + query={networkDnsQuery} skip={skip} variables={variables} > @@ -159,7 +161,7 @@ export class NetworkDnsComponentQuery extends QueryTemplatePaginated< histogram: getOr(null, 'source.NetworkDns.histogram', data), }); }} - + ); } } diff --git a/x-pack/legacy/plugins/siem/public/containers/network_http/index.gql_query.ts b/x-pack/legacy/plugins/siem/public/containers/network_http/index.gql_query.ts index b084fe846dca2..bedf13dfa9849 100644 --- a/x-pack/legacy/plugins/siem/public/containers/network_http/index.gql_query.ts +++ b/x-pack/legacy/plugins/siem/public/containers/network_http/index.gql_query.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { gql } from '@apollo/client'; +import gql from 'graphql-tag'; export const networkHttpQuery = gql` query GetNetworkHttpQuery( diff --git a/x-pack/legacy/plugins/siem/public/containers/network_http/index.tsx b/x-pack/legacy/plugins/siem/public/containers/network_http/index.tsx index 1f0759d25e870..bf4e64f63d559 100644 --- a/x-pack/legacy/plugins/siem/public/containers/network_http/index.tsx +++ b/x-pack/legacy/plugins/siem/public/containers/network_http/index.tsx @@ -6,13 +6,13 @@ import { getOr } from 'lodash/fp'; import React from 'react'; +import { Query } from 'react-apollo'; import { connect } from 'react-redux'; import { compose } from 'redux'; import { DEFAULT_INDEX_KEY } from '../../../common/constants'; import { GetNetworkHttpQuery, - GetNetworkHttpQueryComponent, NetworkHttpEdges, NetworkHttpSortField, PageInfoPaginated, @@ -22,6 +22,7 @@ import { withKibana, WithKibanaProps } from '../../lib/kibana'; import { generateTablePaginationOptions } from '../../components/paginated_table/helpers'; import { createFilter, getDefaultFetchPolicy } from '../helpers'; import { QueryTemplatePaginated, QueryTemplatePaginatedProps } from '../query_template_paginated'; +import { networkHttpQuery } from './index.gql_query'; const ID = 'networkHttpQuery'; @@ -39,7 +40,7 @@ export interface NetworkHttpArgs { } export interface OwnProps extends QueryTemplatePaginatedProps { - children: (args: NetworkHttpArgs) => React.ReactElement; + children: (args: NetworkHttpArgs) => React.ReactNode; ip?: string; type: networkModel.NetworkType; } @@ -89,9 +90,10 @@ class NetworkHttpComponentQuery extends QueryTemplatePaginated< }, }; return ( - fetchPolicy={getDefaultFetchPolicy()} notifyOnNetworkStatusChange + query={networkHttpQuery} skip={skip} variables={variables} > @@ -131,7 +133,7 @@ class NetworkHttpComponentQuery extends QueryTemplatePaginated< totalCount: getOr(-1, 'source.NetworkHttp.totalCount', data), }); }} - + ); } } diff --git a/x-pack/legacy/plugins/siem/public/containers/network_top_countries/index.gql_query.ts b/x-pack/legacy/plugins/siem/public/containers/network_top_countries/index.gql_query.ts index 4c647d910ebd6..5850246ceecec 100644 --- a/x-pack/legacy/plugins/siem/public/containers/network_top_countries/index.gql_query.ts +++ b/x-pack/legacy/plugins/siem/public/containers/network_top_countries/index.gql_query.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { gql } from '@apollo/client'; +import gql from 'graphql-tag'; export const networkTopCountriesQuery = gql` query GetNetworkTopCountriesQuery( diff --git a/x-pack/legacy/plugins/siem/public/containers/network_top_countries/index.tsx b/x-pack/legacy/plugins/siem/public/containers/network_top_countries/index.tsx index 43f3616b79924..bd1e1a002bbcd 100644 --- a/x-pack/legacy/plugins/siem/public/containers/network_top_countries/index.tsx +++ b/x-pack/legacy/plugins/siem/public/containers/network_top_countries/index.tsx @@ -6,6 +6,7 @@ import { getOr } from 'lodash/fp'; import React from 'react'; +import { Query } from 'react-apollo'; import { connect } from 'react-redux'; import { compose } from 'redux'; @@ -13,7 +14,6 @@ import { DEFAULT_INDEX_KEY } from '../../../common/constants'; import { FlowTargetSourceDest, GetNetworkTopCountriesQuery, - GetNetworkTopCountriesQueryComponent, NetworkTopCountriesEdges, NetworkTopTablesSortField, PageInfoPaginated, @@ -23,6 +23,7 @@ import { withKibana, WithKibanaProps } from '../../lib/kibana'; import { generateTablePaginationOptions } from '../../components/paginated_table/helpers'; import { createFilter, getDefaultFetchPolicy } from '../helpers'; import { QueryTemplatePaginated, QueryTemplatePaginatedProps } from '../query_template_paginated'; +import { networkTopCountriesQuery } from './index.gql_query'; const ID = 'networkTopCountriesQuery'; @@ -40,7 +41,7 @@ export interface NetworkTopCountriesArgs { } export interface OwnProps extends QueryTemplatePaginatedProps { - children: (args: NetworkTopCountriesArgs) => React.ReactElement; + children: (args: NetworkTopCountriesArgs) => React.ReactNode; flowTarget: FlowTargetSourceDest; ip?: string; type: networkModel.NetworkType; @@ -93,9 +94,10 @@ class NetworkTopCountriesComponentQuery extends QueryTemplatePaginated< }, }; return ( - fetchPolicy={getDefaultFetchPolicy()} notifyOnNetworkStatusChange + query={networkTopCountriesQuery} skip={skip} variables={variables} > @@ -135,7 +137,7 @@ class NetworkTopCountriesComponentQuery extends QueryTemplatePaginated< totalCount: getOr(-1, 'source.NetworkTopCountries.totalCount', data), }); }} - + ); } } diff --git a/x-pack/legacy/plugins/siem/public/containers/network_top_n_flow/index.gql_query.ts b/x-pack/legacy/plugins/siem/public/containers/network_top_n_flow/index.gql_query.ts index ba852e042016c..a73f9ff9256ff 100644 --- a/x-pack/legacy/plugins/siem/public/containers/network_top_n_flow/index.gql_query.ts +++ b/x-pack/legacy/plugins/siem/public/containers/network_top_n_flow/index.gql_query.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { gql } from '@apollo/client'; +import gql from 'graphql-tag'; export const networkTopNFlowQuery = gql` query GetNetworkTopNFlowQuery( diff --git a/x-pack/legacy/plugins/siem/public/containers/network_top_n_flow/index.tsx b/x-pack/legacy/plugins/siem/public/containers/network_top_n_flow/index.tsx index 3121ab9d8433c..f0f1f8257f29f 100644 --- a/x-pack/legacy/plugins/siem/public/containers/network_top_n_flow/index.tsx +++ b/x-pack/legacy/plugins/siem/public/containers/network_top_n_flow/index.tsx @@ -6,6 +6,7 @@ import { getOr } from 'lodash/fp'; import React from 'react'; +import { Query } from 'react-apollo'; import { connect } from 'react-redux'; import { compose } from 'redux'; @@ -13,7 +14,6 @@ import { DEFAULT_INDEX_KEY } from '../../../common/constants'; import { FlowTargetSourceDest, GetNetworkTopNFlowQuery, - GetNetworkTopNFlowQueryComponent, NetworkTopNFlowEdges, NetworkTopTablesSortField, PageInfoPaginated, @@ -23,6 +23,7 @@ import { inputsModel, inputsSelectors, networkModel, networkSelectors, State } f import { generateTablePaginationOptions } from '../../components/paginated_table/helpers'; import { createFilter, getDefaultFetchPolicy } from '../helpers'; import { QueryTemplatePaginated, QueryTemplatePaginatedProps } from '../query_template_paginated'; +import { networkTopNFlowQuery } from './index.gql_query'; const ID = 'networkTopNFlowQuery'; @@ -40,7 +41,7 @@ export interface NetworkTopNFlowArgs { } export interface OwnProps extends QueryTemplatePaginatedProps { - children: (args: NetworkTopNFlowArgs) => React.ReactElement; + children: (args: NetworkTopNFlowArgs) => React.ReactNode; flowTarget: FlowTargetSourceDest; ip?: string; type: networkModel.NetworkType; @@ -93,9 +94,10 @@ class NetworkTopNFlowComponentQuery extends QueryTemplatePaginated< }, }; return ( - fetchPolicy={getDefaultFetchPolicy()} notifyOnNetworkStatusChange + query={networkTopNFlowQuery} skip={skip} variables={variables} > @@ -135,7 +137,7 @@ class NetworkTopNFlowComponentQuery extends QueryTemplatePaginated< totalCount: getOr(-1, 'source.NetworkTopNFlow.totalCount', data), }); }} - + ); } } diff --git a/x-pack/legacy/plugins/siem/public/containers/overview/overview_host/index.gql_query.ts b/x-pack/legacy/plugins/siem/public/containers/overview/overview_host/index.gql_query.ts index a1b6998ec2e75..6f17bf6915aa4 100644 --- a/x-pack/legacy/plugins/siem/public/containers/overview/overview_host/index.gql_query.ts +++ b/x-pack/legacy/plugins/siem/public/containers/overview/overview_host/index.gql_query.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { gql } from '@apollo/client'; +import gql from 'graphql-tag'; export const overviewHostQuery = gql` query GetOverviewHostQuery( diff --git a/x-pack/legacy/plugins/siem/public/containers/overview/overview_host/index.tsx b/x-pack/legacy/plugins/siem/public/containers/overview/overview_host/index.tsx index 8d7028e3f6bd7..2dd9ccf24d802 100644 --- a/x-pack/legacy/plugins/siem/public/containers/overview/overview_host/index.tsx +++ b/x-pack/legacy/plugins/siem/public/containers/overview/overview_host/index.tsx @@ -6,16 +6,19 @@ import { getOr } from 'lodash/fp'; import React from 'react'; +import { Query } from 'react-apollo'; import { connect, ConnectedProps } from 'react-redux'; import { DEFAULT_INDEX_KEY } from '../../../../common/constants'; -import { GetOverviewHostQueryComponent, OverviewHostData } from '../../../graphql/types'; +import { GetOverviewHostQuery, OverviewHostData } from '../../../graphql/types'; import { useUiSetting } from '../../../lib/kibana'; import { inputsModel, inputsSelectors } from '../../../store/inputs'; import { State } from '../../../store'; import { createFilter, getDefaultFetchPolicy } from '../../helpers'; import { QueryTemplateProps } from '../../query_template'; +import { overviewHostQuery } from './index.gql_query'; + export const ID = 'overviewHostQuery'; export interface OverviewHostArgs { @@ -27,40 +30,43 @@ export interface OverviewHostArgs { } export interface OverviewHostProps extends QueryTemplateProps { - children: (args: OverviewHostArgs) => React.ReactElement; + children: (args: OverviewHostArgs) => React.ReactNode; sourceId: string; endDate: number; startDate: number; } const OverviewHostComponentQuery = React.memo( - ({ id = ID, children, filterQuery, isInspected, sourceId, startDate, endDate }) => ( - (DEFAULT_INDEX_KEY), - inspect: isInspected, - }} - > - {({ data, loading, refetch }) => { - const overviewHost = getOr({}, `source.OverviewHost`, data); - return children({ - id, - inspect: getOr(null, 'source.OverviewHost.inspect', data), - overviewHost, - loading, - refetch, - }); - }} - - ) + ({ id = ID, children, filterQuery, isInspected, sourceId, startDate, endDate }) => { + return ( + + query={overviewHostQuery} + fetchPolicy={getDefaultFetchPolicy()} + variables={{ + sourceId, + timerange: { + interval: '12h', + from: startDate, + to: endDate, + }, + filterQuery: createFilter(filterQuery), + defaultIndex: useUiSetting(DEFAULT_INDEX_KEY), + inspect: isInspected, + }} + > + {({ data, loading, refetch }) => { + const overviewHost = getOr({}, `source.OverviewHost`, data); + return children({ + id, + inspect: getOr(null, 'source.OverviewHost.inspect', data), + overviewHost, + loading, + refetch, + }); + }} + + ); + } ); OverviewHostComponentQuery.displayName = 'OverviewHostComponentQuery'; diff --git a/x-pack/legacy/plugins/siem/public/containers/overview/overview_network/index.gql_query.ts b/x-pack/legacy/plugins/siem/public/containers/overview/overview_network/index.gql_query.ts index 6eb8dc9dcdaec..d40ab900b91a7 100644 --- a/x-pack/legacy/plugins/siem/public/containers/overview/overview_network/index.gql_query.ts +++ b/x-pack/legacy/plugins/siem/public/containers/overview/overview_network/index.gql_query.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { gql } from '@apollo/client'; +import gql from 'graphql-tag'; export const overviewNetworkQuery = gql` query GetOverviewNetworkQuery( diff --git a/x-pack/legacy/plugins/siem/public/containers/overview/overview_network/index.tsx b/x-pack/legacy/plugins/siem/public/containers/overview/overview_network/index.tsx index 5ae8741c2545e..d0acd41c224a5 100644 --- a/x-pack/legacy/plugins/siem/public/containers/overview/overview_network/index.tsx +++ b/x-pack/legacy/plugins/siem/public/containers/overview/overview_network/index.tsx @@ -6,16 +6,19 @@ import { getOr } from 'lodash/fp'; import React from 'react'; +import { Query } from 'react-apollo'; import { connect, ConnectedProps } from 'react-redux'; import { DEFAULT_INDEX_KEY } from '../../../../common/constants'; -import { GetOverviewNetworkQueryComponent, OverviewNetworkData } from '../../../graphql/types'; +import { GetOverviewNetworkQuery, OverviewNetworkData } from '../../../graphql/types'; import { useUiSetting } from '../../../lib/kibana'; import { State } from '../../../store'; import { inputsModel, inputsSelectors } from '../../../store/inputs'; import { createFilter, getDefaultFetchPolicy } from '../../helpers'; import { QueryTemplateProps } from '../../query_template'; +import { overviewNetworkQuery } from './index.gql_query'; + export const ID = 'overviewNetworkQuery'; export interface OverviewNetworkArgs { @@ -27,7 +30,7 @@ export interface OverviewNetworkArgs { } export interface OverviewNetworkProps extends QueryTemplateProps { - children: (args: OverviewNetworkArgs) => React.ReactElement; + children: (args: OverviewNetworkArgs) => React.ReactNode; sourceId: string; endDate: number; startDate: number; @@ -35,7 +38,8 @@ export interface OverviewNetworkProps extends QueryTemplateProps { export const OverviewNetworkComponentQuery = React.memo( ({ id = ID, children, filterQuery, isInspected, sourceId, startDate, endDate }) => ( - + query={overviewNetworkQuery} fetchPolicy={getDefaultFetchPolicy()} notifyOnNetworkStatusChange variables={{ @@ -60,7 +64,7 @@ export const OverviewNetworkComponentQuery = React.memo + ) ); diff --git a/x-pack/legacy/plugins/siem/public/containers/query_template.tsx b/x-pack/legacy/plugins/siem/public/containers/query_template.tsx index 43b9237bf0cb7..dfb452c24b86e 100644 --- a/x-pack/legacy/plugins/siem/public/containers/query_template.tsx +++ b/x-pack/legacy/plugins/siem/public/containers/query_template.tsx @@ -4,13 +4,9 @@ * you may not use this file except in compliance with the Elastic License. */ -import { - ApolloQueryResult, - FetchMoreOptions, - FetchMoreQueryOptions, - OperationVariables, -} from '@apollo/client'; +import { ApolloQueryResult } from 'apollo-client'; import React from 'react'; +import { FetchMoreOptions, FetchMoreQueryOptions, OperationVariables } from 'react-apollo'; import { ESQuery } from '../../common/typed_json'; diff --git a/x-pack/legacy/plugins/siem/public/containers/query_template_paginated.tsx b/x-pack/legacy/plugins/siem/public/containers/query_template_paginated.tsx index c01289bf61f6c..db618f216d83e 100644 --- a/x-pack/legacy/plugins/siem/public/containers/query_template_paginated.tsx +++ b/x-pack/legacy/plugins/siem/public/containers/query_template_paginated.tsx @@ -4,15 +4,10 @@ * you may not use this file except in compliance with the Elastic License. */ -import { - ApolloQueryResult, - NetworkStatus, - FetchMoreOptions, - FetchMoreQueryOptions, - OperationVariables, -} from '@apollo/client'; -import React from 'react'; +import { ApolloQueryResult, NetworkStatus } from 'apollo-client'; import memoizeOne from 'memoize-one'; +import React from 'react'; +import { FetchMoreOptions, FetchMoreQueryOptions, OperationVariables } from 'react-apollo'; import deepEqual from 'fast-deep-equal'; import { ESQuery } from '../../common/typed_json'; diff --git a/x-pack/legacy/plugins/siem/public/containers/source/index.gql_query.ts b/x-pack/legacy/plugins/siem/public/containers/source/index.gql_query.ts index 6c84ee7f29c41..1f9ba09167e1e 100644 --- a/x-pack/legacy/plugins/siem/public/containers/source/index.gql_query.ts +++ b/x-pack/legacy/plugins/siem/public/containers/source/index.gql_query.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { gql } from '@apollo/client'; +import gql from 'graphql-tag'; export const sourceQuery = gql` query SourceQuery($sourceId: ID = "default", $defaultIndex: [String!]!) { diff --git a/x-pack/legacy/plugins/siem/public/containers/source/index.test.tsx b/x-pack/legacy/plugins/siem/public/containers/source/index.test.tsx index d64a7ebab44f4..d1a183a402e37 100644 --- a/x-pack/legacy/plugins/siem/public/containers/source/index.test.tsx +++ b/x-pack/legacy/plugins/siem/public/containers/source/index.test.tsx @@ -4,39 +4,55 @@ * you may not use this file except in compliance with the Elastic License. */ +import { isEqual } from 'lodash/fp'; +import { mount } from 'enzyme'; import React from 'react'; -import { MockedProvider } from '@apollo/client/testing'; -import { renderHook } from '@testing-library/react-hooks'; +import { MockedProvider } from 'react-apollo/test-utils'; -import { useWithSource, indicesExistOrDataTemporarilyUnavailable } from '.'; +import { wait } from '../../lib/helpers'; + +import { WithSource, indicesExistOrDataTemporarilyUnavailable } from '.'; import { mockBrowserFields, mockIndexFields, mocksSource } from './mock'; jest.mock('../../lib/kibana'); describe('Index Fields & Browser Fields', () => { test('Index Fields', async () => { - const wrapper: React.ComponentType = ({ children }) => ( + mount( - {(children as unknown) as undefined} + + {({ indexPattern }) => { + if (!isEqual(indexPattern.fields, [])) { + expect(indexPattern.fields).toEqual(mockIndexFields); + } + + return null; + }} + ); - const { result, waitForNextUpdate } = renderHook(() => useWithSource(), { wrapper }); - await waitForNextUpdate(); - - expect(result.current.indexPattern.fields).toEqual(mockIndexFields); + // Why => https://github.com/apollographql/react-apollo/issues/1711 + await wait(); }); test('Browser Fields', async () => { - const wrapper: React.ComponentType = ({ children }) => ( + mount( - {(children as unknown) as undefined} + + {({ browserFields }) => { + if (!isEqual(browserFields, {})) { + expect(browserFields).toEqual(mockBrowserFields); + } + + return null; + }} + ); - const { result, waitForNextUpdate } = renderHook(() => useWithSource(), { wrapper }); - await waitForNextUpdate(); - expect(result.current.browserFields).toEqual(mockBrowserFields); + // Why => https://github.com/apollographql/react-apollo/issues/1711 + await wait(); }); describe('indicesExistOrDataTemporarilyUnavailable', () => { diff --git a/x-pack/legacy/plugins/siem/public/containers/source/index.tsx b/x-pack/legacy/plugins/siem/public/containers/source/index.tsx index f8f85f0fccc04..e454421ca955d 100644 --- a/x-pack/legacy/plugins/siem/public/containers/source/index.tsx +++ b/x-pack/legacy/plugins/siem/public/containers/source/index.tsx @@ -6,16 +6,18 @@ import { isUndefined } from 'lodash'; import { get, keyBy, pick, set, isEmpty } from 'lodash/fp'; -import { useMemo } from 'react'; +import { Query } from 'react-apollo'; +import React, { useEffect, useMemo, useState } from 'react'; import memoizeOne from 'memoize-one'; import { IIndexPattern } from 'src/plugins/data/public'; import { useUiSetting$ } from '../../lib/kibana'; import { DEFAULT_INDEX_KEY } from '../../../common/constants'; -import { IndexField, useSourceQueryQuery } from '../../graphql/types'; +import { IndexField, SourceQuery } from '../../graphql/types'; import { sourceQuery } from './index.gql_query'; +import { useApolloClient } from '../../utils/apollo_context'; export { sourceQuery }; @@ -48,6 +50,18 @@ export const getAllFieldsByName = ( ): { [fieldName: string]: Partial } => keyBy('name', getAllBrowserFields(browserFields)); +interface WithSourceArgs { + indicesExist: boolean; + browserFields: BrowserFields; + indexPattern: IIndexPattern; +} + +interface WithSourceProps { + children: (args: WithSourceArgs) => React.ReactNode; + indexToAdd?: string[] | null; + sourceId: string; +} + export const getIndexFields = memoizeOne( (title: string, fields: IndexField[]): IIndexPattern => fields && fields.length > 0 @@ -69,10 +83,7 @@ export const getBrowserFields = memoizeOne( : {} ); -export const indicesExistOrDataTemporarilyUnavailable = (indicesExist: boolean | undefined) => - indicesExist || isUndefined(indicesExist); - -export const useWithSource = (indexToAdd?: string[] | null, sourceId: string = 'default') => { +export const WithSource = React.memo(({ children, indexToAdd, sourceId }) => { const [configIndex] = useUiSetting$(DEFAULT_INDEX_KEY); const defaultIndex = useMemo(() => { if (indexToAdd != null && !isEmpty(indexToAdd)) { @@ -81,28 +92,86 @@ export const useWithSource = (indexToAdd?: string[] | null, sourceId: string = ' return configIndex; }, [configIndex, indexToAdd]); - const variables = { - sourceId, - defaultIndex, - }; - - const { data } = useSourceQueryQuery({ - fetchPolicy: 'cache-first', - notifyOnNetworkStatusChange: true, - variables, - }); - - const indicesExist = get('source.status.indicesExist', data); - const browserFields = getBrowserFields( - defaultIndex.join(), - get('source.status.indexFields', data) + return ( + + query={sourceQuery} + fetchPolicy="cache-first" + notifyOnNetworkStatusChange + variables={{ + sourceId, + defaultIndex, + }} + > + {({ data }) => + children({ + indicesExist: get('source.status.indicesExist', data), + browserFields: getBrowserFields( + defaultIndex.join(), + get('source.status.indexFields', data) + ), + indexPattern: getIndexFields(defaultIndex.join(), get('source.status.indexFields', data)), + }) + } + ); - const indexPattern = getIndexFields(defaultIndex.join(), get('source.status.indexFields', data)); - const contentAvailable = indicesExistOrDataTemporarilyUnavailable(indicesExist); - - return { - browserFields, - indexPattern, - contentAvailable, - }; +}); + +WithSource.displayName = 'WithSource'; + +export const indicesExistOrDataTemporarilyUnavailable = (indicesExist: boolean | undefined) => + indicesExist || isUndefined(indicesExist); + +export const useWithSource = (sourceId: string, indices: string[]) => { + const [loading, updateLoading] = useState(false); + const [indicesExist, setIndicesExist] = useState(undefined); + const [browserFields, setBrowserFields] = useState(null); + const [indexPattern, setIndexPattern] = useState(null); + const [errorMessage, updateErrorMessage] = useState(null); + + const apolloClient = useApolloClient(); + async function fetchSource(signal: AbortSignal) { + updateLoading(true); + if (apolloClient) { + apolloClient + .query({ + query: sourceQuery, + fetchPolicy: 'cache-first', + variables: { + sourceId, + defaultIndex: indices, + }, + context: { + fetchOptions: { + signal, + }, + }, + }) + .then( + result => { + updateLoading(false); + updateErrorMessage(null); + setIndicesExist(get('data.source.status.indicesExist', result)); + setBrowserFields( + getBrowserFields(indices.join(), get('data.source.status.indexFields', result)) + ); + setIndexPattern( + getIndexFields(indices.join(), get('data.source.status.indexFields', result)) + ); + }, + error => { + updateLoading(false); + updateErrorMessage(error.message); + } + ); + } + } + + useEffect(() => { + const abortCtrl = new AbortController(); + const signal = abortCtrl.signal; + fetchSource(signal); + return () => abortCtrl.abort(); + }, [apolloClient, sourceId, indices]); + + return { indicesExist, browserFields, indexPattern, loading, errorMessage }; }; diff --git a/x-pack/legacy/plugins/siem/public/containers/timeline/all/index.gql_query.ts b/x-pack/legacy/plugins/siem/public/containers/timeline/all/index.gql_query.ts index 055c7203ef78e..e380e46e77070 100644 --- a/x-pack/legacy/plugins/siem/public/containers/timeline/all/index.gql_query.ts +++ b/x-pack/legacy/plugins/siem/public/containers/timeline/all/index.gql_query.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { gql } from '@apollo/client'; +import gql from 'graphql-tag'; export const allTimelinesQuery = gql` query GetAllTimeline( diff --git a/x-pack/legacy/plugins/siem/public/containers/timeline/all/index.tsx b/x-pack/legacy/plugins/siem/public/containers/timeline/all/index.tsx index 1da4404146a44..22c7b03f34dd5 100644 --- a/x-pack/legacy/plugins/siem/public/containers/timeline/all/index.tsx +++ b/x-pack/legacy/plugins/siem/public/containers/timeline/all/index.tsx @@ -8,14 +8,16 @@ import { getOr } from 'lodash/fp'; import React from 'react'; import memoizeOne from 'memoize-one'; +import { Query } from 'react-apollo'; + import { OpenTimelineResult } from '../../../components/open_timeline/types'; import { GetAllTimeline, - GetAllTimelineComponent, PageInfoTimeline, SortTimeline, TimelineResult, } from '../../../graphql/types'; +import { allTimelinesQuery } from './index.gql_query'; export interface AllTimelinesArgs { timelines: OpenTimelineResult[]; @@ -31,7 +33,7 @@ export interface AllTimelinesVariables { } interface OwnProps extends AllTimelinesVariables { - children?: (args: AllTimelinesArgs) => React.ReactElement; + children?: (args: AllTimelinesArgs) => React.ReactNode; } const getAllTimeline = memoizeOne( @@ -83,7 +85,8 @@ const AllTimelinesQueryComponent: React.FC = ({ sort, }; return ( - + query={allTimelinesQuery} fetchPolicy="network-only" notifyOnNetworkStatusChange variables={variables} @@ -98,7 +101,7 @@ const AllTimelinesQueryComponent: React.FC = ({ ), }) } - + ); }; diff --git a/x-pack/legacy/plugins/siem/public/containers/timeline/delete/persist.gql_query.ts b/x-pack/legacy/plugins/siem/public/containers/timeline/delete/persist.gql_query.ts index 1cdd4a4c66c32..4096d7245e89b 100644 --- a/x-pack/legacy/plugins/siem/public/containers/timeline/delete/persist.gql_query.ts +++ b/x-pack/legacy/plugins/siem/public/containers/timeline/delete/persist.gql_query.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { gql } from '@apollo/client'; +import gql from 'graphql-tag'; export const deleteTimelineMutation = gql` mutation DeleteTimelineMutation($id: [ID!]!) { diff --git a/x-pack/legacy/plugins/siem/public/containers/timeline/details/index.gql_query.ts b/x-pack/legacy/plugins/siem/public/containers/timeline/details/index.gql_query.ts index 2618fe8565536..4677d2328be87 100644 --- a/x-pack/legacy/plugins/siem/public/containers/timeline/details/index.gql_query.ts +++ b/x-pack/legacy/plugins/siem/public/containers/timeline/details/index.gql_query.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { gql } from '@apollo/client'; +import gql from 'graphql-tag'; export const timelineDetailsQuery = gql` query GetTimelineDetailsQuery( diff --git a/x-pack/legacy/plugins/siem/public/containers/timeline/details/index.tsx b/x-pack/legacy/plugins/siem/public/containers/timeline/details/index.tsx index 4c5e0f7940449..cf1b8954307e7 100644 --- a/x-pack/legacy/plugins/siem/public/containers/timeline/details/index.tsx +++ b/x-pack/legacy/plugins/siem/public/containers/timeline/details/index.tsx @@ -7,15 +7,14 @@ import { getOr } from 'lodash/fp'; import memoizeOne from 'memoize-one'; import React from 'react'; +import { Query } from 'react-apollo'; import { DEFAULT_INDEX_KEY } from '../../../../common/constants'; -import { - DetailItem, - GetTimelineDetailsQuery, - GetTimelineDetailsQueryComponent, -} from '../../../graphql/types'; +import { DetailItem, GetTimelineDetailsQuery } from '../../../graphql/types'; import { useUiSetting } from '../../../lib/kibana'; +import { timelineDetailsQuery } from './index.gql_query'; + export interface EventsArgs { detailsData: DetailItem[] | null; loading: boolean; @@ -47,7 +46,8 @@ const TimelineDetailsQueryComponent: React.FC = ({ defaultIndex: useUiSetting(DEFAULT_INDEX_KEY), }; return executeQuery ? ( - + query={timelineDetailsQuery} fetchPolicy="network-only" notifyOnNetworkStatusChange variables={variables} @@ -61,7 +61,7 @@ const TimelineDetailsQueryComponent: React.FC = ({ ), }) } - + ) : ( children!({ loading: false, detailsData: null }) ); diff --git a/x-pack/legacy/plugins/siem/public/containers/timeline/favorite/persist.gql_query.ts b/x-pack/legacy/plugins/siem/public/containers/timeline/favorite/persist.gql_query.ts index d11c87df8332f..27d3fdd342e19 100644 --- a/x-pack/legacy/plugins/siem/public/containers/timeline/favorite/persist.gql_query.ts +++ b/x-pack/legacy/plugins/siem/public/containers/timeline/favorite/persist.gql_query.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { gql } from '@apollo/client'; +import gql from 'graphql-tag'; export const persistTimelineFavoriteMutation = gql` mutation PersistTimelineFavoriteMutation($timelineId: ID) { diff --git a/x-pack/legacy/plugins/siem/public/containers/timeline/index.gql_query.ts b/x-pack/legacy/plugins/siem/public/containers/timeline/index.gql_query.ts index 3d9026085f7f5..c54238c5d8687 100644 --- a/x-pack/legacy/plugins/siem/public/containers/timeline/index.gql_query.ts +++ b/x-pack/legacy/plugins/siem/public/containers/timeline/index.gql_query.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { gql } from '@apollo/client'; +import gql from 'graphql-tag'; export const timelineQuery = gql` query GetTimelineQuery( diff --git a/x-pack/legacy/plugins/siem/public/containers/timeline/index.tsx b/x-pack/legacy/plugins/siem/public/containers/timeline/index.tsx index 5ee36f3a75f98..ccd8babd41e68 100644 --- a/x-pack/legacy/plugins/siem/public/containers/timeline/index.tsx +++ b/x-pack/legacy/plugins/siem/public/containers/timeline/index.tsx @@ -7,6 +7,7 @@ import { getOr } from 'lodash/fp'; import memoizeOne from 'memoize-one'; import React from 'react'; +import { Query } from 'react-apollo'; import { compose, Dispatch } from 'redux'; import { connect, ConnectedProps } from 'react-redux'; @@ -14,7 +15,6 @@ import { IIndexPattern } from '../../../../../../../src/plugins/data/common/inde import { DEFAULT_INDEX_KEY } from '../../../common/constants'; import { GetTimelineQuery, - GetTimelineQueryComponent, PageInfo, SortField, TimelineEdges, @@ -25,6 +25,7 @@ import { withKibana, WithKibanaProps } from '../../lib/kibana'; import { createFilter } from '../helpers'; import { QueryTemplate, QueryTemplateProps } from '../query_template'; import { EventType } from '../../store/timeline/model'; +import { timelineQuery } from './index.gql_query'; import { timelineActions } from '../../store/timeline'; import { SIGNALS_PAGE_TIMELINE_ID } from '../../pages/detection_engine/components/signals'; @@ -40,8 +41,12 @@ export interface TimelineArgs { getUpdatedAt: () => number; } +export interface CustomReduxProps { + clearSignalsState: ({ id }: { id?: string }) => void; +} + export interface OwnProps extends QueryTemplateProps { - children?: (args: TimelineArgs) => React.ReactElement; + children?: (args: TimelineArgs) => React.ReactNode; eventType?: EventType; id: string; indexPattern?: IIndexPattern; @@ -51,7 +56,7 @@ export interface OwnProps extends QueryTemplateProps { fields: string[]; } -type TimelineQueryProps = OwnProps & PropsFromRedux & WithKibanaProps; +type TimelineQueryProps = OwnProps & PropsFromRedux & WithKibanaProps & CustomReduxProps; class TimelineQueryComponent extends QueryTemplate< TimelineQueryProps, @@ -101,7 +106,8 @@ class TimelineQueryComponent extends QueryTemplate< }; return ( - + query={timelineQuery} fetchPolicy="network-only" notifyOnNetworkStatusChange variables={variables} @@ -153,7 +159,7 @@ class TimelineQueryComponent extends QueryTemplate< getUpdatedAt: this.getUpdatedAt, }); }} - + ); } diff --git a/x-pack/legacy/plugins/siem/public/containers/timeline/notes/persist.gql_query.ts b/x-pack/legacy/plugins/siem/public/containers/timeline/notes/persist.gql_query.ts index fbb3c4cd8b3f7..ff9ea164acee4 100644 --- a/x-pack/legacy/plugins/siem/public/containers/timeline/notes/persist.gql_query.ts +++ b/x-pack/legacy/plugins/siem/public/containers/timeline/notes/persist.gql_query.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { gql } from '@apollo/client'; +import gql from 'graphql-tag'; export const persistTimelineNoteMutation = gql` mutation PersistTimelineNoteMutation($noteId: ID, $version: String, $note: NoteInput!) { diff --git a/x-pack/legacy/plugins/siem/public/containers/timeline/one/index.gql_query.ts b/x-pack/legacy/plugins/siem/public/containers/timeline/one/index.gql_query.ts index 8e5af210ddfd4..e68db445a5cbb 100644 --- a/x-pack/legacy/plugins/siem/public/containers/timeline/one/index.gql_query.ts +++ b/x-pack/legacy/plugins/siem/public/containers/timeline/one/index.gql_query.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { gql } from '@apollo/client'; +import gql from 'graphql-tag'; export const oneTimelineQuery = gql` query GetOneTimeline($id: ID!) { diff --git a/x-pack/legacy/plugins/siem/public/containers/timeline/persist.gql_query.ts b/x-pack/legacy/plugins/siem/public/containers/timeline/persist.gql_query.ts index 787a8027e5fef..6a0609f9158f3 100644 --- a/x-pack/legacy/plugins/siem/public/containers/timeline/persist.gql_query.ts +++ b/x-pack/legacy/plugins/siem/public/containers/timeline/persist.gql_query.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { gql } from '@apollo/client'; +import gql from 'graphql-tag'; export const persistTimelineMutation = gql` mutation PersistTimelineMutation($timelineId: ID, $version: String, $timeline: TimelineInput!) { diff --git a/x-pack/legacy/plugins/siem/public/containers/timeline/pinned_event/persist.gql_query.ts b/x-pack/legacy/plugins/siem/public/containers/timeline/pinned_event/persist.gql_query.ts index d66dc4fb28a00..7257dcb404011 100644 --- a/x-pack/legacy/plugins/siem/public/containers/timeline/pinned_event/persist.gql_query.ts +++ b/x-pack/legacy/plugins/siem/public/containers/timeline/pinned_event/persist.gql_query.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { gql } from '@apollo/client'; +import gql from 'graphql-tag'; export const persistTimelinePinnedEventMutation = gql` mutation PersistTimelinePinnedEventMutation($pinnedEventId: ID, $eventId: ID!, $timelineId: ID) { diff --git a/x-pack/legacy/plugins/siem/public/containers/tls/index.gql_query.ts b/x-pack/legacy/plugins/siem/public/containers/tls/index.gql_query.ts index 68b79adcbcf55..bbb92282bee83 100644 --- a/x-pack/legacy/plugins/siem/public/containers/tls/index.gql_query.ts +++ b/x-pack/legacy/plugins/siem/public/containers/tls/index.gql_query.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { gql } from '@apollo/client'; +import gql from 'graphql-tag'; export const tlsQuery = gql` query GetTlsQuery( diff --git a/x-pack/legacy/plugins/siem/public/containers/tls/index.tsx b/x-pack/legacy/plugins/siem/public/containers/tls/index.tsx index 77aa79c29fb81..3738355c8846e 100644 --- a/x-pack/legacy/plugins/siem/public/containers/tls/index.tsx +++ b/x-pack/legacy/plugins/siem/public/containers/tls/index.tsx @@ -6,6 +6,7 @@ import { getOr } from 'lodash/fp'; import React from 'react'; +import { Query } from 'react-apollo'; import { connect } from 'react-redux'; import { compose } from 'redux'; @@ -15,7 +16,6 @@ import { TlsEdges, TlsSortField, GetTlsQuery, - GetTlsQueryComponent, FlowTargetSourceDest, } from '../../graphql/types'; import { inputsModel, networkModel, networkSelectors, State, inputsSelectors } from '../../store'; @@ -23,6 +23,7 @@ import { withKibana, WithKibanaProps } from '../../lib/kibana'; import { createFilter, getDefaultFetchPolicy } from '../helpers'; import { generateTablePaginationOptions } from '../../components/paginated_table/helpers'; import { QueryTemplatePaginated, QueryTemplatePaginatedProps } from '../query_template_paginated'; +import { tlsQuery } from './index.gql_query'; const ID = 'tlsQuery'; @@ -39,7 +40,7 @@ export interface TlsArgs { } export interface OwnProps extends QueryTemplatePaginatedProps { - children: (args: TlsArgs) => React.ReactElement; + children: (args: TlsArgs) => React.ReactNode; flowTarget: FlowTargetSourceDest; ip: string; type: networkModel.NetworkType; @@ -92,7 +93,8 @@ class TlsComponentQuery extends QueryTemplatePaginated< }, }; return ( - + query={tlsQuery} fetchPolicy={getDefaultFetchPolicy()} notifyOnNetworkStatusChange skip={skip} @@ -134,7 +136,7 @@ class TlsComponentQuery extends QueryTemplatePaginated< totalCount: getOr(-1, 'source.Tls.totalCount', data), }); }} - + ); } } diff --git a/x-pack/legacy/plugins/siem/public/containers/uncommon_processes/index.gql_query.ts b/x-pack/legacy/plugins/siem/public/containers/uncommon_processes/index.gql_query.ts index 6ab980e338e32..d984de020faa1 100644 --- a/x-pack/legacy/plugins/siem/public/containers/uncommon_processes/index.gql_query.ts +++ b/x-pack/legacy/plugins/siem/public/containers/uncommon_processes/index.gql_query.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { gql } from '@apollo/client'; +import gql from 'graphql-tag'; export const uncommonProcessesQuery = gql` query GetUncommonProcessesQuery( diff --git a/x-pack/legacy/plugins/siem/public/containers/uncommon_processes/index.tsx b/x-pack/legacy/plugins/siem/public/containers/uncommon_processes/index.tsx index 06b6306bd1140..0a2ce67d9be80 100644 --- a/x-pack/legacy/plugins/siem/public/containers/uncommon_processes/index.tsx +++ b/x-pack/legacy/plugins/siem/public/containers/uncommon_processes/index.tsx @@ -6,13 +6,13 @@ import { getOr } from 'lodash/fp'; import React from 'react'; +import { Query } from 'react-apollo'; import { connect, ConnectedProps } from 'react-redux'; import { compose } from 'redux'; import { DEFAULT_INDEX_KEY } from '../../../common/constants'; import { GetUncommonProcessesQuery, - GetUncommonProcessesQueryComponent, PageInfoPaginated, UncommonProcessesEdges, } from '../../graphql/types'; @@ -22,6 +22,8 @@ import { generateTablePaginationOptions } from '../../components/paginated_table import { createFilter, getDefaultFetchPolicy } from '../helpers'; import { QueryTemplatePaginated, QueryTemplatePaginatedProps } from '../query_template_paginated'; +import { uncommonProcessesQuery } from './index.gql_query'; + const ID = 'uncommonProcessesQuery'; export interface UncommonProcessesArgs { @@ -37,7 +39,7 @@ export interface UncommonProcessesArgs { } export interface OwnProps extends QueryTemplatePaginatedProps { - children: (args: UncommonProcessesArgs) => React.ReactElement; + children: (args: UncommonProcessesArgs) => React.ReactNode; type: hostsModel.HostsType; } @@ -75,7 +77,8 @@ class UncommonProcessesComponentQuery extends QueryTemplatePaginated< }, }; return ( - + query={uncommonProcessesQuery} fetchPolicy={getDefaultFetchPolicy()} notifyOnNetworkStatusChange skip={skip} @@ -117,7 +120,7 @@ class UncommonProcessesComponentQuery extends QueryTemplatePaginated< uncommonProcesses, }); }} - + ); } } diff --git a/x-pack/legacy/plugins/siem/public/containers/users/index.gql_query.ts b/x-pack/legacy/plugins/siem/public/containers/users/index.gql_query.ts index a1ddff1a60e64..3fc1cdfd160db 100644 --- a/x-pack/legacy/plugins/siem/public/containers/users/index.gql_query.ts +++ b/x-pack/legacy/plugins/siem/public/containers/users/index.gql_query.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { gql } from '@apollo/client'; +import gql from 'graphql-tag'; export const usersQuery = gql` query GetUsersQuery( diff --git a/x-pack/legacy/plugins/siem/public/containers/users/index.tsx b/x-pack/legacy/plugins/siem/public/containers/users/index.tsx index f1e0351ef2fe3..5f71449c52460 100644 --- a/x-pack/legacy/plugins/siem/public/containers/users/index.tsx +++ b/x-pack/legacy/plugins/siem/public/containers/users/index.tsx @@ -6,23 +6,20 @@ import { getOr } from 'lodash/fp'; import React from 'react'; +import { Query } from 'react-apollo'; import { connect, ConnectedProps } from 'react-redux'; import { compose } from 'redux'; import { DEFAULT_INDEX_KEY } from '../../../common/constants'; -import { - GetUsersQuery, - FlowTarget, - PageInfoPaginated, - UsersEdges, - GetUsersQueryComponent, -} from '../../graphql/types'; +import { GetUsersQuery, FlowTarget, PageInfoPaginated, UsersEdges } from '../../graphql/types'; import { inputsModel, networkModel, networkSelectors, State, inputsSelectors } from '../../store'; import { withKibana, WithKibanaProps } from '../../lib/kibana'; import { createFilter, getDefaultFetchPolicy } from '../helpers'; import { generateTablePaginationOptions } from '../../components/paginated_table/helpers'; import { QueryTemplatePaginated, QueryTemplatePaginatedProps } from '../query_template_paginated'; +import { usersQuery } from './index.gql_query'; + const ID = 'usersQuery'; export interface UsersArgs { @@ -38,7 +35,7 @@ export interface UsersArgs { } export interface OwnProps extends QueryTemplatePaginatedProps { - children: (args: UsersArgs) => React.ReactElement; + children: (args: UsersArgs) => React.ReactNode; flowTarget: FlowTarget; ip: string; type: networkModel.NetworkType; @@ -84,7 +81,8 @@ class UsersComponentQuery extends QueryTemplatePaginated< }, }; return ( - + query={usersQuery} fetchPolicy={getDefaultFetchPolicy()} notifyOnNetworkStatusChange skip={skip} @@ -126,7 +124,7 @@ class UsersComponentQuery extends QueryTemplatePaginated< users, }); }} - + ); } } diff --git a/x-pack/legacy/plugins/siem/public/graphql/introspection.json b/x-pack/legacy/plugins/siem/public/graphql/introspection.json new file mode 100644 index 0000000000000..9802a5f5bd3bf --- /dev/null +++ b/x-pack/legacy/plugins/siem/public/graphql/introspection.json @@ -0,0 +1,12556 @@ +{ + "__schema": { + "queryType": { "name": "Query" }, + "mutationType": { "name": "Mutation" }, + "subscriptionType": null, + "types": [ + { + "kind": "OBJECT", + "name": "Query", + "description": "", + "fields": [ + { + "name": "getNote", + "description": "", + "args": [ + { + "name": "id", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "ID", "ofType": null } + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "NoteResult", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "getNotesByTimelineId", + "description": "", + "args": [ + { + "name": "timelineId", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "ID", "ofType": null } + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "NoteResult", "ofType": null } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "getNotesByEventId", + "description": "", + "args": [ + { + "name": "eventId", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "ID", "ofType": null } + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "NoteResult", "ofType": null } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "getAllNotes", + "description": "", + "args": [ + { + "name": "pageInfo", + "description": "", + "type": { "kind": "INPUT_OBJECT", "name": "PageInfoNote", "ofType": null }, + "defaultValue": null + }, + { + "name": "search", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "sort", + "description": "", + "type": { "kind": "INPUT_OBJECT", "name": "SortNote", "ofType": null }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "ResponseNotes", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "getAllPinnedEventsByTimelineId", + "description": "", + "args": [ + { + "name": "timelineId", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "ID", "ofType": null } + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "PinnedEvent", "ofType": null } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "source", + "description": "Get a security data source by id", + "args": [ + { + "name": "id", + "description": "The id of the source", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "ID", "ofType": null } + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "Source", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "allSources", + "description": "Get a list of all security data sources", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "Source", "ofType": null } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "getOneTimeline", + "description": "", + "args": [ + { + "name": "id", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "ID", "ofType": null } + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "TimelineResult", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "getAllTimeline", + "description": "", + "args": [ + { + "name": "pageInfo", + "description": "", + "type": { "kind": "INPUT_OBJECT", "name": "PageInfoTimeline", "ofType": null }, + "defaultValue": null + }, + { + "name": "search", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "sort", + "description": "", + "type": { "kind": "INPUT_OBJECT", "name": "SortTimeline", "ofType": null }, + "defaultValue": null + }, + { + "name": "onlyUserFavorite", + "description": "", + "type": { "kind": "SCALAR", "name": "Boolean", "ofType": null }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "ResponseTimelines", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "SCALAR", + "name": "ID", + "description": "The `ID` scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as `\"4\"`) or integer (such as `4`) input value will be accepted as an ID.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "NoteResult", + "description": "", + "fields": [ + { + "name": "eventId", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "note", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "timelineId", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "noteId", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "created", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdBy", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "timelineVersion", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updated", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updatedBy", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "version", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "SCALAR", + "name": "String", + "description": "The `String` scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "SCALAR", + "name": "Float", + "description": "The `Float` scalar type represents signed double-precision fractional values as specified by [IEEE 754](http://en.wikipedia.org/wiki/IEEE_floating_point). ", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "PageInfoNote", + "description": "", + "fields": null, + "inputFields": [ + { + "name": "pageIndex", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "Float", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "pageSize", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "Float", "ofType": null } + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "SortNote", + "description": "", + "fields": null, + "inputFields": [ + { + "name": "sortField", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "ENUM", "name": "SortFieldNote", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "sortOrder", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "ENUM", "name": "Direction", "ofType": null } + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "SortFieldNote", + "description": "", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "updatedBy", + "description": "", + "isDeprecated": false, + "deprecationReason": null + }, + { "name": "updated", "description": "", "isDeprecated": false, "deprecationReason": null } + ], + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "Direction", + "description": "", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { "name": "asc", "description": "", "isDeprecated": false, "deprecationReason": null }, + { "name": "desc", "description": "", "isDeprecated": false, "deprecationReason": null } + ], + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ResponseNotes", + "description": "", + "fields": [ + { + "name": "notes", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "NoteResult", "ofType": null } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "PinnedEvent", + "description": "", + "fields": [ + { + "name": "code", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "message", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pinnedEventId", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "ID", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "eventId", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ID", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "timelineId", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ID", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "timelineVersion", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "created", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdBy", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updated", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updatedBy", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "version", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "Source", + "description": "", + "fields": [ + { + "name": "id", + "description": "The id of the source", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "ID", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "configuration", + "description": "The raw configuration of the source", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "SourceConfiguration", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "status", + "description": "The status of the source", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "SourceStatus", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "Authentications", + "description": "Gets Authentication success and failures based on a timerange", + "args": [ + { + "name": "timerange", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "INPUT_OBJECT", "name": "TimerangeInput", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "pagination", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "PaginationInputPaginated", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "filterQuery", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "defaultIndex", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + } + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "AuthenticationsData", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "Timeline", + "description": "", + "args": [ + { + "name": "pagination", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "INPUT_OBJECT", "name": "PaginationInput", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "sortField", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "INPUT_OBJECT", "name": "SortField", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "fieldRequested", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + } + } + }, + "defaultValue": null + }, + { + "name": "timerange", + "description": "", + "type": { "kind": "INPUT_OBJECT", "name": "TimerangeInput", "ofType": null }, + "defaultValue": null + }, + { + "name": "filterQuery", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "defaultIndex", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + } + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "TimelineData", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "TimelineDetails", + "description": "", + "args": [ + { + "name": "eventId", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "indexName", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "defaultIndex", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + } + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "TimelineDetailsData", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "LastEventTime", + "description": "", + "args": [ + { + "name": "id", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "indexKey", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "ENUM", "name": "LastEventIndexKey", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "details", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "INPUT_OBJECT", "name": "LastTimeDetails", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "defaultIndex", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + } + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "LastEventTimeData", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "Hosts", + "description": "Gets Hosts based on timerange and specified criteria, or all events in the timerange if no criteria is specified", + "args": [ + { + "name": "id", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "timerange", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "INPUT_OBJECT", "name": "TimerangeInput", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "pagination", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "PaginationInputPaginated", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "sort", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "INPUT_OBJECT", "name": "HostsSortField", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "filterQuery", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "defaultIndex", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + } + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "HostsData", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "HostOverview", + "description": "", + "args": [ + { + "name": "id", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "hostName", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "timerange", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "INPUT_OBJECT", "name": "TimerangeInput", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "defaultIndex", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + } + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "HostItem", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "HostFirstLastSeen", + "description": "", + "args": [ + { + "name": "id", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "hostName", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "defaultIndex", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + } + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "FirstLastSeenHost", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "IpOverview", + "description": "", + "args": [ + { + "name": "id", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "filterQuery", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "ip", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "defaultIndex", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + } + } + }, + "defaultValue": null + } + ], + "type": { "kind": "OBJECT", "name": "IpOverviewData", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "Users", + "description": "", + "args": [ + { + "name": "filterQuery", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "id", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "ip", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "pagination", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "PaginationInputPaginated", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "sort", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "INPUT_OBJECT", "name": "UsersSortField", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "flowTarget", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "ENUM", "name": "FlowTarget", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "timerange", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "INPUT_OBJECT", "name": "TimerangeInput", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "defaultIndex", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + } + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "UsersData", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "KpiNetwork", + "description": "", + "args": [ + { + "name": "id", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "timerange", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "INPUT_OBJECT", "name": "TimerangeInput", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "filterQuery", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "defaultIndex", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + } + } + }, + "defaultValue": null + } + ], + "type": { "kind": "OBJECT", "name": "KpiNetworkData", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "KpiHosts", + "description": "", + "args": [ + { + "name": "id", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "timerange", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "INPUT_OBJECT", "name": "TimerangeInput", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "filterQuery", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "defaultIndex", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + } + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "KpiHostsData", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "KpiHostDetails", + "description": "", + "args": [ + { + "name": "id", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "timerange", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "INPUT_OBJECT", "name": "TimerangeInput", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "filterQuery", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "defaultIndex", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + } + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "KpiHostDetailsData", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "MatrixHistogram", + "description": "", + "args": [ + { + "name": "filterQuery", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "defaultIndex", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + } + } + }, + "defaultValue": null + }, + { + "name": "timerange", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "INPUT_OBJECT", "name": "TimerangeInput", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "stackByField", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "histogramType", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "ENUM", "name": "HistogramType", "ofType": null } + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "MatrixHistogramOverTimeData", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "NetworkTopCountries", + "description": "", + "args": [ + { + "name": "id", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "filterQuery", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "ip", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "flowTarget", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "ENUM", "name": "FlowTargetSourceDest", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "pagination", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "PaginationInputPaginated", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "sort", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "NetworkTopTablesSortField", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "timerange", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "INPUT_OBJECT", "name": "TimerangeInput", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "defaultIndex", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + } + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "NetworkTopCountriesData", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "NetworkTopNFlow", + "description": "", + "args": [ + { + "name": "id", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "filterQuery", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "ip", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "flowTarget", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "ENUM", "name": "FlowTargetSourceDest", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "pagination", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "PaginationInputPaginated", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "sort", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "NetworkTopTablesSortField", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "timerange", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "INPUT_OBJECT", "name": "TimerangeInput", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "defaultIndex", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + } + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "NetworkTopNFlowData", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "NetworkDns", + "description": "", + "args": [ + { + "name": "filterQuery", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "id", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "isPtrIncluded", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "Boolean", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "pagination", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "PaginationInputPaginated", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "sort", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "NetworkDnsSortField", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "stackByField", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "timerange", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "INPUT_OBJECT", "name": "TimerangeInput", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "defaultIndex", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + } + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "NetworkDnsData", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "NetworkDnsHistogram", + "description": "", + "args": [ + { + "name": "filterQuery", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "defaultIndex", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + } + } + }, + "defaultValue": null + }, + { + "name": "timerange", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "INPUT_OBJECT", "name": "TimerangeInput", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "stackByField", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "NetworkDsOverTimeData", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "NetworkHttp", + "description": "", + "args": [ + { + "name": "id", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "filterQuery", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "ip", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "pagination", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "PaginationInputPaginated", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "sort", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "NetworkHttpSortField", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "timerange", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "INPUT_OBJECT", "name": "TimerangeInput", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "defaultIndex", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + } + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "NetworkHttpData", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "OverviewNetwork", + "description": "", + "args": [ + { + "name": "id", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "timerange", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "INPUT_OBJECT", "name": "TimerangeInput", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "filterQuery", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "defaultIndex", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + } + } + }, + "defaultValue": null + } + ], + "type": { "kind": "OBJECT", "name": "OverviewNetworkData", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "OverviewHost", + "description": "", + "args": [ + { + "name": "id", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "timerange", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "INPUT_OBJECT", "name": "TimerangeInput", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "filterQuery", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "defaultIndex", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + } + } + }, + "defaultValue": null + } + ], + "type": { "kind": "OBJECT", "name": "OverviewHostData", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "Tls", + "description": "", + "args": [ + { + "name": "filterQuery", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "id", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "ip", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "pagination", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "PaginationInputPaginated", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "sort", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "INPUT_OBJECT", "name": "TlsSortField", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "flowTarget", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "ENUM", "name": "FlowTargetSourceDest", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "timerange", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "INPUT_OBJECT", "name": "TimerangeInput", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "defaultIndex", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + } + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "TlsData", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "UncommonProcesses", + "description": "Gets UncommonProcesses based on a timerange, or all UncommonProcesses if no criteria is specified", + "args": [ + { + "name": "timerange", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "INPUT_OBJECT", "name": "TimerangeInput", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "pagination", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "PaginationInputPaginated", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "filterQuery", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "defaultIndex", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + } + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "UncommonProcessesData", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "whoAmI", + "description": "Just a simple example to get the app name", + "args": [], + "type": { "kind": "OBJECT", "name": "SayMyName", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "SourceConfiguration", + "description": "A set of configuration options for a security data source", + "fields": [ + { + "name": "fields", + "description": "The field mapping to use for this source", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "SourceFields", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "SourceFields", + "description": "A mapping of semantic fields to their document counterparts", + "fields": [ + { + "name": "container", + "description": "The field to identify a container by", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "host", + "description": "The fields to identify a host by", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "message", + "description": "The fields that may contain the log event message. The first field found win.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pod", + "description": "The field to identify a pod by", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "tiebreaker", + "description": "The field to use as a tiebreaker for log events that have identical timestamps", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "timestamp", + "description": "The field to use as a timestamp for metrics and logs", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "SourceStatus", + "description": "The status of an infrastructure data source", + "fields": [ + { + "name": "indicesExist", + "description": "Whether the configured alias or wildcard pattern resolve to any auditbeat indices", + "args": [ + { + "name": "defaultIndex", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + } + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "Boolean", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "indexFields", + "description": "The list of fields defined in the index mappings", + "args": [ + { + "name": "defaultIndex", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + } + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "IndexField", "ofType": null } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "SCALAR", + "name": "Boolean", + "description": "The `Boolean` scalar type represents `true` or `false`.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "IndexField", + "description": "A descriptor of a field in an index", + "fields": [ + { + "name": "category", + "description": "Where the field belong", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "example", + "description": "Example of field's value", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "indexes", + "description": "whether the field's belong to an alias index", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": "The name of the field", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "type", + "description": "The type of the field's values as recognized by Kibana", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "searchable", + "description": "Whether the field's values can be efficiently searched for", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "Boolean", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "aggregatable", + "description": "Whether the field's values can be aggregated", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "Boolean", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "description", + "description": "Description of the field", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "format", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "TimerangeInput", + "description": "", + "fields": null, + "inputFields": [ + { + "name": "interval", + "description": "The interval string to use for last bucket. The format is '{value}{unit}'. For example '5m' would return the metrics for the last 5 minutes of the timespan.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "to", + "description": "The end of the timerange", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "Float", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "from", + "description": "The beginning of the timerange", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "Float", "ofType": null } + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "PaginationInputPaginated", + "description": "", + "fields": null, + "inputFields": [ + { + "name": "activePage", + "description": "The activePage parameter defines the page of results you want to fetch", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "Float", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "cursorStart", + "description": "The cursorStart parameter defines the start of the results to be displayed", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "Float", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "fakePossibleCount", + "description": "The fakePossibleCount parameter determines the total count in order to show 5 additional pages", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "Float", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "querySize", + "description": "The querySize parameter is the number of items to be returned", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "Float", "ofType": null } + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "AuthenticationsData", + "description": "", + "fields": [ + { + "name": "edges", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "AuthenticationsEdges", "ofType": null } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "Float", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "PageInfoPaginated", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "inspect", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "Inspect", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "AuthenticationsEdges", + "description": "", + "fields": [ + { + "name": "node", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "AuthenticationItem", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "cursor", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "CursorType", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "AuthenticationItem", + "description": "", + "fields": [ + { + "name": "_id", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "failures", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "Float", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "successes", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "Float", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "user", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "UserEcsFields", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "lastSuccess", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "LastSourceHost", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "lastFailure", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "LastSourceHost", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "UserEcsFields", + "description": "", + "fields": [ + { + "name": "domain", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "full_name", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "email", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "hash", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "group", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "SCALAR", + "name": "ToStringArray", + "description": "", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "LastSourceHost", + "description": "", + "fields": [ + { + "name": "timestamp", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Date", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "source", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "SourceEcsFields", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "host", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "HostEcsFields", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "SCALAR", + "name": "Date", + "description": "", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "SourceEcsFields", + "description": "", + "fields": [ + { + "name": "bytes", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ip", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "port", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "domain", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "geo", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "GeoEcsFields", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "packets", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "SCALAR", + "name": "ToNumberArray", + "description": "", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "GeoEcsFields", + "description": "", + "fields": [ + { + "name": "city_name", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "continent_name", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "country_iso_code", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "country_name", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "location", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "Location", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "region_iso_code", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "region_name", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "Location", + "description": "", + "fields": [ + { + "name": "lon", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "lat", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "HostEcsFields", + "description": "", + "fields": [ + { + "name": "architecture", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ip", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "mac", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "os", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "OsEcsFields", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "type", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "OsEcsFields", + "description": "", + "fields": [ + { + "name": "platform", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "full", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "family", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "version", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "kernel", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "CursorType", + "description": "", + "fields": [ + { + "name": "value", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "tiebreaker", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "PageInfoPaginated", + "description": "", + "fields": [ + { + "name": "activePage", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "Float", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "fakeTotalCount", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "Float", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "showMorePagesIndicator", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "Boolean", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "Inspect", + "description": "", + "fields": [ + { + "name": "dsl", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "response", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "PaginationInput", + "description": "", + "fields": null, + "inputFields": [ + { + "name": "limit", + "description": "The limit parameter allows you to configure the maximum amount of items to be returned", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "Float", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "cursor", + "description": "The cursor parameter defines the next result you want to fetch", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "tiebreaker", + "description": "The tiebreaker parameter allow to be more precise to fetch the next item", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "SortField", + "description": "", + "fields": null, + "inputFields": [ + { + "name": "sortFieldId", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "direction", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "ENUM", "name": "Direction", "ofType": null } + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "TimelineData", + "description": "", + "fields": [ + { + "name": "edges", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "TimelineEdges", "ofType": null } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "Float", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "PageInfo", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "inspect", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "Inspect", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "TimelineEdges", + "description": "", + "fields": [ + { + "name": "node", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "TimelineItem", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "cursor", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "CursorType", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "TimelineItem", + "description": "", + "fields": [ + { + "name": "_id", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "_index", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "data", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "TimelineNonEcsData", "ofType": null } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ecs", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "ECS", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "TimelineNonEcsData", + "description": "", + "fields": [ + { + "name": "field", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "value", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ECS", + "description": "", + "fields": [ + { + "name": "_id", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "_index", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "auditd", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "AuditdEcsFields", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "destination", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "DestinationEcsFields", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "dns", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "DnsEcsFields", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "endgame", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "EndgameEcsFields", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "event", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "EventEcsFields", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "geo", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "GeoEcsFields", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "host", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "HostEcsFields", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "network", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "NetworkEcsField", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "rule", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "RuleEcsField", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "signal", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "SignalField", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "source", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "SourceEcsFields", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "suricata", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "SuricataEcsFields", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "tls", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "TlsEcsFields", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "zeek", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "ZeekEcsFields", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "http", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "HttpEcsFields", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "url", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "UrlEcsFields", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "timestamp", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Date", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "message", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "user", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "UserEcsFields", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "winlog", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "WinlogEcsFields", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "process", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "ProcessEcsFields", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "file", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "FileFields", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "system", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "SystemEcsField", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "AuditdEcsFields", + "description": "", + "fields": [ + { + "name": "result", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "session", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "data", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "AuditdData", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "summary", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "Summary", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "sequence", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "AuditdData", + "description": "", + "fields": [ + { + "name": "acct", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "terminal", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "op", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "Summary", + "description": "", + "fields": [ + { + "name": "actor", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "PrimarySecondary", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "object", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "PrimarySecondary", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "how", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "message_type", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "sequence", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "PrimarySecondary", + "description": "", + "fields": [ + { + "name": "primary", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "secondary", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "type", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "DestinationEcsFields", + "description": "", + "fields": [ + { + "name": "bytes", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ip", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "port", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "domain", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "geo", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "GeoEcsFields", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "packets", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "DnsEcsFields", + "description": "", + "fields": [ + { + "name": "question", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "DnsQuestionData", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "resolved_ip", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "response_code", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "DnsQuestionData", + "description": "", + "fields": [ + { + "name": "name", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "type", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "EndgameEcsFields", + "description": "", + "fields": [ + { + "name": "exit_code", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "file_name", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "file_path", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "logon_type", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "parent_process_name", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pid", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "process_name", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "subject_domain_name", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "subject_logon_id", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "subject_user_name", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "target_domain_name", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "target_logon_id", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "target_user_name", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "EventEcsFields", + "description": "", + "fields": [ + { + "name": "action", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "category", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "code", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "created", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToDateArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "dataset", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "duration", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "end", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToDateArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "hash", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "kind", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "module", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "original", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "outcome", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "risk_score", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "risk_score_norm", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "severity", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "start", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToDateArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "timezone", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "type", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "SCALAR", + "name": "ToDateArray", + "description": "", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "NetworkEcsField", + "description": "", + "fields": [ + { + "name": "bytes", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "community_id", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "direction", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "packets", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "protocol", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "transport", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "RuleEcsField", + "description": "", + "fields": [ + { + "name": "reference", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "SignalField", + "description": "", + "fields": [ + { + "name": "rule", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "RuleField", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "original_time", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "RuleField", + "description": "", + "fields": [ + { + "name": "id", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "rule_id", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "false_positives", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "saved_id", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "timeline_id", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "timeline_title", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "max_signals", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "risk_score", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "output_index", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "description", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "from", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "immutable", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToBooleanArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "index", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "interval", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "language", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "query", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "references", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "severity", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "tags", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "threat", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToAny", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "type", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "size", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "to", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "enabled", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToBooleanArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "filters", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToAny", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "created_at", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updated_at", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "created_by", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updated_by", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "version", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "SCALAR", + "name": "ToBooleanArray", + "description": "", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "SCALAR", + "name": "ToAny", + "description": "", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "SuricataEcsFields", + "description": "", + "fields": [ + { + "name": "eve", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "SuricataEveData", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "SuricataEveData", + "description": "", + "fields": [ + { + "name": "alert", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "SuricataAlertData", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "flow_id", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "proto", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "SuricataAlertData", + "description": "", + "fields": [ + { + "name": "signature", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "signature_id", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "TlsEcsFields", + "description": "", + "fields": [ + { + "name": "client_certificate", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "TlsClientCertificateData", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "fingerprints", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "TlsFingerprintsData", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "server_certificate", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "TlsServerCertificateData", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "TlsClientCertificateData", + "description": "", + "fields": [ + { + "name": "fingerprint", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "FingerprintData", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "FingerprintData", + "description": "", + "fields": [ + { + "name": "sha1", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "TlsFingerprintsData", + "description": "", + "fields": [ + { + "name": "ja3", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "TlsJa3Data", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "TlsJa3Data", + "description": "", + "fields": [ + { + "name": "hash", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "TlsServerCertificateData", + "description": "", + "fields": [ + { + "name": "fingerprint", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "FingerprintData", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ZeekEcsFields", + "description": "", + "fields": [ + { + "name": "session_id", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "connection", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "ZeekConnectionData", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "notice", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "ZeekNoticeData", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "dns", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "ZeekDnsData", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "http", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "ZeekHttpData", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "files", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "ZeekFileData", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ssl", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "ZeekSslData", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ZeekConnectionData", + "description": "", + "fields": [ + { + "name": "local_resp", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToBooleanArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "local_orig", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToBooleanArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "missed_bytes", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "state", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "history", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ZeekNoticeData", + "description": "", + "fields": [ + { + "name": "suppress_for", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "msg", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "note", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "sub", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "dst", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "dropped", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToBooleanArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "peer_descr", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ZeekDnsData", + "description": "", + "fields": [ + { + "name": "AA", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToBooleanArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "qclass_name", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "RD", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToBooleanArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "qtype_name", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "rejected", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToBooleanArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "qtype", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "query", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "trans_id", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "qclass", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "RA", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToBooleanArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "TC", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToBooleanArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ZeekHttpData", + "description": "", + "fields": [ + { + "name": "resp_mime_types", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "trans_depth", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "status_msg", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "resp_fuids", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "tags", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ZeekFileData", + "description": "", + "fields": [ + { + "name": "session_ids", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "timedout", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToBooleanArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "local_orig", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToBooleanArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "tx_host", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "source", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "is_orig", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToBooleanArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "overflow_bytes", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "sha1", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "duration", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "depth", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "analyzers", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "mime_type", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "rx_host", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "total_bytes", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "fuid", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "seen_bytes", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "missing_bytes", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "md5", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ZeekSslData", + "description": "", + "fields": [ + { + "name": "cipher", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "established", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToBooleanArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "resumed", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToBooleanArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "version", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "HttpEcsFields", + "description": "", + "fields": [ + { + "name": "version", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "request", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "HttpRequestData", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "response", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "HttpResponseData", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "HttpRequestData", + "description": "", + "fields": [ + { + "name": "method", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "body", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "HttpBodyData", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "referrer", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "bytes", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "HttpBodyData", + "description": "", + "fields": [ + { + "name": "content", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "bytes", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "HttpResponseData", + "description": "", + "fields": [ + { + "name": "status_code", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "body", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "HttpBodyData", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "bytes", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "UrlEcsFields", + "description": "", + "fields": [ + { + "name": "domain", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "original", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "username", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "password", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "WinlogEcsFields", + "description": "", + "fields": [ + { + "name": "event_id", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ProcessEcsFields", + "description": "", + "fields": [ + { + "name": "hash", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "ProcessHashData", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pid", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ppid", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "args", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "executable", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "title", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "thread", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "Thread", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "working_directory", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ProcessHashData", + "description": "", + "fields": [ + { + "name": "md5", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "sha1", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "sha256", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "Thread", + "description": "", + "fields": [ + { + "name": "id", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "start", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "FileFields", + "description": "", + "fields": [ + { + "name": "name", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "path", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "target_path", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "extension", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "type", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "device", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "inode", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "uid", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "owner", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "gid", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "group", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "mode", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "size", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "mtime", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToDateArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ctime", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToDateArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "SystemEcsField", + "description": "", + "fields": [ + { + "name": "audit", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "AuditEcsFields", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "auth", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "AuthEcsFields", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "AuditEcsFields", + "description": "", + "fields": [ + { + "name": "package", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "PackageEcsFields", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "PackageEcsFields", + "description": "", + "fields": [ + { + "name": "arch", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "entity_id", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "size", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "summary", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "version", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "AuthEcsFields", + "description": "", + "fields": [ + { + "name": "ssh", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "SshEcsFields", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "SshEcsFields", + "description": "", + "fields": [ + { + "name": "method", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "signature", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "PageInfo", + "description": "", + "fields": [ + { + "name": "endCursor", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "CursorType", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "hasNextPage", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Boolean", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "TimelineDetailsData", + "description": "", + "fields": [ + { + "name": "data", + "description": "", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "DetailItem", "ofType": null } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "inspect", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "Inspect", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "DetailItem", + "description": "", + "fields": [ + { + "name": "field", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "values", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "originalValue", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "EsValue", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "SCALAR", + "name": "EsValue", + "description": "", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "LastEventIndexKey", + "description": "", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "hostDetails", + "description": "", + "isDeprecated": false, + "deprecationReason": null + }, + { "name": "hosts", "description": "", "isDeprecated": false, "deprecationReason": null }, + { + "name": "ipDetails", + "description": "", + "isDeprecated": false, + "deprecationReason": null + }, + { "name": "network", "description": "", "isDeprecated": false, "deprecationReason": null } + ], + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "LastTimeDetails", + "description": "", + "fields": null, + "inputFields": [ + { + "name": "hostName", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "ip", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "LastEventTimeData", + "description": "", + "fields": [ + { + "name": "lastSeen", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Date", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "inspect", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "Inspect", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "HostsSortField", + "description": "", + "fields": null, + "inputFields": [ + { + "name": "field", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "ENUM", "name": "HostsFields", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "direction", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "ENUM", "name": "Direction", "ofType": null } + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "HostsFields", + "description": "", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "hostName", + "description": "", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "lastSeen", + "description": "", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "HostsData", + "description": "", + "fields": [ + { + "name": "edges", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "HostsEdges", "ofType": null } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "Float", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "PageInfoPaginated", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "inspect", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "Inspect", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "HostsEdges", + "description": "", + "fields": [ + { + "name": "node", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "HostItem", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "cursor", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "CursorType", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "HostItem", + "description": "", + "fields": [ + { + "name": "_id", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "lastSeen", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Date", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "host", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "HostEcsFields", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "cloud", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "CloudFields", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "inspect", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "Inspect", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "CloudFields", + "description": "", + "fields": [ + { + "name": "instance", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "CloudInstance", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "machine", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "CloudMachine", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "provider", + "description": "", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "region", + "description": "", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "CloudInstance", + "description": "", + "fields": [ + { + "name": "id", + "description": "", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "CloudMachine", + "description": "", + "fields": [ + { + "name": "type", + "description": "", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "FirstLastSeenHost", + "description": "", + "fields": [ + { + "name": "inspect", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "Inspect", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "firstSeen", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Date", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "lastSeen", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Date", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "IpOverviewData", + "description": "", + "fields": [ + { + "name": "client", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "Overview", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "destination", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "Overview", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "host", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "HostEcsFields", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "server", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "Overview", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "source", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "Overview", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "inspect", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "Inspect", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "Overview", + "description": "", + "fields": [ + { + "name": "firstSeen", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Date", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "lastSeen", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Date", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "autonomousSystem", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "AutonomousSystem", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "geo", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "GeoEcsFields", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "AutonomousSystem", + "description": "", + "fields": [ + { + "name": "number", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "organization", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "AutonomousSystemOrganization", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "AutonomousSystemOrganization", + "description": "", + "fields": [ + { + "name": "name", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "UsersSortField", + "description": "", + "fields": null, + "inputFields": [ + { + "name": "field", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "ENUM", "name": "UsersFields", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "direction", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "ENUM", "name": "Direction", "ofType": null } + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "UsersFields", + "description": "", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { "name": "name", "description": "", "isDeprecated": false, "deprecationReason": null }, + { "name": "count", "description": "", "isDeprecated": false, "deprecationReason": null } + ], + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "FlowTarget", + "description": "", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { "name": "client", "description": "", "isDeprecated": false, "deprecationReason": null }, + { + "name": "destination", + "description": "", + "isDeprecated": false, + "deprecationReason": null + }, + { "name": "server", "description": "", "isDeprecated": false, "deprecationReason": null }, + { "name": "source", "description": "", "isDeprecated": false, "deprecationReason": null } + ], + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "UsersData", + "description": "", + "fields": [ + { + "name": "edges", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "UsersEdges", "ofType": null } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "Float", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "PageInfoPaginated", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "inspect", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "Inspect", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "UsersEdges", + "description": "", + "fields": [ + { + "name": "node", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "UsersNode", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "cursor", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "CursorType", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "UsersNode", + "description": "", + "fields": [ + { + "name": "_id", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "timestamp", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Date", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "user", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "UsersItem", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "UsersItem", + "description": "", + "fields": [ + { + "name": "name", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "groupId", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "groupName", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "count", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "KpiNetworkData", + "description": "", + "fields": [ + { + "name": "networkEvents", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "uniqueFlowId", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "uniqueSourcePrivateIps", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "uniqueSourcePrivateIpsHistogram", + "description": "", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "KpiNetworkHistogramData", "ofType": null } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "uniqueDestinationPrivateIps", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "uniqueDestinationPrivateIpsHistogram", + "description": "", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "KpiNetworkHistogramData", "ofType": null } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "dnsQueries", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "tlsHandshakes", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "inspect", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "Inspect", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "KpiNetworkHistogramData", + "description": "", + "fields": [ + { + "name": "x", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "y", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "KpiHostsData", + "description": "", + "fields": [ + { + "name": "hosts", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "hostsHistogram", + "description": "", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "KpiHostHistogramData", "ofType": null } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "authSuccess", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "authSuccessHistogram", + "description": "", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "KpiHostHistogramData", "ofType": null } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "authFailure", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "authFailureHistogram", + "description": "", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "KpiHostHistogramData", "ofType": null } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "uniqueSourceIps", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "uniqueSourceIpsHistogram", + "description": "", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "KpiHostHistogramData", "ofType": null } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "uniqueDestinationIps", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "uniqueDestinationIpsHistogram", + "description": "", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "KpiHostHistogramData", "ofType": null } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "inspect", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "Inspect", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "KpiHostHistogramData", + "description": "", + "fields": [ + { + "name": "x", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "y", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "KpiHostDetailsData", + "description": "", + "fields": [ + { + "name": "authSuccess", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "authSuccessHistogram", + "description": "", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "KpiHostHistogramData", "ofType": null } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "authFailure", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "authFailureHistogram", + "description": "", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "KpiHostHistogramData", "ofType": null } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "uniqueSourceIps", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "uniqueSourceIpsHistogram", + "description": "", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "KpiHostHistogramData", "ofType": null } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "uniqueDestinationIps", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "uniqueDestinationIpsHistogram", + "description": "", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "KpiHostHistogramData", "ofType": null } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "inspect", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "Inspect", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "HistogramType", + "description": "", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "authentications", + "description": "", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "anomalies", + "description": "", + "isDeprecated": false, + "deprecationReason": null + }, + { "name": "events", "description": "", "isDeprecated": false, "deprecationReason": null }, + { "name": "alerts", "description": "", "isDeprecated": false, "deprecationReason": null }, + { "name": "dns", "description": "", "isDeprecated": false, "deprecationReason": null } + ], + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "MatrixHistogramOverTimeData", + "description": "", + "fields": [ + { + "name": "inspect", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "Inspect", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "matrixHistogramData", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "MatrixOverTimeHistogramData", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "Float", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "MatrixOverTimeHistogramData", + "description": "", + "fields": [ + { + "name": "x", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "y", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "g", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "FlowTargetSourceDest", + "description": "", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "destination", + "description": "", + "isDeprecated": false, + "deprecationReason": null + }, + { "name": "source", "description": "", "isDeprecated": false, "deprecationReason": null } + ], + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "NetworkTopTablesSortField", + "description": "", + "fields": null, + "inputFields": [ + { + "name": "field", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "ENUM", "name": "NetworkTopTablesFields", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "direction", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "ENUM", "name": "Direction", "ofType": null } + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "NetworkTopTablesFields", + "description": "", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "bytes_in", + "description": "", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "bytes_out", + "description": "", + "isDeprecated": false, + "deprecationReason": null + }, + { "name": "flows", "description": "", "isDeprecated": false, "deprecationReason": null }, + { + "name": "destination_ips", + "description": "", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "source_ips", + "description": "", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "NetworkTopCountriesData", + "description": "", + "fields": [ + { + "name": "edges", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "NetworkTopCountriesEdges", "ofType": null } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "Float", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "PageInfoPaginated", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "inspect", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "Inspect", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "NetworkTopCountriesEdges", + "description": "", + "fields": [ + { + "name": "node", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "NetworkTopCountriesItem", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "cursor", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "CursorType", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "NetworkTopCountriesItem", + "description": "", + "fields": [ + { + "name": "_id", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "source", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "TopCountriesItemSource", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "destination", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "TopCountriesItemDestination", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "network", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "TopNetworkTablesEcsField", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "TopCountriesItemSource", + "description": "", + "fields": [ + { + "name": "country", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "destination_ips", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "flows", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "location", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "GeoItem", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "source_ips", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "GeoItem", + "description": "", + "fields": [ + { + "name": "geo", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "GeoEcsFields", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "flowTarget", + "description": "", + "args": [], + "type": { "kind": "ENUM", "name": "FlowTargetSourceDest", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "TopCountriesItemDestination", + "description": "", + "fields": [ + { + "name": "country", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "destination_ips", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "flows", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "location", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "GeoItem", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "source_ips", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "TopNetworkTablesEcsField", + "description": "", + "fields": [ + { + "name": "bytes_in", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "bytes_out", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "NetworkTopNFlowData", + "description": "", + "fields": [ + { + "name": "edges", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "NetworkTopNFlowEdges", "ofType": null } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "Float", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "PageInfoPaginated", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "inspect", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "Inspect", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "NetworkTopNFlowEdges", + "description": "", + "fields": [ + { + "name": "node", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "NetworkTopNFlowItem", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "cursor", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "CursorType", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "NetworkTopNFlowItem", + "description": "", + "fields": [ + { + "name": "_id", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "source", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "TopNFlowItemSource", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "destination", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "TopNFlowItemDestination", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "network", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "TopNetworkTablesEcsField", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "TopNFlowItemSource", + "description": "", + "fields": [ + { + "name": "autonomous_system", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "AutonomousSystemItem", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "domain", + "description": "", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ip", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "location", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "GeoItem", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "flows", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "destination_ips", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "AutonomousSystemItem", + "description": "", + "fields": [ + { + "name": "name", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "number", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "TopNFlowItemDestination", + "description": "", + "fields": [ + { + "name": "autonomous_system", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "AutonomousSystemItem", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "domain", + "description": "", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ip", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "location", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "GeoItem", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "flows", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "source_ips", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "NetworkDnsSortField", + "description": "", + "fields": null, + "inputFields": [ + { + "name": "field", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "ENUM", "name": "NetworkDnsFields", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "direction", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "ENUM", "name": "Direction", "ofType": null } + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "NetworkDnsFields", + "description": "", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "dnsName", + "description": "", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "queryCount", + "description": "", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "uniqueDomains", + "description": "", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "dnsBytesIn", + "description": "", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "dnsBytesOut", + "description": "", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "NetworkDnsData", + "description": "", + "fields": [ + { + "name": "edges", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "NetworkDnsEdges", "ofType": null } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "Float", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "PageInfoPaginated", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "inspect", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "Inspect", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "histogram", + "description": "", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "MatrixOverOrdinalHistogramData", + "ofType": null + } + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "NetworkDnsEdges", + "description": "", + "fields": [ + { + "name": "node", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "NetworkDnsItem", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "cursor", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "CursorType", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "NetworkDnsItem", + "description": "", + "fields": [ + { + "name": "_id", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "dnsBytesIn", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "dnsBytesOut", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "dnsName", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "queryCount", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "uniqueDomains", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "MatrixOverOrdinalHistogramData", + "description": "", + "fields": [ + { + "name": "x", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "y", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "Float", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "g", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "NetworkDsOverTimeData", + "description": "", + "fields": [ + { + "name": "inspect", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "Inspect", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "matrixHistogramData", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "MatrixOverTimeHistogramData", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "Float", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "NetworkHttpSortField", + "description": "", + "fields": null, + "inputFields": [ + { + "name": "direction", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "ENUM", "name": "Direction", "ofType": null } + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "NetworkHttpData", + "description": "", + "fields": [ + { + "name": "edges", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "NetworkHttpEdges", "ofType": null } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "Float", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "PageInfoPaginated", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "inspect", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "Inspect", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "NetworkHttpEdges", + "description": "", + "fields": [ + { + "name": "node", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "NetworkHttpItem", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "cursor", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "CursorType", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "NetworkHttpItem", + "description": "", + "fields": [ + { + "name": "_id", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "domains", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "lastHost", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "lastSourceIp", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "methods", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "path", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "requestCount", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "statuses", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "OverviewNetworkData", + "description": "", + "fields": [ + { + "name": "auditbeatSocket", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "filebeatCisco", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "filebeatNetflow", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "filebeatPanw", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "filebeatSuricata", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "filebeatZeek", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "packetbeatDNS", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "packetbeatFlow", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "packetbeatTLS", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "inspect", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "Inspect", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "OverviewHostData", + "description": "", + "fields": [ + { + "name": "auditbeatAuditd", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "auditbeatFIM", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "auditbeatLogin", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "auditbeatPackage", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "auditbeatProcess", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "auditbeatUser", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "endgameDns", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "endgameFile", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "endgameImageLoad", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "endgameNetwork", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "endgameProcess", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "endgameRegistry", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "endgameSecurity", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "filebeatSystemModule", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "winlogbeatSecurity", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "winlogbeatMWSysmonOperational", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "inspect", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "Inspect", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "TlsSortField", + "description": "", + "fields": null, + "inputFields": [ + { + "name": "field", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "ENUM", "name": "TlsFields", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "direction", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "ENUM", "name": "Direction", "ofType": null } + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "TlsFields", + "description": "", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { "name": "_id", "description": "", "isDeprecated": false, "deprecationReason": null } + ], + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "TlsData", + "description": "", + "fields": [ + { + "name": "edges", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "TlsEdges", "ofType": null } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "Float", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "PageInfoPaginated", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "inspect", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "Inspect", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "TlsEdges", + "description": "", + "fields": [ + { + "name": "node", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "TlsNode", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "cursor", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "CursorType", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "TlsNode", + "description": "", + "fields": [ + { + "name": "_id", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "timestamp", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Date", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "alternativeNames", + "description": "", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "notAfter", + "description": "", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "commonNames", + "description": "", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ja3", + "description": "", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "issuerNames", + "description": "", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "UncommonProcessesData", + "description": "", + "fields": [ + { + "name": "edges", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "UncommonProcessesEdges", "ofType": null } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "Float", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "PageInfoPaginated", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "inspect", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "Inspect", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "UncommonProcessesEdges", + "description": "", + "fields": [ + { + "name": "node", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "UncommonProcessItem", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "cursor", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "CursorType", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "UncommonProcessItem", + "description": "", + "fields": [ + { + "name": "_id", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "instances", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "Float", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "process", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "ProcessEcsFields", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "hosts", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "HostEcsFields", "ofType": null } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "user", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "UserEcsFields", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "SayMyName", + "description": "", + "fields": [ + { + "name": "appName", + "description": "The id of the source", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "TimelineResult", + "description": "", + "fields": [ + { + "name": "columns", + "description": "", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "ColumnHeaderResult", "ofType": null } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "created", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdBy", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "dataProviders", + "description": "", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "DataProviderResult", "ofType": null } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "dateRange", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "DateRangePickerResult", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "description", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "eventIdToNoteIds", + "description": "", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "NoteResult", "ofType": null } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "eventType", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "favorite", + "description": "", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "FavoriteTimelineResult", "ofType": null } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "filters", + "description": "", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "FilterTimelineResult", "ofType": null } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "kqlMode", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "kqlQuery", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "SerializedFilterQueryResult", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "notes", + "description": "", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "NoteResult", "ofType": null } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "noteIds", + "description": "", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pinnedEventIds", + "description": "", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pinnedEventsSaveObject", + "description": "", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "PinnedEvent", "ofType": null } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "savedQueryId", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "savedObjectId", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "sort", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "SortTimelineResult", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "title", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updated", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updatedBy", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "version", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ColumnHeaderResult", + "description": "", + "fields": [ + { + "name": "aggregatable", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Boolean", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "category", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "columnHeaderType", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "description", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "example", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "indexes", + "description": "", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "placeholder", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "searchable", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Boolean", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "type", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "DataProviderResult", + "description": "", + "fields": [ + { + "name": "id", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "enabled", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Boolean", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "excluded", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Boolean", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "kqlQuery", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "queryMatch", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "QueryMatchResult", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "and", + "description": "", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "DataProviderResult", "ofType": null } + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "QueryMatchResult", + "description": "", + "fields": [ + { + "name": "field", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "displayField", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "value", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "displayValue", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "operator", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "DateRangePickerResult", + "description": "", + "fields": [ + { + "name": "start", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "end", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "FavoriteTimelineResult", + "description": "", + "fields": [ + { + "name": "fullName", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "userName", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "favoriteDate", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "FilterTimelineResult", + "description": "", + "fields": [ + { + "name": "exists", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "meta", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "FilterMetaTimelineResult", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "match_all", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "missing", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "query", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "range", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "script", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "FilterMetaTimelineResult", + "description": "", + "fields": [ + { + "name": "alias", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "controlledBy", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "disabled", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Boolean", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "field", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "formattedValue", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "index", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "key", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "negate", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Boolean", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "params", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "type", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "value", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "SerializedFilterQueryResult", + "description": "", + "fields": [ + { + "name": "filterQuery", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "SerializedKueryQueryResult", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "SerializedKueryQueryResult", + "description": "", + "fields": [ + { + "name": "kuery", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "KueryFilterQueryResult", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "serializedQuery", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "KueryFilterQueryResult", + "description": "", + "fields": [ + { + "name": "kind", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "expression", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "SortTimelineResult", + "description": "", + "fields": [ + { + "name": "columnId", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "sortDirection", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "PageInfoTimeline", + "description": "", + "fields": null, + "inputFields": [ + { + "name": "pageIndex", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "Float", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "pageSize", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "Float", "ofType": null } + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "SortTimeline", + "description": "", + "fields": null, + "inputFields": [ + { + "name": "sortField", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "ENUM", "name": "SortFieldTimeline", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "sortOrder", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "ENUM", "name": "Direction", "ofType": null } + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "SortFieldTimeline", + "description": "", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { "name": "title", "description": "", "isDeprecated": false, "deprecationReason": null }, + { + "name": "description", + "description": "", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updated", + "description": "", + "isDeprecated": false, + "deprecationReason": null + }, + { "name": "created", "description": "", "isDeprecated": false, "deprecationReason": null } + ], + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ResponseTimelines", + "description": "", + "fields": [ + { + "name": "timeline", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { "kind": "OBJECT", "name": "TimelineResult", "ofType": null } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "Mutation", + "description": "", + "fields": [ + { + "name": "persistNote", + "description": "Persists a note", + "args": [ + { + "name": "noteId", + "description": "", + "type": { "kind": "SCALAR", "name": "ID", "ofType": null }, + "defaultValue": null + }, + { + "name": "version", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "note", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "INPUT_OBJECT", "name": "NoteInput", "ofType": null } + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "ResponseNote", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "deleteNote", + "description": "", + "args": [ + { + "name": "id", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "ID", "ofType": null } + } + } + }, + "defaultValue": null + } + ], + "type": { "kind": "SCALAR", "name": "Boolean", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "deleteNoteByTimelineId", + "description": "", + "args": [ + { + "name": "timelineId", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "ID", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "version", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + } + ], + "type": { "kind": "SCALAR", "name": "Boolean", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "persistPinnedEventOnTimeline", + "description": "Persists a pinned event in a timeline", + "args": [ + { + "name": "pinnedEventId", + "description": "", + "type": { "kind": "SCALAR", "name": "ID", "ofType": null }, + "defaultValue": null + }, + { + "name": "eventId", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "ID", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "timelineId", + "description": "", + "type": { "kind": "SCALAR", "name": "ID", "ofType": null }, + "defaultValue": null + } + ], + "type": { "kind": "OBJECT", "name": "PinnedEvent", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "deletePinnedEventOnTimeline", + "description": "Remove a pinned events in a timeline", + "args": [ + { + "name": "id", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "ID", "ofType": null } + } + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "Boolean", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "deleteAllPinnedEventsOnTimeline", + "description": "Remove all pinned events in a timeline", + "args": [ + { + "name": "timelineId", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "ID", "ofType": null } + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "Boolean", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "persistTimeline", + "description": "Persists a timeline", + "args": [ + { + "name": "id", + "description": "", + "type": { "kind": "SCALAR", "name": "ID", "ofType": null }, + "defaultValue": null + }, + { + "name": "version", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "timeline", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "INPUT_OBJECT", "name": "TimelineInput", "ofType": null } + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "ResponseTimeline", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "persistFavorite", + "description": "", + "args": [ + { + "name": "timelineId", + "description": "", + "type": { "kind": "SCALAR", "name": "ID", "ofType": null }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "ResponseFavoriteTimeline", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "deleteTimeline", + "description": "", + "args": [ + { + "name": "id", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "ID", "ofType": null } + } + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "Boolean", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "NoteInput", + "description": "", + "fields": null, + "inputFields": [ + { + "name": "eventId", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "note", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "timelineId", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ResponseNote", + "description": "", + "fields": [ + { + "name": "code", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "message", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "note", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "NoteResult", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "TimelineInput", + "description": "", + "fields": null, + "inputFields": [ + { + "name": "columns", + "description": "", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "INPUT_OBJECT", "name": "ColumnHeaderInput", "ofType": null } + } + }, + "defaultValue": null + }, + { + "name": "dataProviders", + "description": "", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "INPUT_OBJECT", "name": "DataProviderInput", "ofType": null } + } + }, + "defaultValue": null + }, + { + "name": "description", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "eventType", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "filters", + "description": "", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "INPUT_OBJECT", "name": "FilterTimelineInput", "ofType": null } + } + }, + "defaultValue": null + }, + { + "name": "kqlMode", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "kqlQuery", + "description": "", + "type": { + "kind": "INPUT_OBJECT", + "name": "SerializedFilterQueryInput", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "title", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "dateRange", + "description": "", + "type": { "kind": "INPUT_OBJECT", "name": "DateRangePickerInput", "ofType": null }, + "defaultValue": null + }, + { + "name": "savedQueryId", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "sort", + "description": "", + "type": { "kind": "INPUT_OBJECT", "name": "SortTimelineInput", "ofType": null }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "ColumnHeaderInput", + "description": "", + "fields": null, + "inputFields": [ + { + "name": "aggregatable", + "description": "", + "type": { "kind": "SCALAR", "name": "Boolean", "ofType": null }, + "defaultValue": null + }, + { + "name": "category", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "columnHeaderType", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "description", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "example", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "indexes", + "description": "", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + } + }, + "defaultValue": null + }, + { + "name": "id", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "name", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "placeholder", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "searchable", + "description": "", + "type": { "kind": "SCALAR", "name": "Boolean", "ofType": null }, + "defaultValue": null + }, + { + "name": "type", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "DataProviderInput", + "description": "", + "fields": null, + "inputFields": [ + { + "name": "id", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "name", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "enabled", + "description": "", + "type": { "kind": "SCALAR", "name": "Boolean", "ofType": null }, + "defaultValue": null + }, + { + "name": "excluded", + "description": "", + "type": { "kind": "SCALAR", "name": "Boolean", "ofType": null }, + "defaultValue": null + }, + { + "name": "kqlQuery", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "queryMatch", + "description": "", + "type": { "kind": "INPUT_OBJECT", "name": "QueryMatchInput", "ofType": null }, + "defaultValue": null + }, + { + "name": "and", + "description": "", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "INPUT_OBJECT", "name": "DataProviderInput", "ofType": null } + } + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "QueryMatchInput", + "description": "", + "fields": null, + "inputFields": [ + { + "name": "field", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "displayField", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "value", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "displayValue", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "operator", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "FilterTimelineInput", + "description": "", + "fields": null, + "inputFields": [ + { + "name": "exists", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "meta", + "description": "", + "type": { "kind": "INPUT_OBJECT", "name": "FilterMetaTimelineInput", "ofType": null }, + "defaultValue": null + }, + { + "name": "match_all", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "missing", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "query", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "range", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "script", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "FilterMetaTimelineInput", + "description": "", + "fields": null, + "inputFields": [ + { + "name": "alias", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "controlledBy", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "disabled", + "description": "", + "type": { "kind": "SCALAR", "name": "Boolean", "ofType": null }, + "defaultValue": null + }, + { + "name": "field", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "formattedValue", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "index", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "key", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "negate", + "description": "", + "type": { "kind": "SCALAR", "name": "Boolean", "ofType": null }, + "defaultValue": null + }, + { + "name": "params", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "type", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "value", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "SerializedFilterQueryInput", + "description": "", + "fields": null, + "inputFields": [ + { + "name": "filterQuery", + "description": "", + "type": { "kind": "INPUT_OBJECT", "name": "SerializedKueryQueryInput", "ofType": null }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "SerializedKueryQueryInput", + "description": "", + "fields": null, + "inputFields": [ + { + "name": "kuery", + "description": "", + "type": { "kind": "INPUT_OBJECT", "name": "KueryFilterQueryInput", "ofType": null }, + "defaultValue": null + }, + { + "name": "serializedQuery", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "KueryFilterQueryInput", + "description": "", + "fields": null, + "inputFields": [ + { + "name": "kind", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "expression", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "DateRangePickerInput", + "description": "", + "fields": null, + "inputFields": [ + { + "name": "start", + "description": "", + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "defaultValue": null + }, + { + "name": "end", + "description": "", + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "SortTimelineInput", + "description": "", + "fields": null, + "inputFields": [ + { + "name": "columnId", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "sortDirection", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ResponseTimeline", + "description": "", + "fields": [ + { + "name": "code", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "message", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "timeline", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "TimelineResult", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ResponseFavoriteTimeline", + "description": "", + "fields": [ + { + "name": "code", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "message", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "savedObjectId", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "version", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "favorite", + "description": "", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "FavoriteTimelineResult", "ofType": null } + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "__Schema", + "description": "A GraphQL Schema defines the capabilities of a GraphQL server. It exposes all available types and directives on the server, as well as the entry points for query, mutation, and subscription operations.", + "fields": [ + { + "name": "types", + "description": "A list of all types supported by this server.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "__Type", "ofType": null } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "queryType", + "description": "The type that query operations will be rooted at.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "__Type", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "mutationType", + "description": "If this server supports mutation, the type that mutation operations will be rooted at.", + "args": [], + "type": { "kind": "OBJECT", "name": "__Type", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "subscriptionType", + "description": "If this server support subscription, the type that subscription operations will be rooted at.", + "args": [], + "type": { "kind": "OBJECT", "name": "__Type", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "directives", + "description": "A list of all directives supported by this server.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "__Directive", "ofType": null } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "__Type", + "description": "The fundamental unit of any GraphQL Schema is the type. There are many kinds of types in GraphQL as represented by the `__TypeKind` enum.\n\nDepending on the kind of a type, certain fields describe information about that type. Scalar types provide no information beyond a name and description, while Enum types provide their values. Object and Interface types provide the fields they describe. Abstract types, Union and Interface, provide the Object types possible at runtime. List and NonNull types compose other types.", + "fields": [ + { + "name": "kind", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "ENUM", "name": "__TypeKind", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": null, + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "description", + "description": null, + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "fields", + "description": null, + "args": [ + { + "name": "includeDeprecated", + "description": null, + "type": { "kind": "SCALAR", "name": "Boolean", "ofType": null }, + "defaultValue": "false" + } + ], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "__Field", "ofType": null } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "interfaces", + "description": null, + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "__Type", "ofType": null } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "possibleTypes", + "description": null, + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "__Type", "ofType": null } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "enumValues", + "description": null, + "args": [ + { + "name": "includeDeprecated", + "description": null, + "type": { "kind": "SCALAR", "name": "Boolean", "ofType": null }, + "defaultValue": "false" + } + ], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "__EnumValue", "ofType": null } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "inputFields", + "description": null, + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "__InputValue", "ofType": null } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ofType", + "description": null, + "args": [], + "type": { "kind": "OBJECT", "name": "__Type", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "__TypeKind", + "description": "An enum describing what kind of type a given `__Type` is.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "SCALAR", + "description": "Indicates this type is a scalar.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "OBJECT", + "description": "Indicates this type is an object. `fields` and `interfaces` are valid fields.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "INTERFACE", + "description": "Indicates this type is an interface. `fields` and `possibleTypes` are valid fields.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "UNION", + "description": "Indicates this type is a union. `possibleTypes` is a valid field.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ENUM", + "description": "Indicates this type is an enum. `enumValues` is a valid field.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "INPUT_OBJECT", + "description": "Indicates this type is an input object. `inputFields` is a valid field.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "LIST", + "description": "Indicates this type is a list. `ofType` is a valid field.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "NON_NULL", + "description": "Indicates this type is a non-null. `ofType` is a valid field.", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "__Field", + "description": "Object and Interface types are described by a list of Fields, each of which has a name, potentially a list of arguments, and a return type.", + "fields": [ + { + "name": "name", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "description", + "description": null, + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "args", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "__InputValue", "ofType": null } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "type", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "__Type", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isDeprecated", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "Boolean", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "deprecationReason", + "description": null, + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "__InputValue", + "description": "Arguments provided to Fields or Directives and the input fields of an InputObject are represented as Input Values which describe their type and optionally a default value.", + "fields": [ + { + "name": "name", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "description", + "description": null, + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "type", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "__Type", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "defaultValue", + "description": "A GraphQL-formatted string representing the default value for this input value.", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "__EnumValue", + "description": "One possible value for a given Enum. Enum values are unique values, not a placeholder for a string or numeric value. However an Enum value is returned in a JSON response as a string.", + "fields": [ + { + "name": "name", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "description", + "description": null, + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isDeprecated", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "Boolean", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "deprecationReason", + "description": null, + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "__Directive", + "description": "A Directive provides a way to describe alternate runtime execution and type validation behavior in a GraphQL document.\n\nIn some cases, you need to provide options to alter GraphQL's execution behavior in ways field arguments will not suffice, such as conditionally including or skipping a field. Directives provide this by describing additional information to the executor.", + "fields": [ + { + "name": "name", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "description", + "description": null, + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "locations", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "ENUM", "name": "__DirectiveLocation", "ofType": null } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "args", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "__InputValue", "ofType": null } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "onOperation", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "Boolean", "ofType": null } + }, + "isDeprecated": true, + "deprecationReason": "Use `locations`." + }, + { + "name": "onFragment", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "Boolean", "ofType": null } + }, + "isDeprecated": true, + "deprecationReason": "Use `locations`." + }, + { + "name": "onField", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "Boolean", "ofType": null } + }, + "isDeprecated": true, + "deprecationReason": "Use `locations`." + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "__DirectiveLocation", + "description": "A Directive can be adjacent to many parts of the GraphQL language, a __DirectiveLocation describes one such possible adjacencies.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "QUERY", + "description": "Location adjacent to a query operation.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "MUTATION", + "description": "Location adjacent to a mutation operation.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "SUBSCRIPTION", + "description": "Location adjacent to a subscription operation.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "FIELD", + "description": "Location adjacent to a field.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "FRAGMENT_DEFINITION", + "description": "Location adjacent to a fragment definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "FRAGMENT_SPREAD", + "description": "Location adjacent to a fragment spread.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "INLINE_FRAGMENT", + "description": "Location adjacent to an inline fragment.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "SCHEMA", + "description": "Location adjacent to a schema definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "SCALAR", + "description": "Location adjacent to a scalar definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "OBJECT", + "description": "Location adjacent to an object type definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "FIELD_DEFINITION", + "description": "Location adjacent to a field definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ARGUMENT_DEFINITION", + "description": "Location adjacent to an argument definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "INTERFACE", + "description": "Location adjacent to an interface definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "UNION", + "description": "Location adjacent to a union definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ENUM", + "description": "Location adjacent to an enum definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ENUM_VALUE", + "description": "Location adjacent to an enum value definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "INPUT_OBJECT", + "description": "Location adjacent to an input object type definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "INPUT_FIELD_DEFINITION", + "description": "Location adjacent to an input object field definition.", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "EcsEdges", + "description": "", + "fields": [ + { + "name": "node", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "ECS", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "cursor", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "CursorType", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "EventsTimelineData", + "description": "", + "fields": [ + { + "name": "edges", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "EcsEdges", "ofType": null } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "Float", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "PageInfo", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "inspect", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "Inspect", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "OsFields", + "description": "", + "fields": [ + { + "name": "platform", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "full", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "family", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "version", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "kernel", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "HostFields", + "description": "", + "fields": [ + { + "name": "architecture", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ip", + "description": "", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "mac", + "description": "", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "os", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "OsFields", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "type", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "NetworkDirectionEcs", + "description": "", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "inbound", + "description": "", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "outbound", + "description": "", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "internal", + "description": "", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "external", + "description": "", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "incoming", + "description": "", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "outgoing", + "description": "", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "listening", + "description": "", + "isDeprecated": false, + "deprecationReason": null + }, + { "name": "unknown", "description": "", "isDeprecated": false, "deprecationReason": null } + ], + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "NetworkHttpFields", + "description": "", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "domains", + "description": "", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "lastHost", + "description": "", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "lastSourceIp", + "description": "", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "methods", + "description": "", + "isDeprecated": false, + "deprecationReason": null + }, + { "name": "path", "description": "", "isDeprecated": false, "deprecationReason": null }, + { + "name": "requestCount", + "description": "", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "statuses", + "description": "", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "FlowDirection", + "description": "", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "uniDirectional", + "description": "", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "biDirectional", + "description": "", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "FavoriteTimelineInput", + "description": "", + "fields": null, + "inputFields": [ + { + "name": "fullName", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "userName", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "favoriteDate", + "description": "", + "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + } + ], + "directives": [ + { + "name": "skip", + "description": "Directs the executor to skip this field or fragment when the `if` argument is true.", + "locations": ["FIELD", "FRAGMENT_SPREAD", "INLINE_FRAGMENT"], + "args": [ + { + "name": "if", + "description": "Skipped when true.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "Boolean", "ofType": null } + }, + "defaultValue": null + } + ] + }, + { + "name": "include", + "description": "Directs the executor to include this field or fragment only when the `if` argument is true.", + "locations": ["FIELD", "FRAGMENT_SPREAD", "INLINE_FRAGMENT"], + "args": [ + { + "name": "if", + "description": "Included when true.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "Boolean", "ofType": null } + }, + "defaultValue": null + } + ] + }, + { + "name": "deprecated", + "description": "Marks an element of a GraphQL schema as no longer supported.", + "locations": ["FIELD_DEFINITION", "ENUM_VALUE"], + "args": [ + { + "name": "reason", + "description": "Explains why this element was deprecated, usually also including a suggestion for how to access supported similar data. Formatted in [Markdown](https://daringfireball.net/projects/markdown/).", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": "\"No longer supported\"" + } + ] + } + ] + } +} diff --git a/x-pack/legacy/plugins/siem/public/graphql/types.ts b/x-pack/legacy/plugins/siem/public/graphql/types.ts new file mode 100644 index 0000000000000..3528ee6e13a38 --- /dev/null +++ b/x-pack/legacy/plugins/siem/public/graphql/types.ts @@ -0,0 +1,5943 @@ +/* tslint:disable */ +/* eslint-disable */ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +export type Maybe = T | null; + +export interface PageInfoNote { + pageIndex: number; + + pageSize: number; +} + +export interface SortNote { + sortField: SortFieldNote; + + sortOrder: Direction; +} + +export interface TimerangeInput { + /** The interval string to use for last bucket. The format is '{value}{unit}'. For example '5m' would return the metrics for the last 5 minutes of the timespan. */ + interval: string; + /** The end of the timerange */ + to: number; + /** The beginning of the timerange */ + from: number; +} + +export interface PaginationInputPaginated { + /** The activePage parameter defines the page of results you want to fetch */ + activePage: number; + /** The cursorStart parameter defines the start of the results to be displayed */ + cursorStart: number; + /** The fakePossibleCount parameter determines the total count in order to show 5 additional pages */ + fakePossibleCount: number; + /** The querySize parameter is the number of items to be returned */ + querySize: number; +} + +export interface PaginationInput { + /** The limit parameter allows you to configure the maximum amount of items to be returned */ + limit: number; + /** The cursor parameter defines the next result you want to fetch */ + cursor?: Maybe; + /** The tiebreaker parameter allow to be more precise to fetch the next item */ + tiebreaker?: Maybe; +} + +export interface SortField { + sortFieldId: string; + + direction: Direction; +} + +export interface LastTimeDetails { + hostName?: Maybe; + + ip?: Maybe; +} + +export interface HostsSortField { + field: HostsFields; + + direction: Direction; +} + +export interface UsersSortField { + field: UsersFields; + + direction: Direction; +} + +export interface NetworkTopTablesSortField { + field: NetworkTopTablesFields; + + direction: Direction; +} + +export interface NetworkDnsSortField { + field: NetworkDnsFields; + + direction: Direction; +} + +export interface NetworkHttpSortField { + direction: Direction; +} + +export interface TlsSortField { + field: TlsFields; + + direction: Direction; +} + +export interface PageInfoTimeline { + pageIndex: number; + + pageSize: number; +} + +export interface SortTimeline { + sortField: SortFieldTimeline; + + sortOrder: Direction; +} + +export interface NoteInput { + eventId?: Maybe; + + note?: Maybe; + + timelineId?: Maybe; +} + +export interface TimelineInput { + columns?: Maybe; + + dataProviders?: Maybe; + + description?: Maybe; + + eventType?: Maybe; + + filters?: Maybe; + + kqlMode?: Maybe; + + kqlQuery?: Maybe; + + title?: Maybe; + + dateRange?: Maybe; + + savedQueryId?: Maybe; + + sort?: Maybe; +} + +export interface ColumnHeaderInput { + aggregatable?: Maybe; + + category?: Maybe; + + columnHeaderType?: Maybe; + + description?: Maybe; + + example?: Maybe; + + indexes?: Maybe; + + id?: Maybe; + + name?: Maybe; + + placeholder?: Maybe; + + searchable?: Maybe; + + type?: Maybe; +} + +export interface DataProviderInput { + id?: Maybe; + + name?: Maybe; + + enabled?: Maybe; + + excluded?: Maybe; + + kqlQuery?: Maybe; + + queryMatch?: Maybe; + + and?: Maybe; +} + +export interface QueryMatchInput { + field?: Maybe; + + displayField?: Maybe; + + value?: Maybe; + + displayValue?: Maybe; + + operator?: Maybe; +} + +export interface FilterTimelineInput { + exists?: Maybe; + + meta?: Maybe; + + match_all?: Maybe; + + missing?: Maybe; + + query?: Maybe; + + range?: Maybe; + + script?: Maybe; +} + +export interface FilterMetaTimelineInput { + alias?: Maybe; + + controlledBy?: Maybe; + + disabled?: Maybe; + + field?: Maybe; + + formattedValue?: Maybe; + + index?: Maybe; + + key?: Maybe; + + negate?: Maybe; + + params?: Maybe; + + type?: Maybe; + + value?: Maybe; +} + +export interface SerializedFilterQueryInput { + filterQuery?: Maybe; +} + +export interface SerializedKueryQueryInput { + kuery?: Maybe; + + serializedQuery?: Maybe; +} + +export interface KueryFilterQueryInput { + kind?: Maybe; + + expression?: Maybe; +} + +export interface DateRangePickerInput { + start?: Maybe; + + end?: Maybe; +} + +export interface SortTimelineInput { + columnId?: Maybe; + + sortDirection?: Maybe; +} + +export interface FavoriteTimelineInput { + fullName?: Maybe; + + userName?: Maybe; + + favoriteDate?: Maybe; +} + +export enum SortFieldNote { + updatedBy = 'updatedBy', + updated = 'updated', +} + +export enum Direction { + asc = 'asc', + desc = 'desc', +} + +export enum LastEventIndexKey { + hostDetails = 'hostDetails', + hosts = 'hosts', + ipDetails = 'ipDetails', + network = 'network', +} + +export enum HostsFields { + hostName = 'hostName', + lastSeen = 'lastSeen', +} + +export enum UsersFields { + name = 'name', + count = 'count', +} + +export enum FlowTarget { + client = 'client', + destination = 'destination', + server = 'server', + source = 'source', +} + +export enum HistogramType { + authentications = 'authentications', + anomalies = 'anomalies', + events = 'events', + alerts = 'alerts', + dns = 'dns', +} + +export enum FlowTargetSourceDest { + destination = 'destination', + source = 'source', +} + +export enum NetworkTopTablesFields { + bytes_in = 'bytes_in', + bytes_out = 'bytes_out', + flows = 'flows', + destination_ips = 'destination_ips', + source_ips = 'source_ips', +} + +export enum NetworkDnsFields { + dnsName = 'dnsName', + queryCount = 'queryCount', + uniqueDomains = 'uniqueDomains', + dnsBytesIn = 'dnsBytesIn', + dnsBytesOut = 'dnsBytesOut', +} + +export enum TlsFields { + _id = '_id', +} + +export enum SortFieldTimeline { + title = 'title', + description = 'description', + updated = 'updated', + created = 'created', +} + +export enum NetworkDirectionEcs { + inbound = 'inbound', + outbound = 'outbound', + internal = 'internal', + external = 'external', + incoming = 'incoming', + outgoing = 'outgoing', + listening = 'listening', + unknown = 'unknown', +} + +export enum NetworkHttpFields { + domains = 'domains', + lastHost = 'lastHost', + lastSourceIp = 'lastSourceIp', + methods = 'methods', + path = 'path', + requestCount = 'requestCount', + statuses = 'statuses', +} + +export enum FlowDirection { + uniDirectional = 'uniDirectional', + biDirectional = 'biDirectional', +} + +export type ToStringArray = string[]; + +export type Date = string; + +export type ToNumberArray = number[]; + +export type ToDateArray = string[]; + +export type ToBooleanArray = boolean[]; + +export type ToAny = any; + +export type EsValue = any; + +// ==================================================== +// Scalars +// ==================================================== + +// ==================================================== +// Types +// ==================================================== + +export interface Query { + getNote: NoteResult; + + getNotesByTimelineId: NoteResult[]; + + getNotesByEventId: NoteResult[]; + + getAllNotes: ResponseNotes; + + getAllPinnedEventsByTimelineId: PinnedEvent[]; + /** Get a security data source by id */ + source: Source; + /** Get a list of all security data sources */ + allSources: Source[]; + + getOneTimeline: TimelineResult; + + getAllTimeline: ResponseTimelines; +} + +export interface NoteResult { + eventId?: Maybe; + + note?: Maybe; + + timelineId?: Maybe; + + noteId: string; + + created?: Maybe; + + createdBy?: Maybe; + + timelineVersion?: Maybe; + + updated?: Maybe; + + updatedBy?: Maybe; + + version?: Maybe; +} + +export interface ResponseNotes { + notes: NoteResult[]; + + totalCount?: Maybe; +} + +export interface PinnedEvent { + code?: Maybe; + + message?: Maybe; + + pinnedEventId: string; + + eventId?: Maybe; + + timelineId?: Maybe; + + timelineVersion?: Maybe; + + created?: Maybe; + + createdBy?: Maybe; + + updated?: Maybe; + + updatedBy?: Maybe; + + version?: Maybe; +} + +export interface Source { + /** The id of the source */ + id: string; + /** The raw configuration of the source */ + configuration: SourceConfiguration; + /** The status of the source */ + status: SourceStatus; + /** Gets Authentication success and failures based on a timerange */ + Authentications: AuthenticationsData; + + Timeline: TimelineData; + + TimelineDetails: TimelineDetailsData; + + LastEventTime: LastEventTimeData; + /** Gets Hosts based on timerange and specified criteria, or all events in the timerange if no criteria is specified */ + Hosts: HostsData; + + HostOverview: HostItem; + + HostFirstLastSeen: FirstLastSeenHost; + + IpOverview?: Maybe; + + Users: UsersData; + + KpiNetwork?: Maybe; + + KpiHosts: KpiHostsData; + + KpiHostDetails: KpiHostDetailsData; + + MatrixHistogram: MatrixHistogramOverTimeData; + + NetworkTopCountries: NetworkTopCountriesData; + + NetworkTopNFlow: NetworkTopNFlowData; + + NetworkDns: NetworkDnsData; + + NetworkDnsHistogram: NetworkDsOverTimeData; + + NetworkHttp: NetworkHttpData; + + OverviewNetwork?: Maybe; + + OverviewHost?: Maybe; + + Tls: TlsData; + /** Gets UncommonProcesses based on a timerange, or all UncommonProcesses if no criteria is specified */ + UncommonProcesses: UncommonProcessesData; + /** Just a simple example to get the app name */ + whoAmI?: Maybe; +} + +/** A set of configuration options for a security data source */ +export interface SourceConfiguration { + /** The field mapping to use for this source */ + fields: SourceFields; +} + +/** A mapping of semantic fields to their document counterparts */ +export interface SourceFields { + /** The field to identify a container by */ + container: string; + /** The fields to identify a host by */ + host: string; + /** The fields that may contain the log event message. The first field found win. */ + message: string[]; + /** The field to identify a pod by */ + pod: string; + /** The field to use as a tiebreaker for log events that have identical timestamps */ + tiebreaker: string; + /** The field to use as a timestamp for metrics and logs */ + timestamp: string; +} + +/** The status of an infrastructure data source */ +export interface SourceStatus { + /** Whether the configured alias or wildcard pattern resolve to any auditbeat indices */ + indicesExist: boolean; + /** The list of fields defined in the index mappings */ + indexFields: IndexField[]; +} + +/** A descriptor of a field in an index */ +export interface IndexField { + /** Where the field belong */ + category: string; + /** Example of field's value */ + example?: Maybe; + /** whether the field's belong to an alias index */ + indexes: (Maybe)[]; + /** The name of the field */ + name: string; + /** The type of the field's values as recognized by Kibana */ + type: string; + /** Whether the field's values can be efficiently searched for */ + searchable: boolean; + /** Whether the field's values can be aggregated */ + aggregatable: boolean; + /** Description of the field */ + description?: Maybe; + + format?: Maybe; +} + +export interface AuthenticationsData { + edges: AuthenticationsEdges[]; + + totalCount: number; + + pageInfo: PageInfoPaginated; + + inspect?: Maybe; +} + +export interface AuthenticationsEdges { + node: AuthenticationItem; + + cursor: CursorType; +} + +export interface AuthenticationItem { + _id: string; + + failures: number; + + successes: number; + + user: UserEcsFields; + + lastSuccess?: Maybe; + + lastFailure?: Maybe; +} + +export interface UserEcsFields { + domain?: Maybe; + + id?: Maybe; + + name?: Maybe; + + full_name?: Maybe; + + email?: Maybe; + + hash?: Maybe; + + group?: Maybe; +} + +export interface LastSourceHost { + timestamp?: Maybe; + + source?: Maybe; + + host?: Maybe; +} + +export interface SourceEcsFields { + bytes?: Maybe; + + ip?: Maybe; + + port?: Maybe; + + domain?: Maybe; + + geo?: Maybe; + + packets?: Maybe; +} + +export interface GeoEcsFields { + city_name?: Maybe; + + continent_name?: Maybe; + + country_iso_code?: Maybe; + + country_name?: Maybe; + + location?: Maybe; + + region_iso_code?: Maybe; + + region_name?: Maybe; +} + +export interface Location { + lon?: Maybe; + + lat?: Maybe; +} + +export interface HostEcsFields { + architecture?: Maybe; + + id?: Maybe; + + ip?: Maybe; + + mac?: Maybe; + + name?: Maybe; + + os?: Maybe; + + type?: Maybe; +} + +export interface OsEcsFields { + platform?: Maybe; + + name?: Maybe; + + full?: Maybe; + + family?: Maybe; + + version?: Maybe; + + kernel?: Maybe; +} + +export interface CursorType { + value?: Maybe; + + tiebreaker?: Maybe; +} + +export interface PageInfoPaginated { + activePage: number; + + fakeTotalCount: number; + + showMorePagesIndicator: boolean; +} + +export interface Inspect { + dsl: string[]; + + response: string[]; +} + +export interface TimelineData { + edges: TimelineEdges[]; + + totalCount: number; + + pageInfo: PageInfo; + + inspect?: Maybe; +} + +export interface TimelineEdges { + node: TimelineItem; + + cursor: CursorType; +} + +export interface TimelineItem { + _id: string; + + _index?: Maybe; + + data: TimelineNonEcsData[]; + + ecs: Ecs; +} + +export interface TimelineNonEcsData { + field: string; + + value?: Maybe; +} + +export interface Ecs { + _id: string; + + _index?: Maybe; + + auditd?: Maybe; + + destination?: Maybe; + + dns?: Maybe; + + endgame?: Maybe; + + event?: Maybe; + + geo?: Maybe; + + host?: Maybe; + + network?: Maybe; + + rule?: Maybe; + + signal?: Maybe; + + source?: Maybe; + + suricata?: Maybe; + + tls?: Maybe; + + zeek?: Maybe; + + http?: Maybe; + + url?: Maybe; + + timestamp?: Maybe; + + message?: Maybe; + + user?: Maybe; + + winlog?: Maybe; + + process?: Maybe; + + file?: Maybe; + + system?: Maybe; +} + +export interface AuditdEcsFields { + result?: Maybe; + + session?: Maybe; + + data?: Maybe; + + summary?: Maybe; + + sequence?: Maybe; +} + +export interface AuditdData { + acct?: Maybe; + + terminal?: Maybe; + + op?: Maybe; +} + +export interface Summary { + actor?: Maybe; + + object?: Maybe; + + how?: Maybe; + + message_type?: Maybe; + + sequence?: Maybe; +} + +export interface PrimarySecondary { + primary?: Maybe; + + secondary?: Maybe; + + type?: Maybe; +} + +export interface DestinationEcsFields { + bytes?: Maybe; + + ip?: Maybe; + + port?: Maybe; + + domain?: Maybe; + + geo?: Maybe; + + packets?: Maybe; +} + +export interface DnsEcsFields { + question?: Maybe; + + resolved_ip?: Maybe; + + response_code?: Maybe; +} + +export interface DnsQuestionData { + name?: Maybe; + + type?: Maybe; +} + +export interface EndgameEcsFields { + exit_code?: Maybe; + + file_name?: Maybe; + + file_path?: Maybe; + + logon_type?: Maybe; + + parent_process_name?: Maybe; + + pid?: Maybe; + + process_name?: Maybe; + + subject_domain_name?: Maybe; + + subject_logon_id?: Maybe; + + subject_user_name?: Maybe; + + target_domain_name?: Maybe; + + target_logon_id?: Maybe; + + target_user_name?: Maybe; +} + +export interface EventEcsFields { + action?: Maybe; + + category?: Maybe; + + code?: Maybe; + + created?: Maybe; + + dataset?: Maybe; + + duration?: Maybe; + + end?: Maybe; + + hash?: Maybe; + + id?: Maybe; + + kind?: Maybe; + + module?: Maybe; + + original?: Maybe; + + outcome?: Maybe; + + risk_score?: Maybe; + + risk_score_norm?: Maybe; + + severity?: Maybe; + + start?: Maybe; + + timezone?: Maybe; + + type?: Maybe; +} + +export interface NetworkEcsField { + bytes?: Maybe; + + community_id?: Maybe; + + direction?: Maybe; + + packets?: Maybe; + + protocol?: Maybe; + + transport?: Maybe; +} + +export interface RuleEcsField { + reference?: Maybe; +} + +export interface SignalField { + rule?: Maybe; + + original_time?: Maybe; +} + +export interface RuleField { + id?: Maybe; + + rule_id?: Maybe; + + false_positives: string[]; + + saved_id?: Maybe; + + timeline_id?: Maybe; + + timeline_title?: Maybe; + + max_signals?: Maybe; + + risk_score?: Maybe; + + output_index?: Maybe; + + description?: Maybe; + + from?: Maybe; + + immutable?: Maybe; + + index?: Maybe; + + interval?: Maybe; + + language?: Maybe; + + query?: Maybe; + + references?: Maybe; + + severity?: Maybe; + + tags?: Maybe; + + threat?: Maybe; + + type?: Maybe; + + size?: Maybe; + + to?: Maybe; + + enabled?: Maybe; + + filters?: Maybe; + + created_at?: Maybe; + + updated_at?: Maybe; + + created_by?: Maybe; + + updated_by?: Maybe; + + version?: Maybe; +} + +export interface SuricataEcsFields { + eve?: Maybe; +} + +export interface SuricataEveData { + alert?: Maybe; + + flow_id?: Maybe; + + proto?: Maybe; +} + +export interface SuricataAlertData { + signature?: Maybe; + + signature_id?: Maybe; +} + +export interface TlsEcsFields { + client_certificate?: Maybe; + + fingerprints?: Maybe; + + server_certificate?: Maybe; +} + +export interface TlsClientCertificateData { + fingerprint?: Maybe; +} + +export interface FingerprintData { + sha1?: Maybe; +} + +export interface TlsFingerprintsData { + ja3?: Maybe; +} + +export interface TlsJa3Data { + hash?: Maybe; +} + +export interface TlsServerCertificateData { + fingerprint?: Maybe; +} + +export interface ZeekEcsFields { + session_id?: Maybe; + + connection?: Maybe; + + notice?: Maybe; + + dns?: Maybe; + + http?: Maybe; + + files?: Maybe; + + ssl?: Maybe; +} + +export interface ZeekConnectionData { + local_resp?: Maybe; + + local_orig?: Maybe; + + missed_bytes?: Maybe; + + state?: Maybe; + + history?: Maybe; +} + +export interface ZeekNoticeData { + suppress_for?: Maybe; + + msg?: Maybe; + + note?: Maybe; + + sub?: Maybe; + + dst?: Maybe; + + dropped?: Maybe; + + peer_descr?: Maybe; +} + +export interface ZeekDnsData { + AA?: Maybe; + + qclass_name?: Maybe; + + RD?: Maybe; + + qtype_name?: Maybe; + + rejected?: Maybe; + + qtype?: Maybe; + + query?: Maybe; + + trans_id?: Maybe; + + qclass?: Maybe; + + RA?: Maybe; + + TC?: Maybe; +} + +export interface ZeekHttpData { + resp_mime_types?: Maybe; + + trans_depth?: Maybe; + + status_msg?: Maybe; + + resp_fuids?: Maybe; + + tags?: Maybe; +} + +export interface ZeekFileData { + session_ids?: Maybe; + + timedout?: Maybe; + + local_orig?: Maybe; + + tx_host?: Maybe; + + source?: Maybe; + + is_orig?: Maybe; + + overflow_bytes?: Maybe; + + sha1?: Maybe; + + duration?: Maybe; + + depth?: Maybe; + + analyzers?: Maybe; + + mime_type?: Maybe; + + rx_host?: Maybe; + + total_bytes?: Maybe; + + fuid?: Maybe; + + seen_bytes?: Maybe; + + missing_bytes?: Maybe; + + md5?: Maybe; +} + +export interface ZeekSslData { + cipher?: Maybe; + + established?: Maybe; + + resumed?: Maybe; + + version?: Maybe; +} + +export interface HttpEcsFields { + version?: Maybe; + + request?: Maybe; + + response?: Maybe; +} + +export interface HttpRequestData { + method?: Maybe; + + body?: Maybe; + + referrer?: Maybe; + + bytes?: Maybe; +} + +export interface HttpBodyData { + content?: Maybe; + + bytes?: Maybe; +} + +export interface HttpResponseData { + status_code?: Maybe; + + body?: Maybe; + + bytes?: Maybe; +} + +export interface UrlEcsFields { + domain?: Maybe; + + original?: Maybe; + + username?: Maybe; + + password?: Maybe; +} + +export interface WinlogEcsFields { + event_id?: Maybe; +} + +export interface ProcessEcsFields { + hash?: Maybe; + + pid?: Maybe; + + name?: Maybe; + + ppid?: Maybe; + + args?: Maybe; + + executable?: Maybe; + + title?: Maybe; + + thread?: Maybe; + + working_directory?: Maybe; +} + +export interface ProcessHashData { + md5?: Maybe; + + sha1?: Maybe; + + sha256?: Maybe; +} + +export interface Thread { + id?: Maybe; + + start?: Maybe; +} + +export interface FileFields { + name?: Maybe; + + path?: Maybe; + + target_path?: Maybe; + + extension?: Maybe; + + type?: Maybe; + + device?: Maybe; + + inode?: Maybe; + + uid?: Maybe; + + owner?: Maybe; + + gid?: Maybe; + + group?: Maybe; + + mode?: Maybe; + + size?: Maybe; + + mtime?: Maybe; + + ctime?: Maybe; +} + +export interface SystemEcsField { + audit?: Maybe; + + auth?: Maybe; +} + +export interface AuditEcsFields { + package?: Maybe; +} + +export interface PackageEcsFields { + arch?: Maybe; + + entity_id?: Maybe; + + name?: Maybe; + + size?: Maybe; + + summary?: Maybe; + + version?: Maybe; +} + +export interface AuthEcsFields { + ssh?: Maybe; +} + +export interface SshEcsFields { + method?: Maybe; + + signature?: Maybe; +} + +export interface PageInfo { + endCursor?: Maybe; + + hasNextPage?: Maybe; +} + +export interface TimelineDetailsData { + data?: Maybe; + + inspect?: Maybe; +} + +export interface DetailItem { + field: string; + + values?: Maybe; + + originalValue?: Maybe; +} + +export interface LastEventTimeData { + lastSeen?: Maybe; + + inspect?: Maybe; +} + +export interface HostsData { + edges: HostsEdges[]; + + totalCount: number; + + pageInfo: PageInfoPaginated; + + inspect?: Maybe; +} + +export interface HostsEdges { + node: HostItem; + + cursor: CursorType; +} + +export interface HostItem { + _id?: Maybe; + + lastSeen?: Maybe; + + host?: Maybe; + + cloud?: Maybe; + + inspect?: Maybe; +} + +export interface CloudFields { + instance?: Maybe; + + machine?: Maybe; + + provider?: Maybe<(Maybe)[]>; + + region?: Maybe<(Maybe)[]>; +} + +export interface CloudInstance { + id?: Maybe<(Maybe)[]>; +} + +export interface CloudMachine { + type?: Maybe<(Maybe)[]>; +} + +export interface FirstLastSeenHost { + inspect?: Maybe; + + firstSeen?: Maybe; + + lastSeen?: Maybe; +} + +export interface IpOverviewData { + client?: Maybe; + + destination?: Maybe; + + host: HostEcsFields; + + server?: Maybe; + + source?: Maybe; + + inspect?: Maybe; +} + +export interface Overview { + firstSeen?: Maybe; + + lastSeen?: Maybe; + + autonomousSystem: AutonomousSystem; + + geo: GeoEcsFields; +} + +export interface AutonomousSystem { + number?: Maybe; + + organization?: Maybe; +} + +export interface AutonomousSystemOrganization { + name?: Maybe; +} + +export interface UsersData { + edges: UsersEdges[]; + + totalCount: number; + + pageInfo: PageInfoPaginated; + + inspect?: Maybe; +} + +export interface UsersEdges { + node: UsersNode; + + cursor: CursorType; +} + +export interface UsersNode { + _id?: Maybe; + + timestamp?: Maybe; + + user?: Maybe; +} + +export interface UsersItem { + name?: Maybe; + + id?: Maybe; + + groupId?: Maybe; + + groupName?: Maybe; + + count?: Maybe; +} + +export interface KpiNetworkData { + networkEvents?: Maybe; + + uniqueFlowId?: Maybe; + + uniqueSourcePrivateIps?: Maybe; + + uniqueSourcePrivateIpsHistogram?: Maybe; + + uniqueDestinationPrivateIps?: Maybe; + + uniqueDestinationPrivateIpsHistogram?: Maybe; + + dnsQueries?: Maybe; + + tlsHandshakes?: Maybe; + + inspect?: Maybe; +} + +export interface KpiNetworkHistogramData { + x?: Maybe; + + y?: Maybe; +} + +export interface KpiHostsData { + hosts?: Maybe; + + hostsHistogram?: Maybe; + + authSuccess?: Maybe; + + authSuccessHistogram?: Maybe; + + authFailure?: Maybe; + + authFailureHistogram?: Maybe; + + uniqueSourceIps?: Maybe; + + uniqueSourceIpsHistogram?: Maybe; + + uniqueDestinationIps?: Maybe; + + uniqueDestinationIpsHistogram?: Maybe; + + inspect?: Maybe; +} + +export interface KpiHostHistogramData { + x?: Maybe; + + y?: Maybe; +} + +export interface KpiHostDetailsData { + authSuccess?: Maybe; + + authSuccessHistogram?: Maybe; + + authFailure?: Maybe; + + authFailureHistogram?: Maybe; + + uniqueSourceIps?: Maybe; + + uniqueSourceIpsHistogram?: Maybe; + + uniqueDestinationIps?: Maybe; + + uniqueDestinationIpsHistogram?: Maybe; + + inspect?: Maybe; +} + +export interface MatrixHistogramOverTimeData { + inspect?: Maybe; + + matrixHistogramData: MatrixOverTimeHistogramData[]; + + totalCount: number; +} + +export interface MatrixOverTimeHistogramData { + x?: Maybe; + + y?: Maybe; + + g?: Maybe; +} + +export interface NetworkTopCountriesData { + edges: NetworkTopCountriesEdges[]; + + totalCount: number; + + pageInfo: PageInfoPaginated; + + inspect?: Maybe; +} + +export interface NetworkTopCountriesEdges { + node: NetworkTopCountriesItem; + + cursor: CursorType; +} + +export interface NetworkTopCountriesItem { + _id?: Maybe; + + source?: Maybe; + + destination?: Maybe; + + network?: Maybe; +} + +export interface TopCountriesItemSource { + country?: Maybe; + + destination_ips?: Maybe; + + flows?: Maybe; + + location?: Maybe; + + source_ips?: Maybe; +} + +export interface GeoItem { + geo?: Maybe; + + flowTarget?: Maybe; +} + +export interface TopCountriesItemDestination { + country?: Maybe; + + destination_ips?: Maybe; + + flows?: Maybe; + + location?: Maybe; + + source_ips?: Maybe; +} + +export interface TopNetworkTablesEcsField { + bytes_in?: Maybe; + + bytes_out?: Maybe; +} + +export interface NetworkTopNFlowData { + edges: NetworkTopNFlowEdges[]; + + totalCount: number; + + pageInfo: PageInfoPaginated; + + inspect?: Maybe; +} + +export interface NetworkTopNFlowEdges { + node: NetworkTopNFlowItem; + + cursor: CursorType; +} + +export interface NetworkTopNFlowItem { + _id?: Maybe; + + source?: Maybe; + + destination?: Maybe; + + network?: Maybe; +} + +export interface TopNFlowItemSource { + autonomous_system?: Maybe; + + domain?: Maybe; + + ip?: Maybe; + + location?: Maybe; + + flows?: Maybe; + + destination_ips?: Maybe; +} + +export interface AutonomousSystemItem { + name?: Maybe; + + number?: Maybe; +} + +export interface TopNFlowItemDestination { + autonomous_system?: Maybe; + + domain?: Maybe; + + ip?: Maybe; + + location?: Maybe; + + flows?: Maybe; + + source_ips?: Maybe; +} + +export interface NetworkDnsData { + edges: NetworkDnsEdges[]; + + totalCount: number; + + pageInfo: PageInfoPaginated; + + inspect?: Maybe; + + histogram?: Maybe; +} + +export interface NetworkDnsEdges { + node: NetworkDnsItem; + + cursor: CursorType; +} + +export interface NetworkDnsItem { + _id?: Maybe; + + dnsBytesIn?: Maybe; + + dnsBytesOut?: Maybe; + + dnsName?: Maybe; + + queryCount?: Maybe; + + uniqueDomains?: Maybe; +} + +export interface MatrixOverOrdinalHistogramData { + x: string; + + y: number; + + g: string; +} + +export interface NetworkDsOverTimeData { + inspect?: Maybe; + + matrixHistogramData: MatrixOverTimeHistogramData[]; + + totalCount: number; +} + +export interface NetworkHttpData { + edges: NetworkHttpEdges[]; + + totalCount: number; + + pageInfo: PageInfoPaginated; + + inspect?: Maybe; +} + +export interface NetworkHttpEdges { + node: NetworkHttpItem; + + cursor: CursorType; +} + +export interface NetworkHttpItem { + _id?: Maybe; + + domains: string[]; + + lastHost?: Maybe; + + lastSourceIp?: Maybe; + + methods: string[]; + + path?: Maybe; + + requestCount?: Maybe; + + statuses: string[]; +} + +export interface OverviewNetworkData { + auditbeatSocket?: Maybe; + + filebeatCisco?: Maybe; + + filebeatNetflow?: Maybe; + + filebeatPanw?: Maybe; + + filebeatSuricata?: Maybe; + + filebeatZeek?: Maybe; + + packetbeatDNS?: Maybe; + + packetbeatFlow?: Maybe; + + packetbeatTLS?: Maybe; + + inspect?: Maybe; +} + +export interface OverviewHostData { + auditbeatAuditd?: Maybe; + + auditbeatFIM?: Maybe; + + auditbeatLogin?: Maybe; + + auditbeatPackage?: Maybe; + + auditbeatProcess?: Maybe; + + auditbeatUser?: Maybe; + + endgameDns?: Maybe; + + endgameFile?: Maybe; + + endgameImageLoad?: Maybe; + + endgameNetwork?: Maybe; + + endgameProcess?: Maybe; + + endgameRegistry?: Maybe; + + endgameSecurity?: Maybe; + + filebeatSystemModule?: Maybe; + + winlogbeatSecurity?: Maybe; + + winlogbeatMWSysmonOperational?: Maybe; + + inspect?: Maybe; +} + +export interface TlsData { + edges: TlsEdges[]; + + totalCount: number; + + pageInfo: PageInfoPaginated; + + inspect?: Maybe; +} + +export interface TlsEdges { + node: TlsNode; + + cursor: CursorType; +} + +export interface TlsNode { + _id?: Maybe; + + timestamp?: Maybe; + + alternativeNames?: Maybe; + + notAfter?: Maybe; + + commonNames?: Maybe; + + ja3?: Maybe; + + issuerNames?: Maybe; +} + +export interface UncommonProcessesData { + edges: UncommonProcessesEdges[]; + + totalCount: number; + + pageInfo: PageInfoPaginated; + + inspect?: Maybe; +} + +export interface UncommonProcessesEdges { + node: UncommonProcessItem; + + cursor: CursorType; +} + +export interface UncommonProcessItem { + _id: string; + + instances: number; + + process: ProcessEcsFields; + + hosts: HostEcsFields[]; + + user?: Maybe; +} + +export interface SayMyName { + /** The id of the source */ + appName: string; +} + +export interface TimelineResult { + columns?: Maybe; + + created?: Maybe; + + createdBy?: Maybe; + + dataProviders?: Maybe; + + dateRange?: Maybe; + + description?: Maybe; + + eventIdToNoteIds?: Maybe; + + eventType?: Maybe; + + favorite?: Maybe; + + filters?: Maybe; + + kqlMode?: Maybe; + + kqlQuery?: Maybe; + + notes?: Maybe; + + noteIds?: Maybe; + + pinnedEventIds?: Maybe; + + pinnedEventsSaveObject?: Maybe; + + savedQueryId?: Maybe; + + savedObjectId: string; + + sort?: Maybe; + + title?: Maybe; + + updated?: Maybe; + + updatedBy?: Maybe; + + version: string; +} + +export interface ColumnHeaderResult { + aggregatable?: Maybe; + + category?: Maybe; + + columnHeaderType?: Maybe; + + description?: Maybe; + + example?: Maybe; + + indexes?: Maybe; + + id?: Maybe; + + name?: Maybe; + + placeholder?: Maybe; + + searchable?: Maybe; + + type?: Maybe; +} + +export interface DataProviderResult { + id?: Maybe; + + name?: Maybe; + + enabled?: Maybe; + + excluded?: Maybe; + + kqlQuery?: Maybe; + + queryMatch?: Maybe; + + and?: Maybe; +} + +export interface QueryMatchResult { + field?: Maybe; + + displayField?: Maybe; + + value?: Maybe; + + displayValue?: Maybe; + + operator?: Maybe; +} + +export interface DateRangePickerResult { + start?: Maybe; + + end?: Maybe; +} + +export interface FavoriteTimelineResult { + fullName?: Maybe; + + userName?: Maybe; + + favoriteDate?: Maybe; +} + +export interface FilterTimelineResult { + exists?: Maybe; + + meta?: Maybe; + + match_all?: Maybe; + + missing?: Maybe; + + query?: Maybe; + + range?: Maybe; + + script?: Maybe; +} + +export interface FilterMetaTimelineResult { + alias?: Maybe; + + controlledBy?: Maybe; + + disabled?: Maybe; + + field?: Maybe; + + formattedValue?: Maybe; + + index?: Maybe; + + key?: Maybe; + + negate?: Maybe; + + params?: Maybe; + + type?: Maybe; + + value?: Maybe; +} + +export interface SerializedFilterQueryResult { + filterQuery?: Maybe; +} + +export interface SerializedKueryQueryResult { + kuery?: Maybe; + + serializedQuery?: Maybe; +} + +export interface KueryFilterQueryResult { + kind?: Maybe; + + expression?: Maybe; +} + +export interface SortTimelineResult { + columnId?: Maybe; + + sortDirection?: Maybe; +} + +export interface ResponseTimelines { + timeline: (Maybe)[]; + + totalCount?: Maybe; +} + +export interface Mutation { + /** Persists a note */ + persistNote: ResponseNote; + + deleteNote?: Maybe; + + deleteNoteByTimelineId?: Maybe; + /** Persists a pinned event in a timeline */ + persistPinnedEventOnTimeline?: Maybe; + /** Remove a pinned events in a timeline */ + deletePinnedEventOnTimeline: boolean; + /** Remove all pinned events in a timeline */ + deleteAllPinnedEventsOnTimeline: boolean; + /** Persists a timeline */ + persistTimeline: ResponseTimeline; + + persistFavorite: ResponseFavoriteTimeline; + + deleteTimeline: boolean; +} + +export interface ResponseNote { + code?: Maybe; + + message?: Maybe; + + note: NoteResult; +} + +export interface ResponseTimeline { + code?: Maybe; + + message?: Maybe; + + timeline: TimelineResult; +} + +export interface ResponseFavoriteTimeline { + code?: Maybe; + + message?: Maybe; + + savedObjectId: string; + + version: string; + + favorite?: Maybe; +} + +export interface EcsEdges { + node: Ecs; + + cursor: CursorType; +} + +export interface EventsTimelineData { + edges: EcsEdges[]; + + totalCount: number; + + pageInfo: PageInfo; + + inspect?: Maybe; +} + +export interface OsFields { + platform?: Maybe; + + name?: Maybe; + + full?: Maybe; + + family?: Maybe; + + version?: Maybe; + + kernel?: Maybe; +} + +export interface HostFields { + architecture?: Maybe; + + id?: Maybe; + + ip?: Maybe<(Maybe)[]>; + + mac?: Maybe<(Maybe)[]>; + + name?: Maybe; + + os?: Maybe; + + type?: Maybe; +} + +// ==================================================== +// Arguments +// ==================================================== + +export interface GetNoteQueryArgs { + id: string; +} +export interface GetNotesByTimelineIdQueryArgs { + timelineId: string; +} +export interface GetNotesByEventIdQueryArgs { + eventId: string; +} +export interface GetAllNotesQueryArgs { + pageInfo?: Maybe; + + search?: Maybe; + + sort?: Maybe; +} +export interface GetAllPinnedEventsByTimelineIdQueryArgs { + timelineId: string; +} +export interface SourceQueryArgs { + /** The id of the source */ + id: string; +} +export interface GetOneTimelineQueryArgs { + id: string; +} +export interface GetAllTimelineQueryArgs { + pageInfo?: Maybe; + + search?: Maybe; + + sort?: Maybe; + + onlyUserFavorite?: Maybe; +} +export interface AuthenticationsSourceArgs { + timerange: TimerangeInput; + + pagination: PaginationInputPaginated; + + filterQuery?: Maybe; + + defaultIndex: string[]; +} +export interface TimelineSourceArgs { + pagination: PaginationInput; + + sortField: SortField; + + fieldRequested: string[]; + + timerange?: Maybe; + + filterQuery?: Maybe; + + defaultIndex: string[]; +} +export interface TimelineDetailsSourceArgs { + eventId: string; + + indexName: string; + + defaultIndex: string[]; +} +export interface LastEventTimeSourceArgs { + id?: Maybe; + + indexKey: LastEventIndexKey; + + details: LastTimeDetails; + + defaultIndex: string[]; +} +export interface HostsSourceArgs { + id?: Maybe; + + timerange: TimerangeInput; + + pagination: PaginationInputPaginated; + + sort: HostsSortField; + + filterQuery?: Maybe; + + defaultIndex: string[]; +} +export interface HostOverviewSourceArgs { + id?: Maybe; + + hostName: string; + + timerange: TimerangeInput; + + defaultIndex: string[]; +} +export interface HostFirstLastSeenSourceArgs { + id?: Maybe; + + hostName: string; + + defaultIndex: string[]; +} +export interface IpOverviewSourceArgs { + id?: Maybe; + + filterQuery?: Maybe; + + ip: string; + + defaultIndex: string[]; +} +export interface UsersSourceArgs { + filterQuery?: Maybe; + + id?: Maybe; + + ip: string; + + pagination: PaginationInputPaginated; + + sort: UsersSortField; + + flowTarget: FlowTarget; + + timerange: TimerangeInput; + + defaultIndex: string[]; +} +export interface KpiNetworkSourceArgs { + id?: Maybe; + + timerange: TimerangeInput; + + filterQuery?: Maybe; + + defaultIndex: string[]; +} +export interface KpiHostsSourceArgs { + id?: Maybe; + + timerange: TimerangeInput; + + filterQuery?: Maybe; + + defaultIndex: string[]; +} +export interface KpiHostDetailsSourceArgs { + id?: Maybe; + + timerange: TimerangeInput; + + filterQuery?: Maybe; + + defaultIndex: string[]; +} +export interface MatrixHistogramSourceArgs { + filterQuery?: Maybe; + + defaultIndex: string[]; + + timerange: TimerangeInput; + + stackByField: string; + + histogramType: HistogramType; +} +export interface NetworkTopCountriesSourceArgs { + id?: Maybe; + + filterQuery?: Maybe; + + ip?: Maybe; + + flowTarget: FlowTargetSourceDest; + + pagination: PaginationInputPaginated; + + sort: NetworkTopTablesSortField; + + timerange: TimerangeInput; + + defaultIndex: string[]; +} +export interface NetworkTopNFlowSourceArgs { + id?: Maybe; + + filterQuery?: Maybe; + + ip?: Maybe; + + flowTarget: FlowTargetSourceDest; + + pagination: PaginationInputPaginated; + + sort: NetworkTopTablesSortField; + + timerange: TimerangeInput; + + defaultIndex: string[]; +} +export interface NetworkDnsSourceArgs { + filterQuery?: Maybe; + + id?: Maybe; + + isPtrIncluded: boolean; + + pagination: PaginationInputPaginated; + + sort: NetworkDnsSortField; + + stackByField?: Maybe; + + timerange: TimerangeInput; + + defaultIndex: string[]; +} +export interface NetworkDnsHistogramSourceArgs { + filterQuery?: Maybe; + + defaultIndex: string[]; + + timerange: TimerangeInput; + + stackByField?: Maybe; +} +export interface NetworkHttpSourceArgs { + id?: Maybe; + + filterQuery?: Maybe; + + ip?: Maybe; + + pagination: PaginationInputPaginated; + + sort: NetworkHttpSortField; + + timerange: TimerangeInput; + + defaultIndex: string[]; +} +export interface OverviewNetworkSourceArgs { + id?: Maybe; + + timerange: TimerangeInput; + + filterQuery?: Maybe; + + defaultIndex: string[]; +} +export interface OverviewHostSourceArgs { + id?: Maybe; + + timerange: TimerangeInput; + + filterQuery?: Maybe; + + defaultIndex: string[]; +} +export interface TlsSourceArgs { + filterQuery?: Maybe; + + id?: Maybe; + + ip: string; + + pagination: PaginationInputPaginated; + + sort: TlsSortField; + + flowTarget: FlowTargetSourceDest; + + timerange: TimerangeInput; + + defaultIndex: string[]; +} +export interface UncommonProcessesSourceArgs { + timerange: TimerangeInput; + + pagination: PaginationInputPaginated; + + filterQuery?: Maybe; + + defaultIndex: string[]; +} +export interface IndicesExistSourceStatusArgs { + defaultIndex: string[]; +} +export interface IndexFieldsSourceStatusArgs { + defaultIndex: string[]; +} +export interface PersistNoteMutationArgs { + noteId?: Maybe; + + version?: Maybe; + + note: NoteInput; +} +export interface DeleteNoteMutationArgs { + id: string[]; +} +export interface DeleteNoteByTimelineIdMutationArgs { + timelineId: string; + + version?: Maybe; +} +export interface PersistPinnedEventOnTimelineMutationArgs { + pinnedEventId?: Maybe; + + eventId: string; + + timelineId?: Maybe; +} +export interface DeletePinnedEventOnTimelineMutationArgs { + id: string[]; +} +export interface DeleteAllPinnedEventsOnTimelineMutationArgs { + timelineId: string; +} +export interface PersistTimelineMutationArgs { + id?: Maybe; + + version?: Maybe; + + timeline: TimelineInput; +} +export interface PersistFavoriteMutationArgs { + timelineId?: Maybe; +} +export interface DeleteTimelineMutationArgs { + id: string[]; +} + +// ==================================================== +// Documents +// ==================================================== + +export namespace GetAuthenticationsQuery { + export type Variables = { + sourceId: string; + timerange: TimerangeInput; + pagination: PaginationInputPaginated; + filterQuery?: Maybe; + defaultIndex: string[]; + inspect: boolean; + }; + + export type Query = { + __typename?: 'Query'; + + source: Source; + }; + + export type Source = { + __typename?: 'Source'; + + id: string; + + Authentications: Authentications; + }; + + export type Authentications = { + __typename?: 'AuthenticationsData'; + + totalCount: number; + + edges: Edges[]; + + pageInfo: PageInfo; + + inspect: Maybe; + }; + + export type Edges = { + __typename?: 'AuthenticationsEdges'; + + node: Node; + + cursor: Cursor; + }; + + export type Node = { + __typename?: 'AuthenticationItem'; + + _id: string; + + failures: number; + + successes: number; + + user: User; + + lastSuccess: Maybe; + + lastFailure: Maybe; + }; + + export type User = { + __typename?: 'UserEcsFields'; + + name: Maybe; + }; + + export type LastSuccess = { + __typename?: 'LastSourceHost'; + + timestamp: Maybe; + + source: Maybe<_Source>; + + host: Maybe; + }; + + export type _Source = { + __typename?: 'SourceEcsFields'; + + ip: Maybe; + }; + + export type Host = { + __typename?: 'HostEcsFields'; + + id: Maybe; + + name: Maybe; + }; + + export type LastFailure = { + __typename?: 'LastSourceHost'; + + timestamp: Maybe; + + source: Maybe<__Source>; + + host: Maybe<_Host>; + }; + + export type __Source = { + __typename?: 'SourceEcsFields'; + + ip: Maybe; + }; + + export type _Host = { + __typename?: 'HostEcsFields'; + + id: Maybe; + + name: Maybe; + }; + + export type Cursor = { + __typename?: 'CursorType'; + + value: Maybe; + }; + + export type PageInfo = { + __typename?: 'PageInfoPaginated'; + + activePage: number; + + fakeTotalCount: number; + + showMorePagesIndicator: boolean; + }; + + export type Inspect = { + __typename?: 'Inspect'; + + dsl: string[]; + + response: string[]; + }; +} + +export namespace GetLastEventTimeQuery { + export type Variables = { + sourceId: string; + indexKey: LastEventIndexKey; + details: LastTimeDetails; + defaultIndex: string[]; + }; + + export type Query = { + __typename?: 'Query'; + + source: Source; + }; + + export type Source = { + __typename?: 'Source'; + + id: string; + + LastEventTime: LastEventTime; + }; + + export type LastEventTime = { + __typename?: 'LastEventTimeData'; + + lastSeen: Maybe; + }; +} + +export namespace GetHostFirstLastSeenQuery { + export type Variables = { + sourceId: string; + hostName: string; + defaultIndex: string[]; + }; + + export type Query = { + __typename?: 'Query'; + + source: Source; + }; + + export type Source = { + __typename?: 'Source'; + + id: string; + + HostFirstLastSeen: HostFirstLastSeen; + }; + + export type HostFirstLastSeen = { + __typename?: 'FirstLastSeenHost'; + + firstSeen: Maybe; + + lastSeen: Maybe; + }; +} + +export namespace GetHostsTableQuery { + export type Variables = { + sourceId: string; + timerange: TimerangeInput; + pagination: PaginationInputPaginated; + sort: HostsSortField; + filterQuery?: Maybe; + defaultIndex: string[]; + inspect: boolean; + }; + + export type Query = { + __typename?: 'Query'; + + source: Source; + }; + + export type Source = { + __typename?: 'Source'; + + id: string; + + Hosts: Hosts; + }; + + export type Hosts = { + __typename?: 'HostsData'; + + totalCount: number; + + edges: Edges[]; + + pageInfo: PageInfo; + + inspect: Maybe; + }; + + export type Edges = { + __typename?: 'HostsEdges'; + + node: Node; + + cursor: Cursor; + }; + + export type Node = { + __typename?: 'HostItem'; + + _id: Maybe; + + lastSeen: Maybe; + + host: Maybe; + }; + + export type Host = { + __typename?: 'HostEcsFields'; + + id: Maybe; + + name: Maybe; + + os: Maybe; + }; + + export type Os = { + __typename?: 'OsEcsFields'; + + name: Maybe; + + version: Maybe; + }; + + export type Cursor = { + __typename?: 'CursorType'; + + value: Maybe; + }; + + export type PageInfo = { + __typename?: 'PageInfoPaginated'; + + activePage: number; + + fakeTotalCount: number; + + showMorePagesIndicator: boolean; + }; + + export type Inspect = { + __typename?: 'Inspect'; + + dsl: string[]; + + response: string[]; + }; +} + +export namespace GetHostOverviewQuery { + export type Variables = { + sourceId: string; + hostName: string; + timerange: TimerangeInput; + defaultIndex: string[]; + inspect: boolean; + }; + + export type Query = { + __typename?: 'Query'; + + source: Source; + }; + + export type Source = { + __typename?: 'Source'; + + id: string; + + HostOverview: HostOverview; + }; + + export type HostOverview = { + __typename?: 'HostItem'; + + _id: Maybe; + + host: Maybe; + + cloud: Maybe; + + inspect: Maybe; + }; + + export type Host = { + __typename?: 'HostEcsFields'; + + architecture: Maybe; + + id: Maybe; + + ip: Maybe; + + mac: Maybe; + + name: Maybe; + + os: Maybe; + + type: Maybe; + }; + + export type Os = { + __typename?: 'OsEcsFields'; + + family: Maybe; + + name: Maybe; + + platform: Maybe; + + version: Maybe; + }; + + export type Cloud = { + __typename?: 'CloudFields'; + + instance: Maybe; + + machine: Maybe; + + provider: Maybe<(Maybe)[]>; + + region: Maybe<(Maybe)[]>; + }; + + export type Instance = { + __typename?: 'CloudInstance'; + + id: Maybe<(Maybe)[]>; + }; + + export type Machine = { + __typename?: 'CloudMachine'; + + type: Maybe<(Maybe)[]>; + }; + + export type Inspect = { + __typename?: 'Inspect'; + + dsl: string[]; + + response: string[]; + }; +} + +export namespace GetIpOverviewQuery { + export type Variables = { + sourceId: string; + filterQuery?: Maybe; + ip: string; + defaultIndex: string[]; + inspect: boolean; + }; + + export type Query = { + __typename?: 'Query'; + + source: Source; + }; + + export type Source = { + __typename?: 'Source'; + + id: string; + + IpOverview: Maybe; + }; + + export type IpOverview = { + __typename?: 'IpOverviewData'; + + source: Maybe<_Source>; + + destination: Maybe; + + host: Host; + + inspect: Maybe; + }; + + export type _Source = { + __typename?: 'Overview'; + + firstSeen: Maybe; + + lastSeen: Maybe; + + autonomousSystem: AutonomousSystem; + + geo: Geo; + }; + + export type AutonomousSystem = { + __typename?: 'AutonomousSystem'; + + number: Maybe; + + organization: Maybe; + }; + + export type Organization = { + __typename?: 'AutonomousSystemOrganization'; + + name: Maybe; + }; + + export type Geo = { + __typename?: 'GeoEcsFields'; + + continent_name: Maybe; + + city_name: Maybe; + + country_iso_code: Maybe; + + country_name: Maybe; + + location: Maybe; + + region_iso_code: Maybe; + + region_name: Maybe; + }; + + export type Location = { + __typename?: 'Location'; + + lat: Maybe; + + lon: Maybe; + }; + + export type Destination = { + __typename?: 'Overview'; + + firstSeen: Maybe; + + lastSeen: Maybe; + + autonomousSystem: _AutonomousSystem; + + geo: _Geo; + }; + + export type _AutonomousSystem = { + __typename?: 'AutonomousSystem'; + + number: Maybe; + + organization: Maybe<_Organization>; + }; + + export type _Organization = { + __typename?: 'AutonomousSystemOrganization'; + + name: Maybe; + }; + + export type _Geo = { + __typename?: 'GeoEcsFields'; + + continent_name: Maybe; + + city_name: Maybe; + + country_iso_code: Maybe; + + country_name: Maybe; + + location: Maybe<_Location>; + + region_iso_code: Maybe; + + region_name: Maybe; + }; + + export type _Location = { + __typename?: 'Location'; + + lat: Maybe; + + lon: Maybe; + }; + + export type Host = { + __typename?: 'HostEcsFields'; + + architecture: Maybe; + + id: Maybe; + + ip: Maybe; + + mac: Maybe; + + name: Maybe; + + os: Maybe; + + type: Maybe; + }; + + export type Os = { + __typename?: 'OsEcsFields'; + + family: Maybe; + + name: Maybe; + + platform: Maybe; + + version: Maybe; + }; + + export type Inspect = { + __typename?: 'Inspect'; + + dsl: string[]; + + response: string[]; + }; +} + +export namespace GetKpiHostDetailsQuery { + export type Variables = { + sourceId: string; + timerange: TimerangeInput; + filterQuery?: Maybe; + defaultIndex: string[]; + inspect: boolean; + }; + + export type Query = { + __typename?: 'Query'; + + source: Source; + }; + + export type Source = { + __typename?: 'Source'; + + id: string; + + KpiHostDetails: KpiHostDetails; + }; + + export type KpiHostDetails = { + __typename?: 'KpiHostDetailsData'; + + authSuccess: Maybe; + + authSuccessHistogram: Maybe; + + authFailure: Maybe; + + authFailureHistogram: Maybe; + + uniqueSourceIps: Maybe; + + uniqueSourceIpsHistogram: Maybe; + + uniqueDestinationIps: Maybe; + + uniqueDestinationIpsHistogram: Maybe; + + inspect: Maybe; + }; + + export type AuthSuccessHistogram = KpiHostDetailsChartFields.Fragment; + + export type AuthFailureHistogram = KpiHostDetailsChartFields.Fragment; + + export type UniqueSourceIpsHistogram = KpiHostDetailsChartFields.Fragment; + + export type UniqueDestinationIpsHistogram = KpiHostDetailsChartFields.Fragment; + + export type Inspect = { + __typename?: 'Inspect'; + + dsl: string[]; + + response: string[]; + }; +} + +export namespace GetKpiHostsQuery { + export type Variables = { + sourceId: string; + timerange: TimerangeInput; + filterQuery?: Maybe; + defaultIndex: string[]; + inspect: boolean; + }; + + export type Query = { + __typename?: 'Query'; + + source: Source; + }; + + export type Source = { + __typename?: 'Source'; + + id: string; + + KpiHosts: KpiHosts; + }; + + export type KpiHosts = { + __typename?: 'KpiHostsData'; + + hosts: Maybe; + + hostsHistogram: Maybe; + + authSuccess: Maybe; + + authSuccessHistogram: Maybe; + + authFailure: Maybe; + + authFailureHistogram: Maybe; + + uniqueSourceIps: Maybe; + + uniqueSourceIpsHistogram: Maybe; + + uniqueDestinationIps: Maybe; + + uniqueDestinationIpsHistogram: Maybe; + + inspect: Maybe; + }; + + export type HostsHistogram = KpiHostChartFields.Fragment; + + export type AuthSuccessHistogram = KpiHostChartFields.Fragment; + + export type AuthFailureHistogram = KpiHostChartFields.Fragment; + + export type UniqueSourceIpsHistogram = KpiHostChartFields.Fragment; + + export type UniqueDestinationIpsHistogram = KpiHostChartFields.Fragment; + + export type Inspect = { + __typename?: 'Inspect'; + + dsl: string[]; + + response: string[]; + }; +} + +export namespace GetKpiNetworkQuery { + export type Variables = { + sourceId: string; + timerange: TimerangeInput; + filterQuery?: Maybe; + defaultIndex: string[]; + inspect: boolean; + }; + + export type Query = { + __typename?: 'Query'; + + source: Source; + }; + + export type Source = { + __typename?: 'Source'; + + id: string; + + KpiNetwork: Maybe; + }; + + export type KpiNetwork = { + __typename?: 'KpiNetworkData'; + + networkEvents: Maybe; + + uniqueFlowId: Maybe; + + uniqueSourcePrivateIps: Maybe; + + uniqueSourcePrivateIpsHistogram: Maybe; + + uniqueDestinationPrivateIps: Maybe; + + uniqueDestinationPrivateIpsHistogram: Maybe; + + dnsQueries: Maybe; + + tlsHandshakes: Maybe; + + inspect: Maybe; + }; + + export type UniqueSourcePrivateIpsHistogram = KpiNetworkChartFields.Fragment; + + export type UniqueDestinationPrivateIpsHistogram = KpiNetworkChartFields.Fragment; + + export type Inspect = { + __typename?: 'Inspect'; + + dsl: string[]; + + response: string[]; + }; +} + +export namespace GetMatrixHistogramQuery { + export type Variables = { + defaultIndex: string[]; + filterQuery?: Maybe; + histogramType: HistogramType; + inspect: boolean; + sourceId: string; + stackByField: string; + timerange: TimerangeInput; + }; + + export type Query = { + __typename?: 'Query'; + + source: Source; + }; + + export type Source = { + __typename?: 'Source'; + + id: string; + + MatrixHistogram: MatrixHistogram; + }; + + export type MatrixHistogram = { + __typename?: 'MatrixHistogramOverTimeData'; + + matrixHistogramData: MatrixHistogramData[]; + + totalCount: number; + + inspect: Maybe; + }; + + export type MatrixHistogramData = { + __typename?: 'MatrixOverTimeHistogramData'; + + x: Maybe; + + y: Maybe; + + g: Maybe; + }; + + export type Inspect = { + __typename?: 'Inspect'; + + dsl: string[]; + + response: string[]; + }; +} + +export namespace GetNetworkDnsQuery { + export type Variables = { + defaultIndex: string[]; + filterQuery?: Maybe; + inspect: boolean; + isPtrIncluded: boolean; + pagination: PaginationInputPaginated; + sort: NetworkDnsSortField; + sourceId: string; + stackByField?: Maybe; + timerange: TimerangeInput; + }; + + export type Query = { + __typename?: 'Query'; + + source: Source; + }; + + export type Source = { + __typename?: 'Source'; + + id: string; + + NetworkDns: NetworkDns; + }; + + export type NetworkDns = { + __typename?: 'NetworkDnsData'; + + totalCount: number; + + edges: Edges[]; + + pageInfo: PageInfo; + + inspect: Maybe; + }; + + export type Edges = { + __typename?: 'NetworkDnsEdges'; + + node: Node; + + cursor: Cursor; + }; + + export type Node = { + __typename?: 'NetworkDnsItem'; + + _id: Maybe; + + dnsBytesIn: Maybe; + + dnsBytesOut: Maybe; + + dnsName: Maybe; + + queryCount: Maybe; + + uniqueDomains: Maybe; + }; + + export type Cursor = { + __typename?: 'CursorType'; + + value: Maybe; + }; + + export type PageInfo = { + __typename?: 'PageInfoPaginated'; + + activePage: number; + + fakeTotalCount: number; + + showMorePagesIndicator: boolean; + }; + + export type Inspect = { + __typename?: 'Inspect'; + + dsl: string[]; + + response: string[]; + }; +} + +export namespace GetNetworkHttpQuery { + export type Variables = { + sourceId: string; + ip?: Maybe; + filterQuery?: Maybe; + pagination: PaginationInputPaginated; + sort: NetworkHttpSortField; + timerange: TimerangeInput; + defaultIndex: string[]; + inspect: boolean; + }; + + export type Query = { + __typename?: 'Query'; + + source: Source; + }; + + export type Source = { + __typename?: 'Source'; + + id: string; + + NetworkHttp: NetworkHttp; + }; + + export type NetworkHttp = { + __typename?: 'NetworkHttpData'; + + totalCount: number; + + edges: Edges[]; + + pageInfo: PageInfo; + + inspect: Maybe; + }; + + export type Edges = { + __typename?: 'NetworkHttpEdges'; + + node: Node; + + cursor: Cursor; + }; + + export type Node = { + __typename?: 'NetworkHttpItem'; + + domains: string[]; + + lastHost: Maybe; + + lastSourceIp: Maybe; + + methods: string[]; + + path: Maybe; + + requestCount: Maybe; + + statuses: string[]; + }; + + export type Cursor = { + __typename?: 'CursorType'; + + value: Maybe; + }; + + export type PageInfo = { + __typename?: 'PageInfoPaginated'; + + activePage: number; + + fakeTotalCount: number; + + showMorePagesIndicator: boolean; + }; + + export type Inspect = { + __typename?: 'Inspect'; + + dsl: string[]; + + response: string[]; + }; +} + +export namespace GetNetworkTopCountriesQuery { + export type Variables = { + sourceId: string; + ip?: Maybe; + filterQuery?: Maybe; + pagination: PaginationInputPaginated; + sort: NetworkTopTablesSortField; + flowTarget: FlowTargetSourceDest; + timerange: TimerangeInput; + defaultIndex: string[]; + inspect: boolean; + }; + + export type Query = { + __typename?: 'Query'; + + source: Source; + }; + + export type Source = { + __typename?: 'Source'; + + id: string; + + NetworkTopCountries: NetworkTopCountries; + }; + + export type NetworkTopCountries = { + __typename?: 'NetworkTopCountriesData'; + + totalCount: number; + + edges: Edges[]; + + pageInfo: PageInfo; + + inspect: Maybe; + }; + + export type Edges = { + __typename?: 'NetworkTopCountriesEdges'; + + node: Node; + + cursor: Cursor; + }; + + export type Node = { + __typename?: 'NetworkTopCountriesItem'; + + source: Maybe<_Source>; + + destination: Maybe; + + network: Maybe; + }; + + export type _Source = { + __typename?: 'TopCountriesItemSource'; + + country: Maybe; + + destination_ips: Maybe; + + flows: Maybe; + + source_ips: Maybe; + }; + + export type Destination = { + __typename?: 'TopCountriesItemDestination'; + + country: Maybe; + + destination_ips: Maybe; + + flows: Maybe; + + source_ips: Maybe; + }; + + export type Network = { + __typename?: 'TopNetworkTablesEcsField'; + + bytes_in: Maybe; + + bytes_out: Maybe; + }; + + export type Cursor = { + __typename?: 'CursorType'; + + value: Maybe; + }; + + export type PageInfo = { + __typename?: 'PageInfoPaginated'; + + activePage: number; + + fakeTotalCount: number; + + showMorePagesIndicator: boolean; + }; + + export type Inspect = { + __typename?: 'Inspect'; + + dsl: string[]; + + response: string[]; + }; +} + +export namespace GetNetworkTopNFlowQuery { + export type Variables = { + sourceId: string; + ip?: Maybe; + filterQuery?: Maybe; + pagination: PaginationInputPaginated; + sort: NetworkTopTablesSortField; + flowTarget: FlowTargetSourceDest; + timerange: TimerangeInput; + defaultIndex: string[]; + inspect: boolean; + }; + + export type Query = { + __typename?: 'Query'; + + source: Source; + }; + + export type Source = { + __typename?: 'Source'; + + id: string; + + NetworkTopNFlow: NetworkTopNFlow; + }; + + export type NetworkTopNFlow = { + __typename?: 'NetworkTopNFlowData'; + + totalCount: number; + + edges: Edges[]; + + pageInfo: PageInfo; + + inspect: Maybe; + }; + + export type Edges = { + __typename?: 'NetworkTopNFlowEdges'; + + node: Node; + + cursor: Cursor; + }; + + export type Node = { + __typename?: 'NetworkTopNFlowItem'; + + source: Maybe<_Source>; + + destination: Maybe; + + network: Maybe; + }; + + export type _Source = { + __typename?: 'TopNFlowItemSource'; + + autonomous_system: Maybe; + + domain: Maybe; + + ip: Maybe; + + location: Maybe; + + flows: Maybe; + + destination_ips: Maybe; + }; + + export type AutonomousSystem = { + __typename?: 'AutonomousSystemItem'; + + name: Maybe; + + number: Maybe; + }; + + export type Location = { + __typename?: 'GeoItem'; + + geo: Maybe; + + flowTarget: Maybe; + }; + + export type Geo = { + __typename?: 'GeoEcsFields'; + + continent_name: Maybe; + + country_name: Maybe; + + country_iso_code: Maybe; + + city_name: Maybe; + + region_iso_code: Maybe; + + region_name: Maybe; + }; + + export type Destination = { + __typename?: 'TopNFlowItemDestination'; + + autonomous_system: Maybe<_AutonomousSystem>; + + domain: Maybe; + + ip: Maybe; + + location: Maybe<_Location>; + + flows: Maybe; + + source_ips: Maybe; + }; + + export type _AutonomousSystem = { + __typename?: 'AutonomousSystemItem'; + + name: Maybe; + + number: Maybe; + }; + + export type _Location = { + __typename?: 'GeoItem'; + + geo: Maybe<_Geo>; + + flowTarget: Maybe; + }; + + export type _Geo = { + __typename?: 'GeoEcsFields'; + + continent_name: Maybe; + + country_name: Maybe; + + country_iso_code: Maybe; + + city_name: Maybe; + + region_iso_code: Maybe; + + region_name: Maybe; + }; + + export type Network = { + __typename?: 'TopNetworkTablesEcsField'; + + bytes_in: Maybe; + + bytes_out: Maybe; + }; + + export type Cursor = { + __typename?: 'CursorType'; + + value: Maybe; + }; + + export type PageInfo = { + __typename?: 'PageInfoPaginated'; + + activePage: number; + + fakeTotalCount: number; + + showMorePagesIndicator: boolean; + }; + + export type Inspect = { + __typename?: 'Inspect'; + + dsl: string[]; + + response: string[]; + }; +} + +export namespace GetOverviewHostQuery { + export type Variables = { + sourceId: string; + timerange: TimerangeInput; + filterQuery?: Maybe; + defaultIndex: string[]; + inspect: boolean; + }; + + export type Query = { + __typename?: 'Query'; + + source: Source; + }; + + export type Source = { + __typename?: 'Source'; + + id: string; + + OverviewHost: Maybe; + }; + + export type OverviewHost = { + __typename?: 'OverviewHostData'; + + auditbeatAuditd: Maybe; + + auditbeatFIM: Maybe; + + auditbeatLogin: Maybe; + + auditbeatPackage: Maybe; + + auditbeatProcess: Maybe; + + auditbeatUser: Maybe; + + endgameDns: Maybe; + + endgameFile: Maybe; + + endgameImageLoad: Maybe; + + endgameNetwork: Maybe; + + endgameProcess: Maybe; + + endgameRegistry: Maybe; + + endgameSecurity: Maybe; + + filebeatSystemModule: Maybe; + + winlogbeatSecurity: Maybe; + + winlogbeatMWSysmonOperational: Maybe; + + inspect: Maybe; + }; + + export type Inspect = { + __typename?: 'Inspect'; + + dsl: string[]; + + response: string[]; + }; +} + +export namespace GetOverviewNetworkQuery { + export type Variables = { + sourceId: string; + timerange: TimerangeInput; + filterQuery?: Maybe; + defaultIndex: string[]; + inspect: boolean; + }; + + export type Query = { + __typename?: 'Query'; + + source: Source; + }; + + export type Source = { + __typename?: 'Source'; + + id: string; + + OverviewNetwork: Maybe; + }; + + export type OverviewNetwork = { + __typename?: 'OverviewNetworkData'; + + auditbeatSocket: Maybe; + + filebeatCisco: Maybe; + + filebeatNetflow: Maybe; + + filebeatPanw: Maybe; + + filebeatSuricata: Maybe; + + filebeatZeek: Maybe; + + packetbeatDNS: Maybe; + + packetbeatFlow: Maybe; + + packetbeatTLS: Maybe; + + inspect: Maybe; + }; + + export type Inspect = { + __typename?: 'Inspect'; + + dsl: string[]; + + response: string[]; + }; +} + +export namespace SourceQuery { + export type Variables = { + sourceId?: Maybe; + defaultIndex: string[]; + }; + + export type Query = { + __typename?: 'Query'; + + source: Source; + }; + + export type Source = { + __typename?: 'Source'; + + id: string; + + status: Status; + }; + + export type Status = { + __typename?: 'SourceStatus'; + + indicesExist: boolean; + + indexFields: IndexFields[]; + }; + + export type IndexFields = { + __typename?: 'IndexField'; + + category: string; + + description: Maybe; + + example: Maybe; + + indexes: (Maybe)[]; + + name: string; + + searchable: boolean; + + type: string; + + aggregatable: boolean; + + format: Maybe; + }; +} + +export namespace GetAllTimeline { + export type Variables = { + pageInfo: PageInfoTimeline; + search?: Maybe; + sort?: Maybe; + onlyUserFavorite?: Maybe; + }; + + export type Query = { + __typename?: 'Query'; + + getAllTimeline: GetAllTimeline; + }; + + export type GetAllTimeline = { + __typename?: 'ResponseTimelines'; + + totalCount: Maybe; + + timeline: (Maybe)[]; + }; + + export type Timeline = { + __typename?: 'TimelineResult'; + + savedObjectId: string; + + description: Maybe; + + favorite: Maybe; + + eventIdToNoteIds: Maybe; + + notes: Maybe; + + noteIds: Maybe; + + pinnedEventIds: Maybe; + + title: Maybe; + + created: Maybe; + + createdBy: Maybe; + + updated: Maybe; + + updatedBy: Maybe; + + version: string; + }; + + export type Favorite = { + __typename?: 'FavoriteTimelineResult'; + + fullName: Maybe; + + userName: Maybe; + + favoriteDate: Maybe; + }; + + export type EventIdToNoteIds = { + __typename?: 'NoteResult'; + + eventId: Maybe; + + note: Maybe; + + timelineId: Maybe; + + noteId: string; + + created: Maybe; + + createdBy: Maybe; + + timelineVersion: Maybe; + + updated: Maybe; + + updatedBy: Maybe; + + version: Maybe; + }; + + export type Notes = { + __typename?: 'NoteResult'; + + eventId: Maybe; + + note: Maybe; + + timelineId: Maybe; + + timelineVersion: Maybe; + + noteId: string; + + created: Maybe; + + createdBy: Maybe; + + updated: Maybe; + + updatedBy: Maybe; + + version: Maybe; + }; +} + +export namespace DeleteTimelineMutation { + export type Variables = { + id: string[]; + }; + + export type Mutation = { + __typename?: 'Mutation'; + + deleteTimeline: boolean; + }; +} + +export namespace GetTimelineDetailsQuery { + export type Variables = { + sourceId: string; + eventId: string; + indexName: string; + defaultIndex: string[]; + }; + + export type Query = { + __typename?: 'Query'; + + source: Source; + }; + + export type Source = { + __typename?: 'Source'; + + id: string; + + TimelineDetails: TimelineDetails; + }; + + export type TimelineDetails = { + __typename?: 'TimelineDetailsData'; + + data: Maybe; + }; + + export type Data = { + __typename?: 'DetailItem'; + + field: string; + + values: Maybe; + + originalValue: Maybe; + }; +} + +export namespace PersistTimelineFavoriteMutation { + export type Variables = { + timelineId?: Maybe; + }; + + export type Mutation = { + __typename?: 'Mutation'; + + persistFavorite: PersistFavorite; + }; + + export type PersistFavorite = { + __typename?: 'ResponseFavoriteTimeline'; + + savedObjectId: string; + + version: string; + + favorite: Maybe; + }; + + export type Favorite = { + __typename?: 'FavoriteTimelineResult'; + + fullName: Maybe; + + userName: Maybe; + + favoriteDate: Maybe; + }; +} + +export namespace GetTimelineQuery { + export type Variables = { + sourceId: string; + fieldRequested: string[]; + pagination: PaginationInput; + sortField: SortField; + filterQuery?: Maybe; + defaultIndex: string[]; + inspect: boolean; + }; + + export type Query = { + __typename?: 'Query'; + + source: Source; + }; + + export type Source = { + __typename?: 'Source'; + + id: string; + + Timeline: Timeline; + }; + + export type Timeline = { + __typename?: 'TimelineData'; + + totalCount: number; + + inspect: Maybe; + + pageInfo: PageInfo; + + edges: Edges[]; + }; + + export type Inspect = { + __typename?: 'Inspect'; + + dsl: string[]; + + response: string[]; + }; + + export type PageInfo = { + __typename?: 'PageInfo'; + + endCursor: Maybe; + + hasNextPage: Maybe; + }; + + export type EndCursor = { + __typename?: 'CursorType'; + + value: Maybe; + + tiebreaker: Maybe; + }; + + export type Edges = { + __typename?: 'TimelineEdges'; + + node: Node; + }; + + export type Node = { + __typename?: 'TimelineItem'; + + _id: string; + + _index: Maybe; + + data: Data[]; + + ecs: Ecs; + }; + + export type Data = { + __typename?: 'TimelineNonEcsData'; + + field: string; + + value: Maybe; + }; + + export type Ecs = { + __typename?: 'ECS'; + + _id: string; + + _index: Maybe; + + timestamp: Maybe; + + message: Maybe; + + system: Maybe; + + event: Maybe; + + auditd: Maybe; + + file: Maybe; + + host: Maybe; + + rule: Maybe; + + source: Maybe<_Source>; + + destination: Maybe; + + dns: Maybe; + + endgame: Maybe; + + geo: Maybe<__Geo>; + + signal: Maybe; + + suricata: Maybe; + + network: Maybe; + + http: Maybe; + + tls: Maybe; + + url: Maybe; + + user: Maybe; + + winlog: Maybe; + + process: Maybe; + + zeek: Maybe; + }; + + export type System = { + __typename?: 'SystemEcsField'; + + auth: Maybe; + + audit: Maybe; + }; + + export type Auth = { + __typename?: 'AuthEcsFields'; + + ssh: Maybe; + }; + + export type Ssh = { + __typename?: 'SshEcsFields'; + + signature: Maybe; + + method: Maybe; + }; + + export type Audit = { + __typename?: 'AuditEcsFields'; + + package: Maybe; + }; + + export type Package = { + __typename?: 'PackageEcsFields'; + + arch: Maybe; + + entity_id: Maybe; + + name: Maybe; + + size: Maybe; + + summary: Maybe; + + version: Maybe; + }; + + export type Event = { + __typename?: 'EventEcsFields'; + + action: Maybe; + + category: Maybe; + + code: Maybe; + + created: Maybe; + + dataset: Maybe; + + duration: Maybe; + + end: Maybe; + + hash: Maybe; + + id: Maybe; + + kind: Maybe; + + module: Maybe; + + original: Maybe; + + outcome: Maybe; + + risk_score: Maybe; + + risk_score_norm: Maybe; + + severity: Maybe; + + start: Maybe; + + timezone: Maybe; + + type: Maybe; + }; + + export type Auditd = { + __typename?: 'AuditdEcsFields'; + + result: Maybe; + + session: Maybe; + + data: Maybe<_Data>; + + summary: Maybe; + }; + + export type _Data = { + __typename?: 'AuditdData'; + + acct: Maybe; + + terminal: Maybe; + + op: Maybe; + }; + + export type Summary = { + __typename?: 'Summary'; + + actor: Maybe; + + object: Maybe; + + how: Maybe; + + message_type: Maybe; + + sequence: Maybe; + }; + + export type Actor = { + __typename?: 'PrimarySecondary'; + + primary: Maybe; + + secondary: Maybe; + }; + + export type Object = { + __typename?: 'PrimarySecondary'; + + primary: Maybe; + + secondary: Maybe; + + type: Maybe; + }; + + export type File = { + __typename?: 'FileFields'; + + name: Maybe; + + path: Maybe; + + target_path: Maybe; + + extension: Maybe; + + type: Maybe; + + device: Maybe; + + inode: Maybe; + + uid: Maybe; + + owner: Maybe; + + gid: Maybe; + + group: Maybe; + + mode: Maybe; + + size: Maybe; + + mtime: Maybe; + + ctime: Maybe; + }; + + export type Host = { + __typename?: 'HostEcsFields'; + + id: Maybe; + + name: Maybe; + + ip: Maybe; + }; + + export type Rule = { + __typename?: 'RuleEcsField'; + + reference: Maybe; + }; + + export type _Source = { + __typename?: 'SourceEcsFields'; + + bytes: Maybe; + + ip: Maybe; + + packets: Maybe; + + port: Maybe; + + geo: Maybe; + }; + + export type Geo = { + __typename?: 'GeoEcsFields'; + + continent_name: Maybe; + + country_name: Maybe; + + country_iso_code: Maybe; + + city_name: Maybe; + + region_iso_code: Maybe; + + region_name: Maybe; + }; + + export type Destination = { + __typename?: 'DestinationEcsFields'; + + bytes: Maybe; + + ip: Maybe; + + packets: Maybe; + + port: Maybe; + + geo: Maybe<_Geo>; + }; + + export type _Geo = { + __typename?: 'GeoEcsFields'; + + continent_name: Maybe; + + country_name: Maybe; + + country_iso_code: Maybe; + + city_name: Maybe; + + region_iso_code: Maybe; + + region_name: Maybe; + }; + + export type Dns = { + __typename?: 'DnsEcsFields'; + + question: Maybe; + + resolved_ip: Maybe; + + response_code: Maybe; + }; + + export type Question = { + __typename?: 'DnsQuestionData'; + + name: Maybe; + + type: Maybe; + }; + + export type Endgame = { + __typename?: 'EndgameEcsFields'; + + exit_code: Maybe; + + file_name: Maybe; + + file_path: Maybe; + + logon_type: Maybe; + + parent_process_name: Maybe; + + pid: Maybe; + + process_name: Maybe; + + subject_domain_name: Maybe; + + subject_logon_id: Maybe; + + subject_user_name: Maybe; + + target_domain_name: Maybe; + + target_logon_id: Maybe; + + target_user_name: Maybe; + }; + + export type __Geo = { + __typename?: 'GeoEcsFields'; + + region_name: Maybe; + + country_iso_code: Maybe; + }; + + export type Signal = { + __typename?: 'SignalField'; + + original_time: Maybe; + + rule: Maybe<_Rule>; + }; + + export type _Rule = { + __typename?: 'RuleField'; + + id: Maybe; + + saved_id: Maybe; + + timeline_id: Maybe; + + timeline_title: Maybe; + + output_index: Maybe; + + from: Maybe; + + index: Maybe; + + language: Maybe; + + query: Maybe; + + to: Maybe; + + filters: Maybe; + }; + + export type Suricata = { + __typename?: 'SuricataEcsFields'; + + eve: Maybe; + }; + + export type Eve = { + __typename?: 'SuricataEveData'; + + proto: Maybe; + + flow_id: Maybe; + + alert: Maybe; + }; + + export type Alert = { + __typename?: 'SuricataAlertData'; + + signature: Maybe; + + signature_id: Maybe; + }; + + export type Network = { + __typename?: 'NetworkEcsField'; + + bytes: Maybe; + + community_id: Maybe; + + direction: Maybe; + + packets: Maybe; + + protocol: Maybe; + + transport: Maybe; + }; + + export type Http = { + __typename?: 'HttpEcsFields'; + + version: Maybe; + + request: Maybe; + + response: Maybe; + }; + + export type Request = { + __typename?: 'HttpRequestData'; + + method: Maybe; + + body: Maybe; + + referrer: Maybe; + }; + + export type Body = { + __typename?: 'HttpBodyData'; + + bytes: Maybe; + + content: Maybe; + }; + + export type Response = { + __typename?: 'HttpResponseData'; + + status_code: Maybe; + + body: Maybe<_Body>; + }; + + export type _Body = { + __typename?: 'HttpBodyData'; + + bytes: Maybe; + + content: Maybe; + }; + + export type Tls = { + __typename?: 'TlsEcsFields'; + + client_certificate: Maybe; + + fingerprints: Maybe; + + server_certificate: Maybe; + }; + + export type ClientCertificate = { + __typename?: 'TlsClientCertificateData'; + + fingerprint: Maybe; + }; + + export type Fingerprint = { + __typename?: 'FingerprintData'; + + sha1: Maybe; + }; + + export type Fingerprints = { + __typename?: 'TlsFingerprintsData'; + + ja3: Maybe; + }; + + export type Ja3 = { + __typename?: 'TlsJa3Data'; + + hash: Maybe; + }; + + export type ServerCertificate = { + __typename?: 'TlsServerCertificateData'; + + fingerprint: Maybe<_Fingerprint>; + }; + + export type _Fingerprint = { + __typename?: 'FingerprintData'; + + sha1: Maybe; + }; + + export type Url = { + __typename?: 'UrlEcsFields'; + + original: Maybe; + + domain: Maybe; + + username: Maybe; + + password: Maybe; + }; + + export type User = { + __typename?: 'UserEcsFields'; + + domain: Maybe; + + name: Maybe; + }; + + export type Winlog = { + __typename?: 'WinlogEcsFields'; + + event_id: Maybe; + }; + + export type Process = { + __typename?: 'ProcessEcsFields'; + + hash: Maybe; + + pid: Maybe; + + name: Maybe; + + ppid: Maybe; + + args: Maybe; + + executable: Maybe; + + title: Maybe; + + working_directory: Maybe; + }; + + export type Hash = { + __typename?: 'ProcessHashData'; + + md5: Maybe; + + sha1: Maybe; + + sha256: Maybe; + }; + + export type Zeek = { + __typename?: 'ZeekEcsFields'; + + session_id: Maybe; + + connection: Maybe; + + notice: Maybe; + + dns: Maybe<_Dns>; + + http: Maybe<_Http>; + + files: Maybe; + + ssl: Maybe; + }; + + export type Connection = { + __typename?: 'ZeekConnectionData'; + + local_resp: Maybe; + + local_orig: Maybe; + + missed_bytes: Maybe; + + state: Maybe; + + history: Maybe; + }; + + export type Notice = { + __typename?: 'ZeekNoticeData'; + + suppress_for: Maybe; + + msg: Maybe; + + note: Maybe; + + sub: Maybe; + + dst: Maybe; + + dropped: Maybe; + + peer_descr: Maybe; + }; + + export type _Dns = { + __typename?: 'ZeekDnsData'; + + AA: Maybe; + + qclass_name: Maybe; + + RD: Maybe; + + qtype_name: Maybe; + + rejected: Maybe; + + qtype: Maybe; + + query: Maybe; + + trans_id: Maybe; + + qclass: Maybe; + + RA: Maybe; + + TC: Maybe; + }; + + export type _Http = { + __typename?: 'ZeekHttpData'; + + resp_mime_types: Maybe; + + trans_depth: Maybe; + + status_msg: Maybe; + + resp_fuids: Maybe; + + tags: Maybe; + }; + + export type Files = { + __typename?: 'ZeekFileData'; + + session_ids: Maybe; + + timedout: Maybe; + + local_orig: Maybe; + + tx_host: Maybe; + + source: Maybe; + + is_orig: Maybe; + + overflow_bytes: Maybe; + + sha1: Maybe; + + duration: Maybe; + + depth: Maybe; + + analyzers: Maybe; + + mime_type: Maybe; + + rx_host: Maybe; + + total_bytes: Maybe; + + fuid: Maybe; + + seen_bytes: Maybe; + + missing_bytes: Maybe; + + md5: Maybe; + }; + + export type Ssl = { + __typename?: 'ZeekSslData'; + + cipher: Maybe; + + established: Maybe; + + resumed: Maybe; + + version: Maybe; + }; +} + +export namespace PersistTimelineNoteMutation { + export type Variables = { + noteId?: Maybe; + version?: Maybe; + note: NoteInput; + }; + + export type Mutation = { + __typename?: 'Mutation'; + + persistNote: PersistNote; + }; + + export type PersistNote = { + __typename?: 'ResponseNote'; + + code: Maybe; + + message: Maybe; + + note: Note; + }; + + export type Note = { + __typename?: 'NoteResult'; + + eventId: Maybe; + + note: Maybe; + + timelineId: Maybe; + + timelineVersion: Maybe; + + noteId: string; + + created: Maybe; + + createdBy: Maybe; + + updated: Maybe; + + updatedBy: Maybe; + + version: Maybe; + }; +} + +export namespace GetOneTimeline { + export type Variables = { + id: string; + }; + + export type Query = { + __typename?: 'Query'; + + getOneTimeline: GetOneTimeline; + }; + + export type GetOneTimeline = { + __typename?: 'TimelineResult'; + + savedObjectId: string; + + columns: Maybe; + + dataProviders: Maybe; + + dateRange: Maybe; + + description: Maybe; + + eventType: Maybe; + + eventIdToNoteIds: Maybe; + + favorite: Maybe; + + filters: Maybe; + + kqlMode: Maybe; + + kqlQuery: Maybe; + + notes: Maybe; + + noteIds: Maybe; + + pinnedEventIds: Maybe; + + pinnedEventsSaveObject: Maybe; + + title: Maybe; + + savedQueryId: Maybe; + + sort: Maybe; + + created: Maybe; + + createdBy: Maybe; + + updated: Maybe; + + updatedBy: Maybe; + + version: string; + }; + + export type Columns = { + __typename?: 'ColumnHeaderResult'; + + aggregatable: Maybe; + + category: Maybe; + + columnHeaderType: Maybe; + + description: Maybe; + + example: Maybe; + + indexes: Maybe; + + id: Maybe; + + name: Maybe; + + searchable: Maybe; + + type: Maybe; + }; + + export type DataProviders = { + __typename?: 'DataProviderResult'; + + id: Maybe; + + name: Maybe; + + enabled: Maybe; + + excluded: Maybe; + + kqlQuery: Maybe; + + queryMatch: Maybe; + + and: Maybe; + }; + + export type QueryMatch = { + __typename?: 'QueryMatchResult'; + + field: Maybe; + + displayField: Maybe; + + value: Maybe; + + displayValue: Maybe; + + operator: Maybe; + }; + + export type And = { + __typename?: 'DataProviderResult'; + + id: Maybe; + + name: Maybe; + + enabled: Maybe; + + excluded: Maybe; + + kqlQuery: Maybe; + + queryMatch: Maybe<_QueryMatch>; + }; + + export type _QueryMatch = { + __typename?: 'QueryMatchResult'; + + field: Maybe; + + displayField: Maybe; + + value: Maybe; + + displayValue: Maybe; + + operator: Maybe; + }; + + export type DateRange = { + __typename?: 'DateRangePickerResult'; + + start: Maybe; + + end: Maybe; + }; + + export type EventIdToNoteIds = { + __typename?: 'NoteResult'; + + eventId: Maybe; + + note: Maybe; + + timelineId: Maybe; + + noteId: string; + + created: Maybe; + + createdBy: Maybe; + + timelineVersion: Maybe; + + updated: Maybe; + + updatedBy: Maybe; + + version: Maybe; + }; + + export type Favorite = { + __typename?: 'FavoriteTimelineResult'; + + fullName: Maybe; + + userName: Maybe; + + favoriteDate: Maybe; + }; + + export type Filters = { + __typename?: 'FilterTimelineResult'; + + meta: Maybe; + + query: Maybe; + + exists: Maybe; + + match_all: Maybe; + + missing: Maybe; + + range: Maybe; + + script: Maybe; + }; + + export type Meta = { + __typename?: 'FilterMetaTimelineResult'; + + alias: Maybe; + + controlledBy: Maybe; + + disabled: Maybe; + + field: Maybe; + + formattedValue: Maybe; + + index: Maybe; + + key: Maybe; + + negate: Maybe; + + params: Maybe; + + type: Maybe; + + value: Maybe; + }; + + export type KqlQuery = { + __typename?: 'SerializedFilterQueryResult'; + + filterQuery: Maybe; + }; + + export type FilterQuery = { + __typename?: 'SerializedKueryQueryResult'; + + kuery: Maybe; + + serializedQuery: Maybe; + }; + + export type Kuery = { + __typename?: 'KueryFilterQueryResult'; + + kind: Maybe; + + expression: Maybe; + }; + + export type Notes = { + __typename?: 'NoteResult'; + + eventId: Maybe; + + note: Maybe; + + timelineId: Maybe; + + timelineVersion: Maybe; + + noteId: string; + + created: Maybe; + + createdBy: Maybe; + + updated: Maybe; + + updatedBy: Maybe; + + version: Maybe; + }; + + export type PinnedEventsSaveObject = { + __typename?: 'PinnedEvent'; + + pinnedEventId: string; + + eventId: Maybe; + + timelineId: Maybe; + + created: Maybe; + + createdBy: Maybe; + + updated: Maybe; + + updatedBy: Maybe; + + version: Maybe; + }; + + export type Sort = { + __typename?: 'SortTimelineResult'; + + columnId: Maybe; + + sortDirection: Maybe; + }; +} + +export namespace PersistTimelineMutation { + export type Variables = { + timelineId?: Maybe; + version?: Maybe; + timeline: TimelineInput; + }; + + export type Mutation = { + __typename?: 'Mutation'; + + persistTimeline: PersistTimeline; + }; + + export type PersistTimeline = { + __typename?: 'ResponseTimeline'; + + code: Maybe; + + message: Maybe; + + timeline: Timeline; + }; + + export type Timeline = { + __typename?: 'TimelineResult'; + + savedObjectId: string; + + version: string; + + columns: Maybe; + + dataProviders: Maybe; + + description: Maybe; + + eventType: Maybe; + + favorite: Maybe; + + filters: Maybe; + + kqlMode: Maybe; + + kqlQuery: Maybe; + + title: Maybe; + + dateRange: Maybe; + + savedQueryId: Maybe; + + sort: Maybe; + + created: Maybe; + + createdBy: Maybe; + + updated: Maybe; + + updatedBy: Maybe; + }; + + export type Columns = { + __typename?: 'ColumnHeaderResult'; + + aggregatable: Maybe; + + category: Maybe; + + columnHeaderType: Maybe; + + description: Maybe; + + example: Maybe; + + indexes: Maybe; + + id: Maybe; + + name: Maybe; + + searchable: Maybe; + + type: Maybe; + }; + + export type DataProviders = { + __typename?: 'DataProviderResult'; + + id: Maybe; + + name: Maybe; + + enabled: Maybe; + + excluded: Maybe; + + kqlQuery: Maybe; + + queryMatch: Maybe; + + and: Maybe; + }; + + export type QueryMatch = { + __typename?: 'QueryMatchResult'; + + field: Maybe; + + displayField: Maybe; + + value: Maybe; + + displayValue: Maybe; + + operator: Maybe; + }; + + export type And = { + __typename?: 'DataProviderResult'; + + id: Maybe; + + name: Maybe; + + enabled: Maybe; + + excluded: Maybe; + + kqlQuery: Maybe; + + queryMatch: Maybe<_QueryMatch>; + }; + + export type _QueryMatch = { + __typename?: 'QueryMatchResult'; + + field: Maybe; + + displayField: Maybe; + + value: Maybe; + + displayValue: Maybe; + + operator: Maybe; + }; + + export type Favorite = { + __typename?: 'FavoriteTimelineResult'; + + fullName: Maybe; + + userName: Maybe; + + favoriteDate: Maybe; + }; + + export type Filters = { + __typename?: 'FilterTimelineResult'; + + meta: Maybe; + + query: Maybe; + + exists: Maybe; + + match_all: Maybe; + + missing: Maybe; + + range: Maybe; + + script: Maybe; + }; + + export type Meta = { + __typename?: 'FilterMetaTimelineResult'; + + alias: Maybe; + + controlledBy: Maybe; + + disabled: Maybe; + + field: Maybe; + + formattedValue: Maybe; + + index: Maybe; + + key: Maybe; + + negate: Maybe; + + params: Maybe; + + type: Maybe; + + value: Maybe; + }; + + export type KqlQuery = { + __typename?: 'SerializedFilterQueryResult'; + + filterQuery: Maybe; + }; + + export type FilterQuery = { + __typename?: 'SerializedKueryQueryResult'; + + kuery: Maybe; + + serializedQuery: Maybe; + }; + + export type Kuery = { + __typename?: 'KueryFilterQueryResult'; + + kind: Maybe; + + expression: Maybe; + }; + + export type DateRange = { + __typename?: 'DateRangePickerResult'; + + start: Maybe; + + end: Maybe; + }; + + export type Sort = { + __typename?: 'SortTimelineResult'; + + columnId: Maybe; + + sortDirection: Maybe; + }; +} + +export namespace PersistTimelinePinnedEventMutation { + export type Variables = { + pinnedEventId?: Maybe; + eventId: string; + timelineId?: Maybe; + }; + + export type Mutation = { + __typename?: 'Mutation'; + + persistPinnedEventOnTimeline: Maybe; + }; + + export type PersistPinnedEventOnTimeline = { + __typename?: 'PinnedEvent'; + + pinnedEventId: string; + + eventId: Maybe; + + timelineId: Maybe; + + timelineVersion: Maybe; + + created: Maybe; + + createdBy: Maybe; + + updated: Maybe; + + updatedBy: Maybe; + + version: Maybe; + }; +} + +export namespace GetTlsQuery { + export type Variables = { + sourceId: string; + filterQuery?: Maybe; + flowTarget: FlowTargetSourceDest; + ip: string; + pagination: PaginationInputPaginated; + sort: TlsSortField; + timerange: TimerangeInput; + defaultIndex: string[]; + inspect: boolean; + }; + + export type Query = { + __typename?: 'Query'; + + source: Source; + }; + + export type Source = { + __typename?: 'Source'; + + id: string; + + Tls: Tls; + }; + + export type Tls = { + __typename?: 'TlsData'; + + totalCount: number; + + edges: Edges[]; + + pageInfo: PageInfo; + + inspect: Maybe; + }; + + export type Edges = { + __typename?: 'TlsEdges'; + + node: Node; + + cursor: Cursor; + }; + + export type Node = { + __typename?: 'TlsNode'; + + _id: Maybe; + + alternativeNames: Maybe; + + commonNames: Maybe; + + ja3: Maybe; + + issuerNames: Maybe; + + notAfter: Maybe; + }; + + export type Cursor = { + __typename?: 'CursorType'; + + value: Maybe; + }; + + export type PageInfo = { + __typename?: 'PageInfoPaginated'; + + activePage: number; + + fakeTotalCount: number; + + showMorePagesIndicator: boolean; + }; + + export type Inspect = { + __typename?: 'Inspect'; + + dsl: string[]; + + response: string[]; + }; +} + +export namespace GetUncommonProcessesQuery { + export type Variables = { + sourceId: string; + timerange: TimerangeInput; + pagination: PaginationInputPaginated; + filterQuery?: Maybe; + defaultIndex: string[]; + inspect: boolean; + }; + + export type Query = { + __typename?: 'Query'; + + source: Source; + }; + + export type Source = { + __typename?: 'Source'; + + id: string; + + UncommonProcesses: UncommonProcesses; + }; + + export type UncommonProcesses = { + __typename?: 'UncommonProcessesData'; + + totalCount: number; + + edges: Edges[]; + + pageInfo: PageInfo; + + inspect: Maybe; + }; + + export type Edges = { + __typename?: 'UncommonProcessesEdges'; + + node: Node; + + cursor: Cursor; + }; + + export type Node = { + __typename?: 'UncommonProcessItem'; + + _id: string; + + instances: number; + + process: Process; + + user: Maybe; + + hosts: Hosts[]; + }; + + export type Process = { + __typename?: 'ProcessEcsFields'; + + args: Maybe; + + name: Maybe; + }; + + export type User = { + __typename?: 'UserEcsFields'; + + id: Maybe; + + name: Maybe; + }; + + export type Hosts = { + __typename?: 'HostEcsFields'; + + name: Maybe; + }; + + export type Cursor = { + __typename?: 'CursorType'; + + value: Maybe; + }; + + export type PageInfo = { + __typename?: 'PageInfoPaginated'; + + activePage: number; + + fakeTotalCount: number; + + showMorePagesIndicator: boolean; + }; + + export type Inspect = { + __typename?: 'Inspect'; + + dsl: string[]; + + response: string[]; + }; +} + +export namespace GetUsersQuery { + export type Variables = { + sourceId: string; + filterQuery?: Maybe; + flowTarget: FlowTarget; + ip: string; + pagination: PaginationInputPaginated; + sort: UsersSortField; + timerange: TimerangeInput; + defaultIndex: string[]; + inspect: boolean; + }; + + export type Query = { + __typename?: 'Query'; + + source: Source; + }; + + export type Source = { + __typename?: 'Source'; + + id: string; + + Users: Users; + }; + + export type Users = { + __typename?: 'UsersData'; + + totalCount: number; + + edges: Edges[]; + + pageInfo: PageInfo; + + inspect: Maybe; + }; + + export type Edges = { + __typename?: 'UsersEdges'; + + node: Node; + + cursor: Cursor; + }; + + export type Node = { + __typename?: 'UsersNode'; + + user: Maybe; + }; + + export type User = { + __typename?: 'UsersItem'; + + name: Maybe; + + id: Maybe; + + groupId: Maybe; + + groupName: Maybe; + + count: Maybe; + }; + + export type Cursor = { + __typename?: 'CursorType'; + + value: Maybe; + }; + + export type PageInfo = { + __typename?: 'PageInfoPaginated'; + + activePage: number; + + fakeTotalCount: number; + + showMorePagesIndicator: boolean; + }; + + export type Inspect = { + __typename?: 'Inspect'; + + dsl: string[]; + + response: string[]; + }; +} + +export namespace KpiHostDetailsChartFields { + export type Fragment = { + __typename?: 'KpiHostHistogramData'; + + x: Maybe; + + y: Maybe; + }; +} + +export namespace KpiHostChartFields { + export type Fragment = { + __typename?: 'KpiHostHistogramData'; + + x: Maybe; + + y: Maybe; + }; +} + +export namespace KpiNetworkChartFields { + export type Fragment = { + __typename?: 'KpiNetworkHistogramData'; + + x: Maybe; + + y: Maybe; + }; +} diff --git a/x-pack/legacy/plugins/siem/public/graphql/types.tsx b/x-pack/legacy/plugins/siem/public/graphql/types.tsx deleted file mode 100644 index 6bf0e89ff5b8d..0000000000000 --- a/x-pack/legacy/plugins/siem/public/graphql/types.tsx +++ /dev/null @@ -1,5314 +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; - * you may not use this file except in compliance with the Elastic License. - */ - -/* tslint:disable */ -/* eslint-disable */ - -import gql from 'graphql-tag'; -import * as React from 'react'; -import * as ApolloReactCommon from '@apollo/client'; -import * as ApolloReactComponents from '@apollo/react-components'; -import * as ApolloReactHooks from '@apollo/client'; -export type Maybe = T | null; -export type Omit = Pick>; - -/** All built-in and custom scalars, mapped to their actual values */ -export type Scalars = { - ID: string, - String: string, - Boolean: boolean, - Int: number, - Float: number, - ToStringArray: string[], - Date: string, - ToNumberArray: number[], - ToDateArray: string[], - ToBooleanArray: boolean[], - ToAny: any, - EsValue: any, -}; - -export type AuditdData = { - __typename?: 'AuditdData', - acct?: Maybe, - terminal?: Maybe, - op?: Maybe, -}; - -export type AuditdEcsFields = { - __typename?: 'AuditdEcsFields', - result?: Maybe, - session?: Maybe, - data?: Maybe, - summary?: Maybe, - sequence?: Maybe, -}; - -export type AuditEcsFields = { - __typename?: 'AuditEcsFields', - package?: Maybe, -}; - -export type AuthEcsFields = { - __typename?: 'AuthEcsFields', - ssh?: Maybe, -}; - -export type AuthenticationItem = { - __typename?: 'AuthenticationItem', - _id: Scalars['String'], - failures: Scalars['Float'], - successes: Scalars['Float'], - user: UserEcsFields, - lastSuccess?: Maybe, - lastFailure?: Maybe, -}; - -export type AuthenticationsData = { - __typename?: 'AuthenticationsData', - edges: Array, - totalCount: Scalars['Float'], - pageInfo: PageInfoPaginated, - inspect?: Maybe, -}; - -export type AuthenticationsEdges = { - __typename?: 'AuthenticationsEdges', - node: AuthenticationItem, - cursor: CursorType, -}; - -export type AutonomousSystem = { - __typename?: 'AutonomousSystem', - number?: Maybe, - organization?: Maybe, -}; - -export type AutonomousSystemItem = { - __typename?: 'AutonomousSystemItem', - name?: Maybe, - number?: Maybe, -}; - -export type AutonomousSystemOrganization = { - __typename?: 'AutonomousSystemOrganization', - name?: Maybe, -}; - -export type CloudFields = { - __typename?: 'CloudFields', - instance?: Maybe, - machine?: Maybe, - provider?: Maybe>>, - region?: Maybe>>, -}; - -export type CloudInstance = { - __typename?: 'CloudInstance', - id?: Maybe>>, -}; - -export type CloudMachine = { - __typename?: 'CloudMachine', - type?: Maybe>>, -}; - -export type ColumnHeaderInput = { - aggregatable?: Maybe, - category?: Maybe, - columnHeaderType?: Maybe, - description?: Maybe, - example?: Maybe, - indexes?: Maybe>, - id?: Maybe, - name?: Maybe, - placeholder?: Maybe, - searchable?: Maybe, - type?: Maybe, -}; - -export type ColumnHeaderResult = { - __typename?: 'ColumnHeaderResult', - aggregatable?: Maybe, - category?: Maybe, - columnHeaderType?: Maybe, - description?: Maybe, - example?: Maybe, - indexes?: Maybe>, - id?: Maybe, - name?: Maybe, - placeholder?: Maybe, - searchable?: Maybe, - type?: Maybe, -}; - -export type CursorType = { - __typename?: 'CursorType', - value?: Maybe, - tiebreaker?: Maybe, -}; - -export type DataProviderInput = { - id?: Maybe, - name?: Maybe, - enabled?: Maybe, - excluded?: Maybe, - kqlQuery?: Maybe, - queryMatch?: Maybe, - and?: Maybe>, -}; - -export type DataProviderResult = { - __typename?: 'DataProviderResult', - id?: Maybe, - name?: Maybe, - enabled?: Maybe, - excluded?: Maybe, - kqlQuery?: Maybe, - queryMatch?: Maybe, - and?: Maybe>, -}; - - -export type DateRangePickerInput = { - start?: Maybe, - end?: Maybe, -}; - -export type DateRangePickerResult = { - __typename?: 'DateRangePickerResult', - start?: Maybe, - end?: Maybe, -}; - -export type DestinationEcsFields = { - __typename?: 'DestinationEcsFields', - bytes?: Maybe, - ip?: Maybe, - port?: Maybe, - domain?: Maybe, - geo?: Maybe, - packets?: Maybe, -}; - -export type DetailItem = { - __typename?: 'DetailItem', - field: Scalars['String'], - values?: Maybe, - originalValue?: Maybe, -}; - -export enum Direction { - asc = 'asc', - desc = 'desc' -} - -export type DnsEcsFields = { - __typename?: 'DnsEcsFields', - question?: Maybe, - resolved_ip?: Maybe, - response_code?: Maybe, -}; - -export type DnsQuestionData = { - __typename?: 'DnsQuestionData', - name?: Maybe, - type?: Maybe, -}; - -export type Ecs = { - __typename?: 'ECS', - _id: Scalars['String'], - _index?: Maybe, - auditd?: Maybe, - destination?: Maybe, - dns?: Maybe, - endgame?: Maybe, - event?: Maybe, - geo?: Maybe, - host?: Maybe, - network?: Maybe, - rule?: Maybe, - signal?: Maybe, - source?: Maybe, - suricata?: Maybe, - tls?: Maybe, - zeek?: Maybe, - http?: Maybe, - url?: Maybe, - timestamp?: Maybe, - message?: Maybe, - user?: Maybe, - winlog?: Maybe, - process?: Maybe, - file?: Maybe, - system?: Maybe, -}; - -export type EcsEdges = { - __typename?: 'EcsEdges', - node: Ecs, - cursor: CursorType, -}; - -export type EndgameEcsFields = { - __typename?: 'EndgameEcsFields', - exit_code?: Maybe, - file_name?: Maybe, - file_path?: Maybe, - logon_type?: Maybe, - parent_process_name?: Maybe, - pid?: Maybe, - process_name?: Maybe, - subject_domain_name?: Maybe, - subject_logon_id?: Maybe, - subject_user_name?: Maybe, - target_domain_name?: Maybe, - target_logon_id?: Maybe, - target_user_name?: Maybe, -}; - - -export type EventEcsFields = { - __typename?: 'EventEcsFields', - action?: Maybe, - category?: Maybe, - code?: Maybe, - created?: Maybe, - dataset?: Maybe, - duration?: Maybe, - end?: Maybe, - hash?: Maybe, - id?: Maybe, - kind?: Maybe, - module?: Maybe, - original?: Maybe, - outcome?: Maybe, - risk_score?: Maybe, - risk_score_norm?: Maybe, - severity?: Maybe, - start?: Maybe, - timezone?: Maybe, - type?: Maybe, -}; - -export type EventsTimelineData = { - __typename?: 'EventsTimelineData', - edges: Array, - totalCount: Scalars['Float'], - pageInfo: PageInfo, - inspect?: Maybe, -}; - -export type FavoriteTimelineInput = { - fullName?: Maybe, - userName?: Maybe, - favoriteDate?: Maybe, -}; - -export type FavoriteTimelineResult = { - __typename?: 'FavoriteTimelineResult', - fullName?: Maybe, - userName?: Maybe, - favoriteDate?: Maybe, -}; - -export type FileFields = { - __typename?: 'FileFields', - name?: Maybe, - path?: Maybe, - target_path?: Maybe, - extension?: Maybe, - type?: Maybe, - device?: Maybe, - inode?: Maybe, - uid?: Maybe, - owner?: Maybe, - gid?: Maybe, - group?: Maybe, - mode?: Maybe, - size?: Maybe, - mtime?: Maybe, - ctime?: Maybe, -}; - -export type FilterMetaTimelineInput = { - alias?: Maybe, - controlledBy?: Maybe, - disabled?: Maybe, - field?: Maybe, - formattedValue?: Maybe, - index?: Maybe, - key?: Maybe, - negate?: Maybe, - params?: Maybe, - type?: Maybe, - value?: Maybe, -}; - -export type FilterMetaTimelineResult = { - __typename?: 'FilterMetaTimelineResult', - alias?: Maybe, - controlledBy?: Maybe, - disabled?: Maybe, - field?: Maybe, - formattedValue?: Maybe, - index?: Maybe, - key?: Maybe, - negate?: Maybe, - params?: Maybe, - type?: Maybe, - value?: Maybe, -}; - -export type FilterTimelineInput = { - exists?: Maybe, - meta?: Maybe, - match_all?: Maybe, - missing?: Maybe, - query?: Maybe, - range?: Maybe, - script?: Maybe, -}; - -export type FilterTimelineResult = { - __typename?: 'FilterTimelineResult', - exists?: Maybe, - meta?: Maybe, - match_all?: Maybe, - missing?: Maybe, - query?: Maybe, - range?: Maybe, - script?: Maybe, -}; - -export type FingerprintData = { - __typename?: 'FingerprintData', - sha1?: Maybe, -}; - -export type FirstLastSeenHost = { - __typename?: 'FirstLastSeenHost', - inspect?: Maybe, - firstSeen?: Maybe, - lastSeen?: Maybe, -}; - -export enum FlowDirection { - uniDirectional = 'uniDirectional', - biDirectional = 'biDirectional' -} - -export enum FlowTarget { - client = 'client', - destination = 'destination', - server = 'server', - source = 'source' -} - -export enum FlowTargetSourceDest { - destination = 'destination', - source = 'source' -} - -export type GeoEcsFields = { - __typename?: 'GeoEcsFields', - city_name?: Maybe, - continent_name?: Maybe, - country_iso_code?: Maybe, - country_name?: Maybe, - location?: Maybe, - region_iso_code?: Maybe, - region_name?: Maybe, -}; - -export type GeoItem = { - __typename?: 'GeoItem', - geo?: Maybe, - flowTarget?: Maybe, -}; - -export enum HistogramType { - authentications = 'authentications', - anomalies = 'anomalies', - events = 'events', - alerts = 'alerts', - dns = 'dns' -} - -export type HostEcsFields = { - __typename?: 'HostEcsFields', - architecture?: Maybe, - id?: Maybe, - ip?: Maybe, - mac?: Maybe, - name?: Maybe, - os?: Maybe, - type?: Maybe, -}; - -export type HostFields = { - __typename?: 'HostFields', - architecture?: Maybe, - id?: Maybe, - ip?: Maybe>>, - mac?: Maybe>>, - name?: Maybe, - os?: Maybe, - type?: Maybe, -}; - -export type HostItem = { - __typename?: 'HostItem', - _id?: Maybe, - lastSeen?: Maybe, - host?: Maybe, - cloud?: Maybe, - inspect?: Maybe, -}; - -export type HostsData = { - __typename?: 'HostsData', - edges: Array, - totalCount: Scalars['Float'], - pageInfo: PageInfoPaginated, - inspect?: Maybe, -}; - -export type HostsEdges = { - __typename?: 'HostsEdges', - node: HostItem, - cursor: CursorType, -}; - -export enum HostsFields { - hostName = 'hostName', - lastSeen = 'lastSeen' -} - -export type HostsSortField = { - field: HostsFields, - direction: Direction, -}; - -export type HttpBodyData = { - __typename?: 'HttpBodyData', - content?: Maybe, - bytes?: Maybe, -}; - -export type HttpEcsFields = { - __typename?: 'HttpEcsFields', - version?: Maybe, - request?: Maybe, - response?: Maybe, -}; - -export type HttpRequestData = { - __typename?: 'HttpRequestData', - method?: Maybe, - body?: Maybe, - referrer?: Maybe, - bytes?: Maybe, -}; - -export type HttpResponseData = { - __typename?: 'HttpResponseData', - status_code?: Maybe, - body?: Maybe, - bytes?: Maybe, -}; - -/** A descriptor of a field in an index */ -export type IndexField = { - __typename?: 'IndexField', - /** Where the field belong */ - category: Scalars['String'], - /** Example of field's value */ - example?: Maybe, - /** whether the field's belong to an alias index */ - indexes: Array>, - /** The name of the field */ - name: Scalars['String'], - /** The type of the field's values as recognized by Kibana */ - type: Scalars['String'], - /** Whether the field's values can be efficiently searched for */ - searchable: Scalars['Boolean'], - /** Whether the field's values can be aggregated */ - aggregatable: Scalars['Boolean'], - /** Description of the field */ - description?: Maybe, - format?: Maybe, -}; - -export type Inspect = { - __typename?: 'Inspect', - dsl: Array, - response: Array, -}; - -export type IpOverviewData = { - __typename?: 'IpOverviewData', - client?: Maybe, - destination?: Maybe, - host: HostEcsFields, - server?: Maybe, - source?: Maybe, - inspect?: Maybe, -}; - -export type KpiHostDetailsData = { - __typename?: 'KpiHostDetailsData', - authSuccess?: Maybe, - authSuccessHistogram?: Maybe>, - authFailure?: Maybe, - authFailureHistogram?: Maybe>, - uniqueSourceIps?: Maybe, - uniqueSourceIpsHistogram?: Maybe>, - uniqueDestinationIps?: Maybe, - uniqueDestinationIpsHistogram?: Maybe>, - inspect?: Maybe, -}; - -export type KpiHostHistogramData = { - __typename?: 'KpiHostHistogramData', - x?: Maybe, - y?: Maybe, -}; - -export type KpiHostsData = { - __typename?: 'KpiHostsData', - hosts?: Maybe, - hostsHistogram?: Maybe>, - authSuccess?: Maybe, - authSuccessHistogram?: Maybe>, - authFailure?: Maybe, - authFailureHistogram?: Maybe>, - uniqueSourceIps?: Maybe, - uniqueSourceIpsHistogram?: Maybe>, - uniqueDestinationIps?: Maybe, - uniqueDestinationIpsHistogram?: Maybe>, - inspect?: Maybe, -}; - -export type KpiNetworkData = { - __typename?: 'KpiNetworkData', - networkEvents?: Maybe, - uniqueFlowId?: Maybe, - uniqueSourcePrivateIps?: Maybe, - uniqueSourcePrivateIpsHistogram?: Maybe>, - uniqueDestinationPrivateIps?: Maybe, - uniqueDestinationPrivateIpsHistogram?: Maybe>, - dnsQueries?: Maybe, - tlsHandshakes?: Maybe, - inspect?: Maybe, -}; - -export type KpiNetworkHistogramData = { - __typename?: 'KpiNetworkHistogramData', - x?: Maybe, - y?: Maybe, -}; - -export type KueryFilterQueryInput = { - kind?: Maybe, - expression?: Maybe, -}; - -export type KueryFilterQueryResult = { - __typename?: 'KueryFilterQueryResult', - kind?: Maybe, - expression?: Maybe, -}; - -export enum LastEventIndexKey { - hostDetails = 'hostDetails', - hosts = 'hosts', - ipDetails = 'ipDetails', - network = 'network' -} - -export type LastEventTimeData = { - __typename?: 'LastEventTimeData', - lastSeen?: Maybe, - inspect?: Maybe, -}; - -export type LastSourceHost = { - __typename?: 'LastSourceHost', - timestamp?: Maybe, - source?: Maybe, - host?: Maybe, -}; - -export type LastTimeDetails = { - hostName?: Maybe, - ip?: Maybe, -}; - -export type Location = { - __typename?: 'Location', - lon?: Maybe, - lat?: Maybe, -}; - -export type MatrixHistogramOverTimeData = { - __typename?: 'MatrixHistogramOverTimeData', - inspect?: Maybe, - matrixHistogramData: Array, - totalCount: Scalars['Float'], -}; - -export type MatrixOverOrdinalHistogramData = { - __typename?: 'MatrixOverOrdinalHistogramData', - x: Scalars['String'], - y: Scalars['Float'], - g: Scalars['String'], -}; - -export type MatrixOverTimeHistogramData = { - __typename?: 'MatrixOverTimeHistogramData', - x?: Maybe, - y?: Maybe, - g?: Maybe, -}; - -export type Mutation = { - __typename?: 'Mutation', - /** Persists a note */ - persistNote: ResponseNote, - deleteNote?: Maybe, - deleteNoteByTimelineId?: Maybe, - /** Persists a pinned event in a timeline */ - persistPinnedEventOnTimeline?: Maybe, - /** Remove a pinned events in a timeline */ - deletePinnedEventOnTimeline: Scalars['Boolean'], - /** Remove all pinned events in a timeline */ - deleteAllPinnedEventsOnTimeline: Scalars['Boolean'], - /** Persists a timeline */ - persistTimeline: ResponseTimeline, - persistFavorite: ResponseFavoriteTimeline, - deleteTimeline: Scalars['Boolean'], -}; - - -export type MutationPersistNoteArgs = { - noteId?: Maybe, - version?: Maybe, - note: NoteInput -}; - - -export type MutationDeleteNoteArgs = { - id: Array -}; - - -export type MutationDeleteNoteByTimelineIdArgs = { - timelineId: Scalars['ID'], - version?: Maybe -}; - - -export type MutationPersistPinnedEventOnTimelineArgs = { - pinnedEventId?: Maybe, - eventId: Scalars['ID'], - timelineId?: Maybe -}; - - -export type MutationDeletePinnedEventOnTimelineArgs = { - id: Array -}; - - -export type MutationDeleteAllPinnedEventsOnTimelineArgs = { - timelineId: Scalars['ID'] -}; - - -export type MutationPersistTimelineArgs = { - id?: Maybe, - version?: Maybe, - timeline: TimelineInput -}; - - -export type MutationPersistFavoriteArgs = { - timelineId?: Maybe -}; - - -export type MutationDeleteTimelineArgs = { - id: Array -}; - -export enum NetworkDirectionEcs { - inbound = 'inbound', - outbound = 'outbound', - internal = 'internal', - external = 'external', - incoming = 'incoming', - outgoing = 'outgoing', - listening = 'listening', - unknown = 'unknown' -} - -export type NetworkDnsData = { - __typename?: 'NetworkDnsData', - edges: Array, - totalCount: Scalars['Float'], - pageInfo: PageInfoPaginated, - inspect?: Maybe, - histogram?: Maybe>, -}; - -export type NetworkDnsEdges = { - __typename?: 'NetworkDnsEdges', - node: NetworkDnsItem, - cursor: CursorType, -}; - -export enum NetworkDnsFields { - dnsName = 'dnsName', - queryCount = 'queryCount', - uniqueDomains = 'uniqueDomains', - dnsBytesIn = 'dnsBytesIn', - dnsBytesOut = 'dnsBytesOut' -} - -export type NetworkDnsItem = { - __typename?: 'NetworkDnsItem', - _id?: Maybe, - dnsBytesIn?: Maybe, - dnsBytesOut?: Maybe, - dnsName?: Maybe, - queryCount?: Maybe, - uniqueDomains?: Maybe, -}; - -export type NetworkDnsSortField = { - field: NetworkDnsFields, - direction: Direction, -}; - -export type NetworkDsOverTimeData = { - __typename?: 'NetworkDsOverTimeData', - inspect?: Maybe, - matrixHistogramData: Array, - totalCount: Scalars['Float'], -}; - -export type NetworkEcsField = { - __typename?: 'NetworkEcsField', - bytes?: Maybe, - community_id?: Maybe, - direction?: Maybe, - packets?: Maybe, - protocol?: Maybe, - transport?: Maybe, -}; - -export type NetworkHttpData = { - __typename?: 'NetworkHttpData', - edges: Array, - totalCount: Scalars['Float'], - pageInfo: PageInfoPaginated, - inspect?: Maybe, -}; - -export type NetworkHttpEdges = { - __typename?: 'NetworkHttpEdges', - node: NetworkHttpItem, - cursor: CursorType, -}; - -export enum NetworkHttpFields { - domains = 'domains', - lastHost = 'lastHost', - lastSourceIp = 'lastSourceIp', - methods = 'methods', - path = 'path', - requestCount = 'requestCount', - statuses = 'statuses' -} - -export type NetworkHttpItem = { - __typename?: 'NetworkHttpItem', - _id?: Maybe, - domains: Array, - lastHost?: Maybe, - lastSourceIp?: Maybe, - methods: Array, - path?: Maybe, - requestCount?: Maybe, - statuses: Array, -}; - -export type NetworkHttpSortField = { - direction: Direction, -}; - -export type NetworkTopCountriesData = { - __typename?: 'NetworkTopCountriesData', - edges: Array, - totalCount: Scalars['Float'], - pageInfo: PageInfoPaginated, - inspect?: Maybe, -}; - -export type NetworkTopCountriesEdges = { - __typename?: 'NetworkTopCountriesEdges', - node: NetworkTopCountriesItem, - cursor: CursorType, -}; - -export type NetworkTopCountriesItem = { - __typename?: 'NetworkTopCountriesItem', - _id?: Maybe, - source?: Maybe, - destination?: Maybe, - network?: Maybe, -}; - -export type NetworkTopNFlowData = { - __typename?: 'NetworkTopNFlowData', - edges: Array, - totalCount: Scalars['Float'], - pageInfo: PageInfoPaginated, - inspect?: Maybe, -}; - -export type NetworkTopNFlowEdges = { - __typename?: 'NetworkTopNFlowEdges', - node: NetworkTopNFlowItem, - cursor: CursorType, -}; - -export type NetworkTopNFlowItem = { - __typename?: 'NetworkTopNFlowItem', - _id?: Maybe, - source?: Maybe, - destination?: Maybe, - network?: Maybe, -}; - -export enum NetworkTopTablesFields { - bytes_in = 'bytes_in', - bytes_out = 'bytes_out', - flows = 'flows', - destination_ips = 'destination_ips', - source_ips = 'source_ips' -} - -export type NetworkTopTablesSortField = { - field: NetworkTopTablesFields, - direction: Direction, -}; - -export type NoteInput = { - eventId?: Maybe, - note?: Maybe, - timelineId?: Maybe, -}; - -export type NoteResult = { - __typename?: 'NoteResult', - eventId?: Maybe, - note?: Maybe, - timelineId?: Maybe, - noteId: Scalars['String'], - created?: Maybe, - createdBy?: Maybe, - timelineVersion?: Maybe, - updated?: Maybe, - updatedBy?: Maybe, - version?: Maybe, -}; - -export type OsEcsFields = { - __typename?: 'OsEcsFields', - platform?: Maybe, - name?: Maybe, - full?: Maybe, - family?: Maybe, - version?: Maybe, - kernel?: Maybe, -}; - -export type OsFields = { - __typename?: 'OsFields', - platform?: Maybe, - name?: Maybe, - full?: Maybe, - family?: Maybe, - version?: Maybe, - kernel?: Maybe, -}; - -export type Overview = { - __typename?: 'Overview', - firstSeen?: Maybe, - lastSeen?: Maybe, - autonomousSystem: AutonomousSystem, - geo: GeoEcsFields, -}; - -export type OverviewHostData = { - __typename?: 'OverviewHostData', - auditbeatAuditd?: Maybe, - auditbeatFIM?: Maybe, - auditbeatLogin?: Maybe, - auditbeatPackage?: Maybe, - auditbeatProcess?: Maybe, - auditbeatUser?: Maybe, - endgameDns?: Maybe, - endgameFile?: Maybe, - endgameImageLoad?: Maybe, - endgameNetwork?: Maybe, - endgameProcess?: Maybe, - endgameRegistry?: Maybe, - endgameSecurity?: Maybe, - filebeatSystemModule?: Maybe, - winlogbeatSecurity?: Maybe, - winlogbeatMWSysmonOperational?: Maybe, - inspect?: Maybe, -}; - -export type OverviewNetworkData = { - __typename?: 'OverviewNetworkData', - auditbeatSocket?: Maybe, - filebeatCisco?: Maybe, - filebeatNetflow?: Maybe, - filebeatPanw?: Maybe, - filebeatSuricata?: Maybe, - filebeatZeek?: Maybe, - packetbeatDNS?: Maybe, - packetbeatFlow?: Maybe, - packetbeatTLS?: Maybe, - inspect?: Maybe, -}; - -export type PackageEcsFields = { - __typename?: 'PackageEcsFields', - arch?: Maybe, - entity_id?: Maybe, - name?: Maybe, - size?: Maybe, - summary?: Maybe, - version?: Maybe, -}; - -export type PageInfo = { - __typename?: 'PageInfo', - endCursor?: Maybe, - hasNextPage?: Maybe, -}; - -export type PageInfoNote = { - pageIndex: Scalars['Float'], - pageSize: Scalars['Float'], -}; - -export type PageInfoPaginated = { - __typename?: 'PageInfoPaginated', - activePage: Scalars['Float'], - fakeTotalCount: Scalars['Float'], - showMorePagesIndicator: Scalars['Boolean'], -}; - -export type PageInfoTimeline = { - pageIndex: Scalars['Float'], - pageSize: Scalars['Float'], -}; - -export type PaginationInput = { - /** The limit parameter allows you to configure the maximum amount of items to be returned */ - limit: Scalars['Float'], - /** The cursor parameter defines the next result you want to fetch */ - cursor?: Maybe, - /** The tiebreaker parameter allow to be more precise to fetch the next item */ - tiebreaker?: Maybe, -}; - -export type PaginationInputPaginated = { - /** The activePage parameter defines the page of results you want to fetch */ - activePage: Scalars['Float'], - /** The cursorStart parameter defines the start of the results to be displayed */ - cursorStart: Scalars['Float'], - /** The fakePossibleCount parameter determines the total count in order to show 5 additional pages */ - fakePossibleCount: Scalars['Float'], - /** The querySize parameter is the number of items to be returned */ - querySize: Scalars['Float'], -}; - -export type PinnedEvent = { - __typename?: 'PinnedEvent', - code?: Maybe, - message?: Maybe, - pinnedEventId: Scalars['ID'], - eventId?: Maybe, - timelineId?: Maybe, - timelineVersion?: Maybe, - created?: Maybe, - createdBy?: Maybe, - updated?: Maybe, - updatedBy?: Maybe, - version?: Maybe, -}; - -export type PrimarySecondary = { - __typename?: 'PrimarySecondary', - primary?: Maybe, - secondary?: Maybe, - type?: Maybe, -}; - -export type ProcessEcsFields = { - __typename?: 'ProcessEcsFields', - hash?: Maybe, - pid?: Maybe, - name?: Maybe, - ppid?: Maybe, - args?: Maybe, - executable?: Maybe, - title?: Maybe, - thread?: Maybe, - working_directory?: Maybe, -}; - -export type ProcessHashData = { - __typename?: 'ProcessHashData', - md5?: Maybe, - sha1?: Maybe, - sha256?: Maybe, -}; - -export type Query = { - __typename?: 'Query', - getNote: NoteResult, - getNotesByTimelineId: Array, - getNotesByEventId: Array, - getAllNotes: ResponseNotes, - getAllPinnedEventsByTimelineId: Array, - /** Get a security data source by id */ - source: Source, - /** Get a list of all security data sources */ - allSources: Array, - getOneTimeline: TimelineResult, - getAllTimeline: ResponseTimelines, -}; - - -export type QueryGetNoteArgs = { - id: Scalars['ID'] -}; - - -export type QueryGetNotesByTimelineIdArgs = { - timelineId: Scalars['ID'] -}; - - -export type QueryGetNotesByEventIdArgs = { - eventId: Scalars['ID'] -}; - - -export type QueryGetAllNotesArgs = { - pageInfo?: Maybe, - search?: Maybe, - sort?: Maybe -}; - - -export type QueryGetAllPinnedEventsByTimelineIdArgs = { - timelineId: Scalars['ID'] -}; - - -export type QuerySourceArgs = { - id: Scalars['ID'] -}; - - -export type QueryGetOneTimelineArgs = { - id: Scalars['ID'] -}; - - -export type QueryGetAllTimelineArgs = { - pageInfo?: Maybe, - search?: Maybe, - sort?: Maybe, - onlyUserFavorite?: Maybe -}; - -export type QueryMatchInput = { - field?: Maybe, - displayField?: Maybe, - value?: Maybe, - displayValue?: Maybe, - operator?: Maybe, -}; - -export type QueryMatchResult = { - __typename?: 'QueryMatchResult', - field?: Maybe, - displayField?: Maybe, - value?: Maybe, - displayValue?: Maybe, - operator?: Maybe, -}; - -export type ResponseFavoriteTimeline = { - __typename?: 'ResponseFavoriteTimeline', - code?: Maybe, - message?: Maybe, - savedObjectId: Scalars['String'], - version: Scalars['String'], - favorite?: Maybe>, -}; - -export type ResponseNote = { - __typename?: 'ResponseNote', - code?: Maybe, - message?: Maybe, - note: NoteResult, -}; - -export type ResponseNotes = { - __typename?: 'ResponseNotes', - notes: Array, - totalCount?: Maybe, -}; - -export type ResponseTimeline = { - __typename?: 'ResponseTimeline', - code?: Maybe, - message?: Maybe, - timeline: TimelineResult, -}; - -export type ResponseTimelines = { - __typename?: 'ResponseTimelines', - timeline: Array>, - totalCount?: Maybe, -}; - -export type RuleEcsField = { - __typename?: 'RuleEcsField', - reference?: Maybe, -}; - -export type RuleField = { - __typename?: 'RuleField', - id?: Maybe, - rule_id?: Maybe, - false_positives: Array, - saved_id?: Maybe, - timeline_id?: Maybe, - timeline_title?: Maybe, - max_signals?: Maybe, - risk_score?: Maybe, - output_index?: Maybe, - description?: Maybe, - from?: Maybe, - immutable?: Maybe, - index?: Maybe, - interval?: Maybe, - language?: Maybe, - query?: Maybe, - references?: Maybe, - severity?: Maybe, - tags?: Maybe, - threat?: Maybe, - type?: Maybe, - size?: Maybe, - to?: Maybe, - enabled?: Maybe, - filters?: Maybe, - created_at?: Maybe, - updated_at?: Maybe, - created_by?: Maybe, - updated_by?: Maybe, - version?: Maybe, -}; - -export type SayMyName = { - __typename?: 'SayMyName', - /** The id of the source */ - appName: Scalars['String'], -}; - -export type SerializedFilterQueryInput = { - filterQuery?: Maybe, -}; - -export type SerializedFilterQueryResult = { - __typename?: 'SerializedFilterQueryResult', - filterQuery?: Maybe, -}; - -export type SerializedKueryQueryInput = { - kuery?: Maybe, - serializedQuery?: Maybe, -}; - -export type SerializedKueryQueryResult = { - __typename?: 'SerializedKueryQueryResult', - kuery?: Maybe, - serializedQuery?: Maybe, -}; - -export type SignalField = { - __typename?: 'SignalField', - rule?: Maybe, - original_time?: Maybe, -}; - -export type SortField = { - sortFieldId: Scalars['String'], - direction: Direction, -}; - -export enum SortFieldNote { - updatedBy = 'updatedBy', - updated = 'updated' -} - -export enum SortFieldTimeline { - title = 'title', - description = 'description', - updated = 'updated', - created = 'created' -} - -export type SortNote = { - sortField: SortFieldNote, - sortOrder: Direction, -}; - -export type SortTimeline = { - sortField: SortFieldTimeline, - sortOrder: Direction, -}; - -export type SortTimelineInput = { - columnId?: Maybe, - sortDirection?: Maybe, -}; - -export type SortTimelineResult = { - __typename?: 'SortTimelineResult', - columnId?: Maybe, - sortDirection?: Maybe, -}; - -export type Source = { - __typename?: 'Source', - /** The id of the source */ - id: Scalars['ID'], - /** The raw configuration of the source */ - configuration: SourceConfiguration, - /** The status of the source */ - status: SourceStatus, - /** Gets Authentication success and failures based on a timerange */ - Authentications: AuthenticationsData, - Timeline: TimelineData, - TimelineDetails: TimelineDetailsData, - LastEventTime: LastEventTimeData, - /** Gets Hosts based on timerange and specified criteria, or all events in the timerange if no criteria is specified */ - Hosts: HostsData, - HostOverview: HostItem, - HostFirstLastSeen: FirstLastSeenHost, - IpOverview?: Maybe, - Users: UsersData, - KpiNetwork?: Maybe, - KpiHosts: KpiHostsData, - KpiHostDetails: KpiHostDetailsData, - MatrixHistogram: MatrixHistogramOverTimeData, - NetworkTopCountries: NetworkTopCountriesData, - NetworkTopNFlow: NetworkTopNFlowData, - NetworkDns: NetworkDnsData, - NetworkDnsHistogram: NetworkDsOverTimeData, - NetworkHttp: NetworkHttpData, - OverviewNetwork?: Maybe, - OverviewHost?: Maybe, - Tls: TlsData, - /** Gets UncommonProcesses based on a timerange, or all UncommonProcesses if no criteria is specified */ - UncommonProcesses: UncommonProcessesData, - /** Just a simple example to get the app name */ - whoAmI?: Maybe, -}; - - -export type SourceAuthenticationsArgs = { - timerange: TimerangeInput, - pagination: PaginationInputPaginated, - filterQuery?: Maybe, - defaultIndex: Array -}; - - -export type SourceTimelineArgs = { - pagination: PaginationInput, - sortField: SortField, - fieldRequested: Array, - timerange?: Maybe, - filterQuery?: Maybe, - defaultIndex: Array -}; - - -export type SourceTimelineDetailsArgs = { - eventId: Scalars['String'], - indexName: Scalars['String'], - defaultIndex: Array -}; - - -export type SourceLastEventTimeArgs = { - id?: Maybe, - indexKey: LastEventIndexKey, - details: LastTimeDetails, - defaultIndex: Array -}; - - -export type SourceHostsArgs = { - id?: Maybe, - timerange: TimerangeInput, - pagination: PaginationInputPaginated, - sort: HostsSortField, - filterQuery?: Maybe, - defaultIndex: Array -}; - - -export type SourceHostOverviewArgs = { - id?: Maybe, - hostName: Scalars['String'], - timerange: TimerangeInput, - defaultIndex: Array -}; - - -export type SourceHostFirstLastSeenArgs = { - id?: Maybe, - hostName: Scalars['String'], - defaultIndex: Array -}; - - -export type SourceIpOverviewArgs = { - id?: Maybe, - filterQuery?: Maybe, - ip: Scalars['String'], - defaultIndex: Array -}; - - -export type SourceUsersArgs = { - filterQuery?: Maybe, - id?: Maybe, - ip: Scalars['String'], - pagination: PaginationInputPaginated, - sort: UsersSortField, - flowTarget: FlowTarget, - timerange: TimerangeInput, - defaultIndex: Array -}; - - -export type SourceKpiNetworkArgs = { - id?: Maybe, - timerange: TimerangeInput, - filterQuery?: Maybe, - defaultIndex: Array -}; - - -export type SourceKpiHostsArgs = { - id?: Maybe, - timerange: TimerangeInput, - filterQuery?: Maybe, - defaultIndex: Array -}; - - -export type SourceKpiHostDetailsArgs = { - id?: Maybe, - timerange: TimerangeInput, - filterQuery?: Maybe, - defaultIndex: Array -}; - - -export type SourceMatrixHistogramArgs = { - filterQuery?: Maybe, - defaultIndex: Array, - timerange: TimerangeInput, - stackByField: Scalars['String'], - histogramType: HistogramType -}; - - -export type SourceNetworkTopCountriesArgs = { - id?: Maybe, - filterQuery?: Maybe, - ip?: Maybe, - flowTarget: FlowTargetSourceDest, - pagination: PaginationInputPaginated, - sort: NetworkTopTablesSortField, - timerange: TimerangeInput, - defaultIndex: Array -}; - - -export type SourceNetworkTopNFlowArgs = { - id?: Maybe, - filterQuery?: Maybe, - ip?: Maybe, - flowTarget: FlowTargetSourceDest, - pagination: PaginationInputPaginated, - sort: NetworkTopTablesSortField, - timerange: TimerangeInput, - defaultIndex: Array -}; - - -export type SourceNetworkDnsArgs = { - filterQuery?: Maybe, - id?: Maybe, - isPtrIncluded: Scalars['Boolean'], - pagination: PaginationInputPaginated, - sort: NetworkDnsSortField, - stackByField?: Maybe, - timerange: TimerangeInput, - defaultIndex: Array -}; - - -export type SourceNetworkDnsHistogramArgs = { - filterQuery?: Maybe, - defaultIndex: Array, - timerange: TimerangeInput, - stackByField?: Maybe -}; - - -export type SourceNetworkHttpArgs = { - id?: Maybe, - filterQuery?: Maybe, - ip?: Maybe, - pagination: PaginationInputPaginated, - sort: NetworkHttpSortField, - timerange: TimerangeInput, - defaultIndex: Array -}; - - -export type SourceOverviewNetworkArgs = { - id?: Maybe, - timerange: TimerangeInput, - filterQuery?: Maybe, - defaultIndex: Array -}; - - -export type SourceOverviewHostArgs = { - id?: Maybe, - timerange: TimerangeInput, - filterQuery?: Maybe, - defaultIndex: Array -}; - - -export type SourceTlsArgs = { - filterQuery?: Maybe, - id?: Maybe, - ip: Scalars['String'], - pagination: PaginationInputPaginated, - sort: TlsSortField, - flowTarget: FlowTargetSourceDest, - timerange: TimerangeInput, - defaultIndex: Array -}; - - -export type SourceUncommonProcessesArgs = { - timerange: TimerangeInput, - pagination: PaginationInputPaginated, - filterQuery?: Maybe, - defaultIndex: Array -}; - -/** A set of configuration options for a security data source */ -export type SourceConfiguration = { - __typename?: 'SourceConfiguration', - /** The field mapping to use for this source */ - fields: SourceFields, -}; - -export type SourceEcsFields = { - __typename?: 'SourceEcsFields', - bytes?: Maybe, - ip?: Maybe, - port?: Maybe, - domain?: Maybe, - geo?: Maybe, - packets?: Maybe, -}; - -/** A mapping of semantic fields to their document counterparts */ -export type SourceFields = { - __typename?: 'SourceFields', - /** The field to identify a container by */ - container: Scalars['String'], - /** The fields to identify a host by */ - host: Scalars['String'], - /** The fields that may contain the log event message. The first field found win. */ - message: Array, - /** The field to identify a pod by */ - pod: Scalars['String'], - /** The field to use as a tiebreaker for log events that have identical timestamps */ - tiebreaker: Scalars['String'], - /** The field to use as a timestamp for metrics and logs */ - timestamp: Scalars['String'], -}; - -/** The status of an infrastructure data source */ -export type SourceStatus = { - __typename?: 'SourceStatus', - /** Whether the configured alias or wildcard pattern resolve to any auditbeat indices */ - indicesExist: Scalars['Boolean'], - /** The list of fields defined in the index mappings */ - indexFields: Array, -}; - - -/** The status of an infrastructure data source */ -export type SourceStatusIndicesExistArgs = { - defaultIndex: Array -}; - - -/** The status of an infrastructure data source */ -export type SourceStatusIndexFieldsArgs = { - defaultIndex: Array -}; - -export type SshEcsFields = { - __typename?: 'SshEcsFields', - method?: Maybe, - signature?: Maybe, -}; - -export type Summary = { - __typename?: 'Summary', - actor?: Maybe, - object?: Maybe, - how?: Maybe, - message_type?: Maybe, - sequence?: Maybe, -}; - -export type SuricataAlertData = { - __typename?: 'SuricataAlertData', - signature?: Maybe, - signature_id?: Maybe, -}; - -export type SuricataEcsFields = { - __typename?: 'SuricataEcsFields', - eve?: Maybe, -}; - -export type SuricataEveData = { - __typename?: 'SuricataEveData', - alert?: Maybe, - flow_id?: Maybe, - proto?: Maybe, -}; - -export type SystemEcsField = { - __typename?: 'SystemEcsField', - audit?: Maybe, - auth?: Maybe, -}; - -export type Thread = { - __typename?: 'Thread', - id?: Maybe, - start?: Maybe, -}; - -export type TimelineData = { - __typename?: 'TimelineData', - edges: Array, - totalCount: Scalars['Float'], - pageInfo: PageInfo, - inspect?: Maybe, -}; - -export type TimelineDetailsData = { - __typename?: 'TimelineDetailsData', - data?: Maybe>, - inspect?: Maybe, -}; - -export type TimelineEdges = { - __typename?: 'TimelineEdges', - node: TimelineItem, - cursor: CursorType, -}; - -export type TimelineInput = { - columns?: Maybe>, - dataProviders?: Maybe>, - description?: Maybe, - eventType?: Maybe, - filters?: Maybe>, - kqlMode?: Maybe, - kqlQuery?: Maybe, - title?: Maybe, - dateRange?: Maybe, - savedQueryId?: Maybe, - sort?: Maybe, -}; - -export type TimelineItem = { - __typename?: 'TimelineItem', - _id: Scalars['String'], - _index?: Maybe, - data: Array, - ecs: Ecs, -}; - -export type TimelineNonEcsData = { - __typename?: 'TimelineNonEcsData', - field: Scalars['String'], - value?: Maybe, -}; - -export type TimelineResult = { - __typename?: 'TimelineResult', - columns?: Maybe>, - created?: Maybe, - createdBy?: Maybe, - dataProviders?: Maybe>, - dateRange?: Maybe, - description?: Maybe, - eventIdToNoteIds?: Maybe>, - eventType?: Maybe, - favorite?: Maybe>, - filters?: Maybe>, - kqlMode?: Maybe, - kqlQuery?: Maybe, - notes?: Maybe>, - noteIds?: Maybe>, - pinnedEventIds?: Maybe>, - pinnedEventsSaveObject?: Maybe>, - savedQueryId?: Maybe, - savedObjectId: Scalars['String'], - sort?: Maybe, - title?: Maybe, - updated?: Maybe, - updatedBy?: Maybe, - version: Scalars['String'], -}; - -export type TimerangeInput = { - /** - * The interval string to use for last bucket. The format is '{value}{unit}'. For - * example '5m' would return the metrics for the last 5 minutes of the timespan. - */ - interval: Scalars['String'], - /** The end of the timerange */ - to: Scalars['Float'], - /** The beginning of the timerange */ - from: Scalars['Float'], -}; - -export type TlsClientCertificateData = { - __typename?: 'TlsClientCertificateData', - fingerprint?: Maybe, -}; - -export type TlsData = { - __typename?: 'TlsData', - edges: Array, - totalCount: Scalars['Float'], - pageInfo: PageInfoPaginated, - inspect?: Maybe, -}; - -export type TlsEcsFields = { - __typename?: 'TlsEcsFields', - client_certificate?: Maybe, - fingerprints?: Maybe, - server_certificate?: Maybe, -}; - -export type TlsEdges = { - __typename?: 'TlsEdges', - node: TlsNode, - cursor: CursorType, -}; - -export enum TlsFields { - _id = '_id' -} - -export type TlsFingerprintsData = { - __typename?: 'TlsFingerprintsData', - ja3?: Maybe, -}; - -export type TlsJa3Data = { - __typename?: 'TlsJa3Data', - hash?: Maybe, -}; - -export type TlsNode = { - __typename?: 'TlsNode', - _id?: Maybe, - timestamp?: Maybe, - alternativeNames?: Maybe>, - notAfter?: Maybe>, - commonNames?: Maybe>, - ja3?: Maybe>, - issuerNames?: Maybe>, -}; - -export type TlsServerCertificateData = { - __typename?: 'TlsServerCertificateData', - fingerprint?: Maybe, -}; - -export type TlsSortField = { - field: TlsFields, - direction: Direction, -}; - - - - - -export type TopCountriesItemDestination = { - __typename?: 'TopCountriesItemDestination', - country?: Maybe, - destination_ips?: Maybe, - flows?: Maybe, - location?: Maybe, - source_ips?: Maybe, -}; - -export type TopCountriesItemSource = { - __typename?: 'TopCountriesItemSource', - country?: Maybe, - destination_ips?: Maybe, - flows?: Maybe, - location?: Maybe, - source_ips?: Maybe, -}; - -export type TopNetworkTablesEcsField = { - __typename?: 'TopNetworkTablesEcsField', - bytes_in?: Maybe, - bytes_out?: Maybe, -}; - -export type TopNFlowItemDestination = { - __typename?: 'TopNFlowItemDestination', - autonomous_system?: Maybe, - domain?: Maybe>, - ip?: Maybe, - location?: Maybe, - flows?: Maybe, - source_ips?: Maybe, -}; - -export type TopNFlowItemSource = { - __typename?: 'TopNFlowItemSource', - autonomous_system?: Maybe, - domain?: Maybe>, - ip?: Maybe, - location?: Maybe, - flows?: Maybe, - destination_ips?: Maybe, -}; - - -export type UncommonProcessesData = { - __typename?: 'UncommonProcessesData', - edges: Array, - totalCount: Scalars['Float'], - pageInfo: PageInfoPaginated, - inspect?: Maybe, -}; - -export type UncommonProcessesEdges = { - __typename?: 'UncommonProcessesEdges', - node: UncommonProcessItem, - cursor: CursorType, -}; - -export type UncommonProcessItem = { - __typename?: 'UncommonProcessItem', - _id: Scalars['String'], - instances: Scalars['Float'], - process: ProcessEcsFields, - hosts: Array, - user?: Maybe, -}; - -export type UrlEcsFields = { - __typename?: 'UrlEcsFields', - domain?: Maybe, - original?: Maybe, - username?: Maybe, - password?: Maybe, -}; - -export type UserEcsFields = { - __typename?: 'UserEcsFields', - domain?: Maybe, - id?: Maybe, - name?: Maybe, - full_name?: Maybe, - email?: Maybe, - hash?: Maybe, - group?: Maybe, -}; - -export type UsersData = { - __typename?: 'UsersData', - edges: Array, - totalCount: Scalars['Float'], - pageInfo: PageInfoPaginated, - inspect?: Maybe, -}; - -export type UsersEdges = { - __typename?: 'UsersEdges', - node: UsersNode, - cursor: CursorType, -}; - -export enum UsersFields { - name = 'name', - count = 'count' -} - -export type UsersItem = { - __typename?: 'UsersItem', - name?: Maybe, - id?: Maybe, - groupId?: Maybe, - groupName?: Maybe, - count?: Maybe, -}; - -export type UsersNode = { - __typename?: 'UsersNode', - _id?: Maybe, - timestamp?: Maybe, - user?: Maybe, -}; - -export type UsersSortField = { - field: UsersFields, - direction: Direction, -}; - -export type WinlogEcsFields = { - __typename?: 'WinlogEcsFields', - event_id?: Maybe, -}; - -export type ZeekConnectionData = { - __typename?: 'ZeekConnectionData', - local_resp?: Maybe, - local_orig?: Maybe, - missed_bytes?: Maybe, - state?: Maybe, - history?: Maybe, -}; - -export type ZeekDnsData = { - __typename?: 'ZeekDnsData', - AA?: Maybe, - qclass_name?: Maybe, - RD?: Maybe, - qtype_name?: Maybe, - rejected?: Maybe, - qtype?: Maybe, - query?: Maybe, - trans_id?: Maybe, - qclass?: Maybe, - RA?: Maybe, - TC?: Maybe, -}; - -export type ZeekEcsFields = { - __typename?: 'ZeekEcsFields', - session_id?: Maybe, - connection?: Maybe, - notice?: Maybe, - dns?: Maybe, - http?: Maybe, - files?: Maybe, - ssl?: Maybe, -}; - -export type ZeekFileData = { - __typename?: 'ZeekFileData', - session_ids?: Maybe, - timedout?: Maybe, - local_orig?: Maybe, - tx_host?: Maybe, - source?: Maybe, - is_orig?: Maybe, - overflow_bytes?: Maybe, - sha1?: Maybe, - duration?: Maybe, - depth?: Maybe, - analyzers?: Maybe, - mime_type?: Maybe, - rx_host?: Maybe, - total_bytes?: Maybe, - fuid?: Maybe, - seen_bytes?: Maybe, - missing_bytes?: Maybe, - md5?: Maybe, -}; - -export type ZeekHttpData = { - __typename?: 'ZeekHttpData', - resp_mime_types?: Maybe, - trans_depth?: Maybe, - status_msg?: Maybe, - resp_fuids?: Maybe, - tags?: Maybe, -}; - -export type ZeekNoticeData = { - __typename?: 'ZeekNoticeData', - suppress_for?: Maybe, - msg?: Maybe, - note?: Maybe, - sub?: Maybe, - dst?: Maybe, - dropped?: Maybe, - peer_descr?: Maybe, -}; - -export type ZeekSslData = { - __typename?: 'ZeekSslData', - cipher?: Maybe, - established?: Maybe, - resumed?: Maybe, - version?: Maybe, -}; - -export type GetAuthenticationsQueryQueryVariables = { - sourceId: Scalars['ID'], - timerange: TimerangeInput, - pagination: PaginationInputPaginated, - filterQuery?: Maybe, - defaultIndex: Array, - inspect: Scalars['Boolean'] -}; - - -export type GetAuthenticationsQueryQuery = { __typename?: 'Query', source: { __typename?: 'Source', id: string, Authentications: { __typename?: 'AuthenticationsData', totalCount: number, edges: Array<{ __typename?: 'AuthenticationsEdges', node: { __typename?: 'AuthenticationItem', _id: string, failures: number, successes: number, user: { __typename?: 'UserEcsFields', name: Maybe }, lastSuccess: Maybe<{ __typename?: 'LastSourceHost', timestamp: Maybe, source: Maybe<{ __typename?: 'SourceEcsFields', ip: Maybe }>, host: Maybe<{ __typename?: 'HostEcsFields', id: Maybe, name: Maybe }> }>, lastFailure: Maybe<{ __typename?: 'LastSourceHost', timestamp: Maybe, source: Maybe<{ __typename?: 'SourceEcsFields', ip: Maybe }>, host: Maybe<{ __typename?: 'HostEcsFields', id: Maybe, name: Maybe }> }> }, cursor: { __typename?: 'CursorType', value: Maybe } }>, pageInfo: { __typename?: 'PageInfoPaginated', activePage: number, fakeTotalCount: number, showMorePagesIndicator: boolean }, inspect: Maybe<{ __typename?: 'Inspect', dsl: Array, response: Array }> } } }; - -export type GetLastEventTimeQueryQueryVariables = { - sourceId: Scalars['ID'], - indexKey: LastEventIndexKey, - details: LastTimeDetails, - defaultIndex: Array -}; - - -export type GetLastEventTimeQueryQuery = { __typename?: 'Query', source: { __typename?: 'Source', id: string, LastEventTime: { __typename?: 'LastEventTimeData', lastSeen: Maybe } } }; - -export type GetHostFirstLastSeenQueryQueryVariables = { - sourceId: Scalars['ID'], - hostName: Scalars['String'], - defaultIndex: Array -}; - - -export type GetHostFirstLastSeenQueryQuery = { __typename?: 'Query', source: { __typename?: 'Source', id: string, HostFirstLastSeen: { __typename?: 'FirstLastSeenHost', firstSeen: Maybe, lastSeen: Maybe } } }; - -export type GetHostsTableQueryQueryVariables = { - sourceId: Scalars['ID'], - timerange: TimerangeInput, - pagination: PaginationInputPaginated, - sort: HostsSortField, - filterQuery?: Maybe, - defaultIndex: Array, - inspect: Scalars['Boolean'] -}; - - -export type GetHostsTableQueryQuery = { __typename?: 'Query', source: { __typename?: 'Source', id: string, Hosts: { __typename?: 'HostsData', totalCount: number, edges: Array<{ __typename?: 'HostsEdges', node: { __typename?: 'HostItem', _id: Maybe, lastSeen: Maybe, host: Maybe<{ __typename?: 'HostEcsFields', id: Maybe, name: Maybe, os: Maybe<{ __typename?: 'OsEcsFields', name: Maybe, version: Maybe }> }> }, cursor: { __typename?: 'CursorType', value: Maybe } }>, pageInfo: { __typename?: 'PageInfoPaginated', activePage: number, fakeTotalCount: number, showMorePagesIndicator: boolean }, inspect: Maybe<{ __typename?: 'Inspect', dsl: Array, response: Array }> } } }; - -export type GetHostOverviewQueryQueryVariables = { - sourceId: Scalars['ID'], - hostName: Scalars['String'], - timerange: TimerangeInput, - defaultIndex: Array, - inspect: Scalars['Boolean'] -}; - - -export type GetHostOverviewQueryQuery = { __typename?: 'Query', source: { __typename?: 'Source', id: string, HostOverview: { __typename?: 'HostItem', _id: Maybe, host: Maybe<{ __typename?: 'HostEcsFields', architecture: Maybe, id: Maybe, ip: Maybe, mac: Maybe, name: Maybe, type: Maybe, os: Maybe<{ __typename?: 'OsEcsFields', family: Maybe, name: Maybe, platform: Maybe, version: Maybe }> }>, cloud: Maybe<{ __typename?: 'CloudFields', provider: Maybe>>, region: Maybe>>, instance: Maybe<{ __typename?: 'CloudInstance', id: Maybe>> }>, machine: Maybe<{ __typename?: 'CloudMachine', type: Maybe>> }> }>, inspect: Maybe<{ __typename?: 'Inspect', dsl: Array, response: Array }> } } }; - -export type GetIpOverviewQueryQueryVariables = { - sourceId: Scalars['ID'], - filterQuery?: Maybe, - ip: Scalars['String'], - defaultIndex: Array, - inspect: Scalars['Boolean'] -}; - - -export type GetIpOverviewQueryQuery = { __typename?: 'Query', source: { __typename?: 'Source', id: string, IpOverview: Maybe<{ __typename?: 'IpOverviewData', source: Maybe<{ __typename?: 'Overview', firstSeen: Maybe, lastSeen: Maybe, autonomousSystem: { __typename?: 'AutonomousSystem', number: Maybe, organization: Maybe<{ __typename?: 'AutonomousSystemOrganization', name: Maybe }> }, geo: { __typename?: 'GeoEcsFields', continent_name: Maybe, city_name: Maybe, country_iso_code: Maybe, country_name: Maybe, region_iso_code: Maybe, region_name: Maybe, location: Maybe<{ __typename?: 'Location', lat: Maybe, lon: Maybe }> } }>, destination: Maybe<{ __typename?: 'Overview', firstSeen: Maybe, lastSeen: Maybe, autonomousSystem: { __typename?: 'AutonomousSystem', number: Maybe, organization: Maybe<{ __typename?: 'AutonomousSystemOrganization', name: Maybe }> }, geo: { __typename?: 'GeoEcsFields', continent_name: Maybe, city_name: Maybe, country_iso_code: Maybe, country_name: Maybe, region_iso_code: Maybe, region_name: Maybe, location: Maybe<{ __typename?: 'Location', lat: Maybe, lon: Maybe }> } }>, host: { __typename?: 'HostEcsFields', architecture: Maybe, id: Maybe, ip: Maybe, mac: Maybe, name: Maybe, type: Maybe, os: Maybe<{ __typename?: 'OsEcsFields', family: Maybe, name: Maybe, platform: Maybe, version: Maybe }> }, inspect: Maybe<{ __typename?: 'Inspect', dsl: Array, response: Array }> }> } }; - -export type KpiHostDetailsChartFieldsFragment = { __typename?: 'KpiHostHistogramData', x: Maybe, y: Maybe }; - -export type GetKpiHostDetailsQueryQueryVariables = { - sourceId: Scalars['ID'], - timerange: TimerangeInput, - filterQuery?: Maybe, - defaultIndex: Array, - inspect: Scalars['Boolean'] -}; - - -export type GetKpiHostDetailsQueryQuery = { __typename?: 'Query', source: { __typename?: 'Source', id: string, KpiHostDetails: { __typename?: 'KpiHostDetailsData', authSuccess: Maybe, authFailure: Maybe, uniqueSourceIps: Maybe, uniqueDestinationIps: Maybe, authSuccessHistogram: Maybe>, authFailureHistogram: Maybe>, uniqueSourceIpsHistogram: Maybe>, uniqueDestinationIpsHistogram: Maybe>, inspect: Maybe<{ __typename?: 'Inspect', dsl: Array, response: Array }> } } }; - -export type KpiHostChartFieldsFragment = { __typename?: 'KpiHostHistogramData', x: Maybe, y: Maybe }; - -export type GetKpiHostsQueryQueryVariables = { - sourceId: Scalars['ID'], - timerange: TimerangeInput, - filterQuery?: Maybe, - defaultIndex: Array, - inspect: Scalars['Boolean'] -}; - - -export type GetKpiHostsQueryQuery = { __typename?: 'Query', source: { __typename?: 'Source', id: string, KpiHosts: { __typename?: 'KpiHostsData', hosts: Maybe, authSuccess: Maybe, authFailure: Maybe, uniqueSourceIps: Maybe, uniqueDestinationIps: Maybe, hostsHistogram: Maybe>, authSuccessHistogram: Maybe>, authFailureHistogram: Maybe>, uniqueSourceIpsHistogram: Maybe>, uniqueDestinationIpsHistogram: Maybe>, inspect: Maybe<{ __typename?: 'Inspect', dsl: Array, response: Array }> } } }; - -export type KpiNetworkChartFieldsFragment = { __typename?: 'KpiNetworkHistogramData', x: Maybe, y: Maybe }; - -export type GetKpiNetworkQueryQueryVariables = { - sourceId: Scalars['ID'], - timerange: TimerangeInput, - filterQuery?: Maybe, - defaultIndex: Array, - inspect: Scalars['Boolean'] -}; - - -export type GetKpiNetworkQueryQuery = { __typename?: 'Query', source: { __typename?: 'Source', id: string, KpiNetwork: Maybe<{ __typename?: 'KpiNetworkData', networkEvents: Maybe, uniqueFlowId: Maybe, uniqueSourcePrivateIps: Maybe, uniqueDestinationPrivateIps: Maybe, dnsQueries: Maybe, tlsHandshakes: Maybe, uniqueSourcePrivateIpsHistogram: Maybe>, uniqueDestinationPrivateIpsHistogram: Maybe>, inspect: Maybe<{ __typename?: 'Inspect', dsl: Array, response: Array }> }> } }; - -export type GetMatrixHistogramQueryQueryVariables = { - defaultIndex: Array, - filterQuery?: Maybe, - histogramType: HistogramType, - inspect: Scalars['Boolean'], - sourceId: Scalars['ID'], - stackByField: Scalars['String'], - timerange: TimerangeInput -}; - - -export type GetMatrixHistogramQueryQuery = { __typename?: 'Query', source: { __typename?: 'Source', id: string, MatrixHistogram: { __typename?: 'MatrixHistogramOverTimeData', totalCount: number, matrixHistogramData: Array<{ __typename?: 'MatrixOverTimeHistogramData', x: Maybe, y: Maybe, g: Maybe }>, inspect: Maybe<{ __typename?: 'Inspect', dsl: Array, response: Array }> } } }; - -export type GetNetworkDnsQueryQueryVariables = { - defaultIndex: Array, - filterQuery?: Maybe, - inspect: Scalars['Boolean'], - isPtrIncluded: Scalars['Boolean'], - pagination: PaginationInputPaginated, - sort: NetworkDnsSortField, - sourceId: Scalars['ID'], - stackByField?: Maybe, - timerange: TimerangeInput -}; - - -export type GetNetworkDnsQueryQuery = { __typename?: 'Query', source: { __typename?: 'Source', id: string, NetworkDns: { __typename?: 'NetworkDnsData', totalCount: number, edges: Array<{ __typename?: 'NetworkDnsEdges', node: { __typename?: 'NetworkDnsItem', _id: Maybe, dnsBytesIn: Maybe, dnsBytesOut: Maybe, dnsName: Maybe, queryCount: Maybe, uniqueDomains: Maybe }, cursor: { __typename?: 'CursorType', value: Maybe } }>, pageInfo: { __typename?: 'PageInfoPaginated', activePage: number, fakeTotalCount: number, showMorePagesIndicator: boolean }, inspect: Maybe<{ __typename?: 'Inspect', dsl: Array, response: Array }> } } }; - -export type GetNetworkHttpQueryQueryVariables = { - sourceId: Scalars['ID'], - ip?: Maybe, - filterQuery?: Maybe, - pagination: PaginationInputPaginated, - sort: NetworkHttpSortField, - timerange: TimerangeInput, - defaultIndex: Array, - inspect: Scalars['Boolean'] -}; - - -export type GetNetworkHttpQueryQuery = { __typename?: 'Query', source: { __typename?: 'Source', id: string, NetworkHttp: { __typename?: 'NetworkHttpData', totalCount: number, edges: Array<{ __typename?: 'NetworkHttpEdges', node: { __typename?: 'NetworkHttpItem', domains: Array, lastHost: Maybe, lastSourceIp: Maybe, methods: Array, path: Maybe, requestCount: Maybe, statuses: Array }, cursor: { __typename?: 'CursorType', value: Maybe } }>, pageInfo: { __typename?: 'PageInfoPaginated', activePage: number, fakeTotalCount: number, showMorePagesIndicator: boolean }, inspect: Maybe<{ __typename?: 'Inspect', dsl: Array, response: Array }> } } }; - -export type GetNetworkTopCountriesQueryQueryVariables = { - sourceId: Scalars['ID'], - ip?: Maybe, - filterQuery?: Maybe, - pagination: PaginationInputPaginated, - sort: NetworkTopTablesSortField, - flowTarget: FlowTargetSourceDest, - timerange: TimerangeInput, - defaultIndex: Array, - inspect: Scalars['Boolean'] -}; - - -export type GetNetworkTopCountriesQueryQuery = { __typename?: 'Query', source: { __typename?: 'Source', id: string, NetworkTopCountries: { __typename?: 'NetworkTopCountriesData', totalCount: number, edges: Array<{ __typename?: 'NetworkTopCountriesEdges', node: { __typename?: 'NetworkTopCountriesItem', source: Maybe<{ __typename?: 'TopCountriesItemSource', country: Maybe, destination_ips: Maybe, flows: Maybe, source_ips: Maybe }>, destination: Maybe<{ __typename?: 'TopCountriesItemDestination', country: Maybe, destination_ips: Maybe, flows: Maybe, source_ips: Maybe }>, network: Maybe<{ __typename?: 'TopNetworkTablesEcsField', bytes_in: Maybe, bytes_out: Maybe }> }, cursor: { __typename?: 'CursorType', value: Maybe } }>, pageInfo: { __typename?: 'PageInfoPaginated', activePage: number, fakeTotalCount: number, showMorePagesIndicator: boolean }, inspect: Maybe<{ __typename?: 'Inspect', dsl: Array, response: Array }> } } }; - -export type GetNetworkTopNFlowQueryQueryVariables = { - sourceId: Scalars['ID'], - ip?: Maybe, - filterQuery?: Maybe, - pagination: PaginationInputPaginated, - sort: NetworkTopTablesSortField, - flowTarget: FlowTargetSourceDest, - timerange: TimerangeInput, - defaultIndex: Array, - inspect: Scalars['Boolean'] -}; - - -export type GetNetworkTopNFlowQueryQuery = { __typename?: 'Query', source: { __typename?: 'Source', id: string, NetworkTopNFlow: { __typename?: 'NetworkTopNFlowData', totalCount: number, edges: Array<{ __typename?: 'NetworkTopNFlowEdges', node: { __typename?: 'NetworkTopNFlowItem', source: Maybe<{ __typename?: 'TopNFlowItemSource', domain: Maybe>, ip: Maybe, flows: Maybe, destination_ips: Maybe, autonomous_system: Maybe<{ __typename?: 'AutonomousSystemItem', name: Maybe, number: Maybe }>, location: Maybe<{ __typename?: 'GeoItem', flowTarget: Maybe, geo: Maybe<{ __typename?: 'GeoEcsFields', continent_name: Maybe, country_name: Maybe, country_iso_code: Maybe, city_name: Maybe, region_iso_code: Maybe, region_name: Maybe }> }> }>, destination: Maybe<{ __typename?: 'TopNFlowItemDestination', domain: Maybe>, ip: Maybe, flows: Maybe, source_ips: Maybe, autonomous_system: Maybe<{ __typename?: 'AutonomousSystemItem', name: Maybe, number: Maybe }>, location: Maybe<{ __typename?: 'GeoItem', flowTarget: Maybe, geo: Maybe<{ __typename?: 'GeoEcsFields', continent_name: Maybe, country_name: Maybe, country_iso_code: Maybe, city_name: Maybe, region_iso_code: Maybe, region_name: Maybe }> }> }>, network: Maybe<{ __typename?: 'TopNetworkTablesEcsField', bytes_in: Maybe, bytes_out: Maybe }> }, cursor: { __typename?: 'CursorType', value: Maybe } }>, pageInfo: { __typename?: 'PageInfoPaginated', activePage: number, fakeTotalCount: number, showMorePagesIndicator: boolean }, inspect: Maybe<{ __typename?: 'Inspect', dsl: Array, response: Array }> } } }; - -export type GetOverviewHostQueryQueryVariables = { - sourceId: Scalars['ID'], - timerange: TimerangeInput, - filterQuery?: Maybe, - defaultIndex: Array, - inspect: Scalars['Boolean'] -}; - - -export type GetOverviewHostQueryQuery = { __typename?: 'Query', source: { __typename?: 'Source', id: string, OverviewHost: Maybe<{ __typename?: 'OverviewHostData', auditbeatAuditd: Maybe, auditbeatFIM: Maybe, auditbeatLogin: Maybe, auditbeatPackage: Maybe, auditbeatProcess: Maybe, auditbeatUser: Maybe, endgameDns: Maybe, endgameFile: Maybe, endgameImageLoad: Maybe, endgameNetwork: Maybe, endgameProcess: Maybe, endgameRegistry: Maybe, endgameSecurity: Maybe, filebeatSystemModule: Maybe, winlogbeatSecurity: Maybe, winlogbeatMWSysmonOperational: Maybe, inspect: Maybe<{ __typename?: 'Inspect', dsl: Array, response: Array }> }> } }; - -export type GetOverviewNetworkQueryQueryVariables = { - sourceId: Scalars['ID'], - timerange: TimerangeInput, - filterQuery?: Maybe, - defaultIndex: Array, - inspect: Scalars['Boolean'] -}; - - -export type GetOverviewNetworkQueryQuery = { __typename?: 'Query', source: { __typename?: 'Source', id: string, OverviewNetwork: Maybe<{ __typename?: 'OverviewNetworkData', auditbeatSocket: Maybe, filebeatCisco: Maybe, filebeatNetflow: Maybe, filebeatPanw: Maybe, filebeatSuricata: Maybe, filebeatZeek: Maybe, packetbeatDNS: Maybe, packetbeatFlow: Maybe, packetbeatTLS: Maybe, inspect: Maybe<{ __typename?: 'Inspect', dsl: Array, response: Array }> }> } }; - -export type SourceQueryQueryVariables = { - sourceId?: Maybe, - defaultIndex: Array -}; - - -export type SourceQueryQuery = { __typename?: 'Query', source: { __typename?: 'Source', id: string, status: { __typename?: 'SourceStatus', indicesExist: boolean, indexFields: Array<{ __typename?: 'IndexField', category: string, description: Maybe, example: Maybe, indexes: Array>, name: string, searchable: boolean, type: string, aggregatable: boolean, format: Maybe }> } } }; - -export type GetAllTimelineQueryVariables = { - pageInfo: PageInfoTimeline, - search?: Maybe, - sort?: Maybe, - onlyUserFavorite?: Maybe -}; - - -export type GetAllTimelineQuery = { __typename?: 'Query', getAllTimeline: { __typename?: 'ResponseTimelines', totalCount: Maybe, timeline: Array, noteIds: Maybe>, pinnedEventIds: Maybe>, title: Maybe, created: Maybe, createdBy: Maybe, updated: Maybe, updatedBy: Maybe, version: string, favorite: Maybe, userName: Maybe, favoriteDate: Maybe }>>, eventIdToNoteIds: Maybe, note: Maybe, timelineId: Maybe, noteId: string, created: Maybe, createdBy: Maybe, timelineVersion: Maybe, updated: Maybe, updatedBy: Maybe, version: Maybe }>>, notes: Maybe, note: Maybe, timelineId: Maybe, timelineVersion: Maybe, noteId: string, created: Maybe, createdBy: Maybe, updated: Maybe, updatedBy: Maybe, version: Maybe }>> }>> } }; - -export type DeleteTimelineMutationMutationVariables = { - id: Array -}; - - -export type DeleteTimelineMutationMutation = { __typename?: 'Mutation', deleteTimeline: boolean }; - -export type GetTimelineDetailsQueryQueryVariables = { - sourceId: Scalars['ID'], - eventId: Scalars['String'], - indexName: Scalars['String'], - defaultIndex: Array -}; - - -export type GetTimelineDetailsQueryQuery = { __typename?: 'Query', source: { __typename?: 'Source', id: string, TimelineDetails: { __typename?: 'TimelineDetailsData', data: Maybe, originalValue: Maybe }>> } } }; - -export type PersistTimelineFavoriteMutationMutationVariables = { - timelineId?: Maybe -}; - - -export type PersistTimelineFavoriteMutationMutation = { __typename?: 'Mutation', persistFavorite: { __typename?: 'ResponseFavoriteTimeline', savedObjectId: string, version: string, favorite: Maybe, userName: Maybe, favoriteDate: Maybe }>> } }; - -export type GetTimelineQueryQueryVariables = { - sourceId: Scalars['ID'], - fieldRequested: Array, - pagination: PaginationInput, - sortField: SortField, - filterQuery?: Maybe, - defaultIndex: Array, - inspect: Scalars['Boolean'] -}; - - -export type GetTimelineQueryQuery = { __typename?: 'Query', source: { __typename?: 'Source', id: string, Timeline: { __typename?: 'TimelineData', totalCount: number, inspect: Maybe<{ __typename?: 'Inspect', dsl: Array, response: Array }>, pageInfo: { __typename?: 'PageInfo', hasNextPage: Maybe, endCursor: Maybe<{ __typename?: 'CursorType', value: Maybe, tiebreaker: Maybe }> }, edges: Array<{ __typename?: 'TimelineEdges', node: { __typename?: 'TimelineItem', _id: string, _index: Maybe, data: Array<{ __typename?: 'TimelineNonEcsData', field: string, value: Maybe }>, ecs: { __typename?: 'ECS', _id: string, _index: Maybe, timestamp: Maybe, message: Maybe, system: Maybe<{ __typename?: 'SystemEcsField', auth: Maybe<{ __typename?: 'AuthEcsFields', ssh: Maybe<{ __typename?: 'SshEcsFields', signature: Maybe, method: Maybe }> }>, audit: Maybe<{ __typename?: 'AuditEcsFields', package: Maybe<{ __typename?: 'PackageEcsFields', arch: Maybe, entity_id: Maybe, name: Maybe, size: Maybe, summary: Maybe, version: Maybe }> }> }>, event: Maybe<{ __typename?: 'EventEcsFields', action: Maybe, category: Maybe, code: Maybe, created: Maybe, dataset: Maybe, duration: Maybe, end: Maybe, hash: Maybe, id: Maybe, kind: Maybe, module: Maybe, original: Maybe, outcome: Maybe, risk_score: Maybe, risk_score_norm: Maybe, severity: Maybe, start: Maybe, timezone: Maybe, type: Maybe }>, auditd: Maybe<{ __typename?: 'AuditdEcsFields', result: Maybe, session: Maybe, data: Maybe<{ __typename?: 'AuditdData', acct: Maybe, terminal: Maybe, op: Maybe }>, summary: Maybe<{ __typename?: 'Summary', how: Maybe, message_type: Maybe, sequence: Maybe, actor: Maybe<{ __typename?: 'PrimarySecondary', primary: Maybe, secondary: Maybe }>, object: Maybe<{ __typename?: 'PrimarySecondary', primary: Maybe, secondary: Maybe, type: Maybe }> }> }>, file: Maybe<{ __typename?: 'FileFields', name: Maybe, path: Maybe, target_path: Maybe, extension: Maybe, type: Maybe, device: Maybe, inode: Maybe, uid: Maybe, owner: Maybe, gid: Maybe, group: Maybe, mode: Maybe, size: Maybe, mtime: Maybe, ctime: Maybe }>, host: Maybe<{ __typename?: 'HostEcsFields', id: Maybe, name: Maybe, ip: Maybe }>, rule: Maybe<{ __typename?: 'RuleEcsField', reference: Maybe }>, source: Maybe<{ __typename?: 'SourceEcsFields', bytes: Maybe, ip: Maybe, packets: Maybe, port: Maybe, geo: Maybe<{ __typename?: 'GeoEcsFields', continent_name: Maybe, country_name: Maybe, country_iso_code: Maybe, city_name: Maybe, region_iso_code: Maybe, region_name: Maybe }> }>, destination: Maybe<{ __typename?: 'DestinationEcsFields', bytes: Maybe, ip: Maybe, packets: Maybe, port: Maybe, geo: Maybe<{ __typename?: 'GeoEcsFields', continent_name: Maybe, country_name: Maybe, country_iso_code: Maybe, city_name: Maybe, region_iso_code: Maybe, region_name: Maybe }> }>, dns: Maybe<{ __typename?: 'DnsEcsFields', resolved_ip: Maybe, response_code: Maybe, question: Maybe<{ __typename?: 'DnsQuestionData', name: Maybe, type: Maybe }> }>, endgame: Maybe<{ __typename?: 'EndgameEcsFields', exit_code: Maybe, file_name: Maybe, file_path: Maybe, logon_type: Maybe, parent_process_name: Maybe, pid: Maybe, process_name: Maybe, subject_domain_name: Maybe, subject_logon_id: Maybe, subject_user_name: Maybe, target_domain_name: Maybe, target_logon_id: Maybe, target_user_name: Maybe }>, geo: Maybe<{ __typename?: 'GeoEcsFields', region_name: Maybe, country_iso_code: Maybe }>, signal: Maybe<{ __typename?: 'SignalField', original_time: Maybe, rule: Maybe<{ __typename?: 'RuleField', id: Maybe, saved_id: Maybe, timeline_id: Maybe, timeline_title: Maybe, output_index: Maybe, from: Maybe, index: Maybe, language: Maybe, query: Maybe, to: Maybe, filters: Maybe }> }>, suricata: Maybe<{ __typename?: 'SuricataEcsFields', eve: Maybe<{ __typename?: 'SuricataEveData', proto: Maybe, flow_id: Maybe, alert: Maybe<{ __typename?: 'SuricataAlertData', signature: Maybe, signature_id: Maybe }> }> }>, network: Maybe<{ __typename?: 'NetworkEcsField', bytes: Maybe, community_id: Maybe, direction: Maybe, packets: Maybe, protocol: Maybe, transport: Maybe }>, http: Maybe<{ __typename?: 'HttpEcsFields', version: Maybe, request: Maybe<{ __typename?: 'HttpRequestData', method: Maybe, referrer: Maybe, body: Maybe<{ __typename?: 'HttpBodyData', bytes: Maybe, content: Maybe }> }>, response: Maybe<{ __typename?: 'HttpResponseData', status_code: Maybe, body: Maybe<{ __typename?: 'HttpBodyData', bytes: Maybe, content: Maybe }> }> }>, tls: Maybe<{ __typename?: 'TlsEcsFields', client_certificate: Maybe<{ __typename?: 'TlsClientCertificateData', fingerprint: Maybe<{ __typename?: 'FingerprintData', sha1: Maybe }> }>, fingerprints: Maybe<{ __typename?: 'TlsFingerprintsData', ja3: Maybe<{ __typename?: 'TlsJa3Data', hash: Maybe }> }>, server_certificate: Maybe<{ __typename?: 'TlsServerCertificateData', fingerprint: Maybe<{ __typename?: 'FingerprintData', sha1: Maybe }> }> }>, url: Maybe<{ __typename?: 'UrlEcsFields', original: Maybe, domain: Maybe, username: Maybe, password: Maybe }>, user: Maybe<{ __typename?: 'UserEcsFields', domain: Maybe, name: Maybe }>, winlog: Maybe<{ __typename?: 'WinlogEcsFields', event_id: Maybe }>, process: Maybe<{ __typename?: 'ProcessEcsFields', pid: Maybe, name: Maybe, ppid: Maybe, args: Maybe, executable: Maybe, title: Maybe, working_directory: Maybe, hash: Maybe<{ __typename?: 'ProcessHashData', md5: Maybe, sha1: Maybe, sha256: Maybe }> }>, zeek: Maybe<{ __typename?: 'ZeekEcsFields', session_id: Maybe, connection: Maybe<{ __typename?: 'ZeekConnectionData', local_resp: Maybe, local_orig: Maybe, missed_bytes: Maybe, state: Maybe, history: Maybe }>, notice: Maybe<{ __typename?: 'ZeekNoticeData', suppress_for: Maybe, msg: Maybe, note: Maybe, sub: Maybe, dst: Maybe, dropped: Maybe, peer_descr: Maybe }>, dns: Maybe<{ __typename?: 'ZeekDnsData', AA: Maybe, qclass_name: Maybe, RD: Maybe, qtype_name: Maybe, rejected: Maybe, qtype: Maybe, query: Maybe, trans_id: Maybe, qclass: Maybe, RA: Maybe, TC: Maybe }>, http: Maybe<{ __typename?: 'ZeekHttpData', resp_mime_types: Maybe, trans_depth: Maybe, status_msg: Maybe, resp_fuids: Maybe, tags: Maybe }>, files: Maybe<{ __typename?: 'ZeekFileData', session_ids: Maybe, timedout: Maybe, local_orig: Maybe, tx_host: Maybe, source: Maybe, is_orig: Maybe, overflow_bytes: Maybe, sha1: Maybe, duration: Maybe, depth: Maybe, analyzers: Maybe, mime_type: Maybe, rx_host: Maybe, total_bytes: Maybe, fuid: Maybe, seen_bytes: Maybe, missing_bytes: Maybe, md5: Maybe }>, ssl: Maybe<{ __typename?: 'ZeekSslData', cipher: Maybe, established: Maybe, resumed: Maybe, version: Maybe }> }> } } }> } } }; - -export type PersistTimelineNoteMutationMutationVariables = { - noteId?: Maybe, - version?: Maybe, - note: NoteInput -}; - - -export type PersistTimelineNoteMutationMutation = { __typename?: 'Mutation', persistNote: { __typename?: 'ResponseNote', code: Maybe, message: Maybe, note: { __typename?: 'NoteResult', eventId: Maybe, note: Maybe, timelineId: Maybe, timelineVersion: Maybe, noteId: string, created: Maybe, createdBy: Maybe, updated: Maybe, updatedBy: Maybe, version: Maybe } } }; - -export type GetOneTimelineQueryVariables = { - id: Scalars['ID'] -}; - - -export type GetOneTimelineQuery = { __typename?: 'Query', getOneTimeline: { __typename?: 'TimelineResult', savedObjectId: string, description: Maybe, eventType: Maybe, kqlMode: Maybe, noteIds: Maybe>, pinnedEventIds: Maybe>, title: Maybe, savedQueryId: Maybe, created: Maybe, createdBy: Maybe, updated: Maybe, updatedBy: Maybe, version: string, columns: Maybe, category: Maybe, columnHeaderType: Maybe, description: Maybe, example: Maybe, indexes: Maybe>, id: Maybe, name: Maybe, searchable: Maybe, type: Maybe }>>, dataProviders: Maybe, name: Maybe, enabled: Maybe, excluded: Maybe, kqlQuery: Maybe, queryMatch: Maybe<{ __typename?: 'QueryMatchResult', field: Maybe, displayField: Maybe, value: Maybe, displayValue: Maybe, operator: Maybe }>, and: Maybe, name: Maybe, enabled: Maybe, excluded: Maybe, kqlQuery: Maybe, queryMatch: Maybe<{ __typename?: 'QueryMatchResult', field: Maybe, displayField: Maybe, value: Maybe, displayValue: Maybe, operator: Maybe }> }>> }>>, dateRange: Maybe<{ __typename?: 'DateRangePickerResult', start: Maybe, end: Maybe }>, eventIdToNoteIds: Maybe, note: Maybe, timelineId: Maybe, noteId: string, created: Maybe, createdBy: Maybe, timelineVersion: Maybe, updated: Maybe, updatedBy: Maybe, version: Maybe }>>, favorite: Maybe, userName: Maybe, favoriteDate: Maybe }>>, filters: Maybe, exists: Maybe, match_all: Maybe, missing: Maybe, range: Maybe, script: Maybe, meta: Maybe<{ __typename?: 'FilterMetaTimelineResult', alias: Maybe, controlledBy: Maybe, disabled: Maybe, field: Maybe, formattedValue: Maybe, index: Maybe, key: Maybe, negate: Maybe, params: Maybe, type: Maybe, value: Maybe }> }>>, kqlQuery: Maybe<{ __typename?: 'SerializedFilterQueryResult', filterQuery: Maybe<{ __typename?: 'SerializedKueryQueryResult', serializedQuery: Maybe, kuery: Maybe<{ __typename?: 'KueryFilterQueryResult', kind: Maybe, expression: Maybe }> }> }>, notes: Maybe, note: Maybe, timelineId: Maybe, timelineVersion: Maybe, noteId: string, created: Maybe, createdBy: Maybe, updated: Maybe, updatedBy: Maybe, version: Maybe }>>, pinnedEventsSaveObject: Maybe, timelineId: Maybe, created: Maybe, createdBy: Maybe, updated: Maybe, updatedBy: Maybe, version: Maybe }>>, sort: Maybe<{ __typename?: 'SortTimelineResult', columnId: Maybe, sortDirection: Maybe }> } }; - -export type PersistTimelineMutationMutationVariables = { - timelineId?: Maybe, - version?: Maybe, - timeline: TimelineInput -}; - - -export type PersistTimelineMutationMutation = { __typename?: 'Mutation', persistTimeline: { __typename?: 'ResponseTimeline', code: Maybe, message: Maybe, timeline: { __typename?: 'TimelineResult', savedObjectId: string, version: string, description: Maybe, eventType: Maybe, kqlMode: Maybe, title: Maybe, savedQueryId: Maybe, created: Maybe, createdBy: Maybe, updated: Maybe, updatedBy: Maybe, columns: Maybe, category: Maybe, columnHeaderType: Maybe, description: Maybe, example: Maybe, indexes: Maybe>, id: Maybe, name: Maybe, searchable: Maybe, type: Maybe }>>, dataProviders: Maybe, name: Maybe, enabled: Maybe, excluded: Maybe, kqlQuery: Maybe, queryMatch: Maybe<{ __typename?: 'QueryMatchResult', field: Maybe, displayField: Maybe, value: Maybe, displayValue: Maybe, operator: Maybe }>, and: Maybe, name: Maybe, enabled: Maybe, excluded: Maybe, kqlQuery: Maybe, queryMatch: Maybe<{ __typename?: 'QueryMatchResult', field: Maybe, displayField: Maybe, value: Maybe, displayValue: Maybe, operator: Maybe }> }>> }>>, favorite: Maybe, userName: Maybe, favoriteDate: Maybe }>>, filters: Maybe, exists: Maybe, match_all: Maybe, missing: Maybe, range: Maybe, script: Maybe, meta: Maybe<{ __typename?: 'FilterMetaTimelineResult', alias: Maybe, controlledBy: Maybe, disabled: Maybe, field: Maybe, formattedValue: Maybe, index: Maybe, key: Maybe, negate: Maybe, params: Maybe, type: Maybe, value: Maybe }> }>>, kqlQuery: Maybe<{ __typename?: 'SerializedFilterQueryResult', filterQuery: Maybe<{ __typename?: 'SerializedKueryQueryResult', serializedQuery: Maybe, kuery: Maybe<{ __typename?: 'KueryFilterQueryResult', kind: Maybe, expression: Maybe }> }> }>, dateRange: Maybe<{ __typename?: 'DateRangePickerResult', start: Maybe, end: Maybe }>, sort: Maybe<{ __typename?: 'SortTimelineResult', columnId: Maybe, sortDirection: Maybe }> } } }; - -export type PersistTimelinePinnedEventMutationMutationVariables = { - pinnedEventId?: Maybe, - eventId: Scalars['ID'], - timelineId?: Maybe -}; - - -export type PersistTimelinePinnedEventMutationMutation = { __typename?: 'Mutation', persistPinnedEventOnTimeline: Maybe<{ __typename?: 'PinnedEvent', pinnedEventId: string, eventId: Maybe, timelineId: Maybe, timelineVersion: Maybe, created: Maybe, createdBy: Maybe, updated: Maybe, updatedBy: Maybe, version: Maybe }> }; - -export type GetTlsQueryQueryVariables = { - sourceId: Scalars['ID'], - filterQuery?: Maybe, - flowTarget: FlowTargetSourceDest, - ip: Scalars['String'], - pagination: PaginationInputPaginated, - sort: TlsSortField, - timerange: TimerangeInput, - defaultIndex: Array, - inspect: Scalars['Boolean'] -}; - - -export type GetTlsQueryQuery = { __typename?: 'Query', source: { __typename?: 'Source', id: string, Tls: { __typename?: 'TlsData', totalCount: number, edges: Array<{ __typename?: 'TlsEdges', node: { __typename?: 'TlsNode', _id: Maybe, alternativeNames: Maybe>, commonNames: Maybe>, ja3: Maybe>, issuerNames: Maybe>, notAfter: Maybe> }, cursor: { __typename?: 'CursorType', value: Maybe } }>, pageInfo: { __typename?: 'PageInfoPaginated', activePage: number, fakeTotalCount: number, showMorePagesIndicator: boolean }, inspect: Maybe<{ __typename?: 'Inspect', dsl: Array, response: Array }> } } }; - -export type GetUncommonProcessesQueryQueryVariables = { - sourceId: Scalars['ID'], - timerange: TimerangeInput, - pagination: PaginationInputPaginated, - filterQuery?: Maybe, - defaultIndex: Array, - inspect: Scalars['Boolean'] -}; - - -export type GetUncommonProcessesQueryQuery = { __typename?: 'Query', source: { __typename?: 'Source', id: string, UncommonProcesses: { __typename?: 'UncommonProcessesData', totalCount: number, edges: Array<{ __typename?: 'UncommonProcessesEdges', node: { __typename?: 'UncommonProcessItem', _id: string, instances: number, process: { __typename?: 'ProcessEcsFields', args: Maybe, name: Maybe }, user: Maybe<{ __typename?: 'UserEcsFields', id: Maybe, name: Maybe }>, hosts: Array<{ __typename?: 'HostEcsFields', name: Maybe }> }, cursor: { __typename?: 'CursorType', value: Maybe } }>, pageInfo: { __typename?: 'PageInfoPaginated', activePage: number, fakeTotalCount: number, showMorePagesIndicator: boolean }, inspect: Maybe<{ __typename?: 'Inspect', dsl: Array, response: Array }> } } }; - -export type GetUsersQueryQueryVariables = { - sourceId: Scalars['ID'], - filterQuery?: Maybe, - flowTarget: FlowTarget, - ip: Scalars['String'], - pagination: PaginationInputPaginated, - sort: UsersSortField, - timerange: TimerangeInput, - defaultIndex: Array, - inspect: Scalars['Boolean'] -}; - - -export type GetUsersQueryQuery = { __typename?: 'Query', source: { __typename?: 'Source', id: string, Users: { __typename?: 'UsersData', totalCount: number, edges: Array<{ __typename?: 'UsersEdges', node: { __typename?: 'UsersNode', user: Maybe<{ __typename?: 'UsersItem', name: Maybe, id: Maybe, groupId: Maybe, groupName: Maybe, count: Maybe }> }, cursor: { __typename?: 'CursorType', value: Maybe } }>, pageInfo: { __typename?: 'PageInfoPaginated', activePage: number, fakeTotalCount: number, showMorePagesIndicator: boolean }, inspect: Maybe<{ __typename?: 'Inspect', dsl: Array, response: Array }> } } }; - -export const KpiHostDetailsChartFieldsFragmentDoc = gql` - fragment KpiHostDetailsChartFields on KpiHostHistogramData { - x - y -} - `; -export const KpiHostChartFieldsFragmentDoc = gql` - fragment KpiHostChartFields on KpiHostHistogramData { - x - y -} - `; -export const KpiNetworkChartFieldsFragmentDoc = gql` - fragment KpiNetworkChartFields on KpiNetworkHistogramData { - x - y -} - `; -export const GetAuthenticationsQueryDocument = gql` - query GetAuthenticationsQuery($sourceId: ID!, $timerange: TimerangeInput!, $pagination: PaginationInputPaginated!, $filterQuery: String, $defaultIndex: [String!]!, $inspect: Boolean!) { - source(id: $sourceId) { - id - Authentications(timerange: $timerange, pagination: $pagination, filterQuery: $filterQuery, defaultIndex: $defaultIndex) { - totalCount - edges { - node { - _id - failures - successes - user { - name - } - lastSuccess { - timestamp - source { - ip - } - host { - id - name - } - } - lastFailure { - timestamp - source { - ip - } - host { - id - name - } - } - } - cursor { - value - } - } - pageInfo { - activePage - fakeTotalCount - showMorePagesIndicator - } - inspect @include(if: $inspect) { - dsl - response - } - } - } -} - `; -export type GetAuthenticationsQueryComponentProps = Omit, 'query'> & ({ variables: GetAuthenticationsQueryQueryVariables; skip?: boolean; } | { skip: boolean; }); - - export const GetAuthenticationsQueryComponent = (props: GetAuthenticationsQueryComponentProps) => ( - query={GetAuthenticationsQueryDocument} {...props} /> - ); - - -/** - * __useGetAuthenticationsQueryQuery__ - * - * To run a query within a React component, call `useGetAuthenticationsQueryQuery` and pass it any options that fit your needs. - * When your component renders, `useGetAuthenticationsQueryQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useGetAuthenticationsQueryQuery({ - * variables: { - * sourceId: // value for 'sourceId' - * timerange: // value for 'timerange' - * pagination: // value for 'pagination' - * filterQuery: // value for 'filterQuery' - * defaultIndex: // value for 'defaultIndex' - * inspect: // value for 'inspect' - * }, - * }); - */ -export function useGetAuthenticationsQueryQuery(baseOptions?: ApolloReactHooks.QueryHookOptions) { - return ApolloReactHooks.useQuery(GetAuthenticationsQueryDocument, baseOptions); - } -export function useGetAuthenticationsQueryLazyQuery(baseOptions?: ApolloReactHooks.LazyQueryHookOptions) { - return ApolloReactHooks.useLazyQuery(GetAuthenticationsQueryDocument, baseOptions); - } -export type GetAuthenticationsQueryQueryHookResult = ReturnType; -export type GetAuthenticationsQueryLazyQueryHookResult = ReturnType; -export type GetAuthenticationsQueryQueryResult = ApolloReactCommon.QueryResult; -export const GetLastEventTimeQueryDocument = gql` - query GetLastEventTimeQuery($sourceId: ID!, $indexKey: LastEventIndexKey!, $details: LastTimeDetails!, $defaultIndex: [String!]!) { - source(id: $sourceId) { - id - LastEventTime(indexKey: $indexKey, details: $details, defaultIndex: $defaultIndex) { - lastSeen - } - } -} - `; -export type GetLastEventTimeQueryComponentProps = Omit, 'query'> & ({ variables: GetLastEventTimeQueryQueryVariables; skip?: boolean; } | { skip: boolean; }); - - export const GetLastEventTimeQueryComponent = (props: GetLastEventTimeQueryComponentProps) => ( - query={GetLastEventTimeQueryDocument} {...props} /> - ); - - -/** - * __useGetLastEventTimeQueryQuery__ - * - * To run a query within a React component, call `useGetLastEventTimeQueryQuery` and pass it any options that fit your needs. - * When your component renders, `useGetLastEventTimeQueryQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useGetLastEventTimeQueryQuery({ - * variables: { - * sourceId: // value for 'sourceId' - * indexKey: // value for 'indexKey' - * details: // value for 'details' - * defaultIndex: // value for 'defaultIndex' - * }, - * }); - */ -export function useGetLastEventTimeQueryQuery(baseOptions?: ApolloReactHooks.QueryHookOptions) { - return ApolloReactHooks.useQuery(GetLastEventTimeQueryDocument, baseOptions); - } -export function useGetLastEventTimeQueryLazyQuery(baseOptions?: ApolloReactHooks.LazyQueryHookOptions) { - return ApolloReactHooks.useLazyQuery(GetLastEventTimeQueryDocument, baseOptions); - } -export type GetLastEventTimeQueryQueryHookResult = ReturnType; -export type GetLastEventTimeQueryLazyQueryHookResult = ReturnType; -export type GetLastEventTimeQueryQueryResult = ApolloReactCommon.QueryResult; -export const GetHostFirstLastSeenQueryDocument = gql` - query GetHostFirstLastSeenQuery($sourceId: ID!, $hostName: String!, $defaultIndex: [String!]!) { - source(id: $sourceId) { - id - HostFirstLastSeen(hostName: $hostName, defaultIndex: $defaultIndex) { - firstSeen - lastSeen - } - } -} - `; -export type GetHostFirstLastSeenQueryComponentProps = Omit, 'query'> & ({ variables: GetHostFirstLastSeenQueryQueryVariables; skip?: boolean; } | { skip: boolean; }); - - export const GetHostFirstLastSeenQueryComponent = (props: GetHostFirstLastSeenQueryComponentProps) => ( - query={GetHostFirstLastSeenQueryDocument} {...props} /> - ); - - -/** - * __useGetHostFirstLastSeenQueryQuery__ - * - * To run a query within a React component, call `useGetHostFirstLastSeenQueryQuery` and pass it any options that fit your needs. - * When your component renders, `useGetHostFirstLastSeenQueryQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useGetHostFirstLastSeenQueryQuery({ - * variables: { - * sourceId: // value for 'sourceId' - * hostName: // value for 'hostName' - * defaultIndex: // value for 'defaultIndex' - * }, - * }); - */ -export function useGetHostFirstLastSeenQueryQuery(baseOptions?: ApolloReactHooks.QueryHookOptions) { - return ApolloReactHooks.useQuery(GetHostFirstLastSeenQueryDocument, baseOptions); - } -export function useGetHostFirstLastSeenQueryLazyQuery(baseOptions?: ApolloReactHooks.LazyQueryHookOptions) { - return ApolloReactHooks.useLazyQuery(GetHostFirstLastSeenQueryDocument, baseOptions); - } -export type GetHostFirstLastSeenQueryQueryHookResult = ReturnType; -export type GetHostFirstLastSeenQueryLazyQueryHookResult = ReturnType; -export type GetHostFirstLastSeenQueryQueryResult = ApolloReactCommon.QueryResult; -export const GetHostsTableQueryDocument = gql` - query GetHostsTableQuery($sourceId: ID!, $timerange: TimerangeInput!, $pagination: PaginationInputPaginated!, $sort: HostsSortField!, $filterQuery: String, $defaultIndex: [String!]!, $inspect: Boolean!) { - source(id: $sourceId) { - id - Hosts(timerange: $timerange, pagination: $pagination, sort: $sort, filterQuery: $filterQuery, defaultIndex: $defaultIndex) { - totalCount - edges { - node { - _id - lastSeen - host { - id - name - os { - name - version - } - } - } - cursor { - value - } - } - pageInfo { - activePage - fakeTotalCount - showMorePagesIndicator - } - inspect @include(if: $inspect) { - dsl - response - } - } - } -} - `; -export type GetHostsTableQueryComponentProps = Omit, 'query'> & ({ variables: GetHostsTableQueryQueryVariables; skip?: boolean; } | { skip: boolean; }); - - export const GetHostsTableQueryComponent = (props: GetHostsTableQueryComponentProps) => ( - query={GetHostsTableQueryDocument} {...props} /> - ); - - -/** - * __useGetHostsTableQueryQuery__ - * - * To run a query within a React component, call `useGetHostsTableQueryQuery` and pass it any options that fit your needs. - * When your component renders, `useGetHostsTableQueryQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useGetHostsTableQueryQuery({ - * variables: { - * sourceId: // value for 'sourceId' - * timerange: // value for 'timerange' - * pagination: // value for 'pagination' - * sort: // value for 'sort' - * filterQuery: // value for 'filterQuery' - * defaultIndex: // value for 'defaultIndex' - * inspect: // value for 'inspect' - * }, - * }); - */ -export function useGetHostsTableQueryQuery(baseOptions?: ApolloReactHooks.QueryHookOptions) { - return ApolloReactHooks.useQuery(GetHostsTableQueryDocument, baseOptions); - } -export function useGetHostsTableQueryLazyQuery(baseOptions?: ApolloReactHooks.LazyQueryHookOptions) { - return ApolloReactHooks.useLazyQuery(GetHostsTableQueryDocument, baseOptions); - } -export type GetHostsTableQueryQueryHookResult = ReturnType; -export type GetHostsTableQueryLazyQueryHookResult = ReturnType; -export type GetHostsTableQueryQueryResult = ApolloReactCommon.QueryResult; -export const GetHostOverviewQueryDocument = gql` - query GetHostOverviewQuery($sourceId: ID!, $hostName: String!, $timerange: TimerangeInput!, $defaultIndex: [String!]!, $inspect: Boolean!) { - source(id: $sourceId) { - id - HostOverview(hostName: $hostName, timerange: $timerange, defaultIndex: $defaultIndex) { - _id - host { - architecture - id - ip - mac - name - os { - family - name - platform - version - } - type - } - cloud { - instance { - id - } - machine { - type - } - provider - region - } - inspect @include(if: $inspect) { - dsl - response - } - } - } -} - `; -export type GetHostOverviewQueryComponentProps = Omit, 'query'> & ({ variables: GetHostOverviewQueryQueryVariables; skip?: boolean; } | { skip: boolean; }); - - export const GetHostOverviewQueryComponent = (props: GetHostOverviewQueryComponentProps) => ( - query={GetHostOverviewQueryDocument} {...props} /> - ); - - -/** - * __useGetHostOverviewQueryQuery__ - * - * To run a query within a React component, call `useGetHostOverviewQueryQuery` and pass it any options that fit your needs. - * When your component renders, `useGetHostOverviewQueryQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useGetHostOverviewQueryQuery({ - * variables: { - * sourceId: // value for 'sourceId' - * hostName: // value for 'hostName' - * timerange: // value for 'timerange' - * defaultIndex: // value for 'defaultIndex' - * inspect: // value for 'inspect' - * }, - * }); - */ -export function useGetHostOverviewQueryQuery(baseOptions?: ApolloReactHooks.QueryHookOptions) { - return ApolloReactHooks.useQuery(GetHostOverviewQueryDocument, baseOptions); - } -export function useGetHostOverviewQueryLazyQuery(baseOptions?: ApolloReactHooks.LazyQueryHookOptions) { - return ApolloReactHooks.useLazyQuery(GetHostOverviewQueryDocument, baseOptions); - } -export type GetHostOverviewQueryQueryHookResult = ReturnType; -export type GetHostOverviewQueryLazyQueryHookResult = ReturnType; -export type GetHostOverviewQueryQueryResult = ApolloReactCommon.QueryResult; -export const GetIpOverviewQueryDocument = gql` - query GetIpOverviewQuery($sourceId: ID!, $filterQuery: String, $ip: String!, $defaultIndex: [String!]!, $inspect: Boolean!) { - source(id: $sourceId) { - id - IpOverview(filterQuery: $filterQuery, ip: $ip, defaultIndex: $defaultIndex) { - source { - firstSeen - lastSeen - autonomousSystem { - number - organization { - name - } - } - geo { - continent_name - city_name - country_iso_code - country_name - location { - lat - lon - } - region_iso_code - region_name - } - } - destination { - firstSeen - lastSeen - autonomousSystem { - number - organization { - name - } - } - geo { - continent_name - city_name - country_iso_code - country_name - location { - lat - lon - } - region_iso_code - region_name - } - } - host { - architecture - id - ip - mac - name - os { - family - name - platform - version - } - type - } - inspect @include(if: $inspect) { - dsl - response - } - } - } -} - `; -export type GetIpOverviewQueryComponentProps = Omit, 'query'> & ({ variables: GetIpOverviewQueryQueryVariables; skip?: boolean; } | { skip: boolean; }); - - export const GetIpOverviewQueryComponent = (props: GetIpOverviewQueryComponentProps) => ( - query={GetIpOverviewQueryDocument} {...props} /> - ); - - -/** - * __useGetIpOverviewQueryQuery__ - * - * To run a query within a React component, call `useGetIpOverviewQueryQuery` and pass it any options that fit your needs. - * When your component renders, `useGetIpOverviewQueryQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useGetIpOverviewQueryQuery({ - * variables: { - * sourceId: // value for 'sourceId' - * filterQuery: // value for 'filterQuery' - * ip: // value for 'ip' - * defaultIndex: // value for 'defaultIndex' - * inspect: // value for 'inspect' - * }, - * }); - */ -export function useGetIpOverviewQueryQuery(baseOptions?: ApolloReactHooks.QueryHookOptions) { - return ApolloReactHooks.useQuery(GetIpOverviewQueryDocument, baseOptions); - } -export function useGetIpOverviewQueryLazyQuery(baseOptions?: ApolloReactHooks.LazyQueryHookOptions) { - return ApolloReactHooks.useLazyQuery(GetIpOverviewQueryDocument, baseOptions); - } -export type GetIpOverviewQueryQueryHookResult = ReturnType; -export type GetIpOverviewQueryLazyQueryHookResult = ReturnType; -export type GetIpOverviewQueryQueryResult = ApolloReactCommon.QueryResult; -export const GetKpiHostDetailsQueryDocument = gql` - query GetKpiHostDetailsQuery($sourceId: ID!, $timerange: TimerangeInput!, $filterQuery: String, $defaultIndex: [String!]!, $inspect: Boolean!) { - source(id: $sourceId) { - id - KpiHostDetails(timerange: $timerange, filterQuery: $filterQuery, defaultIndex: $defaultIndex) { - authSuccess - authSuccessHistogram { - ...KpiHostDetailsChartFields - } - authFailure - authFailureHistogram { - ...KpiHostDetailsChartFields - } - uniqueSourceIps - uniqueSourceIpsHistogram { - ...KpiHostDetailsChartFields - } - uniqueDestinationIps - uniqueDestinationIpsHistogram { - ...KpiHostDetailsChartFields - } - inspect @include(if: $inspect) { - dsl - response - } - } - } -} - ${KpiHostDetailsChartFieldsFragmentDoc}`; -export type GetKpiHostDetailsQueryComponentProps = Omit, 'query'> & ({ variables: GetKpiHostDetailsQueryQueryVariables; skip?: boolean; } | { skip: boolean; }); - - export const GetKpiHostDetailsQueryComponent = (props: GetKpiHostDetailsQueryComponentProps) => ( - query={GetKpiHostDetailsQueryDocument} {...props} /> - ); - - -/** - * __useGetKpiHostDetailsQueryQuery__ - * - * To run a query within a React component, call `useGetKpiHostDetailsQueryQuery` and pass it any options that fit your needs. - * When your component renders, `useGetKpiHostDetailsQueryQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useGetKpiHostDetailsQueryQuery({ - * variables: { - * sourceId: // value for 'sourceId' - * timerange: // value for 'timerange' - * filterQuery: // value for 'filterQuery' - * defaultIndex: // value for 'defaultIndex' - * inspect: // value for 'inspect' - * }, - * }); - */ -export function useGetKpiHostDetailsQueryQuery(baseOptions?: ApolloReactHooks.QueryHookOptions) { - return ApolloReactHooks.useQuery(GetKpiHostDetailsQueryDocument, baseOptions); - } -export function useGetKpiHostDetailsQueryLazyQuery(baseOptions?: ApolloReactHooks.LazyQueryHookOptions) { - return ApolloReactHooks.useLazyQuery(GetKpiHostDetailsQueryDocument, baseOptions); - } -export type GetKpiHostDetailsQueryQueryHookResult = ReturnType; -export type GetKpiHostDetailsQueryLazyQueryHookResult = ReturnType; -export type GetKpiHostDetailsQueryQueryResult = ApolloReactCommon.QueryResult; -export const GetKpiHostsQueryDocument = gql` - query GetKpiHostsQuery($sourceId: ID!, $timerange: TimerangeInput!, $filterQuery: String, $defaultIndex: [String!]!, $inspect: Boolean!) { - source(id: $sourceId) { - id - KpiHosts(timerange: $timerange, filterQuery: $filterQuery, defaultIndex: $defaultIndex) { - hosts - hostsHistogram { - ...KpiHostChartFields - } - authSuccess - authSuccessHistogram { - ...KpiHostChartFields - } - authFailure - authFailureHistogram { - ...KpiHostChartFields - } - uniqueSourceIps - uniqueSourceIpsHistogram { - ...KpiHostChartFields - } - uniqueDestinationIps - uniqueDestinationIpsHistogram { - ...KpiHostChartFields - } - inspect @include(if: $inspect) { - dsl - response - } - } - } -} - ${KpiHostChartFieldsFragmentDoc}`; -export type GetKpiHostsQueryComponentProps = Omit, 'query'> & ({ variables: GetKpiHostsQueryQueryVariables; skip?: boolean; } | { skip: boolean; }); - - export const GetKpiHostsQueryComponent = (props: GetKpiHostsQueryComponentProps) => ( - query={GetKpiHostsQueryDocument} {...props} /> - ); - - -/** - * __useGetKpiHostsQueryQuery__ - * - * To run a query within a React component, call `useGetKpiHostsQueryQuery` and pass it any options that fit your needs. - * When your component renders, `useGetKpiHostsQueryQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useGetKpiHostsQueryQuery({ - * variables: { - * sourceId: // value for 'sourceId' - * timerange: // value for 'timerange' - * filterQuery: // value for 'filterQuery' - * defaultIndex: // value for 'defaultIndex' - * inspect: // value for 'inspect' - * }, - * }); - */ -export function useGetKpiHostsQueryQuery(baseOptions?: ApolloReactHooks.QueryHookOptions) { - return ApolloReactHooks.useQuery(GetKpiHostsQueryDocument, baseOptions); - } -export function useGetKpiHostsQueryLazyQuery(baseOptions?: ApolloReactHooks.LazyQueryHookOptions) { - return ApolloReactHooks.useLazyQuery(GetKpiHostsQueryDocument, baseOptions); - } -export type GetKpiHostsQueryQueryHookResult = ReturnType; -export type GetKpiHostsQueryLazyQueryHookResult = ReturnType; -export type GetKpiHostsQueryQueryResult = ApolloReactCommon.QueryResult; -export const GetKpiNetworkQueryDocument = gql` - query GetKpiNetworkQuery($sourceId: ID!, $timerange: TimerangeInput!, $filterQuery: String, $defaultIndex: [String!]!, $inspect: Boolean!) { - source(id: $sourceId) { - id - KpiNetwork(timerange: $timerange, filterQuery: $filterQuery, defaultIndex: $defaultIndex) { - networkEvents - uniqueFlowId - uniqueSourcePrivateIps - uniqueSourcePrivateIpsHistogram { - ...KpiNetworkChartFields - } - uniqueDestinationPrivateIps - uniqueDestinationPrivateIpsHistogram { - ...KpiNetworkChartFields - } - dnsQueries - tlsHandshakes - inspect @include(if: $inspect) { - dsl - response - } - } - } -} - ${KpiNetworkChartFieldsFragmentDoc}`; -export type GetKpiNetworkQueryComponentProps = Omit, 'query'> & ({ variables: GetKpiNetworkQueryQueryVariables; skip?: boolean; } | { skip: boolean; }); - - export const GetKpiNetworkQueryComponent = (props: GetKpiNetworkQueryComponentProps) => ( - query={GetKpiNetworkQueryDocument} {...props} /> - ); - - -/** - * __useGetKpiNetworkQueryQuery__ - * - * To run a query within a React component, call `useGetKpiNetworkQueryQuery` and pass it any options that fit your needs. - * When your component renders, `useGetKpiNetworkQueryQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useGetKpiNetworkQueryQuery({ - * variables: { - * sourceId: // value for 'sourceId' - * timerange: // value for 'timerange' - * filterQuery: // value for 'filterQuery' - * defaultIndex: // value for 'defaultIndex' - * inspect: // value for 'inspect' - * }, - * }); - */ -export function useGetKpiNetworkQueryQuery(baseOptions?: ApolloReactHooks.QueryHookOptions) { - return ApolloReactHooks.useQuery(GetKpiNetworkQueryDocument, baseOptions); - } -export function useGetKpiNetworkQueryLazyQuery(baseOptions?: ApolloReactHooks.LazyQueryHookOptions) { - return ApolloReactHooks.useLazyQuery(GetKpiNetworkQueryDocument, baseOptions); - } -export type GetKpiNetworkQueryQueryHookResult = ReturnType; -export type GetKpiNetworkQueryLazyQueryHookResult = ReturnType; -export type GetKpiNetworkQueryQueryResult = ApolloReactCommon.QueryResult; -export const GetMatrixHistogramQueryDocument = gql` - query GetMatrixHistogramQuery($defaultIndex: [String!]!, $filterQuery: String, $histogramType: HistogramType!, $inspect: Boolean!, $sourceId: ID!, $stackByField: String!, $timerange: TimerangeInput!) { - source(id: $sourceId) { - id - MatrixHistogram(timerange: $timerange, filterQuery: $filterQuery, defaultIndex: $defaultIndex, stackByField: $stackByField, histogramType: $histogramType) { - matrixHistogramData { - x - y - g - } - totalCount - inspect @include(if: $inspect) { - dsl - response - } - } - } -} - `; -export type GetMatrixHistogramQueryComponentProps = Omit, 'query'> & ({ variables: GetMatrixHistogramQueryQueryVariables; skip?: boolean; } | { skip: boolean; }); - - export const GetMatrixHistogramQueryComponent = (props: GetMatrixHistogramQueryComponentProps) => ( - query={GetMatrixHistogramQueryDocument} {...props} /> - ); - - -/** - * __useGetMatrixHistogramQueryQuery__ - * - * To run a query within a React component, call `useGetMatrixHistogramQueryQuery` and pass it any options that fit your needs. - * When your component renders, `useGetMatrixHistogramQueryQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useGetMatrixHistogramQueryQuery({ - * variables: { - * defaultIndex: // value for 'defaultIndex' - * filterQuery: // value for 'filterQuery' - * histogramType: // value for 'histogramType' - * inspect: // value for 'inspect' - * sourceId: // value for 'sourceId' - * stackByField: // value for 'stackByField' - * timerange: // value for 'timerange' - * }, - * }); - */ -export function useGetMatrixHistogramQueryQuery(baseOptions?: ApolloReactHooks.QueryHookOptions) { - return ApolloReactHooks.useQuery(GetMatrixHistogramQueryDocument, baseOptions); - } -export function useGetMatrixHistogramQueryLazyQuery(baseOptions?: ApolloReactHooks.LazyQueryHookOptions) { - return ApolloReactHooks.useLazyQuery(GetMatrixHistogramQueryDocument, baseOptions); - } -export type GetMatrixHistogramQueryQueryHookResult = ReturnType; -export type GetMatrixHistogramQueryLazyQueryHookResult = ReturnType; -export type GetMatrixHistogramQueryQueryResult = ApolloReactCommon.QueryResult; -export const GetNetworkDnsQueryDocument = gql` - query GetNetworkDnsQuery($defaultIndex: [String!]!, $filterQuery: String, $inspect: Boolean!, $isPtrIncluded: Boolean!, $pagination: PaginationInputPaginated!, $sort: NetworkDnsSortField!, $sourceId: ID!, $stackByField: String, $timerange: TimerangeInput!) { - source(id: $sourceId) { - id - NetworkDns(isPtrIncluded: $isPtrIncluded, sort: $sort, timerange: $timerange, pagination: $pagination, filterQuery: $filterQuery, defaultIndex: $defaultIndex, stackByField: $stackByField) { - totalCount - edges { - node { - _id - dnsBytesIn - dnsBytesOut - dnsName - queryCount - uniqueDomains - } - cursor { - value - } - } - pageInfo { - activePage - fakeTotalCount - showMorePagesIndicator - } - inspect @include(if: $inspect) { - dsl - response - } - } - } -} - `; -export type GetNetworkDnsQueryComponentProps = Omit, 'query'> & ({ variables: GetNetworkDnsQueryQueryVariables; skip?: boolean; } | { skip: boolean; }); - - export const GetNetworkDnsQueryComponent = (props: GetNetworkDnsQueryComponentProps) => ( - query={GetNetworkDnsQueryDocument} {...props} /> - ); - - -/** - * __useGetNetworkDnsQueryQuery__ - * - * To run a query within a React component, call `useGetNetworkDnsQueryQuery` and pass it any options that fit your needs. - * When your component renders, `useGetNetworkDnsQueryQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useGetNetworkDnsQueryQuery({ - * variables: { - * defaultIndex: // value for 'defaultIndex' - * filterQuery: // value for 'filterQuery' - * inspect: // value for 'inspect' - * isPtrIncluded: // value for 'isPtrIncluded' - * pagination: // value for 'pagination' - * sort: // value for 'sort' - * sourceId: // value for 'sourceId' - * stackByField: // value for 'stackByField' - * timerange: // value for 'timerange' - * }, - * }); - */ -export function useGetNetworkDnsQueryQuery(baseOptions?: ApolloReactHooks.QueryHookOptions) { - return ApolloReactHooks.useQuery(GetNetworkDnsQueryDocument, baseOptions); - } -export function useGetNetworkDnsQueryLazyQuery(baseOptions?: ApolloReactHooks.LazyQueryHookOptions) { - return ApolloReactHooks.useLazyQuery(GetNetworkDnsQueryDocument, baseOptions); - } -export type GetNetworkDnsQueryQueryHookResult = ReturnType; -export type GetNetworkDnsQueryLazyQueryHookResult = ReturnType; -export type GetNetworkDnsQueryQueryResult = ApolloReactCommon.QueryResult; -export const GetNetworkHttpQueryDocument = gql` - query GetNetworkHttpQuery($sourceId: ID!, $ip: String, $filterQuery: String, $pagination: PaginationInputPaginated!, $sort: NetworkHttpSortField!, $timerange: TimerangeInput!, $defaultIndex: [String!]!, $inspect: Boolean!) { - source(id: $sourceId) { - id - NetworkHttp(filterQuery: $filterQuery, ip: $ip, pagination: $pagination, sort: $sort, timerange: $timerange, defaultIndex: $defaultIndex) { - totalCount - edges { - node { - domains - lastHost - lastSourceIp - methods - path - requestCount - statuses - } - cursor { - value - } - } - pageInfo { - activePage - fakeTotalCount - showMorePagesIndicator - } - inspect @include(if: $inspect) { - dsl - response - } - } - } -} - `; -export type GetNetworkHttpQueryComponentProps = Omit, 'query'> & ({ variables: GetNetworkHttpQueryQueryVariables; skip?: boolean; } | { skip: boolean; }); - - export const GetNetworkHttpQueryComponent = (props: GetNetworkHttpQueryComponentProps) => ( - query={GetNetworkHttpQueryDocument} {...props} /> - ); - - -/** - * __useGetNetworkHttpQueryQuery__ - * - * To run a query within a React component, call `useGetNetworkHttpQueryQuery` and pass it any options that fit your needs. - * When your component renders, `useGetNetworkHttpQueryQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useGetNetworkHttpQueryQuery({ - * variables: { - * sourceId: // value for 'sourceId' - * ip: // value for 'ip' - * filterQuery: // value for 'filterQuery' - * pagination: // value for 'pagination' - * sort: // value for 'sort' - * timerange: // value for 'timerange' - * defaultIndex: // value for 'defaultIndex' - * inspect: // value for 'inspect' - * }, - * }); - */ -export function useGetNetworkHttpQueryQuery(baseOptions?: ApolloReactHooks.QueryHookOptions) { - return ApolloReactHooks.useQuery(GetNetworkHttpQueryDocument, baseOptions); - } -export function useGetNetworkHttpQueryLazyQuery(baseOptions?: ApolloReactHooks.LazyQueryHookOptions) { - return ApolloReactHooks.useLazyQuery(GetNetworkHttpQueryDocument, baseOptions); - } -export type GetNetworkHttpQueryQueryHookResult = ReturnType; -export type GetNetworkHttpQueryLazyQueryHookResult = ReturnType; -export type GetNetworkHttpQueryQueryResult = ApolloReactCommon.QueryResult; -export const GetNetworkTopCountriesQueryDocument = gql` - query GetNetworkTopCountriesQuery($sourceId: ID!, $ip: String, $filterQuery: String, $pagination: PaginationInputPaginated!, $sort: NetworkTopTablesSortField!, $flowTarget: FlowTargetSourceDest!, $timerange: TimerangeInput!, $defaultIndex: [String!]!, $inspect: Boolean!) { - source(id: $sourceId) { - id - NetworkTopCountries(filterQuery: $filterQuery, flowTarget: $flowTarget, ip: $ip, pagination: $pagination, sort: $sort, timerange: $timerange, defaultIndex: $defaultIndex) { - totalCount - edges { - node { - source { - country - destination_ips - flows - source_ips - } - destination { - country - destination_ips - flows - source_ips - } - network { - bytes_in - bytes_out - } - } - cursor { - value - } - } - pageInfo { - activePage - fakeTotalCount - showMorePagesIndicator - } - inspect @include(if: $inspect) { - dsl - response - } - } - } -} - `; -export type GetNetworkTopCountriesQueryComponentProps = Omit, 'query'> & ({ variables: GetNetworkTopCountriesQueryQueryVariables; skip?: boolean; } | { skip: boolean; }); - - export const GetNetworkTopCountriesQueryComponent = (props: GetNetworkTopCountriesQueryComponentProps) => ( - query={GetNetworkTopCountriesQueryDocument} {...props} /> - ); - - -/** - * __useGetNetworkTopCountriesQueryQuery__ - * - * To run a query within a React component, call `useGetNetworkTopCountriesQueryQuery` and pass it any options that fit your needs. - * When your component renders, `useGetNetworkTopCountriesQueryQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useGetNetworkTopCountriesQueryQuery({ - * variables: { - * sourceId: // value for 'sourceId' - * ip: // value for 'ip' - * filterQuery: // value for 'filterQuery' - * pagination: // value for 'pagination' - * sort: // value for 'sort' - * flowTarget: // value for 'flowTarget' - * timerange: // value for 'timerange' - * defaultIndex: // value for 'defaultIndex' - * inspect: // value for 'inspect' - * }, - * }); - */ -export function useGetNetworkTopCountriesQueryQuery(baseOptions?: ApolloReactHooks.QueryHookOptions) { - return ApolloReactHooks.useQuery(GetNetworkTopCountriesQueryDocument, baseOptions); - } -export function useGetNetworkTopCountriesQueryLazyQuery(baseOptions?: ApolloReactHooks.LazyQueryHookOptions) { - return ApolloReactHooks.useLazyQuery(GetNetworkTopCountriesQueryDocument, baseOptions); - } -export type GetNetworkTopCountriesQueryQueryHookResult = ReturnType; -export type GetNetworkTopCountriesQueryLazyQueryHookResult = ReturnType; -export type GetNetworkTopCountriesQueryQueryResult = ApolloReactCommon.QueryResult; -export const GetNetworkTopNFlowQueryDocument = gql` - query GetNetworkTopNFlowQuery($sourceId: ID!, $ip: String, $filterQuery: String, $pagination: PaginationInputPaginated!, $sort: NetworkTopTablesSortField!, $flowTarget: FlowTargetSourceDest!, $timerange: TimerangeInput!, $defaultIndex: [String!]!, $inspect: Boolean!) { - source(id: $sourceId) { - id - NetworkTopNFlow(filterQuery: $filterQuery, flowTarget: $flowTarget, ip: $ip, pagination: $pagination, sort: $sort, timerange: $timerange, defaultIndex: $defaultIndex) { - totalCount - edges { - node { - source { - autonomous_system { - name - number - } - domain - ip - location { - geo { - continent_name - country_name - country_iso_code - city_name - region_iso_code - region_name - } - flowTarget - } - flows - destination_ips - } - destination { - autonomous_system { - name - number - } - domain - ip - location { - geo { - continent_name - country_name - country_iso_code - city_name - region_iso_code - region_name - } - flowTarget - } - flows - source_ips - } - network { - bytes_in - bytes_out - } - } - cursor { - value - } - } - pageInfo { - activePage - fakeTotalCount - showMorePagesIndicator - } - inspect @include(if: $inspect) { - dsl - response - } - } - } -} - `; -export type GetNetworkTopNFlowQueryComponentProps = Omit, 'query'> & ({ variables: GetNetworkTopNFlowQueryQueryVariables; skip?: boolean; } | { skip: boolean; }); - - export const GetNetworkTopNFlowQueryComponent = (props: GetNetworkTopNFlowQueryComponentProps) => ( - query={GetNetworkTopNFlowQueryDocument} {...props} /> - ); - - -/** - * __useGetNetworkTopNFlowQueryQuery__ - * - * To run a query within a React component, call `useGetNetworkTopNFlowQueryQuery` and pass it any options that fit your needs. - * When your component renders, `useGetNetworkTopNFlowQueryQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useGetNetworkTopNFlowQueryQuery({ - * variables: { - * sourceId: // value for 'sourceId' - * ip: // value for 'ip' - * filterQuery: // value for 'filterQuery' - * pagination: // value for 'pagination' - * sort: // value for 'sort' - * flowTarget: // value for 'flowTarget' - * timerange: // value for 'timerange' - * defaultIndex: // value for 'defaultIndex' - * inspect: // value for 'inspect' - * }, - * }); - */ -export function useGetNetworkTopNFlowQueryQuery(baseOptions?: ApolloReactHooks.QueryHookOptions) { - return ApolloReactHooks.useQuery(GetNetworkTopNFlowQueryDocument, baseOptions); - } -export function useGetNetworkTopNFlowQueryLazyQuery(baseOptions?: ApolloReactHooks.LazyQueryHookOptions) { - return ApolloReactHooks.useLazyQuery(GetNetworkTopNFlowQueryDocument, baseOptions); - } -export type GetNetworkTopNFlowQueryQueryHookResult = ReturnType; -export type GetNetworkTopNFlowQueryLazyQueryHookResult = ReturnType; -export type GetNetworkTopNFlowQueryQueryResult = ApolloReactCommon.QueryResult; -export const GetOverviewHostQueryDocument = gql` - query GetOverviewHostQuery($sourceId: ID!, $timerange: TimerangeInput!, $filterQuery: String, $defaultIndex: [String!]!, $inspect: Boolean!) { - source(id: $sourceId) { - id - OverviewHost(timerange: $timerange, filterQuery: $filterQuery, defaultIndex: $defaultIndex) { - auditbeatAuditd - auditbeatFIM - auditbeatLogin - auditbeatPackage - auditbeatProcess - auditbeatUser - endgameDns - endgameFile - endgameImageLoad - endgameNetwork - endgameProcess - endgameRegistry - endgameSecurity - filebeatSystemModule - winlogbeatSecurity - winlogbeatMWSysmonOperational - inspect @include(if: $inspect) { - dsl - response - } - } - } -} - `; -export type GetOverviewHostQueryComponentProps = Omit, 'query'> & ({ variables: GetOverviewHostQueryQueryVariables; skip?: boolean; } | { skip: boolean; }); - - export const GetOverviewHostQueryComponent = (props: GetOverviewHostQueryComponentProps) => ( - query={GetOverviewHostQueryDocument} {...props} /> - ); - - -/** - * __useGetOverviewHostQueryQuery__ - * - * To run a query within a React component, call `useGetOverviewHostQueryQuery` and pass it any options that fit your needs. - * When your component renders, `useGetOverviewHostQueryQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useGetOverviewHostQueryQuery({ - * variables: { - * sourceId: // value for 'sourceId' - * timerange: // value for 'timerange' - * filterQuery: // value for 'filterQuery' - * defaultIndex: // value for 'defaultIndex' - * inspect: // value for 'inspect' - * }, - * }); - */ -export function useGetOverviewHostQueryQuery(baseOptions?: ApolloReactHooks.QueryHookOptions) { - return ApolloReactHooks.useQuery(GetOverviewHostQueryDocument, baseOptions); - } -export function useGetOverviewHostQueryLazyQuery(baseOptions?: ApolloReactHooks.LazyQueryHookOptions) { - return ApolloReactHooks.useLazyQuery(GetOverviewHostQueryDocument, baseOptions); - } -export type GetOverviewHostQueryQueryHookResult = ReturnType; -export type GetOverviewHostQueryLazyQueryHookResult = ReturnType; -export type GetOverviewHostQueryQueryResult = ApolloReactCommon.QueryResult; -export const GetOverviewNetworkQueryDocument = gql` - query GetOverviewNetworkQuery($sourceId: ID!, $timerange: TimerangeInput!, $filterQuery: String, $defaultIndex: [String!]!, $inspect: Boolean!) { - source(id: $sourceId) { - id - OverviewNetwork(timerange: $timerange, filterQuery: $filterQuery, defaultIndex: $defaultIndex) { - auditbeatSocket - filebeatCisco - filebeatNetflow - filebeatPanw - filebeatSuricata - filebeatZeek - packetbeatDNS - packetbeatFlow - packetbeatTLS - inspect @include(if: $inspect) { - dsl - response - } - } - } -} - `; -export type GetOverviewNetworkQueryComponentProps = Omit, 'query'> & ({ variables: GetOverviewNetworkQueryQueryVariables; skip?: boolean; } | { skip: boolean; }); - - export const GetOverviewNetworkQueryComponent = (props: GetOverviewNetworkQueryComponentProps) => ( - query={GetOverviewNetworkQueryDocument} {...props} /> - ); - - -/** - * __useGetOverviewNetworkQueryQuery__ - * - * To run a query within a React component, call `useGetOverviewNetworkQueryQuery` and pass it any options that fit your needs. - * When your component renders, `useGetOverviewNetworkQueryQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useGetOverviewNetworkQueryQuery({ - * variables: { - * sourceId: // value for 'sourceId' - * timerange: // value for 'timerange' - * filterQuery: // value for 'filterQuery' - * defaultIndex: // value for 'defaultIndex' - * inspect: // value for 'inspect' - * }, - * }); - */ -export function useGetOverviewNetworkQueryQuery(baseOptions?: ApolloReactHooks.QueryHookOptions) { - return ApolloReactHooks.useQuery(GetOverviewNetworkQueryDocument, baseOptions); - } -export function useGetOverviewNetworkQueryLazyQuery(baseOptions?: ApolloReactHooks.LazyQueryHookOptions) { - return ApolloReactHooks.useLazyQuery(GetOverviewNetworkQueryDocument, baseOptions); - } -export type GetOverviewNetworkQueryQueryHookResult = ReturnType; -export type GetOverviewNetworkQueryLazyQueryHookResult = ReturnType; -export type GetOverviewNetworkQueryQueryResult = ApolloReactCommon.QueryResult; -export const SourceQueryDocument = gql` - query SourceQuery($sourceId: ID = "default", $defaultIndex: [String!]!) { - source(id: $sourceId) { - id - status { - indicesExist(defaultIndex: $defaultIndex) - indexFields(defaultIndex: $defaultIndex) { - category - description - example - indexes - name - searchable - type - aggregatable - format - } - } - } -} - `; -export type SourceQueryComponentProps = Omit, 'query'> & ({ variables: SourceQueryQueryVariables; skip?: boolean; } | { skip: boolean; }); - - export const SourceQueryComponent = (props: SourceQueryComponentProps) => ( - query={SourceQueryDocument} {...props} /> - ); - - -/** - * __useSourceQueryQuery__ - * - * To run a query within a React component, call `useSourceQueryQuery` and pass it any options that fit your needs. - * When your component renders, `useSourceQueryQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useSourceQueryQuery({ - * variables: { - * sourceId: // value for 'sourceId' - * defaultIndex: // value for 'defaultIndex' - * }, - * }); - */ -export function useSourceQueryQuery(baseOptions?: ApolloReactHooks.QueryHookOptions) { - return ApolloReactHooks.useQuery(SourceQueryDocument, baseOptions); - } -export function useSourceQueryLazyQuery(baseOptions?: ApolloReactHooks.LazyQueryHookOptions) { - return ApolloReactHooks.useLazyQuery(SourceQueryDocument, baseOptions); - } -export type SourceQueryQueryHookResult = ReturnType; -export type SourceQueryLazyQueryHookResult = ReturnType; -export type SourceQueryQueryResult = ApolloReactCommon.QueryResult; -export const GetAllTimelineDocument = gql` - query GetAllTimeline($pageInfo: PageInfoTimeline!, $search: String, $sort: SortTimeline, $onlyUserFavorite: Boolean) { - getAllTimeline(pageInfo: $pageInfo, search: $search, sort: $sort, onlyUserFavorite: $onlyUserFavorite) { - totalCount - timeline { - savedObjectId - description - favorite { - fullName - userName - favoriteDate - } - eventIdToNoteIds { - eventId - note - timelineId - noteId - created - createdBy - timelineVersion - updated - updatedBy - version - } - notes { - eventId - note - timelineId - timelineVersion - noteId - created - createdBy - updated - updatedBy - version - } - noteIds - pinnedEventIds - title - created - createdBy - updated - updatedBy - version - } - } -} - `; -export type GetAllTimelineComponentProps = Omit, 'query'> & ({ variables: GetAllTimelineQueryVariables; skip?: boolean; } | { skip: boolean; }); - - export const GetAllTimelineComponent = (props: GetAllTimelineComponentProps) => ( - query={GetAllTimelineDocument} {...props} /> - ); - - -/** - * __useGetAllTimelineQuery__ - * - * To run a query within a React component, call `useGetAllTimelineQuery` and pass it any options that fit your needs. - * When your component renders, `useGetAllTimelineQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useGetAllTimelineQuery({ - * variables: { - * pageInfo: // value for 'pageInfo' - * search: // value for 'search' - * sort: // value for 'sort' - * onlyUserFavorite: // value for 'onlyUserFavorite' - * }, - * }); - */ -export function useGetAllTimelineQuery(baseOptions?: ApolloReactHooks.QueryHookOptions) { - return ApolloReactHooks.useQuery(GetAllTimelineDocument, baseOptions); - } -export function useGetAllTimelineLazyQuery(baseOptions?: ApolloReactHooks.LazyQueryHookOptions) { - return ApolloReactHooks.useLazyQuery(GetAllTimelineDocument, baseOptions); - } -export type GetAllTimelineQueryHookResult = ReturnType; -export type GetAllTimelineLazyQueryHookResult = ReturnType; -export type GetAllTimelineQueryResult = ApolloReactCommon.QueryResult; -export const DeleteTimelineMutationDocument = gql` - mutation DeleteTimelineMutation($id: [ID!]!) { - deleteTimeline(id: $id) -} - `; -export type DeleteTimelineMutationMutationFn = ApolloReactCommon.MutationFunction; -export type DeleteTimelineMutationComponentProps = Omit, 'mutation'>; - - export const DeleteTimelineMutationComponent = (props: DeleteTimelineMutationComponentProps) => ( - mutation={DeleteTimelineMutationDocument} {...props} /> - ); - - -/** - * __useDeleteTimelineMutationMutation__ - * - * To run a mutation, you first call `useDeleteTimelineMutationMutation` within a React component and pass it any options that fit your needs. - * When your component renders, `useDeleteTimelineMutationMutation` returns a tuple that includes: - * - A mutate function that you can call at any time to execute the mutation - * - An object with fields that represent the current status of the mutation's execution - * - * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2; - * - * @example - * const [deleteTimelineMutationMutation, { data, loading, error }] = useDeleteTimelineMutationMutation({ - * variables: { - * id: // value for 'id' - * }, - * }); - */ -export function useDeleteTimelineMutationMutation(baseOptions?: ApolloReactHooks.MutationHookOptions) { - return ApolloReactHooks.useMutation(DeleteTimelineMutationDocument, baseOptions); - } -export type DeleteTimelineMutationMutationHookResult = ReturnType; -export type DeleteTimelineMutationMutationResult = ApolloReactCommon.MutationResult; -export type DeleteTimelineMutationMutationOptions = ApolloReactCommon.BaseMutationOptions; -export const GetTimelineDetailsQueryDocument = gql` - query GetTimelineDetailsQuery($sourceId: ID!, $eventId: String!, $indexName: String!, $defaultIndex: [String!]!) { - source(id: $sourceId) { - id - TimelineDetails(eventId: $eventId, indexName: $indexName, defaultIndex: $defaultIndex) { - data { - field - values - originalValue - } - } - } -} - `; -export type GetTimelineDetailsQueryComponentProps = Omit, 'query'> & ({ variables: GetTimelineDetailsQueryQueryVariables; skip?: boolean; } | { skip: boolean; }); - - export const GetTimelineDetailsQueryComponent = (props: GetTimelineDetailsQueryComponentProps) => ( - query={GetTimelineDetailsQueryDocument} {...props} /> - ); - - -/** - * __useGetTimelineDetailsQueryQuery__ - * - * To run a query within a React component, call `useGetTimelineDetailsQueryQuery` and pass it any options that fit your needs. - * When your component renders, `useGetTimelineDetailsQueryQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useGetTimelineDetailsQueryQuery({ - * variables: { - * sourceId: // value for 'sourceId' - * eventId: // value for 'eventId' - * indexName: // value for 'indexName' - * defaultIndex: // value for 'defaultIndex' - * }, - * }); - */ -export function useGetTimelineDetailsQueryQuery(baseOptions?: ApolloReactHooks.QueryHookOptions) { - return ApolloReactHooks.useQuery(GetTimelineDetailsQueryDocument, baseOptions); - } -export function useGetTimelineDetailsQueryLazyQuery(baseOptions?: ApolloReactHooks.LazyQueryHookOptions) { - return ApolloReactHooks.useLazyQuery(GetTimelineDetailsQueryDocument, baseOptions); - } -export type GetTimelineDetailsQueryQueryHookResult = ReturnType; -export type GetTimelineDetailsQueryLazyQueryHookResult = ReturnType; -export type GetTimelineDetailsQueryQueryResult = ApolloReactCommon.QueryResult; -export const PersistTimelineFavoriteMutationDocument = gql` - mutation PersistTimelineFavoriteMutation($timelineId: ID) { - persistFavorite(timelineId: $timelineId) { - savedObjectId - version - favorite { - fullName - userName - favoriteDate - } - } -} - `; -export type PersistTimelineFavoriteMutationMutationFn = ApolloReactCommon.MutationFunction; -export type PersistTimelineFavoriteMutationComponentProps = Omit, 'mutation'>; - - export const PersistTimelineFavoriteMutationComponent = (props: PersistTimelineFavoriteMutationComponentProps) => ( - mutation={PersistTimelineFavoriteMutationDocument} {...props} /> - ); - - -/** - * __usePersistTimelineFavoriteMutationMutation__ - * - * To run a mutation, you first call `usePersistTimelineFavoriteMutationMutation` within a React component and pass it any options that fit your needs. - * When your component renders, `usePersistTimelineFavoriteMutationMutation` returns a tuple that includes: - * - A mutate function that you can call at any time to execute the mutation - * - An object with fields that represent the current status of the mutation's execution - * - * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2; - * - * @example - * const [persistTimelineFavoriteMutationMutation, { data, loading, error }] = usePersistTimelineFavoriteMutationMutation({ - * variables: { - * timelineId: // value for 'timelineId' - * }, - * }); - */ -export function usePersistTimelineFavoriteMutationMutation(baseOptions?: ApolloReactHooks.MutationHookOptions) { - return ApolloReactHooks.useMutation(PersistTimelineFavoriteMutationDocument, baseOptions); - } -export type PersistTimelineFavoriteMutationMutationHookResult = ReturnType; -export type PersistTimelineFavoriteMutationMutationResult = ApolloReactCommon.MutationResult; -export type PersistTimelineFavoriteMutationMutationOptions = ApolloReactCommon.BaseMutationOptions; -export const GetTimelineQueryDocument = gql` - query GetTimelineQuery($sourceId: ID!, $fieldRequested: [String!]!, $pagination: PaginationInput!, $sortField: SortField!, $filterQuery: String, $defaultIndex: [String!]!, $inspect: Boolean!) { - source(id: $sourceId) { - id - Timeline(fieldRequested: $fieldRequested, pagination: $pagination, sortField: $sortField, filterQuery: $filterQuery, defaultIndex: $defaultIndex) { - totalCount - inspect @include(if: $inspect) { - dsl - response - } - pageInfo { - endCursor { - value - tiebreaker - } - hasNextPage - } - edges { - node { - _id - _index - data { - field - value - } - ecs { - _id - _index - timestamp - message - system { - auth { - ssh { - signature - method - } - } - audit { - package { - arch - entity_id - name - size - summary - version - } - } - } - event { - action - category - code - created - dataset - duration - end - hash - id - kind - module - original - outcome - risk_score - risk_score_norm - severity - start - timezone - type - } - auditd { - result - session - data { - acct - terminal - op - } - summary { - actor { - primary - secondary - } - object { - primary - secondary - type - } - how - message_type - sequence - } - } - file { - name - path - target_path - extension - type - device - inode - uid - owner - gid - group - mode - size - mtime - ctime - } - host { - id - name - ip - } - rule { - reference - } - source { - bytes - ip - packets - port - geo { - continent_name - country_name - country_iso_code - city_name - region_iso_code - region_name - } - } - destination { - bytes - ip - packets - port - geo { - continent_name - country_name - country_iso_code - city_name - region_iso_code - region_name - } - } - dns { - question { - name - type - } - resolved_ip - response_code - } - endgame { - exit_code - file_name - file_path - logon_type - parent_process_name - pid - process_name - subject_domain_name - subject_logon_id - subject_user_name - target_domain_name - target_logon_id - target_user_name - } - geo { - region_name - country_iso_code - } - signal { - original_time - rule { - id - saved_id - timeline_id - timeline_title - output_index - from - index - language - query - to - filters - } - } - suricata { - eve { - proto - flow_id - alert { - signature - signature_id - } - } - } - network { - bytes - community_id - direction - packets - protocol - transport - } - http { - version - request { - method - body { - bytes - content - } - referrer - } - response { - status_code - body { - bytes - content - } - } - } - tls { - client_certificate { - fingerprint { - sha1 - } - } - fingerprints { - ja3 { - hash - } - } - server_certificate { - fingerprint { - sha1 - } - } - } - url { - original - domain - username - password - } - user { - domain - name - } - winlog { - event_id - } - process { - hash { - md5 - sha1 - sha256 - } - pid - name - ppid - args - executable - title - working_directory - } - zeek { - session_id - connection { - local_resp - local_orig - missed_bytes - state - history - } - notice { - suppress_for - msg - note - sub - dst - dropped - peer_descr - } - dns { - AA - qclass_name - RD - qtype_name - rejected - qtype - query - trans_id - qclass - RA - TC - } - http { - resp_mime_types - trans_depth - status_msg - resp_fuids - tags - } - files { - session_ids - timedout - local_orig - tx_host - source - is_orig - overflow_bytes - sha1 - duration - depth - analyzers - mime_type - rx_host - total_bytes - fuid - seen_bytes - missing_bytes - md5 - } - ssl { - cipher - established - resumed - version - } - } - } - } - } - } - } -} - `; -export type GetTimelineQueryComponentProps = Omit, 'query'> & ({ variables: GetTimelineQueryQueryVariables; skip?: boolean; } | { skip: boolean; }); - - export const GetTimelineQueryComponent = (props: GetTimelineQueryComponentProps) => ( - query={GetTimelineQueryDocument} {...props} /> - ); - - -/** - * __useGetTimelineQueryQuery__ - * - * To run a query within a React component, call `useGetTimelineQueryQuery` and pass it any options that fit your needs. - * When your component renders, `useGetTimelineQueryQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useGetTimelineQueryQuery({ - * variables: { - * sourceId: // value for 'sourceId' - * fieldRequested: // value for 'fieldRequested' - * pagination: // value for 'pagination' - * sortField: // value for 'sortField' - * filterQuery: // value for 'filterQuery' - * defaultIndex: // value for 'defaultIndex' - * inspect: // value for 'inspect' - * }, - * }); - */ -export function useGetTimelineQueryQuery(baseOptions?: ApolloReactHooks.QueryHookOptions) { - return ApolloReactHooks.useQuery(GetTimelineQueryDocument, baseOptions); - } -export function useGetTimelineQueryLazyQuery(baseOptions?: ApolloReactHooks.LazyQueryHookOptions) { - return ApolloReactHooks.useLazyQuery(GetTimelineQueryDocument, baseOptions); - } -export type GetTimelineQueryQueryHookResult = ReturnType; -export type GetTimelineQueryLazyQueryHookResult = ReturnType; -export type GetTimelineQueryQueryResult = ApolloReactCommon.QueryResult; -export const PersistTimelineNoteMutationDocument = gql` - mutation PersistTimelineNoteMutation($noteId: ID, $version: String, $note: NoteInput!) { - persistNote(noteId: $noteId, version: $version, note: $note) { - code - message - note { - eventId - note - timelineId - timelineVersion - noteId - created - createdBy - updated - updatedBy - version - } - } -} - `; -export type PersistTimelineNoteMutationMutationFn = ApolloReactCommon.MutationFunction; -export type PersistTimelineNoteMutationComponentProps = Omit, 'mutation'>; - - export const PersistTimelineNoteMutationComponent = (props: PersistTimelineNoteMutationComponentProps) => ( - mutation={PersistTimelineNoteMutationDocument} {...props} /> - ); - - -/** - * __usePersistTimelineNoteMutationMutation__ - * - * To run a mutation, you first call `usePersistTimelineNoteMutationMutation` within a React component and pass it any options that fit your needs. - * When your component renders, `usePersistTimelineNoteMutationMutation` returns a tuple that includes: - * - A mutate function that you can call at any time to execute the mutation - * - An object with fields that represent the current status of the mutation's execution - * - * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2; - * - * @example - * const [persistTimelineNoteMutationMutation, { data, loading, error }] = usePersistTimelineNoteMutationMutation({ - * variables: { - * noteId: // value for 'noteId' - * version: // value for 'version' - * note: // value for 'note' - * }, - * }); - */ -export function usePersistTimelineNoteMutationMutation(baseOptions?: ApolloReactHooks.MutationHookOptions) { - return ApolloReactHooks.useMutation(PersistTimelineNoteMutationDocument, baseOptions); - } -export type PersistTimelineNoteMutationMutationHookResult = ReturnType; -export type PersistTimelineNoteMutationMutationResult = ApolloReactCommon.MutationResult; -export type PersistTimelineNoteMutationMutationOptions = ApolloReactCommon.BaseMutationOptions; -export const GetOneTimelineDocument = gql` - query GetOneTimeline($id: ID!) { - getOneTimeline(id: $id) { - savedObjectId - columns { - aggregatable - category - columnHeaderType - description - example - indexes - id - name - searchable - type - } - dataProviders { - id - name - enabled - excluded - kqlQuery - queryMatch { - field - displayField - value - displayValue - operator - } - and { - id - name - enabled - excluded - kqlQuery - queryMatch { - field - displayField - value - displayValue - operator - } - } - } - dateRange { - start - end - } - description - eventType - eventIdToNoteIds { - eventId - note - timelineId - noteId - created - createdBy - timelineVersion - updated - updatedBy - version - } - favorite { - fullName - userName - favoriteDate - } - filters { - meta { - alias - controlledBy - disabled - field - formattedValue - index - key - negate - params - type - value - } - query - exists - match_all - missing - range - script - } - kqlMode - kqlQuery { - filterQuery { - kuery { - kind - expression - } - serializedQuery - } - } - notes { - eventId - note - timelineId - timelineVersion - noteId - created - createdBy - updated - updatedBy - version - } - noteIds - pinnedEventIds - pinnedEventsSaveObject { - pinnedEventId - eventId - timelineId - created - createdBy - updated - updatedBy - version - } - title - savedQueryId - sort { - columnId - sortDirection - } - created - createdBy - updated - updatedBy - version - } -} - `; -export type GetOneTimelineComponentProps = Omit, 'query'> & ({ variables: GetOneTimelineQueryVariables; skip?: boolean; } | { skip: boolean; }); - - export const GetOneTimelineComponent = (props: GetOneTimelineComponentProps) => ( - query={GetOneTimelineDocument} {...props} /> - ); - - -/** - * __useGetOneTimelineQuery__ - * - * To run a query within a React component, call `useGetOneTimelineQuery` and pass it any options that fit your needs. - * When your component renders, `useGetOneTimelineQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useGetOneTimelineQuery({ - * variables: { - * id: // value for 'id' - * }, - * }); - */ -export function useGetOneTimelineQuery(baseOptions?: ApolloReactHooks.QueryHookOptions) { - return ApolloReactHooks.useQuery(GetOneTimelineDocument, baseOptions); - } -export function useGetOneTimelineLazyQuery(baseOptions?: ApolloReactHooks.LazyQueryHookOptions) { - return ApolloReactHooks.useLazyQuery(GetOneTimelineDocument, baseOptions); - } -export type GetOneTimelineQueryHookResult = ReturnType; -export type GetOneTimelineLazyQueryHookResult = ReturnType; -export type GetOneTimelineQueryResult = ApolloReactCommon.QueryResult; -export const PersistTimelineMutationDocument = gql` - mutation PersistTimelineMutation($timelineId: ID, $version: String, $timeline: TimelineInput!) { - persistTimeline(id: $timelineId, version: $version, timeline: $timeline) { - code - message - timeline { - savedObjectId - version - columns { - aggregatable - category - columnHeaderType - description - example - indexes - id - name - searchable - type - } - dataProviders { - id - name - enabled - excluded - kqlQuery - queryMatch { - field - displayField - value - displayValue - operator - } - and { - id - name - enabled - excluded - kqlQuery - queryMatch { - field - displayField - value - displayValue - operator - } - } - } - description - eventType - favorite { - fullName - userName - favoriteDate - } - filters { - meta { - alias - controlledBy - disabled - field - formattedValue - index - key - negate - params - type - value - } - query - exists - match_all - missing - range - script - } - kqlMode - kqlQuery { - filterQuery { - kuery { - kind - expression - } - serializedQuery - } - } - title - dateRange { - start - end - } - savedQueryId - sort { - columnId - sortDirection - } - created - createdBy - updated - updatedBy - } - } -} - `; -export type PersistTimelineMutationMutationFn = ApolloReactCommon.MutationFunction; -export type PersistTimelineMutationComponentProps = Omit, 'mutation'>; - - export const PersistTimelineMutationComponent = (props: PersistTimelineMutationComponentProps) => ( - mutation={PersistTimelineMutationDocument} {...props} /> - ); - - -/** - * __usePersistTimelineMutationMutation__ - * - * To run a mutation, you first call `usePersistTimelineMutationMutation` within a React component and pass it any options that fit your needs. - * When your component renders, `usePersistTimelineMutationMutation` returns a tuple that includes: - * - A mutate function that you can call at any time to execute the mutation - * - An object with fields that represent the current status of the mutation's execution - * - * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2; - * - * @example - * const [persistTimelineMutationMutation, { data, loading, error }] = usePersistTimelineMutationMutation({ - * variables: { - * timelineId: // value for 'timelineId' - * version: // value for 'version' - * timeline: // value for 'timeline' - * }, - * }); - */ -export function usePersistTimelineMutationMutation(baseOptions?: ApolloReactHooks.MutationHookOptions) { - return ApolloReactHooks.useMutation(PersistTimelineMutationDocument, baseOptions); - } -export type PersistTimelineMutationMutationHookResult = ReturnType; -export type PersistTimelineMutationMutationResult = ApolloReactCommon.MutationResult; -export type PersistTimelineMutationMutationOptions = ApolloReactCommon.BaseMutationOptions; -export const PersistTimelinePinnedEventMutationDocument = gql` - mutation PersistTimelinePinnedEventMutation($pinnedEventId: ID, $eventId: ID!, $timelineId: ID) { - persistPinnedEventOnTimeline(pinnedEventId: $pinnedEventId, eventId: $eventId, timelineId: $timelineId) { - pinnedEventId - eventId - timelineId - timelineVersion - created - createdBy - updated - updatedBy - version - } -} - `; -export type PersistTimelinePinnedEventMutationMutationFn = ApolloReactCommon.MutationFunction; -export type PersistTimelinePinnedEventMutationComponentProps = Omit, 'mutation'>; - - export const PersistTimelinePinnedEventMutationComponent = (props: PersistTimelinePinnedEventMutationComponentProps) => ( - mutation={PersistTimelinePinnedEventMutationDocument} {...props} /> - ); - - -/** - * __usePersistTimelinePinnedEventMutationMutation__ - * - * To run a mutation, you first call `usePersistTimelinePinnedEventMutationMutation` within a React component and pass it any options that fit your needs. - * When your component renders, `usePersistTimelinePinnedEventMutationMutation` returns a tuple that includes: - * - A mutate function that you can call at any time to execute the mutation - * - An object with fields that represent the current status of the mutation's execution - * - * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2; - * - * @example - * const [persistTimelinePinnedEventMutationMutation, { data, loading, error }] = usePersistTimelinePinnedEventMutationMutation({ - * variables: { - * pinnedEventId: // value for 'pinnedEventId' - * eventId: // value for 'eventId' - * timelineId: // value for 'timelineId' - * }, - * }); - */ -export function usePersistTimelinePinnedEventMutationMutation(baseOptions?: ApolloReactHooks.MutationHookOptions) { - return ApolloReactHooks.useMutation(PersistTimelinePinnedEventMutationDocument, baseOptions); - } -export type PersistTimelinePinnedEventMutationMutationHookResult = ReturnType; -export type PersistTimelinePinnedEventMutationMutationResult = ApolloReactCommon.MutationResult; -export type PersistTimelinePinnedEventMutationMutationOptions = ApolloReactCommon.BaseMutationOptions; -export const GetTlsQueryDocument = gql` - query GetTlsQuery($sourceId: ID!, $filterQuery: String, $flowTarget: FlowTargetSourceDest!, $ip: String!, $pagination: PaginationInputPaginated!, $sort: TlsSortField!, $timerange: TimerangeInput!, $defaultIndex: [String!]!, $inspect: Boolean!) { - source(id: $sourceId) { - id - Tls(filterQuery: $filterQuery, flowTarget: $flowTarget, ip: $ip, pagination: $pagination, sort: $sort, timerange: $timerange, defaultIndex: $defaultIndex) { - totalCount - edges { - node { - _id - alternativeNames - commonNames - ja3 - issuerNames - notAfter - } - cursor { - value - } - } - pageInfo { - activePage - fakeTotalCount - showMorePagesIndicator - } - inspect @include(if: $inspect) { - dsl - response - } - } - } -} - `; -export type GetTlsQueryComponentProps = Omit, 'query'> & ({ variables: GetTlsQueryQueryVariables; skip?: boolean; } | { skip: boolean; }); - - export const GetTlsQueryComponent = (props: GetTlsQueryComponentProps) => ( - query={GetTlsQueryDocument} {...props} /> - ); - - -/** - * __useGetTlsQueryQuery__ - * - * To run a query within a React component, call `useGetTlsQueryQuery` and pass it any options that fit your needs. - * When your component renders, `useGetTlsQueryQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useGetTlsQueryQuery({ - * variables: { - * sourceId: // value for 'sourceId' - * filterQuery: // value for 'filterQuery' - * flowTarget: // value for 'flowTarget' - * ip: // value for 'ip' - * pagination: // value for 'pagination' - * sort: // value for 'sort' - * timerange: // value for 'timerange' - * defaultIndex: // value for 'defaultIndex' - * inspect: // value for 'inspect' - * }, - * }); - */ -export function useGetTlsQueryQuery(baseOptions?: ApolloReactHooks.QueryHookOptions) { - return ApolloReactHooks.useQuery(GetTlsQueryDocument, baseOptions); - } -export function useGetTlsQueryLazyQuery(baseOptions?: ApolloReactHooks.LazyQueryHookOptions) { - return ApolloReactHooks.useLazyQuery(GetTlsQueryDocument, baseOptions); - } -export type GetTlsQueryQueryHookResult = ReturnType; -export type GetTlsQueryLazyQueryHookResult = ReturnType; -export type GetTlsQueryQueryResult = ApolloReactCommon.QueryResult; -export const GetUncommonProcessesQueryDocument = gql` - query GetUncommonProcessesQuery($sourceId: ID!, $timerange: TimerangeInput!, $pagination: PaginationInputPaginated!, $filterQuery: String, $defaultIndex: [String!]!, $inspect: Boolean!) { - source(id: $sourceId) { - id - UncommonProcesses(timerange: $timerange, pagination: $pagination, filterQuery: $filterQuery, defaultIndex: $defaultIndex) { - totalCount - edges { - node { - _id - instances - process { - args - name - } - user { - id - name - } - hosts { - name - } - } - cursor { - value - } - } - pageInfo { - activePage - fakeTotalCount - showMorePagesIndicator - } - inspect @include(if: $inspect) { - dsl - response - } - } - } -} - `; -export type GetUncommonProcessesQueryComponentProps = Omit, 'query'> & ({ variables: GetUncommonProcessesQueryQueryVariables; skip?: boolean; } | { skip: boolean; }); - - export const GetUncommonProcessesQueryComponent = (props: GetUncommonProcessesQueryComponentProps) => ( - query={GetUncommonProcessesQueryDocument} {...props} /> - ); - - -/** - * __useGetUncommonProcessesQueryQuery__ - * - * To run a query within a React component, call `useGetUncommonProcessesQueryQuery` and pass it any options that fit your needs. - * When your component renders, `useGetUncommonProcessesQueryQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useGetUncommonProcessesQueryQuery({ - * variables: { - * sourceId: // value for 'sourceId' - * timerange: // value for 'timerange' - * pagination: // value for 'pagination' - * filterQuery: // value for 'filterQuery' - * defaultIndex: // value for 'defaultIndex' - * inspect: // value for 'inspect' - * }, - * }); - */ -export function useGetUncommonProcessesQueryQuery(baseOptions?: ApolloReactHooks.QueryHookOptions) { - return ApolloReactHooks.useQuery(GetUncommonProcessesQueryDocument, baseOptions); - } -export function useGetUncommonProcessesQueryLazyQuery(baseOptions?: ApolloReactHooks.LazyQueryHookOptions) { - return ApolloReactHooks.useLazyQuery(GetUncommonProcessesQueryDocument, baseOptions); - } -export type GetUncommonProcessesQueryQueryHookResult = ReturnType; -export type GetUncommonProcessesQueryLazyQueryHookResult = ReturnType; -export type GetUncommonProcessesQueryQueryResult = ApolloReactCommon.QueryResult; -export const GetUsersQueryDocument = gql` - query GetUsersQuery($sourceId: ID!, $filterQuery: String, $flowTarget: FlowTarget!, $ip: String!, $pagination: PaginationInputPaginated!, $sort: UsersSortField!, $timerange: TimerangeInput!, $defaultIndex: [String!]!, $inspect: Boolean!) { - source(id: $sourceId) { - id - Users(filterQuery: $filterQuery, flowTarget: $flowTarget, ip: $ip, pagination: $pagination, sort: $sort, timerange: $timerange, defaultIndex: $defaultIndex) { - totalCount - edges { - node { - user { - name - id - groupId - groupName - count - } - } - cursor { - value - } - } - pageInfo { - activePage - fakeTotalCount - showMorePagesIndicator - } - inspect @include(if: $inspect) { - dsl - response - } - } - } -} - `; -export type GetUsersQueryComponentProps = Omit, 'query'> & ({ variables: GetUsersQueryQueryVariables; skip?: boolean; } | { skip: boolean; }); - - export const GetUsersQueryComponent = (props: GetUsersQueryComponentProps) => ( - query={GetUsersQueryDocument} {...props} /> - ); - - -/** - * __useGetUsersQueryQuery__ - * - * To run a query within a React component, call `useGetUsersQueryQuery` and pass it any options that fit your needs. - * When your component renders, `useGetUsersQueryQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useGetUsersQueryQuery({ - * variables: { - * sourceId: // value for 'sourceId' - * filterQuery: // value for 'filterQuery' - * flowTarget: // value for 'flowTarget' - * ip: // value for 'ip' - * pagination: // value for 'pagination' - * sort: // value for 'sort' - * timerange: // value for 'timerange' - * defaultIndex: // value for 'defaultIndex' - * inspect: // value for 'inspect' - * }, - * }); - */ -export function useGetUsersQueryQuery(baseOptions?: ApolloReactHooks.QueryHookOptions) { - return ApolloReactHooks.useQuery(GetUsersQueryDocument, baseOptions); - } -export function useGetUsersQueryLazyQuery(baseOptions?: ApolloReactHooks.LazyQueryHookOptions) { - return ApolloReactHooks.useLazyQuery(GetUsersQueryDocument, baseOptions); - } -export type GetUsersQueryQueryHookResult = ReturnType; -export type GetUsersQueryLazyQueryHookResult = ReturnType; -export type GetUsersQueryQueryResult = ApolloReactCommon.QueryResult; -export namespace GetAuthenticationsQuery { - export type Variables = GetAuthenticationsQueryQueryVariables; - export type Query = GetAuthenticationsQueryQuery; - export type Source = GetAuthenticationsQueryQuery['source']; - export type Authentications = GetAuthenticationsQueryQuery['source']['Authentications']; - export type Edges = (NonNullable); - export type Node = (NonNullable)['node']; - export type User = (NonNullable)['node']['user']; - export type LastSuccess = (NonNullable<(NonNullable)['node']['lastSuccess']>); - export type _Source = (NonNullable<(NonNullable<(NonNullable)['node']['lastSuccess']>)['source']>); - export type Host = (NonNullable<(NonNullable<(NonNullable)['node']['lastSuccess']>)['host']>); - export type LastFailure = (NonNullable<(NonNullable)['node']['lastFailure']>); - export type __Source = (NonNullable<(NonNullable<(NonNullable)['node']['lastFailure']>)['source']>); - export type _Host = (NonNullable<(NonNullable<(NonNullable)['node']['lastFailure']>)['host']>); - export type Cursor = (NonNullable)['cursor']; - export type PageInfo = GetAuthenticationsQueryQuery['source']['Authentications']['pageInfo']; - export type Inspect = (NonNullable); - export const Document = GetAuthenticationsQueryDocument; - export const Component = GetAuthenticationsQueryComponent; - export const use = useGetAuthenticationsQueryQuery; -} - -export namespace GetLastEventTimeQuery { - export type Variables = GetLastEventTimeQueryQueryVariables; - export type Query = GetLastEventTimeQueryQuery; - export type Source = GetLastEventTimeQueryQuery['source']; - export type LastEventTime = GetLastEventTimeQueryQuery['source']['LastEventTime']; - export const Document = GetLastEventTimeQueryDocument; - export const Component = GetLastEventTimeQueryComponent; - export const use = useGetLastEventTimeQueryQuery; -} - -export namespace GetHostFirstLastSeenQuery { - export type Variables = GetHostFirstLastSeenQueryQueryVariables; - export type Query = GetHostFirstLastSeenQueryQuery; - export type Source = GetHostFirstLastSeenQueryQuery['source']; - export type HostFirstLastSeen = GetHostFirstLastSeenQueryQuery['source']['HostFirstLastSeen']; - export const Document = GetHostFirstLastSeenQueryDocument; - export const Component = GetHostFirstLastSeenQueryComponent; - export const use = useGetHostFirstLastSeenQueryQuery; -} - -export namespace GetHostsTableQuery { - export type Variables = GetHostsTableQueryQueryVariables; - export type Query = GetHostsTableQueryQuery; - export type Source = GetHostsTableQueryQuery['source']; - export type Hosts = GetHostsTableQueryQuery['source']['Hosts']; - export type Edges = (NonNullable); - export type Node = (NonNullable)['node']; - export type Host = (NonNullable<(NonNullable)['node']['host']>); - export type Os = (NonNullable<(NonNullable<(NonNullable)['node']['host']>)['os']>); - export type Cursor = (NonNullable)['cursor']; - export type PageInfo = GetHostsTableQueryQuery['source']['Hosts']['pageInfo']; - export type Inspect = (NonNullable); - export const Document = GetHostsTableQueryDocument; - export const Component = GetHostsTableQueryComponent; - export const use = useGetHostsTableQueryQuery; -} - -export namespace GetHostOverviewQuery { - export type Variables = GetHostOverviewQueryQueryVariables; - export type Query = GetHostOverviewQueryQuery; - export type Source = GetHostOverviewQueryQuery['source']; - export type HostOverview = GetHostOverviewQueryQuery['source']['HostOverview']; - export type Host = (NonNullable); - export type Os = (NonNullable<(NonNullable)['os']>); - export type Cloud = (NonNullable); - export type Instance = (NonNullable<(NonNullable)['instance']>); - export type Machine = (NonNullable<(NonNullable)['machine']>); - export type Inspect = (NonNullable); - export const Document = GetHostOverviewQueryDocument; - export const Component = GetHostOverviewQueryComponent; - export const use = useGetHostOverviewQueryQuery; -} - -export namespace GetIpOverviewQuery { - export type Variables = GetIpOverviewQueryQueryVariables; - export type Query = GetIpOverviewQueryQuery; - export type Source = GetIpOverviewQueryQuery['source']; - export type IpOverview = (NonNullable); - export type _Source = (NonNullable<(NonNullable)['source']>); - export type AutonomousSystem = (NonNullable<(NonNullable)['source']>)['autonomousSystem']; - export type Organization = (NonNullable<(NonNullable<(NonNullable)['source']>)['autonomousSystem']['organization']>); - export type Geo = (NonNullable<(NonNullable)['source']>)['geo']; - export type Location = (NonNullable<(NonNullable<(NonNullable)['source']>)['geo']['location']>); - export type Destination = (NonNullable<(NonNullable)['destination']>); - export type _AutonomousSystem = (NonNullable<(NonNullable)['destination']>)['autonomousSystem']; - export type _Organization = (NonNullable<(NonNullable<(NonNullable)['destination']>)['autonomousSystem']['organization']>); - export type _Geo = (NonNullable<(NonNullable)['destination']>)['geo']; - export type _Location = (NonNullable<(NonNullable<(NonNullable)['destination']>)['geo']['location']>); - export type Host = (NonNullable)['host']; - export type Os = (NonNullable<(NonNullable)['host']['os']>); - export type Inspect = (NonNullable<(NonNullable)['inspect']>); - export const Document = GetIpOverviewQueryDocument; - export const Component = GetIpOverviewQueryComponent; - export const use = useGetIpOverviewQueryQuery; -} - -export namespace KpiHostDetailsChartFields { - export type Fragment = KpiHostDetailsChartFieldsFragment; -} - -export namespace GetKpiHostDetailsQuery { - export type Variables = GetKpiHostDetailsQueryQueryVariables; - export type Query = GetKpiHostDetailsQueryQuery; - export type Source = GetKpiHostDetailsQueryQuery['source']; - export type KpiHostDetails = GetKpiHostDetailsQueryQuery['source']['KpiHostDetails']; - export type AuthSuccessHistogram = KpiHostDetailsChartFieldsFragment; - export type AuthFailureHistogram = KpiHostDetailsChartFieldsFragment; - export type UniqueSourceIpsHistogram = KpiHostDetailsChartFieldsFragment; - export type UniqueDestinationIpsHistogram = KpiHostDetailsChartFieldsFragment; - export type Inspect = (NonNullable); - export const Document = GetKpiHostDetailsQueryDocument; - export const Component = GetKpiHostDetailsQueryComponent; - export const use = useGetKpiHostDetailsQueryQuery; -} - -export namespace KpiHostChartFields { - export type Fragment = KpiHostChartFieldsFragment; -} - -export namespace GetKpiHostsQuery { - export type Variables = GetKpiHostsQueryQueryVariables; - export type Query = GetKpiHostsQueryQuery; - export type Source = GetKpiHostsQueryQuery['source']; - export type KpiHosts = GetKpiHostsQueryQuery['source']['KpiHosts']; - export type HostsHistogram = KpiHostChartFieldsFragment; - export type AuthSuccessHistogram = KpiHostChartFieldsFragment; - export type AuthFailureHistogram = KpiHostChartFieldsFragment; - export type UniqueSourceIpsHistogram = KpiHostChartFieldsFragment; - export type UniqueDestinationIpsHistogram = KpiHostChartFieldsFragment; - export type Inspect = (NonNullable); - export const Document = GetKpiHostsQueryDocument; - export const Component = GetKpiHostsQueryComponent; - export const use = useGetKpiHostsQueryQuery; -} - -export namespace KpiNetworkChartFields { - export type Fragment = KpiNetworkChartFieldsFragment; -} - -export namespace GetKpiNetworkQuery { - export type Variables = GetKpiNetworkQueryQueryVariables; - export type Query = GetKpiNetworkQueryQuery; - export type Source = GetKpiNetworkQueryQuery['source']; - export type KpiNetwork = (NonNullable); - export type UniqueSourcePrivateIpsHistogram = KpiNetworkChartFieldsFragment; - export type UniqueDestinationPrivateIpsHistogram = KpiNetworkChartFieldsFragment; - export type Inspect = (NonNullable<(NonNullable)['inspect']>); - export const Document = GetKpiNetworkQueryDocument; - export const Component = GetKpiNetworkQueryComponent; - export const use = useGetKpiNetworkQueryQuery; -} - -export namespace GetMatrixHistogramQuery { - export type Variables = GetMatrixHistogramQueryQueryVariables; - export type Query = GetMatrixHistogramQueryQuery; - export type Source = GetMatrixHistogramQueryQuery['source']; - export type MatrixHistogram = GetMatrixHistogramQueryQuery['source']['MatrixHistogram']; - export type MatrixHistogramData = (NonNullable); - export type Inspect = (NonNullable); - export const Document = GetMatrixHistogramQueryDocument; - export const Component = GetMatrixHistogramQueryComponent; - export const use = useGetMatrixHistogramQueryQuery; -} - -export namespace GetNetworkDnsQuery { - export type Variables = GetNetworkDnsQueryQueryVariables; - export type Query = GetNetworkDnsQueryQuery; - export type Source = GetNetworkDnsQueryQuery['source']; - export type NetworkDns = GetNetworkDnsQueryQuery['source']['NetworkDns']; - export type Edges = (NonNullable); - export type Node = (NonNullable)['node']; - export type Cursor = (NonNullable)['cursor']; - export type PageInfo = GetNetworkDnsQueryQuery['source']['NetworkDns']['pageInfo']; - export type Inspect = (NonNullable); - export const Document = GetNetworkDnsQueryDocument; - export const Component = GetNetworkDnsQueryComponent; - export const use = useGetNetworkDnsQueryQuery; -} - -export namespace GetNetworkHttpQuery { - export type Variables = GetNetworkHttpQueryQueryVariables; - export type Query = GetNetworkHttpQueryQuery; - export type Source = GetNetworkHttpQueryQuery['source']; - export type NetworkHttp = GetNetworkHttpQueryQuery['source']['NetworkHttp']; - export type Edges = (NonNullable); - export type Node = (NonNullable)['node']; - export type Cursor = (NonNullable)['cursor']; - export type PageInfo = GetNetworkHttpQueryQuery['source']['NetworkHttp']['pageInfo']; - export type Inspect = (NonNullable); - export const Document = GetNetworkHttpQueryDocument; - export const Component = GetNetworkHttpQueryComponent; - export const use = useGetNetworkHttpQueryQuery; -} - -export namespace GetNetworkTopCountriesQuery { - export type Variables = GetNetworkTopCountriesQueryQueryVariables; - export type Query = GetNetworkTopCountriesQueryQuery; - export type Source = GetNetworkTopCountriesQueryQuery['source']; - export type NetworkTopCountries = GetNetworkTopCountriesQueryQuery['source']['NetworkTopCountries']; - export type Edges = (NonNullable); - export type Node = (NonNullable)['node']; - export type _Source = (NonNullable<(NonNullable)['node']['source']>); - export type Destination = (NonNullable<(NonNullable)['node']['destination']>); - export type Network = (NonNullable<(NonNullable)['node']['network']>); - export type Cursor = (NonNullable)['cursor']; - export type PageInfo = GetNetworkTopCountriesQueryQuery['source']['NetworkTopCountries']['pageInfo']; - export type Inspect = (NonNullable); - export const Document = GetNetworkTopCountriesQueryDocument; - export const Component = GetNetworkTopCountriesQueryComponent; - export const use = useGetNetworkTopCountriesQueryQuery; -} - -export namespace GetNetworkTopNFlowQuery { - export type Variables = GetNetworkTopNFlowQueryQueryVariables; - export type Query = GetNetworkTopNFlowQueryQuery; - export type Source = GetNetworkTopNFlowQueryQuery['source']; - export type NetworkTopNFlow = GetNetworkTopNFlowQueryQuery['source']['NetworkTopNFlow']; - export type Edges = (NonNullable); - export type Node = (NonNullable)['node']; - export type _Source = (NonNullable<(NonNullable)['node']['source']>); - export type AutonomousSystem = (NonNullable<(NonNullable<(NonNullable)['node']['source']>)['autonomous_system']>); - export type Location = (NonNullable<(NonNullable<(NonNullable)['node']['source']>)['location']>); - export type Geo = (NonNullable<(NonNullable<(NonNullable<(NonNullable)['node']['source']>)['location']>)['geo']>); - export type Destination = (NonNullable<(NonNullable)['node']['destination']>); - export type _AutonomousSystem = (NonNullable<(NonNullable<(NonNullable)['node']['destination']>)['autonomous_system']>); - export type _Location = (NonNullable<(NonNullable<(NonNullable)['node']['destination']>)['location']>); - export type _Geo = (NonNullable<(NonNullable<(NonNullable<(NonNullable)['node']['destination']>)['location']>)['geo']>); - export type Network = (NonNullable<(NonNullable)['node']['network']>); - export type Cursor = (NonNullable)['cursor']; - export type PageInfo = GetNetworkTopNFlowQueryQuery['source']['NetworkTopNFlow']['pageInfo']; - export type Inspect = (NonNullable); - export const Document = GetNetworkTopNFlowQueryDocument; - export const Component = GetNetworkTopNFlowQueryComponent; - export const use = useGetNetworkTopNFlowQueryQuery; -} - -export namespace GetOverviewHostQuery { - export type Variables = GetOverviewHostQueryQueryVariables; - export type Query = GetOverviewHostQueryQuery; - export type Source = GetOverviewHostQueryQuery['source']; - export type OverviewHost = (NonNullable); - export type Inspect = (NonNullable<(NonNullable)['inspect']>); - export const Document = GetOverviewHostQueryDocument; - export const Component = GetOverviewHostQueryComponent; - export const use = useGetOverviewHostQueryQuery; -} - -export namespace GetOverviewNetworkQuery { - export type Variables = GetOverviewNetworkQueryQueryVariables; - export type Query = GetOverviewNetworkQueryQuery; - export type Source = GetOverviewNetworkQueryQuery['source']; - export type OverviewNetwork = (NonNullable); - export type Inspect = (NonNullable<(NonNullable)['inspect']>); - export const Document = GetOverviewNetworkQueryDocument; - export const Component = GetOverviewNetworkQueryComponent; - export const use = useGetOverviewNetworkQueryQuery; -} - -export namespace SourceQuery { - export type Variables = SourceQueryQueryVariables; - export type Query = SourceQueryQuery; - export type Source = SourceQueryQuery['source']; - export type Status = SourceQueryQuery['source']['status']; - export type IndexFields = (NonNullable); - export const Document = SourceQueryDocument; - export const Component = SourceQueryComponent; - export const use = useSourceQueryQuery; -} - -export namespace GetAllTimeline { - export type Variables = GetAllTimelineQueryVariables; - export type Query = GetAllTimelineQuery; - export type GetAllTimeline = GetAllTimelineQuery['getAllTimeline']; - export type Timeline = (NonNullable); - export type Favorite = (NonNullable<(NonNullable<(NonNullable)['favorite']>)[0]>); - export type EventIdToNoteIds = (NonNullable<(NonNullable<(NonNullable)['eventIdToNoteIds']>)[0]>); - export type Notes = (NonNullable<(NonNullable<(NonNullable)['notes']>)[0]>); - export const Document = GetAllTimelineDocument; - export const Component = GetAllTimelineComponent; - export const use = useGetAllTimelineQuery; -} - -export namespace DeleteTimelineMutation { - export type Variables = DeleteTimelineMutationMutationVariables; - export type Mutation = DeleteTimelineMutationMutation; - export const Document = DeleteTimelineMutationDocument; - export const Component = DeleteTimelineMutationComponent; - export const use = useDeleteTimelineMutationMutation; -} - -export namespace GetTimelineDetailsQuery { - export type Variables = GetTimelineDetailsQueryQueryVariables; - export type Query = GetTimelineDetailsQueryQuery; - export type Source = GetTimelineDetailsQueryQuery['source']; - export type TimelineDetails = GetTimelineDetailsQueryQuery['source']['TimelineDetails']; - export type Data = (NonNullable<(NonNullable)[0]>); - export const Document = GetTimelineDetailsQueryDocument; - export const Component = GetTimelineDetailsQueryComponent; - export const use = useGetTimelineDetailsQueryQuery; -} - -export namespace PersistTimelineFavoriteMutation { - export type Variables = PersistTimelineFavoriteMutationMutationVariables; - export type Mutation = PersistTimelineFavoriteMutationMutation; - export type PersistFavorite = PersistTimelineFavoriteMutationMutation['persistFavorite']; - export type Favorite = (NonNullable<(NonNullable)[0]>); - export const Document = PersistTimelineFavoriteMutationDocument; - export const Component = PersistTimelineFavoriteMutationComponent; - export const use = usePersistTimelineFavoriteMutationMutation; -} - -export namespace GetTimelineQuery { - export type Variables = GetTimelineQueryQueryVariables; - export type Query = GetTimelineQueryQuery; - export type Source = GetTimelineQueryQuery['source']; - export type Timeline = GetTimelineQueryQuery['source']['Timeline']; - export type Inspect = (NonNullable); - export type PageInfo = GetTimelineQueryQuery['source']['Timeline']['pageInfo']; - export type EndCursor = (NonNullable); - export type Edges = (NonNullable); - export type Node = (NonNullable)['node']; - export type Data = (NonNullable<(NonNullable)['node']['data'][0]>); - export type Ecs = (NonNullable)['node']['ecs']; - export type System = (NonNullable<(NonNullable)['node']['ecs']['system']>); - export type Auth = (NonNullable<(NonNullable<(NonNullable)['node']['ecs']['system']>)['auth']>); - export type Ssh = (NonNullable<(NonNullable<(NonNullable<(NonNullable)['node']['ecs']['system']>)['auth']>)['ssh']>); - export type Audit = (NonNullable<(NonNullable<(NonNullable)['node']['ecs']['system']>)['audit']>); - export type Package = (NonNullable<(NonNullable<(NonNullable<(NonNullable)['node']['ecs']['system']>)['audit']>)['package']>); - export type Event = (NonNullable<(NonNullable)['node']['ecs']['event']>); - export type Auditd = (NonNullable<(NonNullable)['node']['ecs']['auditd']>); - export type _Data = (NonNullable<(NonNullable<(NonNullable)['node']['ecs']['auditd']>)['data']>); - export type Summary = (NonNullable<(NonNullable<(NonNullable)['node']['ecs']['auditd']>)['summary']>); - export type Actor = (NonNullable<(NonNullable<(NonNullable<(NonNullable)['node']['ecs']['auditd']>)['summary']>)['actor']>); - export type Object = (NonNullable<(NonNullable<(NonNullable<(NonNullable)['node']['ecs']['auditd']>)['summary']>)['object']>); - export type File = (NonNullable<(NonNullable)['node']['ecs']['file']>); - export type Host = (NonNullable<(NonNullable)['node']['ecs']['host']>); - export type Rule = (NonNullable<(NonNullable)['node']['ecs']['rule']>); - export type _Source = (NonNullable<(NonNullable)['node']['ecs']['source']>); - export type Geo = (NonNullable<(NonNullable<(NonNullable)['node']['ecs']['source']>)['geo']>); - export type Destination = (NonNullable<(NonNullable)['node']['ecs']['destination']>); - export type _Geo = (NonNullable<(NonNullable<(NonNullable)['node']['ecs']['destination']>)['geo']>); - export type Dns = (NonNullable<(NonNullable)['node']['ecs']['dns']>); - export type Question = (NonNullable<(NonNullable<(NonNullable)['node']['ecs']['dns']>)['question']>); - export type Endgame = (NonNullable<(NonNullable)['node']['ecs']['endgame']>); - export type __Geo = (NonNullable<(NonNullable)['node']['ecs']['geo']>); - export type Signal = (NonNullable<(NonNullable)['node']['ecs']['signal']>); - export type _Rule = (NonNullable<(NonNullable<(NonNullable)['node']['ecs']['signal']>)['rule']>); - export type Suricata = (NonNullable<(NonNullable)['node']['ecs']['suricata']>); - export type Eve = (NonNullable<(NonNullable<(NonNullable)['node']['ecs']['suricata']>)['eve']>); - export type Alert = (NonNullable<(NonNullable<(NonNullable<(NonNullable)['node']['ecs']['suricata']>)['eve']>)['alert']>); - export type Network = (NonNullable<(NonNullable)['node']['ecs']['network']>); - export type Http = (NonNullable<(NonNullable)['node']['ecs']['http']>); - export type Request = (NonNullable<(NonNullable<(NonNullable)['node']['ecs']['http']>)['request']>); - export type Body = (NonNullable<(NonNullable<(NonNullable<(NonNullable)['node']['ecs']['http']>)['request']>)['body']>); - export type Response = (NonNullable<(NonNullable<(NonNullable)['node']['ecs']['http']>)['response']>); - export type _Body = (NonNullable<(NonNullable<(NonNullable<(NonNullable)['node']['ecs']['http']>)['response']>)['body']>); - export type Tls = (NonNullable<(NonNullable)['node']['ecs']['tls']>); - export type ClientCertificate = (NonNullable<(NonNullable<(NonNullable)['node']['ecs']['tls']>)['client_certificate']>); - export type Fingerprint = (NonNullable<(NonNullable<(NonNullable<(NonNullable)['node']['ecs']['tls']>)['client_certificate']>)['fingerprint']>); - export type Fingerprints = (NonNullable<(NonNullable<(NonNullable)['node']['ecs']['tls']>)['fingerprints']>); - export type Ja3 = (NonNullable<(NonNullable<(NonNullable<(NonNullable)['node']['ecs']['tls']>)['fingerprints']>)['ja3']>); - export type ServerCertificate = (NonNullable<(NonNullable<(NonNullable)['node']['ecs']['tls']>)['server_certificate']>); - export type _Fingerprint = (NonNullable<(NonNullable<(NonNullable<(NonNullable)['node']['ecs']['tls']>)['server_certificate']>)['fingerprint']>); - export type Url = (NonNullable<(NonNullable)['node']['ecs']['url']>); - export type User = (NonNullable<(NonNullable)['node']['ecs']['user']>); - export type Winlog = (NonNullable<(NonNullable)['node']['ecs']['winlog']>); - export type Process = (NonNullable<(NonNullable)['node']['ecs']['process']>); - export type Hash = (NonNullable<(NonNullable<(NonNullable)['node']['ecs']['process']>)['hash']>); - export type Zeek = (NonNullable<(NonNullable)['node']['ecs']['zeek']>); - export type Connection = (NonNullable<(NonNullable<(NonNullable)['node']['ecs']['zeek']>)['connection']>); - export type Notice = (NonNullable<(NonNullable<(NonNullable)['node']['ecs']['zeek']>)['notice']>); - export type _Dns = (NonNullable<(NonNullable<(NonNullable)['node']['ecs']['zeek']>)['dns']>); - export type _Http = (NonNullable<(NonNullable<(NonNullable)['node']['ecs']['zeek']>)['http']>); - export type Files = (NonNullable<(NonNullable<(NonNullable)['node']['ecs']['zeek']>)['files']>); - export type Ssl = (NonNullable<(NonNullable<(NonNullable)['node']['ecs']['zeek']>)['ssl']>); - export const Document = GetTimelineQueryDocument; - export const Component = GetTimelineQueryComponent; - export const use = useGetTimelineQueryQuery; -} - -export namespace PersistTimelineNoteMutation { - export type Variables = PersistTimelineNoteMutationMutationVariables; - export type Mutation = PersistTimelineNoteMutationMutation; - export type PersistNote = PersistTimelineNoteMutationMutation['persistNote']; - export type Note = PersistTimelineNoteMutationMutation['persistNote']['note']; - export const Document = PersistTimelineNoteMutationDocument; - export const Component = PersistTimelineNoteMutationComponent; - export const use = usePersistTimelineNoteMutationMutation; -} - -export namespace GetOneTimeline { - export type Variables = GetOneTimelineQueryVariables; - export type Query = GetOneTimelineQuery; - export type GetOneTimeline = GetOneTimelineQuery['getOneTimeline']; - export type Columns = (NonNullable<(NonNullable)[0]>); - export type DataProviders = (NonNullable<(NonNullable)[0]>); - export type QueryMatch = (NonNullable<(NonNullable<(NonNullable)[0]>)['queryMatch']>); - export type And = (NonNullable<(NonNullable<(NonNullable<(NonNullable)[0]>)['and']>)[0]>); - export type _QueryMatch = (NonNullable<(NonNullable<(NonNullable<(NonNullable<(NonNullable)[0]>)['and']>)[0]>)['queryMatch']>); - export type DateRange = (NonNullable); - export type EventIdToNoteIds = (NonNullable<(NonNullable)[0]>); - export type Favorite = (NonNullable<(NonNullable)[0]>); - export type Filters = (NonNullable<(NonNullable)[0]>); - export type Meta = (NonNullable<(NonNullable<(NonNullable)[0]>)['meta']>); - export type KqlQuery = (NonNullable); - export type FilterQuery = (NonNullable<(NonNullable)['filterQuery']>); - export type Kuery = (NonNullable<(NonNullable<(NonNullable)['filterQuery']>)['kuery']>); - export type Notes = (NonNullable<(NonNullable)[0]>); - export type PinnedEventsSaveObject = (NonNullable<(NonNullable)[0]>); - export type Sort = (NonNullable); - export const Document = GetOneTimelineDocument; - export const Component = GetOneTimelineComponent; - export const use = useGetOneTimelineQuery; -} - -export namespace PersistTimelineMutation { - export type Variables = PersistTimelineMutationMutationVariables; - export type Mutation = PersistTimelineMutationMutation; - export type PersistTimeline = PersistTimelineMutationMutation['persistTimeline']; - export type Timeline = PersistTimelineMutationMutation['persistTimeline']['timeline']; - export type Columns = (NonNullable<(NonNullable)[0]>); - export type DataProviders = (NonNullable<(NonNullable)[0]>); - export type QueryMatch = (NonNullable<(NonNullable<(NonNullable)[0]>)['queryMatch']>); - export type And = (NonNullable<(NonNullable<(NonNullable<(NonNullable)[0]>)['and']>)[0]>); - export type _QueryMatch = (NonNullable<(NonNullable<(NonNullable<(NonNullable<(NonNullable)[0]>)['and']>)[0]>)['queryMatch']>); - export type Favorite = (NonNullable<(NonNullable)[0]>); - export type Filters = (NonNullable<(NonNullable)[0]>); - export type Meta = (NonNullable<(NonNullable<(NonNullable)[0]>)['meta']>); - export type KqlQuery = (NonNullable); - export type FilterQuery = (NonNullable<(NonNullable)['filterQuery']>); - export type Kuery = (NonNullable<(NonNullable<(NonNullable)['filterQuery']>)['kuery']>); - export type DateRange = (NonNullable); - export type Sort = (NonNullable); - export const Document = PersistTimelineMutationDocument; - export const Component = PersistTimelineMutationComponent; - export const use = usePersistTimelineMutationMutation; -} - -export namespace PersistTimelinePinnedEventMutation { - export type Variables = PersistTimelinePinnedEventMutationMutationVariables; - export type Mutation = PersistTimelinePinnedEventMutationMutation; - export type PersistPinnedEventOnTimeline = (NonNullable); - export const Document = PersistTimelinePinnedEventMutationDocument; - export const Component = PersistTimelinePinnedEventMutationComponent; - export const use = usePersistTimelinePinnedEventMutationMutation; -} - -export namespace GetTlsQuery { - export type Variables = GetTlsQueryQueryVariables; - export type Query = GetTlsQueryQuery; - export type Source = GetTlsQueryQuery['source']; - export type Tls = GetTlsQueryQuery['source']['Tls']; - export type Edges = (NonNullable); - export type Node = (NonNullable)['node']; - export type Cursor = (NonNullable)['cursor']; - export type PageInfo = GetTlsQueryQuery['source']['Tls']['pageInfo']; - export type Inspect = (NonNullable); - export const Document = GetTlsQueryDocument; - export const Component = GetTlsQueryComponent; - export const use = useGetTlsQueryQuery; -} - -export namespace GetUncommonProcessesQuery { - export type Variables = GetUncommonProcessesQueryQueryVariables; - export type Query = GetUncommonProcessesQueryQuery; - export type Source = GetUncommonProcessesQueryQuery['source']; - export type UncommonProcesses = GetUncommonProcessesQueryQuery['source']['UncommonProcesses']; - export type Edges = (NonNullable); - export type Node = (NonNullable)['node']; - export type Process = (NonNullable)['node']['process']; - export type User = (NonNullable<(NonNullable)['node']['user']>); - export type Hosts = (NonNullable<(NonNullable)['node']['hosts'][0]>); - export type Cursor = (NonNullable)['cursor']; - export type PageInfo = GetUncommonProcessesQueryQuery['source']['UncommonProcesses']['pageInfo']; - export type Inspect = (NonNullable); - export const Document = GetUncommonProcessesQueryDocument; - export const Component = GetUncommonProcessesQueryComponent; - export const use = useGetUncommonProcessesQueryQuery; -} - -export namespace GetUsersQuery { - export type Variables = GetUsersQueryQueryVariables; - export type Query = GetUsersQueryQuery; - export type Source = GetUsersQueryQuery['source']; - export type Users = GetUsersQueryQuery['source']['Users']; - export type Edges = (NonNullable); - export type Node = (NonNullable)['node']; - export type User = (NonNullable<(NonNullable)['node']['user']>); - export type Cursor = (NonNullable)['cursor']; - export type PageInfo = GetUsersQueryQuery['source']['Users']['pageInfo']; - export type Inspect = (NonNullable); - export const Document = GetUsersQueryDocument; - export const Component = GetUsersQueryComponent; - export const use = useGetUsersQueryQuery; -} diff --git a/x-pack/legacy/plugins/siem/public/lib/compose/helpers.test.ts b/x-pack/legacy/plugins/siem/public/lib/compose/helpers.test.ts index ae7d09d35bc3c..af4521b4f6e2c 100644 --- a/x-pack/legacy/plugins/siem/public/lib/compose/helpers.test.ts +++ b/x-pack/legacy/plugins/siem/public/lib/compose/helpers.test.ts @@ -4,22 +4,37 @@ * you may not use this file except in compliance with the Elastic License. */ +import { InMemoryCache, IntrospectionFragmentMatcher } from 'apollo-cache-inmemory'; import { errorLink, reTryOneTimeOnErrorLink } from '../../containers/errors'; import { getLinks } from './helpers'; -import { HttpLink } from '@apollo/client'; +import { withClientState } from 'apollo-link-state'; +import * as apolloLinkHttp from 'apollo-link-http'; +import introspectionQueryResultData from '../../graphql/introspection.json'; -jest.mock('@apollo/client'); +jest.mock('apollo-cache-inmemory'); +jest.mock('apollo-link-http'); +jest.mock('apollo-link-state'); jest.mock('../../containers/errors'); +const mockWithClientState = 'mockWithClientState'; const mockHttpLink = { mockHttpLink: 'mockHttpLink' }; // @ts-ignore -HttpLink.mockImplementation(() => mockHttpLink); +withClientState.mockReturnValue(mockWithClientState); +// @ts-ignore +apolloLinkHttp.createHttpLink.mockImplementation(() => mockHttpLink); describe('getLinks helper', () => { test('It should return links in correct order', () => { - const links = getLinks(''); + const mockCache = new InMemoryCache({ + dataIdFromObject: () => null, + fragmentMatcher: new IntrospectionFragmentMatcher({ + introspectionQueryResultData, + }), + }); + const links = getLinks(mockCache, 'basePath'); expect(links[0]).toEqual(errorLink); expect(links[1]).toEqual(reTryOneTimeOnErrorLink); - expect(links[2]).toEqual(mockHttpLink); + expect(links[2]).toEqual(mockWithClientState); + expect(links[3]).toEqual(mockHttpLink); }); }); diff --git a/x-pack/legacy/plugins/siem/public/lib/compose/helpers.ts b/x-pack/legacy/plugins/siem/public/lib/compose/helpers.ts index 42ecdd211b927..b698fc55cc5e5 100644 --- a/x-pack/legacy/plugins/siem/public/lib/compose/helpers.ts +++ b/x-pack/legacy/plugins/siem/public/lib/compose/helpers.ts @@ -4,14 +4,20 @@ * you may not use this file except in compliance with the Elastic License. */ -import { HttpLink } from '@apollo/client'; +import { createHttpLink } from 'apollo-link-http'; +import { withClientState } from 'apollo-link-state'; +import { InMemoryCache } from 'apollo-cache-inmemory'; import { errorLink, reTryOneTimeOnErrorLink } from '../../containers/errors'; -export const getLinks = (basePath: string) => [ +export const getLinks = (cache: InMemoryCache, basePath: string) => [ errorLink, reTryOneTimeOnErrorLink, - new HttpLink({ + withClientState({ + cache, + resolvers: {}, + }), + createHttpLink({ credentials: 'same-origin', headers: { 'kbn-xsrf': 'true' }, uri: `${basePath}/api/siem/graphql`, diff --git a/x-pack/legacy/plugins/siem/public/lib/compose/kibana_compose.tsx b/x-pack/legacy/plugins/siem/public/lib/compose/kibana_compose.tsx index 3b670fb14e4b8..c742ced4c504c 100644 --- a/x-pack/legacy/plugins/siem/public/lib/compose/kibana_compose.tsx +++ b/x-pack/legacy/plugins/siem/public/lib/compose/kibana_compose.tsx @@ -4,25 +4,28 @@ * you may not use this file except in compliance with the Elastic License. */ -import { ApolloClient, ApolloLink, InMemoryCache } from '@apollo/client'; +import { InMemoryCache, IntrospectionFragmentMatcher } from 'apollo-cache-inmemory'; +import ApolloClient from 'apollo-client'; +import { ApolloLink } from 'apollo-link'; +import introspectionQueryResultData from '../../graphql/introspection.json'; import { CoreStart } from '../../plugin'; import { AppFrontendLibs } from '../lib'; import { getLinks } from './helpers'; export function compose(core: CoreStart): AppFrontendLibs { + const cache = new InMemoryCache({ + dataIdFromObject: () => null, + fragmentMatcher: new IntrospectionFragmentMatcher({ + introspectionQueryResultData, + }), + }); const basePath = core.http.basePath.get(); const apolloClient = new ApolloClient({ connectToDevTools: process.env.NODE_ENV !== 'production', - cache: new InMemoryCache({ - typePolicies: { - TimelineItem: { - keyFields: ['_id', '_index', 'data'], - }, - }, - }), - link: ApolloLink.from(getLinks(basePath)), + cache, + link: ApolloLink.from(getLinks(cache, basePath)), }); const libs: AppFrontendLibs = { diff --git a/x-pack/legacy/plugins/siem/public/lib/lib.ts b/x-pack/legacy/plugins/siem/public/lib/lib.ts index 084c62acef443..e7b39d2ea50f9 100644 --- a/x-pack/legacy/plugins/siem/public/lib/lib.ts +++ b/x-pack/legacy/plugins/siem/public/lib/lib.ts @@ -5,7 +5,8 @@ */ import { IScope } from 'angular'; -import { ApolloClient, NormalizedCacheObject } from '@apollo/client'; +import { NormalizedCacheObject } from 'apollo-cache-inmemory'; +import ApolloClient from 'apollo-client'; export interface AppFrontendLibs { apolloClient: AppApolloClient; diff --git a/x-pack/legacy/plugins/siem/public/mock/test_providers.tsx b/x-pack/legacy/plugins/siem/public/mock/test_providers.tsx index 28e7b0deafa30..c7692755c1330 100644 --- a/x-pack/legacy/plugins/siem/public/mock/test_providers.tsx +++ b/x-pack/legacy/plugins/siem/public/mock/test_providers.tsx @@ -6,8 +6,11 @@ import euiDarkVars from '@elastic/eui/dist/eui_theme_dark.json'; import { I18nProvider } from '@kbn/i18n/react'; +import { InMemoryCache as Cache } from 'apollo-cache-inmemory'; +import ApolloClient from 'apollo-client'; +import { ApolloLink } from 'apollo-link'; import React from 'react'; -import { ApolloProvider, ApolloClient, ApolloLink, InMemoryCache } from '@apollo/client'; +import { ApolloProvider } from 'react-apollo'; import { DragDropContext, DropResult, ResponderProvided } from 'react-beautiful-dnd'; import { Provider as ReduxStoreProvider } from 'react-redux'; import { Store } from 'redux'; @@ -29,7 +32,7 @@ interface Props { } export const apolloClient = new ApolloClient({ - cache: new InMemoryCache(), + cache: new Cache(), link: new ApolloLink((o, f) => (f ? f(o) : null)), }); diff --git a/x-pack/legacy/plugins/siem/public/mock/timeline_results.ts b/x-pack/legacy/plugins/siem/public/mock/timeline_results.ts index 26b8eb6bc5f15..d6dc0ae131391 100644 --- a/x-pack/legacy/plugins/siem/public/mock/timeline_results.ts +++ b/x-pack/legacy/plugins/siem/public/mock/timeline_results.ts @@ -4,12 +4,15 @@ * you may not use this file except in compliance with the Elastic License. */ -import { MockedResponse } from '@apollo/client/testing'; import { OpenTimelineResult } from '../components/open_timeline/types'; -import { SortFieldTimeline, TimelineResult, Direction } from '../graphql/types'; +import { GetAllTimeline, SortFieldTimeline, TimelineResult, Direction } from '../graphql/types'; import { allTimelinesQuery } from '../containers/timeline/all/index.gql_query'; -export interface MockedProvidedQuery extends MockedResponse { +export interface MockedProvidedQuery { + request: { + query: GetAllTimeline.Query; + variables: GetAllTimeline.Variables; + }; result: { data: { getAllTimeline: { @@ -19,7 +22,6 @@ export interface MockedProvidedQuery extends MockedResponse { }; }; } - /** Mocks results of a query run by the `OpenTimeline` component */ export const mockOpenTimelineQueryResults: MockedProvidedQuery[] = [ { diff --git a/x-pack/legacy/plugins/siem/public/pages/case/case.tsx b/x-pack/legacy/plugins/siem/public/pages/case/case.tsx index 15a6d076f1009..1206ec950deed 100644 --- a/x-pack/legacy/plugins/siem/public/pages/case/case.tsx +++ b/x-pack/legacy/plugins/siem/public/pages/case/case.tsx @@ -6,29 +6,30 @@ import React from 'react'; -import { EuiButton, EuiButtonIcon, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; -import { CaseHeaderPage } from './components/case_header_page'; +import { EuiButton, EuiFlexGroup } from '@elastic/eui'; +import { HeaderPage } from '../../components/header_page'; import { WrapperPage } from '../../components/wrapper_page'; import { AllCases } from './components/all_cases'; import { SpyRoute } from '../../utils/route/spy_routes'; import * as i18n from './translations'; -import { getCreateCaseUrl, getConfigureCasesUrl } from '../../components/link_to'; +import { getCreateCaseUrl } from '../../components/link_to'; + +const badgeOptions = { + beta: true, + text: i18n.PAGE_BADGE_LABEL, + tooltip: i18n.PAGE_BADGE_TOOLTIP, +}; export const CasesPage = React.memo(() => ( <> - + - - - {i18n.CREATE_TITLE} - - - - - + + {i18n.CREATE_TITLE} + - + diff --git a/x-pack/legacy/plugins/siem/public/pages/case/components/case_header_page/index.tsx b/x-pack/legacy/plugins/siem/public/pages/case/components/case_header_page/index.tsx deleted file mode 100644 index ae2664ca6e839..0000000000000 --- a/x-pack/legacy/plugins/siem/public/pages/case/components/case_header_page/index.tsx +++ /dev/null @@ -1,22 +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; - * you may not use this file except in compliance with the Elastic License. - */ - -import React from 'react'; - -import { HeaderPage, HeaderPageProps } from '../../../../components/header_page'; -import * as i18n from './translations'; - -const CaseHeaderPageComponent: React.FC = props => ; - -CaseHeaderPageComponent.defaultProps = { - badgeOptions: { - beta: true, - text: i18n.PAGE_BADGE_LABEL, - tooltip: i18n.PAGE_BADGE_TOOLTIP, - }, -}; - -export const CaseHeaderPage = React.memo(CaseHeaderPageComponent); diff --git a/x-pack/legacy/plugins/siem/public/pages/case/components/case_header_page/translations.ts b/x-pack/legacy/plugins/siem/public/pages/case/components/case_header_page/translations.ts deleted file mode 100644 index 9fcad926c03b8..0000000000000 --- a/x-pack/legacy/plugins/siem/public/pages/case/components/case_header_page/translations.ts +++ /dev/null @@ -1,16 +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; - * you may not use this file except in compliance with the Elastic License. - */ - -import { i18n } from '@kbn/i18n'; - -export const PAGE_BADGE_LABEL = i18n.translate('xpack.siem.case.caseView.pageBadgeLabel', { - defaultMessage: 'Beta', -}); - -export const PAGE_BADGE_TOOLTIP = i18n.translate('xpack.siem.case.caseView.pageBadgeTooltip', { - defaultMessage: - 'Case Workflow is still in beta. Please help us improve by reporting issues or bugs in the Kibana repo.', -}); diff --git a/x-pack/legacy/plugins/siem/public/pages/case/components/case_view/index.tsx b/x-pack/legacy/plugins/siem/public/pages/case/components/case_view/index.tsx index df3e30a698b56..5cd71c5855d34 100644 --- a/x-pack/legacy/plugins/siem/public/pages/case/components/case_view/index.tsx +++ b/x-pack/legacy/plugins/siem/public/pages/case/components/case_view/index.tsx @@ -34,7 +34,6 @@ import { UserActionTree } from '../user_action_tree'; import { UserList } from '../user_list'; import { useUpdateCase } from '../../../../containers/case/use_update_case'; import { WrapperPage } from '../../../../components/wrapper_page'; -import { WhitePageWrapper } from '../wrappers'; interface Props { caseId: string; @@ -53,6 +52,14 @@ const MyWrapper = styled(WrapperPage)` padding-bottom: 0; `; +const BackgroundWrapper = styled.div` + ${({ theme }) => css` + background-color: ${theme.eui.euiColorEmptyShade}; + border-top: ${theme.eui.euiBorderThin}; + height: 100%; + `} +`; + export interface CaseProps { caseId: string; initialData: Case; @@ -272,7 +279,7 @@ export const CaseComponent = React.memo(({ caseId, initialData, isLoa - + @@ -298,7 +305,7 @@ export const CaseComponent = React.memo(({ caseId, initialData, isLoa - + ); }); diff --git a/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/connectors.tsx b/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/connectors.tsx deleted file mode 100644 index 561464e44c703..0000000000000 --- a/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/connectors.tsx +++ /dev/null @@ -1,52 +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; - * you may not use this file except in compliance with the Elastic License. - */ - -import React from 'react'; -import { - EuiDescribedFormGroup, - EuiFormRow, - EuiFlexGroup, - EuiFlexItem, - EuiLink, -} from '@elastic/eui'; - -import styled from 'styled-components'; - -import { ConnectorsDropdown } from './connectors_dropdown'; -import * as i18n from './translations'; - -const EuiFormRowExtended = styled(EuiFormRow)` - .euiFormRow__labelWrapper { - .euiFormRow__label { - width: 100%; - } - } -`; - -const ConnectorsComponent: React.FC = () => { - const dropDownLabel = ( - - {i18n.INCIDENT_MANAGEMENT_SYSTEM_LABEL} - - {i18n.ADD_NEW_CONNECTOR} - - - ); - - return ( - {i18n.INCIDENT_MANAGEMENT_SYSTEM_TITLE}} - description={i18n.INCIDENT_MANAGEMENT_SYSTEM_DESC} - > - - - - - ); -}; - -export const Connectors = React.memo(ConnectorsComponent); diff --git a/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/connectors_dropdown/index.tsx b/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/connectors_dropdown/index.tsx deleted file mode 100644 index c00baa04d78a0..0000000000000 --- a/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/connectors_dropdown/index.tsx +++ /dev/null @@ -1,56 +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; - * you may not use this file except in compliance with the Elastic License. - */ - -import React, { useState, useCallback } from 'react'; -import { EuiSuperSelect, EuiIcon, EuiSuperSelectOption } from '@elastic/eui'; -import styled from 'styled-components'; - -import * as i18n from '../translations'; - -const ICON_SIZE = 'm'; - -const EuiIconExtended = styled(EuiIcon)` - margin-right: 13px; -`; - -const connectors: Array> = [ - { - value: 'no-connector', - inputDisplay: ( - <> - - {i18n.NO_CONNECTOR} - - ), - 'data-test-subj': 'no-connector', - }, - { - value: 'servicenow-connector', - inputDisplay: ( - <> - - {'My ServiceNow connector'} - - ), - 'data-test-subj': 'servicenow-connector', - }, -]; - -const ConnectorsDropdownComponent: React.FC = () => { - const [selectedConnector, selectConnector] = useState(connectors[0].value); - const onChange = useCallback(connector => selectConnector(connector), [selectedConnector]); - - return ( - - ); -}; - -export const ConnectorsDropdown = React.memo(ConnectorsDropdownComponent); diff --git a/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/translations.ts b/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/translations.ts deleted file mode 100644 index 54d256b143f60..0000000000000 --- a/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/translations.ts +++ /dev/null @@ -1,37 +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; - * you may not use this file except in compliance with the Elastic License. - */ - -import { i18n } from '@kbn/i18n'; - -export const INCIDENT_MANAGEMENT_SYSTEM_TITLE = i18n.translate( - 'xpack.siem.case.configureCases.incidentManagementSystemTitle', - { - defaultMessage: 'Connect to third-party incident management system', - } -); - -export const INCIDENT_MANAGEMENT_SYSTEM_DESC = i18n.translate( - 'xpack.siem.case.configureCases.incidentManagementSystemDesc', - { - defaultMessage: - 'You may optionally connect SIEM cases to a third-party incident management system of your choosing. This will allow you to push case data as an incident in your chosen third-party system.', - } -); - -export const INCIDENT_MANAGEMENT_SYSTEM_LABEL = i18n.translate( - 'xpack.siem.case.configureCases.incidentManagementSystemLabel', - { - defaultMessage: 'Incident management system', - } -); - -export const NO_CONNECTOR = i18n.translate('xpack.siem.case.configureCases.noConnector', { - defaultMessage: 'No connector selected', -}); - -export const ADD_NEW_CONNECTOR = i18n.translate('xpack.siem.case.configureCases.addNewConnector', { - defaultMessage: 'Add new connector option', -}); diff --git a/x-pack/legacy/plugins/siem/public/pages/case/components/wrappers/index.tsx b/x-pack/legacy/plugins/siem/public/pages/case/components/wrappers/index.tsx deleted file mode 100644 index 772d78f948b79..0000000000000 --- a/x-pack/legacy/plugins/siem/public/pages/case/components/wrappers/index.tsx +++ /dev/null @@ -1,22 +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; - * you may not use this file except in compliance with the Elastic License. - */ - -import styled, { css } from 'styled-components'; - -export const WhitePageWrapper = styled.div` - ${({ theme }) => css` - background-color: ${theme.eui.euiColorEmptyShade}; - border-top: ${theme.eui.euiBorderThin}; - height: 100%; - min-height: 100vh; - `} -`; - -export const SectionWrapper = styled.div` - box-sizing: content-box; - margin: 0 auto; - max-width: 1175px; -`; diff --git a/x-pack/legacy/plugins/siem/public/pages/case/configure_cases.tsx b/x-pack/legacy/plugins/siem/public/pages/case/configure_cases.tsx deleted file mode 100644 index 018f9dc9ade52..0000000000000 --- a/x-pack/legacy/plugins/siem/public/pages/case/configure_cases.tsx +++ /dev/null @@ -1,54 +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; - * you may not use this file except in compliance with the Elastic License. - */ - -import React from 'react'; -import styled, { css } from 'styled-components'; - -import { WrapperPage } from '../../components/wrapper_page'; -import { CaseHeaderPage } from './components/case_header_page'; -import { SpyRoute } from '../../utils/route/spy_routes'; -import { getCaseUrl } from '../../components/link_to'; -import { WhitePageWrapper, SectionWrapper } from './components/wrappers'; -import { Connectors } from './components/configure_cases/connectors'; -import * as i18n from './translations'; - -const backOptions = { - href: getCaseUrl(), - text: i18n.BACK_TO_ALL, -}; - -const wrapperPageStyle: Record = { - paddingLeft: '0', - paddingRight: '0', - paddingBottom: '0', -}; - -export const FormWrapper = styled.div` - ${({ theme }) => css` - padding-top: ${theme.eui.paddingSizes.l}; - padding-bottom: ${theme.eui.paddingSizes.l}; - `} -`; - -const ConfigureCasesPageComponent: React.FC = () => ( - <> - - - - - - - - - - - - - - -); - -export const ConfigureCasesPage = React.memo(ConfigureCasesPageComponent); diff --git a/x-pack/legacy/plugins/siem/public/pages/case/create_case.tsx b/x-pack/legacy/plugins/siem/public/pages/case/create_case.tsx index 2c7525264f71b..9bc356517cc68 100644 --- a/x-pack/legacy/plugins/siem/public/pages/case/create_case.tsx +++ b/x-pack/legacy/plugins/siem/public/pages/case/create_case.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { WrapperPage } from '../../components/wrapper_page'; import { Create } from './components/create'; import { SpyRoute } from '../../utils/route/spy_routes'; -import { CaseHeaderPage } from './components/case_header_page'; +import { HeaderPage } from '../../components/header_page'; import * as i18n from './translations'; import { getCaseUrl } from '../../components/link_to'; @@ -17,11 +17,15 @@ const backOptions = { href: getCaseUrl(), text: i18n.BACK_TO_ALL, }; - +const badgeOptions = { + beta: true, + text: i18n.PAGE_BADGE_LABEL, + tooltip: i18n.PAGE_BADGE_TOOLTIP, +}; export const CreateCasePage = React.memo(() => ( <> - + diff --git a/x-pack/legacy/plugins/siem/public/pages/case/index.tsx b/x-pack/legacy/plugins/siem/public/pages/case/index.tsx index 1bde9de1535b5..9bd91b1c6d62d 100644 --- a/x-pack/legacy/plugins/siem/public/pages/case/index.tsx +++ b/x-pack/legacy/plugins/siem/public/pages/case/index.tsx @@ -11,12 +11,10 @@ import { SiemPageName } from '../home/types'; import { CaseDetailsPage } from './case_details'; import { CasesPage } from './case'; import { CreateCasePage } from './create_case'; -import { ConfigureCasesPage } from './configure_cases'; const casesPagePath = `/:pageName(${SiemPageName.case})`; const caseDetailsPagePath = `${casesPagePath}/:detailName`; const createCasePagePath = `${casesPagePath}/create`; -const configureCasesPagePath = `${casesPagePath}/configure`; const CaseContainerComponent: React.FC = () => ( @@ -26,9 +24,6 @@ const CaseContainerComponent: React.FC = () => ( - - - diff --git a/x-pack/legacy/plugins/siem/public/pages/case/translations.ts b/x-pack/legacy/plugins/siem/public/pages/case/translations.ts index 265af0bde547f..4e878ba58411e 100644 --- a/x-pack/legacy/plugins/siem/public/pages/case/translations.ts +++ b/x-pack/legacy/plugins/siem/public/pages/case/translations.ts @@ -57,6 +57,15 @@ export const LAST_UPDATED = i18n.translate('xpack.siem.case.caseView.updatedAt', defaultMessage: 'Last updated', }); +export const PAGE_BADGE_LABEL = i18n.translate('xpack.siem.case.caseView.pageBadgeLabel', { + defaultMessage: 'Beta', +}); + +export const PAGE_BADGE_TOOLTIP = i18n.translate('xpack.siem.case.caseView.pageBadgeTooltip', { + defaultMessage: + 'Case Workflow is still in beta. Please help us improve by reporting issues or bugs in the Kibana repo.', +}); + export const PAGE_SUBTITLE = i18n.translate('xpack.siem.case.caseView.pageSubtitle', { defaultMessage: 'Case Workflow Management within the Elastic SIEM', }); @@ -93,14 +102,3 @@ export const NO_TAGS = i18n.translate('xpack.siem.case.caseView.noTags', { export const TITLE_REQUIRED = i18n.translate('xpack.siem.case.createCase.titleFieldRequiredError', { defaultMessage: 'A title is required.', }); - -export const CONFIGURE_CASES_PAGE_TITLE = i18n.translate( - 'xpack.siem.case.configureCases.headerTitle', - { - defaultMessage: 'Configure cases', - } -); - -export const CONFIGURE_CASES_BUTTON = i18n.translate('xpack.siem.case.configureCasesButton', { - defaultMessage: 'Configure cases', -}); diff --git a/x-pack/legacy/plugins/siem/public/pages/detection_engine/components/signals/default_config.tsx b/x-pack/legacy/plugins/siem/public/pages/detection_engine/components/signals/default_config.tsx index 94015d6090468..44c48b1879e89 100644 --- a/x-pack/legacy/plugins/siem/public/pages/detection_engine/components/signals/default_config.tsx +++ b/x-pack/legacy/plugins/siem/public/pages/detection_engine/components/signals/default_config.tsx @@ -7,7 +7,7 @@ /* eslint-disable react/display-name */ import { EuiButtonIcon, EuiToolTip } from '@elastic/eui'; -import { ApolloClient } from '@apollo/client'; +import ApolloClient from 'apollo-client'; import React from 'react'; import { Filter } from '../../../../../../../../../src/plugins/data/common/es_query'; @@ -191,7 +191,7 @@ export const getSignalsActions = ({ status, updateTimelineIsLoading, }: { - apolloClient?: ApolloClient; + apolloClient?: ApolloClient<{}>; canUserCRUD: boolean; hasIndexWrite: boolean; setEventsLoading: ({ eventIds, isLoading }: SetEventsLoadingProps) => void; diff --git a/x-pack/legacy/plugins/siem/public/pages/detection_engine/components/signals/index.tsx b/x-pack/legacy/plugins/siem/public/pages/detection_engine/components/signals/index.tsx index 1e1ed8766de25..75f19218d9b38 100644 --- a/x-pack/legacy/plugins/siem/public/pages/detection_engine/components/signals/index.tsx +++ b/x-pack/legacy/plugins/siem/public/pages/detection_engine/components/signals/index.tsx @@ -9,7 +9,6 @@ import { isEmpty } from 'lodash/fp'; import React, { useCallback, useEffect, useMemo, useState } from 'react'; import { connect, ConnectedProps } from 'react-redux'; import { Dispatch } from 'redux'; -import { useApolloClient } from '@apollo/client'; import { Filter, esQuery } from '../../../../../../../../../src/plugins/data/public'; import { useFetchIndexPatterns } from '../../../../containers/detection_engine/rules/fetch_index_patterns'; @@ -21,6 +20,7 @@ import { inputsSelectors, State, inputsModel } from '../../../../store'; import { timelineActions, timelineSelectors } from '../../../../store/timeline'; import { TimelineModel } from '../../../../store/timeline/model'; import { timelineDefaults } from '../../../../store/timeline/defaults'; +import { useApolloClient } from '../../../../utils/apollo_context'; import { updateSignalStatusAction } from './actions'; import { diff --git a/x-pack/legacy/plugins/siem/public/pages/detection_engine/components/signals/types.ts b/x-pack/legacy/plugins/siem/public/pages/detection_engine/components/signals/types.ts index cfcd1fe2d23fe..b3e7ed75cfb99 100644 --- a/x-pack/legacy/plugins/siem/public/pages/detection_engine/components/signals/types.ts +++ b/x-pack/legacy/plugins/siem/public/pages/detection_engine/components/signals/types.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { ApolloClient } from '@apollo/client'; +import ApolloClient from 'apollo-client'; import { Ecs } from '../../../../graphql/types'; import { TimelineModel } from '../../../../store/timeline/model'; @@ -42,7 +42,7 @@ export interface UpdateSignalStatusActionProps { export type SendSignalsToTimeline = () => void; export interface SendSignalToTimelineActionProps { - apolloClient?: ApolloClient; + apolloClient?: ApolloClient<{}>; createTimeline: CreateTimeline; ecsData: Ecs; updateTimelineIsLoading: ({ id, isLoading }: { id: string; isLoading: boolean }) => void; diff --git a/x-pack/legacy/plugins/siem/public/pages/detection_engine/detection_engine.tsx b/x-pack/legacy/plugins/siem/public/pages/detection_engine/detection_engine.tsx index 575b85322dcb6..c3fb907ae83e1 100644 --- a/x-pack/legacy/plugins/siem/public/pages/detection_engine/detection_engine.tsx +++ b/x-pack/legacy/plugins/siem/public/pages/detection_engine/detection_engine.tsx @@ -10,8 +10,8 @@ import { useParams } from 'react-router-dom'; import { StickyContainer } from 'react-sticky'; import { connect, ConnectedProps } from 'react-redux'; -import { useGlobalTime } from '../../containers/global_time'; -import { useWithSource } from '../../containers/source'; +import { GlobalTime } from '../../containers/global_time'; +import { indicesExistOrDataTemporarilyUnavailable, WithSource } from '../../containers/source'; import { AlertsTable } from '../../components/alerts_viewer/alerts_table'; import { FiltersGlobal } from '../../components/filters_global'; import { @@ -88,10 +88,6 @@ const DetectionEnginePageComponent: React.FC = ({ signalIndexName, ]); - const { indexPattern, contentAvailable } = useWithSource(indexToAdd); - - const { to, from, deleteQuery, setQuery } = useGlobalTime(); - if (isUserAuthenticated != null && !isUserAuthenticated && !loading) { return ( @@ -113,81 +109,89 @@ const DetectionEnginePageComponent: React.FC = ({ <> {hasEncryptionKey != null && !hasEncryptionKey && } {hasIndexWrite != null && !hasIndexWrite && } - {contentAvailable ? ( - - - - - - - {i18n.LAST_SIGNAL} - {': '} - {lastSignals} - - ) - } - title={i18n.PAGE_TITLE} - > - - {i18n.BUTTON_MANAGE_RULES} - - - - <> - - - {tabName === DetectionEngineTab.signals && ( - <> - - - - - )} - {tabName === DetectionEngineTab.alerts && ( - <> - - - - )} - - - - ) : ( - - - - - )} + + {({ indicesExist, indexPattern }) => { + return indicesExistOrDataTemporarilyUnavailable(indicesExist) ? ( + + + + + + + {i18n.LAST_SIGNAL} + {': '} + {lastSignals} + + ) + } + title={i18n.PAGE_TITLE} + > + + {i18n.BUTTON_MANAGE_RULES} + + + + + {({ to, from, deleteQuery, setQuery }) => ( + <> + + + {tabName === DetectionEngineTab.signals && ( + <> + + + + + )} + {tabName === DetectionEngineTab.alerts && ( + <> + + + + )} + + )} + + + + ) : ( + + + + + ); + }} + ); diff --git a/x-pack/legacy/plugins/siem/public/pages/detection_engine/rules/details/index.tsx b/x-pack/legacy/plugins/siem/public/pages/detection_engine/rules/details/index.tsx index 5ccb4cf5d8372..83dd18f0f14b7 100644 --- a/x-pack/legacy/plugins/siem/public/pages/detection_engine/rules/details/index.tsx +++ b/x-pack/legacy/plugins/siem/public/pages/detection_engine/rules/details/index.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -/* eslint-disable react-hooks/rules-of-hooks, complexity */ +/* eslint-disable react-hooks/rules-of-hooks */ import { EuiButton, @@ -32,7 +32,10 @@ import { SiemSearchBar } from '../../../../components/search_bar'; import { WrapperPage } from '../../../../components/wrapper_page'; import { useRule } from '../../../../containers/detection_engine/rules'; -import { useWithSource } from '../../../../containers/source'; +import { + indicesExistOrDataTemporarilyUnavailable, + WithSource, +} from '../../../../containers/source'; import { SpyRoute } from '../../../../utils/route/spy_routes'; import { DetectionEngineHeaderPage } from '../../components/detection_engine_header_page'; @@ -53,7 +56,7 @@ import { StepPanel } from '../components/step_panel'; import { getStepsData, redirectToDetections } from '../helpers'; import * as ruleI18n from '../translations'; import * as i18n from './translations'; -import { useGlobalTime } from '../../../../containers/global_time'; +import { GlobalTime } from '../../../../containers/global_time'; import { signalsHistogramOptions } from '../../components/signals_histogram_panel/config'; import { inputsSelectors } from '../../../../store/inputs'; import { State } from '../../../../store'; @@ -215,10 +218,6 @@ const RuleDetailsPageComponent: FC = ({ [ruleEnabled, setRuleEnabled] ); - const { contentAvailable, indexPattern } = useWithSource(indexToAdd); - - const { to, from, deleteQuery, setQuery } = useGlobalTime(); - if (redirectToDetections(isSignalIndexExists, isAuthenticated, hasEncryptionKey)) { return ; } @@ -227,147 +226,155 @@ const RuleDetailsPageComponent: FC = ({ <> {hasIndexWrite != null && !hasIndexWrite && } {userHasNoPermissions && } - {contentAvailable ? ( - - - - + + {({ indicesExist, indexPattern }) => { + return indicesExistOrDataTemporarilyUnavailable(indicesExist) ? ( + + {({ to, from, deleteQuery, setQuery }) => ( + + + + - - - {detectionI18n.LAST_SIGNAL} - {': '} - {lastSignals} - , - ] - : []), - , - ]} - title={title} - > - - - - + + + {detectionI18n.LAST_SIGNAL} + {': '} + {lastSignals} + , + ] + : []), + , + ]} + title={title} + > + + + + - - - - - {ruleI18n.EDIT_RULE_SETTINGS} - - - - - - - - - - {ruleError} - {tabs} - - {ruleDetailTab === RuleDetailTabs.signals && ( - <> - - - - {defineRuleData != null && ( - - )} - - + + + + + {ruleI18n.EDIT_RULE_SETTINGS} + + + + + + + + + + {ruleError} + {tabs} + + {ruleDetailTab === RuleDetailTabs.signals && ( + <> + + + + {defineRuleData != null && ( + + )} + + - - - {aboutRuleData != null && ( - - )} - - + + + {aboutRuleData != null && ( + + )} + + - - - {scheduleRuleData != null && ( - + + {scheduleRuleData != null && ( + + )} + + + + + - )} - - - - - - - {ruleId != null && ( - - )} - - )} - {ruleDetailTab === RuleDetailTabs.failures && } - - - ) : ( - - + + {ruleId != null && ( + + )} + + )} + {ruleDetailTab === RuleDetailTabs.failures && } + + + )} + + ) : ( + + - - - )} + + + ); + }} + diff --git a/x-pack/legacy/plugins/siem/public/pages/home/index.tsx b/x-pack/legacy/plugins/siem/public/pages/home/index.tsx index 5d20993144af9..7c5fd56bf1e91 100644 --- a/x-pack/legacy/plugins/siem/public/pages/home/index.tsx +++ b/x-pack/legacy/plugins/siem/public/pages/home/index.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import React, { useMemo } from 'react'; +import React from 'react'; import { Redirect, Route, Switch } from 'react-router-dom'; import styled from 'styled-components'; import useResizeObserver from 'use-resize-observer/polyfilled'; @@ -19,9 +19,8 @@ import { MlNetworkConditionalContainer } from '../../components/ml/conditional_l import { StatefulTimeline } from '../../components/timeline'; import { AutoSaveWarningMsg } from '../../components/timeline/auto_save_warning'; import { UseUrlState } from '../../components/url_state'; -import { useWithSource } from '../../containers/source'; +import { WithSource, indicesExistOrDataTemporarilyUnavailable } from '../../containers/source'; import { SpyRoute } from '../../utils/route/spy_routes'; -import { useShowTimeline } from '../../utils/timeline/use_show_timeline'; import { NotFoundPage } from '../404'; import { DetectionEngineContainer } from '../detection_engine'; import { HostsContainer } from '../hosts'; @@ -62,91 +61,84 @@ const calculateFlyoutHeight = ({ windowHeight: number; }): number => Math.max(0, windowHeight - globalHeaderSize); -export const HomePageComponent = () => { +export const HomePage: React.FC = () => { const { ref: measureRef, height: windowHeight = 0 } = useResizeObserver({}); - const flyoutHeight = useMemo( - () => - calculateFlyoutHeight({ - globalHeaderSize: globalHeaderHeightPx, - windowHeight, - }), - [windowHeight] - ); - - const { browserFields, indexPattern, contentAvailable } = useWithSource(); - - const [showTimeline] = useShowTimeline(); + const flyoutHeight = calculateFlyoutHeight({ + globalHeaderSize: globalHeaderHeightPx, + windowHeight, + }); return ( - +
- - - {contentAvailable && showTimeline && ( - <> - - - + {({ browserFields, indexPattern, indicesExist }) => ( + + + {indicesExistOrDataTemporarilyUnavailable(indicesExist) && ( + <> + + + + + + )} + + + + } /> + } + /> + ( + + )} + /> + ( + + )} + /> + } /> - - + } /> + ( + + )} + /> + ( + + )} + /> + + + + } /> + + )} - - - - - - - } - /> - ( - - )} - /> - ( - - )} - /> - - - - } /> - ( - - )} - /> - ( - - )} - /> - - - - - - - - +
@@ -156,6 +148,4 @@ export const HomePageComponent = () => { ); }; -export const HomePage = React.memo(HomePageComponent); - HomePage.displayName = 'HomePage'; diff --git a/x-pack/legacy/plugins/siem/public/pages/hosts/details/details_tabs.test.tsx b/x-pack/legacy/plugins/siem/public/pages/hosts/details/details_tabs.test.tsx index 1ef1edb4c4dce..81c1b317d4596 100644 --- a/x-pack/legacy/plugins/siem/public/pages/hosts/details/details_tabs.test.tsx +++ b/x-pack/legacy/plugins/siem/public/pages/hosts/details/details_tabs.test.tsx @@ -5,6 +5,7 @@ */ import React from 'react'; +import { IIndexPattern } from 'src/plugins/data/public'; import { MemoryRouter } from 'react-router-dom'; import useResizeObserver from 'use-resize-observer/polyfilled'; @@ -17,6 +18,15 @@ import { type } from './utils'; import { useMountAppended } from '../../../utils/use_mount_appended'; import { getHostDetailsPageFilters } from './helpers'; +jest.mock('../../../containers/source', () => ({ + indicesExistOrDataTemporarilyUnavailable: () => true, + WithSource: ({ + children, + }: { + children: (args: { indicesExist: boolean; indexPattern: IIndexPattern }) => React.ReactNode; + }) => children({ indicesExist: true, indexPattern: mockIndexPattern }), +})); + // Test will fail because we will to need to mock some core services to make the test work // For now let's forget about SiemSearchBar and QueryBar jest.mock('../../../components/search_bar', () => ({ @@ -36,7 +46,7 @@ describe('body', () => { allHosts: 'HostsQueryTabBody', uncommonProcesses: 'UncommonProcessQueryTabBody', anomalies: 'AnomaliesQueryTabBody', - events: 'Memo(EventsQueryTabBodyComponent)', + events: 'EventsQueryTabBody', alerts: 'HostAlertsQueryTabBody', }; diff --git a/x-pack/legacy/plugins/siem/public/pages/hosts/details/details_tabs.tsx b/x-pack/legacy/plugins/siem/public/pages/hosts/details/details_tabs.tsx index 76b43cbcdbb4b..f5efd9248029d 100644 --- a/x-pack/legacy/plugins/siem/public/pages/hosts/details/details_tabs.tsx +++ b/x-pack/legacy/plugins/siem/public/pages/hosts/details/details_tabs.tsx @@ -85,6 +85,7 @@ export const HostDetailsTabs = React.memo( + diff --git a/x-pack/legacy/plugins/siem/public/pages/hosts/details/index.tsx b/x-pack/legacy/plugins/siem/public/pages/hosts/details/index.tsx index d2d6b6cb5298e..8af4731e4dda4 100644 --- a/x-pack/legacy/plugins/siem/public/pages/hosts/details/index.tsx +++ b/x-pack/legacy/plugins/siem/public/pages/hosts/details/index.tsx @@ -25,7 +25,7 @@ import { SiemSearchBar } from '../../../components/search_bar'; import { WrapperPage } from '../../../components/wrapper_page'; import { HostOverviewByNameQuery } from '../../../containers/hosts/overview'; import { KpiHostDetailsQuery } from '../../../containers/kpi_host_details'; -import { useWithSource } from '../../../containers/source'; +import { indicesExistOrDataTemporarilyUnavailable, WithSource } from '../../../containers/source'; import { LastEventIndexKey } from '../../../graphql/types'; import { useKibana } from '../../../lib/kibana'; import { convertToBuildEsQuery } from '../../../lib/keury'; @@ -74,126 +74,132 @@ const HostDetailsComponent = React.memo( }, [setAbsoluteRangeDatePicker] ); - const { contentAvailable, indexPattern } = useWithSource(); - const filterQuery = convertToBuildEsQuery({ - config: esQuery.getEsQueryConfig(kibana.services.uiSettings), - indexPattern, - queries: [query], - filters: getFilters(), - }); return ( <> - {contentAvailable ? ( - - - - - - - - } - title={detailName} - /> - - - {({ hostOverview, loading, id, inspect, refetch }) => ( - + {({ indicesExist, indexPattern }) => { + const filterQuery = convertToBuildEsQuery({ + config: esQuery.getEsQueryConfig(kibana.services.uiSettings), + indexPattern, + queries: [query], + filters: getFilters(), + }); + return indicesExistOrDataTemporarilyUnavailable(indicesExist) ? ( + + + + + + + + } + title={detailName} + /> + + + {({ hostOverview, loading, id, inspect, refetch }) => ( + + {({ isLoadingAnomaliesData, anomaliesData }) => ( + { + const fromTo = scoreIntervalToDateTime(score, interval); + setAbsoluteRangeDatePicker({ + id: 'global', + from: fromTo.from, + to: fromTo.to, + }); + }} + /> + )} + + )} + + + + + - {({ isLoadingAnomaliesData, anomaliesData }) => ( - ( + { - const fromTo = scoreIntervalToDateTime(score, interval); - setAbsoluteRangeDatePicker({ - id: 'global', - from: fromTo.from, - to: fromTo.to, - }); - }} + to={to} + narrowDateRange={narrowDateRange} /> )} - - )} - - - - - - {({ kpiHostDetails, id, inspect, loading, refetch }) => ( - + + + + + + + + - )} - - - - - - - - - - - - ) : ( - - - - - - )} + + + ) : ( + + + + + + ); + }} + diff --git a/x-pack/legacy/plugins/siem/public/pages/hosts/hosts.test.tsx b/x-pack/legacy/plugins/siem/public/pages/hosts/hosts.test.tsx index bbecef4e44a44..99cf767c65e08 100644 --- a/x-pack/legacy/plugins/siem/public/pages/hosts/hosts.test.tsx +++ b/x-pack/legacy/plugins/siem/public/pages/hosts/hosts.test.tsx @@ -8,8 +8,7 @@ import { mount } from 'enzyme'; import { cloneDeep } from 'lodash/fp'; import React from 'react'; import { Router } from 'react-router-dom'; -import { GraphQLRequest } from '@apollo/client'; -import { MockedProvider } from '@apollo/client/testing'; +import { MockedProvider } from 'react-apollo/test-utils'; import { Filter } from '../../../../../../../src/plugins/data/common/es_query'; import '../../mock/match_media'; @@ -33,7 +32,7 @@ jest.mock('../../components/query_bar', () => ({ })); let localSource: Array<{ - request: GraphQLRequest; + request: {}; result: { data: { source: { diff --git a/x-pack/legacy/plugins/siem/public/pages/hosts/hosts.tsx b/x-pack/legacy/plugins/siem/public/pages/hosts/hosts.tsx index 78d41f01c5d28..a7aa9920b7d08 100644 --- a/x-pack/legacy/plugins/siem/public/pages/hosts/hosts.tsx +++ b/x-pack/legacy/plugins/siem/public/pages/hosts/hosts.tsx @@ -21,7 +21,7 @@ import { manageQuery } from '../../components/page/manage_query'; import { SiemSearchBar } from '../../components/search_bar'; import { WrapperPage } from '../../components/wrapper_page'; import { KpiHostsQuery } from '../../containers/kpi_hosts'; -import { useWithSource } from '../../containers/source'; +import { indicesExistOrDataTemporarilyUnavailable, WithSource } from '../../containers/source'; import { LastEventIndexKey } from '../../graphql/types'; import { useKibana } from '../../lib/kibana'; import { convertToBuildEsQuery } from '../../lib/keury'; @@ -68,83 +68,87 @@ export const HostsComponent = React.memo( [setAbsoluteRangeDatePicker] ); - const { contentAvailable, indexPattern } = useWithSource(); - const filterQuery = convertToBuildEsQuery({ - config: esQuery.getEsQueryConfig(kibana.services.uiSettings), - indexPattern, - queries: [query], - filters, - }); - const tabsFilterQuery = convertToBuildEsQuery({ - config: esQuery.getEsQueryConfig(kibana.services.uiSettings), - indexPattern, - queries: [query], - filters: tabsFilters, - }); - return ( <> - {contentAvailable ? ( - - - - - - - } - title={i18n.PAGE_TITLE} - /> - - - {({ kpiHosts, loading, id, inspect, refetch }) => ( - + {({ indicesExist, indexPattern }) => { + const filterQuery = convertToBuildEsQuery({ + config: esQuery.getEsQueryConfig(kibana.services.uiSettings), + indexPattern, + queries: [query], + filters, + }); + const tabsFilterQuery = convertToBuildEsQuery({ + config: esQuery.getEsQueryConfig(kibana.services.uiSettings), + indexPattern, + queries: [query], + filters: tabsFilters, + }); + return indicesExistOrDataTemporarilyUnavailable(indicesExist) ? ( + + + + + + + } + title={i18n.PAGE_TITLE} + /> + + + {({ kpiHosts, loading, id, inspect, refetch }) => ( + + )} + + + + + + + + + - )} - - - - - - - - - - - - ) : ( - - - - - - )} + + + ) : ( + + + + + + ); + }} + + ); diff --git a/x-pack/legacy/plugins/siem/public/pages/hosts/hosts_tabs.tsx b/x-pack/legacy/plugins/siem/public/pages/hosts/hosts_tabs.tsx index e788eff9f8801..80c35e5563c1d 100644 --- a/x-pack/legacy/plugins/siem/public/pages/hosts/hosts_tabs.tsx +++ b/x-pack/legacy/plugins/siem/public/pages/hosts/hosts_tabs.tsx @@ -32,26 +32,9 @@ export const HostsTabs = memo( setQuery, isInitializing, type, + indexPattern, hostsPagePath, }) => { - const narrowDateRange = useCallback( - (score: Anomaly, interval: string) => { - const fromTo = scoreIntervalToDateTime(score, interval); - setAbsoluteRangeDatePicker({ - id: 'global', - from: fromTo.from, - to: fromTo.to, - }); - }, - [setAbsoluteRangeDatePicker] - ); - const updateDateRange = useCallback( - (min: number, max: number) => { - setAbsoluteRangeDatePicker({ id: 'global', from: min, to: max }); - }, - [setAbsoluteRangeDatePicker] - ); - const tabProps = { deleteQuery, endDate: to, @@ -60,8 +43,24 @@ export const HostsTabs = memo( setQuery, startDate: from, type, - narrowDateRange, - updateDateRange, + indexPattern, + narrowDateRange: useCallback( + (score: Anomaly, interval: string) => { + const fromTo = scoreIntervalToDateTime(score, interval); + setAbsoluteRangeDatePicker({ + id: 'global', + from: fromTo.from, + to: fromTo.to, + }); + }, + [setAbsoluteRangeDatePicker] + ), + updateDateRange: useCallback( + (min: number, max: number) => { + setAbsoluteRangeDatePicker({ id: 'global', from: min, to: max }); + }, + [setAbsoluteRangeDatePicker] + ), }; return ( diff --git a/x-pack/legacy/plugins/siem/public/pages/hosts/index.tsx b/x-pack/legacy/plugins/siem/public/pages/hosts/index.tsx index fd50f7c24d06e..699b1441905c3 100644 --- a/x-pack/legacy/plugins/siem/public/pages/hosts/index.tsx +++ b/x-pack/legacy/plugins/siem/public/pages/hosts/index.tsx @@ -10,7 +10,7 @@ import { Redirect, Route, Switch, RouteComponentProps } from 'react-router-dom'; import { HostDetails } from './details'; import { HostsTableType } from '../../store/hosts/model'; -import { useGlobalTime } from '../../containers/global_time'; +import { GlobalTime } from '../../containers/global_time'; import { SiemPageName } from '../home/types'; import { Hosts } from './hosts'; import { hostsPagePath, hostDetailsPagePath } from './types'; @@ -34,62 +34,62 @@ const getHostDetailsTabPath = (pagePath: string) => type Props = Partial> & { url: string }; -export const HostsContainer = React.memo(({ url }) => { - const { to, from, setQuery, deleteQuery, isInitializing } = useGlobalTime(); - - return ( - - ( - - )} - /> - ( - - )} - /> - } - /> - ( - - )} - /> - - ); -}); +export const HostsContainer = React.memo(({ url }) => ( + + {({ to, from, setQuery, deleteQuery, isInitializing }) => ( + + ( + + )} + /> + ( + + )} + /> + } + /> + ( + + )} + /> + + )} + +)); HostsContainer.displayName = 'HostsContainer'; diff --git a/x-pack/legacy/plugins/siem/public/pages/hosts/navigation/events_query_tab_body.tsx b/x-pack/legacy/plugins/siem/public/pages/hosts/navigation/events_query_tab_body.tsx index d871c6f97e752..cb2c19c642bc4 100644 --- a/x-pack/legacy/plugins/siem/public/pages/hosts/navigation/events_query_tab_body.tsx +++ b/x-pack/legacy/plugins/siem/public/pages/hosts/navigation/events_query_tab_body.tsx @@ -47,7 +47,7 @@ export const histogramConfigs: MatrixHisrogramConfigs = { title: i18n.NAVIGATION_EVENTS_TITLE, }; -export const EventsQueryTabBodyComponent = ({ +export const EventsQueryTabBody = ({ deleteQuery, endDate, filterQuery, @@ -86,4 +86,4 @@ export const EventsQueryTabBodyComponent = ({ ); }; -export const EventsQueryTabBody = React.memo(EventsQueryTabBodyComponent); +EventsQueryTabBody.displayName = 'EventsQueryTabBody'; diff --git a/x-pack/legacy/plugins/siem/public/pages/hosts/navigation/hosts_query_tab_body.tsx b/x-pack/legacy/plugins/siem/public/pages/hosts/navigation/hosts_query_tab_body.tsx index d099bcd81da65..6c301d692d0e1 100644 --- a/x-pack/legacy/plugins/siem/public/pages/hosts/navigation/hosts_query_tab_body.tsx +++ b/x-pack/legacy/plugins/siem/public/pages/hosts/navigation/hosts_query_tab_body.tsx @@ -17,6 +17,7 @@ export const HostsQueryTabBody = ({ deleteQuery, endDate, filterQuery, + indexPattern, skip, setQuery, startDate, @@ -36,6 +37,7 @@ export const HostsQueryTabBody = ({ data={hosts} fakeTotalCount={getOr(50, 'fakeTotalCount', pageInfo)} id={id} + indexPattern={indexPattern} inspect={inspect} isInspect={isInspected} loading={loading} diff --git a/x-pack/legacy/plugins/siem/public/pages/hosts/navigation/types.ts b/x-pack/legacy/plugins/siem/public/pages/hosts/navigation/types.ts index be21ed91c3291..cb5fc62b96582 100644 --- a/x-pack/legacy/plugins/siem/public/pages/hosts/navigation/types.ts +++ b/x-pack/legacy/plugins/siem/public/pages/hosts/navigation/types.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { Filter } from '../../../../../../../../src/plugins/data/public'; +import { Filter, IIndexPattern } from '../../../../../../../../src/plugins/data/public'; import { NarrowDateRange } from '../../../components/ml/types'; import { ESTermQuery } from '../../../../common/typed_json'; import { InspectQuery, Refetch } from '../../../store/inputs/model'; @@ -45,6 +45,7 @@ export interface QueryTabBodyProps { export type HostsComponentsQueryProps = QueryTabBodyProps & { deleteQuery?: ({ id }: { id: string }) => void; + indexPattern: IIndexPattern; pageFilters?: Filter[]; skip: boolean; setQuery: SetQuery; diff --git a/x-pack/legacy/plugins/siem/public/pages/hosts/types.ts b/x-pack/legacy/plugins/siem/public/pages/hosts/types.ts index cb276c0b44c00..408450aebebbd 100644 --- a/x-pack/legacy/plugins/siem/public/pages/hosts/types.ts +++ b/x-pack/legacy/plugins/siem/public/pages/hosts/types.ts @@ -4,6 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ +import { IIndexPattern } from 'src/plugins/data/public'; import { ActionCreator } from 'typescript-fsa'; import { SiemPageName } from '../home/types'; @@ -17,6 +18,7 @@ export const hostDetailsPagePath = `${hostsPagePath}/:detailName`; export type HostsTabsProps = HostsComponentProps & { filterQuery: string; type: hostsModel.HostsType; + indexPattern: IIndexPattern; setAbsoluteRangeDatePicker: ActionCreator<{ id: InputsModelId; from: number; diff --git a/x-pack/legacy/plugins/siem/public/pages/network/index.tsx b/x-pack/legacy/plugins/siem/public/pages/network/index.tsx index 9e941b2c9a88c..48fc1421d90bb 100644 --- a/x-pack/legacy/plugins/siem/public/pages/network/index.tsx +++ b/x-pack/legacy/plugins/siem/public/pages/network/index.tsx @@ -13,7 +13,7 @@ import { FlowTarget } from '../../graphql/types'; import { IPDetails } from './ip_details'; import { Network } from './network'; -import { useGlobalTime } from '../../containers/global_time'; +import { GlobalTime } from '../../containers/global_time'; import { SiemPageName } from '../home/types'; import { getNetworkRoutePath } from './navigation'; import { NetworkRouteType } from './navigation/types'; @@ -33,64 +33,67 @@ const NetworkContainerComponent: React.FC = () => { () => getNetworkRoutePath(networkPagePath, capabilitiesFetched, userHasMlUserPermissions), [capabilitiesFetched, userHasMlUserPermissions] ); - const { to, from, setQuery, deleteQuery, isInitializing } = useGlobalTime(); return ( - - ( - + {({ to, from, setQuery, deleteQuery, isInitializing }) => ( + + ( + + )} /> - )} - /> - ( - ( + + )} /> - )} - /> - ( - ( + + )} /> - )} - /> - ( - - )} - /> - + ( + + )} + /> + + )} + ); }; diff --git a/x-pack/legacy/plugins/siem/public/pages/network/ip_details/__snapshots__/index.test.tsx.snap b/x-pack/legacy/plugins/siem/public/pages/network/ip_details/__snapshots__/index.test.tsx.snap index 1f74f026542a1..e7598ef03d786 100644 --- a/x-pack/legacy/plugins/siem/public/pages/network/ip_details/__snapshots__/index.test.tsx.snap +++ b/x-pack/legacy/plugins/siem/public/pages/network/ip_details/__snapshots__/index.test.tsx.snap @@ -1,60 +1,13 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Ip Details it matches the snapshot 1`] = ` - + + + + + + `; diff --git a/x-pack/legacy/plugins/siem/public/pages/network/ip_details/index.test.tsx b/x-pack/legacy/plugins/siem/public/pages/network/ip_details/index.test.tsx index 908d5bf26212d..02132d790796c 100644 --- a/x-pack/legacy/plugins/siem/public/pages/network/ip_details/index.test.tsx +++ b/x-pack/legacy/plugins/siem/public/pages/network/ip_details/index.test.tsx @@ -8,8 +8,7 @@ import { shallow } from 'enzyme'; import { cloneDeep } from 'lodash/fp'; import React from 'react'; import { Router } from 'react-router-dom'; -import { GraphQLRequest } from '@apollo/client'; -import { MockedProvider } from '@apollo/client/testing'; +import { MockedProvider } from 'react-apollo/test-utils'; import { ActionCreator } from 'typescript-fsa'; import '../../../mock/match_media'; @@ -20,7 +19,6 @@ import { apolloClientObservable, mockGlobalState, TestProviders } from '../../.. import { useMountAppended } from '../../../utils/use_mount_appended'; import { createStore, State } from '../../../store'; import { InputsModelId } from '../../../store/inputs/constants'; -// import { useUiSetting$ } from '../../lib/kibana'; import { IPDetailsComponent, IPDetails } from './index'; @@ -37,47 +35,9 @@ jest.mock('../../../components/search_bar', () => ({ jest.mock('../../../components/query_bar', () => ({ QueryBar: () => null, })); -jest.mock('../../../containers/source', () => ({ - useWithSource: () => ({ - contentAvailable: true, - }), -})); - -jest.mock('../../../../../../../../src/plugins/kibana_react/public/context/context', () => ({ - ...jest.requireActual('../../../../../../../../src/plugins/kibana_react/public/context/context'), - useKibana: () => ({ - services: { - http: { - basePath: { - get: () => '', - }, - }, - docLinks: { - links: { - siem: { - gettingStarted: '', - }, - }, - }, - uiSettings: { - get: () => '', - }, - }, - }), -})); - -jest.mock( - '../../../../../../../../src/plugins/kibana_react/public/ui_settings/use_ui_setting', - () => ({ - ...jest.requireActual( - '../../../../../../../../src/plugins/kibana_react/public/ui_settings/use_ui_setting' - ), - useUiSetting$: () => [], - }) -); let localSource: Array<{ - request: GraphQLRequest; + request: {}; result: { data: { source: { @@ -162,31 +122,16 @@ describe('Ip Details', () => { }); test('it renders', () => { - const wrapper = shallow( - - - - ); - - expect( - wrapper - .find('IPDetailsComponent') - .dive() - .find('[data-test-subj="ip-details-page"]') - .exists() - ).toBe(true); + const wrapper = shallow(); + expect(wrapper.find('[data-test-subj="ip-details-page"]').exists()).toBe(true); }); test('it matches the snapshot', () => { - const wrapper = shallow( - - - - ); - expect(wrapper.find('IPDetailsComponent')).toMatchSnapshot(); + const wrapper = shallow(); + expect(wrapper).toMatchSnapshot(); }); - test('it renders ipv6 headline', () => { + test('it renders ipv6 headline', async () => { localSource[0].result.data.source.status.indicesExist = true; const ip = 'fe80--24ce-f7ff-fede-a571'; const wrapper = mount( @@ -198,6 +143,9 @@ describe('Ip Details', () => { ); + // Why => https://github.com/apollographql/react-apollo/issues/1711 + await new Promise(resolve => setTimeout(resolve)); + wrapper.update(); expect( wrapper .find('[data-test-subj="ip-details-headline"] [data-test-subj="header-page-title"]') diff --git a/x-pack/legacy/plugins/siem/public/pages/network/ip_details/index.tsx b/x-pack/legacy/plugins/siem/public/pages/network/ip_details/index.tsx index 160f9343caf75..e796eaca0cd28 100644 --- a/x-pack/legacy/plugins/siem/public/pages/network/ip_details/index.tsx +++ b/x-pack/legacy/plugins/siem/public/pages/network/ip_details/index.tsx @@ -22,7 +22,7 @@ import { IpOverview } from '../../../components/page/network/ip_overview'; import { SiemSearchBar } from '../../../components/search_bar'; import { WrapperPage } from '../../../components/wrapper_page'; import { IpOverviewQuery } from '../../../containers/ip_overview'; -import { useWithSource } from '../../../containers/source'; +import { indicesExistOrDataTemporarilyUnavailable, WithSource } from '../../../containers/source'; import { FlowTargetSourceDest, LastEventIndexKey } from '../../../graphql/types'; import { useKibana } from '../../../lib/kibana'; import { decodeIpv6 } from '../../../lib/helpers'; @@ -76,199 +76,202 @@ export const IPDetailsComponent: React.FC - {contentAvailable ? ( - - - - - - - } - title={ip} - > - - - - - {({ id, inspect, ipOverviewData, loading, refetch }) => ( - + + {({ indicesExist, indexPattern }) => { + const ip = decodeIpv6(detailName); + const filterQuery = convertToBuildEsQuery({ + config: esQuery.getEsQueryConfig(kibana.services.uiSettings), + indexPattern, + queries: [query], + filters, + }); + + return indicesExistOrDataTemporarilyUnavailable(indicesExist) ? ( + + + + + + + } + title={ip} + > + + + + - {({ isLoadingAnomaliesData, anomaliesData }) => ( - ( + + {({ isLoadingAnomaliesData, anomaliesData }) => ( + + )} + + )} + + + + + + + + + + + + + + + + + + + - )} - - )} - + + + + + + - + - - - - - - + + - - - + - - - - - - + + - - - - - - - - - - - - - - - - - - - - - ) : ( - - - - - - )} + + + ) : ( + + + + + + ); + }} + - + ); }; IPDetailsComponent.displayName = 'IPDetailsComponent'; @@ -288,7 +291,7 @@ const mapDispatchToProps = { setIpDetailsTablesActivePageToZero: dispatchIpDetailsTablesActivePageToZero, }; -const connector = connect(makeMapStateToProps, mapDispatchToProps); +export const connector = connect(makeMapStateToProps, mapDispatchToProps); type PropsFromRedux = ConnectedProps; diff --git a/x-pack/legacy/plugins/siem/public/pages/network/network.test.tsx b/x-pack/legacy/plugins/siem/public/pages/network/network.test.tsx index 41c967ffe9874..797fef1586518 100644 --- a/x-pack/legacy/plugins/siem/public/pages/network/network.test.tsx +++ b/x-pack/legacy/plugins/siem/public/pages/network/network.test.tsx @@ -8,8 +8,7 @@ import { mount } from 'enzyme'; import { cloneDeep } from 'lodash/fp'; import React from 'react'; import { Router } from 'react-router-dom'; -import { GraphQLRequest } from '@apollo/client'; -import { MockedProvider } from '@apollo/client/testing'; +import { MockedProvider } from 'react-apollo/test-utils'; import '../../mock/match_media'; import { Filter } from '../../../../../../../src/plugins/data/common/es_query'; @@ -30,7 +29,7 @@ jest.mock('../../components/query_bar', () => ({ })); let localSource: Array<{ - request: GraphQLRequest; + request: {}; result: { data: { source: { diff --git a/x-pack/legacy/plugins/siem/public/pages/network/network.tsx b/x-pack/legacy/plugins/siem/public/pages/network/network.tsx index c71f361e5c9f3..9b1ee76e1d376 100644 --- a/x-pack/legacy/plugins/siem/public/pages/network/network.tsx +++ b/x-pack/legacy/plugins/siem/public/pages/network/network.tsx @@ -21,7 +21,7 @@ import { KpiNetworkComponent } from '../../components/page/network'; import { SiemSearchBar } from '../../components/search_bar'; import { WrapperPage } from '../../components/wrapper_page'; import { KpiNetworkQuery } from '../../containers/kpi_network'; -import { useWithSource } from '../../containers/source'; +import { indicesExistOrDataTemporarilyUnavailable, WithSource } from '../../containers/source'; import { LastEventIndexKey } from '../../graphql/types'; import { useKibana } from '../../lib/kibana'; import { convertToBuildEsQuery } from '../../lib/keury'; @@ -68,101 +68,103 @@ const NetworkComponent = React.memo( [setAbsoluteRangeDatePicker] ); - const { contentAvailable, indexPattern } = useWithSource(); - - const filterQuery = convertToBuildEsQuery({ - config: esQuery.getEsQueryConfig(kibana.services.uiSettings), - indexPattern, - queries: [query], - filters, - }); - const tabsFilterQuery = convertToBuildEsQuery({ - config: esQuery.getEsQueryConfig(kibana.services.uiSettings), - indexPattern, - queries: [query], - filters: tabsFilters, - }); - return ( <> - {contentAvailable ? ( - - - - - - - } - title={i18n.PAGE_TITLE} - /> - - - - - - - {({ kpiNetwork, loading, id, inspect, refetch }) => ( - + {({ indicesExist, indexPattern }) => { + const filterQuery = convertToBuildEsQuery({ + config: esQuery.getEsQueryConfig(kibana.services.uiSettings), + indexPattern, + queries: [query], + filters, + }); + const tabsFilterQuery = convertToBuildEsQuery({ + config: esQuery.getEsQueryConfig(kibana.services.uiSettings), + indexPattern, + queries: [query], + filters: tabsFilters, + }); + + return indicesExistOrDataTemporarilyUnavailable(indicesExist) ? ( + + + + + + + } + title={i18n.PAGE_TITLE} + /> + + - )} - - {capabilitiesFetched && !isInitializing ? ( - <> - + + {({ kpiNetwork, loading, id, inspect, refetch }) => ( + + )} + + + {capabilitiesFetched && !isInitializing ? ( + <> + + + + + + + + + ) : ( + + )} - - - - ) : ( - - )} - - - - - ) : ( - - - - - )} + + + ) : ( + + + + + ); + }} + diff --git a/x-pack/legacy/plugins/siem/public/pages/overview/event_counts/index.tsx b/x-pack/legacy/plugins/siem/public/pages/overview/event_counts/index.tsx index a6725231ccf62..0fc37935b6062 100644 --- a/x-pack/legacy/plugins/siem/public/pages/overview/event_counts/index.tsx +++ b/x-pack/legacy/plugins/siem/public/pages/overview/event_counts/index.tsx @@ -53,26 +53,17 @@ const EventCountsComponent: React.FC = ({ }) => { const kibana = useKibana(); - const hostFilterQuery = convertToBuildEsQuery({ - config: esQuery.getEsQueryConfig(kibana.services.uiSettings), - indexPattern, - queries: [query], - filters: [...filters, ...filterHostData], - }); - - const networkFilterQuery = convertToBuildEsQuery({ - config: esQuery.getEsQueryConfig(kibana.services.uiSettings), - indexPattern, - queries: [query], - filters: [...filters, ...filterNetworkData], - }); - return ( @@ -83,7 +74,12 @@ const EventCountsComponent: React.FC = ({ diff --git a/x-pack/legacy/plugins/siem/public/pages/overview/index.tsx b/x-pack/legacy/plugins/siem/public/pages/overview/index.tsx index 2b8e61dec301c..65b401f00a86e 100644 --- a/x-pack/legacy/plugins/siem/public/pages/overview/index.tsx +++ b/x-pack/legacy/plugins/siem/public/pages/overview/index.tsx @@ -4,10 +4,10 @@ * you may not use this file except in compliance with the Elastic License. */ -import { memo } from 'react'; +import React, { memo } from 'react'; import { StatefulOverview } from './overview'; -export const Overview = memo(StatefulOverview); +export const Overview = memo(() => ); Overview.displayName = 'Overview'; diff --git a/x-pack/legacy/plugins/siem/public/pages/overview/overview.test.tsx b/x-pack/legacy/plugins/siem/public/pages/overview/overview.test.tsx index aa523db32bde2..b20cd84295566 100644 --- a/x-pack/legacy/plugins/siem/public/pages/overview/overview.test.tsx +++ b/x-pack/legacy/plugins/siem/public/pages/overview/overview.test.tsx @@ -7,8 +7,7 @@ import { mount } from 'enzyme'; import { cloneDeep } from 'lodash/fp'; import React from 'react'; -import { GraphQLRequest } from '@apollo/client'; -import { MockedProvider } from '@apollo/client/testing'; +import { MockedProvider } from 'react-apollo/test-utils'; import { MemoryRouter } from 'react-router-dom'; import '../../mock/match_media'; @@ -35,7 +34,7 @@ jest.mock('../../components/query_bar', () => ({ })); let localSource: Array<{ - request: GraphQLRequest; + request: {}; result: { data: { source: { diff --git a/x-pack/legacy/plugins/siem/public/pages/overview/overview.tsx b/x-pack/legacy/plugins/siem/public/pages/overview/overview.tsx index 83d36e043b6e0..2db49e60193fc 100644 --- a/x-pack/legacy/plugins/siem/public/pages/overview/overview.tsx +++ b/x-pack/legacy/plugins/siem/public/pages/overview/overview.tsx @@ -15,8 +15,8 @@ import { AlertsByCategory } from './alerts_by_category'; import { FiltersGlobal } from '../../components/filters_global'; import { SiemSearchBar } from '../../components/search_bar'; import { WrapperPage } from '../../components/wrapper_page'; -import { useGlobalTime } from '../../containers/global_time'; -import { useWithSource } from '../../containers/source'; +import { GlobalTime } from '../../containers/global_time'; +import { WithSource, indicesExistOrDataTemporarilyUnavailable } from '../../containers/source'; import { EventsByDataset } from './events_by_dataset'; import { EventCounts } from './event_counts'; import { OverviewEmpty } from './overview_empty'; @@ -37,86 +37,89 @@ const OverviewComponent: React.FC = ({ filters = NO_FILTERS, query = DEFAULT_QUERY, setAbsoluteRangeDatePicker, -}) => { - const { indexPattern, contentAvailable } = useWithSource(); - const { from, deleteQuery, setQuery, to } = useGlobalTime(); - - return ( - <> - {contentAvailable ? ( - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ) : ( - - )} - - - - ); -}; +}) => ( + <> + + {({ indicesExist, indexPattern }) => + indicesExistOrDataTemporarilyUnavailable(indicesExist) ? ( + + + + + + + + + + + + + + {({ from, deleteQuery, setQuery, to }) => ( + + + + + + + + + + + + + + + + + + + )} + + + + + + ) : ( + + ) + } + + + + +); const makeMapStateToProps = () => { const getGlobalFiltersQuerySelector = inputsSelectors.globalFiltersQuerySelector(); diff --git a/x-pack/legacy/plugins/siem/public/pages/overview/sidebar/sidebar.tsx b/x-pack/legacy/plugins/siem/public/pages/overview/sidebar/sidebar.tsx index ac09a3a72dc64..d3b85afe62a2a 100644 --- a/x-pack/legacy/plugins/siem/public/pages/overview/sidebar/sidebar.tsx +++ b/x-pack/legacy/plugins/siem/public/pages/overview/sidebar/sidebar.tsx @@ -14,6 +14,7 @@ import { StatefulRecentTimelines } from '../../../components/recent_timelines'; import { StatefulNewsFeed } from '../../../components/news_feed'; import { FilterMode } from '../../../components/recent_timelines/types'; import { SidebarHeader } from '../../../components/sidebar_header'; +import { useApolloClient } from '../../../utils/apollo_context'; import * as i18n from '../translations'; @@ -25,6 +26,7 @@ export const Sidebar = React.memo<{ filterBy: FilterMode; setFilterBy: (filterBy: FilterMode) => void; }>(({ filterBy, setFilterBy }) => { + const apolloClient = useApolloClient(); const RecentTimelinesFilters = useMemo( () => , [filterBy, setFilterBy] @@ -34,7 +36,7 @@ export const Sidebar = React.memo<{ {RecentTimelinesFilters} - + diff --git a/x-pack/legacy/plugins/siem/public/pages/timelines/index.tsx b/x-pack/legacy/plugins/siem/public/pages/timelines/index.tsx index 7102b64535617..aa5c891de3628 100644 --- a/x-pack/legacy/plugins/siem/public/pages/timelines/index.tsx +++ b/x-pack/legacy/plugins/siem/public/pages/timelines/index.tsx @@ -5,39 +5,12 @@ */ import React from 'react'; -import styled from 'styled-components'; +import { ApolloConsumer } from 'react-apollo'; -import { HeaderPage } from '../../components/header_page'; -import { StatefulOpenTimeline } from '../../components/open_timeline'; -import { WrapperPage } from '../../components/wrapper_page'; -import { SpyRoute } from '../../utils/route/spy_routes'; -import * as i18n from './translations'; +import { TimelinesPage } from './timelines_page'; -const TimelinesContainer = styled.div` - width: 100%; -`; -TimelinesContainer.displayName = 'TimelinesContainer'; +export const Timelines = React.memo(() => ( + {client => } +)); -export const DEFAULT_SEARCH_RESULTS_PER_PAGE = 10; - -export const TimelinesPage = () => ( - <> - - - - - - - - - - -); - -TimelinesPage.displayName = 'TimelinesPage'; - -export const Timelines = React.memo(TimelinesPage); +Timelines.displayName = 'Timelines'; diff --git a/x-pack/legacy/plugins/siem/public/pages/timelines/timelines_page.tsx b/x-pack/legacy/plugins/siem/public/pages/timelines/timelines_page.tsx new file mode 100644 index 0000000000000..86f702a8ad8a4 --- /dev/null +++ b/x-pack/legacy/plugins/siem/public/pages/timelines/timelines_page.tsx @@ -0,0 +1,48 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import ApolloClient from 'apollo-client'; +import React from 'react'; +import styled from 'styled-components'; + +import { HeaderPage } from '../../components/header_page'; +import { StatefulOpenTimeline } from '../../components/open_timeline'; +import { WrapperPage } from '../../components/wrapper_page'; +import { SpyRoute } from '../../utils/route/spy_routes'; +import * as i18n from './translations'; + +const TimelinesContainer = styled.div` + width: 100%; +`; + +interface TimelinesProps { + apolloClient: ApolloClient; +} + +type OwnProps = TimelinesProps; + +export const DEFAULT_SEARCH_RESULTS_PER_PAGE = 10; + +const TimelinesPageComponent: React.FC = ({ apolloClient }) => ( + <> + + + + + + + + + + +); + +export const TimelinesPage = React.memo(TimelinesPageComponent); diff --git a/x-pack/legacy/plugins/siem/public/store/timeline/epic_favorite.ts b/x-pack/legacy/plugins/siem/public/store/timeline/epic_favorite.ts index 52b2b8ec0c185..4d1b73aa70a6e 100644 --- a/x-pack/legacy/plugins/siem/public/store/timeline/epic_favorite.ts +++ b/x-pack/legacy/plugins/siem/public/store/timeline/epic_favorite.ts @@ -4,7 +4,8 @@ * you may not use this file except in compliance with the Elastic License. */ -import { ApolloClient, NormalizedCacheObject } from '@apollo/client'; +import { NormalizedCacheObject } from 'apollo-cache-inmemory'; +import { ApolloClient } from 'apollo-client'; import { get } from 'lodash/fp'; import { Action } from 'redux'; import { Epic } from 'redux-observable'; diff --git a/x-pack/legacy/plugins/siem/public/store/timeline/epic_note.ts b/x-pack/legacy/plugins/siem/public/store/timeline/epic_note.ts index 4dcdcbd33016b..e5a712fe2c666 100644 --- a/x-pack/legacy/plugins/siem/public/store/timeline/epic_note.ts +++ b/x-pack/legacy/plugins/siem/public/store/timeline/epic_note.ts @@ -4,7 +4,8 @@ * you may not use this file except in compliance with the Elastic License. */ -import { ApolloClient, NormalizedCacheObject } from '@apollo/client'; +import { ApolloClient } from 'apollo-client'; +import { NormalizedCacheObject } from 'apollo-cache-inmemory'; import { get } from 'lodash/fp'; import { Action } from 'redux'; import { Epic } from 'redux-observable'; diff --git a/x-pack/legacy/plugins/siem/public/store/timeline/epic_pinned_event.ts b/x-pack/legacy/plugins/siem/public/store/timeline/epic_pinned_event.ts index b73d1e3ad7fef..2260999a91e7b 100644 --- a/x-pack/legacy/plugins/siem/public/store/timeline/epic_pinned_event.ts +++ b/x-pack/legacy/plugins/siem/public/store/timeline/epic_pinned_event.ts @@ -4,7 +4,8 @@ * you may not use this file except in compliance with the Elastic License. */ -import { ApolloClient, NormalizedCacheObject } from '@apollo/client'; +import { NormalizedCacheObject } from 'apollo-cache-inmemory'; +import { ApolloClient } from 'apollo-client'; import { get, omit } from 'lodash/fp'; import { Action } from 'redux'; import { Epic } from 'redux-observable'; diff --git a/x-pack/legacy/plugins/siem/public/utils/apollo_context.ts b/x-pack/legacy/plugins/siem/public/utils/apollo_context.ts new file mode 100644 index 0000000000000..f0c5e7e917e13 --- /dev/null +++ b/x-pack/legacy/plugins/siem/public/utils/apollo_context.ts @@ -0,0 +1,19 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { ApolloClient } from 'apollo-client'; +import { createContext, useContext } from 'react'; + +/** + * This is a temporary provider and hook for use with hooks until react-apollo + * has upgraded to the new-style `createContext` api. + */ + +export const ApolloClientContext = createContext | undefined>(undefined); + +export const useApolloClient = () => { + return useContext(ApolloClientContext); +}; diff --git a/x-pack/legacy/plugins/siem/public/utils/route/spy_routes.tsx b/x-pack/legacy/plugins/siem/public/utils/route/spy_routes.tsx index 0d980c0bf7d66..ddee2359b28ba 100644 --- a/x-pack/legacy/plugins/siem/public/utils/route/spy_routes.tsx +++ b/x-pack/legacy/plugins/siem/public/utils/route/spy_routes.tsx @@ -81,8 +81,7 @@ export const SpyRouteComponent = memo( } }, [pathname, search, pageName, detailName, tabName, flowTarget, state]); return null; - }, - deepEqual + } ); export const SpyRoute = withRouter(SpyRouteComponent); diff --git a/x-pack/legacy/plugins/siem/public/utils/timeline/use_show_timeline.tsx b/x-pack/legacy/plugins/siem/public/utils/timeline/use_show_timeline.tsx deleted file mode 100644 index e969330b809ff..0000000000000 --- a/x-pack/legacy/plugins/siem/public/utils/timeline/use_show_timeline.tsx +++ /dev/null @@ -1,31 +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; - * you may not use this file except in compliance with the Elastic License. - */ - -import { useLocation } from 'react-router-dom'; - -import { useState, useEffect } from 'react'; -import { SiemPageName } from '../../pages/home/types'; - -const hideTimelineForRoutes = [`/${SiemPageName.case}/configure`]; - -export const useShowTimeline = () => { - const currentLocation = useLocation(); - const [showTimeline, setShowTimeline] = useState( - !hideTimelineForRoutes.includes(currentLocation.pathname) - ); - - useEffect(() => { - if (hideTimelineForRoutes.includes(currentLocation.pathname)) { - if (showTimeline) { - setShowTimeline(false); - } - } else if (!showTimeline) { - setShowTimeline(true); - } - }, [currentLocation.pathname]); - - return [showTimeline]; -}; diff --git a/x-pack/legacy/plugins/siem/scripts/combined_schema.ts b/x-pack/legacy/plugins/siem/scripts/combined_schema.ts index 71eaf8490f7e2..625eb3a4a4755 100644 --- a/x-pack/legacy/plugins/siem/scripts/combined_schema.ts +++ b/x-pack/legacy/plugins/siem/scripts/combined_schema.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { buildSchemaFromTypeDefinitions } from '@kamilkisiela/graphql-tools'; +import { buildSchemaFromTypeDefinitions } from 'graphql-tools'; import { schemas as serverSchemas } from '../server/graphql'; diff --git a/x-pack/legacy/plugins/siem/scripts/generate_types_from_graphql.js b/x-pack/legacy/plugins/siem/scripts/generate_types_from_graphql.js index e6f5f2388a281..36674fec73e09 100644 --- a/x-pack/legacy/plugins/siem/scripts/generate_types_from_graphql.js +++ b/x-pack/legacy/plugins/siem/scripts/generate_types_from_graphql.js @@ -4,171 +4,138 @@ * you may not use this file except in compliance with the Elastic License. */ -/* eslint-disable import/no-extraneous-dependencies */ - require('../../../../../src/setup_node_env'); -const path = require('path'); -const { codegen } = require('@graphql-codegen/core'); -const { loadDocuments } = require('@graphql-toolkit/core'); -const { GraphQLFileLoader } = require('@graphql-toolkit/graphql-file-loader'); -const { CodeFileLoader } = require('@graphql-toolkit/code-file-loader'); +const { join, resolve } = require('path'); +// eslint-disable-next-line import/no-extraneous-dependencies, import/no-unresolved +const { generate } = require('graphql-code-generator'); const GRAPHQL_GLOBS = [ - path.join('public', 'containers', '**', '*.gql_query.ts'), - path.join('common', 'graphql', '**', '*.gql_query.ts'), + join('public', 'containers', '**', '*.gql_query.ts{,x}'), + join('common', 'graphql', '**', '*.gql_query.ts{,x}'), ]; -const OUTPUT_CLIENT_TYPES_PATH = path.resolve('public', 'graphql', 'types.tsx'); -const OUTPUT_SERVER_TYPES_PATH = path.resolve('server', 'graphql', 'types.ts'); -const combinedSchema = require('./combined_schema'); - -const { printSchema, parse } = require('graphql'); -const fs = require('fs'); -const addPlugin = require('@graphql-codegen/add'); -const typescriptPlugin = require('@graphql-codegen/typescript'); -const typescriptOperationsPlugin = require('@graphql-codegen/typescript-operations'); -const typescriptResolversPlugin = require('@graphql-codegen/typescript-resolvers'); -const typescriptCompatibilityPlugin = require('@graphql-codegen/typescript-compatibility'); -const typescriptReactApolloPlugin = require('@graphql-codegen/typescript-react-apollo'); +const OUTPUT_INTROSPECTION_PATH = resolve('public', 'graphql', 'introspection.json'); +const OUTPUT_CLIENT_TYPES_PATH = resolve('public', 'graphql', 'types.ts'); +const OUTPUT_SERVER_TYPES_PATH = resolve('server', 'graphql', 'types.ts'); +const SCHEMA_PATH = resolve(__dirname, 'combined_schema.ts'); async function main() { - const documents = await loadDocuments(GRAPHQL_GLOBS, { - loaders: [new GraphQLFileLoader(), new CodeFileLoader()], - }); - - const client = await codegen({ - schema: parse(printSchema(combinedSchema.default)), - documents, - overwrite: true, - filename: OUTPUT_CLIENT_TYPES_PATH, - primitives: { - String: 'string', - Int: 'number', - Float: 'number', - Boolean: 'boolean', - ID: 'string', - }, - config: { - dedupeOperationSuffix: false, - preResolveTypes: true, - avoidOptionals: false, - namingConvention: { - typeNames: 'change-case#pascalCase', - enumValues: 'keep', - }, - contextType: 'SiemContext', - scalars: { - ToStringArray: 'string[]', - ToNumberArray: 'number[]', - ToDateArray: 'string[]', - ToBooleanArray: 'boolean[]', - Date: 'string', - }, - }, - plugins: [ - { - add: [ - '/*', - ' * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one', - ' * or more contributor license agreements. Licensed under the Elastic License;', - ' * you may not use this file except in compliance with the Elastic License.', - ' */', - '', - '/* tslint:disable */', - '/* eslint-disable */', - '', - ].join('\n'), - }, - { - typescript: {}, - }, - { - 'typescript-operations': {}, - }, - { - 'typescript-react-apollo': { - apolloReactComponentsImportFrom: '@apollo/react-components', - reactApolloVersion: 3, - withHooks: true, - withHOC: false, + await generate( + { + schema: SCHEMA_PATH, + overwrite: true, + generates: { + [OUTPUT_INTROSPECTION_PATH]: { + documents: GRAPHQL_GLOBS, + primitives: { + String: 'string', + Int: 'number', + Float: 'number', + Boolean: 'boolean', + ID: 'string', + }, + config: { + namingConvention: { + typeNames: 'change-case#pascalCase', + enumValues: 'keep', + }, + contextType: 'SiemContext', + scalars: { + ToStringArray: 'string[] | string', + ToNumberArray: 'number[] | number', + ToDateArray: 'string[] | string', + ToBooleanArray: 'boolean[] | boolean', + Date: 'string', + }, + }, + plugins: ['introspection'], }, - }, - { - 'typescript-compatibility': {}, - }, - ], - pluginMap: { - add: addPlugin, - typescript: typescriptPlugin, - 'typescript-operations': typescriptOperationsPlugin, - 'typescript-react-apollo': typescriptReactApolloPlugin, - 'typescript-compatibility': typescriptCompatibilityPlugin, - }, - }); + [OUTPUT_CLIENT_TYPES_PATH]: { + documents: GRAPHQL_GLOBS, + primitives: { + String: 'string', + Int: 'number', + Float: 'number', + Boolean: 'boolean', + ID: 'string', + }, + config: { + avoidOptionals: false, + namingConvention: { + typeNames: 'change-case#pascalCase', + enumValues: 'keep', + }, + contextType: 'SiemContext', + scalars: { + ToStringArray: 'string[]', + ToNumberArray: 'number[]', + ToDateArray: 'string[]', + ToBooleanArray: 'boolean[]', + Date: 'string', + }, + }, + plugins: [ + { + add: `/* tslint:disable */ + /* eslint-disable */ + /* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + `, + }, + 'typescript-common', + 'typescript-server', + 'typescript-client', + ], + }, + [OUTPUT_SERVER_TYPES_PATH]: { + primitives: { + String: 'string', + Int: 'number', + Float: 'number', + Boolean: 'boolean', + ID: 'string', + }, + config: { + avoidOptionals: false, + namingConvention: { + typeNames: 'change-case#pascalCase', + enumValues: 'keep', + }, + contextType: 'SiemContext', + scalars: { + ToStringArray: 'string[] | string', + ToNumberArray: 'number[] | number', + ToDateArray: 'string[] | string', + ToBooleanArray: 'boolean[] | boolean', + Date: 'string', + }, + }, + plugins: [ + { + add: ` + /* tslint:disable */ + /* eslint-disable */ + /* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ - const server = await codegen({ - schema: parse(printSchema(combinedSchema.default)), - documents, - overwrite: true, - filename: OUTPUT_SERVER_TYPES_PATH, - primitives: { - String: 'string', - Int: 'number', - Float: 'number', - Boolean: 'boolean', - ID: 'string', - }, - config: { - declarationKind: 'interface', - useIndexSignature: true, - skipTypename: true, - avoidOptionals: false, - preResolveTypes: true, - namingConvention: { - typeNames: 'change-case#pascalCase', - enumValues: 'keep', - }, - contextType: 'SiemContext', - scalars: { - ToStringArray: 'string[] | string', - ToNumberArray: 'number[] | number', - ToDateArray: 'string[] | string', - ToBooleanArray: 'boolean[] | boolean', - Date: 'string', - }, - }, - plugins: [ - { - add: [ - '/*', - ' * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one', - ' * or more contributor license agreements. Licensed under the Elastic License;', - ' * you may not use this file except in compliance with the Elastic License.', - '*/', - '', - '/* tslint:disable */', - '/* eslint-disable */', - '', - `import { SiemContext } from '../lib/types';`, - '', - ].join('\n'), - }, - { - typescript: {}, - }, - { - 'typescript-resolvers': {}, + import { SiemContext } from '../lib/types'; + `, + }, + 'typescript-common', + 'typescript-server', + 'typescript-resolvers', + ], + }, }, - ], - pluginMap: { - add: addPlugin, - typescript: typescriptPlugin, - 'typescript-resolvers': typescriptResolversPlugin, }, - }); - - fs.writeFileSync(OUTPUT_CLIENT_TYPES_PATH, client); - fs.writeFileSync(OUTPUT_SERVER_TYPES_PATH, server); + true + ); } if (require.main === module) { diff --git a/x-pack/legacy/plugins/siem/server/graphql/authentications/resolvers.ts b/x-pack/legacy/plugins/siem/server/graphql/authentications/resolvers.ts index 4bb626285e3ce..b66ccd9a111b7 100644 --- a/x-pack/legacy/plugins/siem/server/graphql/authentications/resolvers.ts +++ b/x-pack/legacy/plugins/siem/server/graphql/authentications/resolvers.ts @@ -6,7 +6,14 @@ import { SourceResolvers } from '../../graphql/types'; import { Authentications } from '../../lib/authentications'; +import { AppResolverOf, ChildResolverOf } from '../../lib/framework'; import { createOptionsPaginated } from '../../utils/build_query/create_options'; +import { QuerySourceResolver } from '../sources/resolvers'; + +type QueryAuthenticationsResolver = ChildResolverOf< + AppResolverOf, + QuerySourceResolver +>; export interface AuthenticationsResolversDeps { authentications: Authentications; @@ -16,7 +23,7 @@ export const createAuthenticationsResolvers = ( libs: AuthenticationsResolversDeps ): { Source: { - Authentications: SourceResolvers['Authentications']; + Authentications: QueryAuthenticationsResolver; }; } => ({ Source: { diff --git a/x-pack/legacy/plugins/siem/server/graphql/authentications/schema.gql.ts b/x-pack/legacy/plugins/siem/server/graphql/authentications/schema.gql.ts index f297244762b1e..20935ce9ed03f 100644 --- a/x-pack/legacy/plugins/siem/server/graphql/authentications/schema.gql.ts +++ b/x-pack/legacy/plugins/siem/server/graphql/authentications/schema.gql.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { gql } from '@apollo/client'; +import gql from 'graphql-tag'; export const authenticationsSchema = gql` type LastSourceHost { diff --git a/x-pack/legacy/plugins/siem/server/graphql/ecs/schema.gql.ts b/x-pack/legacy/plugins/siem/server/graphql/ecs/schema.gql.ts index da7b1eda7935a..f897236b3470e 100644 --- a/x-pack/legacy/plugins/siem/server/graphql/ecs/schema.gql.ts +++ b/x-pack/legacy/plugins/siem/server/graphql/ecs/schema.gql.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { gql } from '@apollo/client'; +import gql from 'graphql-tag'; export const ecsSchema = gql` scalar ToStringArray diff --git a/x-pack/legacy/plugins/siem/server/graphql/events/resolvers.ts b/x-pack/legacy/plugins/siem/server/graphql/events/resolvers.ts index 7a57c6f3e3776..a9ef6bc682c84 100644 --- a/x-pack/legacy/plugins/siem/server/graphql/events/resolvers.ts +++ b/x-pack/legacy/plugins/siem/server/graphql/events/resolvers.ts @@ -7,21 +7,37 @@ import { GraphQLScalarType, Kind } from 'graphql'; import { Events } from '../../lib/events'; +import { AppResolverOf, ChildResolverOf } from '../../lib/framework'; import { createOptions } from '../../utils/build_query/create_options'; +import { QuerySourceResolver } from '../sources/resolvers'; import { SourceResolvers } from '../types'; import { LastEventTimeRequestOptions } from '../../lib/events/types'; +type QueryTimelineResolver = ChildResolverOf< + AppResolverOf, + QuerySourceResolver +>; + +type QueryTimelineDetailsResolver = ChildResolverOf< + AppResolverOf, + QuerySourceResolver +>; + +type QueryLastEventTimeResolver = ChildResolverOf< + AppResolverOf, + QuerySourceResolver +>; + export interface EventsResolversDeps { events: Events; } - export const createEventsResolvers = ( libs: EventsResolversDeps ): { Source: { - Timeline: SourceResolvers['Timeline']; - TimelineDetails: SourceResolvers['TimelineDetails']; - LastEventTime: SourceResolvers['LastEventTime']; + Timeline: QueryTimelineResolver; + TimelineDetails: QueryTimelineDetailsResolver; + LastEventTime: QueryLastEventTimeResolver; }; } => ({ Source: { diff --git a/x-pack/legacy/plugins/siem/server/graphql/events/schema.gql.ts b/x-pack/legacy/plugins/siem/server/graphql/events/schema.gql.ts index ffef0d218eb21..3b71977bc0d47 100644 --- a/x-pack/legacy/plugins/siem/server/graphql/events/schema.gql.ts +++ b/x-pack/legacy/plugins/siem/server/graphql/events/schema.gql.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { gql } from '@apollo/client'; +import gql from 'graphql-tag'; export const eventsSchema = gql` scalar EsValue diff --git a/x-pack/legacy/plugins/siem/server/graphql/hosts/resolvers.ts b/x-pack/legacy/plugins/siem/server/graphql/hosts/resolvers.ts index 9d86cb3ffae48..65403c4b31261 100644 --- a/x-pack/legacy/plugins/siem/server/graphql/hosts/resolvers.ts +++ b/x-pack/legacy/plugins/siem/server/graphql/hosts/resolvers.ts @@ -7,6 +7,7 @@ import { getOr } from 'lodash/fp'; import { SourceResolvers } from '../../graphql/types'; +import { AppResolverOf, ChildResolverOf } from '../../lib/framework'; import { Hosts, HostOverviewRequestOptions, @@ -15,6 +16,22 @@ import { } from '../../lib/hosts'; import { getFields } from '../../utils/build_query'; import { createOptionsPaginated } from '../../utils/build_query/create_options'; +import { QuerySourceResolver } from '../sources/resolvers'; + +type QueryHostsResolver = ChildResolverOf< + AppResolverOf, + QuerySourceResolver +>; + +type QueryHostOverviewResolver = ChildResolverOf< + AppResolverOf, + QuerySourceResolver +>; + +type QueryHostFirstLastSeenResolver = ChildResolverOf< + AppResolverOf, + QuerySourceResolver +>; export interface HostsResolversDeps { hosts: Hosts; @@ -24,9 +41,9 @@ export const createHostsResolvers = ( libs: HostsResolversDeps ): { Source: { - Hosts: SourceResolvers['Hosts']; - HostOverview: SourceResolvers['HostOverview']; - HostFirstLastSeen: SourceResolvers['HostFirstLastSeen']; + Hosts: QueryHostsResolver; + HostOverview: QueryHostOverviewResolver; + HostFirstLastSeen: QueryHostFirstLastSeenResolver; }; } => ({ Source: { diff --git a/x-pack/legacy/plugins/siem/server/graphql/hosts/schema.gql.ts b/x-pack/legacy/plugins/siem/server/graphql/hosts/schema.gql.ts index 763a83f82a1d8..d813a08cad6db 100644 --- a/x-pack/legacy/plugins/siem/server/graphql/hosts/schema.gql.ts +++ b/x-pack/legacy/plugins/siem/server/graphql/hosts/schema.gql.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { gql } from '@apollo/client'; +import gql from 'graphql-tag'; export const hostsSchema = gql` type OsFields { diff --git a/x-pack/legacy/plugins/siem/server/graphql/ip_details/resolvers.ts b/x-pack/legacy/plugins/siem/server/graphql/ip_details/resolvers.ts index ab3f0f67dcef2..d0e84026de473 100644 --- a/x-pack/legacy/plugins/siem/server/graphql/ip_details/resolvers.ts +++ b/x-pack/legacy/plugins/siem/server/graphql/ip_details/resolvers.ts @@ -5,8 +5,20 @@ */ import { SourceResolvers } from '../../graphql/types'; +import { AppResolverOf, ChildResolverOf } from '../../lib/framework'; import { IpDetails, UsersRequestOptions } from '../../lib/ip_details'; import { createOptions, createOptionsPaginated } from '../../utils/build_query/create_options'; +import { QuerySourceResolver } from '../sources/resolvers'; + +export type QueryIpOverviewResolver = ChildResolverOf< + AppResolverOf, + QuerySourceResolver +>; + +export type QueryUsersResolver = ChildResolverOf< + AppResolverOf, + QuerySourceResolver +>; export interface IDetailsResolversDeps { ipDetails: IpDetails; @@ -16,8 +28,8 @@ export const createIpDetailsResolvers = ( libs: IDetailsResolversDeps ): { Source: { - IpOverview: SourceResolvers['IpOverview']; - Users: SourceResolvers['Users']; + IpOverview: QueryIpOverviewResolver; + Users: QueryUsersResolver; }; } => ({ Source: { diff --git a/x-pack/legacy/plugins/siem/server/graphql/ip_details/schema.gql.ts b/x-pack/legacy/plugins/siem/server/graphql/ip_details/schema.gql.ts index adfe0601b3584..4684449c1b80f 100644 --- a/x-pack/legacy/plugins/siem/server/graphql/ip_details/schema.gql.ts +++ b/x-pack/legacy/plugins/siem/server/graphql/ip_details/schema.gql.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { gql } from '@apollo/client'; +import gql from 'graphql-tag'; const ipOverviewSchema = gql` type AutonomousSystemOrganization { diff --git a/x-pack/legacy/plugins/siem/server/graphql/kpi_hosts/resolvers.ts b/x-pack/legacy/plugins/siem/server/graphql/kpi_hosts/resolvers.ts index 5579a877bd3a7..6708bdcd55d62 100644 --- a/x-pack/legacy/plugins/siem/server/graphql/kpi_hosts/resolvers.ts +++ b/x-pack/legacy/plugins/siem/server/graphql/kpi_hosts/resolvers.ts @@ -5,8 +5,20 @@ */ import { SourceResolvers } from '../../graphql/types'; +import { AppResolverOf, ChildResolverOf } from '../../lib/framework'; import { KpiHosts } from '../../lib/kpi_hosts'; import { createOptions } from '../../utils/build_query/create_options'; +import { QuerySourceResolver } from '../sources/resolvers'; + +export type QueryKpiHostsResolver = ChildResolverOf< + AppResolverOf, + QuerySourceResolver +>; + +export type QueryKpiHostDetailsResolver = ChildResolverOf< + AppResolverOf, + QuerySourceResolver +>; export interface KpiHostsResolversDeps { kpiHosts: KpiHosts; @@ -16,8 +28,8 @@ export const createKpiHostsResolvers = ( libs: KpiHostsResolversDeps ): { Source: { - KpiHosts: SourceResolvers['KpiHosts']; - KpiHostDetails: SourceResolvers['KpiHostDetails']; + KpiHosts: QueryKpiHostsResolver; + KpiHostDetails: QueryKpiHostDetailsResolver; }; } => ({ Source: { diff --git a/x-pack/legacy/plugins/siem/server/graphql/kpi_hosts/schema.gql.ts b/x-pack/legacy/plugins/siem/server/graphql/kpi_hosts/schema.gql.ts index f73346432b89f..49c988436e977 100644 --- a/x-pack/legacy/plugins/siem/server/graphql/kpi_hosts/schema.gql.ts +++ b/x-pack/legacy/plugins/siem/server/graphql/kpi_hosts/schema.gql.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { gql } from '@apollo/client'; +import gql from 'graphql-tag'; export const kpiHostsSchema = gql` type KpiHostHistogramData { diff --git a/x-pack/legacy/plugins/siem/server/graphql/kpi_network/resolvers.ts b/x-pack/legacy/plugins/siem/server/graphql/kpi_network/resolvers.ts index 0cb14933fd887..b587d8c4ac726 100644 --- a/x-pack/legacy/plugins/siem/server/graphql/kpi_network/resolvers.ts +++ b/x-pack/legacy/plugins/siem/server/graphql/kpi_network/resolvers.ts @@ -5,8 +5,15 @@ */ import { SourceResolvers } from '../../graphql/types'; +import { AppResolverOf, ChildResolverOf } from '../../lib/framework'; import { KpiNetwork } from '../../lib/kpi_network'; import { createOptions } from '../../utils/build_query/create_options'; +import { QuerySourceResolver } from '../sources/resolvers'; + +export type QueryKipNetworkResolver = ChildResolverOf< + AppResolverOf, + QuerySourceResolver +>; export interface KpiNetworkResolversDeps { kpiNetwork: KpiNetwork; @@ -16,7 +23,7 @@ export const createKpiNetworkResolvers = ( libs: KpiNetworkResolversDeps ): { Source: { - KpiNetwork: SourceResolvers['KpiNetwork']; + KpiNetwork: QueryKipNetworkResolver; }; } => ({ Source: { diff --git a/x-pack/legacy/plugins/siem/server/graphql/kpi_network/schema.gql.ts b/x-pack/legacy/plugins/siem/server/graphql/kpi_network/schema.gql.ts index 9be8cc806a4c6..830240a83bd91 100644 --- a/x-pack/legacy/plugins/siem/server/graphql/kpi_network/schema.gql.ts +++ b/x-pack/legacy/plugins/siem/server/graphql/kpi_network/schema.gql.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { gql } from '@apollo/client'; +import gql from 'graphql-tag'; export const kpiNetworkSchema = gql` type KpiNetworkHistogramData { diff --git a/x-pack/legacy/plugins/siem/server/graphql/matrix_histogram/resolvers.ts b/x-pack/legacy/plugins/siem/server/graphql/matrix_histogram/resolvers.ts index c8375e53c5d61..35cebe4777dcf 100644 --- a/x-pack/legacy/plugins/siem/server/graphql/matrix_histogram/resolvers.ts +++ b/x-pack/legacy/plugins/siem/server/graphql/matrix_histogram/resolvers.ts @@ -5,18 +5,25 @@ */ import { MatrixHistogram } from '../../lib/matrix_histogram'; +import { AppResolverOf, ChildResolverOf } from '../../lib/framework'; import { createOptions } from '../../utils/build_query/create_options'; +import { QuerySourceResolver } from '../sources/resolvers'; import { SourceResolvers } from '../types'; export interface MatrixHistogramResolversDeps { matrixHistogram: MatrixHistogram; } +type QueryMatrixHistogramResolver = ChildResolverOf< + AppResolverOf, + QuerySourceResolver +>; + export const createMatrixHistogramResolvers = ( libs: MatrixHistogramResolversDeps ): { Source: { - MatrixHistogram: SourceResolvers['MatrixHistogram']; + MatrixHistogram: QueryMatrixHistogramResolver; }; } => ({ Source: { diff --git a/x-pack/legacy/plugins/siem/server/graphql/matrix_histogram/schema.gql.ts b/x-pack/legacy/plugins/siem/server/graphql/matrix_histogram/schema.gql.ts index 7dd0cbe5ba13f..deda6dc6e5c1a 100644 --- a/x-pack/legacy/plugins/siem/server/graphql/matrix_histogram/schema.gql.ts +++ b/x-pack/legacy/plugins/siem/server/graphql/matrix_histogram/schema.gql.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { gql } from '@apollo/client'; +import gql from 'graphql-tag'; export const matrixHistogramSchema = gql` type MatrixOverTimeHistogramData { diff --git a/x-pack/legacy/plugins/siem/server/graphql/network/resolvers.ts b/x-pack/legacy/plugins/siem/server/graphql/network/resolvers.ts index b99d026b33963..db15babc42a72 100644 --- a/x-pack/legacy/plugins/siem/server/graphql/network/resolvers.ts +++ b/x-pack/legacy/plugins/siem/server/graphql/network/resolvers.ts @@ -5,8 +5,30 @@ */ import { SourceResolvers } from '../../graphql/types'; +import { AppResolverOf, ChildResolverOf } from '../../lib/framework'; import { Network } from '../../lib/network'; import { createOptionsPaginated } from '../../utils/build_query/create_options'; +import { QuerySourceResolver } from '../sources/resolvers'; + +type QueryNetworkTopCountriesResolver = ChildResolverOf< + AppResolverOf, + QuerySourceResolver +>; + +type QueryNetworkTopNFlowResolver = ChildResolverOf< + AppResolverOf, + QuerySourceResolver +>; + +type QueryNetworkHttpResolver = ChildResolverOf< + AppResolverOf, + QuerySourceResolver +>; + +type QueryDnsResolver = ChildResolverOf< + AppResolverOf, + QuerySourceResolver +>; export interface NetworkResolversDeps { network: Network; @@ -16,10 +38,10 @@ export const createNetworkResolvers = ( libs: NetworkResolversDeps ): { Source: { - NetworkHttp: SourceResolvers['NetworkHttp']; - NetworkTopCountries: SourceResolvers['NetworkTopCountries']; - NetworkTopNFlow: SourceResolvers['NetworkTopNFlow']; - NetworkDns: SourceResolvers['NetworkDns']; + NetworkHttp: QueryNetworkHttpResolver; + NetworkTopCountries: QueryNetworkTopCountriesResolver; + NetworkTopNFlow: QueryNetworkTopNFlowResolver; + NetworkDns: QueryDnsResolver; }; } => ({ Source: { diff --git a/x-pack/legacy/plugins/siem/server/graphql/network/schema.gql.ts b/x-pack/legacy/plugins/siem/server/graphql/network/schema.gql.ts index c4d999cebb6f0..15e2d832a73c9 100644 --- a/x-pack/legacy/plugins/siem/server/graphql/network/schema.gql.ts +++ b/x-pack/legacy/plugins/siem/server/graphql/network/schema.gql.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { gql } from '@apollo/client'; +import gql from 'graphql-tag'; export const networkSchema = gql` enum NetworkDirectionEcs { diff --git a/x-pack/legacy/plugins/siem/server/graphql/note/resolvers.ts b/x-pack/legacy/plugins/siem/server/graphql/note/resolvers.ts index 2f6c0f775d97d..5f816b9ada54e 100644 --- a/x-pack/legacy/plugins/siem/server/graphql/note/resolvers.ts +++ b/x-pack/legacy/plugins/siem/server/graphql/note/resolvers.ts @@ -4,9 +4,33 @@ * you may not use this file except in compliance with the Elastic License. */ +import { AppResolverWithFields, AppResolverOf } from '../../lib/framework'; import { MutationResolvers, QueryResolvers } from '../types'; import { Note } from '../../lib/note/saved_object'; +export type QueryNoteResolver = AppResolverOf; + +export type QueryAllNoteResolver = AppResolverWithFields< + QueryResolvers.GetAllNotesResolver, + 'totalCount' | 'Note' +>; + +export type QueryNotesByTimelineIdResolver = AppResolverOf< + QueryResolvers.GetNotesByTimelineIdResolver +>; + +export type QueryNotesByEventIdResolver = AppResolverOf; + +export type MutationNoteResolver = AppResolverOf< + MutationResolvers.PersistNoteResolver +>; + +export type MutationDeleteNoteResolver = AppResolverOf; + +export type MutationDeleteNoteByTimelineIdResolver = AppResolverOf< + MutationResolvers.DeleteNoteByTimelineIdResolver +>; + interface NoteResolversDeps { note: Note; } @@ -15,15 +39,15 @@ export const createNoteResolvers = ( libs: NoteResolversDeps ): { Query: { - getNote: QueryResolvers['getNote']; - getAllNotes: QueryResolvers['getAllNotes']; - getNotesByEventId: QueryResolvers['getNotesByEventId']; - getNotesByTimelineId: QueryResolvers['getNotesByTimelineId']; + getNote: QueryNoteResolver; + getAllNotes: QueryAllNoteResolver; + getNotesByEventId: QueryNotesByEventIdResolver; + getNotesByTimelineId: QueryNotesByTimelineIdResolver; }; Mutation: { - deleteNote: MutationResolvers['deleteNote']; - deleteNoteByTimelineId: MutationResolvers['deleteNoteByTimelineId']; - persistNote: MutationResolvers['persistNote']; + deleteNote: MutationDeleteNoteResolver; + deleteNoteByTimelineId: MutationDeleteNoteByTimelineIdResolver; + persistNote: MutationNoteResolver; }; } => ({ Query: { diff --git a/x-pack/legacy/plugins/siem/server/graphql/note/schema.gql.ts b/x-pack/legacy/plugins/siem/server/graphql/note/schema.gql.ts index 610d303d42b33..fa26660d088c1 100644 --- a/x-pack/legacy/plugins/siem/server/graphql/note/schema.gql.ts +++ b/x-pack/legacy/plugins/siem/server/graphql/note/schema.gql.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { gql } from '@apollo/client'; +import gql from 'graphql-tag'; const note = ` eventId: String diff --git a/x-pack/legacy/plugins/siem/server/graphql/overview/resolvers.ts b/x-pack/legacy/plugins/siem/server/graphql/overview/resolvers.ts index beb9c8fc1a0e1..a7bafabb64092 100644 --- a/x-pack/legacy/plugins/siem/server/graphql/overview/resolvers.ts +++ b/x-pack/legacy/plugins/siem/server/graphql/overview/resolvers.ts @@ -5,8 +5,20 @@ */ import { SourceResolvers } from '../../graphql/types'; +import { AppResolverOf, ChildResolverOf } from '../../lib/framework'; import { Overview } from '../../lib/overview'; import { createOptions } from '../../utils/build_query/create_options'; +import { QuerySourceResolver } from '../sources/resolvers'; + +export type QueryOverviewNetworkResolver = ChildResolverOf< + AppResolverOf, + QuerySourceResolver +>; + +export type QueryOverviewHostResolver = ChildResolverOf< + AppResolverOf, + QuerySourceResolver +>; export interface OverviewResolversDeps { overview: Overview; @@ -16,8 +28,8 @@ export const createOverviewResolvers = ( libs: OverviewResolversDeps ): { Source: { - OverviewHost: SourceResolvers['OverviewHost']; - OverviewNetwork: SourceResolvers['OverviewNetwork']; + OverviewHost: QueryOverviewHostResolver; + OverviewNetwork: QueryOverviewNetworkResolver; }; } => ({ Source: { diff --git a/x-pack/legacy/plugins/siem/server/graphql/overview/schema.gql.ts b/x-pack/legacy/plugins/siem/server/graphql/overview/schema.gql.ts index ffb44dad1e3cf..7ab4f9fdb18d6 100644 --- a/x-pack/legacy/plugins/siem/server/graphql/overview/schema.gql.ts +++ b/x-pack/legacy/plugins/siem/server/graphql/overview/schema.gql.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { gql } from '@apollo/client'; +import gql from 'graphql-tag'; export const overviewSchema = gql` type OverviewNetworkData { diff --git a/x-pack/legacy/plugins/siem/server/graphql/pinned_event/resolvers.ts b/x-pack/legacy/plugins/siem/server/graphql/pinned_event/resolvers.ts index 77322120e265b..49072f0279de8 100644 --- a/x-pack/legacy/plugins/siem/server/graphql/pinned_event/resolvers.ts +++ b/x-pack/legacy/plugins/siem/server/graphql/pinned_event/resolvers.ts @@ -4,9 +4,26 @@ * you may not use this file except in compliance with the Elastic License. */ +import { AppResolverOf } from '../../lib/framework'; import { MutationResolvers, QueryResolvers } from '../types'; import { PinnedEvent } from '../../lib/pinned_event/saved_object'; +export type QueryAllPinnedEventsByTimelineIdResolver = AppResolverOf< + QueryResolvers.GetAllPinnedEventsByTimelineIdResolver +>; + +export type MutationPinnedEventResolver = AppResolverOf< + MutationResolvers.PersistPinnedEventOnTimelineResolver +>; + +export type MutationDeletePinnedEventOnTimelineResolver = AppResolverOf< + MutationResolvers.DeletePinnedEventOnTimelineResolver +>; + +export type MutationDeleteAllPinnedEventsOnTimelineResolver = AppResolverOf< + MutationResolvers.DeleteAllPinnedEventsOnTimelineResolver +>; + interface TimelineResolversDeps { pinnedEvent: PinnedEvent; } @@ -15,12 +32,12 @@ export const createPinnedEventResolvers = ( libs: TimelineResolversDeps ): { Query: { - getAllPinnedEventsByTimelineId: QueryResolvers['getAllPinnedEventsByTimelineId']; + getAllPinnedEventsByTimelineId: QueryAllPinnedEventsByTimelineIdResolver; }; Mutation: { - persistPinnedEventOnTimeline: MutationResolvers['persistPinnedEventOnTimeline']; - deletePinnedEventOnTimeline: MutationResolvers['deletePinnedEventOnTimeline']; - deleteAllPinnedEventsOnTimeline: MutationResolvers['deleteAllPinnedEventsOnTimeline']; + persistPinnedEventOnTimeline: MutationPinnedEventResolver; + deletePinnedEventOnTimeline: MutationDeletePinnedEventOnTimelineResolver; + deleteAllPinnedEventsOnTimeline: MutationDeleteAllPinnedEventsOnTimelineResolver; }; } => ({ Query: { diff --git a/x-pack/legacy/plugins/siem/server/graphql/pinned_event/schema.gql.ts b/x-pack/legacy/plugins/siem/server/graphql/pinned_event/schema.gql.ts index 1c139f12af8c1..a797cd6720af2 100644 --- a/x-pack/legacy/plugins/siem/server/graphql/pinned_event/schema.gql.ts +++ b/x-pack/legacy/plugins/siem/server/graphql/pinned_event/schema.gql.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { gql } from '@apollo/client'; +import gql from 'graphql-tag'; export const pinnedEventSchema = gql` ######################### diff --git a/x-pack/legacy/plugins/siem/server/graphql/scalar_date/resolvers.test.ts b/x-pack/legacy/plugins/siem/server/graphql/scalar_date/resolvers.test.ts index a974c814cf0e4..4779d77ed446e 100644 --- a/x-pack/legacy/plugins/siem/server/graphql/scalar_date/resolvers.test.ts +++ b/x-pack/legacy/plugins/siem/server/graphql/scalar_date/resolvers.test.ts @@ -38,7 +38,7 @@ describe('Test ScalarDate Resolver', () => { kind: 'IntValue', value: '1514782800000', }; - const date = dateScalar.parseLiteral(valueNode, {}); + const date = dateScalar.parseLiteral(valueNode); expect(date).toEqual(1514782800000); }); @@ -47,7 +47,7 @@ describe('Test ScalarDate Resolver', () => { kind: 'StringValue', value: '2018-01-01T05:00:00.000Z', }; - const date = dateScalar.parseLiteral(valueNode, {}); + const date = dateScalar.parseLiteral(valueNode); expect(date).toEqual('2018-01-01T05:00:00.000Z'); }); }); diff --git a/x-pack/legacy/plugins/siem/server/graphql/scalar_date/schema.gql.ts b/x-pack/legacy/plugins/siem/server/graphql/scalar_date/schema.gql.ts index e9b6864427930..c18f6ba98014b 100644 --- a/x-pack/legacy/plugins/siem/server/graphql/scalar_date/schema.gql.ts +++ b/x-pack/legacy/plugins/siem/server/graphql/scalar_date/schema.gql.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { gql } from '@apollo/client'; +import gql from 'graphql-tag'; export const dateSchema = gql` scalar Date diff --git a/x-pack/legacy/plugins/siem/server/graphql/scalar_to_any/schema.gql.ts b/x-pack/legacy/plugins/siem/server/graphql/scalar_to_any/schema.gql.ts index ead1865ec2d7b..f0adde0945b5f 100644 --- a/x-pack/legacy/plugins/siem/server/graphql/scalar_to_any/schema.gql.ts +++ b/x-pack/legacy/plugins/siem/server/graphql/scalar_to_any/schema.gql.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { gql } from '@apollo/client'; +import gql from 'graphql-tag'; export const toAnySchema = gql` scalar ToAny diff --git a/x-pack/legacy/plugins/siem/server/graphql/scalar_to_boolean_array/schema.gql.ts b/x-pack/legacy/plugins/siem/server/graphql/scalar_to_boolean_array/schema.gql.ts index 48c7e2a02b967..a741adf3cd89f 100644 --- a/x-pack/legacy/plugins/siem/server/graphql/scalar_to_boolean_array/schema.gql.ts +++ b/x-pack/legacy/plugins/siem/server/graphql/scalar_to_boolean_array/schema.gql.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { gql } from '@apollo/client'; +import gql from 'graphql-tag'; export const toBooleanSchema = gql` scalar ToBooleanArray diff --git a/x-pack/legacy/plugins/siem/server/graphql/scalar_to_date_array/schema.gql.ts b/x-pack/legacy/plugins/siem/server/graphql/scalar_to_date_array/schema.gql.ts index afe16dc1f4987..e7ec88c0c12cb 100644 --- a/x-pack/legacy/plugins/siem/server/graphql/scalar_to_date_array/schema.gql.ts +++ b/x-pack/legacy/plugins/siem/server/graphql/scalar_to_date_array/schema.gql.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { gql } from '@apollo/client'; +import gql from 'graphql-tag'; export const toDateSchema = gql` scalar ToDateArray diff --git a/x-pack/legacy/plugins/siem/server/graphql/scalar_to_number_array/schema.gql.ts b/x-pack/legacy/plugins/siem/server/graphql/scalar_to_number_array/schema.gql.ts index cecbb8b3a008b..1fe85cacd0ea0 100644 --- a/x-pack/legacy/plugins/siem/server/graphql/scalar_to_number_array/schema.gql.ts +++ b/x-pack/legacy/plugins/siem/server/graphql/scalar_to_number_array/schema.gql.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { gql } from '@apollo/client'; +import gql from 'graphql-tag'; export const toNumberSchema = gql` scalar ToNumberArray diff --git a/x-pack/legacy/plugins/siem/server/graphql/source_status/resolvers.ts b/x-pack/legacy/plugins/siem/server/graphql/source_status/resolvers.ts index db18f4e7bcaa2..24589822f0250 100644 --- a/x-pack/legacy/plugins/siem/server/graphql/source_status/resolvers.ts +++ b/x-pack/legacy/plugins/siem/server/graphql/source_status/resolvers.ts @@ -5,16 +5,28 @@ */ import { SourceStatusResolvers } from '../../graphql/types'; +import { AppResolverOf, ChildResolverOf } from '../../lib/framework'; import { IndexFields } from '../../lib/index_fields'; import { SourceStatus } from '../../lib/source_status'; +import { QuerySourceResolver } from '../sources/resolvers'; + +export type SourceStatusIndicesExistResolver = ChildResolverOf< + AppResolverOf, + QuerySourceResolver +>; + +export type SourceStatusIndexFieldsResolver = ChildResolverOf< + AppResolverOf, + QuerySourceResolver +>; export const createSourceStatusResolvers = (libs: { sourceStatus: SourceStatus; fields: IndexFields; }): { SourceStatus: { - indicesExist: SourceStatusResolvers['indicesExist']; - indexFields: SourceStatusResolvers['indexFields']; + indicesExist: SourceStatusIndicesExistResolver; + indexFields: SourceStatusIndexFieldsResolver; }; } => ({ SourceStatus: { diff --git a/x-pack/legacy/plugins/siem/server/graphql/source_status/schema.gql.ts b/x-pack/legacy/plugins/siem/server/graphql/source_status/schema.gql.ts index bce13eb1f8f88..e484b60f8f364 100644 --- a/x-pack/legacy/plugins/siem/server/graphql/source_status/schema.gql.ts +++ b/x-pack/legacy/plugins/siem/server/graphql/source_status/schema.gql.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { gql } from '@apollo/client'; +import gql from 'graphql-tag'; export const sourceStatusSchema = gql` "A descriptor of a field in an index" diff --git a/x-pack/legacy/plugins/siem/server/graphql/sources/resolvers.ts b/x-pack/legacy/plugins/siem/server/graphql/sources/resolvers.ts index c59888bf37938..f3cccfa15b566 100644 --- a/x-pack/legacy/plugins/siem/server/graphql/sources/resolvers.ts +++ b/x-pack/legacy/plugins/siem/server/graphql/sources/resolvers.ts @@ -4,41 +4,45 @@ * you may not use this file except in compliance with the Elastic License. */ +import { QueryResolvers, SourceResolvers } from '../../graphql/types'; import { - ResolversParentTypes, - Resolver, - ResolversTypes, - Maybe, - QuerySourceArgs, - RequireFields, -} from '../../graphql/types'; + AppResolverOf, + AppResolverWithFields, + ChildResolverOf, + ResultOf, +} from '../../lib/framework'; import { SourceStatus } from '../../lib/source_status'; import { Sources } from '../../lib/sources'; -import { SiemContext } from '../../lib/types'; -export const createSourcesResolvers = (libs: { +export type QuerySourceResolver = AppResolverWithFields< + QueryResolvers.SourceResolver, + 'id' | 'configuration' +>; + +export type QueryAllSourcesResolver = AppResolverWithFields< + QueryResolvers.AllSourcesResolver, + 'id' | 'configuration' +>; + +export type SourceStatusResolver = ChildResolverOf< + AppResolverOf>>, + QuerySourceResolver +>; + +export interface SourcesResolversDeps { sources: Sources; sourceStatus: SourceStatus; -}): { +} + +export const createSourcesResolvers = ( + libs: SourcesResolversDeps +): { Query: { - source: Resolver< - Pick, - ResolversParentTypes['Source'], - SiemContext, - RequireFields - >; - allSources: Resolver< - Array>, - ResolversParentTypes['Source'], - SiemContext - >; + source: QuerySourceResolver; + allSources: QueryAllSourcesResolver; }; Source: { - status: Resolver< - Maybe, - ResolversParentTypes['SourceStatus'], - SiemContext - >; + status: SourceStatusResolver; }; } => ({ Query: { diff --git a/x-pack/legacy/plugins/siem/server/graphql/sources/schema.gql.ts b/x-pack/legacy/plugins/siem/server/graphql/sources/schema.gql.ts index b60da4d2e95cb..f213b9db17c69 100644 --- a/x-pack/legacy/plugins/siem/server/graphql/sources/schema.gql.ts +++ b/x-pack/legacy/plugins/siem/server/graphql/sources/schema.gql.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { gql } from '@apollo/client'; +import gql from 'graphql-tag'; export const sourcesSchema = gql` extend type Query { diff --git a/x-pack/legacy/plugins/siem/server/graphql/timeline/resolvers.ts b/x-pack/legacy/plugins/siem/server/graphql/timeline/resolvers.ts index 04edf0b7b62f9..a33751179e93a 100644 --- a/x-pack/legacy/plugins/siem/server/graphql/timeline/resolvers.ts +++ b/x-pack/legacy/plugins/siem/server/graphql/timeline/resolvers.ts @@ -4,9 +4,27 @@ * you may not use this file except in compliance with the Elastic License. */ +import { AppResolverWithFields, AppResolverOf } from '../../lib/framework'; import { MutationResolvers, QueryResolvers } from '../types'; import { Timeline } from '../../lib/timeline/saved_object'; +export type QueryTimelineResolver = AppResolverOf; + +export type QueryAllTimelineResolver = AppResolverWithFields< + QueryResolvers.GetAllTimelineResolver, + 'totalCount' | 'timeline' +>; + +export type MutationTimelineResolver = AppResolverOf< + MutationResolvers.PersistTimelineResolver +>; + +export type MutationDeleteTimelineResolver = AppResolverOf< + MutationResolvers.DeleteTimelineResolver +>; + +export type MutationFavoriteResolver = AppResolverOf; + interface TimelineResolversDeps { timeline: Timeline; } @@ -15,13 +33,13 @@ export const createTimelineResolvers = ( libs: TimelineResolversDeps ): { Query: { - getOneTimeline: QueryResolvers['getOneTimeline']; - getAllTimeline: QueryResolvers['getAllTimeline']; + getOneTimeline: QueryTimelineResolver; + getAllTimeline: QueryAllTimelineResolver; }; Mutation: { - deleteTimeline: MutationResolvers['deleteTimeline']; - persistTimeline: MutationResolvers['persistTimeline']; - persistFavorite: MutationResolvers['persistFavorite']; + deleteTimeline: MutationDeleteTimelineResolver; + persistTimeline: MutationTimelineResolver; + persistFavorite: MutationFavoriteResolver; }; } => ({ Query: { diff --git a/x-pack/legacy/plugins/siem/server/graphql/timeline/schema.gql.ts b/x-pack/legacy/plugins/siem/server/graphql/timeline/schema.gql.ts index aae73489e8170..8b24cea0d6af9 100644 --- a/x-pack/legacy/plugins/siem/server/graphql/timeline/schema.gql.ts +++ b/x-pack/legacy/plugins/siem/server/graphql/timeline/schema.gql.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { gql } from '@apollo/client'; +import gql from 'graphql-tag'; const columnHeader = ` aggregatable: Boolean diff --git a/x-pack/legacy/plugins/siem/server/graphql/tls/resolvers.ts b/x-pack/legacy/plugins/siem/server/graphql/tls/resolvers.ts index 72cf76c0603b7..bfa3fddc3c8a5 100644 --- a/x-pack/legacy/plugins/siem/server/graphql/tls/resolvers.ts +++ b/x-pack/legacy/plugins/siem/server/graphql/tls/resolvers.ts @@ -5,8 +5,15 @@ */ import { SourceResolvers } from '../../graphql/types'; +import { AppResolverOf, ChildResolverOf } from '../../lib/framework'; import { TLS, TlsRequestOptions } from '../../lib/tls'; import { createOptionsPaginated } from '../../utils/build_query/create_options'; +import { QuerySourceResolver } from '../sources/resolvers'; + +export type QueryTlsResolver = ChildResolverOf< + AppResolverOf, + QuerySourceResolver +>; export interface TlsResolversDeps { tls: TLS; @@ -16,7 +23,7 @@ export const createTlsResolvers = ( libs: TlsResolversDeps ): { Source: { - Tls: SourceResolvers['Tls']; + Tls: QueryTlsResolver; }; } => ({ Source: { diff --git a/x-pack/legacy/plugins/siem/server/graphql/tls/schema.gql.ts b/x-pack/legacy/plugins/siem/server/graphql/tls/schema.gql.ts index fda139109f275..301960cea33ef 100644 --- a/x-pack/legacy/plugins/siem/server/graphql/tls/schema.gql.ts +++ b/x-pack/legacy/plugins/siem/server/graphql/tls/schema.gql.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { gql } from '@apollo/client'; +import gql from 'graphql-tag'; export const tlsSchema = gql` enum TlsFields { diff --git a/x-pack/legacy/plugins/siem/server/graphql/types.ts b/x-pack/legacy/plugins/siem/server/graphql/types.ts index 19b57c3519201..f42da48f2c1da 100644 --- a/x-pack/legacy/plugins/siem/server/graphql/types.ts +++ b/x-pack/legacy/plugins/siem/server/graphql/types.ts @@ -1,3876 +1,9189 @@ +/* tslint:disable */ +/* eslint-disable */ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. -*/ - -/* tslint:disable */ -/* eslint-disable */ + */ import { SiemContext } from '../lib/types'; -import { GraphQLResolveInfo, GraphQLScalarType, GraphQLScalarTypeConfig } from 'graphql'; export type Maybe = T | null; -export type RequireFields = { [X in Exclude]?: T[X] } & { [P in K]-?: NonNullable }; - -/** All built-in and custom scalars, mapped to their actual values */ -export interface Scalars { - ID: string, - String: string, - Boolean: boolean, - Int: number, - Float: number, - ToStringArray: string[] | string, - Date: string, - ToNumberArray: number[] | number, - ToDateArray: string[] | string, - ToBooleanArray: boolean[] | boolean, - ToAny: any, - EsValue: any, + +export interface PageInfoNote { + pageIndex: number; + + pageSize: number; } -export interface AuditdData { - acct?: Maybe, - terminal?: Maybe, - op?: Maybe, +export interface SortNote { + sortField: SortFieldNote; + + sortOrder: Direction; } -export interface AuditdEcsFields { - result?: Maybe, - session?: Maybe, - data?: Maybe, - summary?: Maybe, - sequence?: Maybe, +export interface TimerangeInput { + /** The interval string to use for last bucket. The format is '{value}{unit}'. For example '5m' would return the metrics for the last 5 minutes of the timespan. */ + interval: string; + /** The end of the timerange */ + to: number; + /** The beginning of the timerange */ + from: number; } -export interface AuditEcsFields { - package?: Maybe, +export interface PaginationInputPaginated { + /** The activePage parameter defines the page of results you want to fetch */ + activePage: number; + /** The cursorStart parameter defines the start of the results to be displayed */ + cursorStart: number; + /** The fakePossibleCount parameter determines the total count in order to show 5 additional pages */ + fakePossibleCount: number; + /** The querySize parameter is the number of items to be returned */ + querySize: number; } -export interface AuthEcsFields { - ssh?: Maybe, +export interface PaginationInput { + /** The limit parameter allows you to configure the maximum amount of items to be returned */ + limit: number; + /** The cursor parameter defines the next result you want to fetch */ + cursor?: Maybe; + /** The tiebreaker parameter allow to be more precise to fetch the next item */ + tiebreaker?: Maybe; } -export interface AuthenticationItem { - _id: Scalars['String'], - failures: Scalars['Float'], - successes: Scalars['Float'], - user: UserEcsFields, - lastSuccess?: Maybe, - lastFailure?: Maybe, +export interface SortField { + sortFieldId: string; + + direction: Direction; } -export interface AuthenticationsData { - edges: Array, - totalCount: Scalars['Float'], - pageInfo: PageInfoPaginated, - inspect?: Maybe, +export interface LastTimeDetails { + hostName?: Maybe; + + ip?: Maybe; } -export interface AuthenticationsEdges { - node: AuthenticationItem, - cursor: CursorType, +export interface HostsSortField { + field: HostsFields; + + direction: Direction; } -export interface AutonomousSystem { - number?: Maybe, - organization?: Maybe, +export interface UsersSortField { + field: UsersFields; + + direction: Direction; } -export interface AutonomousSystemItem { - name?: Maybe, - number?: Maybe, +export interface NetworkTopTablesSortField { + field: NetworkTopTablesFields; + + direction: Direction; } -export interface AutonomousSystemOrganization { - name?: Maybe, +export interface NetworkDnsSortField { + field: NetworkDnsFields; + + direction: Direction; +} + +export interface NetworkHttpSortField { + direction: Direction; +} + +export interface TlsSortField { + field: TlsFields; + + direction: Direction; +} + +export interface PageInfoTimeline { + pageIndex: number; + + pageSize: number; +} + +export interface SortTimeline { + sortField: SortFieldTimeline; + + sortOrder: Direction; +} + +export interface NoteInput { + eventId?: Maybe; + + note?: Maybe; + + timelineId?: Maybe; +} + +export interface TimelineInput { + columns?: Maybe; + + dataProviders?: Maybe; + + description?: Maybe; + + eventType?: Maybe; + + filters?: Maybe; + + kqlMode?: Maybe; + + kqlQuery?: Maybe; + + title?: Maybe; + + dateRange?: Maybe; + + savedQueryId?: Maybe; + + sort?: Maybe; +} + +export interface ColumnHeaderInput { + aggregatable?: Maybe; + + category?: Maybe; + + columnHeaderType?: Maybe; + + description?: Maybe; + + example?: Maybe; + + indexes?: Maybe; + + id?: Maybe; + + name?: Maybe; + + placeholder?: Maybe; + + searchable?: Maybe; + + type?: Maybe; +} + +export interface DataProviderInput { + id?: Maybe; + + name?: Maybe; + + enabled?: Maybe; + + excluded?: Maybe; + + kqlQuery?: Maybe; + + queryMatch?: Maybe; + + and?: Maybe; +} + +export interface QueryMatchInput { + field?: Maybe; + + displayField?: Maybe; + + value?: Maybe; + + displayValue?: Maybe; + + operator?: Maybe; +} + +export interface FilterTimelineInput { + exists?: Maybe; + + meta?: Maybe; + + match_all?: Maybe; + + missing?: Maybe; + + query?: Maybe; + + range?: Maybe; + + script?: Maybe; +} + +export interface FilterMetaTimelineInput { + alias?: Maybe; + + controlledBy?: Maybe; + + disabled?: Maybe; + + field?: Maybe; + + formattedValue?: Maybe; + + index?: Maybe; + + key?: Maybe; + + negate?: Maybe; + + params?: Maybe; + + type?: Maybe; + + value?: Maybe; +} + +export interface SerializedFilterQueryInput { + filterQuery?: Maybe; +} + +export interface SerializedKueryQueryInput { + kuery?: Maybe; + + serializedQuery?: Maybe; +} + +export interface KueryFilterQueryInput { + kind?: Maybe; + + expression?: Maybe; +} + +export interface DateRangePickerInput { + start?: Maybe; + + end?: Maybe; +} + +export interface SortTimelineInput { + columnId?: Maybe; + + sortDirection?: Maybe; +} + +export interface FavoriteTimelineInput { + fullName?: Maybe; + + userName?: Maybe; + + favoriteDate?: Maybe; +} + +export enum SortFieldNote { + updatedBy = 'updatedBy', + updated = 'updated', +} + +export enum Direction { + asc = 'asc', + desc = 'desc', +} + +export enum LastEventIndexKey { + hostDetails = 'hostDetails', + hosts = 'hosts', + ipDetails = 'ipDetails', + network = 'network', +} + +export enum HostsFields { + hostName = 'hostName', + lastSeen = 'lastSeen', +} + +export enum UsersFields { + name = 'name', + count = 'count', +} + +export enum FlowTarget { + client = 'client', + destination = 'destination', + server = 'server', + source = 'source', +} + +export enum HistogramType { + authentications = 'authentications', + anomalies = 'anomalies', + events = 'events', + alerts = 'alerts', + dns = 'dns', +} + +export enum FlowTargetSourceDest { + destination = 'destination', + source = 'source', +} + +export enum NetworkTopTablesFields { + bytes_in = 'bytes_in', + bytes_out = 'bytes_out', + flows = 'flows', + destination_ips = 'destination_ips', + source_ips = 'source_ips', +} + +export enum NetworkDnsFields { + dnsName = 'dnsName', + queryCount = 'queryCount', + uniqueDomains = 'uniqueDomains', + dnsBytesIn = 'dnsBytesIn', + dnsBytesOut = 'dnsBytesOut', +} + +export enum TlsFields { + _id = '_id', +} + +export enum SortFieldTimeline { + title = 'title', + description = 'description', + updated = 'updated', + created = 'created', +} + +export enum NetworkDirectionEcs { + inbound = 'inbound', + outbound = 'outbound', + internal = 'internal', + external = 'external', + incoming = 'incoming', + outgoing = 'outgoing', + listening = 'listening', + unknown = 'unknown', +} + +export enum NetworkHttpFields { + domains = 'domains', + lastHost = 'lastHost', + lastSourceIp = 'lastSourceIp', + methods = 'methods', + path = 'path', + requestCount = 'requestCount', + statuses = 'statuses', +} + +export enum FlowDirection { + uniDirectional = 'uniDirectional', + biDirectional = 'biDirectional', } -export interface CloudFields { - instance?: Maybe, - machine?: Maybe, - provider?: Maybe>>, - region?: Maybe>>, -} +export type ToStringArray = string[] | string; + +export type Date = string; + +export type ToNumberArray = number[] | number; + +export type ToDateArray = string[] | string; + +export type ToBooleanArray = boolean[] | boolean; + +export type ToAny = any; + +export type EsValue = any; + +// ==================================================== +// Scalars +// ==================================================== + +// ==================================================== +// Types +// ==================================================== + +export interface Query { + getNote: NoteResult; + + getNotesByTimelineId: NoteResult[]; + + getNotesByEventId: NoteResult[]; + + getAllNotes: ResponseNotes; + + getAllPinnedEventsByTimelineId: PinnedEvent[]; + /** Get a security data source by id */ + source: Source; + /** Get a list of all security data sources */ + allSources: Source[]; + + getOneTimeline: TimelineResult; + + getAllTimeline: ResponseTimelines; +} + +export interface NoteResult { + eventId?: Maybe; + + note?: Maybe; + + timelineId?: Maybe; + + noteId: string; + + created?: Maybe; + + createdBy?: Maybe; + + timelineVersion?: Maybe; + + updated?: Maybe; + + updatedBy?: Maybe; + + version?: Maybe; +} + +export interface ResponseNotes { + notes: NoteResult[]; + + totalCount?: Maybe; +} + +export interface PinnedEvent { + code?: Maybe; + + message?: Maybe; + + pinnedEventId: string; + + eventId?: Maybe; + + timelineId?: Maybe; + + timelineVersion?: Maybe; + + created?: Maybe; + + createdBy?: Maybe; + + updated?: Maybe; + + updatedBy?: Maybe; + + version?: Maybe; +} + +export interface Source { + /** The id of the source */ + id: string; + /** The raw configuration of the source */ + configuration: SourceConfiguration; + /** The status of the source */ + status: SourceStatus; + /** Gets Authentication success and failures based on a timerange */ + Authentications: AuthenticationsData; + + Timeline: TimelineData; + + TimelineDetails: TimelineDetailsData; + + LastEventTime: LastEventTimeData; + /** Gets Hosts based on timerange and specified criteria, or all events in the timerange if no criteria is specified */ + Hosts: HostsData; + + HostOverview: HostItem; + + HostFirstLastSeen: FirstLastSeenHost; + + IpOverview?: Maybe; + + Users: UsersData; + + KpiNetwork?: Maybe; + + KpiHosts: KpiHostsData; + + KpiHostDetails: KpiHostDetailsData; + + MatrixHistogram: MatrixHistogramOverTimeData; + + NetworkTopCountries: NetworkTopCountriesData; + + NetworkTopNFlow: NetworkTopNFlowData; + + NetworkDns: NetworkDnsData; + + NetworkDnsHistogram: NetworkDsOverTimeData; + + NetworkHttp: NetworkHttpData; + + OverviewNetwork?: Maybe; + + OverviewHost?: Maybe; + + Tls: TlsData; + /** Gets UncommonProcesses based on a timerange, or all UncommonProcesses if no criteria is specified */ + UncommonProcesses: UncommonProcessesData; + /** Just a simple example to get the app name */ + whoAmI?: Maybe; +} + +/** A set of configuration options for a security data source */ +export interface SourceConfiguration { + /** The field mapping to use for this source */ + fields: SourceFields; +} + +/** A mapping of semantic fields to their document counterparts */ +export interface SourceFields { + /** The field to identify a container by */ + container: string; + /** The fields to identify a host by */ + host: string; + /** The fields that may contain the log event message. The first field found win. */ + message: string[]; + /** The field to identify a pod by */ + pod: string; + /** The field to use as a tiebreaker for log events that have identical timestamps */ + tiebreaker: string; + /** The field to use as a timestamp for metrics and logs */ + timestamp: string; +} + +/** The status of an infrastructure data source */ +export interface SourceStatus { + /** Whether the configured alias or wildcard pattern resolve to any auditbeat indices */ + indicesExist: boolean; + /** The list of fields defined in the index mappings */ + indexFields: IndexField[]; +} + +/** A descriptor of a field in an index */ +export interface IndexField { + /** Where the field belong */ + category: string; + /** Example of field's value */ + example?: Maybe; + /** whether the field's belong to an alias index */ + indexes: (Maybe)[]; + /** The name of the field */ + name: string; + /** The type of the field's values as recognized by Kibana */ + type: string; + /** Whether the field's values can be efficiently searched for */ + searchable: boolean; + /** Whether the field's values can be aggregated */ + aggregatable: boolean; + /** Description of the field */ + description?: Maybe; + + format?: Maybe; +} + +export interface AuthenticationsData { + edges: AuthenticationsEdges[]; + + totalCount: number; + + pageInfo: PageInfoPaginated; + + inspect?: Maybe; +} + +export interface AuthenticationsEdges { + node: AuthenticationItem; + + cursor: CursorType; +} + +export interface AuthenticationItem { + _id: string; + + failures: number; + + successes: number; + + user: UserEcsFields; + + lastSuccess?: Maybe; + + lastFailure?: Maybe; +} + +export interface UserEcsFields { + domain?: Maybe; + + id?: Maybe; + + name?: Maybe; + + full_name?: Maybe; + + email?: Maybe; + + hash?: Maybe; + + group?: Maybe; +} + +export interface LastSourceHost { + timestamp?: Maybe; + + source?: Maybe; + + host?: Maybe; +} + +export interface SourceEcsFields { + bytes?: Maybe; + + ip?: Maybe; + + port?: Maybe; + + domain?: Maybe; + + geo?: Maybe; + + packets?: Maybe; +} + +export interface GeoEcsFields { + city_name?: Maybe; + + continent_name?: Maybe; + + country_iso_code?: Maybe; + + country_name?: Maybe; + + location?: Maybe; + + region_iso_code?: Maybe; + + region_name?: Maybe; +} + +export interface Location { + lon?: Maybe; + + lat?: Maybe; +} + +export interface HostEcsFields { + architecture?: Maybe; + + id?: Maybe; + + ip?: Maybe; + + mac?: Maybe; + + name?: Maybe; + + os?: Maybe; + + type?: Maybe; +} + +export interface OsEcsFields { + platform?: Maybe; + + name?: Maybe; + + full?: Maybe; + + family?: Maybe; + + version?: Maybe; + + kernel?: Maybe; +} + +export interface CursorType { + value?: Maybe; + + tiebreaker?: Maybe; +} + +export interface PageInfoPaginated { + activePage: number; + + fakeTotalCount: number; + + showMorePagesIndicator: boolean; +} + +export interface Inspect { + dsl: string[]; + + response: string[]; +} + +export interface TimelineData { + edges: TimelineEdges[]; + + totalCount: number; + + pageInfo: PageInfo; + + inspect?: Maybe; +} + +export interface TimelineEdges { + node: TimelineItem; + + cursor: CursorType; +} + +export interface TimelineItem { + _id: string; + + _index?: Maybe; + + data: TimelineNonEcsData[]; + + ecs: Ecs; +} + +export interface TimelineNonEcsData { + field: string; + + value?: Maybe; +} + +export interface Ecs { + _id: string; + + _index?: Maybe; + + auditd?: Maybe; + + destination?: Maybe; + + dns?: Maybe; + + endgame?: Maybe; + + event?: Maybe; + + geo?: Maybe; + + host?: Maybe; + + network?: Maybe; + + rule?: Maybe; + + signal?: Maybe; + + source?: Maybe; + + suricata?: Maybe; + + tls?: Maybe; + + zeek?: Maybe; + + http?: Maybe; + + url?: Maybe; + + timestamp?: Maybe; + + message?: Maybe; + + user?: Maybe; + + winlog?: Maybe; + + process?: Maybe; + + file?: Maybe; + + system?: Maybe; +} + +export interface AuditdEcsFields { + result?: Maybe; + + session?: Maybe; + + data?: Maybe; + + summary?: Maybe; + + sequence?: Maybe; +} + +export interface AuditdData { + acct?: Maybe; + + terminal?: Maybe; + + op?: Maybe; +} + +export interface Summary { + actor?: Maybe; + + object?: Maybe; + + how?: Maybe; + + message_type?: Maybe; + + sequence?: Maybe; +} + +export interface PrimarySecondary { + primary?: Maybe; + + secondary?: Maybe; + + type?: Maybe; +} + +export interface DestinationEcsFields { + bytes?: Maybe; + + ip?: Maybe; + + port?: Maybe; + + domain?: Maybe; + + geo?: Maybe; + + packets?: Maybe; +} + +export interface DnsEcsFields { + question?: Maybe; + + resolved_ip?: Maybe; + + response_code?: Maybe; +} + +export interface DnsQuestionData { + name?: Maybe; + + type?: Maybe; +} + +export interface EndgameEcsFields { + exit_code?: Maybe; + + file_name?: Maybe; + + file_path?: Maybe; + + logon_type?: Maybe; + + parent_process_name?: Maybe; + + pid?: Maybe; + + process_name?: Maybe; + + subject_domain_name?: Maybe; + + subject_logon_id?: Maybe; + + subject_user_name?: Maybe; + + target_domain_name?: Maybe; + + target_logon_id?: Maybe; + + target_user_name?: Maybe; +} + +export interface EventEcsFields { + action?: Maybe; + + category?: Maybe; + + code?: Maybe; + + created?: Maybe; + + dataset?: Maybe; + + duration?: Maybe; + + end?: Maybe; + + hash?: Maybe; + + id?: Maybe; + + kind?: Maybe; + + module?: Maybe; + + original?: Maybe; + + outcome?: Maybe; + + risk_score?: Maybe; + + risk_score_norm?: Maybe; + + severity?: Maybe; + + start?: Maybe; + + timezone?: Maybe; + + type?: Maybe; +} + +export interface NetworkEcsField { + bytes?: Maybe; + + community_id?: Maybe; + + direction?: Maybe; + + packets?: Maybe; + + protocol?: Maybe; + + transport?: Maybe; +} + +export interface RuleEcsField { + reference?: Maybe; +} + +export interface SignalField { + rule?: Maybe; + + original_time?: Maybe; +} + +export interface RuleField { + id?: Maybe; + + rule_id?: Maybe; + + false_positives: string[]; + + saved_id?: Maybe; + + timeline_id?: Maybe; + + timeline_title?: Maybe; + + max_signals?: Maybe; + + risk_score?: Maybe; + + output_index?: Maybe; + + description?: Maybe; + + from?: Maybe; + + immutable?: Maybe; + + index?: Maybe; + + interval?: Maybe; + + language?: Maybe; + + query?: Maybe; + + references?: Maybe; + + severity?: Maybe; + + tags?: Maybe; + + threat?: Maybe; + + type?: Maybe; + + size?: Maybe; + + to?: Maybe; + + enabled?: Maybe; + + filters?: Maybe; + + created_at?: Maybe; + + updated_at?: Maybe; + + created_by?: Maybe; + + updated_by?: Maybe; + + version?: Maybe; +} + +export interface SuricataEcsFields { + eve?: Maybe; +} + +export interface SuricataEveData { + alert?: Maybe; + + flow_id?: Maybe; + + proto?: Maybe; +} + +export interface SuricataAlertData { + signature?: Maybe; + + signature_id?: Maybe; +} + +export interface TlsEcsFields { + client_certificate?: Maybe; + + fingerprints?: Maybe; + + server_certificate?: Maybe; +} + +export interface TlsClientCertificateData { + fingerprint?: Maybe; +} + +export interface FingerprintData { + sha1?: Maybe; +} + +export interface TlsFingerprintsData { + ja3?: Maybe; +} + +export interface TlsJa3Data { + hash?: Maybe; +} + +export interface TlsServerCertificateData { + fingerprint?: Maybe; +} + +export interface ZeekEcsFields { + session_id?: Maybe; + + connection?: Maybe; + + notice?: Maybe; + + dns?: Maybe; + + http?: Maybe; + + files?: Maybe; + + ssl?: Maybe; +} + +export interface ZeekConnectionData { + local_resp?: Maybe; + + local_orig?: Maybe; + + missed_bytes?: Maybe; + + state?: Maybe; + + history?: Maybe; +} + +export interface ZeekNoticeData { + suppress_for?: Maybe; + + msg?: Maybe; + + note?: Maybe; + + sub?: Maybe; + + dst?: Maybe; + + dropped?: Maybe; + + peer_descr?: Maybe; +} + +export interface ZeekDnsData { + AA?: Maybe; + + qclass_name?: Maybe; + + RD?: Maybe; + + qtype_name?: Maybe; + + rejected?: Maybe; + + qtype?: Maybe; + + query?: Maybe; + + trans_id?: Maybe; + + qclass?: Maybe; + + RA?: Maybe; + + TC?: Maybe; +} + +export interface ZeekHttpData { + resp_mime_types?: Maybe; + + trans_depth?: Maybe; + + status_msg?: Maybe; + + resp_fuids?: Maybe; + + tags?: Maybe; +} + +export interface ZeekFileData { + session_ids?: Maybe; + + timedout?: Maybe; + + local_orig?: Maybe; + + tx_host?: Maybe; + + source?: Maybe; + + is_orig?: Maybe; + + overflow_bytes?: Maybe; + + sha1?: Maybe; + + duration?: Maybe; + + depth?: Maybe; + + analyzers?: Maybe; + + mime_type?: Maybe; + + rx_host?: Maybe; + + total_bytes?: Maybe; + + fuid?: Maybe; + + seen_bytes?: Maybe; + + missing_bytes?: Maybe; + + md5?: Maybe; +} + +export interface ZeekSslData { + cipher?: Maybe; + + established?: Maybe; + + resumed?: Maybe; + + version?: Maybe; +} + +export interface HttpEcsFields { + version?: Maybe; + + request?: Maybe; + + response?: Maybe; +} + +export interface HttpRequestData { + method?: Maybe; + + body?: Maybe; + + referrer?: Maybe; + + bytes?: Maybe; +} + +export interface HttpBodyData { + content?: Maybe; + + bytes?: Maybe; +} + +export interface HttpResponseData { + status_code?: Maybe; + + body?: Maybe; + + bytes?: Maybe; +} + +export interface UrlEcsFields { + domain?: Maybe; + + original?: Maybe; + + username?: Maybe; + + password?: Maybe; +} + +export interface WinlogEcsFields { + event_id?: Maybe; +} + +export interface ProcessEcsFields { + hash?: Maybe; + + pid?: Maybe; + + name?: Maybe; + + ppid?: Maybe; + + args?: Maybe; + + executable?: Maybe; + + title?: Maybe; + + thread?: Maybe; + + working_directory?: Maybe; +} + +export interface ProcessHashData { + md5?: Maybe; + + sha1?: Maybe; + + sha256?: Maybe; +} + +export interface Thread { + id?: Maybe; + + start?: Maybe; +} + +export interface FileFields { + name?: Maybe; + + path?: Maybe; + + target_path?: Maybe; + + extension?: Maybe; + + type?: Maybe; + + device?: Maybe; + + inode?: Maybe; + + uid?: Maybe; + + owner?: Maybe; + + gid?: Maybe; + + group?: Maybe; + + mode?: Maybe; + + size?: Maybe; + + mtime?: Maybe; + + ctime?: Maybe; +} + +export interface SystemEcsField { + audit?: Maybe; + + auth?: Maybe; +} + +export interface AuditEcsFields { + package?: Maybe; +} + +export interface PackageEcsFields { + arch?: Maybe; + + entity_id?: Maybe; + + name?: Maybe; + + size?: Maybe; + + summary?: Maybe; + + version?: Maybe; +} + +export interface AuthEcsFields { + ssh?: Maybe; +} + +export interface SshEcsFields { + method?: Maybe; + + signature?: Maybe; +} + +export interface PageInfo { + endCursor?: Maybe; + + hasNextPage?: Maybe; +} + +export interface TimelineDetailsData { + data?: Maybe; + + inspect?: Maybe; +} + +export interface DetailItem { + field: string; + + values?: Maybe; + + originalValue?: Maybe; +} + +export interface LastEventTimeData { + lastSeen?: Maybe; + + inspect?: Maybe; +} + +export interface HostsData { + edges: HostsEdges[]; + + totalCount: number; + + pageInfo: PageInfoPaginated; + + inspect?: Maybe; +} + +export interface HostsEdges { + node: HostItem; + + cursor: CursorType; +} + +export interface HostItem { + _id?: Maybe; + + lastSeen?: Maybe; + + host?: Maybe; + + cloud?: Maybe; + + inspect?: Maybe; +} + +export interface CloudFields { + instance?: Maybe; + + machine?: Maybe; + + provider?: Maybe<(Maybe)[]>; + + region?: Maybe<(Maybe)[]>; +} + +export interface CloudInstance { + id?: Maybe<(Maybe)[]>; +} + +export interface CloudMachine { + type?: Maybe<(Maybe)[]>; +} + +export interface FirstLastSeenHost { + inspect?: Maybe; + + firstSeen?: Maybe; + + lastSeen?: Maybe; +} + +export interface IpOverviewData { + client?: Maybe; + + destination?: Maybe; + + host: HostEcsFields; + + server?: Maybe; + + source?: Maybe; + + inspect?: Maybe; +} + +export interface Overview { + firstSeen?: Maybe; + + lastSeen?: Maybe; + + autonomousSystem: AutonomousSystem; + + geo: GeoEcsFields; +} + +export interface AutonomousSystem { + number?: Maybe; + + organization?: Maybe; +} + +export interface AutonomousSystemOrganization { + name?: Maybe; +} + +export interface UsersData { + edges: UsersEdges[]; + + totalCount: number; + + pageInfo: PageInfoPaginated; + + inspect?: Maybe; +} + +export interface UsersEdges { + node: UsersNode; + + cursor: CursorType; +} + +export interface UsersNode { + _id?: Maybe; + + timestamp?: Maybe; + + user?: Maybe; +} + +export interface UsersItem { + name?: Maybe; + + id?: Maybe; + + groupId?: Maybe; + + groupName?: Maybe; + + count?: Maybe; +} + +export interface KpiNetworkData { + networkEvents?: Maybe; + + uniqueFlowId?: Maybe; + + uniqueSourcePrivateIps?: Maybe; + + uniqueSourcePrivateIpsHistogram?: Maybe; + + uniqueDestinationPrivateIps?: Maybe; + + uniqueDestinationPrivateIpsHistogram?: Maybe; + + dnsQueries?: Maybe; + + tlsHandshakes?: Maybe; + + inspect?: Maybe; +} + +export interface KpiNetworkHistogramData { + x?: Maybe; + + y?: Maybe; +} + +export interface KpiHostsData { + hosts?: Maybe; + + hostsHistogram?: Maybe; + + authSuccess?: Maybe; + + authSuccessHistogram?: Maybe; + + authFailure?: Maybe; + + authFailureHistogram?: Maybe; + + uniqueSourceIps?: Maybe; + + uniqueSourceIpsHistogram?: Maybe; + + uniqueDestinationIps?: Maybe; + + uniqueDestinationIpsHistogram?: Maybe; + + inspect?: Maybe; +} + +export interface KpiHostHistogramData { + x?: Maybe; + + y?: Maybe; +} + +export interface KpiHostDetailsData { + authSuccess?: Maybe; + + authSuccessHistogram?: Maybe; + + authFailure?: Maybe; + + authFailureHistogram?: Maybe; + + uniqueSourceIps?: Maybe; + + uniqueSourceIpsHistogram?: Maybe; + + uniqueDestinationIps?: Maybe; + + uniqueDestinationIpsHistogram?: Maybe; + + inspect?: Maybe; +} + +export interface MatrixHistogramOverTimeData { + inspect?: Maybe; + + matrixHistogramData: MatrixOverTimeHistogramData[]; + + totalCount: number; +} + +export interface MatrixOverTimeHistogramData { + x?: Maybe; + + y?: Maybe; + + g?: Maybe; +} + +export interface NetworkTopCountriesData { + edges: NetworkTopCountriesEdges[]; + + totalCount: number; + + pageInfo: PageInfoPaginated; + + inspect?: Maybe; +} + +export interface NetworkTopCountriesEdges { + node: NetworkTopCountriesItem; + + cursor: CursorType; +} + +export interface NetworkTopCountriesItem { + _id?: Maybe; + + source?: Maybe; + + destination?: Maybe; + + network?: Maybe; +} + +export interface TopCountriesItemSource { + country?: Maybe; + + destination_ips?: Maybe; + + flows?: Maybe; + + location?: Maybe; + + source_ips?: Maybe; +} + +export interface GeoItem { + geo?: Maybe; + + flowTarget?: Maybe; +} + +export interface TopCountriesItemDestination { + country?: Maybe; + + destination_ips?: Maybe; + + flows?: Maybe; + + location?: Maybe; + + source_ips?: Maybe; +} + +export interface TopNetworkTablesEcsField { + bytes_in?: Maybe; + + bytes_out?: Maybe; +} + +export interface NetworkTopNFlowData { + edges: NetworkTopNFlowEdges[]; + + totalCount: number; + + pageInfo: PageInfoPaginated; + + inspect?: Maybe; +} + +export interface NetworkTopNFlowEdges { + node: NetworkTopNFlowItem; + + cursor: CursorType; +} + +export interface NetworkTopNFlowItem { + _id?: Maybe; + + source?: Maybe; + + destination?: Maybe; + + network?: Maybe; +} + +export interface TopNFlowItemSource { + autonomous_system?: Maybe; + + domain?: Maybe; + + ip?: Maybe; + + location?: Maybe; + + flows?: Maybe; + + destination_ips?: Maybe; +} + +export interface AutonomousSystemItem { + name?: Maybe; + + number?: Maybe; +} + +export interface TopNFlowItemDestination { + autonomous_system?: Maybe; + + domain?: Maybe; + + ip?: Maybe; + + location?: Maybe; + + flows?: Maybe; + + source_ips?: Maybe; +} + +export interface NetworkDnsData { + edges: NetworkDnsEdges[]; + + totalCount: number; + + pageInfo: PageInfoPaginated; + + inspect?: Maybe; + + histogram?: Maybe; +} + +export interface NetworkDnsEdges { + node: NetworkDnsItem; + + cursor: CursorType; +} + +export interface NetworkDnsItem { + _id?: Maybe; + + dnsBytesIn?: Maybe; + + dnsBytesOut?: Maybe; + + dnsName?: Maybe; + + queryCount?: Maybe; + + uniqueDomains?: Maybe; +} + +export interface MatrixOverOrdinalHistogramData { + x: string; + + y: number; + + g: string; +} + +export interface NetworkDsOverTimeData { + inspect?: Maybe; + + matrixHistogramData: MatrixOverTimeHistogramData[]; + + totalCount: number; +} + +export interface NetworkHttpData { + edges: NetworkHttpEdges[]; + + totalCount: number; + + pageInfo: PageInfoPaginated; + + inspect?: Maybe; +} + +export interface NetworkHttpEdges { + node: NetworkHttpItem; + + cursor: CursorType; +} + +export interface NetworkHttpItem { + _id?: Maybe; + + domains: string[]; + + lastHost?: Maybe; + + lastSourceIp?: Maybe; + + methods: string[]; + + path?: Maybe; + + requestCount?: Maybe; + + statuses: string[]; +} + +export interface OverviewNetworkData { + auditbeatSocket?: Maybe; + + filebeatCisco?: Maybe; + + filebeatNetflow?: Maybe; + + filebeatPanw?: Maybe; + + filebeatSuricata?: Maybe; + + filebeatZeek?: Maybe; + + packetbeatDNS?: Maybe; + + packetbeatFlow?: Maybe; + + packetbeatTLS?: Maybe; + + inspect?: Maybe; +} + +export interface OverviewHostData { + auditbeatAuditd?: Maybe; + + auditbeatFIM?: Maybe; + + auditbeatLogin?: Maybe; + + auditbeatPackage?: Maybe; + + auditbeatProcess?: Maybe; + + auditbeatUser?: Maybe; + + endgameDns?: Maybe; + + endgameFile?: Maybe; + + endgameImageLoad?: Maybe; + + endgameNetwork?: Maybe; + + endgameProcess?: Maybe; + + endgameRegistry?: Maybe; + + endgameSecurity?: Maybe; + + filebeatSystemModule?: Maybe; + + winlogbeatSecurity?: Maybe; + + winlogbeatMWSysmonOperational?: Maybe; + + inspect?: Maybe; +} + +export interface TlsData { + edges: TlsEdges[]; + + totalCount: number; + + pageInfo: PageInfoPaginated; + + inspect?: Maybe; +} + +export interface TlsEdges { + node: TlsNode; + + cursor: CursorType; +} + +export interface TlsNode { + _id?: Maybe; + + timestamp?: Maybe; + + alternativeNames?: Maybe; + + notAfter?: Maybe; + + commonNames?: Maybe; + + ja3?: Maybe; + + issuerNames?: Maybe; +} + +export interface UncommonProcessesData { + edges: UncommonProcessesEdges[]; + + totalCount: number; + + pageInfo: PageInfoPaginated; + + inspect?: Maybe; +} + +export interface UncommonProcessesEdges { + node: UncommonProcessItem; + + cursor: CursorType; +} + +export interface UncommonProcessItem { + _id: string; + + instances: number; + + process: ProcessEcsFields; + + hosts: HostEcsFields[]; + + user?: Maybe; +} + +export interface SayMyName { + /** The id of the source */ + appName: string; +} + +export interface TimelineResult { + columns?: Maybe; + + created?: Maybe; + + createdBy?: Maybe; + + dataProviders?: Maybe; + + dateRange?: Maybe; + + description?: Maybe; + + eventIdToNoteIds?: Maybe; + + eventType?: Maybe; + + favorite?: Maybe; + + filters?: Maybe; + + kqlMode?: Maybe; + + kqlQuery?: Maybe; + + notes?: Maybe; + + noteIds?: Maybe; + + pinnedEventIds?: Maybe; + + pinnedEventsSaveObject?: Maybe; + + savedQueryId?: Maybe; + + savedObjectId: string; + + sort?: Maybe; + + title?: Maybe; + + updated?: Maybe; + + updatedBy?: Maybe; + + version: string; +} + +export interface ColumnHeaderResult { + aggregatable?: Maybe; + + category?: Maybe; + + columnHeaderType?: Maybe; + + description?: Maybe; + + example?: Maybe; + + indexes?: Maybe; + + id?: Maybe; + + name?: Maybe; + + placeholder?: Maybe; + + searchable?: Maybe; + + type?: Maybe; +} + +export interface DataProviderResult { + id?: Maybe; + + name?: Maybe; + + enabled?: Maybe; + + excluded?: Maybe; + + kqlQuery?: Maybe; + + queryMatch?: Maybe; + + and?: Maybe; +} + +export interface QueryMatchResult { + field?: Maybe; + + displayField?: Maybe; + + value?: Maybe; + + displayValue?: Maybe; + + operator?: Maybe; +} + +export interface DateRangePickerResult { + start?: Maybe; + + end?: Maybe; +} + +export interface FavoriteTimelineResult { + fullName?: Maybe; + + userName?: Maybe; + + favoriteDate?: Maybe; +} + +export interface FilterTimelineResult { + exists?: Maybe; + + meta?: Maybe; + + match_all?: Maybe; + + missing?: Maybe; + + query?: Maybe; + + range?: Maybe; + + script?: Maybe; +} + +export interface FilterMetaTimelineResult { + alias?: Maybe; + + controlledBy?: Maybe; + + disabled?: Maybe; + + field?: Maybe; + + formattedValue?: Maybe; + + index?: Maybe; + + key?: Maybe; -export interface CloudInstance { - id?: Maybe>>, -} + negate?: Maybe; -export interface CloudMachine { - type?: Maybe>>, -} + params?: Maybe; -export interface ColumnHeaderInput { - aggregatable?: Maybe, - category?: Maybe, - columnHeaderType?: Maybe, - description?: Maybe, - example?: Maybe, - indexes?: Maybe>, - id?: Maybe, - name?: Maybe, - placeholder?: Maybe, - searchable?: Maybe, - type?: Maybe, -} + type?: Maybe; -export interface ColumnHeaderResult { - aggregatable?: Maybe, - category?: Maybe, - columnHeaderType?: Maybe, - description?: Maybe, - example?: Maybe, - indexes?: Maybe>, - id?: Maybe, - name?: Maybe, - placeholder?: Maybe, - searchable?: Maybe, - type?: Maybe, + value?: Maybe; } -export interface CursorType { - value?: Maybe, - tiebreaker?: Maybe, +export interface SerializedFilterQueryResult { + filterQuery?: Maybe; } -export interface DataProviderInput { - id?: Maybe, - name?: Maybe, - enabled?: Maybe, - excluded?: Maybe, - kqlQuery?: Maybe, - queryMatch?: Maybe, - and?: Maybe>, -} +export interface SerializedKueryQueryResult { + kuery?: Maybe; -export interface DataProviderResult { - id?: Maybe, - name?: Maybe, - enabled?: Maybe, - excluded?: Maybe, - kqlQuery?: Maybe, - queryMatch?: Maybe, - and?: Maybe>, + serializedQuery?: Maybe; } +export interface KueryFilterQueryResult { + kind?: Maybe; -export interface DateRangePickerInput { - start?: Maybe, - end?: Maybe, + expression?: Maybe; } -export interface DateRangePickerResult { - start?: Maybe, - end?: Maybe, -} +export interface SortTimelineResult { + columnId?: Maybe; -export interface DestinationEcsFields { - bytes?: Maybe, - ip?: Maybe, - port?: Maybe, - domain?: Maybe, - geo?: Maybe, - packets?: Maybe, + sortDirection?: Maybe; } -export interface DetailItem { - field: Scalars['String'], - values?: Maybe, - originalValue?: Maybe, -} +export interface ResponseTimelines { + timeline: (Maybe)[]; -export enum Direction { - asc = 'asc', - desc = 'desc' + totalCount?: Maybe; } -export interface DnsEcsFields { - question?: Maybe, - resolved_ip?: Maybe, - response_code?: Maybe, -} +export interface Mutation { + /** Persists a note */ + persistNote: ResponseNote; -export interface DnsQuestionData { - name?: Maybe, - type?: Maybe, -} + deleteNote?: Maybe; -export interface Ecs { - _id: Scalars['String'], - _index?: Maybe, - auditd?: Maybe, - destination?: Maybe, - dns?: Maybe, - endgame?: Maybe, - event?: Maybe, - geo?: Maybe, - host?: Maybe, - network?: Maybe, - rule?: Maybe, - signal?: Maybe, - source?: Maybe, - suricata?: Maybe, - tls?: Maybe, - zeek?: Maybe, - http?: Maybe, - url?: Maybe, - timestamp?: Maybe, - message?: Maybe, - user?: Maybe, - winlog?: Maybe, - process?: Maybe, - file?: Maybe, - system?: Maybe, -} + deleteNoteByTimelineId?: Maybe; + /** Persists a pinned event in a timeline */ + persistPinnedEventOnTimeline?: Maybe; + /** Remove a pinned events in a timeline */ + deletePinnedEventOnTimeline: boolean; + /** Remove all pinned events in a timeline */ + deleteAllPinnedEventsOnTimeline: boolean; + /** Persists a timeline */ + persistTimeline: ResponseTimeline; -export interface EcsEdges { - node: Ecs, - cursor: CursorType, -} + persistFavorite: ResponseFavoriteTimeline; -export interface EndgameEcsFields { - exit_code?: Maybe, - file_name?: Maybe, - file_path?: Maybe, - logon_type?: Maybe, - parent_process_name?: Maybe, - pid?: Maybe, - process_name?: Maybe, - subject_domain_name?: Maybe, - subject_logon_id?: Maybe, - subject_user_name?: Maybe, - target_domain_name?: Maybe, - target_logon_id?: Maybe, - target_user_name?: Maybe, + deleteTimeline: boolean; } +export interface ResponseNote { + code?: Maybe; -export interface EventEcsFields { - action?: Maybe, - category?: Maybe, - code?: Maybe, - created?: Maybe, - dataset?: Maybe, - duration?: Maybe, - end?: Maybe, - hash?: Maybe, - id?: Maybe, - kind?: Maybe, - module?: Maybe, - original?: Maybe, - outcome?: Maybe, - risk_score?: Maybe, - risk_score_norm?: Maybe, - severity?: Maybe, - start?: Maybe, - timezone?: Maybe, - type?: Maybe, -} + message?: Maybe; -export interface EventsTimelineData { - edges: Array, - totalCount: Scalars['Float'], - pageInfo: PageInfo, - inspect?: Maybe, + note: NoteResult; } -export interface FavoriteTimelineInput { - fullName?: Maybe, - userName?: Maybe, - favoriteDate?: Maybe, -} +export interface ResponseTimeline { + code?: Maybe; -export interface FavoriteTimelineResult { - fullName?: Maybe, - userName?: Maybe, - favoriteDate?: Maybe, -} + message?: Maybe; -export interface FileFields { - name?: Maybe, - path?: Maybe, - target_path?: Maybe, - extension?: Maybe, - type?: Maybe, - device?: Maybe, - inode?: Maybe, - uid?: Maybe, - owner?: Maybe, - gid?: Maybe, - group?: Maybe, - mode?: Maybe, - size?: Maybe, - mtime?: Maybe, - ctime?: Maybe, + timeline: TimelineResult; } -export interface FilterMetaTimelineInput { - alias?: Maybe, - controlledBy?: Maybe, - disabled?: Maybe, - field?: Maybe, - formattedValue?: Maybe, - index?: Maybe, - key?: Maybe, - negate?: Maybe, - params?: Maybe, - type?: Maybe, - value?: Maybe, -} +export interface ResponseFavoriteTimeline { + code?: Maybe; -export interface FilterMetaTimelineResult { - alias?: Maybe, - controlledBy?: Maybe, - disabled?: Maybe, - field?: Maybe, - formattedValue?: Maybe, - index?: Maybe, - key?: Maybe, - negate?: Maybe, - params?: Maybe, - type?: Maybe, - value?: Maybe, -} + message?: Maybe; -export interface FilterTimelineInput { - exists?: Maybe, - meta?: Maybe, - match_all?: Maybe, - missing?: Maybe, - query?: Maybe, - range?: Maybe, - script?: Maybe, -} + savedObjectId: string; -export interface FilterTimelineResult { - exists?: Maybe, - meta?: Maybe, - match_all?: Maybe, - missing?: Maybe, - query?: Maybe, - range?: Maybe, - script?: Maybe, -} + version: string; -export interface FingerprintData { - sha1?: Maybe, + favorite?: Maybe; } -export interface FirstLastSeenHost { - inspect?: Maybe, - firstSeen?: Maybe, - lastSeen?: Maybe, -} +export interface EcsEdges { + node: Ecs; -export enum FlowDirection { - uniDirectional = 'uniDirectional', - biDirectional = 'biDirectional' + cursor: CursorType; } -export enum FlowTarget { - client = 'client', - destination = 'destination', - server = 'server', - source = 'source' -} +export interface EventsTimelineData { + edges: EcsEdges[]; -export enum FlowTargetSourceDest { - destination = 'destination', - source = 'source' -} + totalCount: number; -export interface GeoEcsFields { - city_name?: Maybe, - continent_name?: Maybe, - country_iso_code?: Maybe, - country_name?: Maybe, - location?: Maybe, - region_iso_code?: Maybe, - region_name?: Maybe, -} + pageInfo: PageInfo; -export interface GeoItem { - geo?: Maybe, - flowTarget?: Maybe, + inspect?: Maybe; } -export enum HistogramType { - authentications = 'authentications', - anomalies = 'anomalies', - events = 'events', - alerts = 'alerts', - dns = 'dns' -} +export interface OsFields { + platform?: Maybe; -export interface HostEcsFields { - architecture?: Maybe, - id?: Maybe, - ip?: Maybe, - mac?: Maybe, - name?: Maybe, - os?: Maybe, - type?: Maybe, -} + name?: Maybe; -export interface HostFields { - architecture?: Maybe, - id?: Maybe, - ip?: Maybe>>, - mac?: Maybe>>, - name?: Maybe, - os?: Maybe, - type?: Maybe, -} + full?: Maybe; -export interface HostItem { - _id?: Maybe, - lastSeen?: Maybe, - host?: Maybe, - cloud?: Maybe, - inspect?: Maybe, -} + family?: Maybe; -export interface HostsData { - edges: Array, - totalCount: Scalars['Float'], - pageInfo: PageInfoPaginated, - inspect?: Maybe, -} + version?: Maybe; -export interface HostsEdges { - node: HostItem, - cursor: CursorType, + kernel?: Maybe; } -export enum HostsFields { - hostName = 'hostName', - lastSeen = 'lastSeen' -} +export interface HostFields { + architecture?: Maybe; -export interface HostsSortField { - field: HostsFields, - direction: Direction, -} + id?: Maybe; -export interface HttpBodyData { - content?: Maybe, - bytes?: Maybe, -} + ip?: Maybe<(Maybe)[]>; -export interface HttpEcsFields { - version?: Maybe, - request?: Maybe, - response?: Maybe, -} + mac?: Maybe<(Maybe)[]>; -export interface HttpRequestData { - method?: Maybe, - body?: Maybe, - referrer?: Maybe, - bytes?: Maybe, -} + name?: Maybe; -export interface HttpResponseData { - status_code?: Maybe, - body?: Maybe, - bytes?: Maybe, -} + os?: Maybe; -/** A descriptor of a field in an index */ -export interface IndexField { - /** Where the field belong */ - category: Scalars['String'], - /** Example of field's value */ - example?: Maybe, - /** whether the field's belong to an alias index */ - indexes: Array>, - /** The name of the field */ - name: Scalars['String'], - /** The type of the field's values as recognized by Kibana */ - type: Scalars['String'], - /** Whether the field's values can be efficiently searched for */ - searchable: Scalars['Boolean'], - /** Whether the field's values can be aggregated */ - aggregatable: Scalars['Boolean'], - /** Description of the field */ - description?: Maybe, - format?: Maybe, + type?: Maybe; } -export interface Inspect { - dsl: Array, - response: Array, -} +// ==================================================== +// Arguments +// ==================================================== -export interface IpOverviewData { - client?: Maybe, - destination?: Maybe, - host: HostEcsFields, - server?: Maybe, - source?: Maybe, - inspect?: Maybe, +export interface GetNoteQueryArgs { + id: string; } - -export interface KpiHostDetailsData { - authSuccess?: Maybe, - authSuccessHistogram?: Maybe>, - authFailure?: Maybe, - authFailureHistogram?: Maybe>, - uniqueSourceIps?: Maybe, - uniqueSourceIpsHistogram?: Maybe>, - uniqueDestinationIps?: Maybe, - uniqueDestinationIpsHistogram?: Maybe>, - inspect?: Maybe, +export interface GetNotesByTimelineIdQueryArgs { + timelineId: string; } - -export interface KpiHostHistogramData { - x?: Maybe, - y?: Maybe, +export interface GetNotesByEventIdQueryArgs { + eventId: string; } +export interface GetAllNotesQueryArgs { + pageInfo?: Maybe; -export interface KpiHostsData { - hosts?: Maybe, - hostsHistogram?: Maybe>, - authSuccess?: Maybe, - authSuccessHistogram?: Maybe>, - authFailure?: Maybe, - authFailureHistogram?: Maybe>, - uniqueSourceIps?: Maybe, - uniqueSourceIpsHistogram?: Maybe>, - uniqueDestinationIps?: Maybe, - uniqueDestinationIpsHistogram?: Maybe>, - inspect?: Maybe, -} + search?: Maybe; -export interface KpiNetworkData { - networkEvents?: Maybe, - uniqueFlowId?: Maybe, - uniqueSourcePrivateIps?: Maybe, - uniqueSourcePrivateIpsHistogram?: Maybe>, - uniqueDestinationPrivateIps?: Maybe, - uniqueDestinationPrivateIpsHistogram?: Maybe>, - dnsQueries?: Maybe, - tlsHandshakes?: Maybe, - inspect?: Maybe, + sort?: Maybe; } - -export interface KpiNetworkHistogramData { - x?: Maybe, - y?: Maybe, +export interface GetAllPinnedEventsByTimelineIdQueryArgs { + timelineId: string; } - -export interface KueryFilterQueryInput { - kind?: Maybe, - expression?: Maybe, +export interface SourceQueryArgs { + /** The id of the source */ + id: string; } - -export interface KueryFilterQueryResult { - kind?: Maybe, - expression?: Maybe, +export interface GetOneTimelineQueryArgs { + id: string; } +export interface GetAllTimelineQueryArgs { + pageInfo?: Maybe; -export enum LastEventIndexKey { - hostDetails = 'hostDetails', - hosts = 'hosts', - ipDetails = 'ipDetails', - network = 'network' -} + search?: Maybe; -export interface LastEventTimeData { - lastSeen?: Maybe, - inspect?: Maybe, -} + sort?: Maybe; -export interface LastSourceHost { - timestamp?: Maybe, - source?: Maybe, - host?: Maybe, + onlyUserFavorite?: Maybe; } +export interface AuthenticationsSourceArgs { + timerange: TimerangeInput; -export interface LastTimeDetails { - hostName?: Maybe, - ip?: Maybe, -} + pagination: PaginationInputPaginated; -export interface Location { - lon?: Maybe, - lat?: Maybe, -} + filterQuery?: Maybe; -export interface MatrixHistogramOverTimeData { - inspect?: Maybe, - matrixHistogramData: Array, - totalCount: Scalars['Float'], + defaultIndex: string[]; } +export interface TimelineSourceArgs { + pagination: PaginationInput; -export interface MatrixOverOrdinalHistogramData { - x: Scalars['String'], - y: Scalars['Float'], - g: Scalars['String'], -} + sortField: SortField; -export interface MatrixOverTimeHistogramData { - x?: Maybe, - y?: Maybe, - g?: Maybe, -} + fieldRequested: string[]; -export interface Mutation { - /** Persists a note */ - persistNote: ResponseNote, - deleteNote?: Maybe, - deleteNoteByTimelineId?: Maybe, - /** Persists a pinned event in a timeline */ - persistPinnedEventOnTimeline?: Maybe, - /** Remove a pinned events in a timeline */ - deletePinnedEventOnTimeline: Scalars['Boolean'], - /** Remove all pinned events in a timeline */ - deleteAllPinnedEventsOnTimeline: Scalars['Boolean'], - /** Persists a timeline */ - persistTimeline: ResponseTimeline, - persistFavorite: ResponseFavoriteTimeline, - deleteTimeline: Scalars['Boolean'], -} + timerange?: Maybe; + filterQuery?: Maybe; -export interface MutationPersistNoteArgs { - noteId?: Maybe, - version?: Maybe, - note: NoteInput + defaultIndex: string[]; } +export interface TimelineDetailsSourceArgs { + eventId: string; + indexName: string; -export interface MutationDeleteNoteArgs { - id: Array + defaultIndex: string[]; } +export interface LastEventTimeSourceArgs { + id?: Maybe; + + indexKey: LastEventIndexKey; + details: LastTimeDetails; -export interface MutationDeleteNoteByTimelineIdArgs { - timelineId: Scalars['ID'], - version?: Maybe + defaultIndex: string[]; } +export interface HostsSourceArgs { + id?: Maybe; + timerange: TimerangeInput; -export interface MutationPersistPinnedEventOnTimelineArgs { - pinnedEventId?: Maybe, - eventId: Scalars['ID'], - timelineId?: Maybe -} + pagination: PaginationInputPaginated; + + sort: HostsSortField; + filterQuery?: Maybe; -export interface MutationDeletePinnedEventOnTimelineArgs { - id: Array + defaultIndex: string[]; } +export interface HostOverviewSourceArgs { + id?: Maybe; + hostName: string; -export interface MutationDeleteAllPinnedEventsOnTimelineArgs { - timelineId: Scalars['ID'] + timerange: TimerangeInput; + + defaultIndex: string[]; } +export interface HostFirstLastSeenSourceArgs { + id?: Maybe; + hostName: string; -export interface MutationPersistTimelineArgs { - id?: Maybe, - version?: Maybe, - timeline: TimelineInput + defaultIndex: string[]; } +export interface IpOverviewSourceArgs { + id?: Maybe; + + filterQuery?: Maybe; + ip: string; -export interface MutationPersistFavoriteArgs { - timelineId?: Maybe + defaultIndex: string[]; } +export interface UsersSourceArgs { + filterQuery?: Maybe; + id?: Maybe; -export interface MutationDeleteTimelineArgs { - id: Array -} + ip: string; -export enum NetworkDirectionEcs { - inbound = 'inbound', - outbound = 'outbound', - internal = 'internal', - external = 'external', - incoming = 'incoming', - outgoing = 'outgoing', - listening = 'listening', - unknown = 'unknown' -} + pagination: PaginationInputPaginated; -export interface NetworkDnsData { - edges: Array, - totalCount: Scalars['Float'], - pageInfo: PageInfoPaginated, - inspect?: Maybe, - histogram?: Maybe>, -} + sort: UsersSortField; -export interface NetworkDnsEdges { - node: NetworkDnsItem, - cursor: CursorType, -} + flowTarget: FlowTarget; -export enum NetworkDnsFields { - dnsName = 'dnsName', - queryCount = 'queryCount', - uniqueDomains = 'uniqueDomains', - dnsBytesIn = 'dnsBytesIn', - dnsBytesOut = 'dnsBytesOut' -} + timerange: TimerangeInput; -export interface NetworkDnsItem { - _id?: Maybe, - dnsBytesIn?: Maybe, - dnsBytesOut?: Maybe, - dnsName?: Maybe, - queryCount?: Maybe, - uniqueDomains?: Maybe, + defaultIndex: string[]; } +export interface KpiNetworkSourceArgs { + id?: Maybe; -export interface NetworkDnsSortField { - field: NetworkDnsFields, - direction: Direction, -} + timerange: TimerangeInput; -export interface NetworkDsOverTimeData { - inspect?: Maybe, - matrixHistogramData: Array, - totalCount: Scalars['Float'], -} + filterQuery?: Maybe; -export interface NetworkEcsField { - bytes?: Maybe, - community_id?: Maybe, - direction?: Maybe, - packets?: Maybe, - protocol?: Maybe, - transport?: Maybe, + defaultIndex: string[]; } +export interface KpiHostsSourceArgs { + id?: Maybe; -export interface NetworkHttpData { - edges: Array, - totalCount: Scalars['Float'], - pageInfo: PageInfoPaginated, - inspect?: Maybe, -} + timerange: TimerangeInput; -export interface NetworkHttpEdges { - node: NetworkHttpItem, - cursor: CursorType, -} + filterQuery?: Maybe; -export enum NetworkHttpFields { - domains = 'domains', - lastHost = 'lastHost', - lastSourceIp = 'lastSourceIp', - methods = 'methods', - path = 'path', - requestCount = 'requestCount', - statuses = 'statuses' + defaultIndex: string[]; } +export interface KpiHostDetailsSourceArgs { + id?: Maybe; -export interface NetworkHttpItem { - _id?: Maybe, - domains: Array, - lastHost?: Maybe, - lastSourceIp?: Maybe, - methods: Array, - path?: Maybe, - requestCount?: Maybe, - statuses: Array, -} + timerange: TimerangeInput; -export interface NetworkHttpSortField { - direction: Direction, -} + filterQuery?: Maybe; -export interface NetworkTopCountriesData { - edges: Array, - totalCount: Scalars['Float'], - pageInfo: PageInfoPaginated, - inspect?: Maybe, + defaultIndex: string[]; } +export interface MatrixHistogramSourceArgs { + filterQuery?: Maybe; -export interface NetworkTopCountriesEdges { - node: NetworkTopCountriesItem, - cursor: CursorType, -} + defaultIndex: string[]; -export interface NetworkTopCountriesItem { - _id?: Maybe, - source?: Maybe, - destination?: Maybe, - network?: Maybe, -} + timerange: TimerangeInput; -export interface NetworkTopNFlowData { - edges: Array, - totalCount: Scalars['Float'], - pageInfo: PageInfoPaginated, - inspect?: Maybe, -} + stackByField: string; -export interface NetworkTopNFlowEdges { - node: NetworkTopNFlowItem, - cursor: CursorType, + histogramType: HistogramType; } +export interface NetworkTopCountriesSourceArgs { + id?: Maybe; -export interface NetworkTopNFlowItem { - _id?: Maybe, - source?: Maybe, - destination?: Maybe, - network?: Maybe, -} + filterQuery?: Maybe; -export enum NetworkTopTablesFields { - bytes_in = 'bytes_in', - bytes_out = 'bytes_out', - flows = 'flows', - destination_ips = 'destination_ips', - source_ips = 'source_ips' -} + ip?: Maybe; -export interface NetworkTopTablesSortField { - field: NetworkTopTablesFields, - direction: Direction, -} + flowTarget: FlowTargetSourceDest; -export interface NoteInput { - eventId?: Maybe, - note?: Maybe, - timelineId?: Maybe, -} + pagination: PaginationInputPaginated; -export interface NoteResult { - eventId?: Maybe, - note?: Maybe, - timelineId?: Maybe, - noteId: Scalars['String'], - created?: Maybe, - createdBy?: Maybe, - timelineVersion?: Maybe, - updated?: Maybe, - updatedBy?: Maybe, - version?: Maybe, -} + sort: NetworkTopTablesSortField; -export interface OsEcsFields { - platform?: Maybe, - name?: Maybe, - full?: Maybe, - family?: Maybe, - version?: Maybe, - kernel?: Maybe, -} + timerange: TimerangeInput; -export interface OsFields { - platform?: Maybe, - name?: Maybe, - full?: Maybe, - family?: Maybe, - version?: Maybe, - kernel?: Maybe, + defaultIndex: string[]; } +export interface NetworkTopNFlowSourceArgs { + id?: Maybe; -export interface Overview { - firstSeen?: Maybe, - lastSeen?: Maybe, - autonomousSystem: AutonomousSystem, - geo: GeoEcsFields, -} + filterQuery?: Maybe; -export interface OverviewHostData { - auditbeatAuditd?: Maybe, - auditbeatFIM?: Maybe, - auditbeatLogin?: Maybe, - auditbeatPackage?: Maybe, - auditbeatProcess?: Maybe, - auditbeatUser?: Maybe, - endgameDns?: Maybe, - endgameFile?: Maybe, - endgameImageLoad?: Maybe, - endgameNetwork?: Maybe, - endgameProcess?: Maybe, - endgameRegistry?: Maybe, - endgameSecurity?: Maybe, - filebeatSystemModule?: Maybe, - winlogbeatSecurity?: Maybe, - winlogbeatMWSysmonOperational?: Maybe, - inspect?: Maybe, -} + ip?: Maybe; -export interface OverviewNetworkData { - auditbeatSocket?: Maybe, - filebeatCisco?: Maybe, - filebeatNetflow?: Maybe, - filebeatPanw?: Maybe, - filebeatSuricata?: Maybe, - filebeatZeek?: Maybe, - packetbeatDNS?: Maybe, - packetbeatFlow?: Maybe, - packetbeatTLS?: Maybe, - inspect?: Maybe, -} + flowTarget: FlowTargetSourceDest; -export interface PackageEcsFields { - arch?: Maybe, - entity_id?: Maybe, - name?: Maybe, - size?: Maybe, - summary?: Maybe, - version?: Maybe, -} + pagination: PaginationInputPaginated; -export interface PageInfo { - endCursor?: Maybe, - hasNextPage?: Maybe, -} + sort: NetworkTopTablesSortField; -export interface PageInfoNote { - pageIndex: Scalars['Float'], - pageSize: Scalars['Float'], -} + timerange: TimerangeInput; -export interface PageInfoPaginated { - activePage: Scalars['Float'], - fakeTotalCount: Scalars['Float'], - showMorePagesIndicator: Scalars['Boolean'], + defaultIndex: string[]; } +export interface NetworkDnsSourceArgs { + filterQuery?: Maybe; -export interface PageInfoTimeline { - pageIndex: Scalars['Float'], - pageSize: Scalars['Float'], -} + id?: Maybe; -export interface PaginationInput { - /** The limit parameter allows you to configure the maximum amount of items to be returned */ - limit: Scalars['Float'], - /** The cursor parameter defines the next result you want to fetch */ - cursor?: Maybe, - /** The tiebreaker parameter allow to be more precise to fetch the next item */ - tiebreaker?: Maybe, -} + isPtrIncluded: boolean; -export interface PaginationInputPaginated { - /** The activePage parameter defines the page of results you want to fetch */ - activePage: Scalars['Float'], - /** The cursorStart parameter defines the start of the results to be displayed */ - cursorStart: Scalars['Float'], - /** The fakePossibleCount parameter determines the total count in order to show 5 additional pages */ - fakePossibleCount: Scalars['Float'], - /** The querySize parameter is the number of items to be returned */ - querySize: Scalars['Float'], -} + pagination: PaginationInputPaginated; -export interface PinnedEvent { - code?: Maybe, - message?: Maybe, - pinnedEventId: Scalars['ID'], - eventId?: Maybe, - timelineId?: Maybe, - timelineVersion?: Maybe, - created?: Maybe, - createdBy?: Maybe, - updated?: Maybe, - updatedBy?: Maybe, - version?: Maybe, -} + sort: NetworkDnsSortField; -export interface PrimarySecondary { - primary?: Maybe, - secondary?: Maybe, - type?: Maybe, -} + stackByField?: Maybe; -export interface ProcessEcsFields { - hash?: Maybe, - pid?: Maybe, - name?: Maybe, - ppid?: Maybe, - args?: Maybe, - executable?: Maybe, - title?: Maybe, - thread?: Maybe, - working_directory?: Maybe, -} + timerange: TimerangeInput; -export interface ProcessHashData { - md5?: Maybe, - sha1?: Maybe, - sha256?: Maybe, + defaultIndex: string[]; } +export interface NetworkDnsHistogramSourceArgs { + filterQuery?: Maybe; -export interface Query { - getNote: NoteResult, - getNotesByTimelineId: Array, - getNotesByEventId: Array, - getAllNotes: ResponseNotes, - getAllPinnedEventsByTimelineId: Array, - /** Get a security data source by id */ - source: Source, - /** Get a list of all security data sources */ - allSources: Array, - getOneTimeline: TimelineResult, - getAllTimeline: ResponseTimelines, -} + defaultIndex: string[]; + timerange: TimerangeInput; -export interface QueryGetNoteArgs { - id: Scalars['ID'] + stackByField?: Maybe; } +export interface NetworkHttpSourceArgs { + id?: Maybe; + filterQuery?: Maybe; -export interface QueryGetNotesByTimelineIdArgs { - timelineId: Scalars['ID'] -} + ip?: Maybe; + pagination: PaginationInputPaginated; -export interface QueryGetNotesByEventIdArgs { - eventId: Scalars['ID'] -} + sort: NetworkHttpSortField; + timerange: TimerangeInput; -export interface QueryGetAllNotesArgs { - pageInfo?: Maybe, - search?: Maybe, - sort?: Maybe + defaultIndex: string[]; } +export interface OverviewNetworkSourceArgs { + id?: Maybe; + + timerange: TimerangeInput; + filterQuery?: Maybe; -export interface QueryGetAllPinnedEventsByTimelineIdArgs { - timelineId: Scalars['ID'] + defaultIndex: string[]; } +export interface OverviewHostSourceArgs { + id?: Maybe; + timerange: TimerangeInput; -export interface QuerySourceArgs { - id: Scalars['ID'] + filterQuery?: Maybe; + + defaultIndex: string[]; } +export interface TlsSourceArgs { + filterQuery?: Maybe; + id?: Maybe; -export interface QueryGetOneTimelineArgs { - id: Scalars['ID'] -} + ip: string; + pagination: PaginationInputPaginated; -export interface QueryGetAllTimelineArgs { - pageInfo?: Maybe, - search?: Maybe, - sort?: Maybe, - onlyUserFavorite?: Maybe -} + sort: TlsSortField; -export interface QueryMatchInput { - field?: Maybe, - displayField?: Maybe, - value?: Maybe, - displayValue?: Maybe, - operator?: Maybe, -} + flowTarget: FlowTargetSourceDest; -export interface QueryMatchResult { - field?: Maybe, - displayField?: Maybe, - value?: Maybe, - displayValue?: Maybe, - operator?: Maybe, -} + timerange: TimerangeInput; -export interface ResponseFavoriteTimeline { - code?: Maybe, - message?: Maybe, - savedObjectId: Scalars['String'], - version: Scalars['String'], - favorite?: Maybe>, + defaultIndex: string[]; } +export interface UncommonProcessesSourceArgs { + timerange: TimerangeInput; -export interface ResponseNote { - code?: Maybe, - message?: Maybe, - note: NoteResult, -} + pagination: PaginationInputPaginated; -export interface ResponseNotes { - notes: Array, - totalCount?: Maybe, -} + filterQuery?: Maybe; -export interface ResponseTimeline { - code?: Maybe, - message?: Maybe, - timeline: TimelineResult, + defaultIndex: string[]; } - -export interface ResponseTimelines { - timeline: Array>, - totalCount?: Maybe, +export interface IndicesExistSourceStatusArgs { + defaultIndex: string[]; } - -export interface RuleEcsField { - reference?: Maybe, +export interface IndexFieldsSourceStatusArgs { + defaultIndex: string[]; } +export interface PersistNoteMutationArgs { + noteId?: Maybe; -export interface RuleField { - id?: Maybe, - rule_id?: Maybe, - false_positives: Array, - saved_id?: Maybe, - timeline_id?: Maybe, - timeline_title?: Maybe, - max_signals?: Maybe, - risk_score?: Maybe, - output_index?: Maybe, - description?: Maybe, - from?: Maybe, - immutable?: Maybe, - index?: Maybe, - interval?: Maybe, - language?: Maybe, - query?: Maybe, - references?: Maybe, - severity?: Maybe, - tags?: Maybe, - threat?: Maybe, - type?: Maybe, - size?: Maybe, - to?: Maybe, - enabled?: Maybe, - filters?: Maybe, - created_at?: Maybe, - updated_at?: Maybe, - created_by?: Maybe, - updated_by?: Maybe, - version?: Maybe, -} + version?: Maybe; -export interface SayMyName { - /** The id of the source */ - appName: Scalars['String'], + note: NoteInput; } - -export interface SerializedFilterQueryInput { - filterQuery?: Maybe, +export interface DeleteNoteMutationArgs { + id: string[]; } +export interface DeleteNoteByTimelineIdMutationArgs { + timelineId: string; -export interface SerializedFilterQueryResult { - filterQuery?: Maybe, + version?: Maybe; } +export interface PersistPinnedEventOnTimelineMutationArgs { + pinnedEventId?: Maybe; -export interface SerializedKueryQueryInput { - kuery?: Maybe, - serializedQuery?: Maybe, -} + eventId: string; -export interface SerializedKueryQueryResult { - kuery?: Maybe, - serializedQuery?: Maybe, + timelineId?: Maybe; } - -export interface SignalField { - rule?: Maybe, - original_time?: Maybe, +export interface DeletePinnedEventOnTimelineMutationArgs { + id: string[]; } - -export interface SortField { - sortFieldId: Scalars['String'], - direction: Direction, +export interface DeleteAllPinnedEventsOnTimelineMutationArgs { + timelineId: string; } +export interface PersistTimelineMutationArgs { + id?: Maybe; -export enum SortFieldNote { - updatedBy = 'updatedBy', - updated = 'updated' -} + version?: Maybe; -export enum SortFieldTimeline { - title = 'title', - description = 'description', - updated = 'updated', - created = 'created' + timeline: TimelineInput; } - -export interface SortNote { - sortField: SortFieldNote, - sortOrder: Direction, +export interface PersistFavoriteMutationArgs { + timelineId?: Maybe; } - -export interface SortTimeline { - sortField: SortFieldTimeline, - sortOrder: Direction, +export interface DeleteTimelineMutationArgs { + id: string[]; } -export interface SortTimelineInput { - columnId?: Maybe, - sortDirection?: Maybe, -} +import { GraphQLResolveInfo, GraphQLScalarType, GraphQLScalarTypeConfig } from 'graphql'; -export interface SortTimelineResult { - columnId?: Maybe, - sortDirection?: Maybe, -} +export type Resolver = ( + parent: Parent, + args: Args, + context: TContext, + info: GraphQLResolveInfo +) => Promise | Result; + +export interface ISubscriptionResolverObject { + subscribe( + parent: P, + args: Args, + context: TContext, + info: GraphQLResolveInfo + ): AsyncIterator | Promise>; + resolve?( + parent: P, + args: Args, + context: TContext, + info: GraphQLResolveInfo + ): R | Result | Promise; +} + +export type SubscriptionResolver = + | ((...args: any[]) => ISubscriptionResolverObject) + | ISubscriptionResolverObject; + +export type TypeResolveFn = ( + parent: Parent, + context: TContext, + info: GraphQLResolveInfo +) => Maybe; -export interface Source { - /** The id of the source */ - id: Scalars['ID'], - /** The raw configuration of the source */ - configuration: SourceConfiguration, - /** The status of the source */ - status: SourceStatus, - /** Gets Authentication success and failures based on a timerange */ - Authentications: AuthenticationsData, - Timeline: TimelineData, - TimelineDetails: TimelineDetailsData, - LastEventTime: LastEventTimeData, - /** Gets Hosts based on timerange and specified criteria, or all events in the timerange if no criteria is specified */ - Hosts: HostsData, - HostOverview: HostItem, - HostFirstLastSeen: FirstLastSeenHost, - IpOverview?: Maybe, - Users: UsersData, - KpiNetwork?: Maybe, - KpiHosts: KpiHostsData, - KpiHostDetails: KpiHostDetailsData, - MatrixHistogram: MatrixHistogramOverTimeData, - NetworkTopCountries: NetworkTopCountriesData, - NetworkTopNFlow: NetworkTopNFlowData, - NetworkDns: NetworkDnsData, - NetworkDnsHistogram: NetworkDsOverTimeData, - NetworkHttp: NetworkHttpData, - OverviewNetwork?: Maybe, - OverviewHost?: Maybe, - Tls: TlsData, - /** Gets UncommonProcesses based on a timerange, or all UncommonProcesses if no criteria is specified */ - UncommonProcesses: UncommonProcessesData, - /** Just a simple example to get the app name */ - whoAmI?: Maybe, -} +export type NextResolverFn = () => Promise; +export type DirectiveResolverFn = ( + next: NextResolverFn, + source: any, + args: TArgs, + context: TContext, + info: GraphQLResolveInfo +) => TResult | Promise; -export interface SourceAuthenticationsArgs { - timerange: TimerangeInput, - pagination: PaginationInputPaginated, - filterQuery?: Maybe, - defaultIndex: Array -} +export namespace QueryResolvers { + export interface Resolvers { + getNote?: GetNoteResolver; + + getNotesByTimelineId?: GetNotesByTimelineIdResolver; + + getNotesByEventId?: GetNotesByEventIdResolver; + + getAllNotes?: GetAllNotesResolver; + + getAllPinnedEventsByTimelineId?: GetAllPinnedEventsByTimelineIdResolver< + PinnedEvent[], + TypeParent, + TContext + >; + /** Get a security data source by id */ + source?: SourceResolver; + /** Get a list of all security data sources */ + allSources?: AllSourcesResolver; + + getOneTimeline?: GetOneTimelineResolver; + + getAllTimeline?: GetAllTimelineResolver; + } + + export type GetNoteResolver = Resolver< + R, + Parent, + TContext, + GetNoteArgs + >; + export interface GetNoteArgs { + id: string; + } + + export type GetNotesByTimelineIdResolver< + R = NoteResult[], + Parent = {}, + TContext = SiemContext + > = Resolver; + export interface GetNotesByTimelineIdArgs { + timelineId: string; + } + + export type GetNotesByEventIdResolver< + R = NoteResult[], + Parent = {}, + TContext = SiemContext + > = Resolver; + export interface GetNotesByEventIdArgs { + eventId: string; + } + + export type GetAllNotesResolver< + R = ResponseNotes, + Parent = {}, + TContext = SiemContext + > = Resolver; + export interface GetAllNotesArgs { + pageInfo?: Maybe; + + search?: Maybe; + + sort?: Maybe; + } + + export type GetAllPinnedEventsByTimelineIdResolver< + R = PinnedEvent[], + Parent = {}, + TContext = SiemContext + > = Resolver; + export interface GetAllPinnedEventsByTimelineIdArgs { + timelineId: string; + } + + export type SourceResolver = Resolver< + R, + Parent, + TContext, + SourceArgs + >; + export interface SourceArgs { + /** The id of the source */ + id: string; + } + + export type AllSourcesResolver = Resolver< + R, + Parent, + TContext + >; + export type GetOneTimelineResolver< + R = TimelineResult, + Parent = {}, + TContext = SiemContext + > = Resolver; + export interface GetOneTimelineArgs { + id: string; + } + + export type GetAllTimelineResolver< + R = ResponseTimelines, + Parent = {}, + TContext = SiemContext + > = Resolver; + export interface GetAllTimelineArgs { + pageInfo?: Maybe; + + search?: Maybe; + + sort?: Maybe; + + onlyUserFavorite?: Maybe; + } +} + +export namespace NoteResultResolvers { + export interface Resolvers { + eventId?: EventIdResolver, TypeParent, TContext>; + + note?: NoteResolver, TypeParent, TContext>; + + timelineId?: TimelineIdResolver, TypeParent, TContext>; + + noteId?: NoteIdResolver; + + created?: CreatedResolver, TypeParent, TContext>; + + createdBy?: CreatedByResolver, TypeParent, TContext>; + + timelineVersion?: TimelineVersionResolver, TypeParent, TContext>; + + updated?: UpdatedResolver, TypeParent, TContext>; + + updatedBy?: UpdatedByResolver, TypeParent, TContext>; + + version?: VersionResolver, TypeParent, TContext>; + } + + export type EventIdResolver< + R = Maybe, + Parent = NoteResult, + TContext = SiemContext + > = Resolver; + export type NoteResolver< + R = Maybe, + Parent = NoteResult, + TContext = SiemContext + > = Resolver; + export type TimelineIdResolver< + R = Maybe, + Parent = NoteResult, + TContext = SiemContext + > = Resolver; + export type NoteIdResolver = Resolver< + R, + Parent, + TContext + >; + export type CreatedResolver< + R = Maybe, + Parent = NoteResult, + TContext = SiemContext + > = Resolver; + export type CreatedByResolver< + R = Maybe, + Parent = NoteResult, + TContext = SiemContext + > = Resolver; + export type TimelineVersionResolver< + R = Maybe, + Parent = NoteResult, + TContext = SiemContext + > = Resolver; + export type UpdatedResolver< + R = Maybe, + Parent = NoteResult, + TContext = SiemContext + > = Resolver; + export type UpdatedByResolver< + R = Maybe, + Parent = NoteResult, + TContext = SiemContext + > = Resolver; + export type VersionResolver< + R = Maybe, + Parent = NoteResult, + TContext = SiemContext + > = Resolver; +} + +export namespace ResponseNotesResolvers { + export interface Resolvers { + notes?: NotesResolver; + + totalCount?: TotalCountResolver, TypeParent, TContext>; + } + + export type NotesResolver< + R = NoteResult[], + Parent = ResponseNotes, + TContext = SiemContext + > = Resolver; + export type TotalCountResolver< + R = Maybe, + Parent = ResponseNotes, + TContext = SiemContext + > = Resolver; +} + +export namespace PinnedEventResolvers { + export interface Resolvers { + code?: CodeResolver, TypeParent, TContext>; + + message?: MessageResolver, TypeParent, TContext>; + + pinnedEventId?: PinnedEventIdResolver; + + eventId?: EventIdResolver, TypeParent, TContext>; + + timelineId?: TimelineIdResolver, TypeParent, TContext>; + + timelineVersion?: TimelineVersionResolver, TypeParent, TContext>; + + created?: CreatedResolver, TypeParent, TContext>; + + createdBy?: CreatedByResolver, TypeParent, TContext>; + + updated?: UpdatedResolver, TypeParent, TContext>; + + updatedBy?: UpdatedByResolver, TypeParent, TContext>; + + version?: VersionResolver, TypeParent, TContext>; + } + + export type CodeResolver< + R = Maybe, + Parent = PinnedEvent, + TContext = SiemContext + > = Resolver; + export type MessageResolver< + R = Maybe, + Parent = PinnedEvent, + TContext = SiemContext + > = Resolver; + export type PinnedEventIdResolver< + R = string, + Parent = PinnedEvent, + TContext = SiemContext + > = Resolver; + export type EventIdResolver< + R = Maybe, + Parent = PinnedEvent, + TContext = SiemContext + > = Resolver; + export type TimelineIdResolver< + R = Maybe, + Parent = PinnedEvent, + TContext = SiemContext + > = Resolver; + export type TimelineVersionResolver< + R = Maybe, + Parent = PinnedEvent, + TContext = SiemContext + > = Resolver; + export type CreatedResolver< + R = Maybe, + Parent = PinnedEvent, + TContext = SiemContext + > = Resolver; + export type CreatedByResolver< + R = Maybe, + Parent = PinnedEvent, + TContext = SiemContext + > = Resolver; + export type UpdatedResolver< + R = Maybe, + Parent = PinnedEvent, + TContext = SiemContext + > = Resolver; + export type UpdatedByResolver< + R = Maybe, + Parent = PinnedEvent, + TContext = SiemContext + > = Resolver; + export type VersionResolver< + R = Maybe, + Parent = PinnedEvent, + TContext = SiemContext + > = Resolver; +} + +export namespace SourceResolvers { + export interface Resolvers { + /** The id of the source */ + id?: IdResolver; + /** The raw configuration of the source */ + configuration?: ConfigurationResolver; + /** The status of the source */ + status?: StatusResolver; + /** Gets Authentication success and failures based on a timerange */ + Authentications?: AuthenticationsResolver; + + Timeline?: TimelineResolver; + + TimelineDetails?: TimelineDetailsResolver; + + LastEventTime?: LastEventTimeResolver; + /** Gets Hosts based on timerange and specified criteria, or all events in the timerange if no criteria is specified */ + Hosts?: HostsResolver; + + HostOverview?: HostOverviewResolver; + + HostFirstLastSeen?: HostFirstLastSeenResolver; + + IpOverview?: IpOverviewResolver, TypeParent, TContext>; + + Users?: UsersResolver; + + KpiNetwork?: KpiNetworkResolver, TypeParent, TContext>; + + KpiHosts?: KpiHostsResolver; + + KpiHostDetails?: KpiHostDetailsResolver; + + MatrixHistogram?: MatrixHistogramResolver; + + NetworkTopCountries?: NetworkTopCountriesResolver< + NetworkTopCountriesData, + TypeParent, + TContext + >; + + NetworkTopNFlow?: NetworkTopNFlowResolver; + + NetworkDns?: NetworkDnsResolver; + + NetworkDnsHistogram?: NetworkDnsHistogramResolver; + + NetworkHttp?: NetworkHttpResolver; + + OverviewNetwork?: OverviewNetworkResolver, TypeParent, TContext>; + + OverviewHost?: OverviewHostResolver, TypeParent, TContext>; + + Tls?: TlsResolver; + /** Gets UncommonProcesses based on a timerange, or all UncommonProcesses if no criteria is specified */ + UncommonProcesses?: UncommonProcessesResolver; + /** Just a simple example to get the app name */ + whoAmI?: WhoAmIResolver, TypeParent, TContext>; + } + + export type IdResolver = Resolver< + R, + Parent, + TContext + >; + export type ConfigurationResolver< + R = SourceConfiguration, + Parent = Source, + TContext = SiemContext + > = Resolver; + export type StatusResolver = Resolver< + R, + Parent, + TContext + >; + export type AuthenticationsResolver< + R = AuthenticationsData, + Parent = Source, + TContext = SiemContext + > = Resolver; + export interface AuthenticationsArgs { + timerange: TimerangeInput; + pagination: PaginationInputPaginated; -export interface SourceTimelineArgs { - pagination: PaginationInput, - sortField: SortField, - fieldRequested: Array, - timerange?: Maybe, - filterQuery?: Maybe, - defaultIndex: Array -} + filterQuery?: Maybe; + defaultIndex: string[]; + } -export interface SourceTimelineDetailsArgs { - eventId: Scalars['String'], - indexName: Scalars['String'], - defaultIndex: Array -} + export type TimelineResolver< + R = TimelineData, + Parent = Source, + TContext = SiemContext + > = Resolver; + export interface TimelineArgs { + pagination: PaginationInput; + sortField: SortField; -export interface SourceLastEventTimeArgs { - id?: Maybe, - indexKey: LastEventIndexKey, - details: LastTimeDetails, - defaultIndex: Array -} + fieldRequested: string[]; + timerange?: Maybe; -export interface SourceHostsArgs { - id?: Maybe, - timerange: TimerangeInput, - pagination: PaginationInputPaginated, - sort: HostsSortField, - filterQuery?: Maybe, - defaultIndex: Array -} + filterQuery?: Maybe; + defaultIndex: string[]; + } -export interface SourceHostOverviewArgs { - id?: Maybe, - hostName: Scalars['String'], - timerange: TimerangeInput, - defaultIndex: Array -} + export type TimelineDetailsResolver< + R = TimelineDetailsData, + Parent = Source, + TContext = SiemContext + > = Resolver; + export interface TimelineDetailsArgs { + eventId: string; + indexName: string; -export interface SourceHostFirstLastSeenArgs { - id?: Maybe, - hostName: Scalars['String'], - defaultIndex: Array -} + defaultIndex: string[]; + } + export type LastEventTimeResolver< + R = LastEventTimeData, + Parent = Source, + TContext = SiemContext + > = Resolver; + export interface LastEventTimeArgs { + id?: Maybe; -export interface SourceIpOverviewArgs { - id?: Maybe, - filterQuery?: Maybe, - ip: Scalars['String'], - defaultIndex: Array -} + indexKey: LastEventIndexKey; + details: LastTimeDetails; -export interface SourceUsersArgs { - filterQuery?: Maybe, - id?: Maybe, - ip: Scalars['String'], - pagination: PaginationInputPaginated, - sort: UsersSortField, - flowTarget: FlowTarget, - timerange: TimerangeInput, - defaultIndex: Array -} + defaultIndex: string[]; + } + export type HostsResolver = Resolver< + R, + Parent, + TContext, + HostsArgs + >; + export interface HostsArgs { + id?: Maybe; -export interface SourceKpiNetworkArgs { - id?: Maybe, - timerange: TimerangeInput, - filterQuery?: Maybe, - defaultIndex: Array -} + timerange: TimerangeInput; + pagination: PaginationInputPaginated; -export interface SourceKpiHostsArgs { - id?: Maybe, - timerange: TimerangeInput, - filterQuery?: Maybe, - defaultIndex: Array -} + sort: HostsSortField; + filterQuery?: Maybe; -export interface SourceKpiHostDetailsArgs { - id?: Maybe, - timerange: TimerangeInput, - filterQuery?: Maybe, - defaultIndex: Array -} + defaultIndex: string[]; + } + export type HostOverviewResolver< + R = HostItem, + Parent = Source, + TContext = SiemContext + > = Resolver; + export interface HostOverviewArgs { + id?: Maybe; -export interface SourceMatrixHistogramArgs { - filterQuery?: Maybe, - defaultIndex: Array, - timerange: TimerangeInput, - stackByField: Scalars['String'], - histogramType: HistogramType -} + hostName: string; + timerange: TimerangeInput; -export interface SourceNetworkTopCountriesArgs { - id?: Maybe, - filterQuery?: Maybe, - ip?: Maybe, - flowTarget: FlowTargetSourceDest, - pagination: PaginationInputPaginated, - sort: NetworkTopTablesSortField, - timerange: TimerangeInput, - defaultIndex: Array -} + defaultIndex: string[]; + } + export type HostFirstLastSeenResolver< + R = FirstLastSeenHost, + Parent = Source, + TContext = SiemContext + > = Resolver; + export interface HostFirstLastSeenArgs { + id?: Maybe; -export interface SourceNetworkTopNFlowArgs { - id?: Maybe, - filterQuery?: Maybe, - ip?: Maybe, - flowTarget: FlowTargetSourceDest, - pagination: PaginationInputPaginated, - sort: NetworkTopTablesSortField, - timerange: TimerangeInput, - defaultIndex: Array -} + hostName: string; + defaultIndex: string[]; + } -export interface SourceNetworkDnsArgs { - filterQuery?: Maybe, - id?: Maybe, - isPtrIncluded: Scalars['Boolean'], - pagination: PaginationInputPaginated, - sort: NetworkDnsSortField, - stackByField?: Maybe, - timerange: TimerangeInput, - defaultIndex: Array -} + export type IpOverviewResolver< + R = Maybe, + Parent = Source, + TContext = SiemContext + > = Resolver; + export interface IpOverviewArgs { + id?: Maybe; + filterQuery?: Maybe; -export interface SourceNetworkDnsHistogramArgs { - filterQuery?: Maybe, - defaultIndex: Array, - timerange: TimerangeInput, - stackByField?: Maybe -} + ip: string; + defaultIndex: string[]; + } -export interface SourceNetworkHttpArgs { - id?: Maybe, - filterQuery?: Maybe, - ip?: Maybe, - pagination: PaginationInputPaginated, - sort: NetworkHttpSortField, - timerange: TimerangeInput, - defaultIndex: Array -} + export type UsersResolver = Resolver< + R, + Parent, + TContext, + UsersArgs + >; + export interface UsersArgs { + filterQuery?: Maybe; + id?: Maybe; -export interface SourceOverviewNetworkArgs { - id?: Maybe, - timerange: TimerangeInput, - filterQuery?: Maybe, - defaultIndex: Array -} + ip: string; + pagination: PaginationInputPaginated; -export interface SourceOverviewHostArgs { - id?: Maybe, - timerange: TimerangeInput, - filterQuery?: Maybe, - defaultIndex: Array -} + sort: UsersSortField; + flowTarget: FlowTarget; -export interface SourceTlsArgs { - filterQuery?: Maybe, - id?: Maybe, - ip: Scalars['String'], - pagination: PaginationInputPaginated, - sort: TlsSortField, - flowTarget: FlowTargetSourceDest, - timerange: TimerangeInput, - defaultIndex: Array -} + timerange: TimerangeInput; + defaultIndex: string[]; + } -export interface SourceUncommonProcessesArgs { - timerange: TimerangeInput, - pagination: PaginationInputPaginated, - filterQuery?: Maybe, - defaultIndex: Array -} + export type KpiNetworkResolver< + R = Maybe, + Parent = Source, + TContext = SiemContext + > = Resolver; + export interface KpiNetworkArgs { + id?: Maybe; -/** A set of configuration options for a security data source */ -export interface SourceConfiguration { - /** The field mapping to use for this source */ - fields: SourceFields, -} + timerange: TimerangeInput; -export interface SourceEcsFields { - bytes?: Maybe, - ip?: Maybe, - port?: Maybe, - domain?: Maybe, - geo?: Maybe, - packets?: Maybe, -} + filterQuery?: Maybe; -/** A mapping of semantic fields to their document counterparts */ -export interface SourceFields { - /** The field to identify a container by */ - container: Scalars['String'], - /** The fields to identify a host by */ - host: Scalars['String'], - /** The fields that may contain the log event message. The first field found win. */ - message: Array, - /** The field to identify a pod by */ - pod: Scalars['String'], - /** The field to use as a tiebreaker for log events that have identical timestamps */ - tiebreaker: Scalars['String'], - /** The field to use as a timestamp for metrics and logs */ - timestamp: Scalars['String'], -} + defaultIndex: string[]; + } -/** The status of an infrastructure data source */ -export interface SourceStatus { - /** Whether the configured alias or wildcard pattern resolve to any auditbeat indices */ - indicesExist: Scalars['Boolean'], - /** The list of fields defined in the index mappings */ - indexFields: Array, -} + export type KpiHostsResolver< + R = KpiHostsData, + Parent = Source, + TContext = SiemContext + > = Resolver; + export interface KpiHostsArgs { + id?: Maybe; + timerange: TimerangeInput; -/** The status of an infrastructure data source */ -export interface SourceStatusIndicesExistArgs { - defaultIndex: Array -} + filterQuery?: Maybe; + defaultIndex: string[]; + } -/** The status of an infrastructure data source */ -export interface SourceStatusIndexFieldsArgs { - defaultIndex: Array -} + export type KpiHostDetailsResolver< + R = KpiHostDetailsData, + Parent = Source, + TContext = SiemContext + > = Resolver; + export interface KpiHostDetailsArgs { + id?: Maybe; -export interface SshEcsFields { - method?: Maybe, - signature?: Maybe, -} + timerange: TimerangeInput; -export interface Summary { - actor?: Maybe, - object?: Maybe, - how?: Maybe, - message_type?: Maybe, - sequence?: Maybe, -} + filterQuery?: Maybe; -export interface SuricataAlertData { - signature?: Maybe, - signature_id?: Maybe, -} + defaultIndex: string[]; + } -export interface SuricataEcsFields { - eve?: Maybe, -} + export type MatrixHistogramResolver< + R = MatrixHistogramOverTimeData, + Parent = Source, + TContext = SiemContext + > = Resolver; + export interface MatrixHistogramArgs { + filterQuery?: Maybe; -export interface SuricataEveData { - alert?: Maybe, - flow_id?: Maybe, - proto?: Maybe, -} + defaultIndex: string[]; -export interface SystemEcsField { - audit?: Maybe, - auth?: Maybe, -} + timerange: TimerangeInput; -export interface Thread { - id?: Maybe, - start?: Maybe, -} + stackByField: string; -export interface TimelineData { - edges: Array, - totalCount: Scalars['Float'], - pageInfo: PageInfo, - inspect?: Maybe, -} + histogramType: HistogramType; + } -export interface TimelineDetailsData { - data?: Maybe>, - inspect?: Maybe, -} + export type NetworkTopCountriesResolver< + R = NetworkTopCountriesData, + Parent = Source, + TContext = SiemContext + > = Resolver; + export interface NetworkTopCountriesArgs { + id?: Maybe; -export interface TimelineEdges { - node: TimelineItem, - cursor: CursorType, -} + filterQuery?: Maybe; -export interface TimelineInput { - columns?: Maybe>, - dataProviders?: Maybe>, - description?: Maybe, - eventType?: Maybe, - filters?: Maybe>, - kqlMode?: Maybe, - kqlQuery?: Maybe, - title?: Maybe, - dateRange?: Maybe, - savedQueryId?: Maybe, - sort?: Maybe, -} + ip?: Maybe; -export interface TimelineItem { - _id: Scalars['String'], - _index?: Maybe, - data: Array, - ecs: Ecs, -} + flowTarget: FlowTargetSourceDest; -export interface TimelineNonEcsData { - field: Scalars['String'], - value?: Maybe, -} + pagination: PaginationInputPaginated; -export interface TimelineResult { - columns?: Maybe>, - created?: Maybe, - createdBy?: Maybe, - dataProviders?: Maybe>, - dateRange?: Maybe, - description?: Maybe, - eventIdToNoteIds?: Maybe>, - eventType?: Maybe, - favorite?: Maybe>, - filters?: Maybe>, - kqlMode?: Maybe, - kqlQuery?: Maybe, - notes?: Maybe>, - noteIds?: Maybe>, - pinnedEventIds?: Maybe>, - pinnedEventsSaveObject?: Maybe>, - savedQueryId?: Maybe, - savedObjectId: Scalars['String'], - sort?: Maybe, - title?: Maybe, - updated?: Maybe, - updatedBy?: Maybe, - version: Scalars['String'], -} + sort: NetworkTopTablesSortField; -export interface TimerangeInput { - /** - * The interval string to use for last bucket. The format is '{value}{unit}'. For - * example '5m' would return the metrics for the last 5 minutes of the timespan. - */ - interval: Scalars['String'], - /** The end of the timerange */ - to: Scalars['Float'], - /** The beginning of the timerange */ - from: Scalars['Float'], -} + timerange: TimerangeInput; -export interface TlsClientCertificateData { - fingerprint?: Maybe, -} + defaultIndex: string[]; + } -export interface TlsData { - edges: Array, - totalCount: Scalars['Float'], - pageInfo: PageInfoPaginated, - inspect?: Maybe, -} + export type NetworkTopNFlowResolver< + R = NetworkTopNFlowData, + Parent = Source, + TContext = SiemContext + > = Resolver; + export interface NetworkTopNFlowArgs { + id?: Maybe; -export interface TlsEcsFields { - client_certificate?: Maybe, - fingerprints?: Maybe, - server_certificate?: Maybe, -} + filterQuery?: Maybe; -export interface TlsEdges { - node: TlsNode, - cursor: CursorType, -} + ip?: Maybe; -export enum TlsFields { - _id = '_id' -} + flowTarget: FlowTargetSourceDest; -export interface TlsFingerprintsData { - ja3?: Maybe, -} + pagination: PaginationInputPaginated; -export interface TlsJa3Data { - hash?: Maybe, -} + sort: NetworkTopTablesSortField; -export interface TlsNode { - _id?: Maybe, - timestamp?: Maybe, - alternativeNames?: Maybe>, - notAfter?: Maybe>, - commonNames?: Maybe>, - ja3?: Maybe>, - issuerNames?: Maybe>, -} + timerange: TimerangeInput; -export interface TlsServerCertificateData { - fingerprint?: Maybe, -} + defaultIndex: string[]; + } -export interface TlsSortField { - field: TlsFields, - direction: Direction, -} + export type NetworkDnsResolver< + R = NetworkDnsData, + Parent = Source, + TContext = SiemContext + > = Resolver; + export interface NetworkDnsArgs { + filterQuery?: Maybe; + id?: Maybe; + isPtrIncluded: boolean; + pagination: PaginationInputPaginated; + sort: NetworkDnsSortField; -export interface TopCountriesItemDestination { - country?: Maybe, - destination_ips?: Maybe, - flows?: Maybe, - location?: Maybe, - source_ips?: Maybe, -} + stackByField?: Maybe; -export interface TopCountriesItemSource { - country?: Maybe, - destination_ips?: Maybe, - flows?: Maybe, - location?: Maybe, - source_ips?: Maybe, -} + timerange: TimerangeInput; -export interface TopNetworkTablesEcsField { - bytes_in?: Maybe, - bytes_out?: Maybe, -} + defaultIndex: string[]; + } -export interface TopNFlowItemDestination { - autonomous_system?: Maybe, - domain?: Maybe>, - ip?: Maybe, - location?: Maybe, - flows?: Maybe, - source_ips?: Maybe, -} + export type NetworkDnsHistogramResolver< + R = NetworkDsOverTimeData, + Parent = Source, + TContext = SiemContext + > = Resolver; + export interface NetworkDnsHistogramArgs { + filterQuery?: Maybe; -export interface TopNFlowItemSource { - autonomous_system?: Maybe, - domain?: Maybe>, - ip?: Maybe, - location?: Maybe, - flows?: Maybe, - destination_ips?: Maybe, -} + defaultIndex: string[]; + timerange: TimerangeInput; -export interface UncommonProcessesData { - edges: Array, - totalCount: Scalars['Float'], - pageInfo: PageInfoPaginated, - inspect?: Maybe, -} + stackByField?: Maybe; + } -export interface UncommonProcessesEdges { - node: UncommonProcessItem, - cursor: CursorType, -} + export type NetworkHttpResolver< + R = NetworkHttpData, + Parent = Source, + TContext = SiemContext + > = Resolver; + export interface NetworkHttpArgs { + id?: Maybe; -export interface UncommonProcessItem { - _id: Scalars['String'], - instances: Scalars['Float'], - process: ProcessEcsFields, - hosts: Array, - user?: Maybe, -} + filterQuery?: Maybe; -export interface UrlEcsFields { - domain?: Maybe, - original?: Maybe, - username?: Maybe, - password?: Maybe, -} + ip?: Maybe; -export interface UserEcsFields { - domain?: Maybe, - id?: Maybe, - name?: Maybe, - full_name?: Maybe, - email?: Maybe, - hash?: Maybe, - group?: Maybe, -} + pagination: PaginationInputPaginated; -export interface UsersData { - edges: Array, - totalCount: Scalars['Float'], - pageInfo: PageInfoPaginated, - inspect?: Maybe, -} + sort: NetworkHttpSortField; -export interface UsersEdges { - node: UsersNode, - cursor: CursorType, -} + timerange: TimerangeInput; -export enum UsersFields { - name = 'name', - count = 'count' -} + defaultIndex: string[]; + } -export interface UsersItem { - name?: Maybe, - id?: Maybe, - groupId?: Maybe, - groupName?: Maybe, - count?: Maybe, -} + export type OverviewNetworkResolver< + R = Maybe, + Parent = Source, + TContext = SiemContext + > = Resolver; + export interface OverviewNetworkArgs { + id?: Maybe; -export interface UsersNode { - _id?: Maybe, - timestamp?: Maybe, - user?: Maybe, -} + timerange: TimerangeInput; -export interface UsersSortField { - field: UsersFields, - direction: Direction, -} + filterQuery?: Maybe; -export interface WinlogEcsFields { - event_id?: Maybe, -} + defaultIndex: string[]; + } -export interface ZeekConnectionData { - local_resp?: Maybe, - local_orig?: Maybe, - missed_bytes?: Maybe, - state?: Maybe, - history?: Maybe, -} + export type OverviewHostResolver< + R = Maybe, + Parent = Source, + TContext = SiemContext + > = Resolver; + export interface OverviewHostArgs { + id?: Maybe; -export interface ZeekDnsData { - AA?: Maybe, - qclass_name?: Maybe, - RD?: Maybe, - qtype_name?: Maybe, - rejected?: Maybe, - qtype?: Maybe, - query?: Maybe, - trans_id?: Maybe, - qclass?: Maybe, - RA?: Maybe, - TC?: Maybe, -} + timerange: TimerangeInput; -export interface ZeekEcsFields { - session_id?: Maybe, - connection?: Maybe, - notice?: Maybe, - dns?: Maybe, - http?: Maybe, - files?: Maybe, - ssl?: Maybe, -} + filterQuery?: Maybe; -export interface ZeekFileData { - session_ids?: Maybe, - timedout?: Maybe, - local_orig?: Maybe, - tx_host?: Maybe, - source?: Maybe, - is_orig?: Maybe, - overflow_bytes?: Maybe, - sha1?: Maybe, - duration?: Maybe, - depth?: Maybe, - analyzers?: Maybe, - mime_type?: Maybe, - rx_host?: Maybe, - total_bytes?: Maybe, - fuid?: Maybe, - seen_bytes?: Maybe, - missing_bytes?: Maybe, - md5?: Maybe, -} + defaultIndex: string[]; + } -export interface ZeekHttpData { - resp_mime_types?: Maybe, - trans_depth?: Maybe, - status_msg?: Maybe, - resp_fuids?: Maybe, - tags?: Maybe, -} + export type TlsResolver = Resolver< + R, + Parent, + TContext, + TlsArgs + >; + export interface TlsArgs { + filterQuery?: Maybe; -export interface ZeekNoticeData { - suppress_for?: Maybe, - msg?: Maybe, - note?: Maybe, - sub?: Maybe, - dst?: Maybe, - dropped?: Maybe, - peer_descr?: Maybe, -} + id?: Maybe; -export interface ZeekSslData { - cipher?: Maybe, - established?: Maybe, - resumed?: Maybe, - version?: Maybe, -} + ip: string; -export type WithIndex = TObject & Record; -export type ResolversObject = WithIndex; + pagination: PaginationInputPaginated; -export type ResolverTypeWrapper = Promise | T; + sort: TlsSortField; -export type ResolverFn = ( - parent: TParent, - args: TArgs, - context: TContext, - info: GraphQLResolveInfo -) => Promise | TResult; + flowTarget: FlowTargetSourceDest; + timerange: TimerangeInput; -export type StitchingResolver = { - fragment: string; - resolve: ResolverFn; -}; + defaultIndex: string[]; + } -export type Resolver = - | ResolverFn - | StitchingResolver; + export type UncommonProcessesResolver< + R = UncommonProcessesData, + Parent = Source, + TContext = SiemContext + > = Resolver; + export interface UncommonProcessesArgs { + timerange: TimerangeInput; -export type SubscriptionSubscribeFn = ( - parent: TParent, - args: TArgs, - context: TContext, - info: GraphQLResolveInfo -) => AsyncIterator | Promise>; + pagination: PaginationInputPaginated; -export type SubscriptionResolveFn = ( - parent: TParent, - args: TArgs, - context: TContext, - info: GraphQLResolveInfo -) => TResult | Promise; + filterQuery?: Maybe; -export interface SubscriptionSubscriberObject { - subscribe: SubscriptionSubscribeFn<{ [key in TKey]: TResult }, TParent, TContext, TArgs>; - resolve?: SubscriptionResolveFn; -} + defaultIndex: string[]; + } -export interface SubscriptionResolverObject { - subscribe: SubscriptionSubscribeFn; - resolve: SubscriptionResolveFn; + export type WhoAmIResolver< + R = Maybe, + Parent = Source, + TContext = SiemContext + > = Resolver; } +/** A set of configuration options for a security data source */ +export namespace SourceConfigurationResolvers { + export interface Resolvers { + /** The field mapping to use for this source */ + fields?: FieldsResolver; + } + + export type FieldsResolver< + R = SourceFields, + Parent = SourceConfiguration, + TContext = SiemContext + > = Resolver; +} +/** A mapping of semantic fields to their document counterparts */ +export namespace SourceFieldsResolvers { + export interface Resolvers { + /** The field to identify a container by */ + container?: ContainerResolver; + /** The fields to identify a host by */ + host?: HostResolver; + /** The fields that may contain the log event message. The first field found win. */ + message?: MessageResolver; + /** The field to identify a pod by */ + pod?: PodResolver; + /** The field to use as a tiebreaker for log events that have identical timestamps */ + tiebreaker?: TiebreakerResolver; + /** The field to use as a timestamp for metrics and logs */ + timestamp?: TimestampResolver; + } + + export type ContainerResolver< + R = string, + Parent = SourceFields, + TContext = SiemContext + > = Resolver; + export type HostResolver = Resolver< + R, + Parent, + TContext + >; + export type MessageResolver< + R = string[], + Parent = SourceFields, + TContext = SiemContext + > = Resolver; + export type PodResolver = Resolver< + R, + Parent, + TContext + >; + export type TiebreakerResolver< + R = string, + Parent = SourceFields, + TContext = SiemContext + > = Resolver; + export type TimestampResolver< + R = string, + Parent = SourceFields, + TContext = SiemContext + > = Resolver; +} +/** The status of an infrastructure data source */ +export namespace SourceStatusResolvers { + export interface Resolvers { + /** Whether the configured alias or wildcard pattern resolve to any auditbeat indices */ + indicesExist?: IndicesExistResolver; + /** The list of fields defined in the index mappings */ + indexFields?: IndexFieldsResolver; + } + + export type IndicesExistResolver< + R = boolean, + Parent = SourceStatus, + TContext = SiemContext + > = Resolver; + export interface IndicesExistArgs { + defaultIndex: string[]; + } + + export type IndexFieldsResolver< + R = IndexField[], + Parent = SourceStatus, + TContext = SiemContext + > = Resolver; + export interface IndexFieldsArgs { + defaultIndex: string[]; + } +} +/** A descriptor of a field in an index */ +export namespace IndexFieldResolvers { + export interface Resolvers { + /** Where the field belong */ + category?: CategoryResolver; + /** Example of field's value */ + example?: ExampleResolver, TypeParent, TContext>; + /** whether the field's belong to an alias index */ + indexes?: IndexesResolver<(Maybe)[], TypeParent, TContext>; + /** The name of the field */ + name?: NameResolver; + /** The type of the field's values as recognized by Kibana */ + type?: TypeResolver; + /** Whether the field's values can be efficiently searched for */ + searchable?: SearchableResolver; + /** Whether the field's values can be aggregated */ + aggregatable?: AggregatableResolver; + /** Description of the field */ + description?: DescriptionResolver, TypeParent, TContext>; + + format?: FormatResolver, TypeParent, TContext>; + } + + export type CategoryResolver = Resolver< + R, + Parent, + TContext + >; + export type ExampleResolver< + R = Maybe, + Parent = IndexField, + TContext = SiemContext + > = Resolver; + export type IndexesResolver< + R = (Maybe)[], + Parent = IndexField, + TContext = SiemContext + > = Resolver; + export type NameResolver = Resolver< + R, + Parent, + TContext + >; + export type TypeResolver = Resolver< + R, + Parent, + TContext + >; + export type SearchableResolver< + R = boolean, + Parent = IndexField, + TContext = SiemContext + > = Resolver; + export type AggregatableResolver< + R = boolean, + Parent = IndexField, + TContext = SiemContext + > = Resolver; + export type DescriptionResolver< + R = Maybe, + Parent = IndexField, + TContext = SiemContext + > = Resolver; + export type FormatResolver< + R = Maybe, + Parent = IndexField, + TContext = SiemContext + > = Resolver; +} + +export namespace AuthenticationsDataResolvers { + export interface Resolvers { + edges?: EdgesResolver; + + totalCount?: TotalCountResolver; + + pageInfo?: PageInfoResolver; + + inspect?: InspectResolver, TypeParent, TContext>; + } + + export type EdgesResolver< + R = AuthenticationsEdges[], + Parent = AuthenticationsData, + TContext = SiemContext + > = Resolver; + export type TotalCountResolver< + R = number, + Parent = AuthenticationsData, + TContext = SiemContext + > = Resolver; + export type PageInfoResolver< + R = PageInfoPaginated, + Parent = AuthenticationsData, + TContext = SiemContext + > = Resolver; + export type InspectResolver< + R = Maybe, + Parent = AuthenticationsData, + TContext = SiemContext + > = Resolver; +} + +export namespace AuthenticationsEdgesResolvers { + export interface Resolvers { + node?: NodeResolver; + + cursor?: CursorResolver; + } + + export type NodeResolver< + R = AuthenticationItem, + Parent = AuthenticationsEdges, + TContext = SiemContext + > = Resolver; + export type CursorResolver< + R = CursorType, + Parent = AuthenticationsEdges, + TContext = SiemContext + > = Resolver; +} + +export namespace AuthenticationItemResolvers { + export interface Resolvers { + _id?: _IdResolver; + + failures?: FailuresResolver; + + successes?: SuccessesResolver; + + user?: UserResolver; + + lastSuccess?: LastSuccessResolver, TypeParent, TContext>; + + lastFailure?: LastFailureResolver, TypeParent, TContext>; + } + + export type _IdResolver< + R = string, + Parent = AuthenticationItem, + TContext = SiemContext + > = Resolver; + export type FailuresResolver< + R = number, + Parent = AuthenticationItem, + TContext = SiemContext + > = Resolver; + export type SuccessesResolver< + R = number, + Parent = AuthenticationItem, + TContext = SiemContext + > = Resolver; + export type UserResolver< + R = UserEcsFields, + Parent = AuthenticationItem, + TContext = SiemContext + > = Resolver; + export type LastSuccessResolver< + R = Maybe, + Parent = AuthenticationItem, + TContext = SiemContext + > = Resolver; + export type LastFailureResolver< + R = Maybe, + Parent = AuthenticationItem, + TContext = SiemContext + > = Resolver; +} + +export namespace UserEcsFieldsResolvers { + export interface Resolvers { + domain?: DomainResolver, TypeParent, TContext>; + + id?: IdResolver, TypeParent, TContext>; + + name?: NameResolver, TypeParent, TContext>; + + full_name?: FullNameResolver, TypeParent, TContext>; + + email?: EmailResolver, TypeParent, TContext>; + + hash?: HashResolver, TypeParent, TContext>; + + group?: GroupResolver, TypeParent, TContext>; + } + + export type DomainResolver< + R = Maybe, + Parent = UserEcsFields, + TContext = SiemContext + > = Resolver; + export type IdResolver< + R = Maybe, + Parent = UserEcsFields, + TContext = SiemContext + > = Resolver; + export type NameResolver< + R = Maybe, + Parent = UserEcsFields, + TContext = SiemContext + > = Resolver; + export type FullNameResolver< + R = Maybe, + Parent = UserEcsFields, + TContext = SiemContext + > = Resolver; + export type EmailResolver< + R = Maybe, + Parent = UserEcsFields, + TContext = SiemContext + > = Resolver; + export type HashResolver< + R = Maybe, + Parent = UserEcsFields, + TContext = SiemContext + > = Resolver; + export type GroupResolver< + R = Maybe, + Parent = UserEcsFields, + TContext = SiemContext + > = Resolver; +} + +export namespace LastSourceHostResolvers { + export interface Resolvers { + timestamp?: TimestampResolver, TypeParent, TContext>; + + source?: SourceResolver, TypeParent, TContext>; + + host?: HostResolver, TypeParent, TContext>; + } + + export type TimestampResolver< + R = Maybe, + Parent = LastSourceHost, + TContext = SiemContext + > = Resolver; + export type SourceResolver< + R = Maybe, + Parent = LastSourceHost, + TContext = SiemContext + > = Resolver; + export type HostResolver< + R = Maybe, + Parent = LastSourceHost, + TContext = SiemContext + > = Resolver; +} + +export namespace SourceEcsFieldsResolvers { + export interface Resolvers { + bytes?: BytesResolver, TypeParent, TContext>; + + ip?: IpResolver, TypeParent, TContext>; + + port?: PortResolver, TypeParent, TContext>; + + domain?: DomainResolver, TypeParent, TContext>; + + geo?: GeoResolver, TypeParent, TContext>; + + packets?: PacketsResolver, TypeParent, TContext>; + } + + export type BytesResolver< + R = Maybe, + Parent = SourceEcsFields, + TContext = SiemContext + > = Resolver; + export type IpResolver< + R = Maybe, + Parent = SourceEcsFields, + TContext = SiemContext + > = Resolver; + export type PortResolver< + R = Maybe, + Parent = SourceEcsFields, + TContext = SiemContext + > = Resolver; + export type DomainResolver< + R = Maybe, + Parent = SourceEcsFields, + TContext = SiemContext + > = Resolver; + export type GeoResolver< + R = Maybe, + Parent = SourceEcsFields, + TContext = SiemContext + > = Resolver; + export type PacketsResolver< + R = Maybe, + Parent = SourceEcsFields, + TContext = SiemContext + > = Resolver; +} + +export namespace GeoEcsFieldsResolvers { + export interface Resolvers { + city_name?: CityNameResolver, TypeParent, TContext>; + + continent_name?: ContinentNameResolver, TypeParent, TContext>; + + country_iso_code?: CountryIsoCodeResolver, TypeParent, TContext>; + + country_name?: CountryNameResolver, TypeParent, TContext>; + + location?: LocationResolver, TypeParent, TContext>; + + region_iso_code?: RegionIsoCodeResolver, TypeParent, TContext>; + + region_name?: RegionNameResolver, TypeParent, TContext>; + } + + export type CityNameResolver< + R = Maybe, + Parent = GeoEcsFields, + TContext = SiemContext + > = Resolver; + export type ContinentNameResolver< + R = Maybe, + Parent = GeoEcsFields, + TContext = SiemContext + > = Resolver; + export type CountryIsoCodeResolver< + R = Maybe, + Parent = GeoEcsFields, + TContext = SiemContext + > = Resolver; + export type CountryNameResolver< + R = Maybe, + Parent = GeoEcsFields, + TContext = SiemContext + > = Resolver; + export type LocationResolver< + R = Maybe, + Parent = GeoEcsFields, + TContext = SiemContext + > = Resolver; + export type RegionIsoCodeResolver< + R = Maybe, + Parent = GeoEcsFields, + TContext = SiemContext + > = Resolver; + export type RegionNameResolver< + R = Maybe, + Parent = GeoEcsFields, + TContext = SiemContext + > = Resolver; +} + +export namespace LocationResolvers { + export interface Resolvers { + lon?: LonResolver, TypeParent, TContext>; + + lat?: LatResolver, TypeParent, TContext>; + } + + export type LonResolver< + R = Maybe, + Parent = Location, + TContext = SiemContext + > = Resolver; + export type LatResolver< + R = Maybe, + Parent = Location, + TContext = SiemContext + > = Resolver; +} + +export namespace HostEcsFieldsResolvers { + export interface Resolvers { + architecture?: ArchitectureResolver, TypeParent, TContext>; + + id?: IdResolver, TypeParent, TContext>; + + ip?: IpResolver, TypeParent, TContext>; + + mac?: MacResolver, TypeParent, TContext>; + + name?: NameResolver, TypeParent, TContext>; + + os?: OsResolver, TypeParent, TContext>; + + type?: TypeResolver, TypeParent, TContext>; + } + + export type ArchitectureResolver< + R = Maybe, + Parent = HostEcsFields, + TContext = SiemContext + > = Resolver; + export type IdResolver< + R = Maybe, + Parent = HostEcsFields, + TContext = SiemContext + > = Resolver; + export type IpResolver< + R = Maybe, + Parent = HostEcsFields, + TContext = SiemContext + > = Resolver; + export type MacResolver< + R = Maybe, + Parent = HostEcsFields, + TContext = SiemContext + > = Resolver; + export type NameResolver< + R = Maybe, + Parent = HostEcsFields, + TContext = SiemContext + > = Resolver; + export type OsResolver< + R = Maybe, + Parent = HostEcsFields, + TContext = SiemContext + > = Resolver; + export type TypeResolver< + R = Maybe, + Parent = HostEcsFields, + TContext = SiemContext + > = Resolver; +} + +export namespace OsEcsFieldsResolvers { + export interface Resolvers { + platform?: PlatformResolver, TypeParent, TContext>; + + name?: NameResolver, TypeParent, TContext>; + + full?: FullResolver, TypeParent, TContext>; + + family?: FamilyResolver, TypeParent, TContext>; + + version?: VersionResolver, TypeParent, TContext>; + + kernel?: KernelResolver, TypeParent, TContext>; + } + + export type PlatformResolver< + R = Maybe, + Parent = OsEcsFields, + TContext = SiemContext + > = Resolver; + export type NameResolver< + R = Maybe, + Parent = OsEcsFields, + TContext = SiemContext + > = Resolver; + export type FullResolver< + R = Maybe, + Parent = OsEcsFields, + TContext = SiemContext + > = Resolver; + export type FamilyResolver< + R = Maybe, + Parent = OsEcsFields, + TContext = SiemContext + > = Resolver; + export type VersionResolver< + R = Maybe, + Parent = OsEcsFields, + TContext = SiemContext + > = Resolver; + export type KernelResolver< + R = Maybe, + Parent = OsEcsFields, + TContext = SiemContext + > = Resolver; +} + +export namespace CursorTypeResolvers { + export interface Resolvers { + value?: ValueResolver, TypeParent, TContext>; + + tiebreaker?: TiebreakerResolver, TypeParent, TContext>; + } + + export type ValueResolver< + R = Maybe, + Parent = CursorType, + TContext = SiemContext + > = Resolver; + export type TiebreakerResolver< + R = Maybe, + Parent = CursorType, + TContext = SiemContext + > = Resolver; +} + +export namespace PageInfoPaginatedResolvers { + export interface Resolvers { + activePage?: ActivePageResolver; + + fakeTotalCount?: FakeTotalCountResolver; + + showMorePagesIndicator?: ShowMorePagesIndicatorResolver; + } + + export type ActivePageResolver< + R = number, + Parent = PageInfoPaginated, + TContext = SiemContext + > = Resolver; + export type FakeTotalCountResolver< + R = number, + Parent = PageInfoPaginated, + TContext = SiemContext + > = Resolver; + export type ShowMorePagesIndicatorResolver< + R = boolean, + Parent = PageInfoPaginated, + TContext = SiemContext + > = Resolver; +} + +export namespace InspectResolvers { + export interface Resolvers { + dsl?: DslResolver; + + response?: ResponseResolver; + } + + export type DslResolver = Resolver< + R, + Parent, + TContext + >; + export type ResponseResolver = Resolver< + R, + Parent, + TContext + >; +} + +export namespace TimelineDataResolvers { + export interface Resolvers { + edges?: EdgesResolver; + + totalCount?: TotalCountResolver; + + pageInfo?: PageInfoResolver; + + inspect?: InspectResolver, TypeParent, TContext>; + } + + export type EdgesResolver< + R = TimelineEdges[], + Parent = TimelineData, + TContext = SiemContext + > = Resolver; + export type TotalCountResolver< + R = number, + Parent = TimelineData, + TContext = SiemContext + > = Resolver; + export type PageInfoResolver< + R = PageInfo, + Parent = TimelineData, + TContext = SiemContext + > = Resolver; + export type InspectResolver< + R = Maybe, + Parent = TimelineData, + TContext = SiemContext + > = Resolver; +} + +export namespace TimelineEdgesResolvers { + export interface Resolvers { + node?: NodeResolver; + + cursor?: CursorResolver; + } -export type SubscriptionObject = - | SubscriptionSubscriberObject - | SubscriptionResolverObject; - -export type SubscriptionResolver = - | ((...args: any[]) => SubscriptionObject) - | SubscriptionObject; + export type NodeResolver< + R = TimelineItem, + Parent = TimelineEdges, + TContext = SiemContext + > = Resolver; + export type CursorResolver< + R = CursorType, + Parent = TimelineEdges, + TContext = SiemContext + > = Resolver; +} -export type TypeResolveFn = ( - parent: TParent, - context: TContext, - info: GraphQLResolveInfo -) => Maybe; +export namespace TimelineItemResolvers { + export interface Resolvers { + _id?: _IdResolver; -export type isTypeOfResolverFn = (obj: T, info: GraphQLResolveInfo) => boolean; + _index?: _IndexResolver, TypeParent, TContext>; -export type NextResolverFn = () => Promise; + data?: DataResolver; -export type DirectiveResolverFn = ( - next: NextResolverFn, - parent: TParent, - args: TArgs, - context: TContext, - info: GraphQLResolveInfo -) => TResult | Promise; + ecs?: EcsResolver; + } -/** Mapping between all available schema types and the resolvers types */ -export type ResolversTypes = ResolversObject<{ - Query: ResolverTypeWrapper<{}>, - ID: ResolverTypeWrapper, - NoteResult: ResolverTypeWrapper, - String: ResolverTypeWrapper, - Float: ResolverTypeWrapper, - PageInfoNote: PageInfoNote, - SortNote: SortNote, - SortFieldNote: SortFieldNote, - Direction: Direction, - ResponseNotes: ResolverTypeWrapper, - PinnedEvent: ResolverTypeWrapper, - Source: ResolverTypeWrapper, - SourceConfiguration: ResolverTypeWrapper, - SourceFields: ResolverTypeWrapper, - SourceStatus: ResolverTypeWrapper, - Boolean: ResolverTypeWrapper, - IndexField: ResolverTypeWrapper, - TimerangeInput: TimerangeInput, - PaginationInputPaginated: PaginationInputPaginated, - AuthenticationsData: ResolverTypeWrapper, - AuthenticationsEdges: ResolverTypeWrapper, - AuthenticationItem: ResolverTypeWrapper, - UserEcsFields: ResolverTypeWrapper, - ToStringArray: ResolverTypeWrapper, - LastSourceHost: ResolverTypeWrapper, - Date: ResolverTypeWrapper, - SourceEcsFields: ResolverTypeWrapper, - ToNumberArray: ResolverTypeWrapper, - GeoEcsFields: ResolverTypeWrapper, - Location: ResolverTypeWrapper, - HostEcsFields: ResolverTypeWrapper, - OsEcsFields: ResolverTypeWrapper, - CursorType: ResolverTypeWrapper, - PageInfoPaginated: ResolverTypeWrapper, - Inspect: ResolverTypeWrapper, - PaginationInput: PaginationInput, - SortField: SortField, - TimelineData: ResolverTypeWrapper, - TimelineEdges: ResolverTypeWrapper, - TimelineItem: ResolverTypeWrapper, - TimelineNonEcsData: ResolverTypeWrapper, - ECS: ResolverTypeWrapper, - AuditdEcsFields: ResolverTypeWrapper, - AuditdData: ResolverTypeWrapper, - Summary: ResolverTypeWrapper, - PrimarySecondary: ResolverTypeWrapper, - DestinationEcsFields: ResolverTypeWrapper, - DnsEcsFields: ResolverTypeWrapper, - DnsQuestionData: ResolverTypeWrapper, - EndgameEcsFields: ResolverTypeWrapper, - EventEcsFields: ResolverTypeWrapper, - ToDateArray: ResolverTypeWrapper, - NetworkEcsField: ResolverTypeWrapper, - RuleEcsField: ResolverTypeWrapper, - SignalField: ResolverTypeWrapper, - RuleField: ResolverTypeWrapper, - ToBooleanArray: ResolverTypeWrapper, - ToAny: ResolverTypeWrapper, - SuricataEcsFields: ResolverTypeWrapper, - SuricataEveData: ResolverTypeWrapper, - SuricataAlertData: ResolverTypeWrapper, - TlsEcsFields: ResolverTypeWrapper, - TlsClientCertificateData: ResolverTypeWrapper, - FingerprintData: ResolverTypeWrapper, - TlsFingerprintsData: ResolverTypeWrapper, - TlsJa3Data: ResolverTypeWrapper, - TlsServerCertificateData: ResolverTypeWrapper, - ZeekEcsFields: ResolverTypeWrapper, - ZeekConnectionData: ResolverTypeWrapper, - ZeekNoticeData: ResolverTypeWrapper, - ZeekDnsData: ResolverTypeWrapper, - ZeekHttpData: ResolverTypeWrapper, - ZeekFileData: ResolverTypeWrapper, - ZeekSslData: ResolverTypeWrapper, - HttpEcsFields: ResolverTypeWrapper, - HttpRequestData: ResolverTypeWrapper, - HttpBodyData: ResolverTypeWrapper, - HttpResponseData: ResolverTypeWrapper, - UrlEcsFields: ResolverTypeWrapper, - WinlogEcsFields: ResolverTypeWrapper, - ProcessEcsFields: ResolverTypeWrapper, - ProcessHashData: ResolverTypeWrapper, - Thread: ResolverTypeWrapper, - FileFields: ResolverTypeWrapper, - SystemEcsField: ResolverTypeWrapper, - AuditEcsFields: ResolverTypeWrapper, - PackageEcsFields: ResolverTypeWrapper, - AuthEcsFields: ResolverTypeWrapper, - SshEcsFields: ResolverTypeWrapper, - PageInfo: ResolverTypeWrapper, - TimelineDetailsData: ResolverTypeWrapper, - DetailItem: ResolverTypeWrapper, - EsValue: ResolverTypeWrapper, - LastEventIndexKey: LastEventIndexKey, - LastTimeDetails: LastTimeDetails, - LastEventTimeData: ResolverTypeWrapper, - HostsSortField: HostsSortField, - HostsFields: HostsFields, - HostsData: ResolverTypeWrapper, - HostsEdges: ResolverTypeWrapper, - HostItem: ResolverTypeWrapper, - CloudFields: ResolverTypeWrapper, - CloudInstance: ResolverTypeWrapper, - CloudMachine: ResolverTypeWrapper, - FirstLastSeenHost: ResolverTypeWrapper, - IpOverviewData: ResolverTypeWrapper, - Overview: ResolverTypeWrapper, - AutonomousSystem: ResolverTypeWrapper, - AutonomousSystemOrganization: ResolverTypeWrapper, - UsersSortField: UsersSortField, - UsersFields: UsersFields, - FlowTarget: FlowTarget, - UsersData: ResolverTypeWrapper, - UsersEdges: ResolverTypeWrapper, - UsersNode: ResolverTypeWrapper, - UsersItem: ResolverTypeWrapper, - KpiNetworkData: ResolverTypeWrapper, - KpiNetworkHistogramData: ResolverTypeWrapper, - KpiHostsData: ResolverTypeWrapper, - KpiHostHistogramData: ResolverTypeWrapper, - KpiHostDetailsData: ResolverTypeWrapper, - HistogramType: HistogramType, - MatrixHistogramOverTimeData: ResolverTypeWrapper, - MatrixOverTimeHistogramData: ResolverTypeWrapper, - FlowTargetSourceDest: FlowTargetSourceDest, - NetworkTopTablesSortField: NetworkTopTablesSortField, - NetworkTopTablesFields: NetworkTopTablesFields, - NetworkTopCountriesData: ResolverTypeWrapper, - NetworkTopCountriesEdges: ResolverTypeWrapper, - NetworkTopCountriesItem: ResolverTypeWrapper, - TopCountriesItemSource: ResolverTypeWrapper, - GeoItem: ResolverTypeWrapper, - TopCountriesItemDestination: ResolverTypeWrapper, - TopNetworkTablesEcsField: ResolverTypeWrapper, - NetworkTopNFlowData: ResolverTypeWrapper, - NetworkTopNFlowEdges: ResolverTypeWrapper, - NetworkTopNFlowItem: ResolverTypeWrapper, - TopNFlowItemSource: ResolverTypeWrapper, - AutonomousSystemItem: ResolverTypeWrapper, - TopNFlowItemDestination: ResolverTypeWrapper, - NetworkDnsSortField: NetworkDnsSortField, - NetworkDnsFields: NetworkDnsFields, - NetworkDnsData: ResolverTypeWrapper, - NetworkDnsEdges: ResolverTypeWrapper, - NetworkDnsItem: ResolverTypeWrapper, - MatrixOverOrdinalHistogramData: ResolverTypeWrapper, - NetworkDsOverTimeData: ResolverTypeWrapper, - NetworkHttpSortField: NetworkHttpSortField, - NetworkHttpData: ResolverTypeWrapper, - NetworkHttpEdges: ResolverTypeWrapper, - NetworkHttpItem: ResolverTypeWrapper, - OverviewNetworkData: ResolverTypeWrapper, - OverviewHostData: ResolverTypeWrapper, - TlsSortField: TlsSortField, - TlsFields: TlsFields, - TlsData: ResolverTypeWrapper, - TlsEdges: ResolverTypeWrapper, - TlsNode: ResolverTypeWrapper, - UncommonProcessesData: ResolverTypeWrapper, - UncommonProcessesEdges: ResolverTypeWrapper, - UncommonProcessItem: ResolverTypeWrapper, - SayMyName: ResolverTypeWrapper, - TimelineResult: ResolverTypeWrapper, - ColumnHeaderResult: ResolverTypeWrapper, - DataProviderResult: ResolverTypeWrapper, - QueryMatchResult: ResolverTypeWrapper, - DateRangePickerResult: ResolverTypeWrapper, - FavoriteTimelineResult: ResolverTypeWrapper, - FilterTimelineResult: ResolverTypeWrapper, - FilterMetaTimelineResult: ResolverTypeWrapper, - SerializedFilterQueryResult: ResolverTypeWrapper, - SerializedKueryQueryResult: ResolverTypeWrapper, - KueryFilterQueryResult: ResolverTypeWrapper, - SortTimelineResult: ResolverTypeWrapper, - PageInfoTimeline: PageInfoTimeline, - SortTimeline: SortTimeline, - SortFieldTimeline: SortFieldTimeline, - ResponseTimelines: ResolverTypeWrapper, - Mutation: ResolverTypeWrapper<{}>, - NoteInput: NoteInput, - ResponseNote: ResolverTypeWrapper, - TimelineInput: TimelineInput, - ColumnHeaderInput: ColumnHeaderInput, - DataProviderInput: DataProviderInput, - QueryMatchInput: QueryMatchInput, - FilterTimelineInput: FilterTimelineInput, - FilterMetaTimelineInput: FilterMetaTimelineInput, - SerializedFilterQueryInput: SerializedFilterQueryInput, - SerializedKueryQueryInput: SerializedKueryQueryInput, - KueryFilterQueryInput: KueryFilterQueryInput, - DateRangePickerInput: DateRangePickerInput, - SortTimelineInput: SortTimelineInput, - ResponseTimeline: ResolverTypeWrapper, - ResponseFavoriteTimeline: ResolverTypeWrapper, - EcsEdges: ResolverTypeWrapper, - EventsTimelineData: ResolverTypeWrapper, - FavoriteTimelineInput: FavoriteTimelineInput, - FlowDirection: FlowDirection, - HostFields: ResolverTypeWrapper, - OsFields: ResolverTypeWrapper, - NetworkDirectionEcs: NetworkDirectionEcs, - NetworkHttpFields: NetworkHttpFields, -}>; - -/** Mapping between all available schema types and the resolvers parents */ -export type ResolversParentTypes = ResolversObject<{ - Query: {}, - ID: Scalars['ID'], - NoteResult: NoteResult, - String: Scalars['String'], - Float: Scalars['Float'], - PageInfoNote: PageInfoNote, - SortNote: SortNote, - SortFieldNote: SortFieldNote, - Direction: Direction, - ResponseNotes: ResponseNotes, - PinnedEvent: PinnedEvent, - Source: Source, - SourceConfiguration: SourceConfiguration, - SourceFields: SourceFields, - SourceStatus: SourceStatus, - Boolean: Scalars['Boolean'], - IndexField: IndexField, - TimerangeInput: TimerangeInput, - PaginationInputPaginated: PaginationInputPaginated, - AuthenticationsData: AuthenticationsData, - AuthenticationsEdges: AuthenticationsEdges, - AuthenticationItem: AuthenticationItem, - UserEcsFields: UserEcsFields, - ToStringArray: Scalars['ToStringArray'], - LastSourceHost: LastSourceHost, - Date: Scalars['Date'], - SourceEcsFields: SourceEcsFields, - ToNumberArray: Scalars['ToNumberArray'], - GeoEcsFields: GeoEcsFields, - Location: Location, - HostEcsFields: HostEcsFields, - OsEcsFields: OsEcsFields, - CursorType: CursorType, - PageInfoPaginated: PageInfoPaginated, - Inspect: Inspect, - PaginationInput: PaginationInput, - SortField: SortField, - TimelineData: TimelineData, - TimelineEdges: TimelineEdges, - TimelineItem: TimelineItem, - TimelineNonEcsData: TimelineNonEcsData, - ECS: Ecs, - AuditdEcsFields: AuditdEcsFields, - AuditdData: AuditdData, - Summary: Summary, - PrimarySecondary: PrimarySecondary, - DestinationEcsFields: DestinationEcsFields, - DnsEcsFields: DnsEcsFields, - DnsQuestionData: DnsQuestionData, - EndgameEcsFields: EndgameEcsFields, - EventEcsFields: EventEcsFields, - ToDateArray: Scalars['ToDateArray'], - NetworkEcsField: NetworkEcsField, - RuleEcsField: RuleEcsField, - SignalField: SignalField, - RuleField: RuleField, - ToBooleanArray: Scalars['ToBooleanArray'], - ToAny: Scalars['ToAny'], - SuricataEcsFields: SuricataEcsFields, - SuricataEveData: SuricataEveData, - SuricataAlertData: SuricataAlertData, - TlsEcsFields: TlsEcsFields, - TlsClientCertificateData: TlsClientCertificateData, - FingerprintData: FingerprintData, - TlsFingerprintsData: TlsFingerprintsData, - TlsJa3Data: TlsJa3Data, - TlsServerCertificateData: TlsServerCertificateData, - ZeekEcsFields: ZeekEcsFields, - ZeekConnectionData: ZeekConnectionData, - ZeekNoticeData: ZeekNoticeData, - ZeekDnsData: ZeekDnsData, - ZeekHttpData: ZeekHttpData, - ZeekFileData: ZeekFileData, - ZeekSslData: ZeekSslData, - HttpEcsFields: HttpEcsFields, - HttpRequestData: HttpRequestData, - HttpBodyData: HttpBodyData, - HttpResponseData: HttpResponseData, - UrlEcsFields: UrlEcsFields, - WinlogEcsFields: WinlogEcsFields, - ProcessEcsFields: ProcessEcsFields, - ProcessHashData: ProcessHashData, - Thread: Thread, - FileFields: FileFields, - SystemEcsField: SystemEcsField, - AuditEcsFields: AuditEcsFields, - PackageEcsFields: PackageEcsFields, - AuthEcsFields: AuthEcsFields, - SshEcsFields: SshEcsFields, - PageInfo: PageInfo, - TimelineDetailsData: TimelineDetailsData, - DetailItem: DetailItem, - EsValue: Scalars['EsValue'], - LastEventIndexKey: LastEventIndexKey, - LastTimeDetails: LastTimeDetails, - LastEventTimeData: LastEventTimeData, - HostsSortField: HostsSortField, - HostsFields: HostsFields, - HostsData: HostsData, - HostsEdges: HostsEdges, - HostItem: HostItem, - CloudFields: CloudFields, - CloudInstance: CloudInstance, - CloudMachine: CloudMachine, - FirstLastSeenHost: FirstLastSeenHost, - IpOverviewData: IpOverviewData, - Overview: Overview, - AutonomousSystem: AutonomousSystem, - AutonomousSystemOrganization: AutonomousSystemOrganization, - UsersSortField: UsersSortField, - UsersFields: UsersFields, - FlowTarget: FlowTarget, - UsersData: UsersData, - UsersEdges: UsersEdges, - UsersNode: UsersNode, - UsersItem: UsersItem, - KpiNetworkData: KpiNetworkData, - KpiNetworkHistogramData: KpiNetworkHistogramData, - KpiHostsData: KpiHostsData, - KpiHostHistogramData: KpiHostHistogramData, - KpiHostDetailsData: KpiHostDetailsData, - HistogramType: HistogramType, - MatrixHistogramOverTimeData: MatrixHistogramOverTimeData, - MatrixOverTimeHistogramData: MatrixOverTimeHistogramData, - FlowTargetSourceDest: FlowTargetSourceDest, - NetworkTopTablesSortField: NetworkTopTablesSortField, - NetworkTopTablesFields: NetworkTopTablesFields, - NetworkTopCountriesData: NetworkTopCountriesData, - NetworkTopCountriesEdges: NetworkTopCountriesEdges, - NetworkTopCountriesItem: NetworkTopCountriesItem, - TopCountriesItemSource: TopCountriesItemSource, - GeoItem: GeoItem, - TopCountriesItemDestination: TopCountriesItemDestination, - TopNetworkTablesEcsField: TopNetworkTablesEcsField, - NetworkTopNFlowData: NetworkTopNFlowData, - NetworkTopNFlowEdges: NetworkTopNFlowEdges, - NetworkTopNFlowItem: NetworkTopNFlowItem, - TopNFlowItemSource: TopNFlowItemSource, - AutonomousSystemItem: AutonomousSystemItem, - TopNFlowItemDestination: TopNFlowItemDestination, - NetworkDnsSortField: NetworkDnsSortField, - NetworkDnsFields: NetworkDnsFields, - NetworkDnsData: NetworkDnsData, - NetworkDnsEdges: NetworkDnsEdges, - NetworkDnsItem: NetworkDnsItem, - MatrixOverOrdinalHistogramData: MatrixOverOrdinalHistogramData, - NetworkDsOverTimeData: NetworkDsOverTimeData, - NetworkHttpSortField: NetworkHttpSortField, - NetworkHttpData: NetworkHttpData, - NetworkHttpEdges: NetworkHttpEdges, - NetworkHttpItem: NetworkHttpItem, - OverviewNetworkData: OverviewNetworkData, - OverviewHostData: OverviewHostData, - TlsSortField: TlsSortField, - TlsFields: TlsFields, - TlsData: TlsData, - TlsEdges: TlsEdges, - TlsNode: TlsNode, - UncommonProcessesData: UncommonProcessesData, - UncommonProcessesEdges: UncommonProcessesEdges, - UncommonProcessItem: UncommonProcessItem, - SayMyName: SayMyName, - TimelineResult: TimelineResult, - ColumnHeaderResult: ColumnHeaderResult, - DataProviderResult: DataProviderResult, - QueryMatchResult: QueryMatchResult, - DateRangePickerResult: DateRangePickerResult, - FavoriteTimelineResult: FavoriteTimelineResult, - FilterTimelineResult: FilterTimelineResult, - FilterMetaTimelineResult: FilterMetaTimelineResult, - SerializedFilterQueryResult: SerializedFilterQueryResult, - SerializedKueryQueryResult: SerializedKueryQueryResult, - KueryFilterQueryResult: KueryFilterQueryResult, - SortTimelineResult: SortTimelineResult, - PageInfoTimeline: PageInfoTimeline, - SortTimeline: SortTimeline, - SortFieldTimeline: SortFieldTimeline, - ResponseTimelines: ResponseTimelines, - Mutation: {}, - NoteInput: NoteInput, - ResponseNote: ResponseNote, - TimelineInput: TimelineInput, - ColumnHeaderInput: ColumnHeaderInput, - DataProviderInput: DataProviderInput, - QueryMatchInput: QueryMatchInput, - FilterTimelineInput: FilterTimelineInput, - FilterMetaTimelineInput: FilterMetaTimelineInput, - SerializedFilterQueryInput: SerializedFilterQueryInput, - SerializedKueryQueryInput: SerializedKueryQueryInput, - KueryFilterQueryInput: KueryFilterQueryInput, - DateRangePickerInput: DateRangePickerInput, - SortTimelineInput: SortTimelineInput, - ResponseTimeline: ResponseTimeline, - ResponseFavoriteTimeline: ResponseFavoriteTimeline, - EcsEdges: EcsEdges, - EventsTimelineData: EventsTimelineData, - FavoriteTimelineInput: FavoriteTimelineInput, - FlowDirection: FlowDirection, - HostFields: HostFields, - OsFields: OsFields, - NetworkDirectionEcs: NetworkDirectionEcs, - NetworkHttpFields: NetworkHttpFields, -}>; - -export type AuditdDataResolvers = ResolversObject<{ - acct?: Resolver, ParentType, ContextType>, - terminal?: Resolver, ParentType, ContextType>, - op?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type AuditdEcsFieldsResolvers = ResolversObject<{ - result?: Resolver, ParentType, ContextType>, - session?: Resolver, ParentType, ContextType>, - data?: Resolver, ParentType, ContextType>, - summary?: Resolver, ParentType, ContextType>, - sequence?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type AuditEcsFieldsResolvers = ResolversObject<{ - package?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type AuthEcsFieldsResolvers = ResolversObject<{ - ssh?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type AuthenticationItemResolvers = ResolversObject<{ - _id?: Resolver, - failures?: Resolver, - successes?: Resolver, - user?: Resolver, - lastSuccess?: Resolver, ParentType, ContextType>, - lastFailure?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type AuthenticationsDataResolvers = ResolversObject<{ - edges?: Resolver, ParentType, ContextType>, - totalCount?: Resolver, - pageInfo?: Resolver, - inspect?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type AuthenticationsEdgesResolvers = ResolversObject<{ - node?: Resolver, - cursor?: Resolver, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type AutonomousSystemResolvers = ResolversObject<{ - number?: Resolver, ParentType, ContextType>, - organization?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type AutonomousSystemItemResolvers = ResolversObject<{ - name?: Resolver, ParentType, ContextType>, - number?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type AutonomousSystemOrganizationResolvers = ResolversObject<{ - name?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type CloudFieldsResolvers = ResolversObject<{ - instance?: Resolver, ParentType, ContextType>, - machine?: Resolver, ParentType, ContextType>, - provider?: Resolver>>, ParentType, ContextType>, - region?: Resolver>>, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type CloudInstanceResolvers = ResolversObject<{ - id?: Resolver>>, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type CloudMachineResolvers = ResolversObject<{ - type?: Resolver>>, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type ColumnHeaderResultResolvers = ResolversObject<{ - aggregatable?: Resolver, ParentType, ContextType>, - category?: Resolver, ParentType, ContextType>, - columnHeaderType?: Resolver, ParentType, ContextType>, - description?: Resolver, ParentType, ContextType>, - example?: Resolver, ParentType, ContextType>, - indexes?: Resolver>, ParentType, ContextType>, - id?: Resolver, ParentType, ContextType>, - name?: Resolver, ParentType, ContextType>, - placeholder?: Resolver, ParentType, ContextType>, - searchable?: Resolver, ParentType, ContextType>, - type?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type CursorTypeResolvers = ResolversObject<{ - value?: Resolver, ParentType, ContextType>, - tiebreaker?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type DataProviderResultResolvers = ResolversObject<{ - id?: Resolver, ParentType, ContextType>, - name?: Resolver, ParentType, ContextType>, - enabled?: Resolver, ParentType, ContextType>, - excluded?: Resolver, ParentType, ContextType>, - kqlQuery?: Resolver, ParentType, ContextType>, - queryMatch?: Resolver, ParentType, ContextType>, - and?: Resolver>, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export interface DateScalarConfig extends GraphQLScalarTypeConfig { - name: 'Date' -} - -export type DateRangePickerResultResolvers = ResolversObject<{ - start?: Resolver, ParentType, ContextType>, - end?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type DestinationEcsFieldsResolvers = ResolversObject<{ - bytes?: Resolver, ParentType, ContextType>, - ip?: Resolver, ParentType, ContextType>, - port?: Resolver, ParentType, ContextType>, - domain?: Resolver, ParentType, ContextType>, - geo?: Resolver, ParentType, ContextType>, - packets?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type DetailItemResolvers = ResolversObject<{ - field?: Resolver, - values?: Resolver, ParentType, ContextType>, - originalValue?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type DnsEcsFieldsResolvers = ResolversObject<{ - question?: Resolver, ParentType, ContextType>, - resolved_ip?: Resolver, ParentType, ContextType>, - response_code?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type DnsQuestionDataResolvers = ResolversObject<{ - name?: Resolver, ParentType, ContextType>, - type?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type EcsResolvers = ResolversObject<{ - _id?: Resolver, - _index?: Resolver, ParentType, ContextType>, - auditd?: Resolver, ParentType, ContextType>, - destination?: Resolver, ParentType, ContextType>, - dns?: Resolver, ParentType, ContextType>, - endgame?: Resolver, ParentType, ContextType>, - event?: Resolver, ParentType, ContextType>, - geo?: Resolver, ParentType, ContextType>, - host?: Resolver, ParentType, ContextType>, - network?: Resolver, ParentType, ContextType>, - rule?: Resolver, ParentType, ContextType>, - signal?: Resolver, ParentType, ContextType>, - source?: Resolver, ParentType, ContextType>, - suricata?: Resolver, ParentType, ContextType>, - tls?: Resolver, ParentType, ContextType>, - zeek?: Resolver, ParentType, ContextType>, - http?: Resolver, ParentType, ContextType>, - url?: Resolver, ParentType, ContextType>, - timestamp?: Resolver, ParentType, ContextType>, - message?: Resolver, ParentType, ContextType>, - user?: Resolver, ParentType, ContextType>, - winlog?: Resolver, ParentType, ContextType>, - process?: Resolver, ParentType, ContextType>, - file?: Resolver, ParentType, ContextType>, - system?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type EcsEdgesResolvers = ResolversObject<{ - node?: Resolver, - cursor?: Resolver, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type EndgameEcsFieldsResolvers = ResolversObject<{ - exit_code?: Resolver, ParentType, ContextType>, - file_name?: Resolver, ParentType, ContextType>, - file_path?: Resolver, ParentType, ContextType>, - logon_type?: Resolver, ParentType, ContextType>, - parent_process_name?: Resolver, ParentType, ContextType>, - pid?: Resolver, ParentType, ContextType>, - process_name?: Resolver, ParentType, ContextType>, - subject_domain_name?: Resolver, ParentType, ContextType>, - subject_logon_id?: Resolver, ParentType, ContextType>, - subject_user_name?: Resolver, ParentType, ContextType>, - target_domain_name?: Resolver, ParentType, ContextType>, - target_logon_id?: Resolver, ParentType, ContextType>, - target_user_name?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export interface EsValueScalarConfig extends GraphQLScalarTypeConfig { - name: 'EsValue' -} - -export type EventEcsFieldsResolvers = ResolversObject<{ - action?: Resolver, ParentType, ContextType>, - category?: Resolver, ParentType, ContextType>, - code?: Resolver, ParentType, ContextType>, - created?: Resolver, ParentType, ContextType>, - dataset?: Resolver, ParentType, ContextType>, - duration?: Resolver, ParentType, ContextType>, - end?: Resolver, ParentType, ContextType>, - hash?: Resolver, ParentType, ContextType>, - id?: Resolver, ParentType, ContextType>, - kind?: Resolver, ParentType, ContextType>, - module?: Resolver, ParentType, ContextType>, - original?: Resolver, ParentType, ContextType>, - outcome?: Resolver, ParentType, ContextType>, - risk_score?: Resolver, ParentType, ContextType>, - risk_score_norm?: Resolver, ParentType, ContextType>, - severity?: Resolver, ParentType, ContextType>, - start?: Resolver, ParentType, ContextType>, - timezone?: Resolver, ParentType, ContextType>, - type?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type EventsTimelineDataResolvers = ResolversObject<{ - edges?: Resolver, ParentType, ContextType>, - totalCount?: Resolver, - pageInfo?: Resolver, - inspect?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type FavoriteTimelineResultResolvers = ResolversObject<{ - fullName?: Resolver, ParentType, ContextType>, - userName?: Resolver, ParentType, ContextType>, - favoriteDate?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type FileFieldsResolvers = ResolversObject<{ - name?: Resolver, ParentType, ContextType>, - path?: Resolver, ParentType, ContextType>, - target_path?: Resolver, ParentType, ContextType>, - extension?: Resolver, ParentType, ContextType>, - type?: Resolver, ParentType, ContextType>, - device?: Resolver, ParentType, ContextType>, - inode?: Resolver, ParentType, ContextType>, - uid?: Resolver, ParentType, ContextType>, - owner?: Resolver, ParentType, ContextType>, - gid?: Resolver, ParentType, ContextType>, - group?: Resolver, ParentType, ContextType>, - mode?: Resolver, ParentType, ContextType>, - size?: Resolver, ParentType, ContextType>, - mtime?: Resolver, ParentType, ContextType>, - ctime?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type FilterMetaTimelineResultResolvers = ResolversObject<{ - alias?: Resolver, ParentType, ContextType>, - controlledBy?: Resolver, ParentType, ContextType>, - disabled?: Resolver, ParentType, ContextType>, - field?: Resolver, ParentType, ContextType>, - formattedValue?: Resolver, ParentType, ContextType>, - index?: Resolver, ParentType, ContextType>, - key?: Resolver, ParentType, ContextType>, - negate?: Resolver, ParentType, ContextType>, - params?: Resolver, ParentType, ContextType>, - type?: Resolver, ParentType, ContextType>, - value?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type FilterTimelineResultResolvers = ResolversObject<{ - exists?: Resolver, ParentType, ContextType>, - meta?: Resolver, ParentType, ContextType>, - match_all?: Resolver, ParentType, ContextType>, - missing?: Resolver, ParentType, ContextType>, - query?: Resolver, ParentType, ContextType>, - range?: Resolver, ParentType, ContextType>, - script?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type FingerprintDataResolvers = ResolversObject<{ - sha1?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type FirstLastSeenHostResolvers = ResolversObject<{ - inspect?: Resolver, ParentType, ContextType>, - firstSeen?: Resolver, ParentType, ContextType>, - lastSeen?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type GeoEcsFieldsResolvers = ResolversObject<{ - city_name?: Resolver, ParentType, ContextType>, - continent_name?: Resolver, ParentType, ContextType>, - country_iso_code?: Resolver, ParentType, ContextType>, - country_name?: Resolver, ParentType, ContextType>, - location?: Resolver, ParentType, ContextType>, - region_iso_code?: Resolver, ParentType, ContextType>, - region_name?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type GeoItemResolvers = ResolversObject<{ - geo?: Resolver, ParentType, ContextType>, - flowTarget?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type HostEcsFieldsResolvers = ResolversObject<{ - architecture?: Resolver, ParentType, ContextType>, - id?: Resolver, ParentType, ContextType>, - ip?: Resolver, ParentType, ContextType>, - mac?: Resolver, ParentType, ContextType>, - name?: Resolver, ParentType, ContextType>, - os?: Resolver, ParentType, ContextType>, - type?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type HostFieldsResolvers = ResolversObject<{ - architecture?: Resolver, ParentType, ContextType>, - id?: Resolver, ParentType, ContextType>, - ip?: Resolver>>, ParentType, ContextType>, - mac?: Resolver>>, ParentType, ContextType>, - name?: Resolver, ParentType, ContextType>, - os?: Resolver, ParentType, ContextType>, - type?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type HostItemResolvers = ResolversObject<{ - _id?: Resolver, ParentType, ContextType>, - lastSeen?: Resolver, ParentType, ContextType>, - host?: Resolver, ParentType, ContextType>, - cloud?: Resolver, ParentType, ContextType>, - inspect?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type HostsDataResolvers = ResolversObject<{ - edges?: Resolver, ParentType, ContextType>, - totalCount?: Resolver, - pageInfo?: Resolver, - inspect?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type HostsEdgesResolvers = ResolversObject<{ - node?: Resolver, - cursor?: Resolver, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type HttpBodyDataResolvers = ResolversObject<{ - content?: Resolver, ParentType, ContextType>, - bytes?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type HttpEcsFieldsResolvers = ResolversObject<{ - version?: Resolver, ParentType, ContextType>, - request?: Resolver, ParentType, ContextType>, - response?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type HttpRequestDataResolvers = ResolversObject<{ - method?: Resolver, ParentType, ContextType>, - body?: Resolver, ParentType, ContextType>, - referrer?: Resolver, ParentType, ContextType>, - bytes?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type HttpResponseDataResolvers = ResolversObject<{ - status_code?: Resolver, ParentType, ContextType>, - body?: Resolver, ParentType, ContextType>, - bytes?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type IndexFieldResolvers = ResolversObject<{ - category?: Resolver, - example?: Resolver, ParentType, ContextType>, - indexes?: Resolver>, ParentType, ContextType>, - name?: Resolver, - type?: Resolver, - searchable?: Resolver, - aggregatable?: Resolver, - description?: Resolver, ParentType, ContextType>, - format?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type InspectResolvers = ResolversObject<{ - dsl?: Resolver, ParentType, ContextType>, - response?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type IpOverviewDataResolvers = ResolversObject<{ - client?: Resolver, ParentType, ContextType>, - destination?: Resolver, ParentType, ContextType>, - host?: Resolver, - server?: Resolver, ParentType, ContextType>, - source?: Resolver, ParentType, ContextType>, - inspect?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type KpiHostDetailsDataResolvers = ResolversObject<{ - authSuccess?: Resolver, ParentType, ContextType>, - authSuccessHistogram?: Resolver>, ParentType, ContextType>, - authFailure?: Resolver, ParentType, ContextType>, - authFailureHistogram?: Resolver>, ParentType, ContextType>, - uniqueSourceIps?: Resolver, ParentType, ContextType>, - uniqueSourceIpsHistogram?: Resolver>, ParentType, ContextType>, - uniqueDestinationIps?: Resolver, ParentType, ContextType>, - uniqueDestinationIpsHistogram?: Resolver>, ParentType, ContextType>, - inspect?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type KpiHostHistogramDataResolvers = ResolversObject<{ - x?: Resolver, ParentType, ContextType>, - y?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type KpiHostsDataResolvers = ResolversObject<{ - hosts?: Resolver, ParentType, ContextType>, - hostsHistogram?: Resolver>, ParentType, ContextType>, - authSuccess?: Resolver, ParentType, ContextType>, - authSuccessHistogram?: Resolver>, ParentType, ContextType>, - authFailure?: Resolver, ParentType, ContextType>, - authFailureHistogram?: Resolver>, ParentType, ContextType>, - uniqueSourceIps?: Resolver, ParentType, ContextType>, - uniqueSourceIpsHistogram?: Resolver>, ParentType, ContextType>, - uniqueDestinationIps?: Resolver, ParentType, ContextType>, - uniqueDestinationIpsHistogram?: Resolver>, ParentType, ContextType>, - inspect?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type KpiNetworkDataResolvers = ResolversObject<{ - networkEvents?: Resolver, ParentType, ContextType>, - uniqueFlowId?: Resolver, ParentType, ContextType>, - uniqueSourcePrivateIps?: Resolver, ParentType, ContextType>, - uniqueSourcePrivateIpsHistogram?: Resolver>, ParentType, ContextType>, - uniqueDestinationPrivateIps?: Resolver, ParentType, ContextType>, - uniqueDestinationPrivateIpsHistogram?: Resolver>, ParentType, ContextType>, - dnsQueries?: Resolver, ParentType, ContextType>, - tlsHandshakes?: Resolver, ParentType, ContextType>, - inspect?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type KpiNetworkHistogramDataResolvers = ResolversObject<{ - x?: Resolver, ParentType, ContextType>, - y?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type KueryFilterQueryResultResolvers = ResolversObject<{ - kind?: Resolver, ParentType, ContextType>, - expression?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type LastEventTimeDataResolvers = ResolversObject<{ - lastSeen?: Resolver, ParentType, ContextType>, - inspect?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type LastSourceHostResolvers = ResolversObject<{ - timestamp?: Resolver, ParentType, ContextType>, - source?: Resolver, ParentType, ContextType>, - host?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type LocationResolvers = ResolversObject<{ - lon?: Resolver, ParentType, ContextType>, - lat?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type MatrixHistogramOverTimeDataResolvers = ResolversObject<{ - inspect?: Resolver, ParentType, ContextType>, - matrixHistogramData?: Resolver, ParentType, ContextType>, - totalCount?: Resolver, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type MatrixOverOrdinalHistogramDataResolvers = ResolversObject<{ - x?: Resolver, - y?: Resolver, - g?: Resolver, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type MatrixOverTimeHistogramDataResolvers = ResolversObject<{ - x?: Resolver, ParentType, ContextType>, - y?: Resolver, ParentType, ContextType>, - g?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type MutationResolvers = ResolversObject<{ - persistNote?: Resolver>, - deleteNote?: Resolver, ParentType, ContextType, RequireFields>, - deleteNoteByTimelineId?: Resolver, ParentType, ContextType, RequireFields>, - persistPinnedEventOnTimeline?: Resolver, ParentType, ContextType, RequireFields>, - deletePinnedEventOnTimeline?: Resolver>, - deleteAllPinnedEventsOnTimeline?: Resolver>, - persistTimeline?: Resolver>, - persistFavorite?: Resolver, - deleteTimeline?: Resolver>, -}>; - -export type NetworkDnsDataResolvers = ResolversObject<{ - edges?: Resolver, ParentType, ContextType>, - totalCount?: Resolver, - pageInfo?: Resolver, - inspect?: Resolver, ParentType, ContextType>, - histogram?: Resolver>, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type NetworkDnsEdgesResolvers = ResolversObject<{ - node?: Resolver, - cursor?: Resolver, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type NetworkDnsItemResolvers = ResolversObject<{ - _id?: Resolver, ParentType, ContextType>, - dnsBytesIn?: Resolver, ParentType, ContextType>, - dnsBytesOut?: Resolver, ParentType, ContextType>, - dnsName?: Resolver, ParentType, ContextType>, - queryCount?: Resolver, ParentType, ContextType>, - uniqueDomains?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type NetworkDsOverTimeDataResolvers = ResolversObject<{ - inspect?: Resolver, ParentType, ContextType>, - matrixHistogramData?: Resolver, ParentType, ContextType>, - totalCount?: Resolver, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type NetworkEcsFieldResolvers = ResolversObject<{ - bytes?: Resolver, ParentType, ContextType>, - community_id?: Resolver, ParentType, ContextType>, - direction?: Resolver, ParentType, ContextType>, - packets?: Resolver, ParentType, ContextType>, - protocol?: Resolver, ParentType, ContextType>, - transport?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type NetworkHttpDataResolvers = ResolversObject<{ - edges?: Resolver, ParentType, ContextType>, - totalCount?: Resolver, - pageInfo?: Resolver, - inspect?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type NetworkHttpEdgesResolvers = ResolversObject<{ - node?: Resolver, - cursor?: Resolver, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type NetworkHttpItemResolvers = ResolversObject<{ - _id?: Resolver, ParentType, ContextType>, - domains?: Resolver, ParentType, ContextType>, - lastHost?: Resolver, ParentType, ContextType>, - lastSourceIp?: Resolver, ParentType, ContextType>, - methods?: Resolver, ParentType, ContextType>, - path?: Resolver, ParentType, ContextType>, - requestCount?: Resolver, ParentType, ContextType>, - statuses?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type NetworkTopCountriesDataResolvers = ResolversObject<{ - edges?: Resolver, ParentType, ContextType>, - totalCount?: Resolver, - pageInfo?: Resolver, - inspect?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type NetworkTopCountriesEdgesResolvers = ResolversObject<{ - node?: Resolver, - cursor?: Resolver, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type NetworkTopCountriesItemResolvers = ResolversObject<{ - _id?: Resolver, ParentType, ContextType>, - source?: Resolver, ParentType, ContextType>, - destination?: Resolver, ParentType, ContextType>, - network?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type NetworkTopNFlowDataResolvers = ResolversObject<{ - edges?: Resolver, ParentType, ContextType>, - totalCount?: Resolver, - pageInfo?: Resolver, - inspect?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type NetworkTopNFlowEdgesResolvers = ResolversObject<{ - node?: Resolver, - cursor?: Resolver, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type NetworkTopNFlowItemResolvers = ResolversObject<{ - _id?: Resolver, ParentType, ContextType>, - source?: Resolver, ParentType, ContextType>, - destination?: Resolver, ParentType, ContextType>, - network?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type NoteResultResolvers = ResolversObject<{ - eventId?: Resolver, ParentType, ContextType>, - note?: Resolver, ParentType, ContextType>, - timelineId?: Resolver, ParentType, ContextType>, - noteId?: Resolver, - created?: Resolver, ParentType, ContextType>, - createdBy?: Resolver, ParentType, ContextType>, - timelineVersion?: Resolver, ParentType, ContextType>, - updated?: Resolver, ParentType, ContextType>, - updatedBy?: Resolver, ParentType, ContextType>, - version?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type OsEcsFieldsResolvers = ResolversObject<{ - platform?: Resolver, ParentType, ContextType>, - name?: Resolver, ParentType, ContextType>, - full?: Resolver, ParentType, ContextType>, - family?: Resolver, ParentType, ContextType>, - version?: Resolver, ParentType, ContextType>, - kernel?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type OsFieldsResolvers = ResolversObject<{ - platform?: Resolver, ParentType, ContextType>, - name?: Resolver, ParentType, ContextType>, - full?: Resolver, ParentType, ContextType>, - family?: Resolver, ParentType, ContextType>, - version?: Resolver, ParentType, ContextType>, - kernel?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type OverviewResolvers = ResolversObject<{ - firstSeen?: Resolver, ParentType, ContextType>, - lastSeen?: Resolver, ParentType, ContextType>, - autonomousSystem?: Resolver, - geo?: Resolver, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type OverviewHostDataResolvers = ResolversObject<{ - auditbeatAuditd?: Resolver, ParentType, ContextType>, - auditbeatFIM?: Resolver, ParentType, ContextType>, - auditbeatLogin?: Resolver, ParentType, ContextType>, - auditbeatPackage?: Resolver, ParentType, ContextType>, - auditbeatProcess?: Resolver, ParentType, ContextType>, - auditbeatUser?: Resolver, ParentType, ContextType>, - endgameDns?: Resolver, ParentType, ContextType>, - endgameFile?: Resolver, ParentType, ContextType>, - endgameImageLoad?: Resolver, ParentType, ContextType>, - endgameNetwork?: Resolver, ParentType, ContextType>, - endgameProcess?: Resolver, ParentType, ContextType>, - endgameRegistry?: Resolver, ParentType, ContextType>, - endgameSecurity?: Resolver, ParentType, ContextType>, - filebeatSystemModule?: Resolver, ParentType, ContextType>, - winlogbeatSecurity?: Resolver, ParentType, ContextType>, - winlogbeatMWSysmonOperational?: Resolver, ParentType, ContextType>, - inspect?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type OverviewNetworkDataResolvers = ResolversObject<{ - auditbeatSocket?: Resolver, ParentType, ContextType>, - filebeatCisco?: Resolver, ParentType, ContextType>, - filebeatNetflow?: Resolver, ParentType, ContextType>, - filebeatPanw?: Resolver, ParentType, ContextType>, - filebeatSuricata?: Resolver, ParentType, ContextType>, - filebeatZeek?: Resolver, ParentType, ContextType>, - packetbeatDNS?: Resolver, ParentType, ContextType>, - packetbeatFlow?: Resolver, ParentType, ContextType>, - packetbeatTLS?: Resolver, ParentType, ContextType>, - inspect?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type PackageEcsFieldsResolvers = ResolversObject<{ - arch?: Resolver, ParentType, ContextType>, - entity_id?: Resolver, ParentType, ContextType>, - name?: Resolver, ParentType, ContextType>, - size?: Resolver, ParentType, ContextType>, - summary?: Resolver, ParentType, ContextType>, - version?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type PageInfoResolvers = ResolversObject<{ - endCursor?: Resolver, ParentType, ContextType>, - hasNextPage?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type PageInfoPaginatedResolvers = ResolversObject<{ - activePage?: Resolver, - fakeTotalCount?: Resolver, - showMorePagesIndicator?: Resolver, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type PinnedEventResolvers = ResolversObject<{ - code?: Resolver, ParentType, ContextType>, - message?: Resolver, ParentType, ContextType>, - pinnedEventId?: Resolver, - eventId?: Resolver, ParentType, ContextType>, - timelineId?: Resolver, ParentType, ContextType>, - timelineVersion?: Resolver, ParentType, ContextType>, - created?: Resolver, ParentType, ContextType>, - createdBy?: Resolver, ParentType, ContextType>, - updated?: Resolver, ParentType, ContextType>, - updatedBy?: Resolver, ParentType, ContextType>, - version?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type PrimarySecondaryResolvers = ResolversObject<{ - primary?: Resolver, ParentType, ContextType>, - secondary?: Resolver, ParentType, ContextType>, - type?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type ProcessEcsFieldsResolvers = ResolversObject<{ - hash?: Resolver, ParentType, ContextType>, - pid?: Resolver, ParentType, ContextType>, - name?: Resolver, ParentType, ContextType>, - ppid?: Resolver, ParentType, ContextType>, - args?: Resolver, ParentType, ContextType>, - executable?: Resolver, ParentType, ContextType>, - title?: Resolver, ParentType, ContextType>, - thread?: Resolver, ParentType, ContextType>, - working_directory?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type ProcessHashDataResolvers = ResolversObject<{ - md5?: Resolver, ParentType, ContextType>, - sha1?: Resolver, ParentType, ContextType>, - sha256?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type QueryResolvers = ResolversObject<{ - getNote?: Resolver>, - getNotesByTimelineId?: Resolver, ParentType, ContextType, RequireFields>, - getNotesByEventId?: Resolver, ParentType, ContextType, RequireFields>, - getAllNotes?: Resolver, - getAllPinnedEventsByTimelineId?: Resolver, ParentType, ContextType, RequireFields>, - source?: Resolver>, - allSources?: Resolver, ParentType, ContextType>, - getOneTimeline?: Resolver>, - getAllTimeline?: Resolver, -}>; - -export type QueryMatchResultResolvers = ResolversObject<{ - field?: Resolver, ParentType, ContextType>, - displayField?: Resolver, ParentType, ContextType>, - value?: Resolver, ParentType, ContextType>, - displayValue?: Resolver, ParentType, ContextType>, - operator?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type ResponseFavoriteTimelineResolvers = ResolversObject<{ - code?: Resolver, ParentType, ContextType>, - message?: Resolver, ParentType, ContextType>, - savedObjectId?: Resolver, - version?: Resolver, - favorite?: Resolver>, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type ResponseNoteResolvers = ResolversObject<{ - code?: Resolver, ParentType, ContextType>, - message?: Resolver, ParentType, ContextType>, - note?: Resolver, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type ResponseNotesResolvers = ResolversObject<{ - notes?: Resolver, ParentType, ContextType>, - totalCount?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type ResponseTimelineResolvers = ResolversObject<{ - code?: Resolver, ParentType, ContextType>, - message?: Resolver, ParentType, ContextType>, - timeline?: Resolver, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type ResponseTimelinesResolvers = ResolversObject<{ - timeline?: Resolver>, ParentType, ContextType>, - totalCount?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type RuleEcsFieldResolvers = ResolversObject<{ - reference?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type RuleFieldResolvers = ResolversObject<{ - id?: Resolver, ParentType, ContextType>, - rule_id?: Resolver, ParentType, ContextType>, - false_positives?: Resolver, ParentType, ContextType>, - saved_id?: Resolver, ParentType, ContextType>, - timeline_id?: Resolver, ParentType, ContextType>, - timeline_title?: Resolver, ParentType, ContextType>, - max_signals?: Resolver, ParentType, ContextType>, - risk_score?: Resolver, ParentType, ContextType>, - output_index?: Resolver, ParentType, ContextType>, - description?: Resolver, ParentType, ContextType>, - from?: Resolver, ParentType, ContextType>, - immutable?: Resolver, ParentType, ContextType>, - index?: Resolver, ParentType, ContextType>, - interval?: Resolver, ParentType, ContextType>, - language?: Resolver, ParentType, ContextType>, - query?: Resolver, ParentType, ContextType>, - references?: Resolver, ParentType, ContextType>, - severity?: Resolver, ParentType, ContextType>, - tags?: Resolver, ParentType, ContextType>, - threat?: Resolver, ParentType, ContextType>, - type?: Resolver, ParentType, ContextType>, - size?: Resolver, ParentType, ContextType>, - to?: Resolver, ParentType, ContextType>, - enabled?: Resolver, ParentType, ContextType>, - filters?: Resolver, ParentType, ContextType>, - created_at?: Resolver, ParentType, ContextType>, - updated_at?: Resolver, ParentType, ContextType>, - created_by?: Resolver, ParentType, ContextType>, - updated_by?: Resolver, ParentType, ContextType>, - version?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type SayMyNameResolvers = ResolversObject<{ - appName?: Resolver, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type SerializedFilterQueryResultResolvers = ResolversObject<{ - filterQuery?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type SerializedKueryQueryResultResolvers = ResolversObject<{ - kuery?: Resolver, ParentType, ContextType>, - serializedQuery?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type SignalFieldResolvers = ResolversObject<{ - rule?: Resolver, ParentType, ContextType>, - original_time?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type SortTimelineResultResolvers = ResolversObject<{ - columnId?: Resolver, ParentType, ContextType>, - sortDirection?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type SourceResolvers = ResolversObject<{ - id?: Resolver, - configuration?: Resolver, - status?: Resolver, - Authentications?: Resolver>, - Timeline?: Resolver>, - TimelineDetails?: Resolver>, - LastEventTime?: Resolver>, - Hosts?: Resolver>, - HostOverview?: Resolver>, - HostFirstLastSeen?: Resolver>, - IpOverview?: Resolver, ParentType, ContextType, RequireFields>, - Users?: Resolver>, - KpiNetwork?: Resolver, ParentType, ContextType, RequireFields>, - KpiHosts?: Resolver>, - KpiHostDetails?: Resolver>, - MatrixHistogram?: Resolver>, - NetworkTopCountries?: Resolver>, - NetworkTopNFlow?: Resolver>, - NetworkDns?: Resolver>, - NetworkDnsHistogram?: Resolver>, - NetworkHttp?: Resolver>, - OverviewNetwork?: Resolver, ParentType, ContextType, RequireFields>, - OverviewHost?: Resolver, ParentType, ContextType, RequireFields>, - Tls?: Resolver>, - UncommonProcesses?: Resolver>, - whoAmI?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type SourceConfigurationResolvers = ResolversObject<{ - fields?: Resolver, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type SourceEcsFieldsResolvers = ResolversObject<{ - bytes?: Resolver, ParentType, ContextType>, - ip?: Resolver, ParentType, ContextType>, - port?: Resolver, ParentType, ContextType>, - domain?: Resolver, ParentType, ContextType>, - geo?: Resolver, ParentType, ContextType>, - packets?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type SourceFieldsResolvers = ResolversObject<{ - container?: Resolver, - host?: Resolver, - message?: Resolver, ParentType, ContextType>, - pod?: Resolver, - tiebreaker?: Resolver, - timestamp?: Resolver, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type SourceStatusResolvers = ResolversObject<{ - indicesExist?: Resolver>, - indexFields?: Resolver, ParentType, ContextType, RequireFields>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type SshEcsFieldsResolvers = ResolversObject<{ - method?: Resolver, ParentType, ContextType>, - signature?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type SummaryResolvers = ResolversObject<{ - actor?: Resolver, ParentType, ContextType>, - object?: Resolver, ParentType, ContextType>, - how?: Resolver, ParentType, ContextType>, - message_type?: Resolver, ParentType, ContextType>, - sequence?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type SuricataAlertDataResolvers = ResolversObject<{ - signature?: Resolver, ParentType, ContextType>, - signature_id?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type SuricataEcsFieldsResolvers = ResolversObject<{ - eve?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type SuricataEveDataResolvers = ResolversObject<{ - alert?: Resolver, ParentType, ContextType>, - flow_id?: Resolver, ParentType, ContextType>, - proto?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type SystemEcsFieldResolvers = ResolversObject<{ - audit?: Resolver, ParentType, ContextType>, - auth?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type ThreadResolvers = ResolversObject<{ - id?: Resolver, ParentType, ContextType>, - start?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type TimelineDataResolvers = ResolversObject<{ - edges?: Resolver, ParentType, ContextType>, - totalCount?: Resolver, - pageInfo?: Resolver, - inspect?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type TimelineDetailsDataResolvers = ResolversObject<{ - data?: Resolver>, ParentType, ContextType>, - inspect?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type TimelineEdgesResolvers = ResolversObject<{ - node?: Resolver, - cursor?: Resolver, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type TimelineItemResolvers = ResolversObject<{ - _id?: Resolver, - _index?: Resolver, ParentType, ContextType>, - data?: Resolver, ParentType, ContextType>, - ecs?: Resolver, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type TimelineNonEcsDataResolvers = ResolversObject<{ - field?: Resolver, - value?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type TimelineResultResolvers = ResolversObject<{ - columns?: Resolver>, ParentType, ContextType>, - created?: Resolver, ParentType, ContextType>, - createdBy?: Resolver, ParentType, ContextType>, - dataProviders?: Resolver>, ParentType, ContextType>, - dateRange?: Resolver, ParentType, ContextType>, - description?: Resolver, ParentType, ContextType>, - eventIdToNoteIds?: Resolver>, ParentType, ContextType>, - eventType?: Resolver, ParentType, ContextType>, - favorite?: Resolver>, ParentType, ContextType>, - filters?: Resolver>, ParentType, ContextType>, - kqlMode?: Resolver, ParentType, ContextType>, - kqlQuery?: Resolver, ParentType, ContextType>, - notes?: Resolver>, ParentType, ContextType>, - noteIds?: Resolver>, ParentType, ContextType>, - pinnedEventIds?: Resolver>, ParentType, ContextType>, - pinnedEventsSaveObject?: Resolver>, ParentType, ContextType>, - savedQueryId?: Resolver, ParentType, ContextType>, - savedObjectId?: Resolver, - sort?: Resolver, ParentType, ContextType>, - title?: Resolver, ParentType, ContextType>, - updated?: Resolver, ParentType, ContextType>, - updatedBy?: Resolver, ParentType, ContextType>, - version?: Resolver, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type TlsClientCertificateDataResolvers = ResolversObject<{ - fingerprint?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type TlsDataResolvers = ResolversObject<{ - edges?: Resolver, ParentType, ContextType>, - totalCount?: Resolver, - pageInfo?: Resolver, - inspect?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type TlsEcsFieldsResolvers = ResolversObject<{ - client_certificate?: Resolver, ParentType, ContextType>, - fingerprints?: Resolver, ParentType, ContextType>, - server_certificate?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type TlsEdgesResolvers = ResolversObject<{ - node?: Resolver, - cursor?: Resolver, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type TlsFingerprintsDataResolvers = ResolversObject<{ - ja3?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type TlsJa3DataResolvers = ResolversObject<{ - hash?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type TlsNodeResolvers = ResolversObject<{ - _id?: Resolver, ParentType, ContextType>, - timestamp?: Resolver, ParentType, ContextType>, - alternativeNames?: Resolver>, ParentType, ContextType>, - notAfter?: Resolver>, ParentType, ContextType>, - commonNames?: Resolver>, ParentType, ContextType>, - ja3?: Resolver>, ParentType, ContextType>, - issuerNames?: Resolver>, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type TlsServerCertificateDataResolvers = ResolversObject<{ - fingerprint?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export interface ToAnyScalarConfig extends GraphQLScalarTypeConfig { - name: 'ToAny' -} - -export interface ToBooleanArrayScalarConfig extends GraphQLScalarTypeConfig { - name: 'ToBooleanArray' -} - -export interface ToDateArrayScalarConfig extends GraphQLScalarTypeConfig { - name: 'ToDateArray' -} - -export interface ToNumberArrayScalarConfig extends GraphQLScalarTypeConfig { - name: 'ToNumberArray' -} - -export type TopCountriesItemDestinationResolvers = ResolversObject<{ - country?: Resolver, ParentType, ContextType>, - destination_ips?: Resolver, ParentType, ContextType>, - flows?: Resolver, ParentType, ContextType>, - location?: Resolver, ParentType, ContextType>, - source_ips?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type TopCountriesItemSourceResolvers = ResolversObject<{ - country?: Resolver, ParentType, ContextType>, - destination_ips?: Resolver, ParentType, ContextType>, - flows?: Resolver, ParentType, ContextType>, - location?: Resolver, ParentType, ContextType>, - source_ips?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type TopNetworkTablesEcsFieldResolvers = ResolversObject<{ - bytes_in?: Resolver, ParentType, ContextType>, - bytes_out?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type TopNFlowItemDestinationResolvers = ResolversObject<{ - autonomous_system?: Resolver, ParentType, ContextType>, - domain?: Resolver>, ParentType, ContextType>, - ip?: Resolver, ParentType, ContextType>, - location?: Resolver, ParentType, ContextType>, - flows?: Resolver, ParentType, ContextType>, - source_ips?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type TopNFlowItemSourceResolvers = ResolversObject<{ - autonomous_system?: Resolver, ParentType, ContextType>, - domain?: Resolver>, ParentType, ContextType>, - ip?: Resolver, ParentType, ContextType>, - location?: Resolver, ParentType, ContextType>, - flows?: Resolver, ParentType, ContextType>, - destination_ips?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export interface ToStringArrayScalarConfig extends GraphQLScalarTypeConfig { - name: 'ToStringArray' -} - -export type UncommonProcessesDataResolvers = ResolversObject<{ - edges?: Resolver, ParentType, ContextType>, - totalCount?: Resolver, - pageInfo?: Resolver, - inspect?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type UncommonProcessesEdgesResolvers = ResolversObject<{ - node?: Resolver, - cursor?: Resolver, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type UncommonProcessItemResolvers = ResolversObject<{ - _id?: Resolver, - instances?: Resolver, - process?: Resolver, - hosts?: Resolver, ParentType, ContextType>, - user?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type UrlEcsFieldsResolvers = ResolversObject<{ - domain?: Resolver, ParentType, ContextType>, - original?: Resolver, ParentType, ContextType>, - username?: Resolver, ParentType, ContextType>, - password?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type UserEcsFieldsResolvers = ResolversObject<{ - domain?: Resolver, ParentType, ContextType>, - id?: Resolver, ParentType, ContextType>, - name?: Resolver, ParentType, ContextType>, - full_name?: Resolver, ParentType, ContextType>, - email?: Resolver, ParentType, ContextType>, - hash?: Resolver, ParentType, ContextType>, - group?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type UsersDataResolvers = ResolversObject<{ - edges?: Resolver, ParentType, ContextType>, - totalCount?: Resolver, - pageInfo?: Resolver, - inspect?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type UsersEdgesResolvers = ResolversObject<{ - node?: Resolver, - cursor?: Resolver, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type UsersItemResolvers = ResolversObject<{ - name?: Resolver, ParentType, ContextType>, - id?: Resolver, ParentType, ContextType>, - groupId?: Resolver, ParentType, ContextType>, - groupName?: Resolver, ParentType, ContextType>, - count?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type UsersNodeResolvers = ResolversObject<{ - _id?: Resolver, ParentType, ContextType>, - timestamp?: Resolver, ParentType, ContextType>, - user?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type WinlogEcsFieldsResolvers = ResolversObject<{ - event_id?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type ZeekConnectionDataResolvers = ResolversObject<{ - local_resp?: Resolver, ParentType, ContextType>, - local_orig?: Resolver, ParentType, ContextType>, - missed_bytes?: Resolver, ParentType, ContextType>, - state?: Resolver, ParentType, ContextType>, - history?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type ZeekDnsDataResolvers = ResolversObject<{ - AA?: Resolver, ParentType, ContextType>, - qclass_name?: Resolver, ParentType, ContextType>, - RD?: Resolver, ParentType, ContextType>, - qtype_name?: Resolver, ParentType, ContextType>, - rejected?: Resolver, ParentType, ContextType>, - qtype?: Resolver, ParentType, ContextType>, - query?: Resolver, ParentType, ContextType>, - trans_id?: Resolver, ParentType, ContextType>, - qclass?: Resolver, ParentType, ContextType>, - RA?: Resolver, ParentType, ContextType>, - TC?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type ZeekEcsFieldsResolvers = ResolversObject<{ - session_id?: Resolver, ParentType, ContextType>, - connection?: Resolver, ParentType, ContextType>, - notice?: Resolver, ParentType, ContextType>, - dns?: Resolver, ParentType, ContextType>, - http?: Resolver, ParentType, ContextType>, - files?: Resolver, ParentType, ContextType>, - ssl?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type ZeekFileDataResolvers = ResolversObject<{ - session_ids?: Resolver, ParentType, ContextType>, - timedout?: Resolver, ParentType, ContextType>, - local_orig?: Resolver, ParentType, ContextType>, - tx_host?: Resolver, ParentType, ContextType>, - source?: Resolver, ParentType, ContextType>, - is_orig?: Resolver, ParentType, ContextType>, - overflow_bytes?: Resolver, ParentType, ContextType>, - sha1?: Resolver, ParentType, ContextType>, - duration?: Resolver, ParentType, ContextType>, - depth?: Resolver, ParentType, ContextType>, - analyzers?: Resolver, ParentType, ContextType>, - mime_type?: Resolver, ParentType, ContextType>, - rx_host?: Resolver, ParentType, ContextType>, - total_bytes?: Resolver, ParentType, ContextType>, - fuid?: Resolver, ParentType, ContextType>, - seen_bytes?: Resolver, ParentType, ContextType>, - missing_bytes?: Resolver, ParentType, ContextType>, - md5?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type ZeekHttpDataResolvers = ResolversObject<{ - resp_mime_types?: Resolver, ParentType, ContextType>, - trans_depth?: Resolver, ParentType, ContextType>, - status_msg?: Resolver, ParentType, ContextType>, - resp_fuids?: Resolver, ParentType, ContextType>, - tags?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type ZeekNoticeDataResolvers = ResolversObject<{ - suppress_for?: Resolver, ParentType, ContextType>, - msg?: Resolver, ParentType, ContextType>, - note?: Resolver, ParentType, ContextType>, - sub?: Resolver, ParentType, ContextType>, - dst?: Resolver, ParentType, ContextType>, - dropped?: Resolver, ParentType, ContextType>, - peer_descr?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type ZeekSslDataResolvers = ResolversObject<{ - cipher?: Resolver, ParentType, ContextType>, - established?: Resolver, ParentType, ContextType>, - resumed?: Resolver, ParentType, ContextType>, - version?: Resolver, ParentType, ContextType>, - __isTypeOf?: isTypeOfResolverFn, -}>; - -export type Resolvers = ResolversObject<{ - AuditdData?: AuditdDataResolvers, - AuditdEcsFields?: AuditdEcsFieldsResolvers, - AuditEcsFields?: AuditEcsFieldsResolvers, - AuthEcsFields?: AuthEcsFieldsResolvers, - AuthenticationItem?: AuthenticationItemResolvers, - AuthenticationsData?: AuthenticationsDataResolvers, - AuthenticationsEdges?: AuthenticationsEdgesResolvers, - AutonomousSystem?: AutonomousSystemResolvers, - AutonomousSystemItem?: AutonomousSystemItemResolvers, - AutonomousSystemOrganization?: AutonomousSystemOrganizationResolvers, - CloudFields?: CloudFieldsResolvers, - CloudInstance?: CloudInstanceResolvers, - CloudMachine?: CloudMachineResolvers, - ColumnHeaderResult?: ColumnHeaderResultResolvers, - CursorType?: CursorTypeResolvers, - DataProviderResult?: DataProviderResultResolvers, - Date?: GraphQLScalarType, - DateRangePickerResult?: DateRangePickerResultResolvers, - DestinationEcsFields?: DestinationEcsFieldsResolvers, - DetailItem?: DetailItemResolvers, - DnsEcsFields?: DnsEcsFieldsResolvers, - DnsQuestionData?: DnsQuestionDataResolvers, - ECS?: EcsResolvers, - EcsEdges?: EcsEdgesResolvers, - EndgameEcsFields?: EndgameEcsFieldsResolvers, - EsValue?: GraphQLScalarType, - EventEcsFields?: EventEcsFieldsResolvers, - EventsTimelineData?: EventsTimelineDataResolvers, - FavoriteTimelineResult?: FavoriteTimelineResultResolvers, - FileFields?: FileFieldsResolvers, - FilterMetaTimelineResult?: FilterMetaTimelineResultResolvers, - FilterTimelineResult?: FilterTimelineResultResolvers, - FingerprintData?: FingerprintDataResolvers, - FirstLastSeenHost?: FirstLastSeenHostResolvers, - GeoEcsFields?: GeoEcsFieldsResolvers, - GeoItem?: GeoItemResolvers, - HostEcsFields?: HostEcsFieldsResolvers, - HostFields?: HostFieldsResolvers, - HostItem?: HostItemResolvers, - HostsData?: HostsDataResolvers, - HostsEdges?: HostsEdgesResolvers, - HttpBodyData?: HttpBodyDataResolvers, - HttpEcsFields?: HttpEcsFieldsResolvers, - HttpRequestData?: HttpRequestDataResolvers, - HttpResponseData?: HttpResponseDataResolvers, - IndexField?: IndexFieldResolvers, - Inspect?: InspectResolvers, - IpOverviewData?: IpOverviewDataResolvers, - KpiHostDetailsData?: KpiHostDetailsDataResolvers, - KpiHostHistogramData?: KpiHostHistogramDataResolvers, - KpiHostsData?: KpiHostsDataResolvers, - KpiNetworkData?: KpiNetworkDataResolvers, - KpiNetworkHistogramData?: KpiNetworkHistogramDataResolvers, - KueryFilterQueryResult?: KueryFilterQueryResultResolvers, - LastEventTimeData?: LastEventTimeDataResolvers, - LastSourceHost?: LastSourceHostResolvers, - Location?: LocationResolvers, - MatrixHistogramOverTimeData?: MatrixHistogramOverTimeDataResolvers, - MatrixOverOrdinalHistogramData?: MatrixOverOrdinalHistogramDataResolvers, - MatrixOverTimeHistogramData?: MatrixOverTimeHistogramDataResolvers, - Mutation?: MutationResolvers, - NetworkDnsData?: NetworkDnsDataResolvers, - NetworkDnsEdges?: NetworkDnsEdgesResolvers, - NetworkDnsItem?: NetworkDnsItemResolvers, - NetworkDsOverTimeData?: NetworkDsOverTimeDataResolvers, - NetworkEcsField?: NetworkEcsFieldResolvers, - NetworkHttpData?: NetworkHttpDataResolvers, - NetworkHttpEdges?: NetworkHttpEdgesResolvers, - NetworkHttpItem?: NetworkHttpItemResolvers, - NetworkTopCountriesData?: NetworkTopCountriesDataResolvers, - NetworkTopCountriesEdges?: NetworkTopCountriesEdgesResolvers, - NetworkTopCountriesItem?: NetworkTopCountriesItemResolvers, - NetworkTopNFlowData?: NetworkTopNFlowDataResolvers, - NetworkTopNFlowEdges?: NetworkTopNFlowEdgesResolvers, - NetworkTopNFlowItem?: NetworkTopNFlowItemResolvers, - NoteResult?: NoteResultResolvers, - OsEcsFields?: OsEcsFieldsResolvers, - OsFields?: OsFieldsResolvers, - Overview?: OverviewResolvers, - OverviewHostData?: OverviewHostDataResolvers, - OverviewNetworkData?: OverviewNetworkDataResolvers, - PackageEcsFields?: PackageEcsFieldsResolvers, - PageInfo?: PageInfoResolvers, - PageInfoPaginated?: PageInfoPaginatedResolvers, - PinnedEvent?: PinnedEventResolvers, - PrimarySecondary?: PrimarySecondaryResolvers, - ProcessEcsFields?: ProcessEcsFieldsResolvers, - ProcessHashData?: ProcessHashDataResolvers, - Query?: QueryResolvers, - QueryMatchResult?: QueryMatchResultResolvers, - ResponseFavoriteTimeline?: ResponseFavoriteTimelineResolvers, - ResponseNote?: ResponseNoteResolvers, - ResponseNotes?: ResponseNotesResolvers, - ResponseTimeline?: ResponseTimelineResolvers, - ResponseTimelines?: ResponseTimelinesResolvers, - RuleEcsField?: RuleEcsFieldResolvers, - RuleField?: RuleFieldResolvers, - SayMyName?: SayMyNameResolvers, - SerializedFilterQueryResult?: SerializedFilterQueryResultResolvers, - SerializedKueryQueryResult?: SerializedKueryQueryResultResolvers, - SignalField?: SignalFieldResolvers, - SortTimelineResult?: SortTimelineResultResolvers, - Source?: SourceResolvers, - SourceConfiguration?: SourceConfigurationResolvers, - SourceEcsFields?: SourceEcsFieldsResolvers, - SourceFields?: SourceFieldsResolvers, - SourceStatus?: SourceStatusResolvers, - SshEcsFields?: SshEcsFieldsResolvers, - Summary?: SummaryResolvers, - SuricataAlertData?: SuricataAlertDataResolvers, - SuricataEcsFields?: SuricataEcsFieldsResolvers, - SuricataEveData?: SuricataEveDataResolvers, - SystemEcsField?: SystemEcsFieldResolvers, - Thread?: ThreadResolvers, - TimelineData?: TimelineDataResolvers, - TimelineDetailsData?: TimelineDetailsDataResolvers, - TimelineEdges?: TimelineEdgesResolvers, - TimelineItem?: TimelineItemResolvers, - TimelineNonEcsData?: TimelineNonEcsDataResolvers, - TimelineResult?: TimelineResultResolvers, - TlsClientCertificateData?: TlsClientCertificateDataResolvers, - TlsData?: TlsDataResolvers, - TlsEcsFields?: TlsEcsFieldsResolvers, - TlsEdges?: TlsEdgesResolvers, - TlsFingerprintsData?: TlsFingerprintsDataResolvers, - TlsJa3Data?: TlsJa3DataResolvers, - TlsNode?: TlsNodeResolvers, - TlsServerCertificateData?: TlsServerCertificateDataResolvers, - ToAny?: GraphQLScalarType, - ToBooleanArray?: GraphQLScalarType, - ToDateArray?: GraphQLScalarType, - ToNumberArray?: GraphQLScalarType, - TopCountriesItemDestination?: TopCountriesItemDestinationResolvers, - TopCountriesItemSource?: TopCountriesItemSourceResolvers, - TopNetworkTablesEcsField?: TopNetworkTablesEcsFieldResolvers, - TopNFlowItemDestination?: TopNFlowItemDestinationResolvers, - TopNFlowItemSource?: TopNFlowItemSourceResolvers, - ToStringArray?: GraphQLScalarType, - UncommonProcessesData?: UncommonProcessesDataResolvers, - UncommonProcessesEdges?: UncommonProcessesEdgesResolvers, - UncommonProcessItem?: UncommonProcessItemResolvers, - UrlEcsFields?: UrlEcsFieldsResolvers, - UserEcsFields?: UserEcsFieldsResolvers, - UsersData?: UsersDataResolvers, - UsersEdges?: UsersEdgesResolvers, - UsersItem?: UsersItemResolvers, - UsersNode?: UsersNodeResolvers, - WinlogEcsFields?: WinlogEcsFieldsResolvers, - ZeekConnectionData?: ZeekConnectionDataResolvers, - ZeekDnsData?: ZeekDnsDataResolvers, - ZeekEcsFields?: ZeekEcsFieldsResolvers, - ZeekFileData?: ZeekFileDataResolvers, - ZeekHttpData?: ZeekHttpDataResolvers, - ZeekNoticeData?: ZeekNoticeDataResolvers, - ZeekSslData?: ZeekSslDataResolvers, -}>; - - -/** - * @deprecated - * Use "Resolvers" root object instead. If you wish to get "IResolvers", add "typesPrefix: I" to your config. -*/ -export type IResolvers = Resolvers; + export type _IdResolver = Resolver< + R, + Parent, + TContext + >; + export type _IndexResolver< + R = Maybe, + Parent = TimelineItem, + TContext = SiemContext + > = Resolver; + export type DataResolver< + R = TimelineNonEcsData[], + Parent = TimelineItem, + TContext = SiemContext + > = Resolver; + export type EcsResolver = Resolver< + R, + Parent, + TContext + >; +} + +export namespace TimelineNonEcsDataResolvers { + export interface Resolvers { + field?: FieldResolver; + + value?: ValueResolver, TypeParent, TContext>; + } + + export type FieldResolver< + R = string, + Parent = TimelineNonEcsData, + TContext = SiemContext + > = Resolver; + export type ValueResolver< + R = Maybe, + Parent = TimelineNonEcsData, + TContext = SiemContext + > = Resolver; +} + +export namespace EcsResolvers { + export interface Resolvers { + _id?: _IdResolver; + + _index?: _IndexResolver, TypeParent, TContext>; + + auditd?: AuditdResolver, TypeParent, TContext>; + + destination?: DestinationResolver, TypeParent, TContext>; + + dns?: DnsResolver, TypeParent, TContext>; + + endgame?: EndgameResolver, TypeParent, TContext>; + + event?: EventResolver, TypeParent, TContext>; + + geo?: GeoResolver, TypeParent, TContext>; + + host?: HostResolver, TypeParent, TContext>; + + network?: NetworkResolver, TypeParent, TContext>; + + rule?: RuleResolver, TypeParent, TContext>; + + signal?: SignalResolver, TypeParent, TContext>; + + source?: SourceResolver, TypeParent, TContext>; + + suricata?: SuricataResolver, TypeParent, TContext>; + + tls?: TlsResolver, TypeParent, TContext>; + + zeek?: ZeekResolver, TypeParent, TContext>; + + http?: HttpResolver, TypeParent, TContext>; + + url?: UrlResolver, TypeParent, TContext>; + + timestamp?: TimestampResolver, TypeParent, TContext>; + + message?: MessageResolver, TypeParent, TContext>; + + user?: UserResolver, TypeParent, TContext>; + + winlog?: WinlogResolver, TypeParent, TContext>; + + process?: ProcessResolver, TypeParent, TContext>; + + file?: FileResolver, TypeParent, TContext>; + + system?: SystemResolver, TypeParent, TContext>; + } + + export type _IdResolver = Resolver< + R, + Parent, + TContext + >; + export type _IndexResolver, Parent = Ecs, TContext = SiemContext> = Resolver< + R, + Parent, + TContext + >; + export type AuditdResolver< + R = Maybe, + Parent = Ecs, + TContext = SiemContext + > = Resolver; + export type DestinationResolver< + R = Maybe, + Parent = Ecs, + TContext = SiemContext + > = Resolver; + export type DnsResolver, Parent = Ecs, TContext = SiemContext> = Resolver< + R, + Parent, + TContext + >; + export type EndgameResolver< + R = Maybe, + Parent = Ecs, + TContext = SiemContext + > = Resolver; + export type EventResolver< + R = Maybe, + Parent = Ecs, + TContext = SiemContext + > = Resolver; + export type GeoResolver, Parent = Ecs, TContext = SiemContext> = Resolver< + R, + Parent, + TContext + >; + export type HostResolver< + R = Maybe, + Parent = Ecs, + TContext = SiemContext + > = Resolver; + export type NetworkResolver< + R = Maybe, + Parent = Ecs, + TContext = SiemContext + > = Resolver; + export type RuleResolver< + R = Maybe, + Parent = Ecs, + TContext = SiemContext + > = Resolver; + export type SignalResolver< + R = Maybe, + Parent = Ecs, + TContext = SiemContext + > = Resolver; + export type SourceResolver< + R = Maybe, + Parent = Ecs, + TContext = SiemContext + > = Resolver; + export type SuricataResolver< + R = Maybe, + Parent = Ecs, + TContext = SiemContext + > = Resolver; + export type TlsResolver, Parent = Ecs, TContext = SiemContext> = Resolver< + R, + Parent, + TContext + >; + export type ZeekResolver< + R = Maybe, + Parent = Ecs, + TContext = SiemContext + > = Resolver; + export type HttpResolver< + R = Maybe, + Parent = Ecs, + TContext = SiemContext + > = Resolver; + export type UrlResolver, Parent = Ecs, TContext = SiemContext> = Resolver< + R, + Parent, + TContext + >; + export type TimestampResolver, Parent = Ecs, TContext = SiemContext> = Resolver< + R, + Parent, + TContext + >; + export type MessageResolver< + R = Maybe, + Parent = Ecs, + TContext = SiemContext + > = Resolver; + export type UserResolver< + R = Maybe, + Parent = Ecs, + TContext = SiemContext + > = Resolver; + export type WinlogResolver< + R = Maybe, + Parent = Ecs, + TContext = SiemContext + > = Resolver; + export type ProcessResolver< + R = Maybe, + Parent = Ecs, + TContext = SiemContext + > = Resolver; + export type FileResolver, Parent = Ecs, TContext = SiemContext> = Resolver< + R, + Parent, + TContext + >; + export type SystemResolver< + R = Maybe, + Parent = Ecs, + TContext = SiemContext + > = Resolver; +} + +export namespace AuditdEcsFieldsResolvers { + export interface Resolvers { + result?: ResultResolver, TypeParent, TContext>; + + session?: SessionResolver, TypeParent, TContext>; + + data?: DataResolver, TypeParent, TContext>; + + summary?: SummaryResolver, TypeParent, TContext>; + + sequence?: SequenceResolver, TypeParent, TContext>; + } + + export type ResultResolver< + R = Maybe, + Parent = AuditdEcsFields, + TContext = SiemContext + > = Resolver; + export type SessionResolver< + R = Maybe, + Parent = AuditdEcsFields, + TContext = SiemContext + > = Resolver; + export type DataResolver< + R = Maybe, + Parent = AuditdEcsFields, + TContext = SiemContext + > = Resolver; + export type SummaryResolver< + R = Maybe, + Parent = AuditdEcsFields, + TContext = SiemContext + > = Resolver; + export type SequenceResolver< + R = Maybe, + Parent = AuditdEcsFields, + TContext = SiemContext + > = Resolver; +} + +export namespace AuditdDataResolvers { + export interface Resolvers { + acct?: AcctResolver, TypeParent, TContext>; + + terminal?: TerminalResolver, TypeParent, TContext>; + + op?: OpResolver, TypeParent, TContext>; + } + + export type AcctResolver< + R = Maybe, + Parent = AuditdData, + TContext = SiemContext + > = Resolver; + export type TerminalResolver< + R = Maybe, + Parent = AuditdData, + TContext = SiemContext + > = Resolver; + export type OpResolver< + R = Maybe, + Parent = AuditdData, + TContext = SiemContext + > = Resolver; +} + +export namespace SummaryResolvers { + export interface Resolvers { + actor?: ActorResolver, TypeParent, TContext>; + + object?: ObjectResolver, TypeParent, TContext>; + + how?: HowResolver, TypeParent, TContext>; + + message_type?: MessageTypeResolver, TypeParent, TContext>; + + sequence?: SequenceResolver, TypeParent, TContext>; + } + + export type ActorResolver< + R = Maybe, + Parent = Summary, + TContext = SiemContext + > = Resolver; + export type ObjectResolver< + R = Maybe, + Parent = Summary, + TContext = SiemContext + > = Resolver; + export type HowResolver< + R = Maybe, + Parent = Summary, + TContext = SiemContext + > = Resolver; + export type MessageTypeResolver< + R = Maybe, + Parent = Summary, + TContext = SiemContext + > = Resolver; + export type SequenceResolver< + R = Maybe, + Parent = Summary, + TContext = SiemContext + > = Resolver; +} + +export namespace PrimarySecondaryResolvers { + export interface Resolvers { + primary?: PrimaryResolver, TypeParent, TContext>; + + secondary?: SecondaryResolver, TypeParent, TContext>; + + type?: TypeResolver, TypeParent, TContext>; + } + + export type PrimaryResolver< + R = Maybe, + Parent = PrimarySecondary, + TContext = SiemContext + > = Resolver; + export type SecondaryResolver< + R = Maybe, + Parent = PrimarySecondary, + TContext = SiemContext + > = Resolver; + export type TypeResolver< + R = Maybe, + Parent = PrimarySecondary, + TContext = SiemContext + > = Resolver; +} + +export namespace DestinationEcsFieldsResolvers { + export interface Resolvers { + bytes?: BytesResolver, TypeParent, TContext>; + + ip?: IpResolver, TypeParent, TContext>; + + port?: PortResolver, TypeParent, TContext>; + + domain?: DomainResolver, TypeParent, TContext>; + + geo?: GeoResolver, TypeParent, TContext>; + + packets?: PacketsResolver, TypeParent, TContext>; + } + + export type BytesResolver< + R = Maybe, + Parent = DestinationEcsFields, + TContext = SiemContext + > = Resolver; + export type IpResolver< + R = Maybe, + Parent = DestinationEcsFields, + TContext = SiemContext + > = Resolver; + export type PortResolver< + R = Maybe, + Parent = DestinationEcsFields, + TContext = SiemContext + > = Resolver; + export type DomainResolver< + R = Maybe, + Parent = DestinationEcsFields, + TContext = SiemContext + > = Resolver; + export type GeoResolver< + R = Maybe, + Parent = DestinationEcsFields, + TContext = SiemContext + > = Resolver; + export type PacketsResolver< + R = Maybe, + Parent = DestinationEcsFields, + TContext = SiemContext + > = Resolver; +} + +export namespace DnsEcsFieldsResolvers { + export interface Resolvers { + question?: QuestionResolver, TypeParent, TContext>; + + resolved_ip?: ResolvedIpResolver, TypeParent, TContext>; + + response_code?: ResponseCodeResolver, TypeParent, TContext>; + } + + export type QuestionResolver< + R = Maybe, + Parent = DnsEcsFields, + TContext = SiemContext + > = Resolver; + export type ResolvedIpResolver< + R = Maybe, + Parent = DnsEcsFields, + TContext = SiemContext + > = Resolver; + export type ResponseCodeResolver< + R = Maybe, + Parent = DnsEcsFields, + TContext = SiemContext + > = Resolver; +} + +export namespace DnsQuestionDataResolvers { + export interface Resolvers { + name?: NameResolver, TypeParent, TContext>; + + type?: TypeResolver, TypeParent, TContext>; + } + + export type NameResolver< + R = Maybe, + Parent = DnsQuestionData, + TContext = SiemContext + > = Resolver; + export type TypeResolver< + R = Maybe, + Parent = DnsQuestionData, + TContext = SiemContext + > = Resolver; +} + +export namespace EndgameEcsFieldsResolvers { + export interface Resolvers { + exit_code?: ExitCodeResolver, TypeParent, TContext>; + + file_name?: FileNameResolver, TypeParent, TContext>; + + file_path?: FilePathResolver, TypeParent, TContext>; + + logon_type?: LogonTypeResolver, TypeParent, TContext>; + + parent_process_name?: ParentProcessNameResolver, TypeParent, TContext>; + + pid?: PidResolver, TypeParent, TContext>; + + process_name?: ProcessNameResolver, TypeParent, TContext>; + + subject_domain_name?: SubjectDomainNameResolver, TypeParent, TContext>; + + subject_logon_id?: SubjectLogonIdResolver, TypeParent, TContext>; + + subject_user_name?: SubjectUserNameResolver, TypeParent, TContext>; + + target_domain_name?: TargetDomainNameResolver, TypeParent, TContext>; + + target_logon_id?: TargetLogonIdResolver, TypeParent, TContext>; + + target_user_name?: TargetUserNameResolver, TypeParent, TContext>; + } + + export type ExitCodeResolver< + R = Maybe, + Parent = EndgameEcsFields, + TContext = SiemContext + > = Resolver; + export type FileNameResolver< + R = Maybe, + Parent = EndgameEcsFields, + TContext = SiemContext + > = Resolver; + export type FilePathResolver< + R = Maybe, + Parent = EndgameEcsFields, + TContext = SiemContext + > = Resolver; + export type LogonTypeResolver< + R = Maybe, + Parent = EndgameEcsFields, + TContext = SiemContext + > = Resolver; + export type ParentProcessNameResolver< + R = Maybe, + Parent = EndgameEcsFields, + TContext = SiemContext + > = Resolver; + export type PidResolver< + R = Maybe, + Parent = EndgameEcsFields, + TContext = SiemContext + > = Resolver; + export type ProcessNameResolver< + R = Maybe, + Parent = EndgameEcsFields, + TContext = SiemContext + > = Resolver; + export type SubjectDomainNameResolver< + R = Maybe, + Parent = EndgameEcsFields, + TContext = SiemContext + > = Resolver; + export type SubjectLogonIdResolver< + R = Maybe, + Parent = EndgameEcsFields, + TContext = SiemContext + > = Resolver; + export type SubjectUserNameResolver< + R = Maybe, + Parent = EndgameEcsFields, + TContext = SiemContext + > = Resolver; + export type TargetDomainNameResolver< + R = Maybe, + Parent = EndgameEcsFields, + TContext = SiemContext + > = Resolver; + export type TargetLogonIdResolver< + R = Maybe, + Parent = EndgameEcsFields, + TContext = SiemContext + > = Resolver; + export type TargetUserNameResolver< + R = Maybe, + Parent = EndgameEcsFields, + TContext = SiemContext + > = Resolver; +} + +export namespace EventEcsFieldsResolvers { + export interface Resolvers { + action?: ActionResolver, TypeParent, TContext>; + + category?: CategoryResolver, TypeParent, TContext>; + + code?: CodeResolver, TypeParent, TContext>; + + created?: CreatedResolver, TypeParent, TContext>; + + dataset?: DatasetResolver, TypeParent, TContext>; + + duration?: DurationResolver, TypeParent, TContext>; + + end?: EndResolver, TypeParent, TContext>; + + hash?: HashResolver, TypeParent, TContext>; + + id?: IdResolver, TypeParent, TContext>; + + kind?: KindResolver, TypeParent, TContext>; + + module?: ModuleResolver, TypeParent, TContext>; + + original?: OriginalResolver, TypeParent, TContext>; + + outcome?: OutcomeResolver, TypeParent, TContext>; + + risk_score?: RiskScoreResolver, TypeParent, TContext>; + + risk_score_norm?: RiskScoreNormResolver, TypeParent, TContext>; + + severity?: SeverityResolver, TypeParent, TContext>; + + start?: StartResolver, TypeParent, TContext>; + + timezone?: TimezoneResolver, TypeParent, TContext>; + + type?: TypeResolver, TypeParent, TContext>; + } + + export type ActionResolver< + R = Maybe, + Parent = EventEcsFields, + TContext = SiemContext + > = Resolver; + export type CategoryResolver< + R = Maybe, + Parent = EventEcsFields, + TContext = SiemContext + > = Resolver; + export type CodeResolver< + R = Maybe, + Parent = EventEcsFields, + TContext = SiemContext + > = Resolver; + export type CreatedResolver< + R = Maybe, + Parent = EventEcsFields, + TContext = SiemContext + > = Resolver; + export type DatasetResolver< + R = Maybe, + Parent = EventEcsFields, + TContext = SiemContext + > = Resolver; + export type DurationResolver< + R = Maybe, + Parent = EventEcsFields, + TContext = SiemContext + > = Resolver; + export type EndResolver< + R = Maybe, + Parent = EventEcsFields, + TContext = SiemContext + > = Resolver; + export type HashResolver< + R = Maybe, + Parent = EventEcsFields, + TContext = SiemContext + > = Resolver; + export type IdResolver< + R = Maybe, + Parent = EventEcsFields, + TContext = SiemContext + > = Resolver; + export type KindResolver< + R = Maybe, + Parent = EventEcsFields, + TContext = SiemContext + > = Resolver; + export type ModuleResolver< + R = Maybe, + Parent = EventEcsFields, + TContext = SiemContext + > = Resolver; + export type OriginalResolver< + R = Maybe, + Parent = EventEcsFields, + TContext = SiemContext + > = Resolver; + export type OutcomeResolver< + R = Maybe, + Parent = EventEcsFields, + TContext = SiemContext + > = Resolver; + export type RiskScoreResolver< + R = Maybe, + Parent = EventEcsFields, + TContext = SiemContext + > = Resolver; + export type RiskScoreNormResolver< + R = Maybe, + Parent = EventEcsFields, + TContext = SiemContext + > = Resolver; + export type SeverityResolver< + R = Maybe, + Parent = EventEcsFields, + TContext = SiemContext + > = Resolver; + export type StartResolver< + R = Maybe, + Parent = EventEcsFields, + TContext = SiemContext + > = Resolver; + export type TimezoneResolver< + R = Maybe, + Parent = EventEcsFields, + TContext = SiemContext + > = Resolver; + export type TypeResolver< + R = Maybe, + Parent = EventEcsFields, + TContext = SiemContext + > = Resolver; +} + +export namespace NetworkEcsFieldResolvers { + export interface Resolvers { + bytes?: BytesResolver, TypeParent, TContext>; + + community_id?: CommunityIdResolver, TypeParent, TContext>; + + direction?: DirectionResolver, TypeParent, TContext>; + + packets?: PacketsResolver, TypeParent, TContext>; + + protocol?: ProtocolResolver, TypeParent, TContext>; + + transport?: TransportResolver, TypeParent, TContext>; + } + + export type BytesResolver< + R = Maybe, + Parent = NetworkEcsField, + TContext = SiemContext + > = Resolver; + export type CommunityIdResolver< + R = Maybe, + Parent = NetworkEcsField, + TContext = SiemContext + > = Resolver; + export type DirectionResolver< + R = Maybe, + Parent = NetworkEcsField, + TContext = SiemContext + > = Resolver; + export type PacketsResolver< + R = Maybe, + Parent = NetworkEcsField, + TContext = SiemContext + > = Resolver; + export type ProtocolResolver< + R = Maybe, + Parent = NetworkEcsField, + TContext = SiemContext + > = Resolver; + export type TransportResolver< + R = Maybe, + Parent = NetworkEcsField, + TContext = SiemContext + > = Resolver; +} + +export namespace RuleEcsFieldResolvers { + export interface Resolvers { + reference?: ReferenceResolver, TypeParent, TContext>; + } + + export type ReferenceResolver< + R = Maybe, + Parent = RuleEcsField, + TContext = SiemContext + > = Resolver; +} + +export namespace SignalFieldResolvers { + export interface Resolvers { + rule?: RuleResolver, TypeParent, TContext>; + + original_time?: OriginalTimeResolver, TypeParent, TContext>; + } + + export type RuleResolver< + R = Maybe, + Parent = SignalField, + TContext = SiemContext + > = Resolver; + export type OriginalTimeResolver< + R = Maybe, + Parent = SignalField, + TContext = SiemContext + > = Resolver; +} + +export namespace RuleFieldResolvers { + export interface Resolvers { + id?: IdResolver, TypeParent, TContext>; + + rule_id?: RuleIdResolver, TypeParent, TContext>; + + false_positives?: FalsePositivesResolver; + + saved_id?: SavedIdResolver, TypeParent, TContext>; + + timeline_id?: TimelineIdResolver, TypeParent, TContext>; + + timeline_title?: TimelineTitleResolver, TypeParent, TContext>; + + max_signals?: MaxSignalsResolver, TypeParent, TContext>; + + risk_score?: RiskScoreResolver, TypeParent, TContext>; + + output_index?: OutputIndexResolver, TypeParent, TContext>; + + description?: DescriptionResolver, TypeParent, TContext>; + + from?: FromResolver, TypeParent, TContext>; + + immutable?: ImmutableResolver, TypeParent, TContext>; + + index?: IndexResolver, TypeParent, TContext>; + + interval?: IntervalResolver, TypeParent, TContext>; + + language?: LanguageResolver, TypeParent, TContext>; + + query?: QueryResolver, TypeParent, TContext>; + + references?: ReferencesResolver, TypeParent, TContext>; + + severity?: SeverityResolver, TypeParent, TContext>; + + tags?: TagsResolver, TypeParent, TContext>; + + threat?: ThreatResolver, TypeParent, TContext>; + + type?: TypeResolver, TypeParent, TContext>; + + size?: SizeResolver, TypeParent, TContext>; + + to?: ToResolver, TypeParent, TContext>; + + enabled?: EnabledResolver, TypeParent, TContext>; + + filters?: FiltersResolver, TypeParent, TContext>; + + created_at?: CreatedAtResolver, TypeParent, TContext>; + + updated_at?: UpdatedAtResolver, TypeParent, TContext>; + + created_by?: CreatedByResolver, TypeParent, TContext>; + + updated_by?: UpdatedByResolver, TypeParent, TContext>; + + version?: VersionResolver, TypeParent, TContext>; + } + + export type IdResolver< + R = Maybe, + Parent = RuleField, + TContext = SiemContext + > = Resolver; + export type RuleIdResolver< + R = Maybe, + Parent = RuleField, + TContext = SiemContext + > = Resolver; + export type FalsePositivesResolver< + R = string[], + Parent = RuleField, + TContext = SiemContext + > = Resolver; + export type SavedIdResolver< + R = Maybe, + Parent = RuleField, + TContext = SiemContext + > = Resolver; + export type TimelineIdResolver< + R = Maybe, + Parent = RuleField, + TContext = SiemContext + > = Resolver; + export type TimelineTitleResolver< + R = Maybe, + Parent = RuleField, + TContext = SiemContext + > = Resolver; + export type MaxSignalsResolver< + R = Maybe, + Parent = RuleField, + TContext = SiemContext + > = Resolver; + export type RiskScoreResolver< + R = Maybe, + Parent = RuleField, + TContext = SiemContext + > = Resolver; + export type OutputIndexResolver< + R = Maybe, + Parent = RuleField, + TContext = SiemContext + > = Resolver; + export type DescriptionResolver< + R = Maybe, + Parent = RuleField, + TContext = SiemContext + > = Resolver; + export type FromResolver< + R = Maybe, + Parent = RuleField, + TContext = SiemContext + > = Resolver; + export type ImmutableResolver< + R = Maybe, + Parent = RuleField, + TContext = SiemContext + > = Resolver; + export type IndexResolver< + R = Maybe, + Parent = RuleField, + TContext = SiemContext + > = Resolver; + export type IntervalResolver< + R = Maybe, + Parent = RuleField, + TContext = SiemContext + > = Resolver; + export type LanguageResolver< + R = Maybe, + Parent = RuleField, + TContext = SiemContext + > = Resolver; + export type QueryResolver< + R = Maybe, + Parent = RuleField, + TContext = SiemContext + > = Resolver; + export type ReferencesResolver< + R = Maybe, + Parent = RuleField, + TContext = SiemContext + > = Resolver; + export type SeverityResolver< + R = Maybe, + Parent = RuleField, + TContext = SiemContext + > = Resolver; + export type TagsResolver< + R = Maybe, + Parent = RuleField, + TContext = SiemContext + > = Resolver; + export type ThreatResolver< + R = Maybe, + Parent = RuleField, + TContext = SiemContext + > = Resolver; + export type TypeResolver< + R = Maybe, + Parent = RuleField, + TContext = SiemContext + > = Resolver; + export type SizeResolver< + R = Maybe, + Parent = RuleField, + TContext = SiemContext + > = Resolver; + export type ToResolver< + R = Maybe, + Parent = RuleField, + TContext = SiemContext + > = Resolver; + export type EnabledResolver< + R = Maybe, + Parent = RuleField, + TContext = SiemContext + > = Resolver; + export type FiltersResolver< + R = Maybe, + Parent = RuleField, + TContext = SiemContext + > = Resolver; + export type CreatedAtResolver< + R = Maybe, + Parent = RuleField, + TContext = SiemContext + > = Resolver; + export type UpdatedAtResolver< + R = Maybe, + Parent = RuleField, + TContext = SiemContext + > = Resolver; + export type CreatedByResolver< + R = Maybe, + Parent = RuleField, + TContext = SiemContext + > = Resolver; + export type UpdatedByResolver< + R = Maybe, + Parent = RuleField, + TContext = SiemContext + > = Resolver; + export type VersionResolver< + R = Maybe, + Parent = RuleField, + TContext = SiemContext + > = Resolver; +} + +export namespace SuricataEcsFieldsResolvers { + export interface Resolvers { + eve?: EveResolver, TypeParent, TContext>; + } + + export type EveResolver< + R = Maybe, + Parent = SuricataEcsFields, + TContext = SiemContext + > = Resolver; +} + +export namespace SuricataEveDataResolvers { + export interface Resolvers { + alert?: AlertResolver, TypeParent, TContext>; + + flow_id?: FlowIdResolver, TypeParent, TContext>; + + proto?: ProtoResolver, TypeParent, TContext>; + } + + export type AlertResolver< + R = Maybe, + Parent = SuricataEveData, + TContext = SiemContext + > = Resolver; + export type FlowIdResolver< + R = Maybe, + Parent = SuricataEveData, + TContext = SiemContext + > = Resolver; + export type ProtoResolver< + R = Maybe, + Parent = SuricataEveData, + TContext = SiemContext + > = Resolver; +} + +export namespace SuricataAlertDataResolvers { + export interface Resolvers { + signature?: SignatureResolver, TypeParent, TContext>; + + signature_id?: SignatureIdResolver, TypeParent, TContext>; + } + + export type SignatureResolver< + R = Maybe, + Parent = SuricataAlertData, + TContext = SiemContext + > = Resolver; + export type SignatureIdResolver< + R = Maybe, + Parent = SuricataAlertData, + TContext = SiemContext + > = Resolver; +} + +export namespace TlsEcsFieldsResolvers { + export interface Resolvers { + client_certificate?: ClientCertificateResolver< + Maybe, + TypeParent, + TContext + >; + + fingerprints?: FingerprintsResolver, TypeParent, TContext>; + + server_certificate?: ServerCertificateResolver< + Maybe, + TypeParent, + TContext + >; + } + + export type ClientCertificateResolver< + R = Maybe, + Parent = TlsEcsFields, + TContext = SiemContext + > = Resolver; + export type FingerprintsResolver< + R = Maybe, + Parent = TlsEcsFields, + TContext = SiemContext + > = Resolver; + export type ServerCertificateResolver< + R = Maybe, + Parent = TlsEcsFields, + TContext = SiemContext + > = Resolver; +} + +export namespace TlsClientCertificateDataResolvers { + export interface Resolvers { + fingerprint?: FingerprintResolver, TypeParent, TContext>; + } + + export type FingerprintResolver< + R = Maybe, + Parent = TlsClientCertificateData, + TContext = SiemContext + > = Resolver; +} + +export namespace FingerprintDataResolvers { + export interface Resolvers { + sha1?: Sha1Resolver, TypeParent, TContext>; + } + + export type Sha1Resolver< + R = Maybe, + Parent = FingerprintData, + TContext = SiemContext + > = Resolver; +} + +export namespace TlsFingerprintsDataResolvers { + export interface Resolvers { + ja3?: Ja3Resolver, TypeParent, TContext>; + } + + export type Ja3Resolver< + R = Maybe, + Parent = TlsFingerprintsData, + TContext = SiemContext + > = Resolver; +} + +export namespace TlsJa3DataResolvers { + export interface Resolvers { + hash?: HashResolver, TypeParent, TContext>; + } + + export type HashResolver< + R = Maybe, + Parent = TlsJa3Data, + TContext = SiemContext + > = Resolver; +} + +export namespace TlsServerCertificateDataResolvers { + export interface Resolvers { + fingerprint?: FingerprintResolver, TypeParent, TContext>; + } + + export type FingerprintResolver< + R = Maybe, + Parent = TlsServerCertificateData, + TContext = SiemContext + > = Resolver; +} + +export namespace ZeekEcsFieldsResolvers { + export interface Resolvers { + session_id?: SessionIdResolver, TypeParent, TContext>; + + connection?: ConnectionResolver, TypeParent, TContext>; + + notice?: NoticeResolver, TypeParent, TContext>; + + dns?: DnsResolver, TypeParent, TContext>; + + http?: HttpResolver, TypeParent, TContext>; + + files?: FilesResolver, TypeParent, TContext>; + + ssl?: SslResolver, TypeParent, TContext>; + } + + export type SessionIdResolver< + R = Maybe, + Parent = ZeekEcsFields, + TContext = SiemContext + > = Resolver; + export type ConnectionResolver< + R = Maybe, + Parent = ZeekEcsFields, + TContext = SiemContext + > = Resolver; + export type NoticeResolver< + R = Maybe, + Parent = ZeekEcsFields, + TContext = SiemContext + > = Resolver; + export type DnsResolver< + R = Maybe, + Parent = ZeekEcsFields, + TContext = SiemContext + > = Resolver; + export type HttpResolver< + R = Maybe, + Parent = ZeekEcsFields, + TContext = SiemContext + > = Resolver; + export type FilesResolver< + R = Maybe, + Parent = ZeekEcsFields, + TContext = SiemContext + > = Resolver; + export type SslResolver< + R = Maybe, + Parent = ZeekEcsFields, + TContext = SiemContext + > = Resolver; +} + +export namespace ZeekConnectionDataResolvers { + export interface Resolvers { + local_resp?: LocalRespResolver, TypeParent, TContext>; + + local_orig?: LocalOrigResolver, TypeParent, TContext>; + + missed_bytes?: MissedBytesResolver, TypeParent, TContext>; + + state?: StateResolver, TypeParent, TContext>; + + history?: HistoryResolver, TypeParent, TContext>; + } + + export type LocalRespResolver< + R = Maybe, + Parent = ZeekConnectionData, + TContext = SiemContext + > = Resolver; + export type LocalOrigResolver< + R = Maybe, + Parent = ZeekConnectionData, + TContext = SiemContext + > = Resolver; + export type MissedBytesResolver< + R = Maybe, + Parent = ZeekConnectionData, + TContext = SiemContext + > = Resolver; + export type StateResolver< + R = Maybe, + Parent = ZeekConnectionData, + TContext = SiemContext + > = Resolver; + export type HistoryResolver< + R = Maybe, + Parent = ZeekConnectionData, + TContext = SiemContext + > = Resolver; +} + +export namespace ZeekNoticeDataResolvers { + export interface Resolvers { + suppress_for?: SuppressForResolver, TypeParent, TContext>; + + msg?: MsgResolver, TypeParent, TContext>; + + note?: NoteResolver, TypeParent, TContext>; + + sub?: SubResolver, TypeParent, TContext>; + + dst?: DstResolver, TypeParent, TContext>; + + dropped?: DroppedResolver, TypeParent, TContext>; + + peer_descr?: PeerDescrResolver, TypeParent, TContext>; + } + + export type SuppressForResolver< + R = Maybe, + Parent = ZeekNoticeData, + TContext = SiemContext + > = Resolver; + export type MsgResolver< + R = Maybe, + Parent = ZeekNoticeData, + TContext = SiemContext + > = Resolver; + export type NoteResolver< + R = Maybe, + Parent = ZeekNoticeData, + TContext = SiemContext + > = Resolver; + export type SubResolver< + R = Maybe, + Parent = ZeekNoticeData, + TContext = SiemContext + > = Resolver; + export type DstResolver< + R = Maybe, + Parent = ZeekNoticeData, + TContext = SiemContext + > = Resolver; + export type DroppedResolver< + R = Maybe, + Parent = ZeekNoticeData, + TContext = SiemContext + > = Resolver; + export type PeerDescrResolver< + R = Maybe, + Parent = ZeekNoticeData, + TContext = SiemContext + > = Resolver; +} + +export namespace ZeekDnsDataResolvers { + export interface Resolvers { + AA?: AaResolver, TypeParent, TContext>; + + qclass_name?: QclassNameResolver, TypeParent, TContext>; + + RD?: RdResolver, TypeParent, TContext>; + + qtype_name?: QtypeNameResolver, TypeParent, TContext>; + + rejected?: RejectedResolver, TypeParent, TContext>; + + qtype?: QtypeResolver, TypeParent, TContext>; + + query?: QueryResolver, TypeParent, TContext>; + + trans_id?: TransIdResolver, TypeParent, TContext>; + + qclass?: QclassResolver, TypeParent, TContext>; + + RA?: RaResolver, TypeParent, TContext>; + + TC?: TcResolver, TypeParent, TContext>; + } + + export type AaResolver< + R = Maybe, + Parent = ZeekDnsData, + TContext = SiemContext + > = Resolver; + export type QclassNameResolver< + R = Maybe, + Parent = ZeekDnsData, + TContext = SiemContext + > = Resolver; + export type RdResolver< + R = Maybe, + Parent = ZeekDnsData, + TContext = SiemContext + > = Resolver; + export type QtypeNameResolver< + R = Maybe, + Parent = ZeekDnsData, + TContext = SiemContext + > = Resolver; + export type RejectedResolver< + R = Maybe, + Parent = ZeekDnsData, + TContext = SiemContext + > = Resolver; + export type QtypeResolver< + R = Maybe, + Parent = ZeekDnsData, + TContext = SiemContext + > = Resolver; + export type QueryResolver< + R = Maybe, + Parent = ZeekDnsData, + TContext = SiemContext + > = Resolver; + export type TransIdResolver< + R = Maybe, + Parent = ZeekDnsData, + TContext = SiemContext + > = Resolver; + export type QclassResolver< + R = Maybe, + Parent = ZeekDnsData, + TContext = SiemContext + > = Resolver; + export type RaResolver< + R = Maybe, + Parent = ZeekDnsData, + TContext = SiemContext + > = Resolver; + export type TcResolver< + R = Maybe, + Parent = ZeekDnsData, + TContext = SiemContext + > = Resolver; +} + +export namespace ZeekHttpDataResolvers { + export interface Resolvers { + resp_mime_types?: RespMimeTypesResolver, TypeParent, TContext>; + + trans_depth?: TransDepthResolver, TypeParent, TContext>; + + status_msg?: StatusMsgResolver, TypeParent, TContext>; + + resp_fuids?: RespFuidsResolver, TypeParent, TContext>; + + tags?: TagsResolver, TypeParent, TContext>; + } + + export type RespMimeTypesResolver< + R = Maybe, + Parent = ZeekHttpData, + TContext = SiemContext + > = Resolver; + export type TransDepthResolver< + R = Maybe, + Parent = ZeekHttpData, + TContext = SiemContext + > = Resolver; + export type StatusMsgResolver< + R = Maybe, + Parent = ZeekHttpData, + TContext = SiemContext + > = Resolver; + export type RespFuidsResolver< + R = Maybe, + Parent = ZeekHttpData, + TContext = SiemContext + > = Resolver; + export type TagsResolver< + R = Maybe, + Parent = ZeekHttpData, + TContext = SiemContext + > = Resolver; +} + +export namespace ZeekFileDataResolvers { + export interface Resolvers { + session_ids?: SessionIdsResolver, TypeParent, TContext>; + + timedout?: TimedoutResolver, TypeParent, TContext>; + + local_orig?: LocalOrigResolver, TypeParent, TContext>; + + tx_host?: TxHostResolver, TypeParent, TContext>; + + source?: SourceResolver, TypeParent, TContext>; + + is_orig?: IsOrigResolver, TypeParent, TContext>; + + overflow_bytes?: OverflowBytesResolver, TypeParent, TContext>; + + sha1?: Sha1Resolver, TypeParent, TContext>; + + duration?: DurationResolver, TypeParent, TContext>; + + depth?: DepthResolver, TypeParent, TContext>; + + analyzers?: AnalyzersResolver, TypeParent, TContext>; + + mime_type?: MimeTypeResolver, TypeParent, TContext>; + + rx_host?: RxHostResolver, TypeParent, TContext>; + + total_bytes?: TotalBytesResolver, TypeParent, TContext>; + + fuid?: FuidResolver, TypeParent, TContext>; + + seen_bytes?: SeenBytesResolver, TypeParent, TContext>; + + missing_bytes?: MissingBytesResolver, TypeParent, TContext>; + + md5?: Md5Resolver, TypeParent, TContext>; + } + + export type SessionIdsResolver< + R = Maybe, + Parent = ZeekFileData, + TContext = SiemContext + > = Resolver; + export type TimedoutResolver< + R = Maybe, + Parent = ZeekFileData, + TContext = SiemContext + > = Resolver; + export type LocalOrigResolver< + R = Maybe, + Parent = ZeekFileData, + TContext = SiemContext + > = Resolver; + export type TxHostResolver< + R = Maybe, + Parent = ZeekFileData, + TContext = SiemContext + > = Resolver; + export type SourceResolver< + R = Maybe, + Parent = ZeekFileData, + TContext = SiemContext + > = Resolver; + export type IsOrigResolver< + R = Maybe, + Parent = ZeekFileData, + TContext = SiemContext + > = Resolver; + export type OverflowBytesResolver< + R = Maybe, + Parent = ZeekFileData, + TContext = SiemContext + > = Resolver; + export type Sha1Resolver< + R = Maybe, + Parent = ZeekFileData, + TContext = SiemContext + > = Resolver; + export type DurationResolver< + R = Maybe, + Parent = ZeekFileData, + TContext = SiemContext + > = Resolver; + export type DepthResolver< + R = Maybe, + Parent = ZeekFileData, + TContext = SiemContext + > = Resolver; + export type AnalyzersResolver< + R = Maybe, + Parent = ZeekFileData, + TContext = SiemContext + > = Resolver; + export type MimeTypeResolver< + R = Maybe, + Parent = ZeekFileData, + TContext = SiemContext + > = Resolver; + export type RxHostResolver< + R = Maybe, + Parent = ZeekFileData, + TContext = SiemContext + > = Resolver; + export type TotalBytesResolver< + R = Maybe, + Parent = ZeekFileData, + TContext = SiemContext + > = Resolver; + export type FuidResolver< + R = Maybe, + Parent = ZeekFileData, + TContext = SiemContext + > = Resolver; + export type SeenBytesResolver< + R = Maybe, + Parent = ZeekFileData, + TContext = SiemContext + > = Resolver; + export type MissingBytesResolver< + R = Maybe, + Parent = ZeekFileData, + TContext = SiemContext + > = Resolver; + export type Md5Resolver< + R = Maybe, + Parent = ZeekFileData, + TContext = SiemContext + > = Resolver; +} + +export namespace ZeekSslDataResolvers { + export interface Resolvers { + cipher?: CipherResolver, TypeParent, TContext>; + + established?: EstablishedResolver, TypeParent, TContext>; + + resumed?: ResumedResolver, TypeParent, TContext>; + + version?: VersionResolver, TypeParent, TContext>; + } + + export type CipherResolver< + R = Maybe, + Parent = ZeekSslData, + TContext = SiemContext + > = Resolver; + export type EstablishedResolver< + R = Maybe, + Parent = ZeekSslData, + TContext = SiemContext + > = Resolver; + export type ResumedResolver< + R = Maybe, + Parent = ZeekSslData, + TContext = SiemContext + > = Resolver; + export type VersionResolver< + R = Maybe, + Parent = ZeekSslData, + TContext = SiemContext + > = Resolver; +} + +export namespace HttpEcsFieldsResolvers { + export interface Resolvers { + version?: VersionResolver, TypeParent, TContext>; + + request?: RequestResolver, TypeParent, TContext>; + + response?: ResponseResolver, TypeParent, TContext>; + } + + export type VersionResolver< + R = Maybe, + Parent = HttpEcsFields, + TContext = SiemContext + > = Resolver; + export type RequestResolver< + R = Maybe, + Parent = HttpEcsFields, + TContext = SiemContext + > = Resolver; + export type ResponseResolver< + R = Maybe, + Parent = HttpEcsFields, + TContext = SiemContext + > = Resolver; +} + +export namespace HttpRequestDataResolvers { + export interface Resolvers { + method?: MethodResolver, TypeParent, TContext>; + + body?: BodyResolver, TypeParent, TContext>; + + referrer?: ReferrerResolver, TypeParent, TContext>; + + bytes?: BytesResolver, TypeParent, TContext>; + } + + export type MethodResolver< + R = Maybe, + Parent = HttpRequestData, + TContext = SiemContext + > = Resolver; + export type BodyResolver< + R = Maybe, + Parent = HttpRequestData, + TContext = SiemContext + > = Resolver; + export type ReferrerResolver< + R = Maybe, + Parent = HttpRequestData, + TContext = SiemContext + > = Resolver; + export type BytesResolver< + R = Maybe, + Parent = HttpRequestData, + TContext = SiemContext + > = Resolver; +} + +export namespace HttpBodyDataResolvers { + export interface Resolvers { + content?: ContentResolver, TypeParent, TContext>; + + bytes?: BytesResolver, TypeParent, TContext>; + } + + export type ContentResolver< + R = Maybe, + Parent = HttpBodyData, + TContext = SiemContext + > = Resolver; + export type BytesResolver< + R = Maybe, + Parent = HttpBodyData, + TContext = SiemContext + > = Resolver; +} + +export namespace HttpResponseDataResolvers { + export interface Resolvers { + status_code?: StatusCodeResolver, TypeParent, TContext>; + + body?: BodyResolver, TypeParent, TContext>; + + bytes?: BytesResolver, TypeParent, TContext>; + } + + export type StatusCodeResolver< + R = Maybe, + Parent = HttpResponseData, + TContext = SiemContext + > = Resolver; + export type BodyResolver< + R = Maybe, + Parent = HttpResponseData, + TContext = SiemContext + > = Resolver; + export type BytesResolver< + R = Maybe, + Parent = HttpResponseData, + TContext = SiemContext + > = Resolver; +} + +export namespace UrlEcsFieldsResolvers { + export interface Resolvers { + domain?: DomainResolver, TypeParent, TContext>; + + original?: OriginalResolver, TypeParent, TContext>; + + username?: UsernameResolver, TypeParent, TContext>; + + password?: PasswordResolver, TypeParent, TContext>; + } + + export type DomainResolver< + R = Maybe, + Parent = UrlEcsFields, + TContext = SiemContext + > = Resolver; + export type OriginalResolver< + R = Maybe, + Parent = UrlEcsFields, + TContext = SiemContext + > = Resolver; + export type UsernameResolver< + R = Maybe, + Parent = UrlEcsFields, + TContext = SiemContext + > = Resolver; + export type PasswordResolver< + R = Maybe, + Parent = UrlEcsFields, + TContext = SiemContext + > = Resolver; +} + +export namespace WinlogEcsFieldsResolvers { + export interface Resolvers { + event_id?: EventIdResolver, TypeParent, TContext>; + } + + export type EventIdResolver< + R = Maybe, + Parent = WinlogEcsFields, + TContext = SiemContext + > = Resolver; +} + +export namespace ProcessEcsFieldsResolvers { + export interface Resolvers { + hash?: HashResolver, TypeParent, TContext>; + + pid?: PidResolver, TypeParent, TContext>; + + name?: NameResolver, TypeParent, TContext>; + + ppid?: PpidResolver, TypeParent, TContext>; + + args?: ArgsResolver, TypeParent, TContext>; + + executable?: ExecutableResolver, TypeParent, TContext>; + + title?: TitleResolver, TypeParent, TContext>; + + thread?: ThreadResolver, TypeParent, TContext>; + + working_directory?: WorkingDirectoryResolver, TypeParent, TContext>; + } + + export type HashResolver< + R = Maybe, + Parent = ProcessEcsFields, + TContext = SiemContext + > = Resolver; + export type PidResolver< + R = Maybe, + Parent = ProcessEcsFields, + TContext = SiemContext + > = Resolver; + export type NameResolver< + R = Maybe, + Parent = ProcessEcsFields, + TContext = SiemContext + > = Resolver; + export type PpidResolver< + R = Maybe, + Parent = ProcessEcsFields, + TContext = SiemContext + > = Resolver; + export type ArgsResolver< + R = Maybe, + Parent = ProcessEcsFields, + TContext = SiemContext + > = Resolver; + export type ExecutableResolver< + R = Maybe, + Parent = ProcessEcsFields, + TContext = SiemContext + > = Resolver; + export type TitleResolver< + R = Maybe, + Parent = ProcessEcsFields, + TContext = SiemContext + > = Resolver; + export type ThreadResolver< + R = Maybe, + Parent = ProcessEcsFields, + TContext = SiemContext + > = Resolver; + export type WorkingDirectoryResolver< + R = Maybe, + Parent = ProcessEcsFields, + TContext = SiemContext + > = Resolver; +} + +export namespace ProcessHashDataResolvers { + export interface Resolvers { + md5?: Md5Resolver, TypeParent, TContext>; + + sha1?: Sha1Resolver, TypeParent, TContext>; + + sha256?: Sha256Resolver, TypeParent, TContext>; + } + + export type Md5Resolver< + R = Maybe, + Parent = ProcessHashData, + TContext = SiemContext + > = Resolver; + export type Sha1Resolver< + R = Maybe, + Parent = ProcessHashData, + TContext = SiemContext + > = Resolver; + export type Sha256Resolver< + R = Maybe, + Parent = ProcessHashData, + TContext = SiemContext + > = Resolver; +} + +export namespace ThreadResolvers { + export interface Resolvers { + id?: IdResolver, TypeParent, TContext>; + + start?: StartResolver, TypeParent, TContext>; + } + + export type IdResolver< + R = Maybe, + Parent = Thread, + TContext = SiemContext + > = Resolver; + export type StartResolver< + R = Maybe, + Parent = Thread, + TContext = SiemContext + > = Resolver; +} + +export namespace FileFieldsResolvers { + export interface Resolvers { + name?: NameResolver, TypeParent, TContext>; + + path?: PathResolver, TypeParent, TContext>; + + target_path?: TargetPathResolver, TypeParent, TContext>; + + extension?: ExtensionResolver, TypeParent, TContext>; + + type?: TypeResolver, TypeParent, TContext>; + + device?: DeviceResolver, TypeParent, TContext>; + + inode?: InodeResolver, TypeParent, TContext>; + + uid?: UidResolver, TypeParent, TContext>; + + owner?: OwnerResolver, TypeParent, TContext>; + + gid?: GidResolver, TypeParent, TContext>; + + group?: GroupResolver, TypeParent, TContext>; + + mode?: ModeResolver, TypeParent, TContext>; + + size?: SizeResolver, TypeParent, TContext>; + + mtime?: MtimeResolver, TypeParent, TContext>; + + ctime?: CtimeResolver, TypeParent, TContext>; + } + + export type NameResolver< + R = Maybe, + Parent = FileFields, + TContext = SiemContext + > = Resolver; + export type PathResolver< + R = Maybe, + Parent = FileFields, + TContext = SiemContext + > = Resolver; + export type TargetPathResolver< + R = Maybe, + Parent = FileFields, + TContext = SiemContext + > = Resolver; + export type ExtensionResolver< + R = Maybe, + Parent = FileFields, + TContext = SiemContext + > = Resolver; + export type TypeResolver< + R = Maybe, + Parent = FileFields, + TContext = SiemContext + > = Resolver; + export type DeviceResolver< + R = Maybe, + Parent = FileFields, + TContext = SiemContext + > = Resolver; + export type InodeResolver< + R = Maybe, + Parent = FileFields, + TContext = SiemContext + > = Resolver; + export type UidResolver< + R = Maybe, + Parent = FileFields, + TContext = SiemContext + > = Resolver; + export type OwnerResolver< + R = Maybe, + Parent = FileFields, + TContext = SiemContext + > = Resolver; + export type GidResolver< + R = Maybe, + Parent = FileFields, + TContext = SiemContext + > = Resolver; + export type GroupResolver< + R = Maybe, + Parent = FileFields, + TContext = SiemContext + > = Resolver; + export type ModeResolver< + R = Maybe, + Parent = FileFields, + TContext = SiemContext + > = Resolver; + export type SizeResolver< + R = Maybe, + Parent = FileFields, + TContext = SiemContext + > = Resolver; + export type MtimeResolver< + R = Maybe, + Parent = FileFields, + TContext = SiemContext + > = Resolver; + export type CtimeResolver< + R = Maybe, + Parent = FileFields, + TContext = SiemContext + > = Resolver; +} + +export namespace SystemEcsFieldResolvers { + export interface Resolvers { + audit?: AuditResolver, TypeParent, TContext>; + + auth?: AuthResolver, TypeParent, TContext>; + } + + export type AuditResolver< + R = Maybe, + Parent = SystemEcsField, + TContext = SiemContext + > = Resolver; + export type AuthResolver< + R = Maybe, + Parent = SystemEcsField, + TContext = SiemContext + > = Resolver; +} + +export namespace AuditEcsFieldsResolvers { + export interface Resolvers { + package?: PackageResolver, TypeParent, TContext>; + } + + export type PackageResolver< + R = Maybe, + Parent = AuditEcsFields, + TContext = SiemContext + > = Resolver; +} + +export namespace PackageEcsFieldsResolvers { + export interface Resolvers { + arch?: ArchResolver, TypeParent, TContext>; + + entity_id?: EntityIdResolver, TypeParent, TContext>; + + name?: NameResolver, TypeParent, TContext>; + + size?: SizeResolver, TypeParent, TContext>; + + summary?: SummaryResolver, TypeParent, TContext>; + + version?: VersionResolver, TypeParent, TContext>; + } + + export type ArchResolver< + R = Maybe, + Parent = PackageEcsFields, + TContext = SiemContext + > = Resolver; + export type EntityIdResolver< + R = Maybe, + Parent = PackageEcsFields, + TContext = SiemContext + > = Resolver; + export type NameResolver< + R = Maybe, + Parent = PackageEcsFields, + TContext = SiemContext + > = Resolver; + export type SizeResolver< + R = Maybe, + Parent = PackageEcsFields, + TContext = SiemContext + > = Resolver; + export type SummaryResolver< + R = Maybe, + Parent = PackageEcsFields, + TContext = SiemContext + > = Resolver; + export type VersionResolver< + R = Maybe, + Parent = PackageEcsFields, + TContext = SiemContext + > = Resolver; +} + +export namespace AuthEcsFieldsResolvers { + export interface Resolvers { + ssh?: SshResolver, TypeParent, TContext>; + } + + export type SshResolver< + R = Maybe, + Parent = AuthEcsFields, + TContext = SiemContext + > = Resolver; +} + +export namespace SshEcsFieldsResolvers { + export interface Resolvers { + method?: MethodResolver, TypeParent, TContext>; + + signature?: SignatureResolver, TypeParent, TContext>; + } + + export type MethodResolver< + R = Maybe, + Parent = SshEcsFields, + TContext = SiemContext + > = Resolver; + export type SignatureResolver< + R = Maybe, + Parent = SshEcsFields, + TContext = SiemContext + > = Resolver; +} + +export namespace PageInfoResolvers { + export interface Resolvers { + endCursor?: EndCursorResolver, TypeParent, TContext>; + + hasNextPage?: HasNextPageResolver, TypeParent, TContext>; + } + + export type EndCursorResolver< + R = Maybe, + Parent = PageInfo, + TContext = SiemContext + > = Resolver; + export type HasNextPageResolver< + R = Maybe, + Parent = PageInfo, + TContext = SiemContext + > = Resolver; +} + +export namespace TimelineDetailsDataResolvers { + export interface Resolvers { + data?: DataResolver, TypeParent, TContext>; + + inspect?: InspectResolver, TypeParent, TContext>; + } + + export type DataResolver< + R = Maybe, + Parent = TimelineDetailsData, + TContext = SiemContext + > = Resolver; + export type InspectResolver< + R = Maybe, + Parent = TimelineDetailsData, + TContext = SiemContext + > = Resolver; +} + +export namespace DetailItemResolvers { + export interface Resolvers { + field?: FieldResolver; + + values?: ValuesResolver, TypeParent, TContext>; + + originalValue?: OriginalValueResolver, TypeParent, TContext>; + } + + export type FieldResolver = Resolver< + R, + Parent, + TContext + >; + export type ValuesResolver< + R = Maybe, + Parent = DetailItem, + TContext = SiemContext + > = Resolver; + export type OriginalValueResolver< + R = Maybe, + Parent = DetailItem, + TContext = SiemContext + > = Resolver; +} + +export namespace LastEventTimeDataResolvers { + export interface Resolvers { + lastSeen?: LastSeenResolver, TypeParent, TContext>; + + inspect?: InspectResolver, TypeParent, TContext>; + } + + export type LastSeenResolver< + R = Maybe, + Parent = LastEventTimeData, + TContext = SiemContext + > = Resolver; + export type InspectResolver< + R = Maybe, + Parent = LastEventTimeData, + TContext = SiemContext + > = Resolver; +} + +export namespace HostsDataResolvers { + export interface Resolvers { + edges?: EdgesResolver; + + totalCount?: TotalCountResolver; + + pageInfo?: PageInfoResolver; + + inspect?: InspectResolver, TypeParent, TContext>; + } + + export type EdgesResolver< + R = HostsEdges[], + Parent = HostsData, + TContext = SiemContext + > = Resolver; + export type TotalCountResolver = Resolver< + R, + Parent, + TContext + >; + export type PageInfoResolver< + R = PageInfoPaginated, + Parent = HostsData, + TContext = SiemContext + > = Resolver; + export type InspectResolver< + R = Maybe, + Parent = HostsData, + TContext = SiemContext + > = Resolver; +} + +export namespace HostsEdgesResolvers { + export interface Resolvers { + node?: NodeResolver; + + cursor?: CursorResolver; + } + + export type NodeResolver = Resolver< + R, + Parent, + TContext + >; + export type CursorResolver< + R = CursorType, + Parent = HostsEdges, + TContext = SiemContext + > = Resolver; +} + +export namespace HostItemResolvers { + export interface Resolvers { + _id?: _IdResolver, TypeParent, TContext>; + + lastSeen?: LastSeenResolver, TypeParent, TContext>; + + host?: HostResolver, TypeParent, TContext>; + + cloud?: CloudResolver, TypeParent, TContext>; + + inspect?: InspectResolver, TypeParent, TContext>; + } + + export type _IdResolver, Parent = HostItem, TContext = SiemContext> = Resolver< + R, + Parent, + TContext + >; + export type LastSeenResolver< + R = Maybe, + Parent = HostItem, + TContext = SiemContext + > = Resolver; + export type HostResolver< + R = Maybe, + Parent = HostItem, + TContext = SiemContext + > = Resolver; + export type CloudResolver< + R = Maybe, + Parent = HostItem, + TContext = SiemContext + > = Resolver; + export type InspectResolver< + R = Maybe, + Parent = HostItem, + TContext = SiemContext + > = Resolver; +} + +export namespace CloudFieldsResolvers { + export interface Resolvers { + instance?: InstanceResolver, TypeParent, TContext>; + + machine?: MachineResolver, TypeParent, TContext>; + + provider?: ProviderResolver)[]>, TypeParent, TContext>; + + region?: RegionResolver)[]>, TypeParent, TContext>; + } + + export type InstanceResolver< + R = Maybe, + Parent = CloudFields, + TContext = SiemContext + > = Resolver; + export type MachineResolver< + R = Maybe, + Parent = CloudFields, + TContext = SiemContext + > = Resolver; + export type ProviderResolver< + R = Maybe<(Maybe)[]>, + Parent = CloudFields, + TContext = SiemContext + > = Resolver; + export type RegionResolver< + R = Maybe<(Maybe)[]>, + Parent = CloudFields, + TContext = SiemContext + > = Resolver; +} + +export namespace CloudInstanceResolvers { + export interface Resolvers { + id?: IdResolver)[]>, TypeParent, TContext>; + } + + export type IdResolver< + R = Maybe<(Maybe)[]>, + Parent = CloudInstance, + TContext = SiemContext + > = Resolver; +} + +export namespace CloudMachineResolvers { + export interface Resolvers { + type?: TypeResolver)[]>, TypeParent, TContext>; + } + + export type TypeResolver< + R = Maybe<(Maybe)[]>, + Parent = CloudMachine, + TContext = SiemContext + > = Resolver; +} + +export namespace FirstLastSeenHostResolvers { + export interface Resolvers { + inspect?: InspectResolver, TypeParent, TContext>; + + firstSeen?: FirstSeenResolver, TypeParent, TContext>; + + lastSeen?: LastSeenResolver, TypeParent, TContext>; + } + + export type InspectResolver< + R = Maybe, + Parent = FirstLastSeenHost, + TContext = SiemContext + > = Resolver; + export type FirstSeenResolver< + R = Maybe, + Parent = FirstLastSeenHost, + TContext = SiemContext + > = Resolver; + export type LastSeenResolver< + R = Maybe, + Parent = FirstLastSeenHost, + TContext = SiemContext + > = Resolver; +} + +export namespace IpOverviewDataResolvers { + export interface Resolvers { + client?: ClientResolver, TypeParent, TContext>; + + destination?: DestinationResolver, TypeParent, TContext>; + + host?: HostResolver; + + server?: ServerResolver, TypeParent, TContext>; + + source?: SourceResolver, TypeParent, TContext>; + + inspect?: InspectResolver, TypeParent, TContext>; + } + + export type ClientResolver< + R = Maybe, + Parent = IpOverviewData, + TContext = SiemContext + > = Resolver; + export type DestinationResolver< + R = Maybe, + Parent = IpOverviewData, + TContext = SiemContext + > = Resolver; + export type HostResolver< + R = HostEcsFields, + Parent = IpOverviewData, + TContext = SiemContext + > = Resolver; + export type ServerResolver< + R = Maybe, + Parent = IpOverviewData, + TContext = SiemContext + > = Resolver; + export type SourceResolver< + R = Maybe, + Parent = IpOverviewData, + TContext = SiemContext + > = Resolver; + export type InspectResolver< + R = Maybe, + Parent = IpOverviewData, + TContext = SiemContext + > = Resolver; +} + +export namespace OverviewResolvers { + export interface Resolvers { + firstSeen?: FirstSeenResolver, TypeParent, TContext>; + + lastSeen?: LastSeenResolver, TypeParent, TContext>; + + autonomousSystem?: AutonomousSystemResolver; + + geo?: GeoResolver; + } + + export type FirstSeenResolver< + R = Maybe, + Parent = Overview, + TContext = SiemContext + > = Resolver; + export type LastSeenResolver< + R = Maybe, + Parent = Overview, + TContext = SiemContext + > = Resolver; + export type AutonomousSystemResolver< + R = AutonomousSystem, + Parent = Overview, + TContext = SiemContext + > = Resolver; + export type GeoResolver = Resolver< + R, + Parent, + TContext + >; +} + +export namespace AutonomousSystemResolvers { + export interface Resolvers { + number?: NumberResolver, TypeParent, TContext>; + + organization?: OrganizationResolver, TypeParent, TContext>; + } + + export type NumberResolver< + R = Maybe, + Parent = AutonomousSystem, + TContext = SiemContext + > = Resolver; + export type OrganizationResolver< + R = Maybe, + Parent = AutonomousSystem, + TContext = SiemContext + > = Resolver; +} + +export namespace AutonomousSystemOrganizationResolvers { + export interface Resolvers { + name?: NameResolver, TypeParent, TContext>; + } + + export type NameResolver< + R = Maybe, + Parent = AutonomousSystemOrganization, + TContext = SiemContext + > = Resolver; +} + +export namespace UsersDataResolvers { + export interface Resolvers { + edges?: EdgesResolver; + + totalCount?: TotalCountResolver; + + pageInfo?: PageInfoResolver; + + inspect?: InspectResolver, TypeParent, TContext>; + } + + export type EdgesResolver< + R = UsersEdges[], + Parent = UsersData, + TContext = SiemContext + > = Resolver; + export type TotalCountResolver = Resolver< + R, + Parent, + TContext + >; + export type PageInfoResolver< + R = PageInfoPaginated, + Parent = UsersData, + TContext = SiemContext + > = Resolver; + export type InspectResolver< + R = Maybe, + Parent = UsersData, + TContext = SiemContext + > = Resolver; +} + +export namespace UsersEdgesResolvers { + export interface Resolvers { + node?: NodeResolver; + + cursor?: CursorResolver; + } + + export type NodeResolver = Resolver< + R, + Parent, + TContext + >; + export type CursorResolver< + R = CursorType, + Parent = UsersEdges, + TContext = SiemContext + > = Resolver; +} + +export namespace UsersNodeResolvers { + export interface Resolvers { + _id?: _IdResolver, TypeParent, TContext>; + + timestamp?: TimestampResolver, TypeParent, TContext>; + + user?: UserResolver, TypeParent, TContext>; + } + + export type _IdResolver, Parent = UsersNode, TContext = SiemContext> = Resolver< + R, + Parent, + TContext + >; + export type TimestampResolver< + R = Maybe, + Parent = UsersNode, + TContext = SiemContext + > = Resolver; + export type UserResolver< + R = Maybe, + Parent = UsersNode, + TContext = SiemContext + > = Resolver; +} + +export namespace UsersItemResolvers { + export interface Resolvers { + name?: NameResolver, TypeParent, TContext>; + + id?: IdResolver, TypeParent, TContext>; + + groupId?: GroupIdResolver, TypeParent, TContext>; + + groupName?: GroupNameResolver, TypeParent, TContext>; + + count?: CountResolver, TypeParent, TContext>; + } + + export type NameResolver< + R = Maybe, + Parent = UsersItem, + TContext = SiemContext + > = Resolver; + export type IdResolver< + R = Maybe, + Parent = UsersItem, + TContext = SiemContext + > = Resolver; + export type GroupIdResolver< + R = Maybe, + Parent = UsersItem, + TContext = SiemContext + > = Resolver; + export type GroupNameResolver< + R = Maybe, + Parent = UsersItem, + TContext = SiemContext + > = Resolver; + export type CountResolver< + R = Maybe, + Parent = UsersItem, + TContext = SiemContext + > = Resolver; +} + +export namespace KpiNetworkDataResolvers { + export interface Resolvers { + networkEvents?: NetworkEventsResolver, TypeParent, TContext>; + + uniqueFlowId?: UniqueFlowIdResolver, TypeParent, TContext>; + + uniqueSourcePrivateIps?: UniqueSourcePrivateIpsResolver, TypeParent, TContext>; + + uniqueSourcePrivateIpsHistogram?: UniqueSourcePrivateIpsHistogramResolver< + Maybe, + TypeParent, + TContext + >; + + uniqueDestinationPrivateIps?: UniqueDestinationPrivateIpsResolver< + Maybe, + TypeParent, + TContext + >; + + uniqueDestinationPrivateIpsHistogram?: UniqueDestinationPrivateIpsHistogramResolver< + Maybe, + TypeParent, + TContext + >; + + dnsQueries?: DnsQueriesResolver, TypeParent, TContext>; + + tlsHandshakes?: TlsHandshakesResolver, TypeParent, TContext>; + + inspect?: InspectResolver, TypeParent, TContext>; + } + + export type NetworkEventsResolver< + R = Maybe, + Parent = KpiNetworkData, + TContext = SiemContext + > = Resolver; + export type UniqueFlowIdResolver< + R = Maybe, + Parent = KpiNetworkData, + TContext = SiemContext + > = Resolver; + export type UniqueSourcePrivateIpsResolver< + R = Maybe, + Parent = KpiNetworkData, + TContext = SiemContext + > = Resolver; + export type UniqueSourcePrivateIpsHistogramResolver< + R = Maybe, + Parent = KpiNetworkData, + TContext = SiemContext + > = Resolver; + export type UniqueDestinationPrivateIpsResolver< + R = Maybe, + Parent = KpiNetworkData, + TContext = SiemContext + > = Resolver; + export type UniqueDestinationPrivateIpsHistogramResolver< + R = Maybe, + Parent = KpiNetworkData, + TContext = SiemContext + > = Resolver; + export type DnsQueriesResolver< + R = Maybe, + Parent = KpiNetworkData, + TContext = SiemContext + > = Resolver; + export type TlsHandshakesResolver< + R = Maybe, + Parent = KpiNetworkData, + TContext = SiemContext + > = Resolver; + export type InspectResolver< + R = Maybe, + Parent = KpiNetworkData, + TContext = SiemContext + > = Resolver; +} + +export namespace KpiNetworkHistogramDataResolvers { + export interface Resolvers { + x?: XResolver, TypeParent, TContext>; + + y?: YResolver, TypeParent, TContext>; + } + + export type XResolver< + R = Maybe, + Parent = KpiNetworkHistogramData, + TContext = SiemContext + > = Resolver; + export type YResolver< + R = Maybe, + Parent = KpiNetworkHistogramData, + TContext = SiemContext + > = Resolver; +} + +export namespace KpiHostsDataResolvers { + export interface Resolvers { + hosts?: HostsResolver, TypeParent, TContext>; + + hostsHistogram?: HostsHistogramResolver, TypeParent, TContext>; + + authSuccess?: AuthSuccessResolver, TypeParent, TContext>; + + authSuccessHistogram?: AuthSuccessHistogramResolver< + Maybe, + TypeParent, + TContext + >; + + authFailure?: AuthFailureResolver, TypeParent, TContext>; + + authFailureHistogram?: AuthFailureHistogramResolver< + Maybe, + TypeParent, + TContext + >; + + uniqueSourceIps?: UniqueSourceIpsResolver, TypeParent, TContext>; + + uniqueSourceIpsHistogram?: UniqueSourceIpsHistogramResolver< + Maybe, + TypeParent, + TContext + >; + + uniqueDestinationIps?: UniqueDestinationIpsResolver, TypeParent, TContext>; + + uniqueDestinationIpsHistogram?: UniqueDestinationIpsHistogramResolver< + Maybe, + TypeParent, + TContext + >; + + inspect?: InspectResolver, TypeParent, TContext>; + } + + export type HostsResolver< + R = Maybe, + Parent = KpiHostsData, + TContext = SiemContext + > = Resolver; + export type HostsHistogramResolver< + R = Maybe, + Parent = KpiHostsData, + TContext = SiemContext + > = Resolver; + export type AuthSuccessResolver< + R = Maybe, + Parent = KpiHostsData, + TContext = SiemContext + > = Resolver; + export type AuthSuccessHistogramResolver< + R = Maybe, + Parent = KpiHostsData, + TContext = SiemContext + > = Resolver; + export type AuthFailureResolver< + R = Maybe, + Parent = KpiHostsData, + TContext = SiemContext + > = Resolver; + export type AuthFailureHistogramResolver< + R = Maybe, + Parent = KpiHostsData, + TContext = SiemContext + > = Resolver; + export type UniqueSourceIpsResolver< + R = Maybe, + Parent = KpiHostsData, + TContext = SiemContext + > = Resolver; + export type UniqueSourceIpsHistogramResolver< + R = Maybe, + Parent = KpiHostsData, + TContext = SiemContext + > = Resolver; + export type UniqueDestinationIpsResolver< + R = Maybe, + Parent = KpiHostsData, + TContext = SiemContext + > = Resolver; + export type UniqueDestinationIpsHistogramResolver< + R = Maybe, + Parent = KpiHostsData, + TContext = SiemContext + > = Resolver; + export type InspectResolver< + R = Maybe, + Parent = KpiHostsData, + TContext = SiemContext + > = Resolver; +} + +export namespace KpiHostHistogramDataResolvers { + export interface Resolvers { + x?: XResolver, TypeParent, TContext>; + + y?: YResolver, TypeParent, TContext>; + } + + export type XResolver< + R = Maybe, + Parent = KpiHostHistogramData, + TContext = SiemContext + > = Resolver; + export type YResolver< + R = Maybe, + Parent = KpiHostHistogramData, + TContext = SiemContext + > = Resolver; +} + +export namespace KpiHostDetailsDataResolvers { + export interface Resolvers { + authSuccess?: AuthSuccessResolver, TypeParent, TContext>; + + authSuccessHistogram?: AuthSuccessHistogramResolver< + Maybe, + TypeParent, + TContext + >; + + authFailure?: AuthFailureResolver, TypeParent, TContext>; + + authFailureHistogram?: AuthFailureHistogramResolver< + Maybe, + TypeParent, + TContext + >; + + uniqueSourceIps?: UniqueSourceIpsResolver, TypeParent, TContext>; + + uniqueSourceIpsHistogram?: UniqueSourceIpsHistogramResolver< + Maybe, + TypeParent, + TContext + >; + + uniqueDestinationIps?: UniqueDestinationIpsResolver, TypeParent, TContext>; + + uniqueDestinationIpsHistogram?: UniqueDestinationIpsHistogramResolver< + Maybe, + TypeParent, + TContext + >; + + inspect?: InspectResolver, TypeParent, TContext>; + } + + export type AuthSuccessResolver< + R = Maybe, + Parent = KpiHostDetailsData, + TContext = SiemContext + > = Resolver; + export type AuthSuccessHistogramResolver< + R = Maybe, + Parent = KpiHostDetailsData, + TContext = SiemContext + > = Resolver; + export type AuthFailureResolver< + R = Maybe, + Parent = KpiHostDetailsData, + TContext = SiemContext + > = Resolver; + export type AuthFailureHistogramResolver< + R = Maybe, + Parent = KpiHostDetailsData, + TContext = SiemContext + > = Resolver; + export type UniqueSourceIpsResolver< + R = Maybe, + Parent = KpiHostDetailsData, + TContext = SiemContext + > = Resolver; + export type UniqueSourceIpsHistogramResolver< + R = Maybe, + Parent = KpiHostDetailsData, + TContext = SiemContext + > = Resolver; + export type UniqueDestinationIpsResolver< + R = Maybe, + Parent = KpiHostDetailsData, + TContext = SiemContext + > = Resolver; + export type UniqueDestinationIpsHistogramResolver< + R = Maybe, + Parent = KpiHostDetailsData, + TContext = SiemContext + > = Resolver; + export type InspectResolver< + R = Maybe, + Parent = KpiHostDetailsData, + TContext = SiemContext + > = Resolver; +} + +export namespace MatrixHistogramOverTimeDataResolvers { + export interface Resolvers { + inspect?: InspectResolver, TypeParent, TContext>; + + matrixHistogramData?: MatrixHistogramDataResolver< + MatrixOverTimeHistogramData[], + TypeParent, + TContext + >; + + totalCount?: TotalCountResolver; + } + + export type InspectResolver< + R = Maybe, + Parent = MatrixHistogramOverTimeData, + TContext = SiemContext + > = Resolver; + export type MatrixHistogramDataResolver< + R = MatrixOverTimeHistogramData[], + Parent = MatrixHistogramOverTimeData, + TContext = SiemContext + > = Resolver; + export type TotalCountResolver< + R = number, + Parent = MatrixHistogramOverTimeData, + TContext = SiemContext + > = Resolver; +} + +export namespace MatrixOverTimeHistogramDataResolvers { + export interface Resolvers { + x?: XResolver, TypeParent, TContext>; + + y?: YResolver, TypeParent, TContext>; + + g?: GResolver, TypeParent, TContext>; + } + + export type XResolver< + R = Maybe, + Parent = MatrixOverTimeHistogramData, + TContext = SiemContext + > = Resolver; + export type YResolver< + R = Maybe, + Parent = MatrixOverTimeHistogramData, + TContext = SiemContext + > = Resolver; + export type GResolver< + R = Maybe, + Parent = MatrixOverTimeHistogramData, + TContext = SiemContext + > = Resolver; +} + +export namespace NetworkTopCountriesDataResolvers { + export interface Resolvers { + edges?: EdgesResolver; + + totalCount?: TotalCountResolver; + + pageInfo?: PageInfoResolver; + + inspect?: InspectResolver, TypeParent, TContext>; + } + + export type EdgesResolver< + R = NetworkTopCountriesEdges[], + Parent = NetworkTopCountriesData, + TContext = SiemContext + > = Resolver; + export type TotalCountResolver< + R = number, + Parent = NetworkTopCountriesData, + TContext = SiemContext + > = Resolver; + export type PageInfoResolver< + R = PageInfoPaginated, + Parent = NetworkTopCountriesData, + TContext = SiemContext + > = Resolver; + export type InspectResolver< + R = Maybe, + Parent = NetworkTopCountriesData, + TContext = SiemContext + > = Resolver; +} + +export namespace NetworkTopCountriesEdgesResolvers { + export interface Resolvers { + node?: NodeResolver; + + cursor?: CursorResolver; + } + + export type NodeResolver< + R = NetworkTopCountriesItem, + Parent = NetworkTopCountriesEdges, + TContext = SiemContext + > = Resolver; + export type CursorResolver< + R = CursorType, + Parent = NetworkTopCountriesEdges, + TContext = SiemContext + > = Resolver; +} + +export namespace NetworkTopCountriesItemResolvers { + export interface Resolvers { + _id?: _IdResolver, TypeParent, TContext>; + + source?: SourceResolver, TypeParent, TContext>; + + destination?: DestinationResolver, TypeParent, TContext>; + + network?: NetworkResolver, TypeParent, TContext>; + } + + export type _IdResolver< + R = Maybe, + Parent = NetworkTopCountriesItem, + TContext = SiemContext + > = Resolver; + export type SourceResolver< + R = Maybe, + Parent = NetworkTopCountriesItem, + TContext = SiemContext + > = Resolver; + export type DestinationResolver< + R = Maybe, + Parent = NetworkTopCountriesItem, + TContext = SiemContext + > = Resolver; + export type NetworkResolver< + R = Maybe, + Parent = NetworkTopCountriesItem, + TContext = SiemContext + > = Resolver; +} + +export namespace TopCountriesItemSourceResolvers { + export interface Resolvers { + country?: CountryResolver, TypeParent, TContext>; + + destination_ips?: DestinationIpsResolver, TypeParent, TContext>; + + flows?: FlowsResolver, TypeParent, TContext>; + + location?: LocationResolver, TypeParent, TContext>; + + source_ips?: SourceIpsResolver, TypeParent, TContext>; + } + + export type CountryResolver< + R = Maybe, + Parent = TopCountriesItemSource, + TContext = SiemContext + > = Resolver; + export type DestinationIpsResolver< + R = Maybe, + Parent = TopCountriesItemSource, + TContext = SiemContext + > = Resolver; + export type FlowsResolver< + R = Maybe, + Parent = TopCountriesItemSource, + TContext = SiemContext + > = Resolver; + export type LocationResolver< + R = Maybe, + Parent = TopCountriesItemSource, + TContext = SiemContext + > = Resolver; + export type SourceIpsResolver< + R = Maybe, + Parent = TopCountriesItemSource, + TContext = SiemContext + > = Resolver; +} + +export namespace GeoItemResolvers { + export interface Resolvers { + geo?: GeoResolver, TypeParent, TContext>; + + flowTarget?: FlowTargetResolver, TypeParent, TContext>; + } + + export type GeoResolver< + R = Maybe, + Parent = GeoItem, + TContext = SiemContext + > = Resolver; + export type FlowTargetResolver< + R = Maybe, + Parent = GeoItem, + TContext = SiemContext + > = Resolver; +} + +export namespace TopCountriesItemDestinationResolvers { + export interface Resolvers { + country?: CountryResolver, TypeParent, TContext>; + + destination_ips?: DestinationIpsResolver, TypeParent, TContext>; + + flows?: FlowsResolver, TypeParent, TContext>; + + location?: LocationResolver, TypeParent, TContext>; + + source_ips?: SourceIpsResolver, TypeParent, TContext>; + } + + export type CountryResolver< + R = Maybe, + Parent = TopCountriesItemDestination, + TContext = SiemContext + > = Resolver; + export type DestinationIpsResolver< + R = Maybe, + Parent = TopCountriesItemDestination, + TContext = SiemContext + > = Resolver; + export type FlowsResolver< + R = Maybe, + Parent = TopCountriesItemDestination, + TContext = SiemContext + > = Resolver; + export type LocationResolver< + R = Maybe, + Parent = TopCountriesItemDestination, + TContext = SiemContext + > = Resolver; + export type SourceIpsResolver< + R = Maybe, + Parent = TopCountriesItemDestination, + TContext = SiemContext + > = Resolver; +} + +export namespace TopNetworkTablesEcsFieldResolvers { + export interface Resolvers { + bytes_in?: BytesInResolver, TypeParent, TContext>; + + bytes_out?: BytesOutResolver, TypeParent, TContext>; + } + + export type BytesInResolver< + R = Maybe, + Parent = TopNetworkTablesEcsField, + TContext = SiemContext + > = Resolver; + export type BytesOutResolver< + R = Maybe, + Parent = TopNetworkTablesEcsField, + TContext = SiemContext + > = Resolver; +} + +export namespace NetworkTopNFlowDataResolvers { + export interface Resolvers { + edges?: EdgesResolver; + + totalCount?: TotalCountResolver; + + pageInfo?: PageInfoResolver; + + inspect?: InspectResolver, TypeParent, TContext>; + } + + export type EdgesResolver< + R = NetworkTopNFlowEdges[], + Parent = NetworkTopNFlowData, + TContext = SiemContext + > = Resolver; + export type TotalCountResolver< + R = number, + Parent = NetworkTopNFlowData, + TContext = SiemContext + > = Resolver; + export type PageInfoResolver< + R = PageInfoPaginated, + Parent = NetworkTopNFlowData, + TContext = SiemContext + > = Resolver; + export type InspectResolver< + R = Maybe, + Parent = NetworkTopNFlowData, + TContext = SiemContext + > = Resolver; +} + +export namespace NetworkTopNFlowEdgesResolvers { + export interface Resolvers { + node?: NodeResolver; + + cursor?: CursorResolver; + } + + export type NodeResolver< + R = NetworkTopNFlowItem, + Parent = NetworkTopNFlowEdges, + TContext = SiemContext + > = Resolver; + export type CursorResolver< + R = CursorType, + Parent = NetworkTopNFlowEdges, + TContext = SiemContext + > = Resolver; +} + +export namespace NetworkTopNFlowItemResolvers { + export interface Resolvers { + _id?: _IdResolver, TypeParent, TContext>; + + source?: SourceResolver, TypeParent, TContext>; + + destination?: DestinationResolver, TypeParent, TContext>; + + network?: NetworkResolver, TypeParent, TContext>; + } + + export type _IdResolver< + R = Maybe, + Parent = NetworkTopNFlowItem, + TContext = SiemContext + > = Resolver; + export type SourceResolver< + R = Maybe, + Parent = NetworkTopNFlowItem, + TContext = SiemContext + > = Resolver; + export type DestinationResolver< + R = Maybe, + Parent = NetworkTopNFlowItem, + TContext = SiemContext + > = Resolver; + export type NetworkResolver< + R = Maybe, + Parent = NetworkTopNFlowItem, + TContext = SiemContext + > = Resolver; +} + +export namespace TopNFlowItemSourceResolvers { + export interface Resolvers { + autonomous_system?: AutonomousSystemResolver, TypeParent, TContext>; + + domain?: DomainResolver, TypeParent, TContext>; + + ip?: IpResolver, TypeParent, TContext>; + + location?: LocationResolver, TypeParent, TContext>; + + flows?: FlowsResolver, TypeParent, TContext>; + + destination_ips?: DestinationIpsResolver, TypeParent, TContext>; + } + + export type AutonomousSystemResolver< + R = Maybe, + Parent = TopNFlowItemSource, + TContext = SiemContext + > = Resolver; + export type DomainResolver< + R = Maybe, + Parent = TopNFlowItemSource, + TContext = SiemContext + > = Resolver; + export type IpResolver< + R = Maybe, + Parent = TopNFlowItemSource, + TContext = SiemContext + > = Resolver; + export type LocationResolver< + R = Maybe, + Parent = TopNFlowItemSource, + TContext = SiemContext + > = Resolver; + export type FlowsResolver< + R = Maybe, + Parent = TopNFlowItemSource, + TContext = SiemContext + > = Resolver; + export type DestinationIpsResolver< + R = Maybe, + Parent = TopNFlowItemSource, + TContext = SiemContext + > = Resolver; +} + +export namespace AutonomousSystemItemResolvers { + export interface Resolvers { + name?: NameResolver, TypeParent, TContext>; + + number?: NumberResolver, TypeParent, TContext>; + } + + export type NameResolver< + R = Maybe, + Parent = AutonomousSystemItem, + TContext = SiemContext + > = Resolver; + export type NumberResolver< + R = Maybe, + Parent = AutonomousSystemItem, + TContext = SiemContext + > = Resolver; +} + +export namespace TopNFlowItemDestinationResolvers { + export interface Resolvers { + autonomous_system?: AutonomousSystemResolver, TypeParent, TContext>; + + domain?: DomainResolver, TypeParent, TContext>; + + ip?: IpResolver, TypeParent, TContext>; + + location?: LocationResolver, TypeParent, TContext>; + + flows?: FlowsResolver, TypeParent, TContext>; + + source_ips?: SourceIpsResolver, TypeParent, TContext>; + } + + export type AutonomousSystemResolver< + R = Maybe, + Parent = TopNFlowItemDestination, + TContext = SiemContext + > = Resolver; + export type DomainResolver< + R = Maybe, + Parent = TopNFlowItemDestination, + TContext = SiemContext + > = Resolver; + export type IpResolver< + R = Maybe, + Parent = TopNFlowItemDestination, + TContext = SiemContext + > = Resolver; + export type LocationResolver< + R = Maybe, + Parent = TopNFlowItemDestination, + TContext = SiemContext + > = Resolver; + export type FlowsResolver< + R = Maybe, + Parent = TopNFlowItemDestination, + TContext = SiemContext + > = Resolver; + export type SourceIpsResolver< + R = Maybe, + Parent = TopNFlowItemDestination, + TContext = SiemContext + > = Resolver; +} + +export namespace NetworkDnsDataResolvers { + export interface Resolvers { + edges?: EdgesResolver; + + totalCount?: TotalCountResolver; + + pageInfo?: PageInfoResolver; + + inspect?: InspectResolver, TypeParent, TContext>; + + histogram?: HistogramResolver, TypeParent, TContext>; + } + + export type EdgesResolver< + R = NetworkDnsEdges[], + Parent = NetworkDnsData, + TContext = SiemContext + > = Resolver; + export type TotalCountResolver< + R = number, + Parent = NetworkDnsData, + TContext = SiemContext + > = Resolver; + export type PageInfoResolver< + R = PageInfoPaginated, + Parent = NetworkDnsData, + TContext = SiemContext + > = Resolver; + export type InspectResolver< + R = Maybe, + Parent = NetworkDnsData, + TContext = SiemContext + > = Resolver; + export type HistogramResolver< + R = Maybe, + Parent = NetworkDnsData, + TContext = SiemContext + > = Resolver; +} + +export namespace NetworkDnsEdgesResolvers { + export interface Resolvers { + node?: NodeResolver; + + cursor?: CursorResolver; + } + + export type NodeResolver< + R = NetworkDnsItem, + Parent = NetworkDnsEdges, + TContext = SiemContext + > = Resolver; + export type CursorResolver< + R = CursorType, + Parent = NetworkDnsEdges, + TContext = SiemContext + > = Resolver; +} + +export namespace NetworkDnsItemResolvers { + export interface Resolvers { + _id?: _IdResolver, TypeParent, TContext>; + + dnsBytesIn?: DnsBytesInResolver, TypeParent, TContext>; + + dnsBytesOut?: DnsBytesOutResolver, TypeParent, TContext>; + + dnsName?: DnsNameResolver, TypeParent, TContext>; + + queryCount?: QueryCountResolver, TypeParent, TContext>; + + uniqueDomains?: UniqueDomainsResolver, TypeParent, TContext>; + } + + export type _IdResolver< + R = Maybe, + Parent = NetworkDnsItem, + TContext = SiemContext + > = Resolver; + export type DnsBytesInResolver< + R = Maybe, + Parent = NetworkDnsItem, + TContext = SiemContext + > = Resolver; + export type DnsBytesOutResolver< + R = Maybe, + Parent = NetworkDnsItem, + TContext = SiemContext + > = Resolver; + export type DnsNameResolver< + R = Maybe, + Parent = NetworkDnsItem, + TContext = SiemContext + > = Resolver; + export type QueryCountResolver< + R = Maybe, + Parent = NetworkDnsItem, + TContext = SiemContext + > = Resolver; + export type UniqueDomainsResolver< + R = Maybe, + Parent = NetworkDnsItem, + TContext = SiemContext + > = Resolver; +} + +export namespace MatrixOverOrdinalHistogramDataResolvers { + export interface Resolvers { + x?: XResolver; + + y?: YResolver; + + g?: GResolver; + } + + export type XResolver< + R = string, + Parent = MatrixOverOrdinalHistogramData, + TContext = SiemContext + > = Resolver; + export type YResolver< + R = number, + Parent = MatrixOverOrdinalHistogramData, + TContext = SiemContext + > = Resolver; + export type GResolver< + R = string, + Parent = MatrixOverOrdinalHistogramData, + TContext = SiemContext + > = Resolver; +} + +export namespace NetworkDsOverTimeDataResolvers { + export interface Resolvers { + inspect?: InspectResolver, TypeParent, TContext>; + + matrixHistogramData?: MatrixHistogramDataResolver< + MatrixOverTimeHistogramData[], + TypeParent, + TContext + >; + + totalCount?: TotalCountResolver; + } + + export type InspectResolver< + R = Maybe, + Parent = NetworkDsOverTimeData, + TContext = SiemContext + > = Resolver; + export type MatrixHistogramDataResolver< + R = MatrixOverTimeHistogramData[], + Parent = NetworkDsOverTimeData, + TContext = SiemContext + > = Resolver; + export type TotalCountResolver< + R = number, + Parent = NetworkDsOverTimeData, + TContext = SiemContext + > = Resolver; +} + +export namespace NetworkHttpDataResolvers { + export interface Resolvers { + edges?: EdgesResolver; + + totalCount?: TotalCountResolver; + + pageInfo?: PageInfoResolver; + + inspect?: InspectResolver, TypeParent, TContext>; + } + + export type EdgesResolver< + R = NetworkHttpEdges[], + Parent = NetworkHttpData, + TContext = SiemContext + > = Resolver; + export type TotalCountResolver< + R = number, + Parent = NetworkHttpData, + TContext = SiemContext + > = Resolver; + export type PageInfoResolver< + R = PageInfoPaginated, + Parent = NetworkHttpData, + TContext = SiemContext + > = Resolver; + export type InspectResolver< + R = Maybe, + Parent = NetworkHttpData, + TContext = SiemContext + > = Resolver; +} + +export namespace NetworkHttpEdgesResolvers { + export interface Resolvers { + node?: NodeResolver; + + cursor?: CursorResolver; + } + + export type NodeResolver< + R = NetworkHttpItem, + Parent = NetworkHttpEdges, + TContext = SiemContext + > = Resolver; + export type CursorResolver< + R = CursorType, + Parent = NetworkHttpEdges, + TContext = SiemContext + > = Resolver; +} + +export namespace NetworkHttpItemResolvers { + export interface Resolvers { + _id?: _IdResolver, TypeParent, TContext>; + + domains?: DomainsResolver; + + lastHost?: LastHostResolver, TypeParent, TContext>; + + lastSourceIp?: LastSourceIpResolver, TypeParent, TContext>; + + methods?: MethodsResolver; + + path?: PathResolver, TypeParent, TContext>; + + requestCount?: RequestCountResolver, TypeParent, TContext>; + + statuses?: StatusesResolver; + } + + export type _IdResolver< + R = Maybe, + Parent = NetworkHttpItem, + TContext = SiemContext + > = Resolver; + export type DomainsResolver< + R = string[], + Parent = NetworkHttpItem, + TContext = SiemContext + > = Resolver; + export type LastHostResolver< + R = Maybe, + Parent = NetworkHttpItem, + TContext = SiemContext + > = Resolver; + export type LastSourceIpResolver< + R = Maybe, + Parent = NetworkHttpItem, + TContext = SiemContext + > = Resolver; + export type MethodsResolver< + R = string[], + Parent = NetworkHttpItem, + TContext = SiemContext + > = Resolver; + export type PathResolver< + R = Maybe, + Parent = NetworkHttpItem, + TContext = SiemContext + > = Resolver; + export type RequestCountResolver< + R = Maybe, + Parent = NetworkHttpItem, + TContext = SiemContext + > = Resolver; + export type StatusesResolver< + R = string[], + Parent = NetworkHttpItem, + TContext = SiemContext + > = Resolver; +} + +export namespace OverviewNetworkDataResolvers { + export interface Resolvers { + auditbeatSocket?: AuditbeatSocketResolver, TypeParent, TContext>; + + filebeatCisco?: FilebeatCiscoResolver, TypeParent, TContext>; + + filebeatNetflow?: FilebeatNetflowResolver, TypeParent, TContext>; + + filebeatPanw?: FilebeatPanwResolver, TypeParent, TContext>; + + filebeatSuricata?: FilebeatSuricataResolver, TypeParent, TContext>; + + filebeatZeek?: FilebeatZeekResolver, TypeParent, TContext>; + + packetbeatDNS?: PacketbeatDnsResolver, TypeParent, TContext>; + + packetbeatFlow?: PacketbeatFlowResolver, TypeParent, TContext>; + + packetbeatTLS?: PacketbeatTlsResolver, TypeParent, TContext>; + + inspect?: InspectResolver, TypeParent, TContext>; + } + + export type AuditbeatSocketResolver< + R = Maybe, + Parent = OverviewNetworkData, + TContext = SiemContext + > = Resolver; + export type FilebeatCiscoResolver< + R = Maybe, + Parent = OverviewNetworkData, + TContext = SiemContext + > = Resolver; + export type FilebeatNetflowResolver< + R = Maybe, + Parent = OverviewNetworkData, + TContext = SiemContext + > = Resolver; + export type FilebeatPanwResolver< + R = Maybe, + Parent = OverviewNetworkData, + TContext = SiemContext + > = Resolver; + export type FilebeatSuricataResolver< + R = Maybe, + Parent = OverviewNetworkData, + TContext = SiemContext + > = Resolver; + export type FilebeatZeekResolver< + R = Maybe, + Parent = OverviewNetworkData, + TContext = SiemContext + > = Resolver; + export type PacketbeatDnsResolver< + R = Maybe, + Parent = OverviewNetworkData, + TContext = SiemContext + > = Resolver; + export type PacketbeatFlowResolver< + R = Maybe, + Parent = OverviewNetworkData, + TContext = SiemContext + > = Resolver; + export type PacketbeatTlsResolver< + R = Maybe, + Parent = OverviewNetworkData, + TContext = SiemContext + > = Resolver; + export type InspectResolver< + R = Maybe, + Parent = OverviewNetworkData, + TContext = SiemContext + > = Resolver; +} + +export namespace OverviewHostDataResolvers { + export interface Resolvers { + auditbeatAuditd?: AuditbeatAuditdResolver, TypeParent, TContext>; + + auditbeatFIM?: AuditbeatFimResolver, TypeParent, TContext>; + + auditbeatLogin?: AuditbeatLoginResolver, TypeParent, TContext>; + + auditbeatPackage?: AuditbeatPackageResolver, TypeParent, TContext>; + + auditbeatProcess?: AuditbeatProcessResolver, TypeParent, TContext>; + + auditbeatUser?: AuditbeatUserResolver, TypeParent, TContext>; + + endgameDns?: EndgameDnsResolver, TypeParent, TContext>; + + endgameFile?: EndgameFileResolver, TypeParent, TContext>; + + endgameImageLoad?: EndgameImageLoadResolver, TypeParent, TContext>; + + endgameNetwork?: EndgameNetworkResolver, TypeParent, TContext>; + + endgameProcess?: EndgameProcessResolver, TypeParent, TContext>; + + endgameRegistry?: EndgameRegistryResolver, TypeParent, TContext>; + + endgameSecurity?: EndgameSecurityResolver, TypeParent, TContext>; + + filebeatSystemModule?: FilebeatSystemModuleResolver, TypeParent, TContext>; + + winlogbeatSecurity?: WinlogbeatSecurityResolver, TypeParent, TContext>; + + winlogbeatMWSysmonOperational?: WinlogbeatMwSysmonOperationalResolver< + Maybe, + TypeParent, + TContext + >; + + inspect?: InspectResolver, TypeParent, TContext>; + } + + export type AuditbeatAuditdResolver< + R = Maybe, + Parent = OverviewHostData, + TContext = SiemContext + > = Resolver; + export type AuditbeatFimResolver< + R = Maybe, + Parent = OverviewHostData, + TContext = SiemContext + > = Resolver; + export type AuditbeatLoginResolver< + R = Maybe, + Parent = OverviewHostData, + TContext = SiemContext + > = Resolver; + export type AuditbeatPackageResolver< + R = Maybe, + Parent = OverviewHostData, + TContext = SiemContext + > = Resolver; + export type AuditbeatProcessResolver< + R = Maybe, + Parent = OverviewHostData, + TContext = SiemContext + > = Resolver; + export type AuditbeatUserResolver< + R = Maybe, + Parent = OverviewHostData, + TContext = SiemContext + > = Resolver; + export type EndgameDnsResolver< + R = Maybe, + Parent = OverviewHostData, + TContext = SiemContext + > = Resolver; + export type EndgameFileResolver< + R = Maybe, + Parent = OverviewHostData, + TContext = SiemContext + > = Resolver; + export type EndgameImageLoadResolver< + R = Maybe, + Parent = OverviewHostData, + TContext = SiemContext + > = Resolver; + export type EndgameNetworkResolver< + R = Maybe, + Parent = OverviewHostData, + TContext = SiemContext + > = Resolver; + export type EndgameProcessResolver< + R = Maybe, + Parent = OverviewHostData, + TContext = SiemContext + > = Resolver; + export type EndgameRegistryResolver< + R = Maybe, + Parent = OverviewHostData, + TContext = SiemContext + > = Resolver; + export type EndgameSecurityResolver< + R = Maybe, + Parent = OverviewHostData, + TContext = SiemContext + > = Resolver; + export type FilebeatSystemModuleResolver< + R = Maybe, + Parent = OverviewHostData, + TContext = SiemContext + > = Resolver; + export type WinlogbeatSecurityResolver< + R = Maybe, + Parent = OverviewHostData, + TContext = SiemContext + > = Resolver; + export type WinlogbeatMwSysmonOperationalResolver< + R = Maybe, + Parent = OverviewHostData, + TContext = SiemContext + > = Resolver; + export type InspectResolver< + R = Maybe, + Parent = OverviewHostData, + TContext = SiemContext + > = Resolver; +} + +export namespace TlsDataResolvers { + export interface Resolvers { + edges?: EdgesResolver; + + totalCount?: TotalCountResolver; + + pageInfo?: PageInfoResolver; + + inspect?: InspectResolver, TypeParent, TContext>; + } + + export type EdgesResolver = Resolver< + R, + Parent, + TContext + >; + export type TotalCountResolver = Resolver< + R, + Parent, + TContext + >; + export type PageInfoResolver< + R = PageInfoPaginated, + Parent = TlsData, + TContext = SiemContext + > = Resolver; + export type InspectResolver< + R = Maybe, + Parent = TlsData, + TContext = SiemContext + > = Resolver; +} + +export namespace TlsEdgesResolvers { + export interface Resolvers { + node?: NodeResolver; + + cursor?: CursorResolver; + } + + export type NodeResolver = Resolver< + R, + Parent, + TContext + >; + export type CursorResolver = Resolver< + R, + Parent, + TContext + >; +} + +export namespace TlsNodeResolvers { + export interface Resolvers { + _id?: _IdResolver, TypeParent, TContext>; + + timestamp?: TimestampResolver, TypeParent, TContext>; + + alternativeNames?: AlternativeNamesResolver, TypeParent, TContext>; + + notAfter?: NotAfterResolver, TypeParent, TContext>; + + commonNames?: CommonNamesResolver, TypeParent, TContext>; + + ja3?: Ja3Resolver, TypeParent, TContext>; + + issuerNames?: IssuerNamesResolver, TypeParent, TContext>; + } + + export type _IdResolver, Parent = TlsNode, TContext = SiemContext> = Resolver< + R, + Parent, + TContext + >; + export type TimestampResolver< + R = Maybe, + Parent = TlsNode, + TContext = SiemContext + > = Resolver; + export type AlternativeNamesResolver< + R = Maybe, + Parent = TlsNode, + TContext = SiemContext + > = Resolver; + export type NotAfterResolver< + R = Maybe, + Parent = TlsNode, + TContext = SiemContext + > = Resolver; + export type CommonNamesResolver< + R = Maybe, + Parent = TlsNode, + TContext = SiemContext + > = Resolver; + export type Ja3Resolver, Parent = TlsNode, TContext = SiemContext> = Resolver< + R, + Parent, + TContext + >; + export type IssuerNamesResolver< + R = Maybe, + Parent = TlsNode, + TContext = SiemContext + > = Resolver; +} + +export namespace UncommonProcessesDataResolvers { + export interface Resolvers { + edges?: EdgesResolver; + + totalCount?: TotalCountResolver; + + pageInfo?: PageInfoResolver; + + inspect?: InspectResolver, TypeParent, TContext>; + } + + export type EdgesResolver< + R = UncommonProcessesEdges[], + Parent = UncommonProcessesData, + TContext = SiemContext + > = Resolver; + export type TotalCountResolver< + R = number, + Parent = UncommonProcessesData, + TContext = SiemContext + > = Resolver; + export type PageInfoResolver< + R = PageInfoPaginated, + Parent = UncommonProcessesData, + TContext = SiemContext + > = Resolver; + export type InspectResolver< + R = Maybe, + Parent = UncommonProcessesData, + TContext = SiemContext + > = Resolver; +} + +export namespace UncommonProcessesEdgesResolvers { + export interface Resolvers { + node?: NodeResolver; + + cursor?: CursorResolver; + } + + export type NodeResolver< + R = UncommonProcessItem, + Parent = UncommonProcessesEdges, + TContext = SiemContext + > = Resolver; + export type CursorResolver< + R = CursorType, + Parent = UncommonProcessesEdges, + TContext = SiemContext + > = Resolver; +} + +export namespace UncommonProcessItemResolvers { + export interface Resolvers { + _id?: _IdResolver; + + instances?: InstancesResolver; + + process?: ProcessResolver; + + hosts?: HostsResolver; + + user?: UserResolver, TypeParent, TContext>; + } + + export type _IdResolver< + R = string, + Parent = UncommonProcessItem, + TContext = SiemContext + > = Resolver; + export type InstancesResolver< + R = number, + Parent = UncommonProcessItem, + TContext = SiemContext + > = Resolver; + export type ProcessResolver< + R = ProcessEcsFields, + Parent = UncommonProcessItem, + TContext = SiemContext + > = Resolver; + export type HostsResolver< + R = HostEcsFields[], + Parent = UncommonProcessItem, + TContext = SiemContext + > = Resolver; + export type UserResolver< + R = Maybe, + Parent = UncommonProcessItem, + TContext = SiemContext + > = Resolver; +} + +export namespace SayMyNameResolvers { + export interface Resolvers { + /** The id of the source */ + appName?: AppNameResolver; + } + + export type AppNameResolver = Resolver< + R, + Parent, + TContext + >; +} + +export namespace TimelineResultResolvers { + export interface Resolvers { + columns?: ColumnsResolver, TypeParent, TContext>; + + created?: CreatedResolver, TypeParent, TContext>; + + createdBy?: CreatedByResolver, TypeParent, TContext>; + + dataProviders?: DataProvidersResolver, TypeParent, TContext>; + + dateRange?: DateRangeResolver, TypeParent, TContext>; + + description?: DescriptionResolver, TypeParent, TContext>; + + eventIdToNoteIds?: EventIdToNoteIdsResolver, TypeParent, TContext>; + + eventType?: EventTypeResolver, TypeParent, TContext>; + + favorite?: FavoriteResolver, TypeParent, TContext>; + + filters?: FiltersResolver, TypeParent, TContext>; + + kqlMode?: KqlModeResolver, TypeParent, TContext>; + + kqlQuery?: KqlQueryResolver, TypeParent, TContext>; + + notes?: NotesResolver, TypeParent, TContext>; + + noteIds?: NoteIdsResolver, TypeParent, TContext>; + + pinnedEventIds?: PinnedEventIdsResolver, TypeParent, TContext>; + + pinnedEventsSaveObject?: PinnedEventsSaveObjectResolver< + Maybe, + TypeParent, + TContext + >; + + savedQueryId?: SavedQueryIdResolver, TypeParent, TContext>; + + savedObjectId?: SavedObjectIdResolver; + + sort?: SortResolver, TypeParent, TContext>; + + title?: TitleResolver, TypeParent, TContext>; + + updated?: UpdatedResolver, TypeParent, TContext>; + + updatedBy?: UpdatedByResolver, TypeParent, TContext>; + + version?: VersionResolver; + } + + export type ColumnsResolver< + R = Maybe, + Parent = TimelineResult, + TContext = SiemContext + > = Resolver; + export type CreatedResolver< + R = Maybe, + Parent = TimelineResult, + TContext = SiemContext + > = Resolver; + export type CreatedByResolver< + R = Maybe, + Parent = TimelineResult, + TContext = SiemContext + > = Resolver; + export type DataProvidersResolver< + R = Maybe, + Parent = TimelineResult, + TContext = SiemContext + > = Resolver; + export type DateRangeResolver< + R = Maybe, + Parent = TimelineResult, + TContext = SiemContext + > = Resolver; + export type DescriptionResolver< + R = Maybe, + Parent = TimelineResult, + TContext = SiemContext + > = Resolver; + export type EventIdToNoteIdsResolver< + R = Maybe, + Parent = TimelineResult, + TContext = SiemContext + > = Resolver; + export type EventTypeResolver< + R = Maybe, + Parent = TimelineResult, + TContext = SiemContext + > = Resolver; + export type FavoriteResolver< + R = Maybe, + Parent = TimelineResult, + TContext = SiemContext + > = Resolver; + export type FiltersResolver< + R = Maybe, + Parent = TimelineResult, + TContext = SiemContext + > = Resolver; + export type KqlModeResolver< + R = Maybe, + Parent = TimelineResult, + TContext = SiemContext + > = Resolver; + export type KqlQueryResolver< + R = Maybe, + Parent = TimelineResult, + TContext = SiemContext + > = Resolver; + export type NotesResolver< + R = Maybe, + Parent = TimelineResult, + TContext = SiemContext + > = Resolver; + export type NoteIdsResolver< + R = Maybe, + Parent = TimelineResult, + TContext = SiemContext + > = Resolver; + export type PinnedEventIdsResolver< + R = Maybe, + Parent = TimelineResult, + TContext = SiemContext + > = Resolver; + export type PinnedEventsSaveObjectResolver< + R = Maybe, + Parent = TimelineResult, + TContext = SiemContext + > = Resolver; + export type SavedQueryIdResolver< + R = Maybe, + Parent = TimelineResult, + TContext = SiemContext + > = Resolver; + export type SavedObjectIdResolver< + R = string, + Parent = TimelineResult, + TContext = SiemContext + > = Resolver; + export type SortResolver< + R = Maybe, + Parent = TimelineResult, + TContext = SiemContext + > = Resolver; + export type TitleResolver< + R = Maybe, + Parent = TimelineResult, + TContext = SiemContext + > = Resolver; + export type UpdatedResolver< + R = Maybe, + Parent = TimelineResult, + TContext = SiemContext + > = Resolver; + export type UpdatedByResolver< + R = Maybe, + Parent = TimelineResult, + TContext = SiemContext + > = Resolver; + export type VersionResolver< + R = string, + Parent = TimelineResult, + TContext = SiemContext + > = Resolver; +} + +export namespace ColumnHeaderResultResolvers { + export interface Resolvers { + aggregatable?: AggregatableResolver, TypeParent, TContext>; + + category?: CategoryResolver, TypeParent, TContext>; + + columnHeaderType?: ColumnHeaderTypeResolver, TypeParent, TContext>; + + description?: DescriptionResolver, TypeParent, TContext>; + + example?: ExampleResolver, TypeParent, TContext>; + + indexes?: IndexesResolver, TypeParent, TContext>; + + id?: IdResolver, TypeParent, TContext>; + + name?: NameResolver, TypeParent, TContext>; + + placeholder?: PlaceholderResolver, TypeParent, TContext>; + + searchable?: SearchableResolver, TypeParent, TContext>; + + type?: TypeResolver, TypeParent, TContext>; + } + + export type AggregatableResolver< + R = Maybe, + Parent = ColumnHeaderResult, + TContext = SiemContext + > = Resolver; + export type CategoryResolver< + R = Maybe, + Parent = ColumnHeaderResult, + TContext = SiemContext + > = Resolver; + export type ColumnHeaderTypeResolver< + R = Maybe, + Parent = ColumnHeaderResult, + TContext = SiemContext + > = Resolver; + export type DescriptionResolver< + R = Maybe, + Parent = ColumnHeaderResult, + TContext = SiemContext + > = Resolver; + export type ExampleResolver< + R = Maybe, + Parent = ColumnHeaderResult, + TContext = SiemContext + > = Resolver; + export type IndexesResolver< + R = Maybe, + Parent = ColumnHeaderResult, + TContext = SiemContext + > = Resolver; + export type IdResolver< + R = Maybe, + Parent = ColumnHeaderResult, + TContext = SiemContext + > = Resolver; + export type NameResolver< + R = Maybe, + Parent = ColumnHeaderResult, + TContext = SiemContext + > = Resolver; + export type PlaceholderResolver< + R = Maybe, + Parent = ColumnHeaderResult, + TContext = SiemContext + > = Resolver; + export type SearchableResolver< + R = Maybe, + Parent = ColumnHeaderResult, + TContext = SiemContext + > = Resolver; + export type TypeResolver< + R = Maybe, + Parent = ColumnHeaderResult, + TContext = SiemContext + > = Resolver; +} + +export namespace DataProviderResultResolvers { + export interface Resolvers { + id?: IdResolver, TypeParent, TContext>; + + name?: NameResolver, TypeParent, TContext>; + + enabled?: EnabledResolver, TypeParent, TContext>; + + excluded?: ExcludedResolver, TypeParent, TContext>; + + kqlQuery?: KqlQueryResolver, TypeParent, TContext>; + + queryMatch?: QueryMatchResolver, TypeParent, TContext>; + + and?: AndResolver, TypeParent, TContext>; + } + + export type IdResolver< + R = Maybe, + Parent = DataProviderResult, + TContext = SiemContext + > = Resolver; + export type NameResolver< + R = Maybe, + Parent = DataProviderResult, + TContext = SiemContext + > = Resolver; + export type EnabledResolver< + R = Maybe, + Parent = DataProviderResult, + TContext = SiemContext + > = Resolver; + export type ExcludedResolver< + R = Maybe, + Parent = DataProviderResult, + TContext = SiemContext + > = Resolver; + export type KqlQueryResolver< + R = Maybe, + Parent = DataProviderResult, + TContext = SiemContext + > = Resolver; + export type QueryMatchResolver< + R = Maybe, + Parent = DataProviderResult, + TContext = SiemContext + > = Resolver; + export type AndResolver< + R = Maybe, + Parent = DataProviderResult, + TContext = SiemContext + > = Resolver; +} + +export namespace QueryMatchResultResolvers { + export interface Resolvers { + field?: FieldResolver, TypeParent, TContext>; + + displayField?: DisplayFieldResolver, TypeParent, TContext>; + + value?: ValueResolver, TypeParent, TContext>; + + displayValue?: DisplayValueResolver, TypeParent, TContext>; + + operator?: OperatorResolver, TypeParent, TContext>; + } + + export type FieldResolver< + R = Maybe, + Parent = QueryMatchResult, + TContext = SiemContext + > = Resolver; + export type DisplayFieldResolver< + R = Maybe, + Parent = QueryMatchResult, + TContext = SiemContext + > = Resolver; + export type ValueResolver< + R = Maybe, + Parent = QueryMatchResult, + TContext = SiemContext + > = Resolver; + export type DisplayValueResolver< + R = Maybe, + Parent = QueryMatchResult, + TContext = SiemContext + > = Resolver; + export type OperatorResolver< + R = Maybe, + Parent = QueryMatchResult, + TContext = SiemContext + > = Resolver; +} + +export namespace DateRangePickerResultResolvers { + export interface Resolvers { + start?: StartResolver, TypeParent, TContext>; + + end?: EndResolver, TypeParent, TContext>; + } + + export type StartResolver< + R = Maybe, + Parent = DateRangePickerResult, + TContext = SiemContext + > = Resolver; + export type EndResolver< + R = Maybe, + Parent = DateRangePickerResult, + TContext = SiemContext + > = Resolver; +} + +export namespace FavoriteTimelineResultResolvers { + export interface Resolvers { + fullName?: FullNameResolver, TypeParent, TContext>; + + userName?: UserNameResolver, TypeParent, TContext>; + + favoriteDate?: FavoriteDateResolver, TypeParent, TContext>; + } + + export type FullNameResolver< + R = Maybe, + Parent = FavoriteTimelineResult, + TContext = SiemContext + > = Resolver; + export type UserNameResolver< + R = Maybe, + Parent = FavoriteTimelineResult, + TContext = SiemContext + > = Resolver; + export type FavoriteDateResolver< + R = Maybe, + Parent = FavoriteTimelineResult, + TContext = SiemContext + > = Resolver; +} + +export namespace FilterTimelineResultResolvers { + export interface Resolvers { + exists?: ExistsResolver, TypeParent, TContext>; + + meta?: MetaResolver, TypeParent, TContext>; + + match_all?: MatchAllResolver, TypeParent, TContext>; + + missing?: MissingResolver, TypeParent, TContext>; + + query?: QueryResolver, TypeParent, TContext>; + + range?: RangeResolver, TypeParent, TContext>; + + script?: ScriptResolver, TypeParent, TContext>; + } + + export type ExistsResolver< + R = Maybe, + Parent = FilterTimelineResult, + TContext = SiemContext + > = Resolver; + export type MetaResolver< + R = Maybe, + Parent = FilterTimelineResult, + TContext = SiemContext + > = Resolver; + export type MatchAllResolver< + R = Maybe, + Parent = FilterTimelineResult, + TContext = SiemContext + > = Resolver; + export type MissingResolver< + R = Maybe, + Parent = FilterTimelineResult, + TContext = SiemContext + > = Resolver; + export type QueryResolver< + R = Maybe, + Parent = FilterTimelineResult, + TContext = SiemContext + > = Resolver; + export type RangeResolver< + R = Maybe, + Parent = FilterTimelineResult, + TContext = SiemContext + > = Resolver; + export type ScriptResolver< + R = Maybe, + Parent = FilterTimelineResult, + TContext = SiemContext + > = Resolver; +} + +export namespace FilterMetaTimelineResultResolvers { + export interface Resolvers { + alias?: AliasResolver, TypeParent, TContext>; + + controlledBy?: ControlledByResolver, TypeParent, TContext>; + + disabled?: DisabledResolver, TypeParent, TContext>; + + field?: FieldResolver, TypeParent, TContext>; + + formattedValue?: FormattedValueResolver, TypeParent, TContext>; + + index?: IndexResolver, TypeParent, TContext>; + + key?: KeyResolver, TypeParent, TContext>; + + negate?: NegateResolver, TypeParent, TContext>; + + params?: ParamsResolver, TypeParent, TContext>; + + type?: TypeResolver, TypeParent, TContext>; + + value?: ValueResolver, TypeParent, TContext>; + } + + export type AliasResolver< + R = Maybe, + Parent = FilterMetaTimelineResult, + TContext = SiemContext + > = Resolver; + export type ControlledByResolver< + R = Maybe, + Parent = FilterMetaTimelineResult, + TContext = SiemContext + > = Resolver; + export type DisabledResolver< + R = Maybe, + Parent = FilterMetaTimelineResult, + TContext = SiemContext + > = Resolver; + export type FieldResolver< + R = Maybe, + Parent = FilterMetaTimelineResult, + TContext = SiemContext + > = Resolver; + export type FormattedValueResolver< + R = Maybe, + Parent = FilterMetaTimelineResult, + TContext = SiemContext + > = Resolver; + export type IndexResolver< + R = Maybe, + Parent = FilterMetaTimelineResult, + TContext = SiemContext + > = Resolver; + export type KeyResolver< + R = Maybe, + Parent = FilterMetaTimelineResult, + TContext = SiemContext + > = Resolver; + export type NegateResolver< + R = Maybe, + Parent = FilterMetaTimelineResult, + TContext = SiemContext + > = Resolver; + export type ParamsResolver< + R = Maybe, + Parent = FilterMetaTimelineResult, + TContext = SiemContext + > = Resolver; + export type TypeResolver< + R = Maybe, + Parent = FilterMetaTimelineResult, + TContext = SiemContext + > = Resolver; + export type ValueResolver< + R = Maybe, + Parent = FilterMetaTimelineResult, + TContext = SiemContext + > = Resolver; +} + +export namespace SerializedFilterQueryResultResolvers { + export interface Resolvers { + filterQuery?: FilterQueryResolver, TypeParent, TContext>; + } + + export type FilterQueryResolver< + R = Maybe, + Parent = SerializedFilterQueryResult, + TContext = SiemContext + > = Resolver; +} + +export namespace SerializedKueryQueryResultResolvers { + export interface Resolvers { + kuery?: KueryResolver, TypeParent, TContext>; + + serializedQuery?: SerializedQueryResolver, TypeParent, TContext>; + } + + export type KueryResolver< + R = Maybe, + Parent = SerializedKueryQueryResult, + TContext = SiemContext + > = Resolver; + export type SerializedQueryResolver< + R = Maybe, + Parent = SerializedKueryQueryResult, + TContext = SiemContext + > = Resolver; +} + +export namespace KueryFilterQueryResultResolvers { + export interface Resolvers { + kind?: KindResolver, TypeParent, TContext>; + + expression?: ExpressionResolver, TypeParent, TContext>; + } + + export type KindResolver< + R = Maybe, + Parent = KueryFilterQueryResult, + TContext = SiemContext + > = Resolver; + export type ExpressionResolver< + R = Maybe, + Parent = KueryFilterQueryResult, + TContext = SiemContext + > = Resolver; +} + +export namespace SortTimelineResultResolvers { + export interface Resolvers { + columnId?: ColumnIdResolver, TypeParent, TContext>; + + sortDirection?: SortDirectionResolver, TypeParent, TContext>; + } + + export type ColumnIdResolver< + R = Maybe, + Parent = SortTimelineResult, + TContext = SiemContext + > = Resolver; + export type SortDirectionResolver< + R = Maybe, + Parent = SortTimelineResult, + TContext = SiemContext + > = Resolver; +} + +export namespace ResponseTimelinesResolvers { + export interface Resolvers { + timeline?: TimelineResolver<(Maybe)[], TypeParent, TContext>; + + totalCount?: TotalCountResolver, TypeParent, TContext>; + } + + export type TimelineResolver< + R = (Maybe)[], + Parent = ResponseTimelines, + TContext = SiemContext + > = Resolver; + export type TotalCountResolver< + R = Maybe, + Parent = ResponseTimelines, + TContext = SiemContext + > = Resolver; +} + +export namespace MutationResolvers { + export interface Resolvers { + /** Persists a note */ + persistNote?: PersistNoteResolver; + + deleteNote?: DeleteNoteResolver, TypeParent, TContext>; + + deleteNoteByTimelineId?: DeleteNoteByTimelineIdResolver, TypeParent, TContext>; + /** Persists a pinned event in a timeline */ + persistPinnedEventOnTimeline?: PersistPinnedEventOnTimelineResolver< + Maybe, + TypeParent, + TContext + >; + /** Remove a pinned events in a timeline */ + deletePinnedEventOnTimeline?: DeletePinnedEventOnTimelineResolver< + boolean, + TypeParent, + TContext + >; + /** Remove all pinned events in a timeline */ + deleteAllPinnedEventsOnTimeline?: DeleteAllPinnedEventsOnTimelineResolver< + boolean, + TypeParent, + TContext + >; + /** Persists a timeline */ + persistTimeline?: PersistTimelineResolver; + + persistFavorite?: PersistFavoriteResolver; + + deleteTimeline?: DeleteTimelineResolver; + } + + export type PersistNoteResolver = Resolver< + R, + Parent, + TContext, + PersistNoteArgs + >; + export interface PersistNoteArgs { + noteId?: Maybe; + + version?: Maybe; + + note: NoteInput; + } + + export type DeleteNoteResolver< + R = Maybe, + Parent = {}, + TContext = SiemContext + > = Resolver; + export interface DeleteNoteArgs { + id: string[]; + } + + export type DeleteNoteByTimelineIdResolver< + R = Maybe, + Parent = {}, + TContext = SiemContext + > = Resolver; + export interface DeleteNoteByTimelineIdArgs { + timelineId: string; + + version?: Maybe; + } + + export type PersistPinnedEventOnTimelineResolver< + R = Maybe, + Parent = {}, + TContext = SiemContext + > = Resolver; + export interface PersistPinnedEventOnTimelineArgs { + pinnedEventId?: Maybe; + + eventId: string; + + timelineId?: Maybe; + } + + export type DeletePinnedEventOnTimelineResolver< + R = boolean, + Parent = {}, + TContext = SiemContext + > = Resolver; + export interface DeletePinnedEventOnTimelineArgs { + id: string[]; + } + + export type DeleteAllPinnedEventsOnTimelineResolver< + R = boolean, + Parent = {}, + TContext = SiemContext + > = Resolver; + export interface DeleteAllPinnedEventsOnTimelineArgs { + timelineId: string; + } + + export type PersistTimelineResolver< + R = ResponseTimeline, + Parent = {}, + TContext = SiemContext + > = Resolver; + export interface PersistTimelineArgs { + id?: Maybe; + + version?: Maybe; + + timeline: TimelineInput; + } + + export type PersistFavoriteResolver< + R = ResponseFavoriteTimeline, + Parent = {}, + TContext = SiemContext + > = Resolver; + export interface PersistFavoriteArgs { + timelineId?: Maybe; + } + + export type DeleteTimelineResolver = Resolver< + R, + Parent, + TContext, + DeleteTimelineArgs + >; + export interface DeleteTimelineArgs { + id: string[]; + } +} + +export namespace ResponseNoteResolvers { + export interface Resolvers { + code?: CodeResolver, TypeParent, TContext>; + + message?: MessageResolver, TypeParent, TContext>; + + note?: NoteResolver; + } + + export type CodeResolver< + R = Maybe, + Parent = ResponseNote, + TContext = SiemContext + > = Resolver; + export type MessageResolver< + R = Maybe, + Parent = ResponseNote, + TContext = SiemContext + > = Resolver; + export type NoteResolver< + R = NoteResult, + Parent = ResponseNote, + TContext = SiemContext + > = Resolver; +} + +export namespace ResponseTimelineResolvers { + export interface Resolvers { + code?: CodeResolver, TypeParent, TContext>; + + message?: MessageResolver, TypeParent, TContext>; + + timeline?: TimelineResolver; + } + + export type CodeResolver< + R = Maybe, + Parent = ResponseTimeline, + TContext = SiemContext + > = Resolver; + export type MessageResolver< + R = Maybe, + Parent = ResponseTimeline, + TContext = SiemContext + > = Resolver; + export type TimelineResolver< + R = TimelineResult, + Parent = ResponseTimeline, + TContext = SiemContext + > = Resolver; +} + +export namespace ResponseFavoriteTimelineResolvers { + export interface Resolvers { + code?: CodeResolver, TypeParent, TContext>; + + message?: MessageResolver, TypeParent, TContext>; + + savedObjectId?: SavedObjectIdResolver; + + version?: VersionResolver; + + favorite?: FavoriteResolver, TypeParent, TContext>; + } + + export type CodeResolver< + R = Maybe, + Parent = ResponseFavoriteTimeline, + TContext = SiemContext + > = Resolver; + export type MessageResolver< + R = Maybe, + Parent = ResponseFavoriteTimeline, + TContext = SiemContext + > = Resolver; + export type SavedObjectIdResolver< + R = string, + Parent = ResponseFavoriteTimeline, + TContext = SiemContext + > = Resolver; + export type VersionResolver< + R = string, + Parent = ResponseFavoriteTimeline, + TContext = SiemContext + > = Resolver; + export type FavoriteResolver< + R = Maybe, + Parent = ResponseFavoriteTimeline, + TContext = SiemContext + > = Resolver; +} + +export namespace EcsEdgesResolvers { + export interface Resolvers { + node?: NodeResolver; + + cursor?: CursorResolver; + } + + export type NodeResolver = Resolver< + R, + Parent, + TContext + >; + export type CursorResolver = Resolver< + R, + Parent, + TContext + >; +} + +export namespace EventsTimelineDataResolvers { + export interface Resolvers { + edges?: EdgesResolver; + + totalCount?: TotalCountResolver; + + pageInfo?: PageInfoResolver; + + inspect?: InspectResolver, TypeParent, TContext>; + } + + export type EdgesResolver< + R = EcsEdges[], + Parent = EventsTimelineData, + TContext = SiemContext + > = Resolver; + export type TotalCountResolver< + R = number, + Parent = EventsTimelineData, + TContext = SiemContext + > = Resolver; + export type PageInfoResolver< + R = PageInfo, + Parent = EventsTimelineData, + TContext = SiemContext + > = Resolver; + export type InspectResolver< + R = Maybe, + Parent = EventsTimelineData, + TContext = SiemContext + > = Resolver; +} + +export namespace OsFieldsResolvers { + export interface Resolvers { + platform?: PlatformResolver, TypeParent, TContext>; + + name?: NameResolver, TypeParent, TContext>; + + full?: FullResolver, TypeParent, TContext>; + + family?: FamilyResolver, TypeParent, TContext>; + + version?: VersionResolver, TypeParent, TContext>; + + kernel?: KernelResolver, TypeParent, TContext>; + } + + export type PlatformResolver< + R = Maybe, + Parent = OsFields, + TContext = SiemContext + > = Resolver; + export type NameResolver, Parent = OsFields, TContext = SiemContext> = Resolver< + R, + Parent, + TContext + >; + export type FullResolver, Parent = OsFields, TContext = SiemContext> = Resolver< + R, + Parent, + TContext + >; + export type FamilyResolver< + R = Maybe, + Parent = OsFields, + TContext = SiemContext + > = Resolver; + export type VersionResolver< + R = Maybe, + Parent = OsFields, + TContext = SiemContext + > = Resolver; + export type KernelResolver< + R = Maybe, + Parent = OsFields, + TContext = SiemContext + > = Resolver; +} + +export namespace HostFieldsResolvers { + export interface Resolvers { + architecture?: ArchitectureResolver, TypeParent, TContext>; + + id?: IdResolver, TypeParent, TContext>; + + ip?: IpResolver)[]>, TypeParent, TContext>; + + mac?: MacResolver)[]>, TypeParent, TContext>; + + name?: NameResolver, TypeParent, TContext>; + + os?: OsResolver, TypeParent, TContext>; + + type?: TypeResolver, TypeParent, TContext>; + } + + export type ArchitectureResolver< + R = Maybe, + Parent = HostFields, + TContext = SiemContext + > = Resolver; + export type IdResolver, Parent = HostFields, TContext = SiemContext> = Resolver< + R, + Parent, + TContext + >; + export type IpResolver< + R = Maybe<(Maybe)[]>, + Parent = HostFields, + TContext = SiemContext + > = Resolver; + export type MacResolver< + R = Maybe<(Maybe)[]>, + Parent = HostFields, + TContext = SiemContext + > = Resolver; + export type NameResolver< + R = Maybe, + Parent = HostFields, + TContext = SiemContext + > = Resolver; + export type OsResolver< + R = Maybe, + Parent = HostFields, + TContext = SiemContext + > = Resolver; + export type TypeResolver< + R = Maybe, + Parent = HostFields, + TContext = SiemContext + > = Resolver; +} + +/** Directs the executor to skip this field or fragment when the `if` argument is true. */ +export type SkipDirectiveResolver = DirectiveResolverFn< + Result, + SkipDirectiveArgs, + SiemContext +>; +export interface SkipDirectiveArgs { + /** Skipped when true. */ + if: boolean; +} + +/** Directs the executor to include this field or fragment only when the `if` argument is true. */ +export type IncludeDirectiveResolver = DirectiveResolverFn< + Result, + IncludeDirectiveArgs, + SiemContext +>; +export interface IncludeDirectiveArgs { + /** Included when true. */ + if: boolean; +} + +/** Marks an element of a GraphQL schema as no longer supported. */ +export type DeprecatedDirectiveResolver = DirectiveResolverFn< + Result, + DeprecatedDirectiveArgs, + SiemContext +>; +export interface DeprecatedDirectiveArgs { + /** Explains why this element was deprecated, usually also including a suggestion for how to access supported similar data. Formatted in [Markdown](https://daringfireball.net/projects/markdown/). */ + reason?: string; +} + +export interface ToStringArrayScalarConfig extends GraphQLScalarTypeConfig { + name: 'ToStringArray'; +} +export interface DateScalarConfig extends GraphQLScalarTypeConfig { + name: 'Date'; +} +export interface ToNumberArrayScalarConfig extends GraphQLScalarTypeConfig { + name: 'ToNumberArray'; +} +export interface ToDateArrayScalarConfig extends GraphQLScalarTypeConfig { + name: 'ToDateArray'; +} +export interface ToBooleanArrayScalarConfig extends GraphQLScalarTypeConfig { + name: 'ToBooleanArray'; +} +export interface ToAnyScalarConfig extends GraphQLScalarTypeConfig { + name: 'ToAny'; +} +export interface EsValueScalarConfig extends GraphQLScalarTypeConfig { + name: 'EsValue'; +} + +export type IResolvers = { + Query?: QueryResolvers.Resolvers; + NoteResult?: NoteResultResolvers.Resolvers; + ResponseNotes?: ResponseNotesResolvers.Resolvers; + PinnedEvent?: PinnedEventResolvers.Resolvers; + Source?: SourceResolvers.Resolvers; + SourceConfiguration?: SourceConfigurationResolvers.Resolvers; + SourceFields?: SourceFieldsResolvers.Resolvers; + SourceStatus?: SourceStatusResolvers.Resolvers; + IndexField?: IndexFieldResolvers.Resolvers; + AuthenticationsData?: AuthenticationsDataResolvers.Resolvers; + AuthenticationsEdges?: AuthenticationsEdgesResolvers.Resolvers; + AuthenticationItem?: AuthenticationItemResolvers.Resolvers; + UserEcsFields?: UserEcsFieldsResolvers.Resolvers; + LastSourceHost?: LastSourceHostResolvers.Resolvers; + SourceEcsFields?: SourceEcsFieldsResolvers.Resolvers; + GeoEcsFields?: GeoEcsFieldsResolvers.Resolvers; + Location?: LocationResolvers.Resolvers; + HostEcsFields?: HostEcsFieldsResolvers.Resolvers; + OsEcsFields?: OsEcsFieldsResolvers.Resolvers; + CursorType?: CursorTypeResolvers.Resolvers; + PageInfoPaginated?: PageInfoPaginatedResolvers.Resolvers; + Inspect?: InspectResolvers.Resolvers; + TimelineData?: TimelineDataResolvers.Resolvers; + TimelineEdges?: TimelineEdgesResolvers.Resolvers; + TimelineItem?: TimelineItemResolvers.Resolvers; + TimelineNonEcsData?: TimelineNonEcsDataResolvers.Resolvers; + Ecs?: EcsResolvers.Resolvers; + AuditdEcsFields?: AuditdEcsFieldsResolvers.Resolvers; + AuditdData?: AuditdDataResolvers.Resolvers; + Summary?: SummaryResolvers.Resolvers; + PrimarySecondary?: PrimarySecondaryResolvers.Resolvers; + DestinationEcsFields?: DestinationEcsFieldsResolvers.Resolvers; + DnsEcsFields?: DnsEcsFieldsResolvers.Resolvers; + DnsQuestionData?: DnsQuestionDataResolvers.Resolvers; + EndgameEcsFields?: EndgameEcsFieldsResolvers.Resolvers; + EventEcsFields?: EventEcsFieldsResolvers.Resolvers; + NetworkEcsField?: NetworkEcsFieldResolvers.Resolvers; + RuleEcsField?: RuleEcsFieldResolvers.Resolvers; + SignalField?: SignalFieldResolvers.Resolvers; + RuleField?: RuleFieldResolvers.Resolvers; + SuricataEcsFields?: SuricataEcsFieldsResolvers.Resolvers; + SuricataEveData?: SuricataEveDataResolvers.Resolvers; + SuricataAlertData?: SuricataAlertDataResolvers.Resolvers; + TlsEcsFields?: TlsEcsFieldsResolvers.Resolvers; + TlsClientCertificateData?: TlsClientCertificateDataResolvers.Resolvers; + FingerprintData?: FingerprintDataResolvers.Resolvers; + TlsFingerprintsData?: TlsFingerprintsDataResolvers.Resolvers; + TlsJa3Data?: TlsJa3DataResolvers.Resolvers; + TlsServerCertificateData?: TlsServerCertificateDataResolvers.Resolvers; + ZeekEcsFields?: ZeekEcsFieldsResolvers.Resolvers; + ZeekConnectionData?: ZeekConnectionDataResolvers.Resolvers; + ZeekNoticeData?: ZeekNoticeDataResolvers.Resolvers; + ZeekDnsData?: ZeekDnsDataResolvers.Resolvers; + ZeekHttpData?: ZeekHttpDataResolvers.Resolvers; + ZeekFileData?: ZeekFileDataResolvers.Resolvers; + ZeekSslData?: ZeekSslDataResolvers.Resolvers; + HttpEcsFields?: HttpEcsFieldsResolvers.Resolvers; + HttpRequestData?: HttpRequestDataResolvers.Resolvers; + HttpBodyData?: HttpBodyDataResolvers.Resolvers; + HttpResponseData?: HttpResponseDataResolvers.Resolvers; + UrlEcsFields?: UrlEcsFieldsResolvers.Resolvers; + WinlogEcsFields?: WinlogEcsFieldsResolvers.Resolvers; + ProcessEcsFields?: ProcessEcsFieldsResolvers.Resolvers; + ProcessHashData?: ProcessHashDataResolvers.Resolvers; + Thread?: ThreadResolvers.Resolvers; + FileFields?: FileFieldsResolvers.Resolvers; + SystemEcsField?: SystemEcsFieldResolvers.Resolvers; + AuditEcsFields?: AuditEcsFieldsResolvers.Resolvers; + PackageEcsFields?: PackageEcsFieldsResolvers.Resolvers; + AuthEcsFields?: AuthEcsFieldsResolvers.Resolvers; + SshEcsFields?: SshEcsFieldsResolvers.Resolvers; + PageInfo?: PageInfoResolvers.Resolvers; + TimelineDetailsData?: TimelineDetailsDataResolvers.Resolvers; + DetailItem?: DetailItemResolvers.Resolvers; + LastEventTimeData?: LastEventTimeDataResolvers.Resolvers; + HostsData?: HostsDataResolvers.Resolvers; + HostsEdges?: HostsEdgesResolvers.Resolvers; + HostItem?: HostItemResolvers.Resolvers; + CloudFields?: CloudFieldsResolvers.Resolvers; + CloudInstance?: CloudInstanceResolvers.Resolvers; + CloudMachine?: CloudMachineResolvers.Resolvers; + FirstLastSeenHost?: FirstLastSeenHostResolvers.Resolvers; + IpOverviewData?: IpOverviewDataResolvers.Resolvers; + Overview?: OverviewResolvers.Resolvers; + AutonomousSystem?: AutonomousSystemResolvers.Resolvers; + AutonomousSystemOrganization?: AutonomousSystemOrganizationResolvers.Resolvers; + UsersData?: UsersDataResolvers.Resolvers; + UsersEdges?: UsersEdgesResolvers.Resolvers; + UsersNode?: UsersNodeResolvers.Resolvers; + UsersItem?: UsersItemResolvers.Resolvers; + KpiNetworkData?: KpiNetworkDataResolvers.Resolvers; + KpiNetworkHistogramData?: KpiNetworkHistogramDataResolvers.Resolvers; + KpiHostsData?: KpiHostsDataResolvers.Resolvers; + KpiHostHistogramData?: KpiHostHistogramDataResolvers.Resolvers; + KpiHostDetailsData?: KpiHostDetailsDataResolvers.Resolvers; + MatrixHistogramOverTimeData?: MatrixHistogramOverTimeDataResolvers.Resolvers; + MatrixOverTimeHistogramData?: MatrixOverTimeHistogramDataResolvers.Resolvers; + NetworkTopCountriesData?: NetworkTopCountriesDataResolvers.Resolvers; + NetworkTopCountriesEdges?: NetworkTopCountriesEdgesResolvers.Resolvers; + NetworkTopCountriesItem?: NetworkTopCountriesItemResolvers.Resolvers; + TopCountriesItemSource?: TopCountriesItemSourceResolvers.Resolvers; + GeoItem?: GeoItemResolvers.Resolvers; + TopCountriesItemDestination?: TopCountriesItemDestinationResolvers.Resolvers; + TopNetworkTablesEcsField?: TopNetworkTablesEcsFieldResolvers.Resolvers; + NetworkTopNFlowData?: NetworkTopNFlowDataResolvers.Resolvers; + NetworkTopNFlowEdges?: NetworkTopNFlowEdgesResolvers.Resolvers; + NetworkTopNFlowItem?: NetworkTopNFlowItemResolvers.Resolvers; + TopNFlowItemSource?: TopNFlowItemSourceResolvers.Resolvers; + AutonomousSystemItem?: AutonomousSystemItemResolvers.Resolvers; + TopNFlowItemDestination?: TopNFlowItemDestinationResolvers.Resolvers; + NetworkDnsData?: NetworkDnsDataResolvers.Resolvers; + NetworkDnsEdges?: NetworkDnsEdgesResolvers.Resolvers; + NetworkDnsItem?: NetworkDnsItemResolvers.Resolvers; + MatrixOverOrdinalHistogramData?: MatrixOverOrdinalHistogramDataResolvers.Resolvers; + NetworkDsOverTimeData?: NetworkDsOverTimeDataResolvers.Resolvers; + NetworkHttpData?: NetworkHttpDataResolvers.Resolvers; + NetworkHttpEdges?: NetworkHttpEdgesResolvers.Resolvers; + NetworkHttpItem?: NetworkHttpItemResolvers.Resolvers; + OverviewNetworkData?: OverviewNetworkDataResolvers.Resolvers; + OverviewHostData?: OverviewHostDataResolvers.Resolvers; + TlsData?: TlsDataResolvers.Resolvers; + TlsEdges?: TlsEdgesResolvers.Resolvers; + TlsNode?: TlsNodeResolvers.Resolvers; + UncommonProcessesData?: UncommonProcessesDataResolvers.Resolvers; + UncommonProcessesEdges?: UncommonProcessesEdgesResolvers.Resolvers; + UncommonProcessItem?: UncommonProcessItemResolvers.Resolvers; + SayMyName?: SayMyNameResolvers.Resolvers; + TimelineResult?: TimelineResultResolvers.Resolvers; + ColumnHeaderResult?: ColumnHeaderResultResolvers.Resolvers; + DataProviderResult?: DataProviderResultResolvers.Resolvers; + QueryMatchResult?: QueryMatchResultResolvers.Resolvers; + DateRangePickerResult?: DateRangePickerResultResolvers.Resolvers; + FavoriteTimelineResult?: FavoriteTimelineResultResolvers.Resolvers; + FilterTimelineResult?: FilterTimelineResultResolvers.Resolvers; + FilterMetaTimelineResult?: FilterMetaTimelineResultResolvers.Resolvers; + SerializedFilterQueryResult?: SerializedFilterQueryResultResolvers.Resolvers; + SerializedKueryQueryResult?: SerializedKueryQueryResultResolvers.Resolvers; + KueryFilterQueryResult?: KueryFilterQueryResultResolvers.Resolvers; + SortTimelineResult?: SortTimelineResultResolvers.Resolvers; + ResponseTimelines?: ResponseTimelinesResolvers.Resolvers; + Mutation?: MutationResolvers.Resolvers; + ResponseNote?: ResponseNoteResolvers.Resolvers; + ResponseTimeline?: ResponseTimelineResolvers.Resolvers; + ResponseFavoriteTimeline?: ResponseFavoriteTimelineResolvers.Resolvers; + EcsEdges?: EcsEdgesResolvers.Resolvers; + EventsTimelineData?: EventsTimelineDataResolvers.Resolvers; + OsFields?: OsFieldsResolvers.Resolvers; + HostFields?: HostFieldsResolvers.Resolvers; + ToStringArray?: GraphQLScalarType; + Date?: GraphQLScalarType; + ToNumberArray?: GraphQLScalarType; + ToDateArray?: GraphQLScalarType; + ToBooleanArray?: GraphQLScalarType; + ToAny?: GraphQLScalarType; + EsValue?: GraphQLScalarType; +} & { [typeName: string]: never }; + +export type IDirectiveResolvers = { + skip?: SkipDirectiveResolver; + include?: IncludeDirectiveResolver; + deprecated?: DeprecatedDirectiveResolver; +} & { [directiveName: string]: never }; diff --git a/x-pack/legacy/plugins/siem/server/graphql/uncommon_processes/resolvers.ts b/x-pack/legacy/plugins/siem/server/graphql/uncommon_processes/resolvers.ts index 00b34a0c5fbe5..03d3c3d1a1fe4 100644 --- a/x-pack/legacy/plugins/siem/server/graphql/uncommon_processes/resolvers.ts +++ b/x-pack/legacy/plugins/siem/server/graphql/uncommon_processes/resolvers.ts @@ -5,8 +5,15 @@ */ import { SourceResolvers } from '../../graphql/types'; +import { AppResolverOf, ChildResolverOf } from '../../lib/framework'; import { UncommonProcesses } from '../../lib/uncommon_processes'; import { createOptionsPaginated } from '../../utils/build_query/create_options'; +import { QuerySourceResolver } from '../sources/resolvers'; + +type QueryUncommonProcessesResolver = ChildResolverOf< + AppResolverOf, + QuerySourceResolver +>; export interface UncommonProcessesResolversDeps { uncommonProcesses: UncommonProcesses; @@ -16,7 +23,7 @@ export const createUncommonProcessesResolvers = ( libs: UncommonProcessesResolversDeps ): { Source: { - UncommonProcesses: SourceResolvers['UncommonProcesses']; + UncommonProcesses: QueryUncommonProcessesResolver; }; } => ({ Source: { diff --git a/x-pack/legacy/plugins/siem/server/graphql/uncommon_processes/schema.gql.ts b/x-pack/legacy/plugins/siem/server/graphql/uncommon_processes/schema.gql.ts index 842ab80b5bd7c..36a3da6779172 100644 --- a/x-pack/legacy/plugins/siem/server/graphql/uncommon_processes/schema.gql.ts +++ b/x-pack/legacy/plugins/siem/server/graphql/uncommon_processes/schema.gql.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { gql } from '@apollo/client'; +import gql from 'graphql-tag'; export const uncommonProcessesSchema = gql` type UncommonProcessItem { diff --git a/x-pack/legacy/plugins/siem/server/graphql/who_am_i/resolvers.ts b/x-pack/legacy/plugins/siem/server/graphql/who_am_i/resolvers.ts index 8a2ecbdbd40bb..065edfb99ccea 100644 --- a/x-pack/legacy/plugins/siem/server/graphql/who_am_i/resolvers.ts +++ b/x-pack/legacy/plugins/siem/server/graphql/who_am_i/resolvers.ts @@ -5,10 +5,17 @@ */ import { SourceResolvers } from '../../graphql/types'; +import { AppResolverOf, ChildResolverOf } from '../../lib/framework'; +import { QuerySourceResolver } from '../sources/resolvers'; + +export type QueryWhoAmIResolver = ChildResolverOf< + AppResolverOf, + QuerySourceResolver +>; export const createWhoAmIResolvers = (): { Source: { - whoAmI: SourceResolvers['whoAmI']; + whoAmI: QueryWhoAmIResolver; }; } => ({ Source: { diff --git a/x-pack/legacy/plugins/siem/server/graphql/who_am_i/schema.gql.ts b/x-pack/legacy/plugins/siem/server/graphql/who_am_i/schema.gql.ts index e2c57fe4b5634..0a264cd2988fe 100644 --- a/x-pack/legacy/plugins/siem/server/graphql/who_am_i/schema.gql.ts +++ b/x-pack/legacy/plugins/siem/server/graphql/who_am_i/schema.gql.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { gql } from '@apollo/client'; +import gql from 'graphql-tag'; export const whoAmISchema = gql` type SayMyName { diff --git a/x-pack/legacy/plugins/siem/server/init_server.ts b/x-pack/legacy/plugins/siem/server/init_server.ts index 83c5f0c171c8a..6158a33c25cfa 100644 --- a/x-pack/legacy/plugins/siem/server/init_server.ts +++ b/x-pack/legacy/plugins/siem/server/init_server.ts @@ -3,7 +3,7 @@ * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ -import { IResolvers, makeExecutableSchema } from '@kamilkisiela/graphql-tools'; +import { IResolvers, makeExecutableSchema } from 'graphql-tools'; import { schemas } from './graphql'; import { createAuthenticationsResolvers } from './graphql/authentications'; diff --git a/x-pack/legacy/plugins/siem/server/lib/framework/types.ts b/x-pack/legacy/plugins/siem/server/lib/framework/types.ts index b72dc9ef580d7..7d049d1dcd195 100644 --- a/x-pack/legacy/plugins/siem/server/lib/framework/types.ts +++ b/x-pack/legacy/plugins/siem/server/lib/framework/types.ts @@ -6,7 +6,6 @@ import { IndicesGetMappingParams } from 'elasticsearch'; import { GraphQLSchema } from 'graphql'; -import * as runtimeTypes from 'io-ts'; import { RequestHandlerContext, KibanaRequest } from '../../../../../../../src/core/server'; import { AuthenticatedUser } from '../../../../../../plugins/security/common/model'; @@ -21,6 +20,8 @@ import { HistogramType, } from '../../graphql/types'; +export * from '../../utils/typed_resolvers'; + export const internalFrameworkRequest = Symbol('internalFrameworkRequest'); export interface FrameworkAdapter { @@ -132,6 +133,3 @@ export interface RequestOptionsPaginated extends RequestBasicOptions { fields: readonly string[]; sortField?: SortField; } - -export const unionWithNullType = (type: T) => - runtimeTypes.union([type, runtimeTypes.null]); diff --git a/x-pack/legacy/plugins/siem/server/utils/typed_resolvers.ts b/x-pack/legacy/plugins/siem/server/utils/typed_resolvers.ts new file mode 100644 index 0000000000000..da38e8a1e1bf2 --- /dev/null +++ b/x-pack/legacy/plugins/siem/server/utils/typed_resolvers.ts @@ -0,0 +1,111 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import * as runtimeTypes from 'io-ts'; +import { GraphQLResolveInfo } from 'graphql'; + +// eslint-disable-next-line @typescript-eslint/no-explicit-any +export type Resolver = ( + parent: Parent, + args: Args, + context: TContext, + info: GraphQLResolveInfo +) => Promise | Result; + +type ResolverResult = R | Promise; + +type AppResolverResult = + | Promise + | Promise<{ [P in keyof R]: () => Promise }> + | { [P in keyof R]: () => Promise } + | { [P in keyof R]: () => R[P] } + | R; + +export type ResultOf = Resolver_ extends Resolver> + ? Result + : never; + +export type SubsetResolverWithFields = R extends Resolver< + Array, + infer ParentInArray, + infer ContextInArray, + infer ArgsInArray +> + ? Resolver< + Array>>, + ParentInArray, + ContextInArray, + ArgsInArray + > + : R extends Resolver + ? Resolver>, Parent, Context, Args> + : never; + +export type SubsetResolverWithoutFields = R extends Resolver< + Array, + infer ParentInArray, + infer ContextInArray, + infer ArgsInArray +> + ? Resolver< + Array>>, + ParentInArray, + ContextInArray, + ArgsInArray + > + : R extends Resolver + ? Resolver>, Parent, Context, Args> + : never; + +export type ResolverWithParent = Resolver_ extends Resolver< + infer Result, + // eslint-disable-next-line @typescript-eslint/no-explicit-any + any, + infer Context, + infer Args +> + ? Resolver + : never; + +// eslint-disable-next-line @typescript-eslint/no-explicit-any +export type AppResolver = Resolver< + AppResolverResult, + Parent, + Context, + Args +>; + +export type AppResolverOf = Resolver_ extends Resolver< + ResolverResult, + never, + infer ContextWithNeverParent, + infer ArgsWithNeverParent +> + ? AppResolver + : Resolver_ extends Resolver< + ResolverResult, + infer Parent, + infer Context, + infer Args + > + ? AppResolver + : never; + +export type AppResolverWithFields = AppResolverOf< + SubsetResolverWithFields +>; + +export type AppResolverWithoutFields = AppResolverOf< + SubsetResolverWithoutFields +>; + +export type ChildResolverOf = ResolverWithParent< + Resolver_, + ResultOf +>; + +export const unionWithNullType = (type: T) => + runtimeTypes.union([type, runtimeTypes.null]); diff --git a/x-pack/package.json b/x-pack/package.json index 5d0ac156f87fa..96e06dd71b3fe 100644 --- a/x-pack/package.json +++ b/x-pack/package.json @@ -27,17 +27,6 @@ }, "devDependencies": { "@cypress/webpack-preprocessor": "^4.1.0", - "@graphql-codegen/add": "^1.12.2", - "@graphql-codegen/core": "^1.12.2", - "@graphql-codegen/typescript": "^1.12.2", - "@graphql-codegen/typescript-compatibility": "^1.12.2", - "@graphql-codegen/typescript-operations": "^1.12.2", - "@graphql-codegen/typescript-resolvers": "^1.12.2", - "@graphql-codegen/typescript-react-apollo": "^1.12.2", - "@graphql-toolkit/code-file-loader": "^0.9.7", - "@graphql-toolkit/common":"^0.9.7", - "@graphql-toolkit/core": "^0.9.7", - "@graphql-toolkit/graphql-file-loader": "^0.9.7", "@kbn/dev-utils": "1.0.0", "@kbn/es": "1.0.0", "@kbn/expect": "1.0.0", @@ -73,6 +62,7 @@ "@types/getos": "^3.0.0", "@types/git-url-parse": "^9.0.0", "@types/glob": "^7.1.1", + "@types/graphql": "^0.13.2", "@types/gulp": "^4.0.6", "@types/hapi__wreck": "^15.0.1", "@types/hoist-non-react-statics": "^3.3.1", @@ -183,8 +173,6 @@ "yargs": "4.8.1" }, "dependencies": { - "@apollo/client": "^3.0.0-beta.37", - "@apollo/react-components": "^3.2.0-beta.1", "@babel/core": "^7.5.5", "@babel/register": "^7.7.0", "@babel/runtime": "^7.5.5", @@ -196,7 +184,6 @@ "@elastic/maki": "6.1.0", "@elastic/node-crypto": "^1.0.0", "@elastic/numeral": "2.4.0", - "@kamilkisiela/graphql-tools": "^4.0.6", "@kbn/babel-preset": "1.0.0", "@kbn/config-schema": "1.0.0", "@kbn/i18n": "1.0.0", @@ -214,8 +201,8 @@ "angular-ui-ace": "0.2.3", "apollo-cache-inmemory": "1.6.2", "apollo-client": "^2.3.8", - "apollo-link": "^1.2.13", - "apollo-link-error": "^2.0.0-beta.0", + "apollo-link": "^1.2.3", + "apollo-link-error": "^1.1.7", "apollo-link-http": "^1.5.16", "apollo-link-schema": "^1.1.0", "apollo-link-state": "^0.4.1", @@ -254,10 +241,10 @@ "git-url-parse": "11.1.2", "github-markdown-css": "^2.10.0", "glob": "^7.1.2", - "graphql": "^14.6.0", + "graphql": "^0.13.2", "graphql-fields": "^1.0.2", - "graphql-tag": "^2.10.3", - "graphql-tools": "^4.0.6", + "graphql-tag": "^2.9.2", + "graphql-tools": "^3.0.2", "h2o2": "^8.1.2", "handlebars": "4.5.3", "history": "4.9.0", diff --git a/x-pack/test/api_integration/apis/siem/feature_controls.ts b/x-pack/test/api_integration/apis/siem/feature_controls.ts index 35a8bbca2ff5d..1623a2b286f79 100644 --- a/x-pack/test/api_integration/apis/siem/feature_controls.ts +++ b/x-pack/test/api_integration/apis/siem/feature_controls.ts @@ -5,7 +5,7 @@ */ import expect from '@kbn/expect'; -import { gql } from '@apollo/client'; +import gql from 'graphql-tag'; import { FtrProviderContext } from '../../ftr_provider_context'; const introspectionQuery = gql` diff --git a/x-pack/test/api_integration/apis/siem/saved_objects/notes.ts b/x-pack/test/api_integration/apis/siem/saved_objects/notes.ts index 97ed58ae0a45e..5aa7a10e07c2a 100644 --- a/x-pack/test/api_integration/apis/siem/saved_objects/notes.ts +++ b/x-pack/test/api_integration/apis/siem/saved_objects/notes.ts @@ -5,7 +5,7 @@ */ import expect from '@kbn/expect'; -import { gql } from '@apollo/client'; +import gql from 'graphql-tag'; import { FtrProviderContext } from '../../../ftr_provider_context'; import { persistTimelineNoteMutation } from '../../../../../legacy/plugins/siem/public/containers/timeline/notes/persist.gql_query'; diff --git a/x-pack/test/api_integration/apis/siem/saved_objects/timeline.ts b/x-pack/test/api_integration/apis/siem/saved_objects/timeline.ts index 98fc86632a3fd..a6ced270e2132 100644 --- a/x-pack/test/api_integration/apis/siem/saved_objects/timeline.ts +++ b/x-pack/test/api_integration/apis/siem/saved_objects/timeline.ts @@ -11,7 +11,7 @@ */ import expect from '@kbn/expect'; -import { ApolloClient } from '@apollo/client'; +import ApolloClient from 'apollo-client'; import { FtrProviderContext } from '../../../ftr_provider_context'; diff --git a/x-pack/test/api_integration/services/siem_graphql_client.ts b/x-pack/test/api_integration/services/siem_graphql_client.ts index 6668aa89852a3..7d6aa5e8a9dd5 100644 --- a/x-pack/test/api_integration/services/siem_graphql_client.ts +++ b/x-pack/test/api_integration/services/siem_graphql_client.ts @@ -6,9 +6,12 @@ import { format as formatUrl } from 'url'; import fetch from 'node-fetch'; -import { ApolloClient, HttpLink, InMemoryCache } from '@apollo/client'; +import { InMemoryCache, IntrospectionFragmentMatcher } from 'apollo-cache-inmemory'; +import { ApolloClient } from 'apollo-client'; +import { HttpLink } from 'apollo-link-http'; import { FtrProviderContext } from '../ftr_provider_context'; +import introspectionQueryResultData from '../../../legacy/plugins/siem/public/graphql/introspection.json'; interface SiemGraphQLClientFactoryOptions { username?: string; @@ -41,7 +44,11 @@ export function SiemGraphQLClientFactoryProvider({ getService }: FtrProviderCont }); return new ApolloClient({ - cache: new InMemoryCache({}), + cache: new InMemoryCache({ + fragmentMatcher: new IntrospectionFragmentMatcher({ + introspectionQueryResultData, + }), + }), link: httpLink, }); }; diff --git a/yarn.lock b/yarn.lock index f3777830ecce2..7f38495c20f4a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,49 +2,6 @@ # yarn lockfile v1 -"@apollo/client@^3.0.0-beta.10", "@apollo/client@^3.0.0-beta.23", "@apollo/client@^3.0.0-beta.37": - version "3.0.0-beta.37" - resolved "https://registry.yarnpkg.com/@apollo/client/-/client-3.0.0-beta.37.tgz#24d4eacebc2dd0d6c27e87b8aacbb5323c0d29d6" - integrity sha512-EVarxDX4dG51IHs9DyivYZQN51U2eu9deWRyAI9xkp6Y5vwmTfAcfMYQIxc/ZZhiFAq4MEk0EPLtU2kOfTILjQ== - dependencies: - "@types/zen-observable" "^0.8.0" - "@wry/equality" "^0.1.9" - fast-json-stable-stringify "^2.0.0" - graphql-tag "^2.10.2" - optimism "^0.11.5" - symbol-observable "^1.2.0" - ts-invariant "^0.4.4" - tslib "^1.10.0" - zen-observable "^0.8.14" - -"@apollo/react-common@^3.2.0-beta.1": - version "3.2.0-beta.1" - resolved "https://registry.yarnpkg.com/@apollo/react-common/-/react-common-3.2.0-beta.1.tgz#91227dde37759d9af577a8f397749deb0c5286eb" - integrity sha512-ZXkzQHZOA5WrIrIzYmltEXc22iZNWcgTdFEyMi2AwhoMdv/w89UXO7+QQ+2Fav7LgJ8zEE+znv+6D7DmKpJVvg== - dependencies: - "@apollo/client" "^3.0.0-beta.23" - -"@apollo/react-components@^3.2.0-beta.1": - version "3.2.0-beta.1" - resolved "https://registry.yarnpkg.com/@apollo/react-components/-/react-components-3.2.0-beta.1.tgz#21e2bf33ad52d9c8b46c0fa922cc3f6251775390" - integrity sha512-klPUqS8JMR57xuVUvY53EFwa4SrNBGczSL44eNc37MC4nnYGm8oH/yg73zqAf+XsiJZfXq/cgNJi5LBy0p69Lg== - dependencies: - "@apollo/react-common" "^3.2.0-beta.1" - prop-types "^15.7.2" - ts-invariant "^0.4.4" - tslib "^1.10.0" - -"@ardatan/graphql-tools@4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@ardatan/graphql-tools/-/graphql-tools-4.1.0.tgz#183508ef4e3d4966f763cb1634a81be1c1255f8d" - integrity sha512-0b+KH5RZN9vCMpEjxrwFwZ7v3K6QDjs1EH+R6eRrgKMR2X274JWqYraHKLWE1uJ8iwrkRaOYfCV12jLVuvWS+A== - dependencies: - apollo-link "^1.2.3" - apollo-utilities "^1.0.1" - deprecated-decorator "^0.1.6" - iterall "^1.1.3" - uuid "^3.1.0" - "@babel/cli@^7.5.5": version "7.5.5" resolved "https://registry.yarnpkg.com/@babel/cli/-/cli-7.5.5.tgz#bdb6d9169e93e241a08f5f7b0265195bf38ef5ec" @@ -69,13 +26,6 @@ dependencies: "@babel/highlight" "^7.0.0" -"@babel/code-frame@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.8.3.tgz#33e25903d7481181534e12ec0a25f16b6fcf419e" - integrity sha512-a9gxpmdXtZEInkCSHUJDLHZVBgb1QS0jhss4cPP93EW7s+uC5bikET2twEF3KV+7rDblJcmNvTR7VJejqd2C2g== - dependencies: - "@babel/highlight" "^7.8.3" - "@babel/core@7.5.5", "@babel/core@^7.0.0", "@babel/core@^7.1.0", "@babel/core@^7.4.3", "@babel/core@^7.5.5": version "7.5.5" resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.5.5.tgz#17b2686ef0d6bc58f963dddd68ab669755582c30" @@ -127,16 +77,6 @@ source-map "^0.5.0" trim-right "^1.0.1" -"@babel/generator@^7.5.0", "@babel/generator@^7.8.3", "@babel/generator@^7.8.4": - version "7.8.4" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.8.4.tgz#35bbc74486956fe4251829f9f6c48330e8d0985e" - integrity sha512-PwhclGdRpNAf3IxZb0YVuITPZmmrXz9zf6fH8lT4XbrmfQKr6ryBzhv593P5C6poJRciFCL/eHGW2NuGrgEyxA== - dependencies: - "@babel/types" "^7.8.3" - jsesc "^2.5.1" - lodash "^4.17.13" - source-map "^0.5.0" - "@babel/generator@^7.6.0", "@babel/generator@^7.6.2": version "7.6.2" resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.6.2.tgz#dac8a3c2df118334c2a29ff3446da1636a8f8c03" @@ -181,13 +121,6 @@ dependencies: "@babel/types" "^7.7.4" -"@babel/helper-annotate-as-pure@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.8.3.tgz#60bc0bc657f63a0924ff9a4b4a0b24a13cf4deee" - integrity sha512-6o+mJrZBxOoEX77Ezv9zwW7WV8DdluouRKNY/IR5u/YTMuKHgugHOzYWlYvYLpLA9nPsQCAAASpCIbjI9Mv+Uw== - dependencies: - "@babel/types" "^7.8.3" - "@babel/helper-builder-binary-assignment-operator-visitor@^7.1.0": version "7.1.0" resolved "https://registry.yarnpkg.com/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.1.0.tgz#6b69628dfe4087798e0c4ed98e3d4a6b2fbd2f5f" @@ -238,15 +171,6 @@ "@babel/traverse" "^7.7.4" "@babel/types" "^7.7.4" -"@babel/helper-call-delegate@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/helper-call-delegate/-/helper-call-delegate-7.8.3.tgz#de82619898aa605d409c42be6ffb8d7204579692" - integrity sha512-6Q05px0Eb+N4/GTyKPPvnkig7Lylw+QzihMpws9iiZQv7ZImf84ZsZpQH7QoWN4n4tm81SnSzPgHw2qtO0Zf3A== - dependencies: - "@babel/helper-hoist-variables" "^7.8.3" - "@babel/traverse" "^7.8.3" - "@babel/types" "^7.8.3" - "@babel/helper-create-class-features-plugin@^7.4.4", "@babel/helper-create-class-features-plugin@^7.5.5": version "7.5.5" resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.5.5.tgz#401f302c8ddbc0edd36f7c6b2887d8fa1122e5a4" @@ -271,18 +195,6 @@ "@babel/helper-replace-supers" "^7.7.4" "@babel/helper-split-export-declaration" "^7.7.4" -"@babel/helper-create-class-features-plugin@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.8.3.tgz#5b94be88c255f140fd2c10dd151e7f98f4bff397" - integrity sha512-qmp4pD7zeTxsv0JNecSBsEmG1ei2MqwJq4YQcK3ZWm/0t07QstWfvuV/vm3Qt5xNMFETn2SZqpMx2MQzbtq+KA== - dependencies: - "@babel/helper-function-name" "^7.8.3" - "@babel/helper-member-expression-to-functions" "^7.8.3" - "@babel/helper-optimise-call-expression" "^7.8.3" - "@babel/helper-plugin-utils" "^7.8.3" - "@babel/helper-replace-supers" "^7.8.3" - "@babel/helper-split-export-declaration" "^7.8.3" - "@babel/helper-create-regexp-features-plugin@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.7.4.tgz#6d5762359fd34f4da1500e4cff9955b5299aaf59" @@ -309,15 +221,6 @@ "@babel/types" "^7.7.4" lodash "^4.17.13" -"@babel/helper-define-map@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/helper-define-map/-/helper-define-map-7.8.3.tgz#a0655cad5451c3760b726eba875f1cd8faa02c15" - integrity sha512-PoeBYtxoZGtct3md6xZOCWPcKuMuk3IHhgxsRRNtnNShebf4C8YonTSblsK4tvDbm+eJAw2HAPOfCr+Q/YRG/g== - dependencies: - "@babel/helper-function-name" "^7.8.3" - "@babel/types" "^7.8.3" - lodash "^4.17.13" - "@babel/helper-explode-assignable-expression@^7.1.0": version "7.1.0" resolved "https://registry.yarnpkg.com/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.1.0.tgz#537fa13f6f1674df745b0c00ec8fe4e99681c8f6" @@ -352,15 +255,6 @@ "@babel/template" "^7.7.4" "@babel/types" "^7.7.4" -"@babel/helper-function-name@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.8.3.tgz#eeeb665a01b1f11068e9fb86ad56a1cb1a824cca" - integrity sha512-BCxgX1BC2hD/oBlIFUgOCQDOPV8nSINxCwM3o93xP4P9Fq6aV5sgv2cOOITDMtCfQ+3PvHp3l689XZvAM9QyOA== - dependencies: - "@babel/helper-get-function-arity" "^7.8.3" - "@babel/template" "^7.8.3" - "@babel/types" "^7.8.3" - "@babel/helper-get-function-arity@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0.tgz#83572d4320e2a4657263734113c42868b64e49c3" @@ -375,13 +269,6 @@ dependencies: "@babel/types" "^7.7.4" -"@babel/helper-get-function-arity@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.8.3.tgz#b894b947bd004381ce63ea1db9f08547e920abd5" - integrity sha512-FVDR+Gd9iLjUMY1fzE2SR0IuaJToR4RkCDARVfsBBPSP53GEqSFjD8gNyxg246VUyc/ALRxFaAK8rVG7UT7xRA== - dependencies: - "@babel/types" "^7.8.3" - "@babel/helper-hoist-variables@^7.4.4": version "7.4.4" resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.4.4.tgz#0298b5f25c8c09c53102d52ac4a98f773eb2850a" @@ -396,13 +283,6 @@ dependencies: "@babel/types" "^7.7.4" -"@babel/helper-hoist-variables@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.8.3.tgz#1dbe9b6b55d78c9b4183fc8cdc6e30ceb83b7134" - integrity sha512-ky1JLOjcDUtSc+xkt0xhYff7Z6ILTAHKmZLHPxAhOP0Nd77O+3nCsd6uSVYur6nJnCI029CrNbYlc0LoPfAPQg== - dependencies: - "@babel/types" "^7.8.3" - "@babel/helper-member-expression-to-functions@^7.5.5": version "7.5.5" resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.5.5.tgz#1fb5b8ec4453a93c439ee9fe3aeea4a84b76b590" @@ -417,13 +297,6 @@ dependencies: "@babel/types" "^7.7.4" -"@babel/helper-member-expression-to-functions@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.8.3.tgz#659b710498ea6c1d9907e0c73f206eee7dadc24c" - integrity sha512-fO4Egq88utkQFjbPrSHGmGLFqmrshs11d46WI+WZDESt7Wu7wN2G2Iu+NMMZJFDOVRHAMIkB5SNh30NtwCA7RA== - dependencies: - "@babel/types" "^7.8.3" - "@babel/helper-module-imports@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.0.0.tgz#96081b7111e486da4d2cd971ad1a4fe216cc2e3d" @@ -438,13 +311,6 @@ dependencies: "@babel/types" "^7.7.4" -"@babel/helper-module-imports@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.8.3.tgz#7fe39589b39c016331b6b8c3f441e8f0b1419498" - integrity sha512-R0Bx3jippsbAEtzkpZ/6FIiuzOURPcMjHp+Z6xPe6DtApDJx+w7UYyOLanZqO8+wKR9G10s/FmHXvxaMd9s6Kg== - dependencies: - "@babel/types" "^7.8.3" - "@babel/helper-module-transforms@^7.1.0", "@babel/helper-module-transforms@^7.4.4": version "7.5.5" resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.5.5.tgz#f84ff8a09038dcbca1fd4355661a500937165b4a" @@ -457,22 +323,10 @@ "@babel/types" "^7.5.5" lodash "^4.17.13" -"@babel/helper-module-transforms@^7.7.4", "@babel/helper-module-transforms@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.8.3.tgz#d305e35d02bee720fbc2c3c3623aa0c316c01590" - integrity sha512-C7NG6B7vfBa/pwCOshpMbOYUmrYQDfCpVL/JCRu0ek8B5p8kue1+BCXpg2vOYs7w5ACB9GTOBYQ5U6NwrMg+3Q== - dependencies: - "@babel/helper-module-imports" "^7.8.3" - "@babel/helper-simple-access" "^7.8.3" - "@babel/helper-split-export-declaration" "^7.8.3" - "@babel/template" "^7.8.3" - "@babel/types" "^7.8.3" - lodash "^4.17.13" - -"@babel/helper-module-transforms@^7.7.5": - version "7.7.5" - resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.7.5.tgz#d044da7ffd91ec967db25cd6748f704b6b244835" - integrity sha512-A7pSxyJf1gN5qXVcidwLWydjftUN878VkalhXX5iQDuGyiGK3sOrrKKHF4/A4fwHtnsotv/NipwAeLzY4KQPvw== +"@babel/helper-module-transforms@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.7.4.tgz#8d7cdb1e1f8ea3d8c38b067345924ac4f8e0879a" + integrity sha512-ehGBu4mXrhs0FxAqN8tWkzF8GSIGAiEumu4ONZ/hD9M88uHcD+Yu2ttKfOCgwzoesJOJrtQh7trI5YPbRtMmnA== dependencies: "@babel/helper-module-imports" "^7.7.4" "@babel/helper-simple-access" "^7.7.4" @@ -495,23 +349,11 @@ dependencies: "@babel/types" "^7.7.4" -"@babel/helper-optimise-call-expression@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.8.3.tgz#7ed071813d09c75298ef4f208956006b6111ecb9" - integrity sha512-Kag20n86cbO2AvHca6EJsvqAd82gc6VMGule4HwebwMlwkpXuVqrNRj6CkCV2sKxgi9MyAUnZVnZ6lJ1/vKhHQ== - dependencies: - "@babel/types" "^7.8.3" - "@babel/helper-plugin-utils@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.0.0.tgz#bbb3fbee98661c569034237cc03967ba99b4f250" integrity sha512-CYAOUCARwExnEixLdB6sDm2dIJ/YgEAKDM1MOeMeZu9Ld/bDgVo8aiWrXwcY7OBh+1Ea2uUcVRcxKk0GJvW7QA== -"@babel/helper-plugin-utils@^7.8.0", "@babel/helper-plugin-utils@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.8.3.tgz#9ea293be19babc0f52ff8ca88b34c3611b208670" - integrity sha512-j+fq49Xds2smCUNYmEHF9kGNkhbet6yVIBp4e6oeQpH1RUs/Ir06xUKzDjDkGcaaokPiTNs2JBWHjaE4csUkZQ== - "@babel/helper-regex@^7.0.0", "@babel/helper-regex@^7.4.4": version "7.5.5" resolved "https://registry.yarnpkg.com/@babel/helper-regex/-/helper-regex-7.5.5.tgz#0aa6824f7100a2e0e89c1527c23936c152cab351" @@ -519,13 +361,6 @@ dependencies: lodash "^4.17.13" -"@babel/helper-regex@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/helper-regex/-/helper-regex-7.8.3.tgz#139772607d51b93f23effe72105b319d2a4c6965" - integrity sha512-BWt0QtYv/cg/NecOAZMdcn/waj/5P26DR4mVLXfFtDokSR6fyuG0Pj+e2FqtSME+MqED1khnSMulkmGl8qWiUQ== - dependencies: - lodash "^4.17.13" - "@babel/helper-remap-async-to-generator@^7.1.0": version "7.1.0" resolved "https://registry.yarnpkg.com/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.1.0.tgz#361d80821b6f38da75bd3f0785ece20a88c5fe7f" @@ -537,16 +372,16 @@ "@babel/traverse" "^7.1.0" "@babel/types" "^7.0.0" -"@babel/helper-remap-async-to-generator@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.8.3.tgz#273c600d8b9bf5006142c1e35887d555c12edd86" - integrity sha512-kgwDmw4fCg7AVgS4DukQR/roGp+jP+XluJE5hsRZwxCYGg+Rv9wSGErDWhlI90FODdYfd4xG4AQRiMDjjN0GzA== +"@babel/helper-remap-async-to-generator@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.7.4.tgz#c68c2407350d9af0e061ed6726afb4fff16d0234" + integrity sha512-Sk4xmtVdM9sA/jCI80f+KS+Md+ZHIpjuqmYPk1M7F/upHou5e4ReYmExAiu6PVe65BhJPZA2CY9x9k4BqE5klw== dependencies: - "@babel/helper-annotate-as-pure" "^7.8.3" - "@babel/helper-wrap-function" "^7.8.3" - "@babel/template" "^7.8.3" - "@babel/traverse" "^7.8.3" - "@babel/types" "^7.8.3" + "@babel/helper-annotate-as-pure" "^7.7.4" + "@babel/helper-wrap-function" "^7.7.4" + "@babel/template" "^7.7.4" + "@babel/traverse" "^7.7.4" + "@babel/types" "^7.7.4" "@babel/helper-replace-supers@^7.5.5": version "7.5.5" @@ -568,16 +403,6 @@ "@babel/traverse" "^7.7.4" "@babel/types" "^7.7.4" -"@babel/helper-replace-supers@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.8.3.tgz#91192d25f6abbcd41da8a989d4492574fb1530bc" - integrity sha512-xOUssL6ho41U81etpLoT2RTdvdus4VfHamCuAm4AHxGr+0it5fnwoVdwUJ7GFEqCsQYzJUhcbsN9wB9apcYKFA== - dependencies: - "@babel/helper-member-expression-to-functions" "^7.8.3" - "@babel/helper-optimise-call-expression" "^7.8.3" - "@babel/traverse" "^7.8.3" - "@babel/types" "^7.8.3" - "@babel/helper-simple-access@^7.1.0": version "7.1.0" resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.1.0.tgz#65eeb954c8c245beaa4e859da6188f39d71e585c" @@ -594,14 +419,6 @@ "@babel/template" "^7.7.4" "@babel/types" "^7.7.4" -"@babel/helper-simple-access@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.8.3.tgz#7f8109928b4dab4654076986af575231deb639ae" - integrity sha512-VNGUDjx5cCWg4vvCTR8qQ7YJYZ+HBjxOgXEl7ounz+4Sn7+LMD3CFrCTEU6/qXKbA2nKg21CwhhBzO0RpRbdCw== - dependencies: - "@babel/template" "^7.8.3" - "@babel/types" "^7.8.3" - "@babel/helper-split-export-declaration@^7.4.4": version "7.4.4" resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.4.4.tgz#ff94894a340be78f53f06af038b205c49d993677" @@ -616,13 +433,6 @@ dependencies: "@babel/types" "^7.7.4" -"@babel/helper-split-export-declaration@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.8.3.tgz#31a9f30070f91368a7182cf05f831781065fc7a9" - integrity sha512-3x3yOeyBhW851hroze7ElzdkeRXQYQbFIb7gLK1WQYsw2GWDay5gAJNw1sWJ0VFP6z5J1whqeXH/WCdCjZv6dA== - dependencies: - "@babel/types" "^7.8.3" - "@babel/helper-wrap-function@^7.1.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/helper-wrap-function/-/helper-wrap-function-7.2.0.tgz#c4e0012445769e2815b55296ead43a958549f6fa" @@ -633,15 +443,15 @@ "@babel/traverse" "^7.1.0" "@babel/types" "^7.2.0" -"@babel/helper-wrap-function@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/helper-wrap-function/-/helper-wrap-function-7.8.3.tgz#9dbdb2bb55ef14aaa01fe8c99b629bd5352d8610" - integrity sha512-LACJrbUET9cQDzb6kG7EeD7+7doC3JNvUgTEQOx2qaO1fKlzE/Bf05qs9w1oXQMmXlPO65lC3Tq9S6gZpTErEQ== +"@babel/helper-wrap-function@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/helper-wrap-function/-/helper-wrap-function-7.7.4.tgz#37ab7fed5150e22d9d7266e830072c0cdd8baace" + integrity sha512-VsfzZt6wmsocOaVU0OokwrIytHND55yvyT4BPB9AIIgwr8+x7617hetdJTsuGwygN5RC6mxA9EJztTjuwm2ofg== dependencies: - "@babel/helper-function-name" "^7.8.3" - "@babel/template" "^7.8.3" - "@babel/traverse" "^7.8.3" - "@babel/types" "^7.8.3" + "@babel/helper-function-name" "^7.7.4" + "@babel/template" "^7.7.4" + "@babel/traverse" "^7.7.4" + "@babel/types" "^7.7.4" "@babel/helpers@^7.5.5": version "7.5.5" @@ -670,49 +480,30 @@ esutils "^2.0.2" js-tokens "^4.0.0" -"@babel/highlight@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.8.3.tgz#28f173d04223eaaa59bc1d439a3836e6d1265797" - integrity sha512-PX4y5xQUvy0fnEVHrYOarRPXVWafSjTW9T0Hab8gVIawpl2Sj0ORyrygANq+KjcNlSSTw0YCLSNA8OyZ1I4yEg== - dependencies: - chalk "^2.0.0" - esutils "^2.0.2" - js-tokens "^4.0.0" - -"@babel/parser@7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.8.3.tgz#790874091d2001c9be6ec426c2eed47bc7679081" - integrity sha512-/V72F4Yp/qmHaTALizEm9Gf2eQHV3QyTL3K0cNfijwnMnb1L+LDlAubb/ZnSdGAVzVSWakujHYs1I26x66sMeQ== - "@babel/parser@^7.0.0", "@babel/parser@^7.1.0", "@babel/parser@^7.4.3", "@babel/parser@^7.4.4", "@babel/parser@^7.5.5": version "7.5.5" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.5.5.tgz#02f077ac8817d3df4a832ef59de67565e71cca4b" integrity sha512-E5BN68cqR7dhKan1SfqgPGhQ178bkVKpXTPEXnFJBrEt8/DKRZlybmy+IgYLTeN7tp1R5Ccmbm2rBk17sHYU3g== -"@babel/parser@^7.2.0", "@babel/parser@^7.7.4": - version "7.7.5" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.7.5.tgz#cbf45321619ac12d83363fcf9c94bb67fa646d71" - integrity sha512-KNlOe9+/nk4i29g0VXgl8PEXIRms5xKLJeuZ6UptN0fHv+jDiriG+y94X6qAgWTR0h3KaoM1wK5G5h7MHFRSig== +"@babel/parser@^7.2.0", "@babel/parser@^7.6.2": + version "7.6.2" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.6.2.tgz#205e9c95e16ba3b8b96090677a67c9d6075b70a1" + integrity sha512-mdFqWrSPCmikBoaBYMuBulzTIKuXVPtEISFbRRVNwMWpCms/hmE2kRq0bblUHaNRKrjRlmVbx1sDHmjmRgD2Xg== "@babel/parser@^7.6.0": version "7.6.0" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.6.0.tgz#3e05d0647432a8326cb28d0de03895ae5a57f39b" integrity sha512-+o2q111WEx4srBs7L9eJmcwi655eD8sXniLqMB93TBK9GrNzGrxDWSjiqz2hLU0Ha8MTXFIP0yd9fNdP+m43ZQ== -"@babel/parser@^7.6.2": - version "7.6.2" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.6.2.tgz#205e9c95e16ba3b8b96090677a67c9d6075b70a1" - integrity sha512-mdFqWrSPCmikBoaBYMuBulzTIKuXVPtEISFbRRVNwMWpCms/hmE2kRq0bblUHaNRKrjRlmVbx1sDHmjmRgD2Xg== - "@babel/parser@^7.6.3": version "7.6.4" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.6.4.tgz#cb9b36a7482110282d5cb6dd424ec9262b473d81" integrity sha512-D8RHPW5qd0Vbyo3qb+YjO5nvUVRTXFLQ/FsDxJU2Nqz4uB5EnUN0ZQSEYpvTIbRuttig1XbHWU5oMeQwQSAA+A== -"@babel/parser@^7.8.3", "@babel/parser@^7.8.4": - version "7.8.4" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.8.4.tgz#d1dbe64691d60358a974295fa53da074dd2ce8e8" - integrity sha512-0fKu/QqildpXmPVaRBoXOlyBb3MC+J0A66x97qEfLOMkn3u6nfY5esWogQwi/K0BjASYy4DbnsEWnpNL6qT5Mw== +"@babel/parser@^7.7.4": + version "7.7.5" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.7.5.tgz#cbf45321619ac12d83363fcf9c94bb67fa646d71" + integrity sha512-KNlOe9+/nk4i29g0VXgl8PEXIRms5xKLJeuZ6UptN0fHv+jDiriG+y94X6qAgWTR0h3KaoM1wK5G5h7MHFRSig== "@babel/plugin-proposal-async-generator-functions@^7.2.0": version "7.2.0" @@ -724,15 +515,15 @@ "@babel/plugin-syntax-async-generators" "^7.2.0" "@babel/plugin-proposal-async-generator-functions@^7.7.4": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.8.3.tgz#bad329c670b382589721b27540c7d288601c6e6f" - integrity sha512-NZ9zLv848JsV3hs8ryEh7Uaz/0KsmPLqv0+PdkDJL1cJy0K4kOCFa8zc1E3mp+RHPQcpdfb/6GovEsW4VDrOMw== + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.7.4.tgz#0351c5ac0a9e927845fffd5b82af476947b7ce6d" + integrity sha512-1ypyZvGRXriY/QP668+s8sFr2mqinhkRDMPSQLNghCQE+GAkFtp+wkHVvg2+Hdki8gwP+NFzJBJ/N1BfzCCDEw== dependencies: - "@babel/helper-plugin-utils" "^7.8.3" - "@babel/helper-remap-async-to-generator" "^7.8.3" - "@babel/plugin-syntax-async-generators" "^7.8.0" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-remap-async-to-generator" "^7.7.4" + "@babel/plugin-syntax-async-generators" "^7.7.4" -"@babel/plugin-proposal-class-properties@7.5.5", "@babel/plugin-proposal-class-properties@^7.3.3": +"@babel/plugin-proposal-class-properties@7.5.5", "@babel/plugin-proposal-class-properties@^7.3.3", "@babel/plugin-proposal-class-properties@^7.5.1", "@babel/plugin-proposal-class-properties@^7.5.5": version "7.5.5" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.5.5.tgz#a974cfae1e37c3110e71f3c6a2e48b8e71958cd4" integrity sha512-AF79FsnWFxjlaosgdi421vmYG6/jg79bVD0dpD44QdgobzHKuLZ6S3vl8la9qIeSwGi8i1fS0O1mfuDAAdo1/A== @@ -740,7 +531,7 @@ "@babel/helper-create-class-features-plugin" "^7.5.5" "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-proposal-class-properties@^7.0.0", "@babel/plugin-proposal-class-properties@^7.5.1", "@babel/plugin-proposal-class-properties@^7.5.5": +"@babel/plugin-proposal-class-properties@^7.7.0": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.7.4.tgz#2f964f0cb18b948450362742e33e15211e77c2ba" integrity sha512-EcuXeV4Hv1X3+Q1TsuOmyyxeTRiSqurGJ26+I/FW1WbymmRRapVORm6x1Zl3iDIHyRxEs+VXWp6qnlcfcJSbbw== @@ -748,14 +539,6 @@ "@babel/helper-create-class-features-plugin" "^7.7.4" "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-proposal-class-properties@^7.7.0": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.8.3.tgz#5e06654af5cd04b608915aada9b2a6788004464e" - integrity sha512-EqFhbo7IosdgPgZggHaNObkmO1kNUe3slaKu54d5OWvy+p9QIKOzK1GAEpAIsZtWVtPXUHSMcT4smvDrCfY4AA== - dependencies: - "@babel/helper-create-class-features-plugin" "^7.8.3" - "@babel/helper-plugin-utils" "^7.8.3" - "@babel/plugin-proposal-decorators@7.4.4": version "7.4.4" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-decorators/-/plugin-proposal-decorators-7.4.4.tgz#de9b2a1a8ab0196f378e2a82f10b6e2a36f21cc0" @@ -798,12 +581,12 @@ "@babel/plugin-syntax-json-strings" "^7.7.4" "@babel/plugin-proposal-nullish-coalescing-operator@^7.4.4": - version "7.7.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-nullish-coalescing-operator/-/plugin-proposal-nullish-coalescing-operator-7.7.4.tgz#7db302c83bc30caa89e38fee935635ef6bd11c28" - integrity sha512-TbYHmr1Gl1UC7Vo2HVuj/Naci5BEGNZ0AJhzqD2Vpr6QPFWpUmBRLrIDjedzx7/CShq0bRDS2gI4FIs77VHLVQ== + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-nullish-coalescing-operator/-/plugin-proposal-nullish-coalescing-operator-7.4.4.tgz#41c360d59481d88e0ce3a3f837df10121a769b39" + integrity sha512-Amph7Epui1Dh/xxUxS2+K22/MUi6+6JVTvy3P58tja3B6yKTSjwwx0/d83rF7551D6PVSSoplQb8GCwqec7HRw== dependencies: "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-syntax-nullish-coalescing-operator" "^7.7.4" + "@babel/plugin-syntax-nullish-coalescing-operator" "^7.2.0" "@babel/plugin-proposal-object-rest-spread@7.5.5", "@babel/plugin-proposal-object-rest-spread@^7.3.2", "@babel/plugin-proposal-object-rest-spread@^7.5.5": version "7.5.5" @@ -813,7 +596,7 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-syntax-object-rest-spread" "^7.2.0" -"@babel/plugin-proposal-object-rest-spread@^7.0.0": +"@babel/plugin-proposal-object-rest-spread@^7.6.2", "@babel/plugin-proposal-object-rest-spread@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.7.4.tgz#cc57849894a5c774214178c8ab64f6334ec8af71" integrity sha512-rnpnZR3/iWKmiQyJ3LKJpSwLDcX/nSXhdLk4Aq/tXOApIvyu7qoabrige0ylsAJffaUC51WiBu209Q0U+86OWQ== @@ -821,14 +604,6 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-syntax-object-rest-spread" "^7.7.4" -"@babel/plugin-proposal-object-rest-spread@^7.6.2", "@babel/plugin-proposal-object-rest-spread@^7.7.4": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.8.3.tgz#eb5ae366118ddca67bed583b53d7554cad9951bb" - integrity sha512-8qvuPwU/xxUCt78HocNlv0mXXo0wdh9VT1R04WU8HGOfaOob26pF+9P5/lYjN/q7DHOX1bvX60hnhOvuQUJdbA== - dependencies: - "@babel/helper-plugin-utils" "^7.8.3" - "@babel/plugin-syntax-object-rest-spread" "^7.8.0" - "@babel/plugin-proposal-optional-catch-binding@^7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.2.0.tgz#135d81edb68a081e55e56ec48541ece8065c38f5" @@ -846,12 +621,12 @@ "@babel/plugin-syntax-optional-catch-binding" "^7.7.4" "@babel/plugin-proposal-optional-chaining@^7.6.0": - version "7.7.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.7.5.tgz#f0835f044cef85b31071a924010a2a390add11d4" - integrity sha512-sOwFqT8JSchtJeDD+CjmWCaiFoLxY4Ps7NjvwHC/U7l4e9i5pTRNt8nDMIFSOUL+ncFbYSwruHM8WknYItWdXw== + version "7.6.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.6.0.tgz#e9bf1f9b9ba10c77c033082da75f068389041af8" + integrity sha512-kj4gkZ6qUggkprRq3Uh5KP8XnE1MdIO0J7MhdDX8+rAbB6dJ2UrensGIS+0NPZAaaJ1Vr0PN6oLUgXMU1uMcSg== dependencies: "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-syntax-optional-chaining" "^7.7.4" + "@babel/plugin-syntax-optional-chaining" "^7.2.0" "@babel/plugin-proposal-unicode-property-regex@^7.4.4": version "7.4.4" @@ -877,17 +652,10 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-syntax-async-generators@^7.7.4", "@babel/plugin-syntax-async-generators@^7.8.0": - version "7.8.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz#a983fb1aeb2ec3f6ed042a210f640e90e786fe0d" - integrity sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw== - dependencies: - "@babel/helper-plugin-utils" "^7.8.0" - -"@babel/plugin-syntax-class-properties@^7.0.0": +"@babel/plugin-syntax-async-generators@^7.7.4": version "7.7.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.7.4.tgz#6048c129ea908a432a1ff85f1dc794dc62ddaa5e" - integrity sha512-JH3v5ZOeKT0qqdJ9BeBcZTFQiJOMax8RopSr1bH6ASkZKo2qWsvBML7W1mp89sszBRDBBRO8snqcByGdrMTdMg== + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.7.4.tgz#331aaf310a10c80c44a66b238b6e49132bd3c889" + integrity sha512-Li4+EjSpBgxcsmeEF8IFcfV/+yJGxHXDirDkEoyFjumuwbmfCVHUt0HuowD/iGM7OhIRyXJH9YXxqiH6N815+g== dependencies: "@babel/helper-plugin-utils" "^7.0.0" @@ -906,16 +674,9 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-syntax-dynamic-import@^7.7.4": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.8.3.tgz#62bf98b2da3cd21d626154fc96ee5b3cb68eacb3" - integrity sha512-5gdGbFon+PszYzqs83S3E5mpi7/y/8M9eC90MRTZfduQOYW76ig6SOSPNe41IG5LoP3FGBn2N0RjVDSQiS94kQ== - dependencies: - "@babel/helper-plugin-utils" "^7.8.0" - -"@babel/plugin-syntax-flow@^7.0.0": version "7.7.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-flow/-/plugin-syntax-flow-7.7.4.tgz#6d91b59e1a0e4c17f36af2e10dd64ef220919d7b" - integrity sha512-2AMAWl5PsmM5KPkB22cvOkUyWk6MjUaqhHNU5nSPUl/ns3j5qLfw2SuYP5RbVZ0tfLvePr4zUScbICtDP2CUNw== + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.7.4.tgz#29ca3b4415abfe4a5ec381e903862ad1a54c3aec" + integrity sha512-jHQW0vbRGvwQNgyVxwDh4yuXu4bH1f5/EICJLAhl1SblLs2CDhrsmCk+v5XLdE9wxtAFRyxx+P//Iw+a5L/tTg== dependencies: "@babel/helper-plugin-utils" "^7.0.0" @@ -926,17 +687,17 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-syntax-json-strings@^7.2.0", "@babel/plugin-syntax-json-strings@^7.7.4": - version "7.7.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.7.4.tgz#86e63f7d2e22f9e27129ac4e83ea989a382e86cc" - integrity sha512-QpGupahTQW1mHRXddMG5srgpHWqRLwJnJZKXTigB9RPFCCGbDGCgBeM/iC82ICXp414WeYx/tD54w7M2qRqTMg== +"@babel/plugin-syntax-json-strings@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.2.0.tgz#72bd13f6ffe1d25938129d2a186b11fd62951470" + integrity sha512-5UGYnMSLRE1dqqZwug+1LISpA403HzlSfsg6P9VXU6TBjcSHeNlw4DxDx7LgpF+iKZoOG/+uzqoRHTdcUpiZNg== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-syntax-jsx@^7.0.0", "@babel/plugin-syntax-jsx@^7.7.4": +"@babel/plugin-syntax-json-strings@^7.7.4": version "7.7.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.7.4.tgz#dab2b56a36fb6c3c222a1fbc71f7bf97f327a9ec" - integrity sha512-wuy6fiMe9y7HeZBWXYCGt2RGxZOj0BImZ9EyXJVnVGBKO/Br592rbR3rtIQn0eQhAk9vqaKP5n8tVqEFBQMfLg== + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.7.4.tgz#86e63f7d2e22f9e27129ac4e83ea989a382e86cc" + integrity sha512-QpGupahTQW1mHRXddMG5srgpHWqRLwJnJZKXTigB9RPFCCGbDGCgBeM/iC82ICXp414WeYx/tD54w7M2qRqTMg== dependencies: "@babel/helper-plugin-utils" "^7.0.0" @@ -947,10 +708,17 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-syntax-nullish-coalescing-operator@^7.7.4": +"@babel/plugin-syntax-jsx@^7.7.4": version "7.7.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.7.4.tgz#e53b751d0c3061b1ba3089242524b65a7a9da12b" - integrity sha512-XKh/yIRPiQTOeBg0QJjEus5qiSKucKAiApNtO1psqG7D17xmE+X2i5ZqBEuSvo0HRuyPaKaSN/Gy+Ha9KFQolw== + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.7.4.tgz#dab2b56a36fb6c3c222a1fbc71f7bf97f327a9ec" + integrity sha512-wuy6fiMe9y7HeZBWXYCGt2RGxZOj0BImZ9EyXJVnVGBKO/Br592rbR3rtIQn0eQhAk9vqaKP5n8tVqEFBQMfLg== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-syntax-nullish-coalescing-operator@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.2.0.tgz#f75083dfd5ade73e783db729bbd87e7b9efb7624" + integrity sha512-lRCEaKE+LTxDQtgbYajI04ddt6WW0WJq57xqkAZ+s11h4YgfRHhVA/Y2VhfPzzFD4qeLHWg32DMp9HooY4Kqlg== dependencies: "@babel/helper-plugin-utils" "^7.0.0" @@ -968,13 +736,6 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-syntax-object-rest-spread@^7.8.0": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz#60e225edcbd98a640332a2e72dd3e66f1af55871" - integrity sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA== - dependencies: - "@babel/helper-plugin-utils" "^7.8.0" - "@babel/plugin-syntax-optional-catch-binding@^7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.2.0.tgz#a94013d6eda8908dfe6a477e7f9eda85656ecf5c" @@ -983,16 +744,16 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-syntax-optional-catch-binding@^7.7.4": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz#6111a265bcfb020eb9efd0fdfd7d26402b9ed6c1" - integrity sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q== + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.7.4.tgz#a3e38f59f4b6233867b4a92dcb0ee05b2c334aa6" + integrity sha512-4ZSuzWgFxqHRE31Glu+fEr/MirNZOMYmD/0BhBWyLyOOQz/gTAl7QmWm2hX1QxEIXsr2vkdlwxIzTyiYRC4xcQ== dependencies: - "@babel/helper-plugin-utils" "^7.8.0" + "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-syntax-optional-chaining@^7.7.4": - version "7.7.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.7.4.tgz#c91fdde6de85d2eb8906daea7b21944c3610c901" - integrity sha512-2MqYD5WjZSbJdUagnJvIdSfkb/ucOC9/1fRJxm7GAxY6YQLWlUvkfxoNbUPcPLHJyetKUDQ4+yyuUyAoc0HriA== +"@babel/plugin-syntax-optional-chaining@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.2.0.tgz#a59d6ae8c167e7608eaa443fda9fa8fa6bf21dff" + integrity sha512-HtGCtvp5Uq/jH/WNUPkK6b7rufnCPLLlDAFN7cmACoIjaOOiXxUt3SswU5loHqrhtqTsa/WoLQ1OQ1AGuZqaWA== dependencies: "@babel/helper-plugin-utils" "^7.0.0" @@ -1017,13 +778,6 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-arrow-functions@^7.0.0", "@babel/plugin-transform-arrow-functions@^7.7.4": - version "7.7.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.7.4.tgz#76309bd578addd8aee3b379d809c802305a98a12" - integrity sha512-zUXy3e8jBNPiffmqkHRNDdZM2r8DWhCB7HhcoyZjiK1TxYEluLHAvQuYnTT+ARqRpabWqy/NHkO6e3MsYB5YfA== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-transform-arrow-functions@^7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.2.0.tgz#9aeafbe4d6ffc6563bf8f8372091628f00779550" @@ -1031,6 +785,13 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" +"@babel/plugin-transform-arrow-functions@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.7.4.tgz#76309bd578addd8aee3b379d809c802305a98a12" + integrity sha512-zUXy3e8jBNPiffmqkHRNDdZM2r8DWhCB7HhcoyZjiK1TxYEluLHAvQuYnTT+ARqRpabWqy/NHkO6e3MsYB5YfA== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-transform-async-to-generator@^7.5.0": version "7.5.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.5.0.tgz#89a3848a0166623b5bc481164b5936ab947e887e" @@ -1041,20 +802,13 @@ "@babel/helper-remap-async-to-generator" "^7.1.0" "@babel/plugin-transform-async-to-generator@^7.7.4": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.8.3.tgz#4308fad0d9409d71eafb9b1a6ee35f9d64b64086" - integrity sha512-imt9tFLD9ogt56Dd5CI/6XgpukMwd/fLGSrix2httihVe7LOGVPhyhMh1BU5kDM7iHD08i8uUtmV2sWaBFlHVQ== - dependencies: - "@babel/helper-module-imports" "^7.8.3" - "@babel/helper-plugin-utils" "^7.8.3" - "@babel/helper-remap-async-to-generator" "^7.8.3" - -"@babel/plugin-transform-block-scoped-functions@^7.0.0": version "7.7.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.7.4.tgz#d0d9d5c269c78eaea76227ace214b8d01e4d837b" - integrity sha512-kqtQzwtKcpPclHYjLK//3lH8OFsCDuDJBaFhVwf8kqdnF6MN4l618UDlcA7TfRs3FayrHj+svYnSX8MC9zmUyQ== + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.7.4.tgz#694cbeae6d613a34ef0292713fa42fb45c4470ba" + integrity sha512-zpUTZphp5nHokuy8yLlyafxCJ0rSlFoSHypTUWgpdwoDXWQcseaect7cJ8Ppk6nunOM6+5rPMkod4OYKPR5MUg== dependencies: + "@babel/helper-module-imports" "^7.7.4" "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-remap-async-to-generator" "^7.7.4" "@babel/plugin-transform-block-scoped-functions@^7.2.0": version "7.2.0" @@ -1064,19 +818,11 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-transform-block-scoped-functions@^7.7.4": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.8.3.tgz#437eec5b799b5852072084b3ae5ef66e8349e8a3" - integrity sha512-vo4F2OewqjbB1+yaJ7k2EJFHlTP3jR634Z9Cj9itpqNjuLXvhlVxgnjsHsdRgASR8xYDrx6onw4vW5H6We0Jmg== - dependencies: - "@babel/helper-plugin-utils" "^7.8.3" - -"@babel/plugin-transform-block-scoping@^7.0.0": version "7.7.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.7.4.tgz#200aad0dcd6bb80372f94d9e628ea062c58bf224" - integrity sha512-2VBe9u0G+fDt9B5OV5DQH4KBf5DoiNkwFKOz0TCvBWvdAN2rOykCTkrL+jTLxfCAm76l9Qo5OqL7HBOx2dWggg== + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.7.4.tgz#d0d9d5c269c78eaea76227ace214b8d01e4d837b" + integrity sha512-kqtQzwtKcpPclHYjLK//3lH8OFsCDuDJBaFhVwf8kqdnF6MN4l618UDlcA7TfRs3FayrHj+svYnSX8MC9zmUyQ== dependencies: "@babel/helper-plugin-utils" "^7.0.0" - lodash "^4.17.13" "@babel/plugin-transform-block-scoping@^7.5.5": version "7.5.5" @@ -1095,26 +841,12 @@ lodash "^4.17.13" "@babel/plugin-transform-block-scoping@^7.7.4": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.8.3.tgz#97d35dab66857a437c166358b91d09050c868f3a" - integrity sha512-pGnYfm7RNRgYRi7bids5bHluENHqJhrV4bCZRwc5GamaWIIs07N4rZECcmJL6ZClwjDz1GbdMZFtPs27hTB06w== - dependencies: - "@babel/helper-plugin-utils" "^7.8.3" - lodash "^4.17.13" - -"@babel/plugin-transform-classes@^7.0.0": version "7.7.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.7.4.tgz#c92c14be0a1399e15df72667067a8f510c9400ec" - integrity sha512-sK1mjWat7K+buWRuImEzjNf68qrKcrddtpQo3swi9j7dUcG6y6R6+Di039QN2bD1dykeswlagupEmpOatFHHUg== + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.7.4.tgz#200aad0dcd6bb80372f94d9e628ea062c58bf224" + integrity sha512-2VBe9u0G+fDt9B5OV5DQH4KBf5DoiNkwFKOz0TCvBWvdAN2rOykCTkrL+jTLxfCAm76l9Qo5OqL7HBOx2dWggg== dependencies: - "@babel/helper-annotate-as-pure" "^7.7.4" - "@babel/helper-define-map" "^7.7.4" - "@babel/helper-function-name" "^7.7.4" - "@babel/helper-optimise-call-expression" "^7.7.4" "@babel/helper-plugin-utils" "^7.0.0" - "@babel/helper-replace-supers" "^7.7.4" - "@babel/helper-split-export-declaration" "^7.7.4" - globals "^11.1.0" + lodash "^4.17.13" "@babel/plugin-transform-classes@^7.5.5": version "7.5.5" @@ -1131,25 +863,18 @@ globals "^11.1.0" "@babel/plugin-transform-classes@^7.7.4": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.8.3.tgz#46fd7a9d2bb9ea89ce88720477979fe0d71b21b8" - integrity sha512-SjT0cwFJ+7Rbr1vQsvphAHwUHvSUPmMjMU/0P59G8U2HLFqSa082JO7zkbDNWs9kH/IUqpHI6xWNesGf8haF1w== - dependencies: - "@babel/helper-annotate-as-pure" "^7.8.3" - "@babel/helper-define-map" "^7.8.3" - "@babel/helper-function-name" "^7.8.3" - "@babel/helper-optimise-call-expression" "^7.8.3" - "@babel/helper-plugin-utils" "^7.8.3" - "@babel/helper-replace-supers" "^7.8.3" - "@babel/helper-split-export-declaration" "^7.8.3" - globals "^11.1.0" - -"@babel/plugin-transform-computed-properties@^7.0.0", "@babel/plugin-transform-computed-properties@^7.7.4": version "7.7.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.7.4.tgz#e856c1628d3238ffe12d668eb42559f79a81910d" - integrity sha512-bSNsOsZnlpLLyQew35rl4Fma3yKWqK3ImWMSC/Nc+6nGjC9s5NFWAer1YQ899/6s9HxO2zQC1WoFNfkOqRkqRQ== + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.7.4.tgz#c92c14be0a1399e15df72667067a8f510c9400ec" + integrity sha512-sK1mjWat7K+buWRuImEzjNf68qrKcrddtpQo3swi9j7dUcG6y6R6+Di039QN2bD1dykeswlagupEmpOatFHHUg== dependencies: + "@babel/helper-annotate-as-pure" "^7.7.4" + "@babel/helper-define-map" "^7.7.4" + "@babel/helper-function-name" "^7.7.4" + "@babel/helper-optimise-call-expression" "^7.7.4" "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-replace-supers" "^7.7.4" + "@babel/helper-split-export-declaration" "^7.7.4" + globals "^11.1.0" "@babel/plugin-transform-computed-properties@^7.2.0": version "7.2.0" @@ -1158,6 +883,13 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" +"@babel/plugin-transform-computed-properties@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.7.4.tgz#e856c1628d3238ffe12d668eb42559f79a81910d" + integrity sha512-bSNsOsZnlpLLyQew35rl4Fma3yKWqK3ImWMSC/Nc+6nGjC9s5NFWAer1YQ899/6s9HxO2zQC1WoFNfkOqRkqRQ== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-transform-destructuring@7.5.0", "@babel/plugin-transform-destructuring@^7.5.0": version "7.5.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.5.0.tgz#f6c09fdfe3f94516ff074fe877db7bc9ef05855a" @@ -1165,13 +897,6 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-destructuring@^7.0.0", "@babel/plugin-transform-destructuring@^7.7.4": - version "7.7.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.7.4.tgz#2b713729e5054a1135097b6a67da1b6fe8789267" - integrity sha512-4jFMXI1Cu2aXbcXXl8Lr6YubCn6Oc7k9lLsu8v61TZh+1jny2BWmdtvY9zSUlLdGUvcy9DMAWyZEOqjsbeg/wA== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-transform-destructuring@^7.6.0": version "7.6.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.6.0.tgz#44bbe08b57f4480094d57d9ffbcd96d309075ba6" @@ -1179,6 +904,13 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" +"@babel/plugin-transform-destructuring@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.7.4.tgz#2b713729e5054a1135097b6a67da1b6fe8789267" + integrity sha512-4jFMXI1Cu2aXbcXXl8Lr6YubCn6Oc7k9lLsu8v61TZh+1jny2BWmdtvY9zSUlLdGUvcy9DMAWyZEOqjsbeg/wA== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-transform-dotall-regex@^7.4.4": version "7.4.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.4.4.tgz#361a148bc951444312c69446d76ed1ea8e4450c3" @@ -1234,13 +966,6 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-syntax-flow" "^7.2.0" -"@babel/plugin-transform-for-of@^7.0.0": - version "7.7.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.7.4.tgz#248800e3a5e507b1f103d8b4ca998e77c63932bc" - integrity sha512-zZ1fD1B8keYtEcKF+M1TROfeHTKnijcVQm0yO/Yu1f7qoDoxEIc/+GX6Go430Bg84eM/xwPFp0+h4EbZg7epAA== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-transform-for-of@^7.4.4": version "7.4.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.4.4.tgz#0267fc735e24c808ba173866c6c4d1440fc3c556" @@ -1249,18 +974,10 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-transform-for-of@^7.7.4": - version "7.8.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.8.4.tgz#6fe8eae5d6875086ee185dd0b098a8513783b47d" - integrity sha512-iAXNlOWvcYUYoV8YIxwS7TxGRJcxyl8eQCfT+A5j8sKUzRFvJdcyjp97jL2IghWSRDaL2PU2O2tX8Cu9dTBq5A== - dependencies: - "@babel/helper-plugin-utils" "^7.8.3" - -"@babel/plugin-transform-function-name@^7.0.0": version "7.7.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.7.4.tgz#75a6d3303d50db638ff8b5385d12451c865025b1" - integrity sha512-E/x09TvjHNhsULs2IusN+aJNRV5zKwxu1cpirZyRPw+FyyIKEHPXTsadj48bVpc1R5Qq1B5ZkzumuFLytnbT6g== + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.7.4.tgz#248800e3a5e507b1f103d8b4ca998e77c63932bc" + integrity sha512-zZ1fD1B8keYtEcKF+M1TROfeHTKnijcVQm0yO/Yu1f7qoDoxEIc/+GX6Go430Bg84eM/xwPFp0+h4EbZg7epAA== dependencies: - "@babel/helper-function-name" "^7.7.4" "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-transform-function-name@^7.4.4": @@ -1272,18 +989,11 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-transform-function-name@^7.7.4": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.8.3.tgz#279373cb27322aaad67c2683e776dfc47196ed8b" - integrity sha512-rO/OnDS78Eifbjn5Py9v8y0aR+aSYhDhqAwVfsTl0ERuMZyr05L1aFSCJnbv2mmsLkit/4ReeQ9N2BgLnOcPCQ== - dependencies: - "@babel/helper-function-name" "^7.8.3" - "@babel/helper-plugin-utils" "^7.8.3" - -"@babel/plugin-transform-literals@^7.0.0": version "7.7.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-literals/-/plugin-transform-literals-7.7.4.tgz#27fe87d2b5017a2a5a34d1c41a6b9f6a6262643e" - integrity sha512-X2MSV7LfJFm4aZfxd0yLVFrEXAgPqYoDG53Br/tCKiKYfX0MjVjQeWPIhPHHsCqzwQANq+FLN786fF5rgLS+gw== + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.7.4.tgz#75a6d3303d50db638ff8b5385d12451c865025b1" + integrity sha512-E/x09TvjHNhsULs2IusN+aJNRV5zKwxu1cpirZyRPw+FyyIKEHPXTsadj48bVpc1R5Qq1B5ZkzumuFLytnbT6g== dependencies: + "@babel/helper-function-name" "^7.7.4" "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-transform-literals@^7.2.0": @@ -1294,16 +1004,9 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-transform-literals@^7.7.4": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-literals/-/plugin-transform-literals-7.8.3.tgz#aef239823d91994ec7b68e55193525d76dbd5dc1" - integrity sha512-3Tqf8JJ/qB7TeldGl+TT55+uQei9JfYaregDcEAyBZ7akutriFrt6C/wLYIer6OYhleVQvH/ntEhjE/xMmy10A== - dependencies: - "@babel/helper-plugin-utils" "^7.8.3" - -"@babel/plugin-transform-member-expression-literals@^7.0.0", "@babel/plugin-transform-member-expression-literals@^7.7.4": version "7.7.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.7.4.tgz#aee127f2f3339fc34ce5e3055d7ffbf7aa26f19a" - integrity sha512-9VMwMO7i69LHTesL0RdGy93JU6a+qOPuvB4F4d0kR0zyVjJRVJRaoaGjhtki6SzQUu8yen/vxPKN6CWnCUw6bA== + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-literals/-/plugin-transform-literals-7.7.4.tgz#27fe87d2b5017a2a5a34d1c41a6b9f6a6262643e" + integrity sha512-X2MSV7LfJFm4aZfxd0yLVFrEXAgPqYoDG53Br/tCKiKYfX0MjVjQeWPIhPHHsCqzwQANq+FLN786fF5rgLS+gw== dependencies: "@babel/helper-plugin-utils" "^7.0.0" @@ -1314,6 +1017,13 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" +"@babel/plugin-transform-member-expression-literals@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.7.4.tgz#aee127f2f3339fc34ce5e3055d7ffbf7aa26f19a" + integrity sha512-9VMwMO7i69LHTesL0RdGy93JU6a+qOPuvB4F4d0kR0zyVjJRVJRaoaGjhtki6SzQUu8yen/vxPKN6CWnCUw6bA== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-transform-modules-amd@^7.5.0": version "7.5.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.5.0.tgz#ef00435d46da0a5961aa728a1d2ecff063e4fb91" @@ -1324,22 +1034,12 @@ babel-plugin-dynamic-import-node "^2.3.0" "@babel/plugin-transform-modules-amd@^7.7.4": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.8.3.tgz#65606d44616b50225e76f5578f33c568a0b876a5" - integrity sha512-MadJiU3rLKclzT5kBH4yxdry96odTUwuqrZM+GllFI/VhxfPz+k9MshJM+MwhfkCdxxclSbSBbUGciBngR+kEQ== - dependencies: - "@babel/helper-module-transforms" "^7.8.3" - "@babel/helper-plugin-utils" "^7.8.3" - babel-plugin-dynamic-import-node "^2.3.0" - -"@babel/plugin-transform-modules-commonjs@^7.0.0": - version "7.7.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.7.5.tgz#1d27f5eb0bcf7543e774950e5b2fa782e637b345" - integrity sha512-9Cq4zTFExwFhQI6MT1aFxgqhIsMWQWDVwOgLzl7PTWJHsNaqFvklAU+Oz6AQLAS0dJKTwZSOCo20INwktxpi3Q== + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.7.4.tgz#276b3845ca2b228f2995e453adc2e6f54d72fb71" + integrity sha512-/542/5LNA18YDtg1F+QHvvUSlxdvjZoD/aldQwkq+E3WCkbEjNSN9zdrOXaSlfg3IfGi22ijzecklF/A7kVZFQ== dependencies: - "@babel/helper-module-transforms" "^7.7.5" + "@babel/helper-module-transforms" "^7.7.4" "@babel/helper-plugin-utils" "^7.0.0" - "@babel/helper-simple-access" "^7.7.4" babel-plugin-dynamic-import-node "^2.3.0" "@babel/plugin-transform-modules-commonjs@^7.5.0": @@ -1435,19 +1135,11 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-transform-new-target@^7.7.4": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.8.3.tgz#60cc2ae66d85c95ab540eb34babb6434d4c70c43" - integrity sha512-QuSGysibQpyxexRyui2vca+Cmbljo8bcRckgzYV4kRIsHpVeyeC3JDO63pY+xFZ6bWOBn7pfKZTqV4o/ix9sFw== - dependencies: - "@babel/helper-plugin-utils" "^7.8.3" - -"@babel/plugin-transform-object-super@^7.0.0": version "7.7.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.7.4.tgz#48488937a2d586c0148451bf51af9d7dda567262" - integrity sha512-ho+dAEhC2aRnff2JCA0SAK7V2R62zJd/7dmtoe7MHcso4C2mS+vZjn1Pb1pCVZvJs1mgsvv5+7sT+m3Bysb6eg== + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.7.4.tgz#4a0753d2d60639437be07b592a9e58ee00720167" + integrity sha512-CnPRiNtOG1vRodnsyGX37bHQleHE14B9dnnlgSeEs3ek3fHN1A1SScglTCg1sfbe7sRQ2BUcpgpTpWSfMKz3gg== dependencies: "@babel/helper-plugin-utils" "^7.0.0" - "@babel/helper-replace-supers" "^7.7.4" "@babel/plugin-transform-object-super@^7.5.5": version "7.5.5" @@ -1458,21 +1150,12 @@ "@babel/helper-replace-supers" "^7.5.5" "@babel/plugin-transform-object-super@^7.7.4": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.8.3.tgz#ebb6a1e7a86ffa96858bd6ac0102d65944261725" - integrity sha512-57FXk+gItG/GejofIyLIgBKTas4+pEU47IXKDBWFTxdPd7F80H8zybyAY7UoblVfBhBGs2EKM+bJUu2+iUYPDQ== - dependencies: - "@babel/helper-plugin-utils" "^7.8.3" - "@babel/helper-replace-supers" "^7.8.3" - -"@babel/plugin-transform-parameters@^7.0.0": version "7.7.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.7.4.tgz#da4555c97f39b51ac089d31c7380f03bca4075ce" - integrity sha512-VJwhVePWPa0DqE9vcfptaJSzNDKrWU/4FbYCjZERtmqEs05g3UMXnYMZoXja7JAJ7Y7sPZipwm/pGApZt7wHlw== + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.7.4.tgz#48488937a2d586c0148451bf51af9d7dda567262" + integrity sha512-ho+dAEhC2aRnff2JCA0SAK7V2R62zJd/7dmtoe7MHcso4C2mS+vZjn1Pb1pCVZvJs1mgsvv5+7sT+m3Bysb6eg== dependencies: - "@babel/helper-call-delegate" "^7.7.4" - "@babel/helper-get-function-arity" "^7.7.4" "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-replace-supers" "^7.7.4" "@babel/plugin-transform-parameters@^7.4.4": version "7.4.4" @@ -1484,19 +1167,12 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-transform-parameters@^7.7.4": - version "7.8.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.8.4.tgz#1d5155de0b65db0ccf9971165745d3bb990d77d3" - integrity sha512-IsS3oTxeTsZlE5KqzTbcC2sV0P9pXdec53SU+Yxv7o/6dvGM5AkTotQKhoSffhNgZ/dftsSiOoxy7evCYJXzVA== - dependencies: - "@babel/helper-call-delegate" "^7.8.3" - "@babel/helper-get-function-arity" "^7.8.3" - "@babel/helper-plugin-utils" "^7.8.3" - -"@babel/plugin-transform-property-literals@^7.0.0", "@babel/plugin-transform-property-literals@^7.7.4": version "7.7.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.7.4.tgz#2388d6505ef89b266103f450f9167e6bd73f98c2" - integrity sha512-MatJhlC4iHsIskWYyawl53KuHrt+kALSADLQQ/HkhTjX954fkxIEh4q5slL4oRAnsm/eDoZ4q0CIZpcqBuxhJQ== + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.7.4.tgz#da4555c97f39b51ac089d31c7380f03bca4075ce" + integrity sha512-VJwhVePWPa0DqE9vcfptaJSzNDKrWU/4FbYCjZERtmqEs05g3UMXnYMZoXja7JAJ7Y7sPZipwm/pGApZt7wHlw== dependencies: + "@babel/helper-call-delegate" "^7.7.4" + "@babel/helper-get-function-arity" "^7.7.4" "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-transform-property-literals@^7.2.0": @@ -1506,6 +1182,13 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" +"@babel/plugin-transform-property-literals@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.7.4.tgz#2388d6505ef89b266103f450f9167e6bd73f98c2" + integrity sha512-MatJhlC4iHsIskWYyawl53KuHrt+kALSADLQQ/HkhTjX954fkxIEh4q5slL4oRAnsm/eDoZ4q0CIZpcqBuxhJQ== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-transform-react-constant-elements@^7.0.0", "@babel/plugin-transform-react-constant-elements@^7.2.0": version "7.5.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-constant-elements/-/plugin-transform-react-constant-elements-7.5.0.tgz#4d6ae4033bc38f8a65dfca2b6235c44522a422fc" @@ -1624,13 +1307,6 @@ resolve "^1.8.1" semver "^5.5.1" -"@babel/plugin-transform-shorthand-properties@^7.0.0": - version "7.7.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.7.4.tgz#74a0a9b2f6d67a684c6fbfd5f0458eb7ba99891e" - integrity sha512-q+suddWRfIcnyG5YiDP58sT65AJDZSUhXQDZE3r04AuqD6d/XLaQPPXSBzP2zGerkgBivqtQm9XKGLuHqBID6Q== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-transform-shorthand-properties@^7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.2.0.tgz#6333aee2f8d6ee7e28615457298934a3b46198f0" @@ -1639,16 +1315,9 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-transform-shorthand-properties@^7.7.4": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.8.3.tgz#28545216e023a832d4d3a1185ed492bcfeac08c8" - integrity sha512-I9DI6Odg0JJwxCHzbzW08ggMdCezoWcuQRz3ptdudgwaHxTjxw5HgdFJmZIkIMlRymL6YiZcped4TTCB0JcC8w== - dependencies: - "@babel/helper-plugin-utils" "^7.8.3" - -"@babel/plugin-transform-spread@^7.0.0", "@babel/plugin-transform-spread@^7.7.4": version "7.7.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-spread/-/plugin-transform-spread-7.7.4.tgz#aa673b356fe6b7e70d69b6e33a17fef641008578" - integrity sha512-8OSs0FLe5/80cndziPlg4R0K6HcWSM0zyNhHhLsmw/Nc5MaA49cAsnoJ/t/YZf8qkG7fD+UjTRaApVDB526d7Q== + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.7.4.tgz#74a0a9b2f6d67a684c6fbfd5f0458eb7ba99891e" + integrity sha512-q+suddWRfIcnyG5YiDP58sT65AJDZSUhXQDZE3r04AuqD6d/XLaQPPXSBzP2zGerkgBivqtQm9XKGLuHqBID6Q== dependencies: "@babel/helper-plugin-utils" "^7.0.0" @@ -1659,6 +1328,13 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" +"@babel/plugin-transform-spread@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-spread/-/plugin-transform-spread-7.7.4.tgz#aa673b356fe6b7e70d69b6e33a17fef641008578" + integrity sha512-8OSs0FLe5/80cndziPlg4R0K6HcWSM0zyNhHhLsmw/Nc5MaA49cAsnoJ/t/YZf8qkG7fD+UjTRaApVDB526d7Q== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-transform-sticky-regex@^7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.2.0.tgz#a1e454b5995560a9c1e0d537dfc15061fd2687e1" @@ -1668,20 +1344,12 @@ "@babel/helper-regex" "^7.0.0" "@babel/plugin-transform-sticky-regex@^7.7.4": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.8.3.tgz#be7a1290f81dae767475452199e1f76d6175b100" - integrity sha512-9Spq0vGCD5Bb4Z/ZXXSK5wbbLFMG085qd2vhL1JYu1WcQ5bXqZBAYRzU1d+p79GcHs2szYv5pVQCX13QgldaWw== - dependencies: - "@babel/helper-plugin-utils" "^7.8.3" - "@babel/helper-regex" "^7.8.3" - -"@babel/plugin-transform-template-literals@^7.0.0", "@babel/plugin-transform-template-literals@^7.7.4": version "7.7.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.7.4.tgz#1eb6411736dd3fe87dbd20cc6668e5121c17d604" - integrity sha512-sA+KxLwF3QwGj5abMHkHgshp9+rRz+oY9uoRil4CyLtgEuE/88dpkeWgNk5qKVsJE9iSfly3nvHapdRiIS2wnQ== + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.7.4.tgz#ffb68c05090c30732076b1285dc1401b404a123c" + integrity sha512-Ls2NASyL6qtVe1H1hXts9yuEeONV2TJZmplLONkMPUG158CtmnrzW5Q5teibM5UVOFjG0D3IC5mzXR6pPpUY7A== dependencies: - "@babel/helper-annotate-as-pure" "^7.7.4" "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-regex" "^7.0.0" "@babel/plugin-transform-template-literals@^7.4.4": version "7.4.4" @@ -1691,6 +1359,14 @@ "@babel/helper-annotate-as-pure" "^7.0.0" "@babel/helper-plugin-utils" "^7.0.0" +"@babel/plugin-transform-template-literals@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.7.4.tgz#1eb6411736dd3fe87dbd20cc6668e5121c17d604" + integrity sha512-sA+KxLwF3QwGj5abMHkHgshp9+rRz+oY9uoRil4CyLtgEuE/88dpkeWgNk5qKVsJE9iSfly3nvHapdRiIS2wnQ== + dependencies: + "@babel/helper-annotate-as-pure" "^7.7.4" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-transform-typeof-symbol@^7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.2.0.tgz#117d2bcec2fbf64b4b59d1f9819894682d29f2b2" @@ -1948,9 +1624,9 @@ "@babel/plugin-transform-typescript" "^7.3.2" "@babel/preset-typescript@^7.7.4": - version "7.7.7" - resolved "https://registry.yarnpkg.com/@babel/preset-typescript/-/preset-typescript-7.7.7.tgz#69ddea54e8b4e491ccbf94147e673b2ac6e11e2e" - integrity sha512-Apg0sCTovsSA+pEaI8efnA44b9x4X/7z4P8vsWMiN8rSUaM4y4+Shl5NMWnMl6njvt96+CEb6jwpXAKYAVCSQA== + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/preset-typescript/-/preset-typescript-7.7.4.tgz#780059a78e6fa7f7a4c87f027292a86b31ce080a" + integrity sha512-rqrjxfdiHPsnuPur0jKrIIGQCIgoTWMTjlbWE69G4QJ6TIOVnnRnIJhUxNTL/VwDmEAVX08Tq3B1nirer5341w== dependencies: "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-transform-typescript" "^7.7.4" @@ -2045,30 +1721,6 @@ "@babel/parser" "^7.7.4" "@babel/types" "^7.7.4" -"@babel/template@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.8.3.tgz#e02ad04fe262a657809327f578056ca15fd4d1b8" - integrity sha512-04m87AcQgAFdvuoyiQ2kgELr2tV8B4fP/xJAVUL3Yb3bkNdMedD3d0rlSQr3PegP0cms3eHjl1F7PWlvWbU8FQ== - dependencies: - "@babel/code-frame" "^7.8.3" - "@babel/parser" "^7.8.3" - "@babel/types" "^7.8.3" - -"@babel/traverse@7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.8.3.tgz#a826215b011c9b4f73f3a893afbc05151358bf9a" - integrity sha512-we+a2lti+eEImHmEXp7bM9cTxGzxPmBiVJlLVD+FuuQMeeO7RaDbutbgeheDkw+Xe3mCfJHnGOWLswT74m2IPg== - dependencies: - "@babel/code-frame" "^7.8.3" - "@babel/generator" "^7.8.3" - "@babel/helper-function-name" "^7.8.3" - "@babel/helper-split-export-declaration" "^7.8.3" - "@babel/parser" "^7.8.3" - "@babel/types" "^7.8.3" - debug "^4.1.0" - globals "^11.1.0" - lodash "^4.17.13" - "@babel/traverse@^7.0.0", "@babel/traverse@^7.1.0", "@babel/traverse@^7.4.3", "@babel/traverse@^7.4.4", "@babel/traverse@^7.5.5": version "7.5.5" resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.5.5.tgz#f664f8f368ed32988cd648da9f72d5ca70f165bb" @@ -2084,17 +1736,17 @@ globals "^11.1.0" lodash "^4.17.13" -"@babel/traverse@^7.1.6", "@babel/traverse@^7.7.4": - version "7.7.4" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.7.4.tgz#9c1e7c60fb679fe4fcfaa42500833333c2058558" - integrity sha512-P1L58hQyupn8+ezVA2z5KBm4/Zr4lCC8dwKCMYzsa5jFMDMQAzaBNy9W5VjB+KAmBjb40U7a/H6ao+Xo+9saIw== +"@babel/traverse@^7.1.6", "@babel/traverse@^7.6.0": + version "7.6.2" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.6.2.tgz#b0e2bfd401d339ce0e6c05690206d1e11502ce2c" + integrity sha512-8fRE76xNwNttVEF2TwxJDGBLWthUkHWSldmfuBzVRmEDWOtu4XdINTgN7TDWzuLg4bbeIMLvfMFD9we5YcWkRQ== dependencies: "@babel/code-frame" "^7.5.5" - "@babel/generator" "^7.7.4" - "@babel/helper-function-name" "^7.7.4" - "@babel/helper-split-export-declaration" "^7.7.4" - "@babel/parser" "^7.7.4" - "@babel/types" "^7.7.4" + "@babel/generator" "^7.6.2" + "@babel/helper-function-name" "^7.1.0" + "@babel/helper-split-export-declaration" "^7.4.4" + "@babel/parser" "^7.6.2" + "@babel/types" "^7.6.0" debug "^4.1.0" globals "^11.1.0" lodash "^4.17.13" @@ -2114,45 +1766,21 @@ globals "^11.1.0" lodash "^4.17.13" -"@babel/traverse@^7.6.0": - version "7.6.2" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.6.2.tgz#b0e2bfd401d339ce0e6c05690206d1e11502ce2c" - integrity sha512-8fRE76xNwNttVEF2TwxJDGBLWthUkHWSldmfuBzVRmEDWOtu4XdINTgN7TDWzuLg4bbeIMLvfMFD9we5YcWkRQ== +"@babel/traverse@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.7.4.tgz#9c1e7c60fb679fe4fcfaa42500833333c2058558" + integrity sha512-P1L58hQyupn8+ezVA2z5KBm4/Zr4lCC8dwKCMYzsa5jFMDMQAzaBNy9W5VjB+KAmBjb40U7a/H6ao+Xo+9saIw== dependencies: "@babel/code-frame" "^7.5.5" - "@babel/generator" "^7.6.2" - "@babel/helper-function-name" "^7.1.0" - "@babel/helper-split-export-declaration" "^7.4.4" - "@babel/parser" "^7.6.2" - "@babel/types" "^7.6.0" - debug "^4.1.0" - globals "^11.1.0" - lodash "^4.17.13" - -"@babel/traverse@^7.8.3": - version "7.8.4" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.8.4.tgz#f0845822365f9d5b0e312ed3959d3f827f869e3c" - integrity sha512-NGLJPZwnVEyBPLI+bl9y9aSnxMhsKz42so7ApAv9D+b4vAFPpY013FTS9LdKxcABoIYFU52HcYga1pPlx454mg== - dependencies: - "@babel/code-frame" "^7.8.3" - "@babel/generator" "^7.8.4" - "@babel/helper-function-name" "^7.8.3" - "@babel/helper-split-export-declaration" "^7.8.3" - "@babel/parser" "^7.8.4" - "@babel/types" "^7.8.3" + "@babel/generator" "^7.7.4" + "@babel/helper-function-name" "^7.7.4" + "@babel/helper-split-export-declaration" "^7.7.4" + "@babel/parser" "^7.7.4" + "@babel/types" "^7.7.4" debug "^4.1.0" globals "^11.1.0" lodash "^4.17.13" -"@babel/types@7.8.3", "@babel/types@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.8.3.tgz#5a383dffa5416db1b73dedffd311ffd0788fb31c" - integrity sha512-jBD+G8+LWpMBBWvVcdr4QysjUE4mU/syrhN17o1u3gx0/WzJB1kwiVZAXRtWbsIPOwW8pF/YJV5+nmetPzepXg== - dependencies: - esutils "^2.0.2" - lodash "^4.17.13" - to-fast-properties "^2.0.0" - "@babel/types@^7.0.0", "@babel/types@^7.2.0", "@babel/types@^7.3.0", "@babel/types@^7.4.0", "@babel/types@^7.4.4", "@babel/types@^7.5.5": version "7.5.5" resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.5.5.tgz#97b9f728e182785909aa4ab56264f090a028d18a" @@ -2540,200 +2168,6 @@ resolved "https://registry.yarnpkg.com/@emotion/weak-memoize/-/weak-memoize-0.2.4.tgz#622a72bebd1e3f48d921563b4b60a762295a81fc" integrity sha512-6PYY5DVdAY1ifaQW6XYTnOMihmBVT27elqSjEoodchsGjzYlEsTQMcEhSud99kVawatyTZRTiVkJ/c6lwbQ7nA== -"@graphql-codegen/add@^1.12.2": - version "1.12.2" - resolved "https://registry.yarnpkg.com/@graphql-codegen/add/-/add-1.12.2.tgz#d018f307520525bfbb59fde0d0ecca0b53714212" - integrity sha512-r4O3aXsi8gwm1v27C3T00HnPdn1mZzmp7ZfeEcsG8KymrVgHwh2VUPIevXRr0G6qPu8AnyqxBGWGm+mZme9Eag== - dependencies: - "@graphql-codegen/plugin-helpers" "1.12.2" - tslib "1.10.0" - -"@graphql-codegen/core@^1.12.2": - version "1.12.2" - resolved "https://registry.yarnpkg.com/@graphql-codegen/core/-/core-1.12.2.tgz#85dcef3a9205f11aa910f0527c272967ed5c4427" - integrity sha512-n7OENe0lXIg40AGokO0W5v/OKo+bd4gjdKCRVp8N9Pu0o0uYm11rtCoL1JESJqUSt/LESbq+FH14fUqdXU048Q== - dependencies: - "@graphql-codegen/plugin-helpers" "1.12.2" - "@graphql-toolkit/common" "0.9.7" - "@graphql-toolkit/schema-merging" "0.9.7" - tslib "1.10.0" - -"@graphql-codegen/plugin-helpers@1.12.2": - version "1.12.2" - resolved "https://registry.yarnpkg.com/@graphql-codegen/plugin-helpers/-/plugin-helpers-1.12.2.tgz#44ffeefb21515b021f99c6e5be28699d740af560" - integrity sha512-N294rqdBh+mCi4HWHbhPV9wE0XLCVKx524pYL4yp8qWiSdAs3Iz9+q9C9QNsLBvHypZdqml44M8kBMG41A9I/Q== - dependencies: - "@graphql-toolkit/common" "0.9.7" - camel-case "4.1.1" - common-tags "1.8.0" - constant-case "3.0.3" - import-from "3.0.0" - lower-case "2.0.1" - param-case "3.0.3" - pascal-case "3.1.1" - tslib "1.10.0" - upper-case "2.0.1" - -"@graphql-codegen/typescript-compatibility@^1.12.2": - version "1.12.2" - resolved "https://registry.yarnpkg.com/@graphql-codegen/typescript-compatibility/-/typescript-compatibility-1.12.2.tgz#3dce0545acaab072b4069134b32954bca5e0cba1" - integrity sha512-DK2ovG9fcoUqkOiCCXFZ5E32eakcrbH+em8NIP2WEtB9hhk1FL0NEockpacaRAXvuqOqxygMYR24GWNssvdFKw== - dependencies: - "@graphql-codegen/plugin-helpers" "1.12.2" - "@graphql-codegen/visitor-plugin-common" "1.12.2" - pascal-case "3.1.1" - tslib "1.10.0" - -"@graphql-codegen/typescript-operations@^1.12.2": - version "1.12.2" - resolved "https://registry.yarnpkg.com/@graphql-codegen/typescript-operations/-/typescript-operations-1.12.2.tgz#d5d495f237b1bb93839e28da0ddecc5f4ce9f877" - integrity sha512-U4wp9H5sbCP3kWEXI5SbGYeXUyDKidHi2kBRoQochEdsTXugF+6dr5WuUY3IvLIYS9qNKHKq6dm/9nl3DpBD+Q== - dependencies: - "@graphql-codegen/plugin-helpers" "1.12.2" - "@graphql-codegen/typescript" "1.12.2" - "@graphql-codegen/visitor-plugin-common" "1.12.2" - auto-bind "4.0.0" - tslib "1.10.0" - -"@graphql-codegen/typescript-react-apollo@^1.12.2": - version "1.12.2" - resolved "https://registry.yarnpkg.com/@graphql-codegen/typescript-react-apollo/-/typescript-react-apollo-1.12.2.tgz#6a25bd07550ea795c023c98bffcf8a57b1240a33" - integrity sha512-oMRRmHTtd8LdAG8FN7msp7O9T960Oxm04L2JNYDoWc1GuxcMXo3ZVR7bRGgcvgDSmV391k5PSCtA3B8T/QgXjA== - dependencies: - "@graphql-codegen/plugin-helpers" "1.12.2" - "@graphql-codegen/visitor-plugin-common" "1.12.2" - auto-bind "4.0.0" - camel-case "4.1.1" - pascal-case "3.1.1" - tslib "1.10.0" - -"@graphql-codegen/typescript-resolvers@^1.12.2": - version "1.12.2" - resolved "https://registry.yarnpkg.com/@graphql-codegen/typescript-resolvers/-/typescript-resolvers-1.12.2.tgz#17ed56be4d249ce961f5e6135d1c1ba5461ccfe9" - integrity sha512-+YJIAMck3X4DPC4Bwt8Ht4mlHxdYzMemHtRZjur0V6+WnxMxjE1NDylZ0bynhbbHd6bM1yoA3JpU5jCBcxF1Gw== - dependencies: - "@graphql-codegen/plugin-helpers" "1.12.2" - "@graphql-codegen/typescript" "1.12.2" - "@graphql-codegen/visitor-plugin-common" "1.12.2" - "@graphql-toolkit/common" "0.9.7" - auto-bind "4.0.0" - tslib "1.10.0" - -"@graphql-codegen/typescript@1.12.2", "@graphql-codegen/typescript@^1.12.2": - version "1.12.2" - resolved "https://registry.yarnpkg.com/@graphql-codegen/typescript/-/typescript-1.12.2.tgz#4b63ab80dcac7624711459e776201c6a5d0f7373" - integrity sha512-G2H91ocAEcZ86TFNQWV2HZUdXSR7v/Ntjq0ChqDvz/a7PTJxa5Pe5j4sQ9q13vGR5CedAMbBZkZ8zTKLAqY5sg== - dependencies: - "@graphql-codegen/plugin-helpers" "1.12.2" - "@graphql-codegen/visitor-plugin-common" "1.12.2" - auto-bind "4.0.0" - tslib "1.10.0" - -"@graphql-codegen/visitor-plugin-common@1.12.2": - version "1.12.2" - resolved "https://registry.yarnpkg.com/@graphql-codegen/visitor-plugin-common/-/visitor-plugin-common-1.12.2.tgz#a32ed6ed2554bd2df125675e296d110d7ec00420" - integrity sha512-+DOnCNvgsMvVVXgAqA2Kqvcy9g0V5xiMAmpgNfrRE1tJ2PGXFsYP4HElBu+PQZCTn5AR8Tfw037zhfbUuF5oDw== - dependencies: - "@graphql-codegen/plugin-helpers" "1.12.2" - "@graphql-toolkit/relay-operation-optimizer" "0.9.7" - auto-bind "4.0.0" - dependency-graph "0.8.1" - graphql-tag "2.10.1" - pascal-case "3.1.1" - tslib "1.10.0" - -"@graphql-toolkit/code-file-loader@^0.9.7": - version "0.9.7" - resolved "https://registry.yarnpkg.com/@graphql-toolkit/code-file-loader/-/code-file-loader-0.9.7.tgz#3a1ee8dfd8029dbfba1ee4178dca1cbe3c313e04" - integrity sha512-Vs2E7ojJ2gmhTz+U0MRLMib8yPz4+U1THCE3QgP4Pqnrqnkp/kEI7qpt3G3XI7JRRBWDHU2gdwOydnHmM/Cjow== - dependencies: - "@graphql-toolkit/common" "0.9.7" - "@graphql-toolkit/graphql-tag-pluck" "0.9.7" - tslib "1.10.0" - -"@graphql-toolkit/common@0.9.7", "@graphql-toolkit/common@^0.9.7": - version "0.9.7" - resolved "https://registry.yarnpkg.com/@graphql-toolkit/common/-/common-0.9.7.tgz#63bc6233c4fd88bc94dfe6a3ec85b8f961f780f9" - integrity sha512-dpSRBMLeIiRct2gkjj24bp0EV7hbK/7dpJAPqNgvDH2535LhOkprYiCXQJyP4N1LODAEkpN/zzlJfKMVn773MQ== - dependencies: - "@ardatan/graphql-tools" "4.1.0" - aggregate-error "3.0.1" - lodash "4.17.15" - -"@graphql-toolkit/core@^0.9.7": - version "0.9.7" - resolved "https://registry.yarnpkg.com/@graphql-toolkit/core/-/core-0.9.7.tgz#a68fff000f3aedb6584c22f3f6b641885aec0f56" - integrity sha512-w1WU0iOq6AEBTICDxcu1xjFruFfGCHg6ERdWTWdIBOTn30qysIC0ek+XWN67vF9yV9QIdAxNu66gXKjUUWm2Tg== - dependencies: - "@graphql-toolkit/common" "0.9.7" - "@graphql-toolkit/schema-merging" "0.9.7" - aggregate-error "3.0.1" - globby "11.0.0" - import-from "^3.0.0" - is-glob "4.0.1" - lodash "4.17.15" - resolve-from "5.0.0" - tslib "1.10.0" - unixify "1.0.0" - valid-url "1.0.9" - -"@graphql-toolkit/graphql-file-loader@^0.9.7": - version "0.9.7" - resolved "https://registry.yarnpkg.com/@graphql-toolkit/graphql-file-loader/-/graphql-file-loader-0.9.7.tgz#1f15dfcf50342ab9e480fbbe2b16896395f36c45" - integrity sha512-t7CfYjghuXAtIqzwHhkUoE/u0a918UTOOVtHdLHh8rojjIUfsSeLeqMcFacRv+/z+kyKl9lgi4TE/qiyIpyR5A== - dependencies: - "@graphql-toolkit/common" "0.9.7" - tslib "1.10.0" - -"@graphql-toolkit/graphql-tag-pluck@0.9.7": - version "0.9.7" - resolved "https://registry.yarnpkg.com/@graphql-toolkit/graphql-tag-pluck/-/graphql-tag-pluck-0.9.7.tgz#772c5f15fb9b8e5f61d2816c4cfb1dcd1e3ba34e" - integrity sha512-hfHs9m/6rK0JRPrZg9LW8fPmQiNy7zvueey+TUH+qLHOkQiklDVDtQ/2yje35B16bwiyk3axxmHZ/H3fb5nWiQ== - dependencies: - "@babel/parser" "7.8.3" - "@babel/traverse" "7.8.3" - "@babel/types" "7.8.3" - "@graphql-toolkit/common" "0.9.7" - optionalDependencies: - vue-template-compiler "^2.6.11" - -"@graphql-toolkit/json-file-loader@^0.9.7": - version "0.9.7" - resolved "https://registry.yarnpkg.com/@graphql-toolkit/json-file-loader/-/json-file-loader-0.9.7.tgz#3f68dfbbc0c55c2b1531b6e200d5cd76ef85bb59" - integrity sha512-MNnCX201p011FPOm/rlDLkBTpx4LvooG9pdMU1ijRD/sqpHSkhZ2U/aKyoiDDKrLUgK7cvHws1KXBvLcg7r6aQ== - dependencies: - "@graphql-toolkit/common" "0.9.7" - tslib "1.10.0" - -"@graphql-toolkit/relay-operation-optimizer@0.9.7": - version "0.9.7" - resolved "https://registry.yarnpkg.com/@graphql-toolkit/relay-operation-optimizer/-/relay-operation-optimizer-0.9.7.tgz#e13034f835231b268ee355bfac6228dd34f9b951" - integrity sha512-IPFAbKMOX3RdjyDuamK9ziuTFD5tsCiTVvHACHA2wgg+32krJZJsV6STKhFLqIwytS40vt5zhZydQCFxIrCD5g== - dependencies: - "@graphql-toolkit/common" "0.9.7" - relay-compiler "8.0.0" - -"@graphql-toolkit/schema-merging@0.9.7", "@graphql-toolkit/schema-merging@^0.9.7": - version "0.9.7" - resolved "https://registry.yarnpkg.com/@graphql-toolkit/schema-merging/-/schema-merging-0.9.7.tgz#241ddd2c9ba79dd4444014057d0765777ab3cd12" - integrity sha512-RLhP0+XT4JGoPGCvlcTPdCE8stA7l0D5+gZ8ZP0snqzZOdsDFG4cNxpJtwf48i7uArsXkfu5OjOvTwh0MR0Wrw== - dependencies: - "@ardatan/graphql-tools" "4.1.0" - "@graphql-toolkit/common" "0.9.7" - deepmerge "4.2.2" - tslib "1.10.0" - -"@graphql-toolkit/url-loader@^0.9.7": - version "0.9.7" - resolved "https://registry.yarnpkg.com/@graphql-toolkit/url-loader/-/url-loader-0.9.7.tgz#222af4f8bb6d87735760555dd100c55fd3d36281" - integrity sha512-cOT2XJVZLWOKG4V9ucVtUTqJMW0BJqEqrHvpR8YcIWffrEChmzZQX+ug3BkRNomaUe8ywgExJ80aZuKWeSHvew== - dependencies: - "@ardatan/graphql-tools" "4.1.0" - "@graphql-toolkit/common" "0.9.7" - cross-fetch "3.0.4" - tslib "1.10.0" - valid-url "1.0.9" - "@gulp-sourcemaps/identity-map@1.X": version "1.0.2" resolved "https://registry.yarnpkg.com/@gulp-sourcemaps/identity-map/-/identity-map-1.0.2.tgz#1e6fe5d8027b1f285dc0d31762f566bccd73d5a9" @@ -3221,17 +2655,6 @@ dependencies: core-js "^2.5.7" -"@kamilkisiela/graphql-tools@^4.0.6": - version "4.0.6" - resolved "https://registry.yarnpkg.com/@kamilkisiela/graphql-tools/-/graphql-tools-4.0.6.tgz#6dcf4d18bedaf34f6ab1d5bad2414e530d0875d1" - integrity sha512-IPWa+dOFCE4zaCsrJrAMp7yWXnfOZLNhqoMEOmn958WkLM0mmsDc/W/Rh7/7xopIT6P0oizb6/N1iH5HnNXOUA== - dependencies: - apollo-link "^1.2.3" - apollo-utilities "^1.0.1" - deprecated-decorator "^0.1.6" - iterall "^1.1.3" - uuid "^3.1.0" - "@mapbox/extent@0.4.0": version "0.4.0" resolved "https://registry.yarnpkg.com/@mapbox/extent/-/extent-0.4.0.tgz#3e591f32e1f0c3981c864239f7b0ac06e610f8a9" @@ -3424,25 +2847,38 @@ resolved "https://registry.yarnpkg.com/@microsoft/tsdoc/-/tsdoc-0.12.14.tgz#0e0810a0a174e50e22dfe8edb30599840712f22d" integrity sha512-518yewjSga1jLdiLrcmpMFlaba5P+50b0TWNFUpC+SL9Yzf0kMi57qw+bMl+rQ08cGqH1vLx4eg9YFUbZXgZ0Q== -"@nodelib/fs.scandir@2.1.3": - version "2.1.3" - resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.3.tgz#3a582bdb53804c6ba6d146579c46e52130cf4a3b" - integrity sha512-eGmwYQn3gxo4r7jdQnkrrN6bY478C3P+a/y72IJukF8LjB6ZHeB3c+Ehacj3sYeSmUXGlnA67/PmbM9CVwL7Dw== +"@mrmlnc/readdir-enhanced@^2.2.1": + version "2.2.1" + resolved "https://registry.yarnpkg.com/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz#524af240d1a360527b730475ecfa1344aa540dde" + integrity sha512-bPHp6Ji8b41szTOcaP63VlnbbO5Ny6dwAATtY6JTjh5N2OLrb5Qk/Th5cRkRQhkWCt+EJsYrNB0MiL+Gpn6e3g== + dependencies: + call-me-maybe "^1.0.1" + glob-to-regexp "^0.3.0" + +"@nodelib/fs.scandir@2.1.1": + version "2.1.1" + resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.1.tgz#7fa8fed654939e1a39753d286b48b4836d00e0eb" + integrity sha512-NT/skIZjgotDSiXs0WqYhgcuBKhUMgfekCmCGtkUAiLqZdOnrdjmZr9wRl3ll64J9NF79uZ4fk16Dx0yMc/Xbg== dependencies: - "@nodelib/fs.stat" "2.0.3" + "@nodelib/fs.stat" "2.0.1" run-parallel "^1.1.9" -"@nodelib/fs.stat@2.0.3", "@nodelib/fs.stat@^2.0.2": - version "2.0.3" - resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-2.0.3.tgz#34dc5f4cabbc720f4e60f75a747e7ecd6c175bd3" - integrity sha512-bQBFruR2TAwoevBEd/NWMoAAtNGzTRgdrqnYCc7dhzfoNvqPzLyqlEQnzZ3kVnNrSp25iyxE00/3h2fqGAGArA== +"@nodelib/fs.stat@2.0.1", "@nodelib/fs.stat@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-2.0.1.tgz#814f71b1167390cfcb6a6b3d9cdeb0951a192c14" + integrity sha512-+RqhBlLn6YRBGOIoVYthsG0J9dfpO79eJyN7BYBkZJtfqrBwf2KK+rD/M/yjZR6WBmIhAgOV7S60eCgaSWtbFw== -"@nodelib/fs.walk@^1.2.3": - version "1.2.4" - resolved "https://registry.yarnpkg.com/@nodelib/fs.walk/-/fs.walk-1.2.4.tgz#011b9202a70a6366e436ca5c065844528ab04976" - integrity sha512-1V9XOY4rDW0rehzbrcqAmHnz8e7SKvX27gh8Gt2WgB0+pdzdiLV83p72kZPU+jvMbS1qU5mauP2iOvO8rhmurQ== +"@nodelib/fs.stat@^1.1.2": + version "1.1.3" + resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-1.1.3.tgz#2b5a3ab3f918cca48a8c754c08168e3f03eba61b" + integrity sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw== + +"@nodelib/fs.walk@^1.2.1": + version "1.2.2" + resolved "https://registry.yarnpkg.com/@nodelib/fs.walk/-/fs.walk-1.2.2.tgz#6a6450c5e17012abd81450eb74949a4d970d2807" + integrity sha512-J/DR3+W12uCzAJkw7niXDcqcKBg6+5G5Q/ZpThpGNzAUz70eOR6RV4XnnSN01qHZiVl0eavoxJsBypQoKsV2QQ== dependencies: - "@nodelib/fs.scandir" "2.1.3" + "@nodelib/fs.scandir" "2.1.1" fastq "^1.6.0" "@oclif/color@^0.0.0": @@ -4684,6 +4120,11 @@ resolved "https://registry.yarnpkg.com/@types/argparse/-/argparse-1.0.33.tgz#2728669427cdd74a99e53c9f457ca2866a37c52d" integrity sha512-VQgHxyPMTj3hIlq9SY1mctqx+Jj8kpQfoLvDlVSDNOyuYs8JYfkuY3OW/4+dO657yPmNhHpePRx0/Tje5ImNVQ== +"@types/async@2.0.49": + version "2.0.49" + resolved "https://registry.yarnpkg.com/@types/async/-/async-2.0.49.tgz#92e33d13f74c895cb9a7f38ba97db8431ed14bc0" + integrity sha512-Benr3i5odUkvpFkOpzGqrltGdbSs+EVCkEBGXbuR7uT0VzhXKIkhem6PDzHdx5EonA+rfbB3QvP6aDOw5+zp5Q== + "@types/babel-types@*", "@types/babel-types@^7.0.0": version "7.0.4" resolved "https://registry.yarnpkg.com/@types/babel-types/-/babel-types-7.0.4.tgz#bfd5b0d0d1ba13e351dff65b6e52783b816826c8" @@ -4856,11 +4297,9 @@ integrity sha512-EIjmpvnHj+T4nMcKwHwxZKUfDmphIKJc2qnEMhSoOvr1lYEQpuRKRz8orWr//krYIIArS/KGGLfL2YGVUYXmIA== "@types/cp-file@*": - version "6.1.2" - resolved "https://registry.yarnpkg.com/@types/cp-file/-/cp-file-6.1.2.tgz#3c579201715ca6177d34f3e14f2b29861c470c4c" - integrity sha512-wvqCNhHt+GMfEglZ83cQ+8dEv5Oh8DwEq6IBBBL7+hWISR+82l/bSmssCo5zGHg7HpW6+kjZwDby9zGkCStN5w== - dependencies: - cp-file "*" + version "4.2.0" + resolved "https://registry.yarnpkg.com/@types/cp-file/-/cp-file-4.2.0.tgz#2b12186b50dad407b11021284627bdf4adb87a87" + integrity sha512-nkd9c0L2aWfsDFrkpxfGJ5bCKeiAv6lccbH9vxKeWYw9YuyqskjtRTrBEBAiea9R08OSiboQ4ssmwAVJMHmHHA== "@types/cpy@^5.1.0": version "5.1.0" @@ -5060,6 +4499,11 @@ dependencies: "@types/node" "*" +"@types/graphql@^0.13.2": + version "0.13.4" + resolved "https://registry.yarnpkg.com/@types/graphql/-/graphql-0.13.4.tgz#55ae9c29f0fd6b85ee536f5c72b4769d5c5e06b1" + integrity sha512-B4yel4ro2nTb3v0pYO8vO6SjgvFJSrwUY+IO6TUSLdOSB+gQFslylrhRCHxvXMIhxB71mv5PEE9dAX+24S8sew== + "@types/gulp@^4.0.6": version "4.0.6" resolved "https://registry.yarnpkg.com/@types/gulp/-/gulp-4.0.6.tgz#68fe0e1f0ff3657cfca46fb564806b744a1bf899" @@ -6250,14 +5694,7 @@ "@types/node" "^12.0.2" tslib "^1.9.3" -"@wry/context@^0.5.0": - version "0.5.0" - resolved "https://registry.yarnpkg.com/@wry/context/-/context-0.5.0.tgz#5ff84d0d5726b62c07045af8465f890eb3823c8c" - integrity sha512-yW5XFrWbRvv2/f86+g0YAfko7671SQg7Epn8lYjux4MZmIvtPvK2ts+vG1QAPu2w6GuBioEJknRa7K2LFj2kQw== - dependencies: - tslib "^1.9.3" - -"@wry/equality@^0.1.2", "@wry/equality@^0.1.9": +"@wry/equality@^0.1.2": version "0.1.9" resolved "https://registry.yarnpkg.com/@wry/equality/-/equality-0.1.9.tgz#b13e18b7a8053c6858aa6c85b54911fb31e3a909" integrity sha512-mB6ceGjpMGz1ZTza8HYnrPGos2mC6So4NhS1PtZ8s4Qt0K7fBiIGhpSxUbQmhwcSWE3no+bYxmI2OL6KuXYmoQ== @@ -6521,14 +5958,6 @@ aggregate-error@2.1.0: clean-stack "^2.0.0" indent-string "^3.0.0" -aggregate-error@3.0.1, aggregate-error@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/aggregate-error/-/aggregate-error-3.0.1.tgz#db2fe7246e536f40d9b5442a39e117d7dd6a24e0" - integrity sha512-quoaXsZ9/BLNae5yiNoUz+Nhkwz83GhWwtYFglcjEQB2NDHCIpApbqXxIFnm4Pq/Nvhrsq5sYJFyohrrxnTGAA== - dependencies: - clean-stack "^2.0.0" - indent-string "^4.0.0" - aggregate-error@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/aggregate-error/-/aggregate-error-1.0.0.tgz#888344dad0220a72e3af50906117f48771925fac" @@ -6537,6 +5966,14 @@ aggregate-error@^1.0.0: clean-stack "^1.0.0" indent-string "^3.0.0" +aggregate-error@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/aggregate-error/-/aggregate-error-3.0.1.tgz#db2fe7246e536f40d9b5442a39e117d7dd6a24e0" + integrity sha512-quoaXsZ9/BLNae5yiNoUz+Nhkwz83GhWwtYFglcjEQB2NDHCIpApbqXxIFnm4Pq/Nvhrsq5sYJFyohrrxnTGAA== + dependencies: + clean-stack "^2.0.0" + indent-string "^4.0.0" + "airbnb-js-shims@^1 || ^2": version "2.1.1" resolved "https://registry.yarnpkg.com/airbnb-js-shims/-/airbnb-js-shims-2.1.1.tgz#a509611480db7e6d9db62fe2acfaeb473b6842ac" @@ -6856,7 +6293,7 @@ ansi-styles@^3.2.0: dependencies: color-convert "^1.9.0" -ansi-styles@^4.0.0: +ansi-styles@^4.0.0, ansi-styles@^4.1.0: version "4.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.2.1.tgz#90ae75c424d008d2624c5bf29ead3177ebfcf359" integrity sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA== @@ -6864,14 +6301,6 @@ ansi-styles@^4.0.0: "@types/color-name" "^1.1.1" color-convert "^2.0.1" -ansi-styles@^4.1.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.2.0.tgz#5681f0dcf7ae5880a7841d8831c4724ed9cc0172" - integrity sha512-7kFQgnEaMdRtwf6uSfUnVr9gSGC7faurn+J/Mv90/W+iTtN0405/nLdopfMWwchyxhbGYl6TC4Sccn9TUkGAgg== - dependencies: - "@types/color-name" "^1.1.1" - color-convert "^2.0.1" - ansi-styles@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-1.0.0.tgz#cb102df1c56f5123eab8b67cd7b98027a0279178" @@ -6948,34 +6377,59 @@ apollo-cache-inmemory@1.6.2: ts-invariant "^0.4.0" tslib "^1.9.3" -apollo-cache@1.3.4, apollo-cache@^1.3.2: - version "1.3.4" - resolved "https://registry.yarnpkg.com/apollo-cache/-/apollo-cache-1.3.4.tgz#0c9f63c793e1cd6e34c450f7668e77aff58c9a42" - integrity sha512-7X5aGbqaOWYG+SSkCzJNHTz2ZKDcyRwtmvW4mGVLRqdQs+HxfXS4dUS2CcwrAj449se6tZ6NLUMnjko4KMt3KA== +apollo-cache@^1.1.14: + version "1.1.14" + resolved "https://registry.yarnpkg.com/apollo-cache/-/apollo-cache-1.1.14.tgz#c7d54cdbc7f544161f78fa5e4bae56650e22f7ad" + integrity sha512-Zmo9nVqpWFogki2QyulX6Xx6KYXMyYWX74grwgsYYUOukl4pIAdtYyK8e874o0QDgzSOq5AYPXjtfkoVpqhCRw== dependencies: - apollo-utilities "^1.3.3" - tslib "^1.10.0" + apollo-utilities "^1.0.18" + +apollo-cache@^1.3.2: + version "1.3.2" + resolved "https://registry.yarnpkg.com/apollo-cache/-/apollo-cache-1.3.2.tgz#df4dce56240d6c95c613510d7e409f7214e6d26a" + integrity sha512-+KA685AV5ETEJfjZuviRTEImGA11uNBp/MJGnaCvkgr+BYRrGLruVKBv6WvyFod27WEB2sp7SsG8cNBKANhGLg== + dependencies: + apollo-utilities "^1.3.2" + tslib "^1.9.3" apollo-client@^2.3.8: - version "2.6.8" - resolved "https://registry.yarnpkg.com/apollo-client/-/apollo-client-2.6.8.tgz#01cebc18692abf90c6b3806414e081696b0fa537" - integrity sha512-0zvJtAcONiozpa5z5zgou83iEKkBaXhhSSXJebFHRXs100SecDojyUWKjwTtBPn9HbM6o5xrvC5mo9VQ5fgAjw== + version "2.3.8" + resolved "https://registry.yarnpkg.com/apollo-client/-/apollo-client-2.3.8.tgz#0384a7210eb601ab88b1c13750da076fc9255b95" + integrity sha512-X5wsBD1be1P/mScGsH5H+2hIE8d78WAfqOvFvBpP+C+jzJ9387uHLyFmYYMLRRqDQ3ihjI4iSID7KEOW2gyCcQ== dependencies: "@types/zen-observable" "^0.8.0" - apollo-cache "1.3.4" + apollo-cache "^1.1.14" apollo-link "^1.0.0" - apollo-utilities "1.3.3" + apollo-link-dedup "^1.0.0" + apollo-utilities "^1.0.18" symbol-observable "^1.0.2" - ts-invariant "^0.4.0" - tslib "^1.10.0" zen-observable "^0.8.0" + optionalDependencies: + "@types/async" "2.0.49" -apollo-link-error@^2.0.0-beta.0: - version "2.0.0-beta.0" - resolved "https://registry.yarnpkg.com/apollo-link-error/-/apollo-link-error-2.0.0-beta.0.tgz#58a06f0bc8658abe3490cb6fa7ed0f6d6c10cf98" - integrity sha512-eoTy/PG2JG+co+yOuLoTrk7PFiiIRDByrBytnAI/WGk67ez8px1wKsq3/EoPjAL+ty2IxgET+blu7zqQogEJwA== +apollo-link-dedup@^1.0.0: + version "1.0.9" + resolved "https://registry.yarnpkg.com/apollo-link-dedup/-/apollo-link-dedup-1.0.9.tgz#3c4e4af88ef027cbddfdb857c043fd0574051dad" + integrity sha512-RbuEKpmSHVMtoREMPh2wUFTeh65q+0XPVeqgaOP/rGEAfvLyOMvX0vT2nVaejMohoMxuUnfZwpldXaDFWnlVbg== dependencies: - "@apollo/client" "^3.0.0-beta.10" + apollo-link "^1.2.2" + +apollo-link-error@^1.1.7: + version "1.1.10" + resolved "https://registry.yarnpkg.com/apollo-link-error/-/apollo-link-error-1.1.10.tgz#ce57f0793f0923b598655de5bf5e028d4cf4fba6" + integrity sha512-itG5UV7mQqaalmRkuRsF0cUS4zW2ja8XCbxkMZnIEeN24X3yoJi5hpJeAaEkXf0KgYNsR0+rmtCQNruWyxDnZQ== + dependencies: + apollo-link "^1.2.11" + apollo-link-http-common "^0.2.13" + tslib "^1.9.3" + +apollo-link-http-common@^0.2.13: + version "0.2.13" + resolved "https://registry.yarnpkg.com/apollo-link-http-common/-/apollo-link-http-common-0.2.13.tgz#c688f6baaffdc7b269b2db7ae89dae7c58b5b350" + integrity sha512-Uyg1ECQpTTA691Fwx5e6Rc/6CPSu4TB4pQRTGIpwZ4l5JDOQ+812Wvi/e3IInmzOZpwx5YrrOfXrtN8BrsDXoA== + dependencies: + apollo-link "^1.2.11" + ts-invariant "^0.3.2" tslib "^1.9.3" apollo-link-http-common@^0.2.15: @@ -7004,14 +6458,32 @@ apollo-link-schema@^1.1.0: apollo-link "^1.2.2" apollo-link-state@^0.4.1: - version "0.4.2" - resolved "https://registry.yarnpkg.com/apollo-link-state/-/apollo-link-state-0.4.2.tgz#ac00e9be9b0ca89eae0be6ba31fe904b80bbe2e8" - integrity sha512-xMPcAfuiPVYXaLwC6oJFIZrKgV3GmdO31Ag2eufRoXpvT0AfJZjdaPB4450Nu9TslHRePN9A3quxNueILlQxlw== + version "0.4.1" + resolved "https://registry.yarnpkg.com/apollo-link-state/-/apollo-link-state-0.4.1.tgz#65e9e0e12c67936b8c4b12b8438434f393104579" + integrity sha512-69/til4ENfl/Fvf7br2xSsLSBcxcXPbOHVNkzLLejvUZickl93HLO4/fO+uvoBi4dCYRgN17Zr8FwI41ueRx0g== dependencies: apollo-utilities "^1.0.8" graphql-anywhere "^4.1.0-alpha.0" -apollo-link@^1.0.0, apollo-link@^1.2.13, apollo-link@^1.2.2, apollo-link@^1.2.3: +apollo-link@^1.0.0, apollo-link@^1.2.2, apollo-link@^1.2.3: + version "1.2.3" + resolved "https://registry.yarnpkg.com/apollo-link/-/apollo-link-1.2.3.tgz#9bd8d5fe1d88d31dc91dae9ecc22474d451fb70d" + integrity sha512-iL9yS2OfxYhigme5bpTbmRyC+Htt6tyo2fRMHT3K1XRL/C5IQDDz37OjpPy4ndx7WInSvfSZaaOTKFja9VWqSw== + dependencies: + apollo-utilities "^1.0.0" + zen-observable-ts "^0.8.10" + +apollo-link@^1.2.11: + version "1.2.11" + resolved "https://registry.yarnpkg.com/apollo-link/-/apollo-link-1.2.11.tgz#493293b747ad3237114ccd22e9f559e5e24a194d" + integrity sha512-PQvRCg13VduLy3X/0L79M6uOpTh5iHdxnxYuo8yL7sJlWybKRJwsv4IcRBJpMFbChOOaHY7Og9wgPo6DLKDKDA== + dependencies: + apollo-utilities "^1.2.1" + ts-invariant "^0.3.2" + tslib "^1.9.3" + zen-observable-ts "^0.8.18" + +apollo-link@^1.2.13: version "1.2.13" resolved "https://registry.yarnpkg.com/apollo-link/-/apollo-link-1.2.13.tgz#dff00fbf19dfcd90fddbc14b6a3f9a771acac6c4" integrity sha512-+iBMcYeevMm1JpYgwDEIDt/y0BB7VWyvlm/7x+TIPNLHCTCMgcEgDuW5kH86iQZWo0I7mNwQiTOz+/3ShPFmBw== @@ -7021,10 +6493,10 @@ apollo-link@^1.0.0, apollo-link@^1.2.13, apollo-link@^1.2.2, apollo-link@^1.2.3: tslib "^1.9.3" zen-observable-ts "^0.8.20" -apollo-server-core@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/apollo-server-core/-/apollo-server-core-1.4.0.tgz#4faff7f110bfdd6c3f47008302ae24140f94c592" - integrity sha512-BP1Vh39krgEjkQxbjTdBURUjLHbFq1zeOChDJgaRsMxGtlhzuLWwwC6lLdPatN8jEPbeHq8Tndp9QZ3iQZOKKA== +apollo-server-core@^1.3.6: + version "1.3.6" + resolved "https://registry.yarnpkg.com/apollo-server-core/-/apollo-server-core-1.3.6.tgz#08636243c2de56fa8c267d68dd602cb1fbd323e3" + integrity sha1-CGNiQ8LeVvqMJn1o3WAssfvTI+M= dependencies: apollo-cache-control "^0.1.0" apollo-tracing "^0.1.0" @@ -7036,18 +6508,18 @@ apollo-server-errors@^2.0.2: integrity sha512-zyWDqAVDCkj9espVsoUpZr9PwDznM8UW6fBfhV+i1br//s2AQb07N6ektZ9pRIEvkhykDZW+8tQbDwAO0vUROg== apollo-server-hapi@^1.3.6: - version "1.4.0" - resolved "https://registry.yarnpkg.com/apollo-server-hapi/-/apollo-server-hapi-1.4.0.tgz#df63dcac17120490cde756370bdb5ea965141bc3" - integrity sha512-wChLPugWVcJM6gcSUuoHV6rO5pJUMrjkO5KcvPy4JXgpAbIGewpQvqJO8mk1y3C48WEhTOlgiFPquzGTnk6yFg== + version "1.3.6" + resolved "https://registry.yarnpkg.com/apollo-server-hapi/-/apollo-server-hapi-1.3.6.tgz#44dea128b64c1c10fdd35ac8307896a57ba1f4a8" + integrity sha1-RN6hKLZMHBD901rIMHiWpXuh9Kg= dependencies: - apollo-server-core "^1.4.0" - apollo-server-module-graphiql "^1.4.0" + apollo-server-core "^1.3.6" + apollo-server-module-graphiql "^1.3.4" boom "^7.1.0" -apollo-server-module-graphiql@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/apollo-server-module-graphiql/-/apollo-server-module-graphiql-1.4.0.tgz#c559efa285578820709f1769bb85d3b3eed3d8ec" - integrity sha512-GmkOcb5he2x5gat+TuiTvabnBf1m4jzdecal3XbXBh/Jg+kx4hcvO3TTDFQ9CuTprtzdcVyA11iqG7iOMOt7vA== +apollo-server-module-graphiql@^1.3.4: + version "1.3.4" + resolved "https://registry.yarnpkg.com/apollo-server-module-graphiql/-/apollo-server-module-graphiql-1.3.4.tgz#50399b7c51b7267d0c841529f5173e5fc7304de4" + integrity sha1-UDmbfFG3Jn0MhBUp9Rc+X8cwTeQ= apollo-tracing@^0.1.0: version "0.1.4" @@ -7056,17 +6528,23 @@ apollo-tracing@^0.1.0: dependencies: graphql-extensions "~0.0.9" -apollo-utilities@1.3.3, apollo-utilities@^1.3.3: - version "1.3.3" - resolved "https://registry.yarnpkg.com/apollo-utilities/-/apollo-utilities-1.3.3.tgz#f1854715a7be80cd810bc3ac95df085815c0787c" - integrity sha512-F14aX2R/fKNYMvhuP2t9GD9fggID7zp5I96MF5QeKYWDWTrkRdHRp4+SVfXUVN+cXOaB/IebfvRtzPf25CM0zw== +apollo-utilities@^1.0.0, apollo-utilities@^1.0.1, apollo-utilities@^1.0.18, apollo-utilities@^1.0.8: + version "1.0.18" + resolved "https://registry.yarnpkg.com/apollo-utilities/-/apollo-utilities-1.0.18.tgz#e4ee91534283fde2b744a26caaea120fe6a94f67" + integrity sha512-hHrmsoMYzzzfUlTOPpxr0qRpTLotMkBIQ93Ub7ki2SWdLfYYKrp6/KB8YOUkbCwXxSFvYSV24ccuwUEqZIaHIA== + dependencies: + fast-json-stable-stringify "^2.0.0" + +apollo-utilities@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/apollo-utilities/-/apollo-utilities-1.2.1.tgz#1c3a1ebf5607d7c8efe7636daaf58e7463b41b3c" + integrity sha512-Zv8Udp9XTSFiN8oyXOjf6PMHepD4yxxReLsl6dPUy5Ths7jti3nmlBzZUOxuTWRwZn0MoclqL7RQ5UEJN8MAxg== dependencies: - "@wry/equality" "^0.1.2" fast-json-stable-stringify "^2.0.0" - ts-invariant "^0.4.0" - tslib "^1.10.0" + ts-invariant "^0.2.1" + tslib "^1.9.3" -apollo-utilities@^1.0.1, apollo-utilities@^1.0.8, apollo-utilities@^1.3.0, apollo-utilities@^1.3.2: +apollo-utilities@^1.3.0, apollo-utilities@^1.3.2: version "1.3.2" resolved "https://registry.yarnpkg.com/apollo-utilities/-/apollo-utilities-1.3.2.tgz#8cbdcf8b012f664cd6cb5767f6130f5aed9115c9" integrity sha512-JWNHj8XChz7S4OZghV6yc9FNnzEXj285QYp/nLNh943iObycI5GTDO3NGR9Dth12LRrSFMeDOConPfPln+WGfg== @@ -7600,11 +7078,6 @@ attr-accept@^1.1.3: dependencies: core-js "^2.5.0" -auto-bind@4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/auto-bind/-/auto-bind-4.0.0.tgz#e3589fc6c2da8f7ca43ba9f84fa52a744fc997fb" - integrity sha512-Hdw8qdNiqdJ8LqT0iK0sVzkFbzg6fhnQqqfWhBDxcHZvU75+B+ayzTy8x+k5Ix0Y92XOhOUlx74ps+bA6BeYMQ== - autobind-decorator@^1.3.4: version "1.4.3" resolved "https://registry.yarnpkg.com/autobind-decorator/-/autobind-decorator-1.4.3.tgz#4c96ffa77b10622ede24f110f5dbbf56691417d1" @@ -7998,15 +7471,10 @@ babel-plugin-syntax-jsx@^6.18.0: resolved "https://registry.yarnpkg.com/babel-plugin-syntax-jsx/-/babel-plugin-syntax-jsx-6.18.0.tgz#0af32a9a6e13ca7a3fd5069e62d7b0f58d0d8946" integrity sha1-CvMqmm4Tyno/1QaeYtew9Y0NiUY= -babel-plugin-syntax-trailing-function-commas@^7.0.0-beta.0: - version "7.0.0-beta.0" - resolved "https://registry.yarnpkg.com/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-7.0.0-beta.0.tgz#aa213c1435e2bffeb6fca842287ef534ad05d5cf" - integrity sha512-Xj9XuRuz3nTSbaTXWv3itLOcxyF4oPD8douBBmj7U9BBC6nEBYfyOJYQMf/8PJAFotC62UY5dFfIGEPr7WswzQ== - babel-plugin-transform-define@^1.3.1: - version "1.3.2" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-define/-/babel-plugin-transform-define-1.3.2.tgz#4bdbfe35a839fc206e0f60a7a9ae3b82d5e11808" - integrity sha512-fieU/nFuZjTxIttXoucN1fOIrej8I989IXqATMvKVcgTnfi53BjEwLzkw2KA6Q4gRRl4Cf3iiRVpwiB4PHFuWA== + version "1.3.1" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-define/-/babel-plugin-transform-define-1.3.1.tgz#b21b7bad3b84cf8e3f07cdc8c660b99cbbc01213" + integrity sha512-JXZ1xE9jIbKCGYZ4wbSMPSI5mdS4DRLi5+SkTHgZqWn5YIf/EucykkzUsPmzJlpkX8fsMVdLnA5vt/LvT97Zbg== dependencies: lodash "^4.17.11" traverse "0.6.6" @@ -8084,39 +7552,6 @@ babel-polyfill@^6.26.0: core-js "^2.5.0" regenerator-runtime "^0.10.5" -babel-preset-fbjs@^3.3.0: - version "3.3.0" - resolved "https://registry.yarnpkg.com/babel-preset-fbjs/-/babel-preset-fbjs-3.3.0.tgz#a6024764ea86c8e06a22d794ca8b69534d263541" - integrity sha512-7QTLTCd2gwB2qGoi5epSULMHugSVgpcVt5YAeiFO9ABLrutDQzKfGwzxgZHLpugq8qMdg/DhRZDZ5CLKxBkEbw== - dependencies: - "@babel/plugin-proposal-class-properties" "^7.0.0" - "@babel/plugin-proposal-object-rest-spread" "^7.0.0" - "@babel/plugin-syntax-class-properties" "^7.0.0" - "@babel/plugin-syntax-flow" "^7.0.0" - "@babel/plugin-syntax-jsx" "^7.0.0" - "@babel/plugin-syntax-object-rest-spread" "^7.0.0" - "@babel/plugin-transform-arrow-functions" "^7.0.0" - "@babel/plugin-transform-block-scoped-functions" "^7.0.0" - "@babel/plugin-transform-block-scoping" "^7.0.0" - "@babel/plugin-transform-classes" "^7.0.0" - "@babel/plugin-transform-computed-properties" "^7.0.0" - "@babel/plugin-transform-destructuring" "^7.0.0" - "@babel/plugin-transform-flow-strip-types" "^7.0.0" - "@babel/plugin-transform-for-of" "^7.0.0" - "@babel/plugin-transform-function-name" "^7.0.0" - "@babel/plugin-transform-literals" "^7.0.0" - "@babel/plugin-transform-member-expression-literals" "^7.0.0" - "@babel/plugin-transform-modules-commonjs" "^7.0.0" - "@babel/plugin-transform-object-super" "^7.0.0" - "@babel/plugin-transform-parameters" "^7.0.0" - "@babel/plugin-transform-property-literals" "^7.0.0" - "@babel/plugin-transform-react-display-name" "^7.0.0" - "@babel/plugin-transform-react-jsx" "^7.0.0" - "@babel/plugin-transform-shorthand-properties" "^7.0.0" - "@babel/plugin-transform-spread" "^7.0.0" - "@babel/plugin-transform-template-literals" "^7.0.0" - babel-plugin-syntax-trailing-function-commas "^7.0.0-beta.0" - babel-preset-jest@^24.9.0: version "24.9.0" resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-24.9.0.tgz#192b521e2217fb1d1f67cf73f70c336650ad3cdc" @@ -8674,7 +8109,7 @@ braces@^0.1.2: dependencies: expand-range "^0.1.0" -braces@^2.3.1, braces@^2.3.2: +braces@^2.3.0, braces@^2.3.1, braces@^2.3.2: version "2.3.2" resolved "https://registry.yarnpkg.com/braces/-/braces-2.3.2.tgz#5979fd3f14cd531565e5fa2df1abfff1dfaee729" integrity sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w== @@ -9128,6 +8563,11 @@ caching-transform@^3.0.2: package-hash "^3.0.0" write-file-atomic "^2.4.2" +call-me-maybe@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/call-me-maybe/-/call-me-maybe-1.0.1.tgz#26d208ea89e37b5cbde60250a15f031c16a4d66b" + integrity sha1-JtII6onje1y95gJQoV8DHBak1ms= + call@5.x.x: version "5.0.1" resolved "https://registry.yarnpkg.com/call/-/call-5.0.1.tgz#ac1b5c106d9edc2a17af2a4a4f74dd4f0c06e910" @@ -9197,14 +8637,6 @@ camel-case@3.0.x, camel-case@^3.0.0: no-case "^2.2.0" upper-case "^1.1.1" -camel-case@4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/camel-case/-/camel-case-4.1.1.tgz#1fc41c854f00e2f7d0139dfeba1542d6896fe547" - integrity sha512-7fa2WcG4fYFkclIvEmxBbTvmibwF2/agfEBc6q3lOpVu0A13ltLsA+Hr/8Hp6kp5f+G7hKi6t8lys6XxP+1K6Q== - dependencies: - pascal-case "^3.1.1" - tslib "^1.10.0" - camelcase-keys@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/camelcase-keys/-/camelcase-keys-2.1.0.tgz#308beeaffdf28119051efa1d932213c91b8f92e7" @@ -10418,15 +9850,6 @@ const-pinf-float64@^1.0.0: resolved "https://registry.yarnpkg.com/const-pinf-float64/-/const-pinf-float64-1.0.0.tgz#f6efb0d79f9c0986d3e79f2923abf9b70b63d726" integrity sha1-9u+w15+cCYbT558pI6v5twtj1yY= -constant-case@3.0.3: - version "3.0.3" - resolved "https://registry.yarnpkg.com/constant-case/-/constant-case-3.0.3.tgz#ac910a99caf3926ac5112f352e3af599d8c5fc0a" - integrity sha512-FXtsSnnrFYpzDmvwDGQW+l8XK3GV1coLyBN0eBz16ZUzGaZcT2ANVCJmLeuw2GQgxKHQIe9e0w2dzkSfaRlUmA== - dependencies: - no-case "^3.0.3" - tslib "^1.10.0" - upper-case "^2.0.1" - constant-case@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/constant-case/-/constant-case-2.0.0.tgz#4175764d389d3fa9c8ecd29186ed6005243b6a46" @@ -10656,16 +10079,11 @@ core-js@^1.0.0: resolved "https://registry.yarnpkg.com/core-js/-/core-js-1.2.7.tgz#652294c14651db28fa93bd2d5ff2983a4f08c636" integrity sha1-ZSKUwUZR2yj6k70tX/KYOk8IxjY= -core-js@^2.2.0, core-js@^2.4.0, core-js@^2.5.0, core-js@^2.5.1, core-js@^2.5.7, core-js@^2.6.5, core-js@^2.6.9: +core-js@^2.2.0, core-js@^2.4.0, core-js@^2.5.0, core-js@^2.5.1, core-js@^2.5.3, core-js@^2.5.7, core-js@^2.6.5, core-js@^2.6.9: version "2.6.9" resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.9.tgz#6b4b214620c834152e179323727fc19741b084f2" integrity sha512-HOpZf6eXmnl7la+cUdMnLvUxKNqLUzJvgIziQ0DiF3JwSImNphIqdGqzj6hIKyX04MmV0poclQ7+wjWvxQyR2A== -core-js@^2.4.1, core-js@^2.5.3: - version "2.6.11" - resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.11.tgz#38831469f9922bded8ee21c9dc46985e0399308c" - integrity sha512-5wjnpaT/3dV+XB4borEsnAYQchn00XSgTAWKDkEqv+K8KevjbzmofK6hfJ9TZIlpj2N0xQpazy7PiRQiWHqzWg== - core-js@^3.0.1, core-js@^3.0.4, core-js@^3.2.1: version "3.2.1" resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.2.1.tgz#cd41f38534da6cc59f7db050fe67307de9868b09" @@ -10722,16 +10140,6 @@ cosmiconfig@^5.2.0: js-yaml "^3.13.1" parse-json "^4.0.0" -cp-file@*, cp-file@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/cp-file/-/cp-file-7.0.0.tgz#b9454cfd07fe3b974ab9ea0e5f29655791a9b8cd" - integrity sha512-0Cbj7gyvFVApzpK/uhCtQ/9kE9UnYpxMzaq5nQQC/Dh4iaj5fxp7iEFIullrYwzj8nf0qnsI1Qsx34hAeAebvw== - dependencies: - graceful-fs "^4.1.2" - make-dir "^3.0.0" - nested-error-stacks "^2.0.0" - p-event "^4.1.0" - cp-file@^6.2.0: version "6.2.0" resolved "https://registry.yarnpkg.com/cp-file/-/cp-file-6.2.0.tgz#40d5ea4a1def2a9acdd07ba5c0b0246ef73dc10d" @@ -10743,6 +10151,16 @@ cp-file@^6.2.0: pify "^4.0.1" safe-buffer "^5.0.1" +cp-file@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/cp-file/-/cp-file-7.0.0.tgz#b9454cfd07fe3b974ab9ea0e5f29655791a9b8cd" + integrity sha512-0Cbj7gyvFVApzpK/uhCtQ/9kE9UnYpxMzaq5nQQC/Dh4iaj5fxp7iEFIullrYwzj8nf0qnsI1Qsx34hAeAebvw== + dependencies: + graceful-fs "^4.1.2" + make-dir "^3.0.0" + nested-error-stacks "^2.0.0" + p-event "^4.1.0" + cpy@^8.0.0: version "8.0.0" resolved "https://registry.yarnpkg.com/cpy/-/cpy-8.0.0.tgz#8195db0db19a9ea6aa4f229784cbf3e3f53c3158" @@ -10875,14 +10293,6 @@ cross-fetch@2.2.2: node-fetch "2.1.2" whatwg-fetch "2.0.4" -cross-fetch@3.0.4: - version "3.0.4" - resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-3.0.4.tgz#7bef7020207e684a7638ef5f2f698e24d9eb283c" - integrity sha512-MSHgpjQqgbT/94D4CyADeNoYh52zMkCX4pcJvPP5WqPsLFMKjr2TCMg381ox5qI0ii2dPwaLx/00477knXqXVw== - dependencies: - node-fetch "2.6.0" - whatwg-fetch "3.0.0" - cross-spawn-async@^2.1.1: version "2.2.5" resolved "https://registry.yarnpkg.com/cross-spawn-async/-/cross-spawn-async-2.2.5.tgz#845ff0c0834a3ded9d160daca6d390906bb288cc" @@ -11624,11 +11034,6 @@ dateformat@^3.0.2: resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-3.0.3.tgz#a6e37499a4d9a9cf85ef5872044d62901c9889ae" integrity sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q== -de-indent@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/de-indent/-/de-indent-1.0.2.tgz#b2038e846dc33baa5796128d0804b455b8c1e21d" - integrity sha1-sgOOhG3DO6pXlhKNCAS0VbjB4h0= - debug-fabulous@1.X: version "1.1.0" resolved "https://registry.yarnpkg.com/debug-fabulous/-/debug-fabulous-1.1.0.tgz#af8a08632465224ef4174a9f06308c3c2a1ebc8e" @@ -11824,7 +11229,7 @@ deep-object-diff@^1.1.0: resolved "https://registry.yarnpkg.com/deep-object-diff/-/deep-object-diff-1.1.0.tgz#d6fabf476c2ed1751fc94d5ca693d2ed8c18bc5a" integrity sha512-b+QLs5vHgS+IoSNcUE4n9HP2NwcHj7aqnJWsjPtuG75Rh5TOaGt0OjAYInh77d5T16V5cRDC+Pw/6ZZZiETBGw== -deepmerge@3.2.0, deepmerge@4.2.2, deepmerge@^4.0.0, deepmerge@^4.2.2: +deepmerge@3.2.0, deepmerge@^4.0.0, deepmerge@^4.2.2: version "4.2.2" resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.2.2.tgz#44d2ea3679b8f4d4ffba33f03d865fc1e7bf4955" integrity sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg== @@ -11984,11 +11389,6 @@ depd@~1.1.1, depd@~1.1.2: resolved "https://registry.yarnpkg.com/depd/-/depd-1.1.2.tgz#9bcd52e14c097763e749b274c4346ed2e560b5a9" integrity sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak= -dependency-graph@0.8.1: - version "0.8.1" - resolved "https://registry.yarnpkg.com/dependency-graph/-/dependency-graph-0.8.1.tgz#9b8cae3aa2c7bd95ccb3347a09a2d1047a6c3c5a" - integrity sha512-g213uqF8fyk40W8SBjm079n3CZB4qSpCrA2ye1fLGzH/4HEgB6tzuW2CbLE7leb4t45/6h44Ud59Su1/ROTfqw== - dependency-tree@^7.0.2: version "7.0.2" resolved "https://registry.yarnpkg.com/dependency-tree/-/dependency-tree-7.0.2.tgz#01df8bbdc51e41438f5bb93f4a53e1a9cf8301a1" @@ -12419,14 +11819,6 @@ dot-case@^2.1.0: dependencies: no-case "^2.2.0" -dot-case@^3.0.3: - version "3.0.3" - resolved "https://registry.yarnpkg.com/dot-case/-/dot-case-3.0.3.tgz#21d3b52efaaba2ea5fda875bb1aa8124521cf4aa" - integrity sha512-7hwEmg6RiSQfm/GwPL4AAWXKy3YNNZA3oFv2Pdiey0mwkRCPZ9x6SZbkLcn8Ma5PYeVokzoD4Twv2n7LKp5WeA== - dependencies: - no-case "^3.0.3" - tslib "^1.10.0" - dot-prop@^4.1.0, dot-prop@^4.1.1: version "4.2.0" resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-4.2.0.tgz#1f19e0c2e1aa0e32797c49799f2837ac6af69c57" @@ -14037,6 +13429,20 @@ external-editor@^3.0.3: iconv-lite "^0.4.24" tmp "^0.0.33" +extglob@^2.0.2: + version "2.0.3" + resolved "https://registry.yarnpkg.com/extglob/-/extglob-2.0.3.tgz#55e019d0c95bf873949c737b7e5172dba84ebb29" + integrity sha512-AyptZexgu7qppEPq59DtN/XJGZDrLcVxSHai+4hdgMMS9EpF4GBvygcWWApno8lL9qSjVpYt7Raao28qzJX1ww== + dependencies: + array-unique "^0.3.2" + define-property "^1.0.0" + expand-brackets "^2.1.4" + extend-shallow "^2.0.1" + fragment-cache "^0.2.1" + regex-not "^1.0.0" + snapdragon "^0.8.1" + to-regex "^3.0.1" + extglob@^2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/extglob/-/extglob-2.0.4.tgz#ad00fe4dc612a9232e8718711dc5cb5ab0285543" @@ -14139,15 +13545,38 @@ fast-equals@^2.0.0: resolved "https://registry.yarnpkg.com/fast-equals/-/fast-equals-2.0.0.tgz#bef2c423af3939f2c54310df54c57e64cd2adefc" integrity sha512-u6RBd8cSiLLxAiC04wVsLV6GBFDOXcTCgWkd3wEoFXgidPSoAJENqC9m7Jb2vewSvjBIfXV6icKeh3GTKfIaXA== -fast-glob@2.2.7, fast-glob@3.1.1, fast-glob@^2.0.2, fast-glob@^2.2.2, fast-glob@^2.2.6, fast-glob@^3.0.3, fast-glob@^3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.1.1.tgz#87ee30e9e9f3eb40d6f254a7997655da753d7c82" - integrity sha512-nTCREpBY8w8r+boyFYAx21iL6faSsQynliPHM4Uf56SbkyohCNxpVPEH9xrF5TXKy+IsjkPUHDKiUkzBVRXn9g== +fast-glob@2.2.7, fast-glob@^2.2.6: + version "2.2.7" + resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-2.2.7.tgz#6953857c3afa475fff92ee6015d52da70a4cd39d" + integrity sha512-g1KuQwHOZAmOZMuBtHdxDtju+T2RT8jgCC9aANsbpdiDDTSnjgfuVsIBNKbUeJI3oKMRExcfNDtJl4OhbffMsw== + dependencies: + "@mrmlnc/readdir-enhanced" "^2.2.1" + "@nodelib/fs.stat" "^1.1.2" + glob-parent "^3.1.0" + is-glob "^4.0.0" + merge2 "^1.2.3" + micromatch "^3.1.10" + +fast-glob@^2.0.2: + version "2.0.4" + resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-2.0.4.tgz#a4b9f49e36175f5ef1a3456f580226a6e7abcc9e" + integrity sha512-JAh0y6ScChRmATdQIsN416LK+bAFiGczD9A4zWBMPcTgkpj9SEOC7DEzpfbqoDKzieZw40dIAKx3PofGxukFqw== + dependencies: + "@mrmlnc/readdir-enhanced" "^2.2.1" + glob-parent "3.1.0" + merge2 "1.2.1" + micromatch "3.1.5" + +fast-glob@^3.0.3: + version "3.0.4" + resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.0.4.tgz#d484a41005cb6faeb399b951fd1bd70ddaebb602" + integrity sha512-wkIbV6qg37xTJwqSsdnIphL1e+LaGz4AIQqr00mIubMaEhv1/HEmJ0uuCGZRNRUkZZmOB5mJKO0ZUTVq+SxMQg== dependencies: - "@nodelib/fs.stat" "^2.0.2" - "@nodelib/fs.walk" "^1.2.3" - glob-parent "^5.1.0" - merge2 "^1.3.0" + "@nodelib/fs.stat" "^2.0.1" + "@nodelib/fs.walk" "^1.2.1" + glob-parent "^5.0.0" + is-glob "^4.0.1" + merge2 "^1.2.3" micromatch "^4.0.2" fast-json-stable-stringify@^2.0.0: @@ -14225,11 +13654,6 @@ fb-watchman@^2.0.0: dependencies: bser "^2.0.0" -fbjs-css-vars@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/fbjs-css-vars/-/fbjs-css-vars-1.0.2.tgz#216551136ae02fe255932c3ec8775f18e2c078b8" - integrity sha512-b2XGFAFdWZWg0phtAWLHCk836A1Xann+I+Dgd3Gk64MHKZO44FfoD1KxyvbSh0qZsIoXQGGlVztIY+oitJPpRQ== - fbjs@^0.8.0, fbjs@^0.8.1, fbjs@^0.8.16: version "0.8.17" resolved "https://registry.yarnpkg.com/fbjs/-/fbjs-0.8.17.tgz#c4d598ead6949112653d6588b01a5cdcd9f90fdd" @@ -14256,20 +13680,6 @@ fbjs@^0.8.4, fbjs@^0.8.9: setimmediate "^1.0.5" ua-parser-js "^0.7.9" -fbjs@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/fbjs/-/fbjs-1.0.0.tgz#52c215e0883a3c86af2a7a776ed51525ae8e0a5a" - integrity sha512-MUgcMEJaFhCaF1QtWGnmq9ZDRAzECTCRAF7O6UZIlAlkTs1SasiX9aP0Iw7wfD2mJ7wDTNfg2w7u5fSCwJk1OA== - dependencies: - core-js "^2.4.1" - fbjs-css-vars "^1.0.0" - isomorphic-fetch "^2.1.1" - loose-envify "^1.0.0" - object-assign "^4.1.0" - promise "^7.1.1" - setimmediate "^1.0.5" - ua-parser-js "^0.7.18" - fd-slicer@~1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/fd-slicer/-/fd-slicer-1.0.1.tgz#8b5bcbd9ec327c5041bf9ab023fd6750f1177e65" @@ -15040,17 +14450,7 @@ fsevents@~2.1.0: resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.1.0.tgz#ce1a5f9ac71c6d75278b0c5bd236d7dfece4cbaa" integrity sha512-+iXhW3LuDQsno8dOIrCIT/CBjeBWuP7PXe8w9shnj9Lebny/Gx1ZjVBYwexLz36Ri2jKuXMNpV6CYNh8lHHgrQ== -fstream@^1.0.0: - version "1.0.11" - resolved "https://registry.yarnpkg.com/fstream/-/fstream-1.0.11.tgz#5c1fb1f117477114f0632a0eb4b71b3cb0fd3171" - integrity sha1-XB+x8RdHcRTwYyoOtLcbPLD9MXE= - dependencies: - graceful-fs "^4.1.2" - inherits "~2.0.0" - mkdirp ">=0.5 0" - rimraf "2" - -fstream@^1.0.12: +fstream@^1.0.0, fstream@^1.0.12: version "1.0.12" resolved "https://registry.yarnpkg.com/fstream/-/fstream-1.0.12.tgz#4e8ba8ee2d48be4f7d0de505455548eae5932045" integrity sha512-WvJ193OHa0GHPEL+AycEJgxvBEwyfRkN1vhjca23OaPVMCaLCXTd5qAu82AjTcgP1UJmytkOKb63Ypde7raDIg== @@ -15404,7 +14804,7 @@ glob-all@^3.1.0: glob "^7.0.5" yargs "~1.2.6" -glob-parent@^3.1.0: +glob-parent@3.1.0, glob-parent@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-3.1.0.tgz#9e6af6299d8d3bd2bd40430832bd113df906c5ae" integrity sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4= @@ -15419,7 +14819,7 @@ glob-parent@^5.0.0: dependencies: is-glob "^4.0.1" -glob-parent@^5.1.0, glob-parent@~5.1.0: +glob-parent@~5.1.0: version "5.1.0" resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.0.tgz#5f4c1d1e748d30cd73ad2944b3577a81b081e8c2" integrity sha512-qjtRgnIVmOfnKUE3NJAQEdk+lKrxfw8t5ke7SXtfMTHcjsBfOfWXCQfdb30zfDoZQ2IRSIiidmjtbHZPZ++Ihw== @@ -15442,6 +14842,11 @@ glob-stream@^6.1.0: to-absolute-glob "^2.0.0" unique-stream "^2.0.2" +glob-to-regexp@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.3.0.tgz#8c5a1494d2066c570cc3bfe4496175acc4d502ab" + integrity sha1-jFoUlNIGbFcMw7/kSWF1rMTVAqs= + glob-to-regexp@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.4.0.tgz#49bd677b1671022bd10921c3788f23cdebf9c7e6" @@ -15620,18 +15025,6 @@ globals@^9.18.0, globals@^9.2.0: resolved "https://registry.yarnpkg.com/globals/-/globals-9.18.0.tgz#aa3896b3e69b487f17e31ed2143d69a8e30c2d8a" integrity sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ== -globby@11.0.0: - version "11.0.0" - resolved "https://registry.yarnpkg.com/globby/-/globby-11.0.0.tgz#56fd0e9f0d4f8fb0c456f1ab0dee96e1380bc154" - integrity sha512-iuehFnR3xu5wBBtm4xi0dMe92Ob87ufyu/dHwpDYfbcpYpIbrO5OnS8M1vWvrBhSGEJ3/Ecj7gnX76P8YxpPEg== - dependencies: - array-union "^2.1.0" - dir-glob "^3.0.1" - fast-glob "^3.1.1" - ignore "^5.1.4" - merge2 "^1.3.0" - slash "^3.0.0" - globby@8.0.2: version "8.0.2" resolved "https://registry.yarnpkg.com/globby/-/globby-8.0.2.tgz#5697619ccd95c5275dbb2d6faa42087c1a941d8d" @@ -15914,13 +15307,11 @@ graphlib@^2.1.7: lodash "^4.17.5" graphql-anywhere@^4.1.0-alpha.0: - version "4.2.4" - resolved "https://registry.yarnpkg.com/graphql-anywhere/-/graphql-anywhere-4.2.4.tgz#7f1c08c9348c730c6bb5e818c81f0b72c13696a8" - integrity sha512-rN6Op5vle0Ucqo8uOVPuFzRz1L/MB+ZVa+XezhFcQ6iP13vy95HOXRysrRtWcu2kQQTLyukSGmfU08D8LXWSIw== + version "4.1.16" + resolved "https://registry.yarnpkg.com/graphql-anywhere/-/graphql-anywhere-4.1.16.tgz#82bb59643e30183cfb7b485ed4262a7b39d8a6c1" + integrity sha512-DNQGxrh2p8w4vQwHIW1Sw65ZDbOr6ktQCeol6itH3LeWy1a3IoZ67jxrhgrHM+Upg8oiazvteSr64VRxJ8n5+g== dependencies: - apollo-utilities "^1.3.2" - ts-invariant "^0.3.2" - tslib "^1.9.3" + apollo-utilities "^1.0.18" graphql-code-generator@^0.18.2: version "0.18.2" @@ -16049,9 +15440,9 @@ graphql-extensions@^0.0.x, graphql-extensions@~0.0.9: source-map-support "^0.5.1" graphql-fields@^1.0.2: - version "1.3.0" - resolved "https://registry.yarnpkg.com/graphql-fields/-/graphql-fields-1.3.0.tgz#902ae2fd525eb04ddede7565d447db54dfc56b54" - integrity sha512-juRLzsYgbcJ/YuwExYObDPXn725YyCiVqxx6JlUm4HI5Ytm2RKp6MScaTVieMKtJI+Z6JmNgzInMTNuw0/DbZg== + version "1.2.1" + resolved "https://registry.yarnpkg.com/graphql-fields/-/graphql-fields-1.2.1.tgz#3777112af0bd6f55cc3c7b8f6d7748ab7a1b23bb" + integrity sha512-ufg/dxb78IjQUblNfiaEMkZWD1CwcZjdK0nTEW0dBQyNArxKZI7N+zohZdIdqVJcihPWJod1yymx4NM+1bZjTw== graphql-import@0.7.1, graphql-import@^0.7.1: version "0.7.1" @@ -16079,16 +15470,11 @@ graphql-tag-pluck@0.6.0: source-map-support "^0.5.9" typescript "^3.2.2" -graphql-tag@2.10.1: +graphql-tag@2.10.1, graphql-tag@^2.9.2: version "2.10.1" resolved "https://registry.yarnpkg.com/graphql-tag/-/graphql-tag-2.10.1.tgz#10aa41f1cd8fae5373eaf11f1f67260a3cad5e02" integrity sha512-jApXqWBzNXQ8jYa/HLkZJaVw9jgwNqZkywa2zfFn16Iv1Zb7ELNHkJaXHR7Quvd5SIGsy6Ny7SUKATgnu05uEg== -graphql-tag@^2.10.2, graphql-tag@^2.10.3: - version "2.10.3" - resolved "https://registry.yarnpkg.com/graphql-tag/-/graphql-tag-2.10.3.tgz#ea1baba5eb8fc6339e4c4cf049dabe522b0edf03" - integrity sha512-4FOv3ZKfA4WdOKJeHdz6B3F/vxBLSgmBcGeAFPf4n1F64ltJUvOOerNj0rsJxONQGdhUMynQIvd6LzB+1J5oKA== - graphql-toolkit@0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/graphql-toolkit/-/graphql-toolkit-0.2.0.tgz#91364b69911d51bc915269a37963f4ea2d5f335c" @@ -16117,23 +15503,23 @@ graphql-tools@4.0.4: iterall "^1.1.3" uuid "^3.1.0" -graphql-tools@^4.0.6: - version "4.0.6" - resolved "https://registry.yarnpkg.com/graphql-tools/-/graphql-tools-4.0.6.tgz#0e729e73db05ade3df10a2f92511be544972a844" - integrity sha512-jHLQw8x3xmSNRBCsaZqelXXsFfUSUSktSCUP8KYHiX1Z9qEuwcMpAf+FkdBzk8aTAFqOlPdNZ3OI4DKKqGKUqg== +graphql-tools@^3.0.2: + version "3.1.1" + resolved "https://registry.yarnpkg.com/graphql-tools/-/graphql-tools-3.1.1.tgz#d593358f01e7c8b1671a17b70ddb034dea9dbc50" + integrity sha512-yHvPkweUB0+Q/GWH5wIG60bpt8CTwBklCSzQdEHmRUgAdEQKxw+9B7zB3dG7wB3Ym7M7lfrS4Ej+jtDZfA2UXg== dependencies: - apollo-link "^1.2.3" + apollo-link "^1.2.2" apollo-utilities "^1.0.1" deprecated-decorator "^0.1.6" iterall "^1.1.3" uuid "^3.1.0" -graphql@^14.6.0: - version "14.6.0" - resolved "https://registry.yarnpkg.com/graphql/-/graphql-14.6.0.tgz#57822297111e874ea12f5cd4419616930cd83e49" - integrity sha512-VKzfvHEKybTKjQVpTFrA5yUq2S9ihcZvfJAtsDBBCuV6wauPu1xl/f9ehgVf0FcEJJs4vz6ysb/ZMkGigQZseg== +graphql@^0.13.2: + version "0.13.2" + resolved "https://registry.yarnpkg.com/graphql/-/graphql-0.13.2.tgz#4c740ae3c222823e7004096f832e7b93b2108270" + integrity sha512-QZ5BL8ZO/B20VA8APauGBg3GyEgZ19eduvpLWoq5x7gMmWnHoy8rlQWPLmWgFvo1yNgjSEFMesmS4R6pPr7xog== dependencies: - iterall "^1.2.2" + iterall "^1.2.1" graphviz@^0.0.8: version "0.0.8" @@ -16682,7 +16068,7 @@ hawk@~6.0.2: hoek "4.x.x" sntp "2.x.x" -he@1.2.0, he@1.2.x, he@^1.1.0, he@^1.1.1: +he@1.2.0, he@1.2.x, he@^1.1.1: version "1.2.0" resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== @@ -17186,11 +16572,6 @@ ignore@^5.1.1: resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.2.tgz#e28e584d43ad7e92f96995019cc43b9e1ac49558" integrity sha512-vdqWBp7MyzdmHkkRWV5nY+PfGRbYbahfuvsBCh277tq+w9zyNi7h5CYJCK0kmzti9kU+O/cB7sE8HvKv6aXAKQ== -ignore@^5.1.4: - version "5.1.4" - resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.4.tgz#84b7b3dbe64552b6ef0eca99f6743dbec6d97adf" - integrity sha512-MzbUSahkTW1u7JpKKjY7LCARd1fU5W2rLdxlM4kdkayuCwZImjkpluF9CM1aLewYJguPDqewLam18Y6AU69A8A== - image-size@~0.5.0: version "0.5.5" resolved "https://registry.yarnpkg.com/image-size/-/image-size-0.5.5.tgz#09dfd4ab9d20e29eb1c3e80b8990378df9e3cb9c" @@ -17216,11 +16597,6 @@ immutable@^4.0.0-rc.9: resolved "https://registry.yarnpkg.com/immutable/-/immutable-4.0.0-rc.12.tgz#ca59a7e4c19ae8d9bf74a97bdf0f6e2f2a5d0217" integrity sha512-0M2XxkZLx/mi3t8NVwIm1g8nHoEmM9p9UBl/G9k4+hm0kBgOVdMV/B3CY5dQ8qG8qc80NN4gDV4HQv6FTJ5q7A== -immutable@~3.7.6: - version "3.7.6" - resolved "https://registry.yarnpkg.com/immutable/-/immutable-3.7.6.tgz#13b4d3cb12befa15482a26fe1b2ebae640071e4b" - integrity sha1-E7TTyxK++hVIKib+Gy665kAHHks= - import-cwd@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/import-cwd/-/import-cwd-2.1.0.tgz#aa6cf36e722761285cb371ec6519f53e2435b0a9" @@ -17251,13 +16627,6 @@ import-from@2.1.0, import-from@^2.1.0: dependencies: resolve-from "^3.0.0" -import-from@3.0.0, import-from@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/import-from/-/import-from-3.0.0.tgz#055cfec38cd5a27d8057ca51376d7d3bf0891966" - integrity sha512-CiuXOFFSzkU5x/CR0+z7T91Iht4CXgfCxVOFRhh2Zyhg5wOpWvvDLQUsWl+gcN+QscYBjez8hDCt85O7RLDttQ== - dependencies: - resolve-from "^5.0.0" - import-lazy@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/import-lazy/-/import-lazy-2.1.0.tgz#05698e3d45c88e8d7e9d92cb0584e77f096f3e43" @@ -17943,13 +17312,6 @@ is-glob@4.0.0, is-glob@^4.0.0: dependencies: is-extglob "^2.1.1" -is-glob@4.0.1, is-glob@^4.0.1, is-glob@~4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.1.tgz#7567dbe9f2f5e2467bc77ab83c4a29482407a5dc" - integrity sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg== - dependencies: - is-extglob "^2.1.1" - is-glob@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-2.0.1.tgz#d096f926a3ded5600f3fdfd91198cb0888c2d863" @@ -17964,6 +17326,13 @@ is-glob@^3.1.0: dependencies: is-extglob "^2.1.0" +is-glob@^4.0.1, is-glob@~4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.1.tgz#7567dbe9f2f5e2467bc77ab83c4a29482407a5dc" + integrity sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg== + dependencies: + is-extglob "^2.1.1" + is-hexadecimal@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/is-hexadecimal/-/is-hexadecimal-1.0.1.tgz#6e084bbc92061fbb0971ec58b6ce6d404e24da69" @@ -18086,6 +17455,13 @@ is-observable@^1.1.0: dependencies: symbol-observable "^1.1.0" +is-odd@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-odd/-/is-odd-1.0.0.tgz#3b8a932eb028b3775c39bb09e91767accdb69088" + integrity sha1-O4qTLrAos3dcObsJ6RdnrM22kIg= + dependencies: + is-number "^3.0.0" + is-odd@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/is-odd/-/is-odd-2.0.0.tgz#7646624671fd7ea558ccd9a2795182f2958f1b24" @@ -18572,7 +17948,7 @@ items@2.x.x: resolved "https://registry.yarnpkg.com/items/-/items-2.1.1.tgz#8bd16d9c83b19529de5aea321acaada78364a198" integrity sha1-i9FtnIOxlSneWuoyGsqtp4NkoZg= -iterall@^1.1.3, iterall@^1.2.2: +iterall@^1.1.3, iterall@^1.2.1: version "1.2.2" resolved "https://registry.yarnpkg.com/iterall/-/iterall-1.2.2.tgz#92d70deb8028e0c39ff3164fdbf4d8b088130cd7" integrity sha512-yynBb1g+RFUPY64fTrFv7nsjRrENBQJaX2UL+2Szc9REFrSNm1rpSXHGzhmAy7a9uv3vlvgBlXnf9RqmPH1/DA== @@ -20393,12 +19769,7 @@ lodash.uniqby@^4.7.0: resolved "https://registry.yarnpkg.com/lodash.uniqby/-/lodash.uniqby-4.7.0.tgz#d99c07a669e9e6d24e1362dfe266c67616af1302" integrity sha1-2ZwHpmnp5tJOE2Lf4mbGdhavEwI= -lodash@4.17.11: - version "4.17.11" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d" - integrity sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg== - -lodash@4.17.15, lodash@>4.17.4, lodash@^4, lodash@^4.0.0, lodash@^4.0.1, lodash@^4.10.0, lodash@^4.11.1, lodash@^4.13.1, lodash@^4.14.0, lodash@^4.15.0, lodash@^4.17.0, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.2, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.0, lodash@^4.2.1, lodash@^4.3.0, lodash@^4.5.0, lodash@^4.6.1, lodash@~4.17.10, lodash@~4.17.15, lodash@~4.17.5: +lodash@4.17.11, lodash@4.17.15, lodash@>4.17.4, lodash@^4, lodash@^4.0.0, lodash@^4.0.1, lodash@^4.10.0, lodash@^4.11.1, lodash@^4.13.1, lodash@^4.14.0, lodash@^4.15.0, lodash@^4.17.0, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.2, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.0, lodash@^4.2.1, lodash@^4.3.0, lodash@^4.5.0, lodash@^4.6.1, lodash@~4.17.10, lodash@~4.17.15, lodash@~4.17.5: version "4.17.15" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A== @@ -20538,13 +19909,6 @@ lower-case-first@^1.0.0: dependencies: lower-case "^1.1.2" -lower-case@2.0.1, lower-case@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/lower-case/-/lower-case-2.0.1.tgz#39eeb36e396115cc05e29422eaea9e692c9408c7" - integrity sha512-LiWgfDLLb1dwbFQZsSglpRj+1ctGnayXz3Uv0/WO8n558JycT5fg6zkNcnW0G68Nn0aEldTFeEfmjCfmqry/rQ== - dependencies: - tslib "^1.10.0" - lower-case@^1.1.0, lower-case@^1.1.1, lower-case@^1.1.2: version "1.1.4" resolved "https://registry.yarnpkg.com/lower-case/-/lower-case-1.1.4.tgz#9a2cabd1b9e8e0ae993a4bf7d5875c39c42e8eac" @@ -21053,16 +20417,16 @@ merge-stream@^2.0.0: resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== +merge2@1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.2.1.tgz#271d2516ff52d4af7f7b710b8bf3e16e183fef66" + integrity sha512-wUqcG5pxrAcaFI1lkqkMnk3Q7nUxV/NWfpAFSeWUwG9TRODnBDCUHa75mi3o3vLWQ5N4CQERWCauSlP0I3ZqUg== + merge2@^1.2.3: version "1.2.3" resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.2.3.tgz#7ee99dbd69bb6481689253f018488a1b902b0ed5" integrity sha512-gdUU1Fwj5ep4kplwcmftruWofEFt6lfpkkr3h860CXbAB9c3hGb55EOL2ali0Td5oebvW0E1+3Sr+Ur7XfKpRA== -merge2@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.3.0.tgz#5b366ee83b2f1582c48f87e47cf1a9352103ca81" - integrity sha512-2j4DAdlBOkiSZIsaXk4mTE3sRS02yBHAtfy127xRV3bQUFqXkjHCHLW6Scv7DwNRbIWNHH8zpnz9zMaKXIdvYw== - merge@^1.2.0: version "1.2.1" resolved "https://registry.yarnpkg.com/merge/-/merge-1.2.1.tgz#38bebf80c3220a8a487b6fcfb3941bb11720c145" @@ -21097,6 +20461,25 @@ micromatch@3.1.10, micromatch@^3.0.4, micromatch@^3.1.10, micromatch@^3.1.4: snapdragon "^0.8.1" to-regex "^3.0.2" +micromatch@3.1.5: + version "3.1.5" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.5.tgz#d05e168c206472dfbca985bfef4f57797b4cd4ba" + integrity sha512-ykttrLPQrz1PUJcXjwsTUjGoPJ64StIGNE2lGVD1c9CuguJ+L7/navsE8IcDNndOoCMvYV0qc/exfVbMHkUhvA== + dependencies: + arr-diff "^4.0.0" + array-unique "^0.3.2" + braces "^2.3.0" + define-property "^1.0.0" + extend-shallow "^2.0.1" + extglob "^2.0.2" + fragment-cache "^0.2.1" + kind-of "^6.0.0" + nanomatch "^1.2.5" + object.pick "^1.3.0" + regex-not "^1.0.0" + snapdragon "^0.8.1" + to-regex "^3.0.1" + micromatch@^4.0.0, micromatch@^4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.2.tgz#4fcb0999bf9fbc2fcbdd212f6d629b9a56c39259" @@ -21727,6 +21110,23 @@ nano-time@1.0.0: dependencies: big-integer "^1.6.16" +nanomatch@^1.2.5: + version "1.2.7" + resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.7.tgz#53cd4aa109ff68b7f869591fdc9d10daeeea3e79" + integrity sha512-/5ldsnyurvEw7wNpxLFgjVvBLMta43niEYOy0CJ4ntcYSbx6bugRUTQeFb4BR/WanEL1o3aQgHuVLHQaB6tOqg== + dependencies: + arr-diff "^4.0.0" + array-unique "^0.3.2" + define-property "^1.0.0" + extend-shallow "^2.0.1" + fragment-cache "^0.2.1" + is-odd "^1.0.0" + kind-of "^5.0.2" + object.pick "^1.3.0" + regex-not "^1.0.0" + snapdragon "^0.8.1" + to-regex "^3.0.1" + nanomatch@^1.2.9: version "1.2.9" resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.9.tgz#879f7150cb2dab7a471259066c104eee6e0fa7c2" @@ -21878,14 +21278,6 @@ no-case@^2.2.0, no-case@^2.3.2: dependencies: lower-case "^1.1.1" -no-case@^3.0.3: - version "3.0.3" - resolved "https://registry.yarnpkg.com/no-case/-/no-case-3.0.3.tgz#c21b434c1ffe48b39087e86cfb4d2582e9df18f8" - integrity sha512-ehY/mVQCf9BL0gKfsJBvFJen+1V//U+0HQMPrWct40ixE4jnv0bfvxDbWtAHL9EcaPEOJHVVYKoQn1TlZUB8Tw== - dependencies: - lower-case "^2.0.1" - tslib "^1.10.0" - nock@10.0.6: version "10.0.6" resolved "https://registry.yarnpkg.com/nock/-/nock-10.0.6.tgz#e6d90ee7a68b8cfc2ab7f6127e7d99aa7d13d111" @@ -21929,16 +21321,16 @@ node-fetch@2.1.2: resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.1.2.tgz#ab884e8e7e57e38a944753cec706f788d1768bb5" integrity sha1-q4hOjn5X44qUR1POxwb3iNF2i7U= -node-fetch@2.6.0, node-fetch@^2.6.0: - version "2.6.0" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.0.tgz#e633456386d4aa55863f676a7ab0daa8fdecb0fd" - integrity sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA== - node-fetch@^2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.3.0.tgz#1a1d940bbfb916a1d3e0219f037e89e71f8c5fa5" integrity sha512-MOd8pV3fxENbryESLgVIeaGKrdl+uaYhCSSVkjeOb/31/njTpcis5aWfdqgNlHIrKOLRbMnfPINPOML2CIFeXA== +node-fetch@^2.6.0: + version "2.6.0" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.0.tgz#e633456386d4aa55863f676a7ab0daa8fdecb0fd" + integrity sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA== + node-forge@0.9.0: version "0.9.0" resolved "https://registry.yarnpkg.com/node-forge/-/node-forge-0.9.0.tgz#d624050edbb44874adca12bb9a52ec63cb782579" @@ -22338,11 +21730,6 @@ null-loader@^3.0.0: loader-utils "^1.2.3" schema-utils "^1.0.0" -nullthrows@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/nullthrows/-/nullthrows-1.1.1.tgz#7818258843856ae971eae4208ad7d7eb19a431b1" - integrity sha512-2vPPEi+Z7WqML2jZYddDIfy5Dqb0r2fze2zTxNNknZaFpVHU3mFB3R+DWeJWGVx0ecvttSGlJTI+WG+8Z4cDWw== - num2fraction@^1.2.2: version "1.2.2" resolved "https://registry.yarnpkg.com/num2fraction/-/num2fraction-1.2.2.tgz#6f682b6a027a4e9ddfa4564cd2589d1d4e669ede" @@ -22720,17 +22107,10 @@ oppsy@2.x.x, oppsy@^2.0.0: dependencies: hoek "5.x.x" -optimism@^0.11.5: - version "0.11.5" - resolved "https://registry.yarnpkg.com/optimism/-/optimism-0.11.5.tgz#4c5d45fa0fa1cc9dcf092729b5d6d661b53ff5c9" - integrity sha512-twCHmBb64DYzEZ8A3O+TLCuF/RmZPBhXPQYv4agoiALRLlW9SidMzd7lwUP9mL0jOZhzhnBmb8ajqA00ECo/7g== - dependencies: - "@wry/context" "^0.5.0" - optimism@^0.9.0: - version "0.9.6" - resolved "https://registry.yarnpkg.com/optimism/-/optimism-0.9.6.tgz#5621195486b294c3bfc518d17ac47767234b029f" - integrity sha512-bWr/ZP32UgFCQAoSkz33XctHwpq2via2sBvGvO5JIlrU8gaiM0LvoKj3QMle9LWdSKlzKik8XGSerzsdfYLNxA== + version "0.9.5" + resolved "https://registry.yarnpkg.com/optimism/-/optimism-0.9.5.tgz#b8b5dc9150e97b79ddbf2d2c6c0e44de4d255527" + integrity sha512-lNvmuBgONAGrUbj/xpH69FjMOz1d0jvMNoOCKyVynUPzq2jgVlGL4jFYJqrUHzUfBv+jAFSCP61x5UkfbduYJA== dependencies: "@wry/context" "^0.4.0" @@ -23154,14 +22534,6 @@ param-case@2.1.x, param-case@^2.1.0: dependencies: no-case "^2.2.0" -param-case@3.0.3: - version "3.0.3" - resolved "https://registry.yarnpkg.com/param-case/-/param-case-3.0.3.tgz#4be41f8399eff621c56eebb829a5e451d9801238" - integrity sha512-VWBVyimc1+QrzappRs7waeN2YmoZFCGXWASRYX1/rGHtXqEcrGEIDm+jqIwFa2fRXNgQEwrxaYuIrX0WcAguTA== - dependencies: - dot-case "^3.0.3" - tslib "^1.10.0" - parent-module@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.0.tgz#df250bdc5391f4a085fb589dad761f5ad6b865b5" @@ -23364,14 +22736,6 @@ parseurl@~1.3.3: resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.3.tgz#9da19e7bee8d12dff0513ed5b76957793bc2e8d4" integrity sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ== -pascal-case@3.1.1, pascal-case@^3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/pascal-case/-/pascal-case-3.1.1.tgz#5ac1975133ed619281e88920973d2cd1f279de5f" - integrity sha512-XIeHKqIrsquVTQL2crjq3NfJUxmdLasn3TYOU0VBM+UX2a6ztAWBlJQBePLGY7VHW8+2dRadeIPK5+KImwTxQA== - dependencies: - no-case "^3.0.3" - tslib "^1.10.0" - pascal-case@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/pascal-case/-/pascal-case-2.0.1.tgz#2d578d3455f660da65eca18ef95b4e0de912761e" @@ -26068,10 +25432,15 @@ regex-regex@^1.0.0: resolved "https://registry.yarnpkg.com/regex-regex/-/regex-regex-1.0.0.tgz#9048a1eaeb870f4d480dabc76fc42cdcc0bc3a72" integrity sha1-kEih6uuHD01IDavHb8Qs3MC8OnI= -regexp-tree@^0.1.13, regexp-tree@^0.1.6: - version "0.1.17" - resolved "https://registry.yarnpkg.com/regexp-tree/-/regexp-tree-0.1.17.tgz#66d914a6ca21f95dd7660ed70a7dad47aeb2246a" - integrity sha512-UnOJjFS/EPZmfISmYx+0PcDtPzyFKTe+cZTS5sM5hifnRUDRxoB1j4DAmGwqzxjwBGlwOkGfb2cDGHtjuEwqoA== +regexp-tree@^0.1.13: + version "0.1.13" + resolved "https://registry.yarnpkg.com/regexp-tree/-/regexp-tree-0.1.13.tgz#5b19ab9377edc68bc3679256840bb29afc158d7f" + integrity sha512-hwdV/GQY5F8ReLZWO+W1SRoN5YfpOKY6852+tBFcma72DKBIcHjPRIlIvQN35bCOljuAfP2G2iB0FC/w236mUw== + +regexp-tree@^0.1.6: + version "0.1.10" + resolved "https://registry.yarnpkg.com/regexp-tree/-/regexp-tree-0.1.10.tgz#d837816a039c7af8a8d64d7a7c3cf6a1d93450bc" + integrity sha512-K1qVSbcedffwuIslMwpe6vGlj+ZXRnGkvjAtFHfDZZZuEdA/h0dxljAPu9vhUo6Rrx2U2AwJ+nSQ6hK+lrP5MQ== regexp.prototype.flags@^1.2.0: version "1.2.0" @@ -26172,36 +25541,6 @@ relative@^3.0.2: dependencies: isobject "^2.0.0" -relay-compiler@8.0.0: - version "8.0.0" - resolved "https://registry.yarnpkg.com/relay-compiler/-/relay-compiler-8.0.0.tgz#567edebc857db5748142b57a78d197f976b5e3ac" - integrity sha512-JrS3Bv6+6S0KloHmXUyTcrdFRpI3NxWdiVQC146vD5jgay9EM464lyf9bEUsCol3na4JUrad4aQ/r+4wWxG1kw== - dependencies: - "@babel/core" "^7.0.0" - "@babel/generator" "^7.5.0" - "@babel/parser" "^7.0.0" - "@babel/runtime" "^7.0.0" - "@babel/traverse" "^7.0.0" - "@babel/types" "^7.0.0" - babel-preset-fbjs "^3.3.0" - chalk "^2.4.1" - fast-glob "^2.2.2" - fb-watchman "^2.0.0" - fbjs "^1.0.0" - immutable "~3.7.6" - nullthrows "^1.1.1" - relay-runtime "8.0.0" - signedsource "^1.0.0" - yargs "^14.2.0" - -relay-runtime@8.0.0: - version "8.0.0" - resolved "https://registry.yarnpkg.com/relay-runtime/-/relay-runtime-8.0.0.tgz#52585a7bf04a710bd1bc664bfb0a60dbff3ce6e1" - integrity sha512-lOaZ7K/weTuCIt3pWHkxUG8s7iohI4IyYj65YV4sB9iX6W0uMvt626BFJ4GvNXFmd+OrgNnXcvx1mqRFqJaV8A== - dependencies: - "@babel/runtime" "^7.0.0" - fbjs "^1.0.0" - release-zalgo@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/release-zalgo/-/release-zalgo-1.0.0.tgz#09700b7e5074329739330e535c5a90fb67851730" @@ -26598,11 +25937,6 @@ resolve-dir@^1.0.0, resolve-dir@^1.0.1: expand-tilde "^2.0.0" global-modules "^1.0.0" -resolve-from@5.0.0, resolve-from@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-5.0.0.tgz#c35225843df8f776df21c57557bc087e9dfdfc69" - integrity sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw== - resolve-from@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-1.0.1.tgz#26cbfe935d1aeeeabb29bc3fe5aeb01e93d44226" @@ -26618,6 +25952,11 @@ resolve-from@^4.0.0: resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6" integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g== +resolve-from@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-5.0.0.tgz#c35225843df8f776df21c57557bc087e9dfdfc69" + integrity sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw== + resolve-options@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/resolve-options/-/resolve-options-1.1.0.tgz#32bb9e39c06d67338dc9378c0d6d6074566ad131" @@ -27655,11 +26994,6 @@ signal-exit@^3.0.0, signal-exit@^3.0.2: resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" integrity sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0= -signedsource@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/signedsource/-/signedsource-1.0.0.tgz#1ddace4981798f93bd833973803d80d52e93ad6a" - integrity sha1-HdrOSYF5j5O9gzlzgD2A1S6TrWo= - simple-git@1.116.0: version "1.116.0" resolved "https://registry.yarnpkg.com/simple-git/-/simple-git-1.116.0.tgz#ea6e533466f1e0152186e306e004d4eefa6e3e00" @@ -29894,6 +29228,13 @@ ts-easing@^0.2.0: resolved "https://registry.yarnpkg.com/ts-easing/-/ts-easing-0.2.0.tgz#c8a8a35025105566588d87dbda05dd7fbfa5a4ec" integrity sha512-Z86EW+fFFh/IFB1fqQ3/+7Zpf9t2ebOAxNI/V6Wo7r5gqiqtxmgTlQ1qbqQcjLKYeSHPTsEmvlJUDg/EuL0uHQ== +ts-invariant@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/ts-invariant/-/ts-invariant-0.2.1.tgz#3d587f9d6e3bded97bf9ec17951dd9814d5a9d3f" + integrity sha512-Z/JSxzVmhTo50I+LKagEISFJW3pvPCqsMWLamCTX8Kr3N5aMrnGOqcflbe5hLUzwjvgPfnLzQtHZv0yWQ+FIHg== + dependencies: + tslib "^1.9.3" + ts-invariant@^0.3.2: version "0.3.3" resolved "https://registry.yarnpkg.com/ts-invariant/-/ts-invariant-0.3.3.tgz#b5742b1885ecf9e29c31a750307480f045ec0b16" @@ -29908,13 +29249,6 @@ ts-invariant@^0.4.0: dependencies: tslib "^1.9.3" -ts-invariant@^0.4.4: - version "0.4.4" - resolved "https://registry.yarnpkg.com/ts-invariant/-/ts-invariant-0.4.4.tgz#97a523518688f93aafad01b0e80eb803eb2abd86" - integrity sha512-uEtWkFM/sdZvRNNDL3Ehu4WVpwaulhwQszV8mrtcdeE8nN00BV9mAmQ88RkrBhFgl9gMgvjJLAQcZbnPXI9mlA== - dependencies: - tslib "^1.9.3" - ts-loader@^6.0.4: version "6.0.4" resolved "https://registry.yarnpkg.com/ts-loader/-/ts-loader-6.0.4.tgz#bc331ad91a887a60632d94c9f79448666f2c4b63" @@ -29949,7 +29283,7 @@ tsd@^0.7.4: typescript "^3.0.1" update-notifier "^2.5.0" -tslib@1.10.0, tslib@^1, tslib@^1.10.0: +tslib@^1, tslib@^1.10.0: version "1.10.0" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a" integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ== @@ -30839,13 +30173,6 @@ universalify@^0.1.0: resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66" integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg== -unixify@1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/unixify/-/unixify-1.0.0.tgz#3a641c8c2ffbce4da683a5c70f03a462940c2090" - integrity sha1-OmQcjC/7zk2mg6XHDwOkYpQMIJA= - dependencies: - normalize-path "^2.1.1" - unlazy-loader@^0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/unlazy-loader/-/unlazy-loader-0.1.3.tgz#2efdf05c489da311055586bf3cfca0c541dd8fa5" @@ -30974,13 +30301,6 @@ upper-case-first@^1.1.0, upper-case-first@^1.1.2: dependencies: upper-case "^1.1.1" -upper-case@2.0.1, upper-case@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/upper-case/-/upper-case-2.0.1.tgz#6214d05e235dc817822464ccbae85822b3d8665f" - integrity sha512-laAsbea9SY5osxrv7S99vH9xAaJKrw5Qpdh4ENRLcaxipjKsiaBwiAsxfa8X5mObKNTQPsupSq0J/VIxsSJe3A== - dependencies: - tslib "^1.10.0" - upper-case@^1.0.3, upper-case@^1.1.0, upper-case@^1.1.1, upper-case@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/upper-case/-/upper-case-1.1.3.tgz#f6b4501c2ec4cdd26ba78be7222961de77621598" @@ -31864,14 +31184,6 @@ vt-pbf@^3.1.1: "@mapbox/vector-tile" "^1.3.1" pbf "^3.0.5" -vue-template-compiler@^2.6.11: - version "2.6.11" - resolved "https://registry.yarnpkg.com/vue-template-compiler/-/vue-template-compiler-2.6.11.tgz#c04704ef8f498b153130018993e56309d4698080" - integrity sha512-KIq15bvQDrcCjpGjrAhx4mUlyyHfdmTaoNfeoATHLAiWB+MU3cx4lOzMwrnUh9cCxy0Lt1T11hAFY6TQgroUAA== - dependencies: - de-indent "^1.0.2" - he "^1.1.0" - w3c-hr-time@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/w3c-hr-time/-/w3c-hr-time-1.0.1.tgz#82ac2bff63d950ea9e3189a58a65625fedf19045" @@ -32182,7 +31494,7 @@ whatwg-fetch@2.0.4: resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-2.0.4.tgz#dde6a5df315f9d39991aa17621853d720b85566f" integrity sha512-dcQ1GWpOD/eEQ97k66aiEVpNnapVj90/+R+SXTPYGHpYBBypfKJEQjLrvMZ7YXbKm21gXd4NcuxUTjiv1YtLng== -whatwg-fetch@3.0.0, whatwg-fetch@>=0.10.0, whatwg-fetch@^3.0.0: +whatwg-fetch@>=0.10.0, whatwg-fetch@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-3.0.0.tgz#fc804e458cc460009b1a2b966bc8817d2578aefb" integrity sha512-9GSJUgz1D4MfyKU7KRqwOjXCXTqWdFNvEr7eUBYchQiVc744mqK/MzXPNR2WsPkmkOa4ywfg8C2n8h+13Bey1Q== @@ -33143,6 +32455,21 @@ z-schema@~3.18.3: optionalDependencies: commander "^2.7.1" +zen-observable-ts@^0.8.10: + version "0.8.10" + resolved "https://registry.yarnpkg.com/zen-observable-ts/-/zen-observable-ts-0.8.10.tgz#18e2ce1c89fe026e9621fd83cc05168228fce829" + integrity sha512-5vqMtRggU/2GhePC9OU4sYEWOdvmayp2k3gjPf4F0mXwB3CSbbNznfDUvDJx9O2ZTa1EIXdJhPchQveFKwNXPQ== + dependencies: + zen-observable "^0.8.0" + +zen-observable-ts@^0.8.18: + version "0.8.18" + resolved "https://registry.yarnpkg.com/zen-observable-ts/-/zen-observable-ts-0.8.18.tgz#ade44b1060cc4a800627856ec10b9c67f5f639c8" + integrity sha512-q7d05s75Rn1j39U5Oapg3HI2wzriVwERVo4N7uFGpIYuHB9ff02P/E92P9B8T7QVC93jCMHpbXH7X0eVR5LA7A== + dependencies: + tslib "^1.9.3" + zen-observable "^0.8.0" + zen-observable-ts@^0.8.20: version "0.8.20" resolved "https://registry.yarnpkg.com/zen-observable-ts/-/zen-observable-ts-0.8.20.tgz#44091e335d3fcbc97f6497e63e7f57d5b516b163" @@ -33156,11 +32483,6 @@ zen-observable@^0.8.0: resolved "https://registry.yarnpkg.com/zen-observable/-/zen-observable-0.8.8.tgz#1ea93995bf098754a58215a1e0a7309e5749ec42" integrity sha512-HnhhyNnwTFzS48nihkCZIJGsWGFcYUz+XPDlPK5W84Ifji8SksC6m7sQWOf8zdCGhzQ4tDYuMYGu5B0N1dXTtg== -zen-observable@^0.8.14: - version "0.8.15" - resolved "https://registry.yarnpkg.com/zen-observable/-/zen-observable-0.8.15.tgz#96415c512d8e3ffd920afd3889604e30b9eaac15" - integrity sha512-PQ2PC7R9rslx84ndNBZB/Dkv8V8fZEpk83RLgXtYd0fwUgEjseMn1Dgajh2x6S8QbZAFa9p2qVCEuYZNgve0dQ== - zip-stream@^2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/zip-stream/-/zip-stream-2.1.2.tgz#841efd23214b602ff49c497cba1a85d8b5fbc39c" From 0f329f564b9333e86a18a856c570d017852576e9 Mon Sep 17 00:00:00 2001 From: spalger Date: Fri, 28 Feb 2020 11:45:25 -0700 Subject: [PATCH 19/31] disable flaky suite (#55953) --- .../lib/request_interceptors/on_post_auth_interceptor.test.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/spaces/server/lib/request_interceptors/on_post_auth_interceptor.test.ts b/x-pack/plugins/spaces/server/lib/request_interceptors/on_post_auth_interceptor.test.ts index 61157a9318781..9cbb2c30e4baf 100644 --- a/x-pack/plugins/spaces/server/lib/request_interceptors/on_post_auth_interceptor.test.ts +++ b/x-pack/plugins/spaces/server/lib/request_interceptors/on_post_auth_interceptor.test.ts @@ -30,7 +30,8 @@ import { Feature } from '../../../../features/server'; import { spacesConfig } from '../__fixtures__'; import { securityMock } from '../../../../security/server/mocks'; -describe('onPostAuthInterceptor', () => { +// FLAKY: https://github.com/elastic/kibana/issues/55953 +describe.skip('onPostAuthInterceptor', () => { let root: ReturnType; jest.setTimeout(30000); From b658baf012e6a0102f23e475196ae1a8a5b76355 Mon Sep 17 00:00:00 2001 From: Zacqary Adam Xeper Date: Fri, 28 Feb 2020 13:11:34 -0600 Subject: [PATCH 20/31] [Metrics Alerts] Fix alerting on a rate aggregation (#58789) Co-authored-by: Elastic Machine --- .../register_metric_threshold_alert_type.ts | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/x-pack/plugins/infra/server/lib/alerting/metric_threshold/register_metric_threshold_alert_type.ts b/x-pack/plugins/infra/server/lib/alerting/metric_threshold/register_metric_threshold_alert_type.ts index 9bc54c1a49c8f..8f1f10ccad5ac 100644 --- a/x-pack/plugins/infra/server/lib/alerting/metric_threshold/register_metric_threshold_alert_type.ts +++ b/x-pack/plugins/infra/server/lib/alerting/metric_threshold/register_metric_threshold_alert_type.ts @@ -6,6 +6,7 @@ import uuid from 'uuid'; import { i18n } from '@kbn/i18n'; import { schema } from '@kbn/config-schema'; +import { networkTraffic } from '../../../../common/inventory_models/shared/metrics/snapshot/network_traffic'; import { MetricThresholdAlertTypeParams, Comparator, @@ -26,6 +27,17 @@ async function getMetric( { metric, aggType, timeUnit, timeSize, indexPattern }: MetricThresholdAlertTypeParams ) { const interval = `${timeSize}${timeUnit}`; + const aggregations = + aggType === 'rate' + ? networkTraffic('aggregatedValue', metric) + : { + aggregatedValue: { + [aggType]: { + field: metric, + }, + }, + }; + const searchBody = { query: { bool: { @@ -50,13 +62,7 @@ async function getMetric( field: '@timestamp', fixed_interval: interval, }, - aggregations: { - aggregatedValue: { - [aggType]: { - field: metric, - }, - }, - }, + aggregations, }, }, }; From 06ebbb3fe0a65c6060d1e915307b715904915dcd Mon Sep 17 00:00:00 2001 From: Zacqary Adam Xeper Date: Fri, 28 Feb 2020 13:11:50 -0600 Subject: [PATCH 21/31] [Metric Alerts] Add backend support for multiple expressions per alert (#58672) * Add support for multiple alert expressions * Rename expressions to criteria Co-authored-by: Elastic Machine --- .../register_metric_threshold_alert_type.ts | 48 ++++++++++++------- .../lib/alerting/metric_threshold/types.ts | 2 +- 2 files changed, 31 insertions(+), 19 deletions(-) diff --git a/x-pack/plugins/infra/server/lib/alerting/metric_threshold/register_metric_threshold_alert_type.ts b/x-pack/plugins/infra/server/lib/alerting/metric_threshold/register_metric_threshold_alert_type.ts index 8f1f10ccad5ac..8785957dbd98e 100644 --- a/x-pack/plugins/infra/server/lib/alerting/metric_threshold/register_metric_threshold_alert_type.ts +++ b/x-pack/plugins/infra/server/lib/alerting/metric_threshold/register_metric_threshold_alert_type.ts @@ -8,7 +8,7 @@ import { i18n } from '@kbn/i18n'; import { schema } from '@kbn/config-schema'; import { networkTraffic } from '../../../../common/inventory_models/shared/metrics/snapshot/network_traffic'; import { - MetricThresholdAlertTypeParams, + MetricExpressionParams, Comparator, AlertStates, METRIC_THRESHOLD_ALERT_TYPE_ID, @@ -24,7 +24,7 @@ const FIRED_ACTIONS = { async function getMetric( { callCluster }: AlertServices, - { metric, aggType, timeUnit, timeSize, indexPattern }: MetricThresholdAlertTypeParams + { metric, aggType, timeUnit, timeSize, indexPattern }: MetricExpressionParams ) { const interval = `${timeSize}${timeUnit}`; const aggregations = @@ -101,37 +101,49 @@ export async function registerMetricThresholdAlertType(alertingPlugin: PluginSet name: 'Metric Alert - Threshold', validate: { params: schema.object({ - threshold: schema.arrayOf(schema.number()), - comparator: schema.string(), - aggType: schema.string(), - metric: schema.string(), - timeUnit: schema.string(), - timeSize: schema.number(), - indexPattern: schema.string(), + criteria: schema.arrayOf( + schema.object({ + threshold: schema.arrayOf(schema.number()), + comparator: schema.string(), + aggType: schema.string(), + metric: schema.string(), + timeUnit: schema.string(), + timeSize: schema.number(), + indexPattern: schema.string(), + }) + ), }), }, defaultActionGroupId: FIRED_ACTIONS.id, actionGroups: [FIRED_ACTIONS], async executor({ services, params }) { - const { threshold, comparator } = params as MetricThresholdAlertTypeParams; + const { criteria } = params as { criteria: MetricExpressionParams[] }; const alertInstance = services.alertInstanceFactory(alertUUID); - const currentValue = await getMetric(services, params as MetricThresholdAlertTypeParams); - if (typeof currentValue === 'undefined') - throw new Error('Could not get current value of metric'); - const comparisonFunction = comparatorMap[comparator]; + const alertResults = await Promise.all( + criteria.map(({ threshold, comparator }) => + (async () => { + const currentValue = await getMetric(services, params as MetricExpressionParams); + if (typeof currentValue === 'undefined') + throw new Error('Could not get current value of metric'); - const isValueInAlertState = comparisonFunction(currentValue, threshold); + const comparisonFunction = comparatorMap[comparator]; + return { shouldFire: comparisonFunction(currentValue, threshold), currentValue }; + })() + ) + ); - if (isValueInAlertState) { + const shouldAlertFire = alertResults.every(({ shouldFire }) => shouldFire); + + if (shouldAlertFire) { alertInstance.scheduleActions(FIRED_ACTIONS.id, { - value: currentValue, + value: alertResults.map(({ currentValue }) => currentValue), }); } // Future use: ability to fetch display current alert state alertInstance.replaceState({ - alertState: isValueInAlertState ? AlertStates.ALERT : AlertStates.OK, + alertState: shouldAlertFire ? AlertStates.ALERT : AlertStates.OK, }); }, }); diff --git a/x-pack/plugins/infra/server/lib/alerting/metric_threshold/types.ts b/x-pack/plugins/infra/server/lib/alerting/metric_threshold/types.ts index 2618469ff693c..9bb0d8963ac66 100644 --- a/x-pack/plugins/infra/server/lib/alerting/metric_threshold/types.ts +++ b/x-pack/plugins/infra/server/lib/alerting/metric_threshold/types.ts @@ -23,7 +23,7 @@ export enum AlertStates { export type TimeUnit = 's' | 'm' | 'h' | 'd'; -export interface MetricThresholdAlertTypeParams { +export interface MetricExpressionParams { aggType: MetricsExplorerAggregation; metric: string; timeSize: number; From b46a335f2bf03d6b8ce3ce5cb830bf4e998765b5 Mon Sep 17 00:00:00 2001 From: Kevin Logan <56395104+kevinlog@users.noreply.github.com> Date: Fri, 28 Feb 2020 11:25:36 -0800 Subject: [PATCH 22/31] [Endpoint] Task/add nav bar (#58604) * Add tabs to the Endpoint app. Uses EuiTabs and browser history for integration with react-router Co-authored-by: Paul Tavares <56442535+paul-tavares@users.noreply.github.com> Co-authored-by: Elastic Machine --- .../endpoint/components/header_nav.tsx | 76 +++++++++++++++++++ .../public/applications/endpoint/index.tsx | 2 + .../functional/apps/endpoint/header_nav.ts | 55 ++++++++++++++ x-pack/test/functional/apps/endpoint/index.ts | 1 + 4 files changed, 134 insertions(+) create mode 100644 x-pack/plugins/endpoint/public/applications/endpoint/components/header_nav.tsx create mode 100644 x-pack/test/functional/apps/endpoint/header_nav.ts diff --git a/x-pack/plugins/endpoint/public/applications/endpoint/components/header_nav.tsx b/x-pack/plugins/endpoint/public/applications/endpoint/components/header_nav.tsx new file mode 100644 index 0000000000000..84570fe82ed44 --- /dev/null +++ b/x-pack/plugins/endpoint/public/applications/endpoint/components/header_nav.tsx @@ -0,0 +1,76 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import React, { MouseEvent } from 'react'; +import { i18n } from '@kbn/i18n'; +import { EuiTabs, EuiTab } from '@elastic/eui'; +import { useHistory, useLocation } from 'react-router-dom'; + +export interface NavTabs { + name: string; + id: string; + href: string; +} + +export const navTabs: NavTabs[] = [ + { + id: 'home', + name: i18n.translate('xpack.endpoint.headerNav.home', { + defaultMessage: 'Home', + }), + href: '/', + }, + { + id: 'management', + name: i18n.translate('xpack.endpoint.headerNav.management', { + defaultMessage: 'Management', + }), + href: '/management', + }, + { + id: 'alerts', + name: i18n.translate('xpack.endpoint.headerNav.alerts', { + defaultMessage: 'Alerts', + }), + href: '/alerts', + }, + { + id: 'policies', + name: i18n.translate('xpack.endpoint.headerNav.policies', { + defaultMessage: 'Policies', + }), + href: '/policy', + }, +]; + +export const HeaderNavigation: React.FunctionComponent<{ basename: string }> = React.memo( + ({ basename }) => { + const history = useHistory(); + const location = useLocation(); + + function renderNavTabs(tabs: NavTabs[]) { + return tabs.map((tab, index) => { + return ( + { + event.preventDefault(); + history.push(tab.href); + }} + isSelected={tab.href === location.pathname} + > + {tab.name} + + ); + }); + } + + return {renderNavTabs(navTabs)}; + } +); diff --git a/x-pack/plugins/endpoint/public/applications/endpoint/index.tsx b/x-pack/plugins/endpoint/public/applications/endpoint/index.tsx index c6c032c273543..7ab66817a0888 100644 --- a/x-pack/plugins/endpoint/public/applications/endpoint/index.tsx +++ b/x-pack/plugins/endpoint/public/applications/endpoint/index.tsx @@ -16,6 +16,7 @@ import { appStoreFactory } from './store'; import { AlertIndex } from './view/alerts'; import { ManagementList } from './view/managing'; import { PolicyList } from './view/policy'; +import { HeaderNavigation } from './components/header_nav'; /** * This module will be loaded asynchronously to reduce the bundle size of your plugin's main bundle. @@ -41,6 +42,7 @@ const AppRoot: React.FunctionComponent = React.memo(({ basename, st + { + const pageObjects = getPageObjects(['common', 'endpoint']); + const testSubjects = getService('testSubjects'); + + describe('Header nav', function() { + this.tags('ciGroup7'); + before(async () => { + await pageObjects.common.navigateToApp('endpoint'); + }); + + it('renders the tabs when the app loads', async () => { + const homeTabText = await testSubjects.getVisibleText('homeEndpointTab'); + const managementTabText = await testSubjects.getVisibleText('managementEndpointTab'); + const alertsTabText = await testSubjects.getVisibleText('alertsEndpointTab'); + const policiesTabText = await testSubjects.getVisibleText('policiesEndpointTab'); + + expect(homeTabText.trim()).to.be('Home'); + expect(managementTabText.trim()).to.be('Management'); + expect(alertsTabText.trim()).to.be('Alerts'); + expect(policiesTabText.trim()).to.be('Policies'); + }); + + it('renders the management page when the Management tab is selected', async () => { + await (await testSubjects.find('managementEndpointTab')).click(); + await testSubjects.existOrFail('managementViewTitle'); + }); + + it('renders the alerts page when the Alerts tab is selected', async () => { + await (await testSubjects.find('alertsEndpointTab')).click(); + await testSubjects.existOrFail('alertListPage'); + }); + + it('renders the policy page when Policy tab is selected', async () => { + await (await testSubjects.find('policiesEndpointTab')).click(); + await testSubjects.existOrFail('policyViewTitle'); + }); + + it('renders the home page when Home tab is selected after selecting another tab', async () => { + await (await testSubjects.find('managementEndpointTab')).click(); + await testSubjects.existOrFail('managementViewTitle'); + + await (await testSubjects.find('homeEndpointTab')).click(); + await testSubjects.existOrFail('welcomeTitle'); + }); + }); +}; diff --git a/x-pack/test/functional/apps/endpoint/index.ts b/x-pack/test/functional/apps/endpoint/index.ts index 818c040f824d9..0c9179c23ea6c 100644 --- a/x-pack/test/functional/apps/endpoint/index.ts +++ b/x-pack/test/functional/apps/endpoint/index.ts @@ -11,6 +11,7 @@ export default function({ loadTestFile }: FtrProviderContext) { loadTestFile(require.resolve('./feature_controls')); loadTestFile(require.resolve('./landing_page')); + loadTestFile(require.resolve('./header_nav')); loadTestFile(require.resolve('./management')); loadTestFile(require.resolve('./policy_list')); loadTestFile(require.resolve('./alert_list')); From 9bdd23a460b31443fa8cf4c656600c659aa268e5 Mon Sep 17 00:00:00 2001 From: Josh Dover Date: Fri, 28 Feb 2020 13:31:59 -0700 Subject: [PATCH 23/31] Do not write UUID file during optimize process (#58899) --- src/core/server/uuid/resolve_uuid.test.ts | 230 +++++++++++++----- src/core/server/uuid/resolve_uuid.ts | 41 +++- src/core/server/uuid/uuid_service.test.ts | 36 ++- src/core/server/uuid/uuid_service.ts | 10 +- src/dev/build/build_distributables.js | 2 + src/dev/build/tasks/index.js | 1 + src/dev/build/tasks/uuid_verification_task.js | 38 +++ 7 files changed, 278 insertions(+), 80 deletions(-) create mode 100644 src/dev/build/tasks/uuid_verification_task.js diff --git a/src/core/server/uuid/resolve_uuid.test.ts b/src/core/server/uuid/resolve_uuid.test.ts index d1332daa02057..efc90c07c1fa6 100644 --- a/src/core/server/uuid/resolve_uuid.test.ts +++ b/src/core/server/uuid/resolve_uuid.test.ts @@ -19,7 +19,7 @@ import { join } from 'path'; import { readFile, writeFile } from './fs'; -import { resolveInstanceUuid } from './resolve_uuid'; +import { resolveInstanceUuid, UUID_7_6_0_BUG } from './resolve_uuid'; import { configServiceMock } from '../config/config_service.mock'; import { loggingServiceMock } from '../logging/logging_service.mock'; import { BehaviorSubject } from 'rxjs'; @@ -97,58 +97,96 @@ describe('resolveInstanceUuid', () => { }); describe('when file is present and config property is set', () => { - it('writes to file and returns the config uuid if they mismatch', async () => { - const uuid = await resolveInstanceUuid(configService, logger); - expect(uuid).toEqual(DEFAULT_CONFIG_UUID); - expect(writeFile).toHaveBeenCalledWith( - join('data-folder', 'uuid'), - DEFAULT_CONFIG_UUID, - expect.any(Object) - ); - expect(logger.debug).toHaveBeenCalledTimes(1); - expect(logger.debug.mock.calls[0]).toMatchInlineSnapshot(` - Array [ - "Updating Kibana instance UUID to: CONFIG_UUID (was: FILE_UUID)", - ] - `); + describe('when they mismatch', () => { + describe('when syncToFile is true', () => { + it('writes to file and returns the config uuid', async () => { + const uuid = await resolveInstanceUuid({ configService, logger, syncToFile: true }); + expect(uuid).toEqual(DEFAULT_CONFIG_UUID); + expect(writeFile).toHaveBeenCalledWith( + join('data-folder', 'uuid'), + DEFAULT_CONFIG_UUID, + expect.any(Object) + ); + expect(logger.debug).toHaveBeenCalledTimes(1); + expect(logger.debug.mock.calls[0]).toMatchInlineSnapshot(` + Array [ + "Updating Kibana instance UUID to: CONFIG_UUID (was: FILE_UUID)", + ] + `); + }); + }); + + describe('when syncTofile is false', () => { + it('does not write to file and returns the config uuid', async () => { + const uuid = await resolveInstanceUuid({ configService, logger, syncToFile: false }); + expect(uuid).toEqual(DEFAULT_CONFIG_UUID); + expect(writeFile).not.toHaveBeenCalled(); + expect(logger.debug).toHaveBeenCalledTimes(1); + expect(logger.debug.mock.calls[0]).toMatchInlineSnapshot(` + Array [ + "Updating Kibana instance UUID to: CONFIG_UUID (was: FILE_UUID)", + ] + `); + }); + }); }); - it('does not write to file if they match', async () => { - mockReadFile({ uuid: DEFAULT_CONFIG_UUID }); - const uuid = await resolveInstanceUuid(configService, logger); - expect(uuid).toEqual(DEFAULT_CONFIG_UUID); - expect(writeFile).not.toHaveBeenCalled(); - expect(logger.debug).toHaveBeenCalledTimes(1); - expect(logger.debug.mock.calls[0]).toMatchInlineSnapshot(` - Array [ - "Kibana instance UUID: CONFIG_UUID", - ] - `); + + describe('when they match', () => { + it('does not write to file', async () => { + mockReadFile({ uuid: DEFAULT_CONFIG_UUID }); + const uuid = await resolveInstanceUuid({ configService, logger, syncToFile: true }); + expect(uuid).toEqual(DEFAULT_CONFIG_UUID); + expect(writeFile).not.toHaveBeenCalled(); + expect(logger.debug).toHaveBeenCalledTimes(1); + expect(logger.debug.mock.calls[0]).toMatchInlineSnapshot(` + Array [ + "Kibana instance UUID: CONFIG_UUID", + ] + `); + }); }); }); describe('when file is not present and config property is set', () => { - it('writes the uuid to file and returns the config uuid', async () => { - mockReadFile({ error: fileNotFoundError }); - const uuid = await resolveInstanceUuid(configService, logger); - expect(uuid).toEqual(DEFAULT_CONFIG_UUID); - expect(writeFile).toHaveBeenCalledWith( - join('data-folder', 'uuid'), - DEFAULT_CONFIG_UUID, - expect.any(Object) - ); - expect(logger.debug).toHaveBeenCalledTimes(1); - expect(logger.debug.mock.calls[0]).toMatchInlineSnapshot(` - Array [ - "Setting new Kibana instance UUID: CONFIG_UUID", - ] - `); + describe('when syncToFile is true', () => { + it('writes the uuid to file and returns the config uuid', async () => { + mockReadFile({ error: fileNotFoundError }); + const uuid = await resolveInstanceUuid({ configService, logger, syncToFile: true }); + expect(uuid).toEqual(DEFAULT_CONFIG_UUID); + expect(writeFile).toHaveBeenCalledWith( + join('data-folder', 'uuid'), + DEFAULT_CONFIG_UUID, + expect.any(Object) + ); + expect(logger.debug).toHaveBeenCalledTimes(1); + expect(logger.debug.mock.calls[0]).toMatchInlineSnapshot(` + Array [ + "Setting new Kibana instance UUID: CONFIG_UUID", + ] + `); + }); + }); + + describe('when syncToFile is false', () => { + it('does not write the uuid to file and returns the config uuid', async () => { + mockReadFile({ error: fileNotFoundError }); + const uuid = await resolveInstanceUuid({ configService, logger, syncToFile: false }); + expect(uuid).toEqual(DEFAULT_CONFIG_UUID); + expect(writeFile).not.toHaveBeenCalled(); + expect(logger.debug).toHaveBeenCalledTimes(1); + expect(logger.debug.mock.calls[0]).toMatchInlineSnapshot(` + Array [ + "Setting new Kibana instance UUID: CONFIG_UUID", + ] + `); + }); }); }); describe('when file is present and config property is not set', () => { it('does not write to file and returns the file uuid', async () => { configService = getConfigService(undefined); - const uuid = await resolveInstanceUuid(configService, logger); + const uuid = await resolveInstanceUuid({ configService, logger, syncToFile: true }); expect(uuid).toEqual(DEFAULT_FILE_UUID); expect(writeFile).not.toHaveBeenCalled(); expect(logger.debug).toHaveBeenCalledTimes(1); @@ -160,23 +198,95 @@ describe('resolveInstanceUuid', () => { }); }); + describe('when file is present with 7.6.0 UUID', () => { + describe('when config property is not set', () => { + it('writes new uuid to file and returns new uuid', async () => { + mockReadFile({ uuid: UUID_7_6_0_BUG }); + configService = getConfigService(undefined); + const uuid = await resolveInstanceUuid({ configService, logger, syncToFile: true }); + expect(uuid).not.toEqual(UUID_7_6_0_BUG); + expect(uuid).toEqual('NEW_UUID'); + expect(writeFile).toHaveBeenCalledWith( + join('data-folder', 'uuid'), + 'NEW_UUID', + expect.any(Object) + ); + expect(logger.debug).toHaveBeenCalledTimes(2); + expect(logger.debug.mock.calls).toMatchInlineSnapshot(` + Array [ + Array [ + "UUID from 7.6.0 bug detected, ignoring file UUID", + ], + Array [ + "Setting new Kibana instance UUID: NEW_UUID", + ], + ] + `); + }); + }); + + describe('when config property is set', () => { + it('writes config uuid to file and returns config uuid', async () => { + mockReadFile({ uuid: UUID_7_6_0_BUG }); + configService = getConfigService(DEFAULT_CONFIG_UUID); + const uuid = await resolveInstanceUuid({ configService, logger, syncToFile: true }); + expect(uuid).not.toEqual(UUID_7_6_0_BUG); + expect(uuid).toEqual(DEFAULT_CONFIG_UUID); + expect(writeFile).toHaveBeenCalledWith( + join('data-folder', 'uuid'), + DEFAULT_CONFIG_UUID, + expect.any(Object) + ); + expect(logger.debug).toHaveBeenCalledTimes(2); + expect(logger.debug.mock.calls).toMatchInlineSnapshot(` + Array [ + Array [ + "UUID from 7.6.0 bug detected, ignoring file UUID", + ], + Array [ + "Setting new Kibana instance UUID: CONFIG_UUID", + ], + ] + `); + }); + }); + }); + describe('when file is not present and config property is not set', () => { - it('generates a new uuid and write it to file', async () => { - configService = getConfigService(undefined); - mockReadFile({ error: fileNotFoundError }); - const uuid = await resolveInstanceUuid(configService, logger); - expect(uuid).toEqual('NEW_UUID'); - expect(writeFile).toHaveBeenCalledWith( - join('data-folder', 'uuid'), - 'NEW_UUID', - expect.any(Object) - ); - expect(logger.debug).toHaveBeenCalledTimes(1); - expect(logger.debug.mock.calls[0]).toMatchInlineSnapshot(` - Array [ - "Setting new Kibana instance UUID: NEW_UUID", - ] - `); + describe('when syncToFile is true', () => { + it('generates a new uuid and write it to file', async () => { + configService = getConfigService(undefined); + mockReadFile({ error: fileNotFoundError }); + const uuid = await resolveInstanceUuid({ configService, logger, syncToFile: true }); + expect(uuid).toEqual('NEW_UUID'); + expect(writeFile).toHaveBeenCalledWith( + join('data-folder', 'uuid'), + 'NEW_UUID', + expect.any(Object) + ); + expect(logger.debug).toHaveBeenCalledTimes(1); + expect(logger.debug.mock.calls[0]).toMatchInlineSnapshot(` + Array [ + "Setting new Kibana instance UUID: NEW_UUID", + ] + `); + }); + }); + + describe('when syncToFile is false', () => { + it('generates a new uuid and does not write it to file', async () => { + configService = getConfigService(undefined); + mockReadFile({ error: fileNotFoundError }); + const uuid = await resolveInstanceUuid({ configService, logger, syncToFile: false }); + expect(uuid).toEqual('NEW_UUID'); + expect(writeFile).not.toHaveBeenCalled(); + expect(logger.debug).toHaveBeenCalledTimes(1); + expect(logger.debug.mock.calls[0]).toMatchInlineSnapshot(` + Array [ + "Setting new Kibana instance UUID: NEW_UUID", + ] + `); + }); }); }); @@ -184,7 +294,7 @@ describe('resolveInstanceUuid', () => { it('throws an explicit error for file read errors', async () => { mockReadFile({ error: permissionError }); await expect( - resolveInstanceUuid(configService, logger) + resolveInstanceUuid({ configService, logger, syncToFile: true }) ).rejects.toThrowErrorMatchingInlineSnapshot( `"Unable to read Kibana UUID file, please check the uuid.server configuration value in kibana.yml and ensure Kibana has sufficient permissions to read / write to this file. Error was: EACCES"` ); @@ -192,7 +302,7 @@ describe('resolveInstanceUuid', () => { it('throws an explicit error for file write errors', async () => { mockWriteFile(isDirectoryError); await expect( - resolveInstanceUuid(configService, logger) + resolveInstanceUuid({ configService, logger, syncToFile: true }) ).rejects.toThrowErrorMatchingInlineSnapshot( `"Unable to write Kibana UUID file, please check the uuid.server configuration value in kibana.yml and ensure Kibana has sufficient permissions to read / write to this file. Error was: EISDIR"` ); diff --git a/src/core/server/uuid/resolve_uuid.ts b/src/core/server/uuid/resolve_uuid.ts index 3f5bdc7387392..516357e10d3f7 100644 --- a/src/core/server/uuid/resolve_uuid.ts +++ b/src/core/server/uuid/resolve_uuid.ts @@ -28,11 +28,21 @@ import { Logger } from '../logging'; const FILE_ENCODING = 'utf8'; const FILE_NAME = 'uuid'; +/** + * This UUID was inadvertantly shipped in the 7.6.0 distributable and should be deleted if found. + * See https://github.com/elastic/kibana/issues/57673 for more info. + */ +export const UUID_7_6_0_BUG = `ce42b997-a913-4d58-be46-bb1937feedd6`; -export async function resolveInstanceUuid( - configService: IConfigService, - logger: Logger -): Promise { +export async function resolveInstanceUuid({ + configService, + syncToFile, + logger, +}: { + configService: IConfigService; + syncToFile: boolean; + logger: Logger; +}): Promise { const [pathConfig, serverConfig] = await Promise.all([ configService .atPath(pathConfigDef.path) @@ -46,7 +56,7 @@ export async function resolveInstanceUuid( const uuidFilePath = join(pathConfig.data, FILE_NAME); - const uuidFromFile = await readUuidFromFile(uuidFilePath); + const uuidFromFile = await readUuidFromFile(uuidFilePath, logger); const uuidFromConfig = serverConfig.uuid; if (uuidFromConfig) { @@ -61,7 +71,7 @@ export async function resolveInstanceUuid( } else { logger.debug(`Updating Kibana instance UUID to: ${uuidFromConfig} (was: ${uuidFromFile})`); } - await writeUuidToFile(uuidFilePath, uuidFromConfig); + await writeUuidToFile(uuidFilePath, uuidFromConfig, syncToFile); return uuidFromConfig; } } @@ -69,7 +79,7 @@ export async function resolveInstanceUuid( const newUuid = uuid.v4(); // no uuid either in config or file, we need to generate and write it. logger.debug(`Setting new Kibana instance UUID: ${newUuid}`); - await writeUuidToFile(uuidFilePath, newUuid); + await writeUuidToFile(uuidFilePath, newUuid, syncToFile); return newUuid; } @@ -77,10 +87,17 @@ export async function resolveInstanceUuid( return uuidFromFile; } -async function readUuidFromFile(filepath: string): Promise { +async function readUuidFromFile(filepath: string, logger: Logger): Promise { try { const content = await readFile(filepath); - return content.toString(FILE_ENCODING); + const decoded = content.toString(FILE_ENCODING); + + if (decoded === UUID_7_6_0_BUG) { + logger.debug(`UUID from 7.6.0 bug detected, ignoring file UUID`); + return undefined; + } else { + return decoded; + } } catch (e) { if (e.code === 'ENOENT') { // non-existent uuid file is ok, we will create it. @@ -94,7 +111,11 @@ async function readUuidFromFile(filepath: string): Promise { } } -async function writeUuidToFile(filepath: string, uuidValue: string) { +async function writeUuidToFile(filepath: string, uuidValue: string, syncToFile: boolean) { + if (!syncToFile) { + return; + } + try { return await writeFile(filepath, uuidValue, { encoding: FILE_ENCODING }); } catch (e) { diff --git a/src/core/server/uuid/uuid_service.test.ts b/src/core/server/uuid/uuid_service.test.ts index 315df7af8aa19..a61061ff84263 100644 --- a/src/core/server/uuid/uuid_service.test.ts +++ b/src/core/server/uuid/uuid_service.test.ts @@ -23,6 +23,8 @@ import { CoreContext } from '../core_context'; import { loggingServiceMock } from '../logging/logging_service.mock'; import { mockCoreContext } from '../core_context.mock'; +import { Env } from '../config'; +import { getEnvOptions } from '../config/__mocks__/env'; jest.mock('./resolve_uuid', () => ({ resolveInstanceUuid: jest.fn().mockResolvedValue('SOME_UUID'), @@ -31,26 +33,44 @@ jest.mock('./resolve_uuid', () => ({ describe('UuidService', () => { let logger: ReturnType; let coreContext: CoreContext; - let service: UuidService; beforeEach(() => { jest.clearAllMocks(); logger = loggingServiceMock.create(); coreContext = mockCoreContext.create({ logger }); - service = new UuidService(coreContext); }); describe('#setup()', () => { - it('calls manageInstanceUuid with core configuration service', async () => { + it('calls resolveInstanceUuid with core configuration service', async () => { + const service = new UuidService(coreContext); await service.setup(); expect(resolveInstanceUuid).toHaveBeenCalledTimes(1); - expect(resolveInstanceUuid).toHaveBeenCalledWith( - coreContext.configService, - logger.get('uuid') - ); + expect(resolveInstanceUuid).toHaveBeenCalledWith({ + configService: coreContext.configService, + syncToFile: true, + logger: logger.get('uuid'), + }); }); - it('returns the uuid resolved from manageInstanceUuid', async () => { + describe('when cliArgs.optimize is true', () => { + it('calls resolveInstanceUuid with syncToFile: false', async () => { + coreContext = mockCoreContext.create({ + logger, + env: Env.createDefault(getEnvOptions({ cliArgs: { optimize: true } })), + }); + const service = new UuidService(coreContext); + await service.setup(); + expect(resolveInstanceUuid).toHaveBeenCalledTimes(1); + expect(resolveInstanceUuid).toHaveBeenCalledWith({ + configService: coreContext.configService, + syncToFile: false, + logger: logger.get('uuid'), + }); + }); + }); + + it('returns the uuid resolved from resolveInstanceUuid', async () => { + const service = new UuidService(coreContext); const setup = await service.setup(); expect(setup.getInstanceUuid()).toEqual('SOME_UUID'); }); diff --git a/src/core/server/uuid/uuid_service.ts b/src/core/server/uuid/uuid_service.ts index 10104fa704936..62ed4a19edf5a 100644 --- a/src/core/server/uuid/uuid_service.ts +++ b/src/core/server/uuid/uuid_service.ts @@ -20,7 +20,7 @@ import { resolveInstanceUuid } from './resolve_uuid'; import { CoreContext } from '../core_context'; import { Logger } from '../logging'; -import { IConfigService } from '../config'; +import { IConfigService, CliArgs } from '../config'; /** * APIs to access the application's instance uuid. @@ -38,15 +38,21 @@ export interface UuidServiceSetup { export class UuidService { private readonly log: Logger; private readonly configService: IConfigService; + private readonly cliArgs: CliArgs; private uuid: string = ''; constructor(core: CoreContext) { this.log = core.logger.get('uuid'); this.configService = core.configService; + this.cliArgs = core.env.cliArgs; } public async setup() { - this.uuid = await resolveInstanceUuid(this.configService, this.log); + this.uuid = await resolveInstanceUuid({ + configService: this.configService, + syncToFile: !this.cliArgs.optimize, + logger: this.log, + }); return { getInstanceUuid: () => this.uuid, diff --git a/src/dev/build/build_distributables.js b/src/dev/build/build_distributables.js index c4f9d7f56554c..6c2efeebc60c3 100644 --- a/src/dev/build/build_distributables.js +++ b/src/dev/build/build_distributables.js @@ -54,6 +54,7 @@ import { VerifyExistingNodeBuildsTask, PathLengthTask, WriteShaSumsTask, + UuidVerificationTask, } from './tasks'; export async function buildDistributables(options) { @@ -136,6 +137,7 @@ export async function buildDistributables(options) { await run(CleanNodeBuildsTask); await run(PathLengthTask); + await run(UuidVerificationTask); /** * package platform-specific builds into archives diff --git a/src/dev/build/tasks/index.js b/src/dev/build/tasks/index.js index 56e813111279d..8105fa8a7d5d4 100644 --- a/src/dev/build/tasks/index.js +++ b/src/dev/build/tasks/index.js @@ -38,3 +38,4 @@ export * from './verify_env_task'; export * from './write_sha_sums_task'; export * from './path_length_task'; export * from './build_kibana_platform_plugins'; +export * from './uuid_verification_task'; diff --git a/src/dev/build/tasks/uuid_verification_task.js b/src/dev/build/tasks/uuid_verification_task.js new file mode 100644 index 0000000000000..32c9e73dba988 --- /dev/null +++ b/src/dev/build/tasks/uuid_verification_task.js @@ -0,0 +1,38 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { read } from '../lib'; + +export const UuidVerificationTask = { + description: 'Verify that no UUID file is baked into the build', + + async run(config, log, build) { + const uuidFilePath = build.resolvePath('data', 'uuid'); + await read(uuidFilePath).then( + function success() { + throw new Error(`UUID file should not exist at [${uuidFilePath}]`); + }, + function error(err) { + if (err.code !== 'ENOENT') { + throw err; + } + } + ); + }, +}; From 56ba753db0090b7e1109fc14b35eecfaf08719a3 Mon Sep 17 00:00:00 2001 From: Rudolf Meijering Date: Fri, 28 Feb 2020 22:32:58 +0100 Subject: [PATCH 24/31] Don't start pollEsNodesVersion unless someone subscribes (#56923) * Don't start pollEsNodesVersion unless someone subscribes By not polling until subscribed to, we prevent verbose error logs when the optimizer is run (which automatically skips migrations). * Test pollEsNodeVersions behaviour * Cleanup unused code * PR Feedback * Make test more stable Co-authored-by: Elastic Machine --- .../elasticsearch_service.test.ts | 133 +++++++++++++----- .../elasticsearch/elasticsearch_service.ts | 49 +++---- .../saved_objects/saved_objects_service.ts | 8 ++ 3 files changed, 127 insertions(+), 63 deletions(-) diff --git a/src/core/server/elasticsearch/elasticsearch_service.test.ts b/src/core/server/elasticsearch/elasticsearch_service.test.ts index 022a03e01d37d..2667859f303d4 100644 --- a/src/core/server/elasticsearch/elasticsearch_service.test.ts +++ b/src/core/server/elasticsearch/elasticsearch_service.test.ts @@ -33,6 +33,9 @@ import { ElasticsearchService } from './elasticsearch_service'; import { elasticsearchServiceMock } from './elasticsearch_service.mock'; import { duration } from 'moment'; +const delay = async (durationMs: number) => + await new Promise(resolve => setTimeout(resolve, durationMs)); + let elasticsearchService: ElasticsearchService; const configService = configServiceMock.create(); const deps = { @@ -42,7 +45,7 @@ configService.atPath.mockReturnValue( new BehaviorSubject({ hosts: ['http://1.2.3.4'], healthCheck: { - delay: duration(2000), + delay: duration(10), }, ssl: { verificationMode: 'none', @@ -125,21 +128,21 @@ describe('#setup', () => { const config = MockClusterClient.mock.calls[0][0]; expect(config).toMatchInlineSnapshot(` -Object { - "healthCheckDelay": "PT2S", - "hosts": Array [ - "http://8.8.8.8", - ], - "logQueries": true, - "requestHeadersWhitelist": Array [ - undefined, - ], - "ssl": Object { - "certificate": "certificate-value", - "verificationMode": "none", - }, -} -`); + Object { + "healthCheckDelay": "PT0.01S", + "hosts": Array [ + "http://8.8.8.8", + ], + "logQueries": true, + "requestHeadersWhitelist": Array [ + undefined, + ], + "ssl": Object { + "certificate": "certificate-value", + "verificationMode": "none", + }, + } + `); }); it('falls back to elasticsearch config if custom config not passed', async () => { const setupContract = await elasticsearchService.setup(deps); @@ -150,24 +153,24 @@ Object { const config = MockClusterClient.mock.calls[0][0]; expect(config).toMatchInlineSnapshot(` -Object { - "healthCheckDelay": "PT2S", - "hosts": Array [ - "http://1.2.3.4", - ], - "requestHeadersWhitelist": Array [ - undefined, - ], - "ssl": Object { - "alwaysPresentCertificate": undefined, - "certificate": undefined, - "certificateAuthorities": undefined, - "key": undefined, - "keyPassphrase": undefined, - "verificationMode": "none", - }, -} -`); + Object { + "healthCheckDelay": "PT0.01S", + "hosts": Array [ + "http://1.2.3.4", + ], + "requestHeadersWhitelist": Array [ + undefined, + ], + "ssl": Object { + "alwaysPresentCertificate": undefined, + "certificate": undefined, + "certificateAuthorities": undefined, + "key": undefined, + "keyPassphrase": undefined, + "verificationMode": "none", + }, + } + `); }); it('does not merge elasticsearch hosts if custom config overrides', async () => { @@ -213,6 +216,45 @@ Object { `); }); }); + + it('esNodeVersionCompatibility$ only starts polling when subscribed to', async done => { + const mockAdminClusterClientInstance = elasticsearchServiceMock.createClusterClient(); + const mockDataClusterClientInstance = elasticsearchServiceMock.createClusterClient(); + MockClusterClient.mockImplementationOnce( + () => mockAdminClusterClientInstance + ).mockImplementationOnce(() => mockDataClusterClientInstance); + + mockAdminClusterClientInstance.callAsInternalUser.mockRejectedValue(new Error()); + + const setupContract = await elasticsearchService.setup(deps); + await delay(10); + + expect(mockAdminClusterClientInstance.callAsInternalUser).toHaveBeenCalledTimes(0); + setupContract.esNodesCompatibility$.subscribe(() => { + expect(mockAdminClusterClientInstance.callAsInternalUser).toHaveBeenCalledTimes(1); + done(); + }); + }); + + it('esNodeVersionCompatibility$ stops polling when unsubscribed from', async done => { + const mockAdminClusterClientInstance = elasticsearchServiceMock.createClusterClient(); + const mockDataClusterClientInstance = elasticsearchServiceMock.createClusterClient(); + MockClusterClient.mockImplementationOnce( + () => mockAdminClusterClientInstance + ).mockImplementationOnce(() => mockDataClusterClientInstance); + + mockAdminClusterClientInstance.callAsInternalUser.mockRejectedValue(new Error()); + + const setupContract = await elasticsearchService.setup(deps); + + expect(mockAdminClusterClientInstance.callAsInternalUser).toHaveBeenCalledTimes(0); + const sub = setupContract.esNodesCompatibility$.subscribe(async () => { + sub.unsubscribe(); + await delay(100); + expect(mockAdminClusterClientInstance.callAsInternalUser).toHaveBeenCalledTimes(1); + done(); + }); + }); }); describe('#stop', () => { @@ -229,4 +271,27 @@ describe('#stop', () => { expect(mockAdminClusterClientInstance.close).toHaveBeenCalledTimes(1); expect(mockDataClusterClientInstance.close).toHaveBeenCalledTimes(1); }); + + it('stops pollEsNodeVersions even if there are active subscriptions', async done => { + expect.assertions(2); + const mockAdminClusterClientInstance = elasticsearchServiceMock.createCustomClusterClient(); + const mockDataClusterClientInstance = elasticsearchServiceMock.createCustomClusterClient(); + + MockClusterClient.mockImplementationOnce( + () => mockAdminClusterClientInstance + ).mockImplementationOnce(() => mockDataClusterClientInstance); + + mockAdminClusterClientInstance.callAsInternalUser.mockRejectedValue(new Error()); + + const setupContract = await elasticsearchService.setup(deps); + + setupContract.esNodesCompatibility$.subscribe(async () => { + expect(mockAdminClusterClientInstance.callAsInternalUser).toHaveBeenCalledTimes(1); + + await elasticsearchService.stop(); + await delay(100); + expect(mockAdminClusterClientInstance.callAsInternalUser).toHaveBeenCalledTimes(1); + done(); + }); + }); }); diff --git a/src/core/server/elasticsearch/elasticsearch_service.ts b/src/core/server/elasticsearch/elasticsearch_service.ts index 9eaf125cc006f..6616b42f136c0 100644 --- a/src/core/server/elasticsearch/elasticsearch_service.ts +++ b/src/core/server/elasticsearch/elasticsearch_service.ts @@ -17,8 +17,17 @@ * under the License. */ -import { ConnectableObservable, Observable, Subscription } from 'rxjs'; -import { filter, first, map, publishReplay, switchMap, take } from 'rxjs/operators'; +import { ConnectableObservable, Observable, Subscription, Subject } from 'rxjs'; +import { + filter, + first, + map, + publishReplay, + switchMap, + take, + shareReplay, + takeUntil, +} from 'rxjs/operators'; import { CoreService } from '../../types'; import { merge } from '../../utils'; @@ -47,13 +56,8 @@ interface SetupDeps { export class ElasticsearchService implements CoreService { private readonly log: Logger; private readonly config$: Observable; - private subscriptions: { - client?: Subscription; - esNodesCompatibility?: Subscription; - } = { - client: undefined, - esNodesCompatibility: undefined, - }; + private subscription: Subscription | undefined; + private stop$ = new Subject(); private kibanaVersion: string; constructor(private readonly coreContext: CoreContext) { @@ -69,7 +73,7 @@ export class ElasticsearchService implements CoreService { - if (this.subscriptions.client !== undefined) { + if (this.subscription !== undefined) { this.log.error('Clients cannot be changed after they are created'); return false; } @@ -100,7 +104,7 @@ export class ElasticsearchService implements CoreService; - this.subscriptions.client = clients$.connect(); + this.subscription = clients$.connect(); const config = await this.config$.pipe(first()).toPromise(); @@ -164,18 +168,7 @@ export class ElasticsearchService implements CoreService).connect(); - - // TODO: Move to Status Service https://github.com/elastic/kibana/issues/41983 - esNodesCompatibility$.subscribe(({ isCompatible, message }) => { - if (!isCompatible && message) { - this.log.error(message); - } - }); + }).pipe(takeUntil(this.stop$), shareReplay({ refCount: true, bufferSize: 1 })); return { legacy: { config$: clients$.pipe(map(clients => clients.config)) }, @@ -195,12 +188,10 @@ export class ElasticsearchService implements CoreService { + if (!isCompatible && message) { + this.logger.error(message); + } + }); + await this.setupDeps!.elasticsearch.esNodesCompatibility$.pipe( filter(nodes => nodes.isCompatible), take(1) From d55ddd23a149567f98880207d1c8c57ed8a90fae Mon Sep 17 00:00:00 2001 From: spalger Date: Fri, 28 Feb 2020 14:58:32 -0700 Subject: [PATCH 25/31] disable failing suite (#58942) --- .../lib/request_interceptors/on_request_interceptor.test.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/spaces/server/lib/request_interceptors/on_request_interceptor.test.ts b/x-pack/plugins/spaces/server/lib/request_interceptors/on_request_interceptor.test.ts index 448bc39eb606e..1b673d3418983 100644 --- a/x-pack/plugins/spaces/server/lib/request_interceptors/on_request_interceptor.test.ts +++ b/x-pack/plugins/spaces/server/lib/request_interceptors/on_request_interceptor.test.ts @@ -18,7 +18,8 @@ import { import * as kbnTestServer from '../../../../../../src/test_utils/kbn_server'; import { elasticsearchServiceMock } from 'src/core/server/mocks'; -describe('onRequestInterceptor', () => { +// FAILING: https://github.com/elastic/kibana/issues/58942 +describe.skip('onRequestInterceptor', () => { let root: ReturnType; beforeEach(async () => { From 100c570219becb3727e31746d957820170881656 Mon Sep 17 00:00:00 2001 From: Patrick Mueller Date: Fri, 28 Feb 2020 17:23:56 -0500 Subject: [PATCH 26/31] change to have kibana --ssl cli option use more recent certs (#57933) * change to have --ssl cli option use more recent certs * also configure 'server.ssl.certificateAuthorities' per PR review * delete theoretically now-unused ssl creds --- src/cli/dev_ssl.js | 22 ---------------------- src/cli/serve/serve.js | 12 +++++------- test/dev_certs/server.crt | 20 -------------------- test/dev_certs/server.key | 27 --------------------------- 4 files changed, 5 insertions(+), 76 deletions(-) delete mode 100644 src/cli/dev_ssl.js delete mode 100644 test/dev_certs/server.crt delete mode 100644 test/dev_certs/server.key diff --git a/src/cli/dev_ssl.js b/src/cli/dev_ssl.js deleted file mode 100644 index 110f44ee57b7d..0000000000000 --- a/src/cli/dev_ssl.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { resolve } from 'path'; -export const DEV_SSL_CERT_PATH = resolve(__dirname, '../../test/dev_certs/server.crt'); -export const DEV_SSL_KEY_PATH = resolve(__dirname, '../../test/dev_certs/server.key'); diff --git a/src/cli/serve/serve.js b/src/cli/serve/serve.js index be3fc319389d7..29d0fe16ee126 100644 --- a/src/cli/serve/serve.js +++ b/src/cli/serve/serve.js @@ -28,8 +28,6 @@ import { getConfigPath } from '../../core/server/path'; import { bootstrap } from '../../core/server'; import { readKeystore } from './read_keystore'; -import { DEV_SSL_CERT_PATH, DEV_SSL_KEY_PATH } from '../dev_ssl'; - function canRequire(path) { try { require.resolve(path); @@ -90,7 +88,7 @@ function applyConfigOverrides(rawConfig, opts, extraCliOptions) { if (opts.ssl) { // @kbn/dev-utils is part of devDependencies - const { CA_CERT_PATH } = require('@kbn/dev-utils'); + const { CA_CERT_PATH, KBN_KEY_PATH, KBN_CERT_PATH } = require('@kbn/dev-utils'); const customElasticsearchHosts = opts.elasticsearch ? opts.elasticsearch.split(',') : [].concat(get('elasticsearch.hosts') || []); @@ -104,6 +102,7 @@ function applyConfigOverrides(rawConfig, opts, extraCliOptions) { ensureNotDefined('server.ssl.key'); ensureNotDefined('server.ssl.keystore.path'); ensureNotDefined('server.ssl.truststore.path'); + ensureNotDefined('server.ssl.certificateAuthorities'); ensureNotDefined('elasticsearch.ssl.certificateAuthorities'); const elasticsearchHosts = ( @@ -121,10 +120,9 @@ function applyConfigOverrides(rawConfig, opts, extraCliOptions) { }); set('server.ssl.enabled', true); - // TODO: change this cert/key to KBN_CERT_PATH and KBN_KEY_PATH from '@kbn/dev-utils'; will require some work to avoid breaking - // functional tests. Once that is done, the existing test cert/key at DEV_SSL_CERT_PATH and DEV_SSL_KEY_PATH can be deleted. - set('server.ssl.certificate', DEV_SSL_CERT_PATH); - set('server.ssl.key', DEV_SSL_KEY_PATH); + set('server.ssl.certificate', KBN_CERT_PATH); + set('server.ssl.key', KBN_KEY_PATH); + set('server.ssl.certificateAuthorities', CA_CERT_PATH); set('elasticsearch.hosts', elasticsearchHosts); set('elasticsearch.ssl.certificateAuthorities', CA_CERT_PATH); } diff --git a/test/dev_certs/server.crt b/test/dev_certs/server.crt deleted file mode 100644 index c7a39de4b517a..0000000000000 --- a/test/dev_certs/server.crt +++ /dev/null @@ -1,20 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDMDCCAhgCCQCkOD7fnHiQrTANBgkqhkiG9w0BAQUFADBZMQswCQYDVQQGEwJB -VTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0 -cyBQdHkgTHRkMRIwEAYDVQQDEwlsb2NhbGhvc3QwIBcNMTYwMTE5MjExNjQ5WhgP -MjA4NDAyMDYyMTE2NDlaMFkxCzAJBgNVBAYTAkFVMRMwEQYDVQQIEwpTb21lLVN0 -YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQxEjAQBgNVBAMT -CWxvY2FsaG9zdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALR63SnR -LW/Dgl0Vuy8gB6KjWwvajRWeXNgvlf6LX56oNsUFREHBLQlC2uT5R26F3tOqCDbs -MFNoyDjMBinXRRFJJ2Sokue7GSsGvBv41LMTHnO/MeCCbEOqghJS/QI89cV+u+Aw -9U+v426KAlCa1sGuE2+3/JvqdBQyheiukmGLiJ0OofpfgpYuFmKi2uYBKU3qzjUx -D01wQ4rCpq5nEnksGhgBeBDnheYmmDsj/wDvnz1exK/WprvTiHQ5MwuIQ4OybwgV -WDF+zv8PXrObrsZvD/ulrjh1cakvnCe2kDYEKMRiHUDesHS2jNJkBUe+FJo4/E3U -pFoYOtdoBe69BIUCAwEAATANBgkqhkiG9w0BAQUFAAOCAQEAQhjF91G0R662XJJ7 -jGMudA9VbRVCow8s68I/GWPZmpKxPAxwz0xiv1eFIoiP416LX9amnx3yAmUoN4Wr -Cq0jsgyT1AOiSCdxkvYsqQG3SFVVt5BDLjThH66Vxi7Bach6SyATa1NG588mg7n9 -pPJ4A1rcj+5kZuwnd52kfVLP+535lylwMyoyJa2AskieRPLNSzus2eUDTR6F+9Mb -eLOwp5rMl2nNYfLXUCSqEeC6uPu0yq6Tu0N0SjThfKndd2NU1fk3zyOjxyCIhGPe -G8VhrPY4lkJ9EE9Tuq095jwd1+q9fYzlKZWhOmg+IcOwUMgbgeWpeZTAhUIZAnia -4UH6NA== ------END CERTIFICATE----- diff --git a/test/dev_certs/server.key b/test/dev_certs/server.key deleted file mode 100644 index 5a6dfea9dc7e4..0000000000000 --- a/test/dev_certs/server.key +++ /dev/null @@ -1,27 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIEowIBAAKCAQEAtHrdKdEtb8OCXRW7LyAHoqNbC9qNFZ5c2C+V/otfnqg2xQVE -QcEtCULa5PlHboXe06oINuwwU2jIOMwGKddFEUknZKiS57sZKwa8G/jUsxMec78x -4IJsQ6qCElL9Ajz1xX674DD1T6/jbooCUJrWwa4Tb7f8m+p0FDKF6K6SYYuInQ6h -+l+Cli4WYqLa5gEpTerONTEPTXBDisKmrmcSeSwaGAF4EOeF5iaYOyP/AO+fPV7E -r9amu9OIdDkzC4hDg7JvCBVYMX7O/w9es5uuxm8P+6WuOHVxqS+cJ7aQNgQoxGId -QN6wdLaM0mQFR74Umjj8TdSkWhg612gF7r0EhQIDAQABAoIBADNwfU6o3vFm4OYV -BofU8jgppQ6I2QNbYoz/axnksXkv6oRXDvBK1cI4+tieL/zRTQQ5ByRYRyHO0JpX -lD4iq/3UQtUOsug3TGIWBlFWp5DulxRYXyflJGRY2b/NRW144HfMulGYwqJWuFTO -IwDEUQdczQ9fejEaLsF+8Omzr+b6+mEDewqoHb4mbr7gXMdkK85FU2tjWRHlUR+N -GMXRhQQE7o76UyYwNRbI418LaZitHcVYMKSsyU/+Uo/ivzD793OFzk5sDR9eThgi -B50yK2ClB+1bUfis18TXMtC4mZZeypTWifJpBzIiVLMBuN7/Y0HrSomIzyPC7ytW -5jZWCOECgYEA4k+AEmYOiIfPajT3YfG3y0Dptoup9x6zkzVNZnde3LgGRfezzJ7S -+lGbLNnIiuxAeHwZnyrptO0cgm0+SOCRwGXqySkl14WzD1P684nRwlQkzKv/50mZ -ZMUjM83SuIzh8mLv3F5xQ9td5R/y2kCw4YgyYHvhp1nLxEdwPbjtttkCgYEAzCgr -wlP0Uu5PlaSMKSbtmC6tHGv+kgTLM89V6o71+HiUTG6TWGmM+6XlT1cfVWE+27np -MsYoFTKI/meAeJwm+0pxEwemHgrgffkdmsWpTByLaOY1t/eNHagaLCGm2ZRu/WK7 -oltV18kPijnmFs1uZLvlBkxmkadrVAj/cw5uZ40CgYBFZt/9xHJ8iDmhdnDPBpO4 -r0V9B8Ot1yp24IfF/qGGyqCR4G6xN5u3zELsNDV99QmoaVZqK3zUUUrG7L2HF+da -u2aPHiFOwN+yuaxh90fucmN+qNinkziJYLN09Y/DrOC1toWcbRILH0DiPTP6npAf -+eaJFDSVX8JPhSD0rLupsQKBgEzILuz/NjyadEQLhstTYLiDlYfC9hNkyifKKr30 -1n2EnAHC9Jej2uoqEnwsgBRUZpes7A+0hw6x2uQTeTXjRKXt8Wj+z3MtFBFMx92V -yX5ene/t5PYznFczCeTfIylhsfyKTZdaUoa9j6Kk8+xPht1L7W7Y/Rp6pNsOJ0TW -gJ9hAoGBAOJDNPkmH1hY64bvR6P0zEyedClhxIclPHgCrntFTlspkMj/QY48K6IP -R8SZ5jDpxAquQDgvpiuZRDYMHBRJkUe2VpHJFYGl1MLTfoBYn1IH401ixUSBYxAW -yfE7/zMDZUov2Uu8Muto5R/yNHEKBMOLGjadkADhRIHbW4WG1yVr ------END RSA PRIVATE KEY----- From 3f1930ae63a7495c52ca018f09488f6b120db3ad Mon Sep 17 00:00:00 2001 From: Maryia Lapata Date: Sat, 29 Feb 2020 12:53:06 +0300 Subject: [PATCH 27/31] Move dev tools styles to NP (#58855) --- src/legacy/core_plugins/kibana/public/dev_tools/README.md | 1 - src/legacy/core_plugins/kibana/public/index.scss | 3 --- .../_index.scss => plugins/dev_tools/public/index.scss} | 0 src/plugins/dev_tools/public/plugin.ts | 2 ++ 4 files changed, 2 insertions(+), 4 deletions(-) rename src/{legacy/core_plugins/kibana/public/dev_tools/_index.scss => plugins/dev_tools/public/index.scss} (100%) diff --git a/src/legacy/core_plugins/kibana/public/dev_tools/README.md b/src/legacy/core_plugins/kibana/public/dev_tools/README.md index 0234830d6071c..199ddcc754d04 100644 --- a/src/legacy/core_plugins/kibana/public/dev_tools/README.md +++ b/src/legacy/core_plugins/kibana/public/dev_tools/README.md @@ -1,4 +1,3 @@ This folder is just a left-over of the things that can't be moved to Kibana platform just yet: -* Styling (this can be moved as soon as there is support for styling in Kibana platform) * Check whether there are no dev tools and hide the link in the nav bar (this can be moved as soon as all dev tools are moved) \ No newline at end of file diff --git a/src/legacy/core_plugins/kibana/public/index.scss b/src/legacy/core_plugins/kibana/public/index.scss index 324458c0814d9..3eef84c32db79 100644 --- a/src/legacy/core_plugins/kibana/public/index.scss +++ b/src/legacy/core_plugins/kibana/public/index.scss @@ -10,9 +10,6 @@ // vis_type_vislib UI styles @import 'src/legacy/core_plugins/vis_type_vislib/public/index'; -// Dev tools styles -@import './dev_tools/index'; - // Discover styles @import 'discover/index'; diff --git a/src/legacy/core_plugins/kibana/public/dev_tools/_index.scss b/src/plugins/dev_tools/public/index.scss similarity index 100% rename from src/legacy/core_plugins/kibana/public/dev_tools/_index.scss rename to src/plugins/dev_tools/public/index.scss diff --git a/src/plugins/dev_tools/public/plugin.ts b/src/plugins/dev_tools/public/plugin.ts index 2a2ae6385875f..9ebfeb5387b26 100644 --- a/src/plugins/dev_tools/public/plugin.ts +++ b/src/plugins/dev_tools/public/plugin.ts @@ -21,6 +21,8 @@ import { App, CoreSetup, Plugin } from 'kibana/public'; import { sortBy } from 'lodash'; import { KibanaLegacySetup } from '../../kibana_legacy/public'; +import './index.scss'; + export interface DevToolsSetup { /** * Register a developer tool. It will be available From 61c9dc4022d1629513c4450d9a3c2482268d98e1 Mon Sep 17 00:00:00 2001 From: Tyler Smalley Date: Sat, 29 Feb 2020 16:34:54 -0800 Subject: [PATCH 28/31] Skips failing Ingest Manager integration tests https://github.com/elastic/kibana/issues/58969 https://github.com/elastic/kibana/issues/58968 https://github.com/elastic/kibana/issues/58967 https://github.com/elastic/kibana/issues/58966 https://github.com/elastic/kibana/issues/58961 https://github.com/elastic/kibana/issues/58960 https://github.com/elastic/kibana/issues/58959 https://github.com/elastic/kibana/issues/58958 https://github.com/elastic/kibana/issues/58958 https://github.com/elastic/kibana/issues/58957 https://github.com/elastic/kibana/issues/58956 https://github.com/elastic/kibana/issues/58955 https://github.com/elastic/kibana/issues/58954 Signed-off-by: Tyler Smalley --- .../ingest_manager/server/integration_tests/router.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/ingest_manager/server/integration_tests/router.test.ts b/x-pack/plugins/ingest_manager/server/integration_tests/router.test.ts index 38976957173f4..c874aa7d22abc 100644 --- a/x-pack/plugins/ingest_manager/server/integration_tests/router.test.ts +++ b/x-pack/plugins/ingest_manager/server/integration_tests/router.test.ts @@ -23,7 +23,7 @@ function createXPackRoot(config: {} = {}) { } describe('ingestManager', () => { - describe('default. manager, EPM, and Fleet all disabled', () => { + describe.skip('default. manager, EPM, and Fleet all disabled', () => { let root: ReturnType; beforeAll(async () => { root = createXPackRoot(); @@ -50,7 +50,7 @@ describe('ingestManager', () => { }); }); - describe('manager only (no EPM, no Fleet)', () => { + describe.skip('manager only (no EPM, no Fleet)', () => { let root: ReturnType; beforeAll(async () => { const ingestManagerConfig = { From 420ded8eb2c46615116518bee328c9eebcdd646a Mon Sep 17 00:00:00 2001 From: Tyler Smalley Date: Sat, 29 Feb 2020 16:39:47 -0800 Subject: [PATCH 29/31] Skips additional failing Ingest Manager integration tests https://github.com/elastic/kibana/issues/58969 https://github.com/elastic/kibana/issues/58968 https://github.com/elastic/kibana/issues/58967 https://github.com/elastic/kibana/issues/58966 Signed-off-by: Tyler Smalley --- .../ingest_manager/server/integration_tests/router.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/plugins/ingest_manager/server/integration_tests/router.test.ts b/x-pack/plugins/ingest_manager/server/integration_tests/router.test.ts index c874aa7d22abc..3a13359cdf782 100644 --- a/x-pack/plugins/ingest_manager/server/integration_tests/router.test.ts +++ b/x-pack/plugins/ingest_manager/server/integration_tests/router.test.ts @@ -87,7 +87,7 @@ describe('ingestManager', () => { // https://github.com/jfsiii/kibana/blob/f73b54ebb7e0f6fc00efd8a6800a01eb2d9fb772/x-pack/plugins/ingest_manager/server/plugin.ts#L84 // adding tests to confirm the Fleet & EPM routes are never added - describe('manager and EPM; no Fleet', () => { + describe.skip('manager and EPM; no Fleet', () => { let root: ReturnType; beforeAll(async () => { const ingestManagerConfig = { From 5b532ff50f66d16ec61d87c34f5e1172700c4260 Mon Sep 17 00:00:00 2001 From: Christos Nasikas Date: Sun, 1 Mar 2020 13:29:18 +0200 Subject: [PATCH 30/31] Restores [SIEM][CASE] Init Configure Case Page (#58121) (#58924) * [SIEM][CASE] Init configure cases * [SIEM][CASE] Translate header title * [SIEM][CASE] Add back link * [SIEM][CASE] Add default options to header page * [SIEM][CASE] Create configure cases page redirections and links * [SIEM][CASE] Add configure cases button * [SIEM][CASE] Change translation variable * [SIEM][CASE] Create wrappers * [SIEM][CASE] Create section wrapper * [SIEM][CASE] Switch to new wrapper * [SIEM][CASE] Add translations * [SIEM][CASE] Add connectors dropdown component * [SIEM][CASE] Add connectors component * [SIEM][CASE] Show connectors * [SIEM][CASE] Create add new connector button * [SIEM][CASE] Change values * [SIEM][CASE] Use state for connectors dropdown * [SIEM][CASE] Remove unnecessary attribute * [SIEM][CASE] Remove timeline in configuration page * [SIEM][CASE] Remove text from gear button * [SIEM][CASE] make show timeline more generic so we can re-use if need it Co-authored-by: Xavier Mouligneau <189600+XavierM@users.noreply.github.com> Co-authored-by: Elastic Machine --- .../siem/public/components/link_to/index.ts | 2 + .../public/components/link_to/link_to.tsx | 11 +++- .../components/link_to/redirect_to_case.tsx | 4 ++ .../plugins/siem/public/pages/case/case.tsx | 27 +++++---- .../components/case_header_page/index.tsx | 22 ++++++++ .../case_header_page/translations.ts | 16 ++++++ .../pages/case/components/case_view/index.tsx | 13 +---- .../components/configure_cases/connectors.tsx | 52 +++++++++++++++++ .../connectors_dropdown/index.tsx | 56 +++++++++++++++++++ .../configure_cases/translations.ts | 37 ++++++++++++ .../pages/case/components/wrappers/index.tsx | 22 ++++++++ .../public/pages/case/configure_cases.tsx | 54 ++++++++++++++++++ .../siem/public/pages/case/create_case.tsx | 10 +--- .../plugins/siem/public/pages/case/index.tsx | 5 ++ .../siem/public/pages/case/translations.ts | 20 ++++--- .../plugins/siem/public/pages/home/index.tsx | 5 +- .../utils/timeline/use_show_timeline.tsx | 31 ++++++++++ 17 files changed, 345 insertions(+), 42 deletions(-) create mode 100644 x-pack/legacy/plugins/siem/public/pages/case/components/case_header_page/index.tsx create mode 100644 x-pack/legacy/plugins/siem/public/pages/case/components/case_header_page/translations.ts create mode 100644 x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/connectors.tsx create mode 100644 x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/connectors_dropdown/index.tsx create mode 100644 x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/translations.ts create mode 100644 x-pack/legacy/plugins/siem/public/pages/case/components/wrappers/index.tsx create mode 100644 x-pack/legacy/plugins/siem/public/pages/case/configure_cases.tsx create mode 100644 x-pack/legacy/plugins/siem/public/utils/timeline/use_show_timeline.tsx diff --git a/x-pack/legacy/plugins/siem/public/components/link_to/index.ts b/x-pack/legacy/plugins/siem/public/components/link_to/index.ts index c93b415e017bb..a1c1f78e398e3 100644 --- a/x-pack/legacy/plugins/siem/public/components/link_to/index.ts +++ b/x-pack/legacy/plugins/siem/public/components/link_to/index.ts @@ -17,6 +17,8 @@ export { getCaseDetailsUrl, getCaseUrl, getCreateCaseUrl, + getConfigureCasesUrl, RedirectToCasePage, RedirectToCreatePage, + RedirectToConfigureCasesPage, } from './redirect_to_case'; diff --git a/x-pack/legacy/plugins/siem/public/components/link_to/link_to.tsx b/x-pack/legacy/plugins/siem/public/components/link_to/link_to.tsx index c08b429dc4625..08e4d1a3494e0 100644 --- a/x-pack/legacy/plugins/siem/public/components/link_to/link_to.tsx +++ b/x-pack/legacy/plugins/siem/public/components/link_to/link_to.tsx @@ -20,7 +20,11 @@ import { RedirectToHostsPage, RedirectToHostDetailsPage } from './redirect_to_ho import { RedirectToNetworkPage } from './redirect_to_network'; import { RedirectToOverviewPage } from './redirect_to_overview'; import { RedirectToTimelinesPage } from './redirect_to_timelines'; -import { RedirectToCasePage, RedirectToCreatePage } from './redirect_to_case'; +import { + RedirectToCasePage, + RedirectToCreatePage, + RedirectToConfigureCasesPage, +} from './redirect_to_case'; import { DetectionEngineTab } from '../../pages/detection_engine/types'; interface LinkToPageProps { @@ -43,6 +47,11 @@ export const LinkToPage = React.memo(({ match }) => ( component={RedirectToCreatePage} path={`${match.url}/:pageName(${SiemPageName.case})/create`} /> + ; +export const RedirectToConfigureCasesPage = () => ( + +); const baseCaseUrl = `#/link-to/${SiemPageName.case}`; export const getCaseUrl = () => baseCaseUrl; export const getCaseDetailsUrl = (detailName: string) => `${baseCaseUrl}/${detailName}`; export const getCreateCaseUrl = () => `${baseCaseUrl}/create`; +export const getConfigureCasesUrl = () => `${baseCaseUrl}/configure`; diff --git a/x-pack/legacy/plugins/siem/public/pages/case/case.tsx b/x-pack/legacy/plugins/siem/public/pages/case/case.tsx index 1206ec950deed..15a6d076f1009 100644 --- a/x-pack/legacy/plugins/siem/public/pages/case/case.tsx +++ b/x-pack/legacy/plugins/siem/public/pages/case/case.tsx @@ -6,30 +6,29 @@ import React from 'react'; -import { EuiButton, EuiFlexGroup } from '@elastic/eui'; -import { HeaderPage } from '../../components/header_page'; +import { EuiButton, EuiButtonIcon, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; +import { CaseHeaderPage } from './components/case_header_page'; import { WrapperPage } from '../../components/wrapper_page'; import { AllCases } from './components/all_cases'; import { SpyRoute } from '../../utils/route/spy_routes'; import * as i18n from './translations'; -import { getCreateCaseUrl } from '../../components/link_to'; - -const badgeOptions = { - beta: true, - text: i18n.PAGE_BADGE_LABEL, - tooltip: i18n.PAGE_BADGE_TOOLTIP, -}; +import { getCreateCaseUrl, getConfigureCasesUrl } from '../../components/link_to'; export const CasesPage = React.memo(() => ( <> - + - - {i18n.CREATE_TITLE} - + + + {i18n.CREATE_TITLE} + + + + + - + diff --git a/x-pack/legacy/plugins/siem/public/pages/case/components/case_header_page/index.tsx b/x-pack/legacy/plugins/siem/public/pages/case/components/case_header_page/index.tsx new file mode 100644 index 0000000000000..ae2664ca6e839 --- /dev/null +++ b/x-pack/legacy/plugins/siem/public/pages/case/components/case_header_page/index.tsx @@ -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; + * you may not use this file except in compliance with the Elastic License. + */ + +import React from 'react'; + +import { HeaderPage, HeaderPageProps } from '../../../../components/header_page'; +import * as i18n from './translations'; + +const CaseHeaderPageComponent: React.FC = props => ; + +CaseHeaderPageComponent.defaultProps = { + badgeOptions: { + beta: true, + text: i18n.PAGE_BADGE_LABEL, + tooltip: i18n.PAGE_BADGE_TOOLTIP, + }, +}; + +export const CaseHeaderPage = React.memo(CaseHeaderPageComponent); diff --git a/x-pack/legacy/plugins/siem/public/pages/case/components/case_header_page/translations.ts b/x-pack/legacy/plugins/siem/public/pages/case/components/case_header_page/translations.ts new file mode 100644 index 0000000000000..9fcad926c03b8 --- /dev/null +++ b/x-pack/legacy/plugins/siem/public/pages/case/components/case_header_page/translations.ts @@ -0,0 +1,16 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { i18n } from '@kbn/i18n'; + +export const PAGE_BADGE_LABEL = i18n.translate('xpack.siem.case.caseView.pageBadgeLabel', { + defaultMessage: 'Beta', +}); + +export const PAGE_BADGE_TOOLTIP = i18n.translate('xpack.siem.case.caseView.pageBadgeTooltip', { + defaultMessage: + 'Case Workflow is still in beta. Please help us improve by reporting issues or bugs in the Kibana repo.', +}); diff --git a/x-pack/legacy/plugins/siem/public/pages/case/components/case_view/index.tsx b/x-pack/legacy/plugins/siem/public/pages/case/components/case_view/index.tsx index 5cd71c5855d34..df3e30a698b56 100644 --- a/x-pack/legacy/plugins/siem/public/pages/case/components/case_view/index.tsx +++ b/x-pack/legacy/plugins/siem/public/pages/case/components/case_view/index.tsx @@ -34,6 +34,7 @@ import { UserActionTree } from '../user_action_tree'; import { UserList } from '../user_list'; import { useUpdateCase } from '../../../../containers/case/use_update_case'; import { WrapperPage } from '../../../../components/wrapper_page'; +import { WhitePageWrapper } from '../wrappers'; interface Props { caseId: string; @@ -52,14 +53,6 @@ const MyWrapper = styled(WrapperPage)` padding-bottom: 0; `; -const BackgroundWrapper = styled.div` - ${({ theme }) => css` - background-color: ${theme.eui.euiColorEmptyShade}; - border-top: ${theme.eui.euiBorderThin}; - height: 100%; - `} -`; - export interface CaseProps { caseId: string; initialData: Case; @@ -279,7 +272,7 @@ export const CaseComponent = React.memo(({ caseId, initialData, isLoa - + @@ -305,7 +298,7 @@ export const CaseComponent = React.memo(({ caseId, initialData, isLoa - + ); }); diff --git a/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/connectors.tsx b/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/connectors.tsx new file mode 100644 index 0000000000000..561464e44c703 --- /dev/null +++ b/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/connectors.tsx @@ -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; + * you may not use this file except in compliance with the Elastic License. + */ + +import React from 'react'; +import { + EuiDescribedFormGroup, + EuiFormRow, + EuiFlexGroup, + EuiFlexItem, + EuiLink, +} from '@elastic/eui'; + +import styled from 'styled-components'; + +import { ConnectorsDropdown } from './connectors_dropdown'; +import * as i18n from './translations'; + +const EuiFormRowExtended = styled(EuiFormRow)` + .euiFormRow__labelWrapper { + .euiFormRow__label { + width: 100%; + } + } +`; + +const ConnectorsComponent: React.FC = () => { + const dropDownLabel = ( + + {i18n.INCIDENT_MANAGEMENT_SYSTEM_LABEL} + + {i18n.ADD_NEW_CONNECTOR} + + + ); + + return ( + {i18n.INCIDENT_MANAGEMENT_SYSTEM_TITLE}} + description={i18n.INCIDENT_MANAGEMENT_SYSTEM_DESC} + > + + + + + ); +}; + +export const Connectors = React.memo(ConnectorsComponent); diff --git a/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/connectors_dropdown/index.tsx b/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/connectors_dropdown/index.tsx new file mode 100644 index 0000000000000..c00baa04d78a0 --- /dev/null +++ b/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/connectors_dropdown/index.tsx @@ -0,0 +1,56 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import React, { useState, useCallback } from 'react'; +import { EuiSuperSelect, EuiIcon, EuiSuperSelectOption } from '@elastic/eui'; +import styled from 'styled-components'; + +import * as i18n from '../translations'; + +const ICON_SIZE = 'm'; + +const EuiIconExtended = styled(EuiIcon)` + margin-right: 13px; +`; + +const connectors: Array> = [ + { + value: 'no-connector', + inputDisplay: ( + <> + + {i18n.NO_CONNECTOR} + + ), + 'data-test-subj': 'no-connector', + }, + { + value: 'servicenow-connector', + inputDisplay: ( + <> + + {'My ServiceNow connector'} + + ), + 'data-test-subj': 'servicenow-connector', + }, +]; + +const ConnectorsDropdownComponent: React.FC = () => { + const [selectedConnector, selectConnector] = useState(connectors[0].value); + const onChange = useCallback(connector => selectConnector(connector), [selectedConnector]); + + return ( + + ); +}; + +export const ConnectorsDropdown = React.memo(ConnectorsDropdownComponent); diff --git a/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/translations.ts b/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/translations.ts new file mode 100644 index 0000000000000..54d256b143f60 --- /dev/null +++ b/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/translations.ts @@ -0,0 +1,37 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { i18n } from '@kbn/i18n'; + +export const INCIDENT_MANAGEMENT_SYSTEM_TITLE = i18n.translate( + 'xpack.siem.case.configureCases.incidentManagementSystemTitle', + { + defaultMessage: 'Connect to third-party incident management system', + } +); + +export const INCIDENT_MANAGEMENT_SYSTEM_DESC = i18n.translate( + 'xpack.siem.case.configureCases.incidentManagementSystemDesc', + { + defaultMessage: + 'You may optionally connect SIEM cases to a third-party incident management system of your choosing. This will allow you to push case data as an incident in your chosen third-party system.', + } +); + +export const INCIDENT_MANAGEMENT_SYSTEM_LABEL = i18n.translate( + 'xpack.siem.case.configureCases.incidentManagementSystemLabel', + { + defaultMessage: 'Incident management system', + } +); + +export const NO_CONNECTOR = i18n.translate('xpack.siem.case.configureCases.noConnector', { + defaultMessage: 'No connector selected', +}); + +export const ADD_NEW_CONNECTOR = i18n.translate('xpack.siem.case.configureCases.addNewConnector', { + defaultMessage: 'Add new connector option', +}); diff --git a/x-pack/legacy/plugins/siem/public/pages/case/components/wrappers/index.tsx b/x-pack/legacy/plugins/siem/public/pages/case/components/wrappers/index.tsx new file mode 100644 index 0000000000000..772d78f948b79 --- /dev/null +++ b/x-pack/legacy/plugins/siem/public/pages/case/components/wrappers/index.tsx @@ -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; + * you may not use this file except in compliance with the Elastic License. + */ + +import styled, { css } from 'styled-components'; + +export const WhitePageWrapper = styled.div` + ${({ theme }) => css` + background-color: ${theme.eui.euiColorEmptyShade}; + border-top: ${theme.eui.euiBorderThin}; + height: 100%; + min-height: 100vh; + `} +`; + +export const SectionWrapper = styled.div` + box-sizing: content-box; + margin: 0 auto; + max-width: 1175px; +`; diff --git a/x-pack/legacy/plugins/siem/public/pages/case/configure_cases.tsx b/x-pack/legacy/plugins/siem/public/pages/case/configure_cases.tsx new file mode 100644 index 0000000000000..018f9dc9ade52 --- /dev/null +++ b/x-pack/legacy/plugins/siem/public/pages/case/configure_cases.tsx @@ -0,0 +1,54 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import React from 'react'; +import styled, { css } from 'styled-components'; + +import { WrapperPage } from '../../components/wrapper_page'; +import { CaseHeaderPage } from './components/case_header_page'; +import { SpyRoute } from '../../utils/route/spy_routes'; +import { getCaseUrl } from '../../components/link_to'; +import { WhitePageWrapper, SectionWrapper } from './components/wrappers'; +import { Connectors } from './components/configure_cases/connectors'; +import * as i18n from './translations'; + +const backOptions = { + href: getCaseUrl(), + text: i18n.BACK_TO_ALL, +}; + +const wrapperPageStyle: Record = { + paddingLeft: '0', + paddingRight: '0', + paddingBottom: '0', +}; + +export const FormWrapper = styled.div` + ${({ theme }) => css` + padding-top: ${theme.eui.paddingSizes.l}; + padding-bottom: ${theme.eui.paddingSizes.l}; + `} +`; + +const ConfigureCasesPageComponent: React.FC = () => ( + <> + + + + + + + + + + + + + + +); + +export const ConfigureCasesPage = React.memo(ConfigureCasesPageComponent); diff --git a/x-pack/legacy/plugins/siem/public/pages/case/create_case.tsx b/x-pack/legacy/plugins/siem/public/pages/case/create_case.tsx index 9bc356517cc68..2c7525264f71b 100644 --- a/x-pack/legacy/plugins/siem/public/pages/case/create_case.tsx +++ b/x-pack/legacy/plugins/siem/public/pages/case/create_case.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { WrapperPage } from '../../components/wrapper_page'; import { Create } from './components/create'; import { SpyRoute } from '../../utils/route/spy_routes'; -import { HeaderPage } from '../../components/header_page'; +import { CaseHeaderPage } from './components/case_header_page'; import * as i18n from './translations'; import { getCaseUrl } from '../../components/link_to'; @@ -17,15 +17,11 @@ const backOptions = { href: getCaseUrl(), text: i18n.BACK_TO_ALL, }; -const badgeOptions = { - beta: true, - text: i18n.PAGE_BADGE_LABEL, - tooltip: i18n.PAGE_BADGE_TOOLTIP, -}; + export const CreateCasePage = React.memo(() => ( <> - + diff --git a/x-pack/legacy/plugins/siem/public/pages/case/index.tsx b/x-pack/legacy/plugins/siem/public/pages/case/index.tsx index 9bd91b1c6d62d..1bde9de1535b5 100644 --- a/x-pack/legacy/plugins/siem/public/pages/case/index.tsx +++ b/x-pack/legacy/plugins/siem/public/pages/case/index.tsx @@ -11,10 +11,12 @@ import { SiemPageName } from '../home/types'; import { CaseDetailsPage } from './case_details'; import { CasesPage } from './case'; import { CreateCasePage } from './create_case'; +import { ConfigureCasesPage } from './configure_cases'; const casesPagePath = `/:pageName(${SiemPageName.case})`; const caseDetailsPagePath = `${casesPagePath}/:detailName`; const createCasePagePath = `${casesPagePath}/create`; +const configureCasesPagePath = `${casesPagePath}/configure`; const CaseContainerComponent: React.FC = () => ( @@ -24,6 +26,9 @@ const CaseContainerComponent: React.FC = () => ( + + + diff --git a/x-pack/legacy/plugins/siem/public/pages/case/translations.ts b/x-pack/legacy/plugins/siem/public/pages/case/translations.ts index 4e878ba58411e..265af0bde547f 100644 --- a/x-pack/legacy/plugins/siem/public/pages/case/translations.ts +++ b/x-pack/legacy/plugins/siem/public/pages/case/translations.ts @@ -57,15 +57,6 @@ export const LAST_UPDATED = i18n.translate('xpack.siem.case.caseView.updatedAt', defaultMessage: 'Last updated', }); -export const PAGE_BADGE_LABEL = i18n.translate('xpack.siem.case.caseView.pageBadgeLabel', { - defaultMessage: 'Beta', -}); - -export const PAGE_BADGE_TOOLTIP = i18n.translate('xpack.siem.case.caseView.pageBadgeTooltip', { - defaultMessage: - 'Case Workflow is still in beta. Please help us improve by reporting issues or bugs in the Kibana repo.', -}); - export const PAGE_SUBTITLE = i18n.translate('xpack.siem.case.caseView.pageSubtitle', { defaultMessage: 'Case Workflow Management within the Elastic SIEM', }); @@ -102,3 +93,14 @@ export const NO_TAGS = i18n.translate('xpack.siem.case.caseView.noTags', { export const TITLE_REQUIRED = i18n.translate('xpack.siem.case.createCase.titleFieldRequiredError', { defaultMessage: 'A title is required.', }); + +export const CONFIGURE_CASES_PAGE_TITLE = i18n.translate( + 'xpack.siem.case.configureCases.headerTitle', + { + defaultMessage: 'Configure cases', + } +); + +export const CONFIGURE_CASES_BUTTON = i18n.translate('xpack.siem.case.configureCasesButton', { + defaultMessage: 'Configure cases', +}); diff --git a/x-pack/legacy/plugins/siem/public/pages/home/index.tsx b/x-pack/legacy/plugins/siem/public/pages/home/index.tsx index 7c5fd56bf1e91..605136a190c54 100644 --- a/x-pack/legacy/plugins/siem/public/pages/home/index.tsx +++ b/x-pack/legacy/plugins/siem/public/pages/home/index.tsx @@ -21,6 +21,7 @@ import { AutoSaveWarningMsg } from '../../components/timeline/auto_save_warning' import { UseUrlState } from '../../components/url_state'; import { WithSource, indicesExistOrDataTemporarilyUnavailable } from '../../containers/source'; import { SpyRoute } from '../../utils/route/spy_routes'; +import { useShowTimeline } from '../../utils/timeline/use_show_timeline'; import { NotFoundPage } from '../404'; import { DetectionEngineContainer } from '../detection_engine'; import { HostsContainer } from '../hosts'; @@ -68,6 +69,8 @@ export const HomePage: React.FC = () => { windowHeight, }); + const [showTimeline] = useShowTimeline(); + return ( @@ -77,7 +80,7 @@ export const HomePage: React.FC = () => { {({ browserFields, indexPattern, indicesExist }) => ( - {indicesExistOrDataTemporarilyUnavailable(indicesExist) && ( + {indicesExistOrDataTemporarilyUnavailable(indicesExist) && showTimeline && ( <> { + const currentLocation = useLocation(); + const [showTimeline, setShowTimeline] = useState( + !hideTimelineForRoutes.includes(currentLocation.pathname) + ); + + useEffect(() => { + if (hideTimelineForRoutes.includes(currentLocation.pathname)) { + if (showTimeline) { + setShowTimeline(false); + } + } else if (!showTimeline) { + setShowTimeline(true); + } + }, [currentLocation.pathname]); + + return [showTimeline]; +}; From 45f804c43c0716ac24bccde906dad229a0a8950d Mon Sep 17 00:00:00 2001 From: Nic Date: Sun, 1 Mar 2020 16:30:44 -0600 Subject: [PATCH 31/31] [SIEM] Detection Fix typo in Adobe Hijack Persistence rule (#58804) Fixes https://github.com/elastic/kibana/issues/58803 --- .../rules/prepackaged_rules/eql_adobe_hijack_persistence.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x-pack/legacy/plugins/siem/server/lib/detection_engine/rules/prepackaged_rules/eql_adobe_hijack_persistence.json b/x-pack/legacy/plugins/siem/server/lib/detection_engine/rules/prepackaged_rules/eql_adobe_hijack_persistence.json index 387726168cb10..8b8c510093260 100644 --- a/x-pack/legacy/plugins/siem/server/lib/detection_engine/rules/prepackaged_rules/eql_adobe_hijack_persistence.json +++ b/x-pack/legacy/plugins/siem/server/lib/detection_engine/rules/prepackaged_rules/eql_adobe_hijack_persistence.json @@ -6,7 +6,7 @@ "language": "kuery", "max_signals": 100, "name": "Adobe Hijack Persistence", - "query": "file.path:(\"C:\\Program Files (x86)\\Adobe\\Acrobat Reader DC\\Reader\\AcroCEF\\RdrCEF.exe\" or \"C:\\Program Files\\Adobe\\Acrobat Reader DC\\Reader\\AcroCEF\\RdrCEF.exe\") and event.action:\"File created (rule: FileCreate)\" and not process.name:msiexeec.exe", + "query": "file.path:(\"C:\\Program Files (x86)\\Adobe\\Acrobat Reader DC\\Reader\\AcroCEF\\RdrCEF.exe\" or \"C:\\Program Files\\Adobe\\Acrobat Reader DC\\Reader\\AcroCEF\\RdrCEF.exe\") and event.action:\"File created (rule: FileCreate)\" and not process.name:msiexec.exe", "risk_score": 21, "rule_id": "2bf78aa2-9c56-48de-b139-f169bf99cf86", "severity": "low", @@ -32,5 +32,5 @@ } ], "type": "query", - "version": 1 + "version": 2 }