@cccsaurora/howler-ui 2.19.0-dev.1181 → 2.19.0-dev.1264
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/analytic/index.d.ts +2 -3
- package/api/analytic/index.js +1 -2
- package/api/index.d.ts +4 -0
- package/api/index.js +10 -2
- package/api/search/case.d.ts +4 -0
- package/api/search/case.js +8 -0
- package/api/search/facet/hit.d.ts +1 -3
- package/api/search/facet/index.d.ts +3 -1
- package/api/search/index.d.ts +3 -1
- package/api/search/index.js +2 -1
- package/api/socket/index.d.ts +3 -0
- package/api/socket/index.js +6 -0
- package/api/socket/viewers.d.ts +2 -0
- package/api/socket/viewers.js +8 -0
- package/api/socket/viewers.test.js +44 -0
- package/api/v2/case/index.d.ts +9 -0
- package/api/v2/case/index.js +21 -0
- package/api/v2/case/items.d.ts +9 -0
- package/api/v2/case/items.js +19 -0
- package/api/v2/case/rules.d.ts +6 -0
- package/api/v2/case/rules.js +18 -0
- package/api/v2/fuzzy.d.ts +17 -0
- package/api/v2/fuzzy.js +11 -0
- package/api/v2/index.d.ts +5 -0
- package/api/v2/index.js +7 -0
- package/api/v2/search/facet.d.ts +3 -0
- package/api/v2/search/facet.js +12 -0
- package/api/v2/search/index.d.ts +6 -0
- package/api/v2/search/index.js +24 -0
- package/commons/components/leftnav/LeftNavDrawer.js +1 -1
- package/components/app/App.js +49 -11
- package/components/app/hooks/useMatchers.d.ts +1 -1
- package/components/app/hooks/useMatchers.js +23 -11
- package/components/app/hooks/useMatchers.test.js +22 -22
- package/components/app/hooks/useTitle.js +5 -5
- package/components/app/providers/FavouritesProvider.js +2 -2
- package/components/app/providers/GridColumnsProvider.js +2 -2
- package/components/app/providers/GridColumnsProvider.test.js +3 -3
- package/components/app/providers/ModalProvider.d.ts +1 -0
- package/components/app/providers/ParameterProvider.d.ts +25 -3
- package/components/app/providers/ParameterProvider.js +163 -226
- package/components/app/providers/ParameterProvider.test.js +358 -94
- package/components/app/providers/RecordProvider.d.ts +23 -0
- package/components/app/providers/{HitProvider.js → RecordProvider.js} +46 -42
- package/components/app/providers/{HitSearchProvider.d.ts → RecordSearchProvider.d.ts} +6 -6
- package/components/app/providers/{HitSearchProvider.js → RecordSearchProvider.js} +13 -19
- package/components/app/providers/{HitSearchProvider.test.js → RecordSearchProvider.test.js} +52 -71
- package/components/app/providers/SearchResponseProvider.d.ts +4 -4
- package/components/app/providers/SearchResponseProvider.js +1 -1
- package/components/app/providers/SocketProvider.d.ts +11 -2
- package/components/app/providers/SocketProvider.js +18 -5
- package/components/app/providers/UserListProvider.js +28 -8
- package/components/app/providers/UserListProvider.test.js +150 -0
- package/components/elements/ContextMenu.d.ts +56 -0
- package/components/elements/ContextMenu.js +109 -0
- package/components/elements/ContextMenu.test.d.ts +1 -0
- package/components/elements/ContextMenu.test.js +215 -0
- package/components/{routes/overviews/OverviewEditor.js → elements/MarkdownEditor.js} +3 -3
- package/components/elements/ObjectDetails.d.ts +6 -0
- package/components/elements/{hit/HitDetails.js → ObjectDetails.js} +17 -17
- package/components/elements/PluginChip.d.ts +1 -1
- package/components/elements/PluginChip.js +0 -1
- package/components/elements/PluginTypography.d.ts +2 -1
- package/components/elements/PluginTypography.js +3 -2
- package/components/elements/UserList.d.ts +5 -2
- package/components/elements/UserList.js +33 -16
- package/components/elements/UserList.test.d.ts +1 -0
- package/components/elements/UserList.test.js +122 -0
- package/components/elements/addons/lists/TuiListElement.d.ts +1 -1
- package/components/elements/addons/lists/TuiListElement.js +0 -1
- package/components/elements/addons/search/SearchTotal.js +1 -1
- package/components/elements/addons/search/SearchTotal.test.js +2 -2
- package/components/elements/addons/search/phrase/Phrase.js +1 -1
- package/components/elements/case/CaseCard.d.ts +12 -0
- package/components/elements/case/CaseCard.js +43 -0
- package/components/elements/case/CasePreview.d.ts +6 -0
- package/components/elements/case/CasePreview.js +17 -0
- package/components/elements/case/StatusIcon.d.ts +5 -0
- package/components/elements/case/StatusIcon.js +13 -0
- package/components/elements/display/ChipPopper.d.ts +1 -1
- package/components/elements/display/ChipPopper.js +6 -5
- package/components/elements/display/Classification.js +1 -1
- package/components/elements/display/ClassificationChip.d.ts +14 -0
- package/components/elements/display/ClassificationChip.js +36 -0
- package/components/elements/display/HowlerCard.js +1 -1
- package/components/elements/display/HowlerCard.test.js +5 -9
- package/components/elements/display/ItemManager.js +2 -2
- package/components/elements/display/Modal.js +2 -0
- package/components/elements/display/QueryResultText.d.ts +1 -0
- package/components/elements/display/QueryResultText.js +2 -2
- package/components/elements/event/EventCard.d.ts +6 -0
- package/components/elements/event/EventCard.js +22 -0
- package/components/elements/event/EventPreview.d.ts +6 -0
- package/components/elements/event/EventPreview.js +12 -0
- package/components/elements/hit/HitActions.js +4 -4
- package/components/elements/hit/HitBanner.d.ts +1 -0
- package/components/elements/hit/HitBanner.js +31 -49
- package/components/elements/hit/HitCard.d.ts +4 -0
- package/components/elements/hit/HitCard.js +7 -7
- package/components/elements/hit/HitLabels.js +2 -2
- package/components/elements/hit/HitLabels.test.js +2 -2
- package/components/elements/hit/HitOutline.d.ts +1 -0
- package/components/elements/hit/HitOutline.js +3 -3
- package/components/elements/hit/{HitQuickSearch.d.ts → HitPreview.d.ts} +3 -3
- package/components/elements/hit/{HitQuickSearch.js → HitPreview.js} +10 -4
- package/components/elements/hit/HitSummary.d.ts +2 -1
- package/components/elements/hit/HitSummary.js +6 -5
- package/components/elements/hit/aggregate/HitGraph.js +8 -8
- package/components/elements/hit/elements/AnalyticLink.d.ts +9 -0
- package/components/elements/hit/elements/AnalyticLink.js +22 -0
- package/components/elements/hit/elements/{HitUsers.d.ts → Assigned.d.ts} +3 -4
- package/components/elements/hit/elements/Assigned.js +36 -0
- package/components/elements/hit/elements/Assigned.test.d.ts +1 -0
- package/components/elements/hit/elements/Assigned.test.js +65 -0
- package/components/elements/hit/grid/AddColumnModal.js +5 -4
- package/components/elements/hit/grid/EnhancedCell.d.ts +2 -1
- package/components/elements/hit/grid/EnhancedCell.js +2 -2
- package/components/elements/hit/grid/{HitRow.d.ts → RecordRow.d.ts} +3 -2
- package/components/elements/hit/grid/{HitRow.js → RecordRow.js} +11 -9
- package/components/elements/hit/grid/{HitTable.d.ts → RecordTable.d.ts} +5 -4
- package/components/elements/hit/grid/{HitTable.js → RecordTable.js} +13 -11
- package/components/elements/hit/outlines/DefaultOutline.js +1 -1
- package/components/elements/hit/related/RelatedRecords.js +63 -0
- package/components/elements/{hit/HitComments.d.ts → record/RecordComments.d.ts} +5 -4
- package/components/elements/{hit/HitComments.js → record/RecordComments.js} +29 -28
- package/components/elements/{hit/HitContextMenu.d.ts → record/RecordContextMenu.d.ts} +3 -3
- package/components/elements/record/RecordContextMenu.js +268 -0
- package/components/elements/record/RecordContextMenu.test.d.ts +1 -0
- package/components/elements/{hit/HitContextMenu.test.js → record/RecordContextMenu.test.js} +98 -43
- package/components/elements/record/RecordRelated.d.ts +7 -0
- package/components/elements/record/RecordRelated.js +34 -0
- package/components/elements/{hit/HitWorklog.d.ts → record/RecordWorklog.d.ts} +4 -3
- package/components/elements/{hit/HitWorklog.js → record/RecordWorklog.js} +15 -13
- package/components/elements/search/FuzzySearchBar.d.ts +7 -0
- package/components/elements/search/FuzzySearchBar.js +33 -0
- package/components/elements/search/FuzzySearchBar.test.d.ts +1 -0
- package/components/elements/search/FuzzySearchBar.test.js +87 -0
- package/components/elements/view/ViewTitle.d.ts +1 -0
- package/components/elements/view/ViewTitle.js +9 -2
- package/components/hooks/useHitActions.d.ts +1 -1
- package/components/hooks/useHitActions.js +4 -4
- package/components/hooks/useMyPreferences.js +10 -1
- package/components/hooks/useMySearch.js +2 -2
- package/components/hooks/useMySitemap.js +4 -1
- package/components/hooks/useMyTheme.js +9 -2
- package/components/hooks/{useHitSelection.d.ts → useRecordSelection.d.ts} +2 -2
- package/components/hooks/{useHitSelection.js → useRecordSelection.js} +12 -33
- package/components/hooks/useRelatedRecords.d.ts +13 -0
- package/components/hooks/useRelatedRecords.js +32 -0
- package/components/routes/action/edit/ActionEditor.js +2 -2
- package/components/routes/action/view/ActionSearch.js +1 -1
- package/components/routes/advanced/QueryBuilder.js +4 -27
- package/components/routes/advanced/QueryEditor.js +3 -3
- package/components/routes/advanced/historyCompletionProvider.js +3 -3
- package/components/routes/analytics/AnalyticDetails.js +6 -54
- package/components/routes/analytics/AnalyticSearch.js +9 -18
- package/components/routes/cases/CaseViewer.d.ts +2 -0
- package/components/routes/cases/CaseViewer.js +44 -0
- package/components/routes/cases/CaseViewer.test.d.ts +1 -0
- package/components/routes/cases/CaseViewer.test.js +133 -0
- package/components/routes/cases/Cases.d.ts +2 -0
- package/components/routes/cases/Cases.js +140 -0
- package/components/routes/cases/constants.d.ts +6 -0
- package/components/routes/cases/constants.js +6 -0
- package/components/routes/cases/detail/AlertPanel.d.ts +6 -0
- package/components/routes/cases/detail/AlertPanel.js +33 -0
- package/components/routes/cases/detail/AlertPanel.test.d.ts +1 -0
- package/components/routes/cases/detail/AlertPanel.test.js +107 -0
- package/components/routes/cases/detail/CaseDashboard.d.ts +7 -0
- package/components/routes/cases/detail/CaseDashboard.js +66 -0
- package/components/routes/cases/detail/CaseDashboard.test.d.ts +1 -0
- package/components/routes/cases/detail/CaseDashboard.test.js +218 -0
- package/components/routes/cases/detail/CaseDetails.d.ts +6 -0
- package/components/routes/cases/detail/CaseDetails.js +79 -0
- package/components/routes/cases/detail/CaseDetails.test.d.ts +1 -0
- package/components/routes/cases/detail/CaseDetails.test.js +145 -0
- package/components/routes/cases/detail/CaseObservables.d.ts +6 -0
- package/components/routes/cases/detail/CaseObservables.js +142 -0
- package/components/routes/cases/detail/CaseObservables.test.d.ts +1 -0
- package/components/routes/cases/detail/CaseObservables.test.js +169 -0
- package/components/routes/cases/detail/CaseOverview.d.ts +7 -0
- package/components/routes/cases/detail/CaseOverview.js +43 -0
- package/components/routes/cases/detail/CaseRules.d.ts +7 -0
- package/components/routes/cases/detail/CaseRules.js +55 -0
- package/components/routes/cases/detail/CaseRules.test.d.ts +1 -0
- package/components/routes/cases/detail/CaseRules.test.js +238 -0
- package/components/routes/cases/detail/CaseSearch.d.ts +3 -0
- package/components/routes/cases/detail/CaseSearch.js +78 -0
- package/components/routes/cases/detail/CaseSearch.test.d.ts +1 -0
- package/components/routes/cases/detail/CaseSearch.test.js +154 -0
- package/components/routes/cases/detail/CaseSidebar.d.ts +8 -0
- package/components/routes/cases/detail/CaseSidebar.js +147 -0
- package/components/routes/cases/detail/CaseSidebar.test.d.ts +1 -0
- package/components/routes/cases/detail/CaseSidebar.test.js +155 -0
- package/components/routes/cases/detail/CaseTask.d.ts +14 -0
- package/components/routes/cases/detail/CaseTask.js +71 -0
- package/components/routes/cases/detail/CaseTask.test.d.ts +1 -0
- package/components/routes/cases/detail/CaseTask.test.js +143 -0
- package/components/routes/cases/detail/CaseTimeline.d.ts +12 -0
- package/components/routes/cases/detail/CaseTimeline.js +106 -0
- package/components/routes/cases/detail/CaseTimeline.test.d.ts +1 -0
- package/components/routes/cases/detail/CaseTimeline.test.js +320 -0
- package/components/routes/cases/detail/CreateRuleDialog.d.ts +9 -0
- package/components/routes/cases/detail/CreateRuleDialog.js +145 -0
- package/components/routes/cases/detail/CreateRuleDialog.test.d.ts +1 -0
- package/components/routes/cases/detail/CreateRuleDialog.test.js +284 -0
- package/components/routes/cases/detail/ItemPage.d.ts +6 -0
- package/components/routes/cases/detail/ItemPage.js +100 -0
- package/components/routes/cases/detail/ItemPage.test.d.ts +1 -0
- package/components/routes/cases/detail/ItemPage.test.js +238 -0
- package/components/routes/cases/detail/MarkdownPage.d.ts +8 -0
- package/components/routes/cases/detail/MarkdownPage.js +63 -0
- package/components/routes/cases/detail/MarkdownPage.test.d.ts +1 -0
- package/components/routes/cases/detail/MarkdownPage.test.js +116 -0
- package/components/routes/cases/detail/RelatedCasePanel.d.ts +6 -0
- package/components/routes/cases/detail/RelatedCasePanel.js +34 -0
- package/components/routes/cases/detail/RelatedCasePanel.test.d.ts +1 -0
- package/components/routes/cases/detail/RelatedCasePanel.test.js +115 -0
- package/components/routes/cases/detail/TaskPanel.d.ts +7 -0
- package/components/routes/cases/detail/TaskPanel.js +95 -0
- package/components/routes/cases/detail/TaskPanel.test.d.ts +1 -0
- package/components/routes/cases/detail/TaskPanel.test.js +145 -0
- package/components/routes/cases/detail/aggregates/CaseAggregate.d.ts +11 -0
- package/components/routes/cases/detail/aggregates/CaseAggregate.js +24 -0
- package/components/routes/cases/detail/aggregates/SourceAggregate.d.ts +6 -0
- package/components/routes/cases/detail/aggregates/SourceAggregate.js +26 -0
- package/components/routes/cases/detail/observables/Observable.d.ts +8 -0
- package/components/routes/cases/detail/observables/Observable.js +13 -0
- package/components/routes/cases/detail/observables/Observable.test.d.ts +1 -0
- package/components/routes/cases/detail/observables/Observable.test.js +72 -0
- package/components/routes/cases/detail/observables/ObservableTable.d.ts +7 -0
- package/components/routes/cases/detail/observables/ObservableTable.js +61 -0
- package/components/routes/cases/detail/observables/ObservableTable.test.d.ts +1 -0
- package/components/routes/cases/detail/observables/ObservableTable.test.js +85 -0
- package/components/routes/cases/detail/sidebar/CaseFolder.d.ts +22 -0
- package/components/routes/cases/detail/sidebar/CaseFolder.js +105 -0
- package/components/routes/cases/detail/sidebar/CaseFolder.test.d.ts +1 -0
- package/components/routes/cases/detail/sidebar/CaseFolder.test.js +98 -0
- package/components/routes/cases/detail/sidebar/CaseFolderContextMenu.d.ts +32 -0
- package/components/routes/cases/detail/sidebar/CaseFolderContextMenu.js +99 -0
- package/components/routes/cases/detail/sidebar/CaseFolderContextMenu.test.d.ts +1 -0
- package/components/routes/cases/detail/sidebar/CaseFolderContextMenu.test.js +117 -0
- package/components/routes/cases/detail/sidebar/FolderEntry.d.ts +25 -0
- package/components/routes/cases/detail/sidebar/FolderEntry.js +89 -0
- package/components/routes/cases/detail/sidebar/FolderEntry.test.d.ts +1 -0
- package/components/routes/cases/detail/sidebar/FolderEntry.test.js +81 -0
- package/components/routes/cases/detail/sidebar/RootDropZone.d.ts +5 -0
- package/components/routes/cases/detail/sidebar/RootDropZone.js +33 -0
- package/components/routes/cases/detail/sidebar/types.d.ts +9 -0
- package/components/routes/cases/detail/sidebar/utils.d.ts +10 -0
- package/components/routes/cases/detail/sidebar/utils.js +51 -0
- package/components/routes/cases/detail/sidebar/utils.test.d.ts +1 -0
- package/components/routes/cases/detail/sidebar/utils.test.js +82 -0
- package/components/routes/cases/detail/types.d.ts +24 -0
- package/components/routes/cases/detail/utils.d.ts +29 -0
- package/components/routes/cases/detail/utils.js +114 -0
- package/components/routes/cases/detail/utils.test.d.ts +1 -0
- package/components/routes/cases/detail/utils.test.js +144 -0
- package/components/routes/cases/hooks/useCase.d.ts +13 -0
- package/components/routes/cases/hooks/useCase.js +69 -0
- package/components/routes/cases/hooks/useCase.test.d.ts +1 -0
- package/components/routes/cases/hooks/useCase.test.js +141 -0
- package/components/routes/cases/modals/AddRecordToCaseModal.d.ts +7 -0
- package/components/routes/cases/modals/AddRecordToCaseModal.js +57 -0
- package/components/routes/cases/modals/AddRecordToCaseModal.test.d.ts +1 -0
- package/components/routes/cases/modals/AddRecordToCaseModal.test.js +309 -0
- package/components/routes/cases/modals/AddToCaseModal.d.ts +9 -0
- package/components/routes/cases/modals/AddToCaseModal.js +72 -0
- package/components/routes/cases/modals/CaseRecordRow.d.ts +9 -0
- package/components/routes/cases/modals/CaseRecordRow.js +14 -0
- package/components/routes/cases/modals/CreateCaseModal.d.ts +7 -0
- package/components/routes/cases/modals/CreateCaseModal.js +53 -0
- package/components/routes/cases/modals/CreateCaseModal.test.d.ts +1 -0
- package/components/routes/cases/modals/CreateCaseModal.test.js +319 -0
- package/components/routes/cases/modals/RenameItemModal.d.ts +9 -0
- package/components/routes/cases/modals/RenameItemModal.js +44 -0
- package/components/routes/cases/modals/ResolveModal.d.ts +7 -0
- package/components/routes/cases/modals/ResolveModal.js +120 -0
- package/components/routes/cases/modals/ResolveModal.test.d.ts +1 -0
- package/components/routes/cases/modals/ResolveModal.test.js +520 -0
- package/components/routes/cases/modals/hooks.d.ts +7 -0
- package/components/routes/cases/modals/hooks.js +40 -0
- package/components/routes/cases/modals/types.d.ts +13 -0
- package/components/routes/cases/search/CaseAssigneeFilter.d.ts +6 -0
- package/components/routes/cases/search/CaseAssigneeFilter.js +33 -0
- package/components/routes/cases/search/CaseAssigneeFilter.test.d.ts +1 -0
- package/components/routes/cases/search/CaseAssigneeFilter.test.js +127 -0
- package/components/routes/cases/search/CaseDateFilter.d.ts +13 -0
- package/components/routes/cases/search/CaseDateFilter.js +26 -0
- package/components/routes/cases/search/CaseDateFilter.test.d.ts +1 -0
- package/components/routes/cases/search/CaseDateFilter.test.js +115 -0
- package/components/routes/cases/search/CaseStatusFilter.d.ts +6 -0
- package/components/routes/cases/search/CaseStatusFilter.js +13 -0
- package/components/routes/cases/search/CaseStatusFilter.test.d.ts +1 -0
- package/components/routes/cases/search/CaseStatusFilter.test.js +86 -0
- package/components/routes/cases/utils.d.ts +3 -0
- package/components/routes/cases/utils.js +21 -0
- package/components/routes/dossiers/DossierEditor.js +2 -2
- package/components/routes/dossiers/DossierEditor.test.js +1 -1
- package/components/routes/events/EventViewer.d.ts +7 -0
- package/components/routes/events/EventViewer.js +24 -0
- package/components/routes/help/ApiDocumentation.js +1 -1
- package/components/routes/help/HitBannerDocumentation.js +1 -0
- package/components/routes/help/HitDocumentation.js +1 -3
- package/components/routes/help/OverviewDocumentation.d.ts +1 -1
- package/components/routes/help/OverviewDocumentation.js +0 -1
- package/components/routes/hits/search/InformationPane.d.ts +1 -0
- package/components/routes/hits/search/InformationPane.js +51 -64
- package/components/routes/hits/search/QuerySettings.js +2 -1
- package/components/routes/hits/search/QuerySettings.test.js +14 -9
- package/components/routes/hits/search/{HitBrowser.js → RecordBrowser.js} +11 -11
- package/components/routes/hits/search/{HitQuery.d.ts → RecordQuery.d.ts} +2 -2
- package/components/routes/hits/search/{HitQuery.js → RecordQuery.js} +6 -6
- package/components/routes/hits/search/SearchPane.js +24 -46
- package/components/routes/hits/search/ViewLink.js +4 -4
- package/components/routes/hits/search/ViewLink.test.js +8 -9
- package/components/routes/hits/search/grid/RecordGrid.d.ts +3 -0
- package/components/routes/hits/search/grid/{HitGrid.js → RecordGrid.js} +15 -15
- package/components/routes/hits/search/shared/CustomSpan.test.js +3 -4
- package/components/routes/hits/search/shared/IndexPicker.d.ts +8 -0
- package/components/routes/hits/search/shared/IndexPicker.js +21 -0
- package/components/routes/hits/search/shared/LayoutSettings.js +3 -3
- package/components/routes/hits/search/shared/SearchActionMenu.js +3 -9
- package/components/routes/hits/view/HitViewer.js +13 -14
- package/components/routes/home/ViewCard.js +47 -41
- package/components/routes/overviews/OverviewViewer.js +4 -4
- package/components/routes/views/ViewComposer.js +49 -23
- package/locales/en/translation.json +171 -27
- package/locales/fr/translation.json +169 -25
- package/models/WithMetadata.d.ts +2 -1
- package/models/entities/generated/Analytic.d.ts +0 -3
- package/models/entities/generated/ApiType.d.ts +3 -1
- package/models/entities/generated/AttachmentsFile.d.ts +12 -0
- package/models/entities/generated/Case.d.ts +29 -0
- package/models/entities/generated/DestinationOriginal.d.ts +19 -0
- package/models/entities/generated/ECSEvent.d.ts +31 -0
- package/models/entities/generated/EmailAttachment.d.ts +8 -0
- package/models/entities/generated/EmailParent.d.ts +19 -0
- package/models/entities/generated/Enrichments.d.ts +7 -0
- package/models/entities/generated/EnrichmentsIndicator.d.ts +21 -0
- package/models/entities/generated/Event.d.ts +80 -26
- package/models/entities/generated/EventCloud.d.ts +20 -0
- package/models/entities/generated/EventDestination.d.ts +23 -0
- package/models/entities/generated/EventEmail.d.ts +30 -0
- package/models/entities/generated/EventFile.d.ts +36 -0
- package/models/entities/generated/EventHowler.d.ts +42 -0
- package/models/entities/generated/EventHttp.d.ts +11 -0
- package/models/entities/generated/EventObserver.d.ts +21 -0
- package/models/entities/generated/EventOrganization.d.ts +7 -0
- package/models/entities/generated/EventProcess.d.ts +34 -0
- package/models/entities/generated/EventSource.d.ts +23 -0
- package/models/entities/generated/EventThreat.d.ts +21 -0
- package/models/entities/generated/EventTls.d.ts +12 -0
- package/models/entities/generated/Hit.d.ts +3 -2
- package/models/entities/generated/Howler.d.ts +0 -5
- package/models/entities/generated/HttpResponse.d.ts +11 -0
- package/models/entities/generated/Item.d.ts +12 -0
- package/models/entities/generated/ObserverIngress.d.ts +9 -0
- package/models/entities/generated/Rule.d.ts +8 -9
- package/models/entities/generated/Task.d.ts +10 -0
- package/models/entities/generated/Threat.d.ts +2 -2
- package/models/entities/generated/{Enrichment.d.ts → ThreatEnrichment.d.ts} +1 -1
- package/models/entities/generated/View.d.ts +1 -0
- package/models/socket/CaseUpdate.d.ts +5 -0
- package/models/socket/ViewersUpdate.d.ts +4 -0
- package/package.json +115 -94
- package/plugins/clue/components/ClueTypography.js +2 -2
- package/plugins/clue/index.d.ts +1 -1
- package/plugins/clue/index.js +0 -1
- package/plugins/clue/utils.d.ts +2 -1
- package/tests/mocks.d.ts +11 -1
- package/tests/mocks.js +12 -7
- package/tests/server-handlers.js +11 -1
- package/tests/utils.d.ts +4 -0
- package/tests/utils.js +21 -0
- package/utils/classificationParser.d.ts +195 -0
- package/utils/classificationParser.js +680 -0
- package/utils/constants.d.ts +4 -3
- package/utils/constants.js +6 -0
- package/utils/recordFunctions.d.ts +3 -0
- package/utils/recordFunctions.js +8 -0
- package/utils/recordFunctions.test.d.ts +1 -0
- package/utils/{hitFunctions.test.js → recordFunctions.test.js} +1 -1
- package/utils/socketUtils.d.ts +14 -0
- package/utils/socketUtils.js +17 -1
- package/utils/socketUtils.test.js +49 -16
- package/utils/typeUtils.d.ts +7 -0
- package/utils/typeUtils.js +27 -0
- package/utils/viewUtils.js +3 -0
- package/api/analytic/rules.d.ts +0 -4
- package/api/analytic/rules.js +0 -8
- package/components/app/providers/HitProvider.d.ts +0 -22
- package/components/elements/display/icons/BundleButton.d.ts +0 -6
- package/components/elements/display/icons/BundleButton.js +0 -32
- package/components/elements/hit/HitContextMenu.js +0 -239
- package/components/elements/hit/HitRelated.d.ts +0 -6
- package/components/elements/hit/HitRelated.js +0 -7
- package/components/elements/hit/elements/HitUsers.js +0 -33
- package/components/routes/advanced/RuleModal.d.ts +0 -7
- package/components/routes/advanced/RuleModal.js +0 -83
- package/components/routes/analytics/RuleView.d.ts +0 -8
- package/components/routes/analytics/RuleView.js +0 -48
- package/components/routes/help/BundleDocumentation.d.ts +0 -3
- package/components/routes/help/BundleDocumentation.js +0 -12
- package/components/routes/help/markdown/en/bundles.md.js +0 -1
- package/components/routes/help/markdown/fr/bundles.md.js +0 -1
- package/components/routes/hits/search/BundleScroller.d.ts +0 -2
- package/components/routes/hits/search/BundleScroller.js +0 -6
- package/components/routes/hits/search/grid/HitGrid.d.ts +0 -3
- package/components/routes/hits/search/shared/BundleParentMenu.d.ts +0 -6
- package/components/routes/hits/search/shared/BundleParentMenu.js +0 -32
- package/utils/hitFunctions.d.ts +0 -2
- package/utils/hitFunctions.js +0 -8
- /package/{components/app/providers/HitSearchProvider.test.d.ts → api/socket/viewers.test.d.ts} +0 -0
- /package/components/{elements/hit/HitContextMenu.test.d.ts → app/providers/RecordSearchProvider.test.d.ts} +0 -0
- /package/{utils/hitFunctions.test.d.ts → components/app/providers/UserListProvider.test.d.ts} +0 -0
- /package/components/{routes/overviews/OverviewEditor.d.ts → elements/MarkdownEditor.d.ts} +0 -0
- /package/components/elements/hit/{HitDetails.d.ts → related/RelatedRecords.d.ts} +0 -0
- /package/components/routes/hits/search/{HitBrowser.d.ts → RecordBrowser.d.ts} +0 -0
|
@@ -0,0 +1,680 @@
|
|
|
1
|
+
// pulled from https://github.com/CybercentreCanada/assemblyline-ui-frontend/blob/master/src/helpers/classificationParser.ts
|
|
2
|
+
export const defaultParts = {
|
|
3
|
+
lvlIdx: 0,
|
|
4
|
+
lvl: '',
|
|
5
|
+
req: [],
|
|
6
|
+
groups: [],
|
|
7
|
+
subgroups: []
|
|
8
|
+
};
|
|
9
|
+
export const defaultDisabled = {
|
|
10
|
+
groups: [],
|
|
11
|
+
levels: []
|
|
12
|
+
};
|
|
13
|
+
export class InvalidClassification extends Error {
|
|
14
|
+
}
|
|
15
|
+
export const getLevelText = (lvl, c12nDef, format, isMobile) => {
|
|
16
|
+
let text = null;
|
|
17
|
+
if (c12nDef != null && lvl != null) {
|
|
18
|
+
text = c12nDef.levels_map[lvl.toString()];
|
|
19
|
+
}
|
|
20
|
+
if (text === undefined || text == null) {
|
|
21
|
+
//ERROR: `Classification level number '${lvl}' was not found in your classification definition.`
|
|
22
|
+
/* eslint-disable no-console */
|
|
23
|
+
console.error(`[classificationParser] Classification level number '${lvl}' was not found in your classification definition.`);
|
|
24
|
+
/* eslint-enable no-console */
|
|
25
|
+
return 'INVALID';
|
|
26
|
+
}
|
|
27
|
+
if (format === 'long' && !isMobile) {
|
|
28
|
+
return c12nDef.levels_map_stl[text];
|
|
29
|
+
}
|
|
30
|
+
return text;
|
|
31
|
+
};
|
|
32
|
+
const getLevelIndex = (c12n, c12nDef) => {
|
|
33
|
+
// assumes c12nDef is coming from the Assemblyline API and all values will be in UPPER case
|
|
34
|
+
let retIndex = null;
|
|
35
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars
|
|
36
|
+
const [level, unused, _x] = c12n?.split(/\/\/(.*)/) ?? [null, null, null];
|
|
37
|
+
const c12nLvl = level?.toUpperCase();
|
|
38
|
+
if (c12nDef.levels_map[c12nLvl] !== undefined) {
|
|
39
|
+
retIndex = c12nDef.levels_map[c12nLvl];
|
|
40
|
+
}
|
|
41
|
+
else if (c12nDef.levels_map_lts[c12nLvl] !== undefined) {
|
|
42
|
+
retIndex = c12nDef.levels_map[c12nDef.levels_map_lts[c12nLvl]];
|
|
43
|
+
}
|
|
44
|
+
else if (c12nDef.levels_aliases[c12nLvl] !== undefined) {
|
|
45
|
+
retIndex = c12nDef.levels_map[c12nDef.levels_aliases[c12nLvl]];
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
// ERROR: `Classification level '${level}' was not found in your classification definition.`
|
|
49
|
+
retIndex = -1;
|
|
50
|
+
/* eslint-disable no-console */
|
|
51
|
+
console.error(`[classificationParser] Classification level '${level}' was not found in your classification definition.`);
|
|
52
|
+
/* eslint-enable no-console */
|
|
53
|
+
}
|
|
54
|
+
if (typeof retIndex !== 'number') {
|
|
55
|
+
retIndex = parseInt(retIndex);
|
|
56
|
+
}
|
|
57
|
+
return [retIndex, unused];
|
|
58
|
+
};
|
|
59
|
+
const getRequired = (c12n, c12nDef, format, isMobile) => {
|
|
60
|
+
const returnSet = [];
|
|
61
|
+
const unused = [];
|
|
62
|
+
if (!c12n) {
|
|
63
|
+
return [returnSet.sort(), unused];
|
|
64
|
+
}
|
|
65
|
+
const partSet = c12n.toUpperCase().split('/');
|
|
66
|
+
for (const p of partSet) {
|
|
67
|
+
if (p in c12nDef.access_req_map_lts) {
|
|
68
|
+
returnSet.push(c12nDef.access_req_map_lts[p]);
|
|
69
|
+
}
|
|
70
|
+
else if (p in c12nDef.access_req_map_stl) {
|
|
71
|
+
returnSet.push(p);
|
|
72
|
+
}
|
|
73
|
+
else if (p in c12nDef.access_req_aliases) {
|
|
74
|
+
for (const a of c12nDef.access_req_aliases[p]) {
|
|
75
|
+
returnSet.push(a);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
unused.push(p);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
if (format === 'long' && !isMobile) {
|
|
83
|
+
const out = [];
|
|
84
|
+
for (const r of returnSet) {
|
|
85
|
+
out.push(c12nDef.access_req_map_stl[r]);
|
|
86
|
+
}
|
|
87
|
+
return [out.sort(), unused];
|
|
88
|
+
}
|
|
89
|
+
return [returnSet.sort(), unused];
|
|
90
|
+
};
|
|
91
|
+
const getGroups = (groupParts, c12nDef, format, isMobile, autoSelect = false) => {
|
|
92
|
+
// Note: this function assumes c12nDef is coming from the Assemblyline API and all values will be in UPPER case
|
|
93
|
+
// and that this function is called AFTER getLevelIndex and getRequired functions with the used values passed in.
|
|
94
|
+
let g1Set = new Set();
|
|
95
|
+
let g2Set = new Set();
|
|
96
|
+
let others = new Set();
|
|
97
|
+
const groups = [];
|
|
98
|
+
const subgroups = [];
|
|
99
|
+
for (const grpPart of groupParts) {
|
|
100
|
+
if (!grpPart) {
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
const gp = grpPart.toUpperCase();
|
|
104
|
+
// if there is a rel marking we know we have groups
|
|
105
|
+
if (gp.startsWith('REL ')) {
|
|
106
|
+
const tempGroups = new Set(gp.replace('REL TO ', '').replace('REL ', '').split(','));
|
|
107
|
+
for (let tg of tempGroups) {
|
|
108
|
+
tg = tg.trim();
|
|
109
|
+
for (let tsg of tg.split('/')) {
|
|
110
|
+
tsg = tsg.trim();
|
|
111
|
+
groups.push(tsg);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
// if there is not a rel marking we either have a subgroup or a
|
|
117
|
+
// solitary_display_name alias for a group, which we will filter out later
|
|
118
|
+
subgroups.push(gp);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
for (const g of groups) {
|
|
122
|
+
if (g in c12nDef.groups_map_lts) {
|
|
123
|
+
g1Set.add(c12nDef.groups_map_lts[g]);
|
|
124
|
+
}
|
|
125
|
+
else if (g in c12nDef.groups_map_stl) {
|
|
126
|
+
g1Set.add(g);
|
|
127
|
+
}
|
|
128
|
+
else if (g in c12nDef.groups_aliases) {
|
|
129
|
+
for (const a of c12nDef.groups_aliases[g]) {
|
|
130
|
+
g1Set.add(a);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
others.add(g);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
for (const g of subgroups) {
|
|
138
|
+
if (g in c12nDef.subgroups_map_lts) {
|
|
139
|
+
g2Set.add(c12nDef.subgroups_map_lts[g]);
|
|
140
|
+
}
|
|
141
|
+
else if (g in c12nDef.subgroups_map_stl) {
|
|
142
|
+
g2Set.add(g);
|
|
143
|
+
}
|
|
144
|
+
else if (g in c12nDef.subgroups_aliases) {
|
|
145
|
+
for (const sa of c12nDef.subgroups_aliases[g]) {
|
|
146
|
+
g2Set.add(sa);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
// Here is where we catch any solitary_display_name aliases for groups
|
|
150
|
+
// within the subgroup sections
|
|
151
|
+
else if (g in c12nDef.groups_aliases) {
|
|
152
|
+
// Check that this alias is actually a solitary name, don't
|
|
153
|
+
// let other aliases leak outside the REL marking
|
|
154
|
+
const grps = c12nDef.groups_aliases[g];
|
|
155
|
+
if (grps.length > 1) {
|
|
156
|
+
// ERROR: Unclear use of alias ${g}
|
|
157
|
+
/* eslint-disable no-console */
|
|
158
|
+
console.error(`[classificationParser] Unclear use of alias ${g}`);
|
|
159
|
+
/* eslint-enable no-console */
|
|
160
|
+
// just default to first below
|
|
161
|
+
}
|
|
162
|
+
g1Set.add(grps[0]);
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
// ERROR: Unknown component ${g}
|
|
166
|
+
// just add it as is to the list
|
|
167
|
+
g1Set.add(g);
|
|
168
|
+
/* eslint-disable no-console */
|
|
169
|
+
console.error(`[classificationParser] Unknown component ${g}`);
|
|
170
|
+
/* eslint-enable no-console */
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
// If dynamic groups are active all remaining parts should be groups found under a
|
|
174
|
+
// REL TO marking that we can merge in with the other groups
|
|
175
|
+
if (c12nDef.dynamic_groups) {
|
|
176
|
+
for (const o of others) {
|
|
177
|
+
g1Set.add(o);
|
|
178
|
+
}
|
|
179
|
+
others = new Set();
|
|
180
|
+
}
|
|
181
|
+
// Check if there are any required group assignments
|
|
182
|
+
for (const subgroup of g2Set) {
|
|
183
|
+
const required = c12nDef.params_map?.[subgroup]?.require_group;
|
|
184
|
+
if (!!required) {
|
|
185
|
+
g1Set.add(required);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
// Check if there are any forbidden group assignments
|
|
189
|
+
for (const subgroup of g2Set) {
|
|
190
|
+
const limitedToGroup = c12nDef.params_map?.[subgroup]?.limited_to_group;
|
|
191
|
+
if (limitedToGroup !== null && limitedToGroup !== undefined) {
|
|
192
|
+
if (g1Set.size > 1 || (g1Set.size === 1 && !g1Set.has(limitedToGroup))) {
|
|
193
|
+
// ERROR: `Subgroup ${subgroup} is limited to group ${limitedToGroup} (found: ${Array.from(g1Set).toString()})`
|
|
194
|
+
// just log the error and leave it
|
|
195
|
+
/* eslint-disable no-console */
|
|
196
|
+
console.error(`[classificationParser] Subgroup ${subgroup} is limited to group ${limitedToGroup} (found: ${Array.from(g1Set).toString()})`);
|
|
197
|
+
/* eslint-enable no-console */
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
// Do auto select
|
|
202
|
+
if (!!autoSelect && !!g1Set) {
|
|
203
|
+
g1Set = new Set([...g1Set, ...c12nDef.groups_auto_select_short]);
|
|
204
|
+
}
|
|
205
|
+
if (!!autoSelect && !!g2Set) {
|
|
206
|
+
g2Set = new Set([...g2Set, ...c12nDef.subgroups_auto_select_short]);
|
|
207
|
+
}
|
|
208
|
+
// swap to long format if required
|
|
209
|
+
if (format === 'long' && !isMobile) {
|
|
210
|
+
const g1Out = [];
|
|
211
|
+
for (const gr of g1Set) {
|
|
212
|
+
g1Out.push(gr in c12nDef.groups_map_stl ? c12nDef.groups_map_stl[gr] : gr);
|
|
213
|
+
}
|
|
214
|
+
const g2Out = [];
|
|
215
|
+
for (const sgr of g2Set) {
|
|
216
|
+
g2Out.push(c12nDef.subgroups_map_stl[sgr]);
|
|
217
|
+
}
|
|
218
|
+
return { groups: g1Out.sort(), subgroups: g2Out.sort(), others: Array.from(others).sort() };
|
|
219
|
+
}
|
|
220
|
+
return { groups: Array.from(g1Set).sort(), subgroups: Array.from(g2Set).sort(), others: Array.from(others).sort() };
|
|
221
|
+
};
|
|
222
|
+
export const getParts = (c12n, c12nDef, format, isMobile) => {
|
|
223
|
+
const [lvlIdx, unused] = getLevelIndex(c12n, c12nDef);
|
|
224
|
+
const [req, unusedParts] = getRequired(unused, c12nDef, format, isMobile);
|
|
225
|
+
const { groups, subgroups, others } = getGroups(unusedParts, c12nDef, format, isMobile);
|
|
226
|
+
if (others.length > 0) {
|
|
227
|
+
// ERROR: `Unparsable classification parts: ${others.join(',')}`)
|
|
228
|
+
// just log the error and leave it
|
|
229
|
+
/* eslint-disable no-console */
|
|
230
|
+
console.error(`[classificationParser] Unparsable classification parts: ${others.join(',')}`);
|
|
231
|
+
/* eslint-enable no-console */
|
|
232
|
+
}
|
|
233
|
+
return {
|
|
234
|
+
lvlIdx,
|
|
235
|
+
lvl: getLevelText(lvlIdx, c12nDef, format, isMobile),
|
|
236
|
+
req: req,
|
|
237
|
+
groups: groups,
|
|
238
|
+
subgroups: subgroups
|
|
239
|
+
};
|
|
240
|
+
};
|
|
241
|
+
export const canSeeRequired = (user_req, req) => {
|
|
242
|
+
// user's require values must be a superset of given require values
|
|
243
|
+
// (ie. user must have all of the required values)
|
|
244
|
+
if (req.length <= 0)
|
|
245
|
+
return true;
|
|
246
|
+
const userSet = new Set(user_req);
|
|
247
|
+
const reqSet = new Set(req);
|
|
248
|
+
for (const elem of reqSet) {
|
|
249
|
+
if (!userSet.has(elem)) {
|
|
250
|
+
return false;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
return true;
|
|
254
|
+
};
|
|
255
|
+
export const canSeeGroups = (user_groups, groups) => {
|
|
256
|
+
// user's groups must have an intersection between required groups
|
|
257
|
+
// (ie. user must have at least one of the given groups)
|
|
258
|
+
if (groups.length === 0)
|
|
259
|
+
return true;
|
|
260
|
+
const groupSet = new Set(groups);
|
|
261
|
+
const userSet = new Set(user_groups);
|
|
262
|
+
for (const elem of groupSet) {
|
|
263
|
+
if (userSet.has(elem)) {
|
|
264
|
+
return true;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
return false;
|
|
268
|
+
};
|
|
269
|
+
/**
|
|
270
|
+
* Normalize a given classification by applying the rules defined in the classification definition.
|
|
271
|
+
* This function will remove any invalid parts and add missing parts to the classification.
|
|
272
|
+
* It will also ensure that the display of the classification is always done the same way
|
|
273
|
+
*
|
|
274
|
+
* Note: This function mutates the passed in `parts` parameter.
|
|
275
|
+
*
|
|
276
|
+
* @param parts - `ClassificationParts` object containing the parsed classification components
|
|
277
|
+
* @param c12nDef - ClassificationDefinition returned by the API server
|
|
278
|
+
* @param format - return results in `long` or `short` format
|
|
279
|
+
* @param isMobile - `true`/`false` if the results should be returned for display on a mobile device
|
|
280
|
+
* @param skipAutoSelect - `true`/`false` skip auto selecting required groups
|
|
281
|
+
*
|
|
282
|
+
* @returns A normalized version of the original classification
|
|
283
|
+
*
|
|
284
|
+
*/
|
|
285
|
+
export const normalizedClassification = (parts, c12nDef, format, isMobile, skipAutoSelect = false) => {
|
|
286
|
+
if (!c12nDef.enforce || !!c12nDef.invalid_mode)
|
|
287
|
+
return c12nDef.UNRESTRICTED;
|
|
288
|
+
const longFormat = format === 'short' || !!isMobile ? false : true;
|
|
289
|
+
const groupDelim = !!longFormat ? 'REL TO ' : 'REL ';
|
|
290
|
+
const { lvlIdx, lvl } = parts;
|
|
291
|
+
let { groups, subgroups, req } = parts;
|
|
292
|
+
// convert to correct format
|
|
293
|
+
req = req.map(r => {
|
|
294
|
+
if (!!longFormat) {
|
|
295
|
+
return c12nDef.access_req_map_stl[r] || r;
|
|
296
|
+
}
|
|
297
|
+
return c12nDef.access_req_map_lts[r] || r;
|
|
298
|
+
});
|
|
299
|
+
groups = groups.map(g => {
|
|
300
|
+
if (!!longFormat) {
|
|
301
|
+
return c12nDef.groups_map_stl[g] || g;
|
|
302
|
+
}
|
|
303
|
+
return c12nDef.groups_map_lts[g] || g;
|
|
304
|
+
});
|
|
305
|
+
subgroups = subgroups.map(g => {
|
|
306
|
+
if (!!longFormat) {
|
|
307
|
+
return c12nDef.subgroups_map_stl[g] || g;
|
|
308
|
+
}
|
|
309
|
+
return c12nDef.subgroups_map_lts[g] || g;
|
|
310
|
+
});
|
|
311
|
+
// 1. Check for all required items if they need a specific level
|
|
312
|
+
let out = lvl;
|
|
313
|
+
let requiredLvlIdx = 0;
|
|
314
|
+
for (const r of req) {
|
|
315
|
+
const rl = !!c12nDef.params_map?.[r]?.require_lvl ? c12nDef.params_map[r].require_lvl : 0;
|
|
316
|
+
requiredLvlIdx = Math.max(requiredLvlIdx, rl);
|
|
317
|
+
}
|
|
318
|
+
out = getLevelText(Math.max(lvlIdx, requiredLvlIdx), c12nDef, format, isMobile);
|
|
319
|
+
// 2. Check for all required items if they should be shown inside the groups display part
|
|
320
|
+
const reqGrp = new Set();
|
|
321
|
+
for (const r of req) {
|
|
322
|
+
if (!!c12nDef.params_map[r]?.is_required_group) {
|
|
323
|
+
reqGrp.add(r);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
const tempReq = Array.from(new Set([...req].filter(x => !reqGrp.has(x))));
|
|
327
|
+
if (tempReq.length > 0) {
|
|
328
|
+
out += '//' + tempReq.sort().join('/');
|
|
329
|
+
}
|
|
330
|
+
if (reqGrp.size > 0) {
|
|
331
|
+
out += '//' + Array.from(reqGrp).sort().join('/');
|
|
332
|
+
}
|
|
333
|
+
// 3. Add auto-selected subgroups
|
|
334
|
+
let tempSubGroups = [...subgroups];
|
|
335
|
+
if (!!longFormat) {
|
|
336
|
+
if (subgroups.length > 0 && c12nDef.subgroups_auto_select.length > 0 && !skipAutoSelect) {
|
|
337
|
+
tempSubGroups = Array.from(new Set([...subgroups, ...c12nDef.subgroups_auto_select])).sort();
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
else {
|
|
341
|
+
if (subgroups.length > 0 && c12nDef.subgroups_auto_select_short.length > 0 && !skipAutoSelect) {
|
|
342
|
+
tempSubGroups = Array.from(new Set([...subgroups, ...c12nDef.subgroups_auto_select_short])).sort();
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
// 4. For every subgroup, check if the subgroup requires or is limited to a specific group
|
|
346
|
+
let tempGroups = [];
|
|
347
|
+
for (const sg of tempSubGroups) {
|
|
348
|
+
const rGrp = c12nDef.params_map[sg]?.require_group;
|
|
349
|
+
if (!!rGrp) {
|
|
350
|
+
tempGroups.push(rGrp);
|
|
351
|
+
}
|
|
352
|
+
const limToGrp = c12nDef.params_map[sg]?.limited_to_group;
|
|
353
|
+
if (!!limToGrp) {
|
|
354
|
+
if (limToGrp in tempGroups) {
|
|
355
|
+
tempGroups = [limToGrp];
|
|
356
|
+
}
|
|
357
|
+
else {
|
|
358
|
+
tempGroups = [];
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
for (const g of tempGroups) {
|
|
363
|
+
if (!!longFormat) {
|
|
364
|
+
groups.push(c12nDef.groups_map_stl[g] || g);
|
|
365
|
+
}
|
|
366
|
+
else {
|
|
367
|
+
groups.push(c12nDef.groups_map_lts[g] || g);
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
groups = Array.from(new Set(groups));
|
|
371
|
+
// 5. Add auto-selected groups
|
|
372
|
+
if (!!longFormat) {
|
|
373
|
+
if (groups.length > 0 && c12nDef.groups_auto_select.length > 0 && !skipAutoSelect) {
|
|
374
|
+
groups = Array.from(new Set([...groups, ...c12nDef.groups_auto_select])).sort();
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
else {
|
|
378
|
+
if (groups.length > 0 && c12nDef.groups_auto_select_short.length > 0 && !skipAutoSelect) {
|
|
379
|
+
groups = Array.from(new Set([...groups, ...c12nDef.groups_auto_select_short])).sort();
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
if (groups.length > 0) {
|
|
383
|
+
groups = groups.sort();
|
|
384
|
+
out += reqGrp.size > 0 ? '/' : '//';
|
|
385
|
+
if (groups.length === 1) {
|
|
386
|
+
// 6. If only one group, check if it has a solitary display name.
|
|
387
|
+
const grp = groups[0];
|
|
388
|
+
const displayName = c12nDef.params_map[grp]?.solitary_display_name || grp;
|
|
389
|
+
out += displayName !== grp ? displayName : groupDelim + grp;
|
|
390
|
+
}
|
|
391
|
+
else {
|
|
392
|
+
if (!longFormat) {
|
|
393
|
+
// 7. In short format mode, check if there is an alias that can replace multiple groups
|
|
394
|
+
for (const [alias, values] of Object.entries(c12nDef.groups_aliases)) {
|
|
395
|
+
if (values.length > 1) {
|
|
396
|
+
if (JSON.stringify(values.sort()) === JSON.stringify(groups)) {
|
|
397
|
+
groups = [alias];
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
out += groupDelim + groups.sort().join(', ');
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
if (tempSubGroups.length > 0) {
|
|
406
|
+
if (groups.length > 0 || reqGrp.size > 0) {
|
|
407
|
+
out += '/';
|
|
408
|
+
}
|
|
409
|
+
else {
|
|
410
|
+
out += '//';
|
|
411
|
+
}
|
|
412
|
+
out += tempSubGroups.sort().join('/');
|
|
413
|
+
}
|
|
414
|
+
return out;
|
|
415
|
+
};
|
|
416
|
+
const levelList = (c12nDef) => {
|
|
417
|
+
const out = [];
|
|
418
|
+
for (const i in c12nDef.levels_map) {
|
|
419
|
+
if (!isNaN(parseInt(i))) {
|
|
420
|
+
out.push(c12nDef.levels_map[i]);
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
return out;
|
|
424
|
+
};
|
|
425
|
+
export const defaultClassificationValidator = {
|
|
426
|
+
disabled: defaultDisabled,
|
|
427
|
+
parts: defaultParts
|
|
428
|
+
};
|
|
429
|
+
/**
|
|
430
|
+
* Applies the Level, Require and Group rules and returns valid and invalid options based on the given input
|
|
431
|
+
*
|
|
432
|
+
* @param parts - `ClassificationParts` object containing the parsed classification components
|
|
433
|
+
* @param c12nDef - ClassificationDefinition returned by the API server
|
|
434
|
+
* @param format - return results in `long` or `short` format
|
|
435
|
+
* @param isMobile - `true`/`false` if the results should be returned for display on a mobile device
|
|
436
|
+
* @param userClassification - `true`/`false` if to apply `auto select` based on the user
|
|
437
|
+
*
|
|
438
|
+
* @returns The most restrictive classification that we could create out of the two
|
|
439
|
+
*
|
|
440
|
+
*/
|
|
441
|
+
export const applyClassificationRules = (parts, c12nDef, format, isMobile, userClassification = false) => {
|
|
442
|
+
const longFormat = format === 'short' || !!isMobile ? false : true;
|
|
443
|
+
const requireLvl = {};
|
|
444
|
+
const limitedToGroup = {};
|
|
445
|
+
const requireGroup = {};
|
|
446
|
+
const partsToCheck = ['req', 'groups', 'subgroups'];
|
|
447
|
+
const retParts = { ...parts };
|
|
448
|
+
const disabledList = {
|
|
449
|
+
levels: [],
|
|
450
|
+
groups: []
|
|
451
|
+
};
|
|
452
|
+
for (const item in c12nDef.params_map) {
|
|
453
|
+
if ({}.hasOwnProperty.call(c12nDef.params_map, item)) {
|
|
454
|
+
const data = c12nDef.params_map[item];
|
|
455
|
+
if ('require_lvl' in data) {
|
|
456
|
+
requireLvl[item] = data.require_lvl;
|
|
457
|
+
}
|
|
458
|
+
if ('limited_to_group' in data) {
|
|
459
|
+
limitedToGroup[item] = data.limited_to_group;
|
|
460
|
+
}
|
|
461
|
+
if ('require_group' in data) {
|
|
462
|
+
requireGroup[item] = data.require_group;
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
for (const partName in partsToCheck) {
|
|
467
|
+
if ({}.hasOwnProperty.call(partsToCheck, partName)) {
|
|
468
|
+
const part = retParts[partsToCheck[partName]];
|
|
469
|
+
for (const value of part) {
|
|
470
|
+
let triggerAutoSelect = false;
|
|
471
|
+
if (value) {
|
|
472
|
+
if (value in requireLvl) {
|
|
473
|
+
if (retParts.lvlIdx < requireLvl[value]) {
|
|
474
|
+
retParts.lvlIdx = requireLvl[value];
|
|
475
|
+
retParts.lvl = getLevelText(requireLvl[value], c12nDef, format, isMobile);
|
|
476
|
+
}
|
|
477
|
+
const levels = levelList(c12nDef);
|
|
478
|
+
for (const l of levels) {
|
|
479
|
+
if (c12nDef.levels_map[l] < requireLvl[value]) {
|
|
480
|
+
disabledList.levels.push(l);
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
if (value in requireGroup) {
|
|
485
|
+
const valueLong = c12nDef.groups_map_stl[requireGroup[value]] || requireGroup[value];
|
|
486
|
+
const valueShort = c12nDef.groups_map_lts[requireGroup[value]] || requireGroup[value];
|
|
487
|
+
if (!retParts.groups.includes(valueLong) && !retParts.groups.includes(valueShort)) {
|
|
488
|
+
retParts.groups.push(valueShort);
|
|
489
|
+
for (const group of c12nDef.groups_auto_select) {
|
|
490
|
+
const gLong = c12nDef.groups_map_stl[group] || group;
|
|
491
|
+
const gShort = c12nDef.groups_map_lts[group] || group;
|
|
492
|
+
if (!retParts.groups.includes(gShort) && !retParts.groups.includes(gLong)) {
|
|
493
|
+
retParts.groups.push(group);
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
if (value in limitedToGroup) {
|
|
499
|
+
for (const gShort in c12nDef.groups_map_stl) {
|
|
500
|
+
const lgShort = c12nDef.groups_map_lts[limitedToGroup[value]] || limitedToGroup[value];
|
|
501
|
+
if (gShort !== lgShort) {
|
|
502
|
+
const gLong = c12nDef.groups_map_stl[gShort];
|
|
503
|
+
disabledList.groups.push(gShort);
|
|
504
|
+
if (retParts.groups.includes(gShort)) {
|
|
505
|
+
retParts.groups.splice(retParts.groups.indexOf(gShort), 1);
|
|
506
|
+
}
|
|
507
|
+
else if (retParts.groups.includes(gLong)) {
|
|
508
|
+
retParts.groups.splice(retParts.groups.indexOf(gLong), 1);
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
if (!userClassification && partsToCheck[partName] === 'groups') {
|
|
514
|
+
triggerAutoSelect = true;
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
if (triggerAutoSelect) {
|
|
518
|
+
for (const group of c12nDef.groups_auto_select) {
|
|
519
|
+
const gLong = c12nDef.groups_map_stl[group] || group;
|
|
520
|
+
const gShort = c12nDef.groups_map_lts[group] || group;
|
|
521
|
+
if (!retParts.groups.includes(gLong) && !retParts.groups.includes(gShort)) {
|
|
522
|
+
retParts.groups.push(group);
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
// Sort all lists and format all returns
|
|
530
|
+
retParts.req = retParts.req.sort().map(r => {
|
|
531
|
+
if (!!longFormat) {
|
|
532
|
+
return c12nDef.access_req_map_stl[r] || r;
|
|
533
|
+
}
|
|
534
|
+
return c12nDef.access_req_map_lts[r] || r;
|
|
535
|
+
});
|
|
536
|
+
retParts.groups = retParts.groups.sort().map(g => {
|
|
537
|
+
if (!!longFormat) {
|
|
538
|
+
return c12nDef.groups_map_stl[g] || g;
|
|
539
|
+
}
|
|
540
|
+
return c12nDef.groups_map_lts[g] || g;
|
|
541
|
+
});
|
|
542
|
+
retParts.subgroups = retParts.subgroups.sort().map(sg => {
|
|
543
|
+
if (!!longFormat) {
|
|
544
|
+
return c12nDef.subgroups_map_stl[sg] || sg;
|
|
545
|
+
}
|
|
546
|
+
return c12nDef.subgroups_map_lts[sg] || sg;
|
|
547
|
+
});
|
|
548
|
+
disabledList.groups = disabledList.groups.sort().map(g => {
|
|
549
|
+
if (!!longFormat) {
|
|
550
|
+
return c12nDef.groups_map_stl[g] || g;
|
|
551
|
+
}
|
|
552
|
+
return c12nDef.groups_map_lts[g] || g;
|
|
553
|
+
});
|
|
554
|
+
disabledList.levels = disabledList.levels.sort().map(l => {
|
|
555
|
+
if (!!longFormat) {
|
|
556
|
+
return c12nDef.levels_map_stl[l] || l;
|
|
557
|
+
}
|
|
558
|
+
return c12nDef.levels_map_lts[l] || l;
|
|
559
|
+
});
|
|
560
|
+
if (!!longFormat) {
|
|
561
|
+
retParts.lvl = c12nDef.levels_map_stl[retParts.lvl] || retParts.lvl;
|
|
562
|
+
}
|
|
563
|
+
else {
|
|
564
|
+
retParts.lvl = c12nDef.levels_map_lts[retParts.lvl] || retParts.lvl;
|
|
565
|
+
}
|
|
566
|
+
return {
|
|
567
|
+
disabled: disabledList,
|
|
568
|
+
parts: retParts
|
|
569
|
+
};
|
|
570
|
+
};
|
|
571
|
+
/**
|
|
572
|
+
* Combines groups to find the maximum
|
|
573
|
+
*
|
|
574
|
+
* @param grps1 - First groups
|
|
575
|
+
* @param grps2 - Second groups
|
|
576
|
+
*
|
|
577
|
+
* @returns The a combination of the given groups
|
|
578
|
+
*
|
|
579
|
+
*/
|
|
580
|
+
const getMaxGroups = (grps1, grps2) => {
|
|
581
|
+
let groups = new Set();
|
|
582
|
+
if (grps1.length > 0 && grps2.length > 0) {
|
|
583
|
+
// intersect sets
|
|
584
|
+
const g2 = new Set(grps2);
|
|
585
|
+
groups = new Set([...grps1].filter(x => g2.has(x)));
|
|
586
|
+
}
|
|
587
|
+
else {
|
|
588
|
+
// union sets
|
|
589
|
+
groups = new Set([...grps1, ...grps2]);
|
|
590
|
+
}
|
|
591
|
+
if (grps1.length > 0 && grps2.length > 0 && groups.size <= 0) {
|
|
592
|
+
// ERROR: Intersection generated nothing, we will just combine all groups which will result in an invalid combination
|
|
593
|
+
groups = new Set([...grps1, ...grps2]);
|
|
594
|
+
/* eslint-disable no-console */
|
|
595
|
+
console.error(`[classificationParser] Could not find any intersection between the groups. ${grps1.toString()} & ${grps2.toString()}`);
|
|
596
|
+
/* eslint-enable no-console */
|
|
597
|
+
}
|
|
598
|
+
return Array.from(groups);
|
|
599
|
+
};
|
|
600
|
+
/**
|
|
601
|
+
* Mixes two classifications and returns to most restrictive form for them
|
|
602
|
+
*
|
|
603
|
+
* @param c12n_1 - First classification
|
|
604
|
+
* @param c12n_2 - Second classification
|
|
605
|
+
* @param c12nDef - ClassificationDefinition returned by the API server
|
|
606
|
+
* @param format - return results in `long` or `short` format
|
|
607
|
+
* @param isMobile - `true`/`false` if the results should be returned for display on a mobile device
|
|
608
|
+
*
|
|
609
|
+
* @returns The most restrictive classification that we could create out of the two
|
|
610
|
+
*
|
|
611
|
+
*/
|
|
612
|
+
export const getMaxClassification = (c12n_1, c12n_2, c12nDef, format, isMobile) => {
|
|
613
|
+
if (!c12nDef.enforce || !!c12nDef.invalid_mode) {
|
|
614
|
+
const noEnforceParts = getParts(c12nDef.UNRESTRICTED, c12nDef, format, isMobile);
|
|
615
|
+
return normalizedClassification(noEnforceParts, c12nDef, format, isMobile);
|
|
616
|
+
}
|
|
617
|
+
const c12n1Parts = getParts(c12n_1, c12nDef, format, isMobile);
|
|
618
|
+
const c12n2Parts = getParts(c12n_2, c12nDef, format, isMobile);
|
|
619
|
+
if (!c12n_1) {
|
|
620
|
+
return normalizedClassification(c12n2Parts, c12nDef, format, isMobile);
|
|
621
|
+
}
|
|
622
|
+
if (!c12n_2) {
|
|
623
|
+
return normalizedClassification(c12n1Parts, c12nDef, format, isMobile);
|
|
624
|
+
}
|
|
625
|
+
const req = Array.from(new Set([...c12n1Parts.req, ...c12n2Parts.req]));
|
|
626
|
+
const groups = getMaxGroups(c12n1Parts.groups, c12n2Parts.groups);
|
|
627
|
+
const subgroups = getMaxGroups(c12n1Parts.subgroups, c12n2Parts.subgroups);
|
|
628
|
+
const lvlIdx = Math.max(c12n1Parts.lvlIdx, c12n2Parts.lvlIdx);
|
|
629
|
+
const out = {
|
|
630
|
+
lvlIdx: lvlIdx,
|
|
631
|
+
lvl: getLevelText(lvlIdx, c12nDef, format, isMobile),
|
|
632
|
+
req: req,
|
|
633
|
+
groups: groups,
|
|
634
|
+
subgroups: subgroups
|
|
635
|
+
};
|
|
636
|
+
return normalizedClassification(out, c12nDef, format, isMobile);
|
|
637
|
+
};
|
|
638
|
+
/**
|
|
639
|
+
*
|
|
640
|
+
* Given a user classification, check if a user is allow to see a certain classification
|
|
641
|
+
*
|
|
642
|
+
* @param user_c12n - Maximum classification for the user
|
|
643
|
+
* @param c12n - Classification the user wishes to see
|
|
644
|
+
* @param c12nDef - ClassificationDefinition returned by the API server
|
|
645
|
+
* @param enforce - `true`/`false` if access controls are enabled
|
|
646
|
+
* @param ignoreInvalid - `true`/`false` if invalid classifications should raise errors or just deny access
|
|
647
|
+
*
|
|
648
|
+
* @returns True is the user can see the classification
|
|
649
|
+
*
|
|
650
|
+
*/
|
|
651
|
+
export const isAccessible = (user_c12n, c12n, c12nDef, enforce = false, ignoreInvalid = true) => {
|
|
652
|
+
if (!!c12nDef.invalid_mode)
|
|
653
|
+
return false;
|
|
654
|
+
if (!enforce)
|
|
655
|
+
return true;
|
|
656
|
+
if (!c12n)
|
|
657
|
+
return true;
|
|
658
|
+
try {
|
|
659
|
+
const userParts = getParts(user_c12n, c12nDef, 'long', false);
|
|
660
|
+
const parts = getParts(c12n, c12nDef, 'long', false);
|
|
661
|
+
if (Number(userParts.lvlIdx) >= Number(parts.lvlIdx)) {
|
|
662
|
+
if (!canSeeRequired(userParts.req, parts.req))
|
|
663
|
+
return false;
|
|
664
|
+
if (!canSeeGroups(userParts.groups, parts.groups))
|
|
665
|
+
return false;
|
|
666
|
+
if (!canSeeGroups(userParts.subgroups, parts.subgroups))
|
|
667
|
+
return false;
|
|
668
|
+
return true;
|
|
669
|
+
}
|
|
670
|
+
return false;
|
|
671
|
+
}
|
|
672
|
+
catch (e) {
|
|
673
|
+
if (e instanceof InvalidClassification) {
|
|
674
|
+
if (!!ignoreInvalid) {
|
|
675
|
+
return false;
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
throw e;
|
|
679
|
+
}
|
|
680
|
+
};
|
package/utils/constants.d.ts
CHANGED
|
@@ -5,9 +5,9 @@ export declare const VERSION: any;
|
|
|
5
5
|
export declare const MY_LOCAL_STORAGE_PREFIX = "howler.ui";
|
|
6
6
|
export declare const MY_SESSION_STORAGE_PREFIX = "howler.ui.cache";
|
|
7
7
|
export declare const ESCALATION_COLORS: {
|
|
8
|
-
alert:
|
|
9
|
-
evidence:
|
|
10
|
-
hit:
|
|
8
|
+
alert: "warning";
|
|
9
|
+
evidence: "error";
|
|
10
|
+
hit: "primary";
|
|
11
11
|
};
|
|
12
12
|
export declare const STATUS_COLORS: {
|
|
13
13
|
open: string;
|
|
@@ -75,6 +75,7 @@ export declare const RULE_INTERVALS: {
|
|
|
75
75
|
crontab: string;
|
|
76
76
|
}[];
|
|
77
77
|
export declare const DATE_RANGES: string[];
|
|
78
|
+
export declare const DATE_RANGE_LUCENE: Partial<Record<(typeof DATE_RANGES)[number], string>>;
|
|
78
79
|
interface LabelData {
|
|
79
80
|
icon?: ReactElement;
|
|
80
81
|
color?: string;
|