@cccsaurora/howler-ui 2.13.0-dev.164 → 2.13.0-dev.171
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/components/app/hooks/useMatchers.js +29 -4
- package/components/app/hooks/useMatchers.test.js +3 -3
- package/components/elements/display/json/JSONViewer.d.ts +2 -0
- package/components/elements/display/json/JSONViewer.js +6 -13
- package/components/routes/hits/search/InformationPane.js +57 -43
- package/package.json +101 -101
- package/utils/stringUtils.d.ts +1 -0
- package/utils/stringUtils.js +9 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
1
2
|
import { has } from 'lodash-es';
|
|
2
3
|
import { useCallback } from 'react';
|
|
3
4
|
import { useContextSelector } from 'use-context-selector';
|
|
@@ -13,7 +14,13 @@ const useMatchers = () => {
|
|
|
13
14
|
}
|
|
14
15
|
// This is a fallback in case metadata is not included. In most cases templates are shown, the template metadata
|
|
15
16
|
// should also exist
|
|
16
|
-
|
|
17
|
+
try {
|
|
18
|
+
return (await getHit(hit.howler.id, true)).__template;
|
|
19
|
+
}
|
|
20
|
+
catch (e) {
|
|
21
|
+
console.warn(e);
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
17
24
|
}, [getHit]);
|
|
18
25
|
const getMatchingOverview = useCallback(async (hit) => {
|
|
19
26
|
if (!hit) {
|
|
@@ -24,7 +31,13 @@ const useMatchers = () => {
|
|
|
24
31
|
}
|
|
25
32
|
// This is a fallback in case metadata is not included. In most cases templates are shown, the template metadata
|
|
26
33
|
// should also exist
|
|
27
|
-
|
|
34
|
+
try {
|
|
35
|
+
return (await getHit(hit.howler.id, true)).__overview;
|
|
36
|
+
}
|
|
37
|
+
catch (e) {
|
|
38
|
+
console.warn(e);
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
28
41
|
}, [getHit]);
|
|
29
42
|
const getMatchingDossiers = useCallback(async (hit) => {
|
|
30
43
|
if (!hit) {
|
|
@@ -35,7 +48,13 @@ const useMatchers = () => {
|
|
|
35
48
|
}
|
|
36
49
|
// This is a fallback in case metadata is not included. In most cases templates are shown, the template metadata
|
|
37
50
|
// should also exist
|
|
38
|
-
|
|
51
|
+
try {
|
|
52
|
+
return (await getHit(hit.howler.id, true)).__dossiers ?? [];
|
|
53
|
+
}
|
|
54
|
+
catch (e) {
|
|
55
|
+
console.warn(e);
|
|
56
|
+
return [];
|
|
57
|
+
}
|
|
39
58
|
}, [getHit]);
|
|
40
59
|
const getMatchingAnalytic = useCallback(async (hit) => {
|
|
41
60
|
if (!hit) {
|
|
@@ -45,7 +64,13 @@ const useMatchers = () => {
|
|
|
45
64
|
return hit.__analytic;
|
|
46
65
|
}
|
|
47
66
|
// This is a fallback in case metadata is not included.
|
|
48
|
-
|
|
67
|
+
try {
|
|
68
|
+
return (await getHit(hit.howler.id, true)).__analytic;
|
|
69
|
+
}
|
|
70
|
+
catch (e) {
|
|
71
|
+
console.warn(e);
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
49
74
|
}, [getHit]);
|
|
50
75
|
return {
|
|
51
76
|
getMatchingDossiers,
|
|
@@ -86,7 +86,7 @@ describe('useMatchers', () => {
|
|
|
86
86
|
has.mockReturnValue(false);
|
|
87
87
|
mockGetHit.mockRejectedValue(new Error('Failed to fetch hit'));
|
|
88
88
|
const { result } = renderHook(() => useMatchers());
|
|
89
|
-
await expect(result.current.getMatchingTemplate(mockHit)).
|
|
89
|
+
await expect(result.current.getMatchingTemplate(mockHit)).resolves.toBeNull();
|
|
90
90
|
expect(mockGetHit).toHaveBeenCalledWith('test-hit-id', true);
|
|
91
91
|
});
|
|
92
92
|
});
|
|
@@ -124,7 +124,7 @@ describe('useMatchers', () => {
|
|
|
124
124
|
has.mockReturnValue(false);
|
|
125
125
|
mockGetHit.mockRejectedValue(new Error('Failed to fetch hit'));
|
|
126
126
|
const { result } = renderHook(() => useMatchers());
|
|
127
|
-
await expect(result.current.getMatchingOverview(mockHit)).
|
|
127
|
+
await expect(result.current.getMatchingOverview(mockHit)).resolves.toBeNull();
|
|
128
128
|
expect(mockGetHit).toHaveBeenCalledWith('test-hit-id', true);
|
|
129
129
|
});
|
|
130
130
|
});
|
|
@@ -162,7 +162,7 @@ describe('useMatchers', () => {
|
|
|
162
162
|
has.mockReturnValue(false);
|
|
163
163
|
mockGetHit.mockRejectedValue(new Error('Failed to fetch hit'));
|
|
164
164
|
const { result } = renderHook(() => useMatchers());
|
|
165
|
-
await expect(result.current.getMatchingDossiers(mockHit)).
|
|
165
|
+
await expect(result.current.getMatchingDossiers(mockHit)).resolves.toEqual([]);
|
|
166
166
|
expect(mockGetHit).toHaveBeenCalledWith('test-hit-id', true);
|
|
167
167
|
});
|
|
168
168
|
});
|
|
@@ -8,10 +8,11 @@ import { useMyLocalStorageItem } from '@cccsaurora/howler-ui/components/hooks/us
|
|
|
8
8
|
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
9
9
|
import { useTranslation } from 'react-i18next';
|
|
10
10
|
import { StorageKey } from '@cccsaurora/howler-ui/utils/constants';
|
|
11
|
+
import { validateRegex } from '@cccsaurora/howler-ui/utils/stringUtils';
|
|
11
12
|
import Throttler from '@cccsaurora/howler-ui/utils/Throttler';
|
|
12
13
|
import { removeEmpty, searchObject } from '@cccsaurora/howler-ui/utils/utils';
|
|
13
14
|
const THROTTLER = new Throttler(150);
|
|
14
|
-
const JSONViewer = ({ data, collapse = true }) => {
|
|
15
|
+
const JSONViewer = ({ data, collapse = true, hideSearch = false, filter }) => {
|
|
15
16
|
const { t } = useTranslation();
|
|
16
17
|
const { isDark } = useAppTheme();
|
|
17
18
|
const [compact] = useMyLocalStorageItem(StorageKey.COMPACT_JSON, true);
|
|
@@ -21,19 +22,11 @@ const JSONViewer = ({ data, collapse = true }) => {
|
|
|
21
22
|
useEffect(() => {
|
|
22
23
|
THROTTLER.debounce(() => {
|
|
23
24
|
const filteredData = removeEmpty(data, compact);
|
|
24
|
-
const searchedData = searchObject(filteredData, query, flat);
|
|
25
|
+
const searchedData = searchObject(filteredData, filter ?? query, flat);
|
|
25
26
|
setResult(searchedData);
|
|
26
27
|
});
|
|
27
|
-
}, [compact, data, flat, query]);
|
|
28
|
-
const hasError = useMemo(() =>
|
|
29
|
-
try {
|
|
30
|
-
new RegExp(query);
|
|
31
|
-
return false;
|
|
32
|
-
}
|
|
33
|
-
catch (e) {
|
|
34
|
-
return true;
|
|
35
|
-
}
|
|
36
|
-
}, [query]);
|
|
28
|
+
}, [compact, data, filter, flat, query]);
|
|
29
|
+
const hasError = useMemo(() => !validateRegex(filter ?? query), [query, filter]);
|
|
37
30
|
const shouldCollapse = useCallback((field) => {
|
|
38
31
|
return (field.name !== 'root' && field.type !== 'object') || field.namespace.length > 3;
|
|
39
32
|
}, []);
|
|
@@ -48,6 +41,6 @@ const JSONViewer = ({ data, collapse = true }) => {
|
|
|
48
41
|
// Type declaration is wrong - this is a valid prop
|
|
49
42
|
displayArrayKey: !compact
|
|
50
43
|
} })), [collapse, compact, isDark, result, shouldCollapse]);
|
|
51
|
-
return data ? (_jsxs(Stack, { direction: "column", spacing: 1, sx: { '& > div:first-of-type': { mt: 1, mr: 0.5 } }, children: [_jsx(Phrase, { value: query, onChange: setQuery, error: hasError, label: t('json.viewer.search.label'), placeholder: t('json.viewer.search.prompt'), disabled: !result, endAdornment: _jsx(IconButton, { onClick: () => setQuery(''), children: _jsx(Clear, {}) }) }), renderer] })) : (_jsx(Skeleton, { width: "100%", height: "95%", variant: "rounded" }));
|
|
44
|
+
return data ? (_jsxs(Stack, { direction: "column", spacing: 1, sx: { '& > div:first-of-type': { mt: 1, mr: 0.5 } }, children: [!hideSearch && (_jsx(Phrase, { value: query, onChange: setQuery, error: hasError, label: t('json.viewer.search.label'), placeholder: t('json.viewer.search.prompt'), disabled: !result, endAdornment: _jsx(IconButton, { onClick: () => setQuery(''), children: _jsx(Clear, {}) }) })), renderer] })) : (_jsx(Skeleton, { width: "100%", height: "95%", variant: "rounded" }));
|
|
52
45
|
};
|
|
53
46
|
export default JSONViewer;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { Clear, Code, Comment, DataObject, History, LinkSharp, OpenInNew, QueryStats } from '@mui/icons-material';
|
|
3
|
-
import { Badge, Box, Divider, Skeleton, Stack, Tab, Tabs, Tooltip, useTheme } from '@mui/material';
|
|
3
|
+
import { Badge, Box, Divider, IconButton, Skeleton, Stack, Tab, Tabs, Tooltip, useTheme } from '@mui/material';
|
|
4
4
|
import TuiIconButton from '@cccsaurora/howler-ui/components/elements/addons/buttons/CustomIconButton';
|
|
5
5
|
import { Icon } from '@iconify/react/dist/iconify.js';
|
|
6
6
|
import useMatchers from '@cccsaurora/howler-ui/components/app/hooks/useMatchers';
|
|
@@ -11,6 +11,7 @@ import FlexOne from '@cccsaurora/howler-ui/components/elements/addons/layout/Fle
|
|
|
11
11
|
import VSBox from '@cccsaurora/howler-ui/components/elements/addons/layout/vsbox/VSBox';
|
|
12
12
|
import VSBoxContent from '@cccsaurora/howler-ui/components/elements/addons/layout/vsbox/VSBoxContent';
|
|
13
13
|
import VSBoxHeader from '@cccsaurora/howler-ui/components/elements/addons/layout/vsbox/VSBoxHeader';
|
|
14
|
+
import Phrase from '@cccsaurora/howler-ui/components/elements/addons/search/phrase/Phrase';
|
|
14
15
|
import BundleButton from '@cccsaurora/howler-ui/components/elements/display/icons/BundleButton';
|
|
15
16
|
import SocketBadge from '@cccsaurora/howler-ui/components/elements/display/icons/SocketBadge';
|
|
16
17
|
import JSONViewer from '@cccsaurora/howler-ui/components/elements/display/json/JSONViewer';
|
|
@@ -38,6 +39,7 @@ import { usePluginStore } from 'react-pluggable';
|
|
|
38
39
|
import { useLocation } from 'react-router-dom';
|
|
39
40
|
import { useContextSelector } from 'use-context-selector';
|
|
40
41
|
import { getUserList } from '@cccsaurora/howler-ui/utils/hitFunctions';
|
|
42
|
+
import { validateRegex } from '@cccsaurora/howler-ui/utils/stringUtils';
|
|
41
43
|
import { tryParse } from '@cccsaurora/howler-ui/utils/utils';
|
|
42
44
|
import LeadRenderer from '../view/LeadRenderer';
|
|
43
45
|
const InformationPane = ({ onClose }) => {
|
|
@@ -54,15 +56,15 @@ const InformationPane = ({ onClose }) => {
|
|
|
54
56
|
const [hasOverview, setHasOverview] = useState(false);
|
|
55
57
|
const [tab, setTab] = useState('overview');
|
|
56
58
|
const [loading, setLoading] = useState(false);
|
|
57
|
-
const [
|
|
59
|
+
const [filter, setFilter] = useState('');
|
|
60
|
+
// In order to properly check for dossiers, we split dossiers into two
|
|
61
|
+
const [_dossiers, setDossiers] = useState(null);
|
|
62
|
+
const dossiers = useMemo(() => _dossiers ?? [], [_dossiers]);
|
|
58
63
|
const users = useMyUserList(userIds);
|
|
59
64
|
const hit = useContextSelector(HitContext, ctx => ctx.hits[selected]);
|
|
60
65
|
howlerPluginStore.plugins.forEach(plugin => {
|
|
61
66
|
pluginStore.executeFunction(`${plugin}.on`, 'viewing');
|
|
62
67
|
});
|
|
63
|
-
useEffect(() => {
|
|
64
|
-
getMatchingOverview(hit).then(_overview => setHasOverview(!!_overview));
|
|
65
|
-
}, [getMatchingOverview, hit]);
|
|
66
68
|
useEffect(() => {
|
|
67
69
|
if (!selected) {
|
|
68
70
|
return;
|
|
@@ -73,10 +75,21 @@ const InformationPane = ({ onClose }) => {
|
|
|
73
75
|
return;
|
|
74
76
|
}
|
|
75
77
|
setUserIds(getUserList(hit));
|
|
76
|
-
getMatchingAnalytic(hit).then(setAnalytic);
|
|
77
|
-
getMatchingDossiers(hit).then(setDossiers);
|
|
78
78
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
79
79
|
}, [getHit, selected]);
|
|
80
|
+
useEffect(() => {
|
|
81
|
+
if (hit && !analytic) {
|
|
82
|
+
getMatchingAnalytic(hit).then(setAnalytic);
|
|
83
|
+
}
|
|
84
|
+
}, [analytic, getMatchingAnalytic, hit]);
|
|
85
|
+
useEffect(() => {
|
|
86
|
+
if (hit && !_dossiers) {
|
|
87
|
+
getMatchingDossiers(hit).then(setDossiers);
|
|
88
|
+
}
|
|
89
|
+
}, [_dossiers, getMatchingDossiers, hit]);
|
|
90
|
+
useEffect(() => {
|
|
91
|
+
getMatchingOverview(hit).then(_overview => setHasOverview(!!_overview));
|
|
92
|
+
}, [getMatchingOverview, hit]);
|
|
80
93
|
useEffect(() => {
|
|
81
94
|
if (tab === 'hit_aggregate' && !hit?.howler.is_bundle) {
|
|
82
95
|
setTab('overview');
|
|
@@ -128,8 +141,8 @@ const InformationPane = ({ onClose }) => {
|
|
|
128
141
|
overview: () => _jsx(HitOverview, { hit: hit }),
|
|
129
142
|
details: () => _jsx(HitDetails, { hit: hit }),
|
|
130
143
|
hit_comments: () => _jsx(HitComments, { hit: hit, users: users }),
|
|
131
|
-
hit_raw: () => _jsx(JSONViewer, { data: !loading && hit }),
|
|
132
|
-
hit_data: () => (_jsx(JSONViewer, { data: !loading && hit?.howler?.data?.map(entry => tryParse(entry)), collapse: false })),
|
|
144
|
+
hit_raw: () => _jsx(JSONViewer, { data: !loading && hit, hideSearch: true, filter: filter }),
|
|
145
|
+
hit_data: () => (_jsx(JSONViewer, { data: !loading && hit?.howler?.data?.map(entry => tryParse(entry)), collapse: false, hideSearch: true, filter: filter })),
|
|
133
146
|
hit_worklog: () => _jsx(HitWorklog, { hit: !loading && hit, users: users }),
|
|
134
147
|
hit_aggregate: () => _jsx(HitSummary, { query: `howler.bundles:(${hit?.howler?.id})` }),
|
|
135
148
|
hit_related: () => _jsx(HitRelated, { hit: hit }),
|
|
@@ -139,7 +152,8 @@ const InformationPane = ({ onClose }) => {
|
|
|
139
152
|
() => _jsx(LeadRenderer, { lead: _lead, hit: hit })
|
|
140
153
|
])))
|
|
141
154
|
}[tab]?.();
|
|
142
|
-
}, [dossiers, hit, loading, tab, users]);
|
|
155
|
+
}, [dossiers, filter, hit, loading, tab, users]);
|
|
156
|
+
const hasError = useMemo(() => !validateRegex(filter), [filter]);
|
|
143
157
|
return (_jsxs(VSBox, { top: 10, sx: { height: '100%', flex: 1 }, children: [_jsxs(Stack, { direction: "column", flex: 1, sx: { overflowY: 'auto', flexGrow: 1 }, position: "relative", spacing: 1, ml: 2, children: [_jsxs(Stack, { direction: "row", alignItems: "center", spacing: 0.5, flexShrink: 0, pr: 2, sx: [hit?.howler?.is_bundle && { position: 'absolute', top: 1, right: 0, zIndex: 1100 }], children: [_jsx(FlexOne, {}), onClose && !location.pathname.startsWith('/bundles') && (_jsx(TuiIconButton, { size: "small", onClick: onClose, tooltip: t('hit.panel.details.exit'), children: _jsx(Clear, {}) })), _jsx(SocketBadge, { size: "small" }), analytic && (_jsx(TuiIconButton, { size: "small", tooltip: t('hit.panel.analytic.open'), disabled: !analytic || loading, route: `/analytics/${analytic.analytic_id}`, children: _jsx(QueryStats, {}) })), hit?.howler.bundles?.length > 0 && _jsx(BundleButton, { ids: hit.howler.bundles, disabled: loading }), !!hit && !hit.howler.is_bundle && (_jsx(TuiIconButton, { tooltip: t('hit.panel.open'), href: `/hits/${selected}`, disabled: !hit || loading, size: "small", target: "_blank", children: _jsx(OpenInNew, {}) }))] }), _jsx(Box, { pr: 2, children: header }), !!hit &&
|
|
144
158
|
!hit.howler.is_bundle &&
|
|
145
159
|
(!loading ? (_jsxs(_Fragment, { children: [_jsx(HitOutline, { hit: hit, layout: HitLayout.DENSE }), _jsx(HitLabels, { hit: hit })] })) : (_jsx(Skeleton, { height: 124 }))), (hit?.howler?.links?.length > 0 ||
|
|
@@ -149,39 +163,39 @@ const InformationPane = ({ onClose }) => {
|
|
|
149
163
|
.slice(0, 3)
|
|
150
164
|
.map(l => _jsx(RelatedLink, { compact: true, ...l }, l.href)), dossiers.flatMap(_dossier => (_dossier.pivots ?? []).map((_pivot, index) => (
|
|
151
165
|
// eslint-disable-next-line react/no-array-index-key
|
|
152
|
-
_jsx(PivotLink, { pivot: _pivot, hit: hit, compact: true }, _dossier.dossier_id + index))))] })),
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
166
|
+
_jsx(PivotLink, { pivot: _pivot, hit: hit, compact: true }, _dossier.dossier_id + index))))] })), _jsxs(VSBoxHeader, { ml: -1, mr: -1, pb: 1, sx: { top: '0px' }, children: [_jsxs(Tabs, { value: tab === 'overview' && !hasOverview ? 'details' : tab, sx: {
|
|
167
|
+
display: 'flex',
|
|
168
|
+
flexDirection: 'row',
|
|
169
|
+
pr: 2,
|
|
170
|
+
alignItems: 'center',
|
|
171
|
+
position: 'relative',
|
|
172
|
+
'& > .MuiTabScrollButton-root': {
|
|
173
|
+
position: 'absolute',
|
|
174
|
+
top: 0,
|
|
175
|
+
bottom: 0,
|
|
176
|
+
zIndex: 5,
|
|
177
|
+
backgroundColor: theme.palette.background.paper,
|
|
178
|
+
'&:not(.Mui-disabled)': {
|
|
179
|
+
opacity: 1
|
|
180
|
+
},
|
|
181
|
+
'&:first-of-type': {
|
|
182
|
+
left: 0
|
|
183
|
+
},
|
|
184
|
+
'&:last-of-type': {
|
|
185
|
+
right: 0
|
|
186
|
+
}
|
|
172
187
|
}
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
'
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
, { label: _jsxs(Stack, { direction: "row", spacing: 0.5, children: [_lead.icon && _jsx(Icon, { icon: _lead.icon }), _jsx("span", { children: i18n.language === 'en' ? _lead.label.en : _lead.label.fr })] }), value: `external-lead:${dossierIndex}:${leadIndex}`, onClick: () => setTab(`external-lead:${dossierIndex}:${leadIndex}`) }, `external-lead:${dossierIndex}:${leadIndex}`)))), _jsx(FlexOne, {}), _jsx(Tab, { sx: { px: 2, minWidth: 0 }, label: _jsx(Tooltip, { title: t('hit.viewer.data'), children: _jsx(DataObject, {}) }), value: "hit_data", onClick: () => setTab('hit_data'), disabled: !hit?.howler?.data }), _jsx(Tab, { sx: { px: 2, minWidth: 0 }, label: _jsx(Tooltip, { title: t('hit.viewer.json'), children: _jsx(Code, {}) }), value: "hit_raw", onClick: () => setTab('hit_raw') }), _jsx(Tab, { sx: { px: 2, minWidth: 0 }, label: _jsx(Tooltip, { title: t('hit.viewer.worklog'), children: _jsx(History, {}) }), value: "hit_worklog", onClick: () => setTab('hit_worklog') }), _jsx(Tab, { sx: { px: 2, minWidth: 0 }, label: _jsx(Tooltip, { title: t('hit.viewer.related'), children: _jsx(LinkSharp, {}) }), value: "hit_related", onClick: () => setTab('hit_related') })] }) }), _jsx(ErrorBoundary, { children: _jsx(VSBoxContent, { mr: -1, ml: -1, height: "100%", children: _jsx(Stack, { height: "100%", flex: 1, children: tabContent }) }) })] }), !!hit && hit?.howler && (_jsxs(Box, { pr: 2, bgcolor: theme.palette.background.default, position: "relative", children: [_jsx(Divider, { orientation: "horizontal" }), _jsx(HitActions, { hit: hit })] }))] }));
|
|
188
|
+
}, variant: "scrollable", children: [_jsx(Tab, { sx: { px: 2, minWidth: 0 }, label: _jsx(Tooltip, { title: t('hit.viewer.comments'), children: _jsx(Badge, { sx: {
|
|
189
|
+
'& > .MuiBadge-badge': {
|
|
190
|
+
backgroundColor: theme.palette.divider,
|
|
191
|
+
zIndex: 1,
|
|
192
|
+
right: theme.spacing(-0.5)
|
|
193
|
+
},
|
|
194
|
+
'& > svg': { zIndex: 2 }
|
|
195
|
+
}, badgeContent: hit?.howler.comment?.length ?? 0, children: _jsx(Comment, {}) }) }), value: "hit_comments", onClick: () => setTab('hit_comments') }), hit?.howler?.is_bundle && (_jsx(Tab, { label: t('hit.viewer.aggregate'), value: "hit_aggregate", onClick: () => setTab('hit_aggregate') })), hasOverview && (_jsx(Tab, { label: t('hit.viewer.overview'), value: "overview", onClick: () => setTab('overview') })), _jsx(Tab, { label: t('hit.viewer.details'), value: "details", onClick: () => setTab('details') }), hit?.howler.dossier?.map((lead, index) => (_jsx(Tab
|
|
196
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
197
|
+
, { label: _jsxs(Stack, { direction: "row", spacing: 0.5, children: [lead.icon && _jsx(Icon, { icon: lead.icon }), _jsx("span", { children: i18n.language === 'en' ? lead.label.en : lead.label.fr })] }), value: 'lead:' + index, onClick: () => setTab('lead:' + index) }, 'lead:' + index))), dossiers.flatMap((_dossier, dossierIndex) => _dossier.leads?.map((_lead, leadIndex) => (_jsx(Tab
|
|
198
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
199
|
+
, { label: _jsxs(Stack, { direction: "row", spacing: 0.5, children: [_lead.icon && _jsx(Icon, { icon: _lead.icon }), _jsx("span", { children: i18n.language === 'en' ? _lead.label.en : _lead.label.fr })] }), value: `external-lead:${dossierIndex}:${leadIndex}`, onClick: () => setTab(`external-lead:${dossierIndex}:${leadIndex}`) }, `external-lead:${dossierIndex}:${leadIndex}`)))), _jsx(FlexOne, {}), _jsx(Tab, { sx: { px: 2, minWidth: 0 }, label: _jsx(Tooltip, { title: t('hit.viewer.data'), children: _jsx(DataObject, {}) }), value: "hit_data", onClick: () => setTab('hit_data'), disabled: !hit?.howler?.data }), _jsx(Tab, { sx: { px: 2, minWidth: 0 }, label: _jsx(Tooltip, { title: t('hit.viewer.json'), children: _jsx(Code, {}) }), value: "hit_raw", onClick: () => setTab('hit_raw') }), _jsx(Tab, { sx: { px: 2, minWidth: 0 }, label: _jsx(Tooltip, { title: t('hit.viewer.worklog'), children: _jsx(History, {}) }), value: "hit_worklog", onClick: () => setTab('hit_worklog') }), _jsx(Tab, { sx: { px: 2, minWidth: 0 }, label: _jsx(Tooltip, { title: t('hit.viewer.related'), children: _jsx(LinkSharp, {}) }), value: "hit_related", onClick: () => setTab('hit_related') })] }), ['hit_raw', 'hit_data'].includes(tab) && (_jsx(Phrase, { sx: { mt: 1, pr: 1 }, value: filter, onChange: setFilter, error: hasError, label: t('json.viewer.search.label'), placeholder: t('json.viewer.search.prompt'), endAdornment: _jsx(IconButton, { onClick: () => setFilter(''), children: _jsx(Clear, {}) }) }))] }), _jsx(ErrorBoundary, { children: _jsx(VSBoxContent, { mr: -1, ml: -1, height: "100%", children: _jsx(Stack, { height: "100%", flex: 1, children: tabContent }) }) })] }), !!hit && hit?.howler && (_jsxs(Box, { pr: 2, bgcolor: theme.palette.background.default, position: "relative", children: [_jsx(Divider, { orientation: "horizontal" }), _jsx(HitActions, { hit: hit })] }))] }));
|
|
186
200
|
};
|
|
187
201
|
export default InformationPane;
|
package/package.json
CHANGED
|
@@ -96,163 +96,163 @@
|
|
|
96
96
|
"internal-slot": "1.0.7"
|
|
97
97
|
},
|
|
98
98
|
"type": "module",
|
|
99
|
-
"version": "2.13.0-dev.
|
|
99
|
+
"version": "2.13.0-dev.171",
|
|
100
100
|
"exports": {
|
|
101
101
|
"./i18n": "./i18n.js",
|
|
102
102
|
"./index.css": "./index.css",
|
|
103
|
+
"./utils/*": "./utils/*.js",
|
|
104
|
+
"./utils/*.json": "./utils/*.json",
|
|
105
|
+
"./locales/*.json": "./locales/*.json",
|
|
106
|
+
"./commons/*": "./commons/*.js",
|
|
103
107
|
"./api/*": "./api/*.js",
|
|
104
108
|
"./api": "./api/index.js",
|
|
105
|
-
"./commons/*": "./commons/*.js",
|
|
106
109
|
"./tests/*": "./tests/*.js",
|
|
107
|
-
"./
|
|
108
|
-
"./rest": "./rest/index.js",
|
|
109
|
-
"./locales/*.json": "./locales/*.json",
|
|
110
|
+
"./plugins/*": "./plugins/*.js",
|
|
110
111
|
"./branding/*": "./branding/*.js",
|
|
111
112
|
"./components/*": "./components/*.js",
|
|
113
|
+
"./rest/*": "./rest/*.js",
|
|
114
|
+
"./rest": "./rest/index.js",
|
|
112
115
|
"./models/*": "./models/*.js",
|
|
113
|
-
"./
|
|
114
|
-
"./
|
|
115
|
-
"./
|
|
116
|
-
"./
|
|
117
|
-
"./
|
|
118
|
-
"./
|
|
119
|
-
"./
|
|
120
|
-
"./
|
|
121
|
-
"./
|
|
122
|
-
"./
|
|
123
|
-
"./
|
|
124
|
-
"./
|
|
125
|
-
"./
|
|
116
|
+
"./locales/fr/*.json": "./locales/fr/*.json",
|
|
117
|
+
"./locales/en/*.json": "./locales/en/*.json",
|
|
118
|
+
"./locales/fr/help/*.json": "./locales/fr/help/*.json",
|
|
119
|
+
"./locales/en/help/*.json": "./locales/en/help/*.json",
|
|
120
|
+
"./commons/components/*": "./commons/components/*.js",
|
|
121
|
+
"./commons/components/utils/*": "./commons/components/utils/*.js",
|
|
122
|
+
"./commons/components/topnav/*": "./commons/components/topnav/*.js",
|
|
123
|
+
"./commons/components/app/*": "./commons/components/app/*.js",
|
|
124
|
+
"./commons/components/display/*": "./commons/components/display/*.js",
|
|
125
|
+
"./commons/components/breadcrumbs/*": "./commons/components/breadcrumbs/*.js",
|
|
126
|
+
"./commons/components/search/*": "./commons/components/search/*.js",
|
|
127
|
+
"./commons/components/pages/*": "./commons/components/pages/*.js",
|
|
128
|
+
"./commons/components/notification/*": "./commons/components/notification/*.js",
|
|
129
|
+
"./commons/components/notification": "./commons/components/notification/index.js",
|
|
130
|
+
"./commons/components/leftnav/*": "./commons/components/leftnav/*.js",
|
|
131
|
+
"./commons/components/utils/hooks/*": "./commons/components/utils/hooks/*.js",
|
|
132
|
+
"./commons/components/app/providers/*": "./commons/components/app/providers/*.js",
|
|
133
|
+
"./commons/components/app/hooks/*": "./commons/components/app/hooks/*.js",
|
|
134
|
+
"./commons/components/app/hooks": "./commons/components/app/hooks/index.js",
|
|
135
|
+
"./commons/components/display/hooks/*": "./commons/components/display/hooks/*.js",
|
|
136
|
+
"./commons/components/pages/hooks/*": "./commons/components/pages/hooks/*.js",
|
|
137
|
+
"./commons/components/notification/elements/*": "./commons/components/notification/elements/*.js",
|
|
138
|
+
"./commons/components/notification/elements/item/*": "./commons/components/notification/elements/item/*.js",
|
|
139
|
+
"./api/template/*": "./api/template/*.js",
|
|
140
|
+
"./api/template": "./api/template/index.js",
|
|
126
141
|
"./api/action/*": "./api/action/*.js",
|
|
127
142
|
"./api/action": "./api/action/index.js",
|
|
143
|
+
"./api/user/*": "./api/user/*.js",
|
|
144
|
+
"./api/user": "./api/user/index.js",
|
|
145
|
+
"./api/hit/*": "./api/hit/*.js",
|
|
146
|
+
"./api/hit": "./api/hit/index.js",
|
|
147
|
+
"./api/configs/*": "./api/configs/*.js",
|
|
148
|
+
"./api/configs": "./api/configs/index.js",
|
|
128
149
|
"./api/auth/*": "./api/auth/*.js",
|
|
129
150
|
"./api/auth": "./api/auth/index.js",
|
|
130
151
|
"./api/search/*": "./api/search/*.js",
|
|
131
152
|
"./api/search": "./api/search/index.js",
|
|
153
|
+
"./api/analytic/*": "./api/analytic/*.js",
|
|
154
|
+
"./api/analytic": "./api/analytic/index.js",
|
|
155
|
+
"./api/notebook/*": "./api/notebook/*.js",
|
|
156
|
+
"./api/notebook": "./api/notebook/index.js",
|
|
132
157
|
"./api/view/*": "./api/view/*.js",
|
|
133
158
|
"./api/view": "./api/view/index.js",
|
|
159
|
+
"./api/dossier/*": "./api/dossier/*.js",
|
|
160
|
+
"./api/dossier": "./api/dossier/index.js",
|
|
134
161
|
"./api/overview/*": "./api/overview/*.js",
|
|
135
162
|
"./api/overview": "./api/overview/index.js",
|
|
136
|
-
"./api/hit/*": "./api/hit/*.js",
|
|
137
|
-
"./api/hit": "./api/hit/index.js",
|
|
138
|
-
"./api/template/*": "./api/template/*.js",
|
|
139
|
-
"./api/template": "./api/template/index.js",
|
|
140
|
-
"./api/analytic/notebooks/*": "./api/analytic/notebooks/*.js",
|
|
141
|
-
"./api/analytic/notebooks": "./api/analytic/notebooks/index.js",
|
|
142
|
-
"./api/analytic/comments/*": "./api/analytic/comments/*.js",
|
|
143
|
-
"./api/analytic/comments": "./api/analytic/comments/index.js",
|
|
144
163
|
"./api/user/avatar/*": "./api/user/avatar/*.js",
|
|
145
164
|
"./api/user/avatar": "./api/user/avatar/index.js",
|
|
146
|
-
"./api/
|
|
147
|
-
"./api/
|
|
148
|
-
"./api/search/sigma/*": "./api/search/sigma/*.js",
|
|
149
|
-
"./api/search/histogram/*": "./api/search/histogram/*.js",
|
|
150
|
-
"./api/search/histogram": "./api/search/histogram/index.js",
|
|
165
|
+
"./api/hit/comments/*": "./api/hit/comments/*.js",
|
|
166
|
+
"./api/hit/comments": "./api/hit/comments/index.js",
|
|
151
167
|
"./api/search/grouped/*": "./api/search/grouped/*.js",
|
|
152
168
|
"./api/search/grouped": "./api/search/grouped/index.js",
|
|
153
|
-
"./api/search/
|
|
154
|
-
"./api/search/
|
|
169
|
+
"./api/search/fields/*": "./api/search/fields/*.js",
|
|
170
|
+
"./api/search/fields": "./api/search/fields/index.js",
|
|
155
171
|
"./api/search/eql/*": "./api/search/eql/*.js",
|
|
156
172
|
"./api/search/facet/*": "./api/search/facet/*.js",
|
|
157
173
|
"./api/search/facet": "./api/search/facet/index.js",
|
|
158
|
-
"./api/
|
|
159
|
-
"./api/
|
|
160
|
-
"./
|
|
161
|
-
"./
|
|
162
|
-
"./
|
|
163
|
-
"./
|
|
164
|
-
"./
|
|
165
|
-
"./
|
|
166
|
-
"./
|
|
167
|
-
"./
|
|
168
|
-
"./
|
|
169
|
-
"./
|
|
170
|
-
"./
|
|
171
|
-
"./commons/components/app/hooks/*": "./commons/components/app/hooks/*.js",
|
|
172
|
-
"./commons/components/app/hooks": "./commons/components/app/hooks/index.js",
|
|
173
|
-
"./commons/components/app/providers/*": "./commons/components/app/providers/*.js",
|
|
174
|
-
"./commons/components/notification/elements/*": "./commons/components/notification/elements/*.js",
|
|
175
|
-
"./commons/components/notification/elements/item/*": "./commons/components/notification/elements/item/*.js",
|
|
176
|
-
"./commons/components/pages/hooks/*": "./commons/components/pages/hooks/*.js",
|
|
177
|
-
"./commons/components/display/hooks/*": "./commons/components/display/hooks/*.js",
|
|
178
|
-
"./commons/components/utils/hooks/*": "./commons/components/utils/hooks/*.js",
|
|
179
|
-
"./locales/en/*.json": "./locales/en/*.json",
|
|
180
|
-
"./locales/fr/*.json": "./locales/fr/*.json",
|
|
181
|
-
"./locales/en/help/*.json": "./locales/en/help/*.json",
|
|
182
|
-
"./locales/fr/help/*.json": "./locales/fr/help/*.json",
|
|
174
|
+
"./api/search/count/*": "./api/search/count/*.js",
|
|
175
|
+
"./api/search/count": "./api/search/count/index.js",
|
|
176
|
+
"./api/search/histogram/*": "./api/search/histogram/*.js",
|
|
177
|
+
"./api/search/histogram": "./api/search/histogram/index.js",
|
|
178
|
+
"./api/search/sigma/*": "./api/search/sigma/*.js",
|
|
179
|
+
"./api/analytic/notebooks/*": "./api/analytic/notebooks/*.js",
|
|
180
|
+
"./api/analytic/notebooks": "./api/analytic/notebooks/index.js",
|
|
181
|
+
"./api/analytic/comments/*": "./api/analytic/comments/*.js",
|
|
182
|
+
"./api/analytic/comments": "./api/analytic/comments/index.js",
|
|
183
|
+
"./plugins/borealis/*": "./plugins/borealis/*.js",
|
|
184
|
+
"./plugins/borealis": "./plugins/borealis/index.js",
|
|
185
|
+
"./plugins/borealis/locales/*": "./plugins/borealis/locales/*.js",
|
|
186
|
+
"./plugins/borealis/components/*": "./plugins/borealis/components/*.js",
|
|
183
187
|
"./components/app/*": "./components/app/*.js",
|
|
184
|
-
"./components/hooks/*": "./components/hooks/*.js",
|
|
185
188
|
"./components/elements/*": "./components/elements/*.js",
|
|
186
189
|
"./components/routes/*": "./components/routes/*.js",
|
|
187
190
|
"./components/logins/*": "./components/logins/*.js",
|
|
191
|
+
"./components/hooks/*": "./components/hooks/*.js",
|
|
192
|
+
"./components/app/providers/*": "./components/app/providers/*.js",
|
|
188
193
|
"./components/app/hooks/*": "./components/app/hooks/*.js",
|
|
189
194
|
"./components/app/drawers/*": "./components/app/drawers/*.js",
|
|
190
|
-
"./components/app/providers/*": "./components/app/providers/*.js",
|
|
191
|
-
"./components/elements/addons/*": "./components/elements/addons/*.js",
|
|
192
195
|
"./components/elements/display/*": "./components/elements/display/*.js",
|
|
193
|
-
"./components/elements/view/*": "./components/elements/view/*.js",
|
|
194
196
|
"./components/elements/hit/*": "./components/elements/hit/*.js",
|
|
195
|
-
"./components/elements/
|
|
196
|
-
"./components/elements/addons
|
|
197
|
+
"./components/elements/view/*": "./components/elements/view/*.js",
|
|
198
|
+
"./components/elements/addons/*": "./components/elements/addons/*.js",
|
|
199
|
+
"./components/elements/display/markdownPlugins/*.md": "./components/elements/display/markdownPlugins/*.md.js",
|
|
200
|
+
"./components/elements/display/modals/*": "./components/elements/display/modals/*.js",
|
|
201
|
+
"./components/elements/display/features/*": "./components/elements/display/features/*.js",
|
|
202
|
+
"./components/elements/display/icons/*": "./components/elements/display/icons/*.js",
|
|
203
|
+
"./components/elements/display/json/*": "./components/elements/display/json/*.js",
|
|
204
|
+
"./components/elements/display/handlebars/*": "./components/elements/display/handlebars/*.js",
|
|
205
|
+
"./components/elements/display/icons/svg/*": "./components/elements/display/icons/svg/*.js",
|
|
206
|
+
"./components/elements/hit/elements/*": "./components/elements/hit/elements/*.js",
|
|
207
|
+
"./components/elements/hit/outlines/*": "./components/elements/hit/outlines/*.js",
|
|
208
|
+
"./components/elements/hit/related/*": "./components/elements/hit/related/*.js",
|
|
209
|
+
"./components/elements/hit/aggregate/*": "./components/elements/hit/aggregate/*.js",
|
|
210
|
+
"./components/elements/hit/actions/*": "./components/elements/hit/actions/*.js",
|
|
211
|
+
"./components/elements/hit/outlines/al/*": "./components/elements/hit/outlines/al/*.js",
|
|
197
212
|
"./components/elements/addons/buttons/*": "./components/elements/addons/buttons/*.js",
|
|
198
213
|
"./components/elements/addons/buttons": "./components/elements/addons/buttons/index.js",
|
|
199
214
|
"./components/elements/addons/layout/*": "./components/elements/addons/layout/*.js",
|
|
200
215
|
"./components/elements/addons/search/*": "./components/elements/addons/search/*.js",
|
|
201
|
-
"./components/elements/addons/lists
|
|
202
|
-
"./components/elements/addons/lists
|
|
203
|
-
"./components/elements/addons/lists/table": "./components/elements/addons/lists/table/index.js",
|
|
216
|
+
"./components/elements/addons/lists/*": "./components/elements/addons/lists/*.js",
|
|
217
|
+
"./components/elements/addons/lists": "./components/elements/addons/lists/index.js",
|
|
204
218
|
"./components/elements/addons/layout/vsbox/*": "./components/elements/addons/layout/vsbox/*.js",
|
|
205
219
|
"./components/elements/addons/search/phrase/*": "./components/elements/addons/search/phrase/*.js",
|
|
206
220
|
"./components/elements/addons/search/phrase": "./components/elements/addons/search/phrase/index.js",
|
|
207
221
|
"./components/elements/addons/search/phrase/word/*": "./components/elements/addons/search/phrase/word/*.js",
|
|
208
222
|
"./components/elements/addons/search/phrase/word/consumers/*": "./components/elements/addons/search/phrase/word/consumers/*.js",
|
|
209
|
-
"./components/elements/
|
|
210
|
-
"./components/elements/
|
|
211
|
-
"./components/elements/
|
|
212
|
-
"./components/elements/display/handlebars/*": "./components/elements/display/handlebars/*.js",
|
|
213
|
-
"./components/elements/display/modals/*": "./components/elements/display/modals/*.js",
|
|
214
|
-
"./components/elements/display/json/*": "./components/elements/display/json/*.js",
|
|
215
|
-
"./components/elements/display/icons/svg/*": "./components/elements/display/icons/svg/*.js",
|
|
216
|
-
"./components/elements/hit/related/*": "./components/elements/hit/related/*.js",
|
|
217
|
-
"./components/elements/hit/aggregate/*": "./components/elements/hit/aggregate/*.js",
|
|
218
|
-
"./components/elements/hit/elements/*": "./components/elements/hit/elements/*.js",
|
|
219
|
-
"./components/elements/hit/actions/*": "./components/elements/hit/actions/*.js",
|
|
220
|
-
"./components/elements/hit/outlines/*": "./components/elements/hit/outlines/*.js",
|
|
221
|
-
"./components/elements/hit/outlines/al/*": "./components/elements/hit/outlines/al/*.js",
|
|
222
|
-
"./components/routes/home/*": "./components/routes/home/*.js",
|
|
223
|
-
"./components/routes/home": "./components/routes/home/index.js",
|
|
223
|
+
"./components/elements/addons/lists/hooks/*": "./components/elements/addons/lists/hooks/*.js",
|
|
224
|
+
"./components/elements/addons/lists/table/*": "./components/elements/addons/lists/table/*.js",
|
|
225
|
+
"./components/elements/addons/lists/table": "./components/elements/addons/lists/table/index.js",
|
|
224
226
|
"./components/routes/views/*": "./components/routes/views/*.js",
|
|
225
|
-
"./components/routes/hits/*": "./components/routes/hits/*.js",
|
|
226
|
-
"./components/routes/advanced/*": "./components/routes/advanced/*.js",
|
|
227
|
-
"./components/routes/admin/*": "./components/routes/admin/*.js",
|
|
228
227
|
"./components/routes/dossiers/*": "./components/routes/dossiers/*.js",
|
|
229
|
-
"./components/routes/templates/*": "./components/routes/templates/*.js",
|
|
230
228
|
"./components/routes/action/*": "./components/routes/action/*.js",
|
|
229
|
+
"./components/routes/admin/*": "./components/routes/admin/*.js",
|
|
230
|
+
"./components/routes/hits/*": "./components/routes/hits/*.js",
|
|
231
231
|
"./components/routes/settings/*": "./components/routes/settings/*.js",
|
|
232
|
+
"./components/routes/home/*": "./components/routes/home/*.js",
|
|
233
|
+
"./components/routes/home": "./components/routes/home/index.js",
|
|
232
234
|
"./components/routes/overviews/*": "./components/routes/overviews/*.js",
|
|
233
|
-
"./components/routes/
|
|
235
|
+
"./components/routes/advanced/*": "./components/routes/advanced/*.js",
|
|
234
236
|
"./components/routes/analytics/*": "./components/routes/analytics/*.js",
|
|
237
|
+
"./components/routes/templates/*": "./components/routes/templates/*.js",
|
|
238
|
+
"./components/routes/help/*": "./components/routes/help/*.js",
|
|
239
|
+
"./components/routes/action/shared/*": "./components/routes/action/shared/*.js",
|
|
240
|
+
"./components/routes/action/view/*": "./components/routes/action/view/*.js",
|
|
241
|
+
"./components/routes/action/edit/*": "./components/routes/action/edit/*.js",
|
|
242
|
+
"./components/routes/admin/users/*": "./components/routes/admin/users/*.js",
|
|
235
243
|
"./components/routes/hits/search/*": "./components/routes/hits/search/*.js",
|
|
236
244
|
"./components/routes/hits/view/*": "./components/routes/hits/view/*.js",
|
|
237
|
-
"./components/routes/hits/search/grid/*": "./components/routes/hits/search/grid/*.js",
|
|
238
245
|
"./components/routes/hits/search/shared/*": "./components/routes/hits/search/shared/*.js",
|
|
239
|
-
"./components/routes/
|
|
240
|
-
"./components/routes/
|
|
241
|
-
"./components/routes/action/shared/*": "./components/routes/action/shared/*.js",
|
|
242
|
-
"./components/routes/action/view/*": "./components/routes/action/view/*.js",
|
|
246
|
+
"./components/routes/hits/search/grid/*": "./components/routes/hits/search/grid/*.js",
|
|
247
|
+
"./components/routes/analytics/widgets/*": "./components/routes/analytics/widgets/*.js",
|
|
243
248
|
"./components/routes/help/markdown/*.md": "./components/routes/help/markdown/*.md.js",
|
|
244
249
|
"./components/routes/help/components/*": "./components/routes/help/components/*.js",
|
|
245
|
-
"./components/routes/help/markdown/en/*.md": "./components/routes/help/markdown/en/*.md.js",
|
|
246
250
|
"./components/routes/help/markdown/fr/*.md": "./components/routes/help/markdown/fr/*.md.js",
|
|
247
|
-
"./components/routes/
|
|
248
|
-
"./components/logins/hooks/*": "./components/logins/hooks/*.js",
|
|
251
|
+
"./components/routes/help/markdown/en/*.md": "./components/routes/help/markdown/en/*.md.js",
|
|
249
252
|
"./components/logins/auth/*": "./components/logins/auth/*.js",
|
|
250
|
-
"./
|
|
253
|
+
"./components/logins/hooks/*": "./components/logins/hooks/*.js",
|
|
251
254
|
"./models/entities/*": "./models/entities/*.js",
|
|
252
|
-
"./models/
|
|
253
|
-
"./
|
|
254
|
-
"./plugins/borealis": "./plugins/borealis/index.js",
|
|
255
|
-
"./plugins/borealis/locales/*": "./plugins/borealis/locales/*.js",
|
|
256
|
-
"./plugins/borealis/components/*": "./plugins/borealis/components/*.js"
|
|
255
|
+
"./models/socket/*": "./models/socket/*.js",
|
|
256
|
+
"./models/entities/generated/*": "./models/entities/generated/*.js"
|
|
257
257
|
}
|
|
258
258
|
}
|
package/utils/stringUtils.d.ts
CHANGED
|
@@ -5,3 +5,4 @@ export declare const safeFieldValueURI: (data: string | number | boolean) => str
|
|
|
5
5
|
export declare const sanitizeLuceneQuery: (query: string) => string;
|
|
6
6
|
export declare const safeStringPropertyCompare: (propertyPath: string) => (a: unknown, b: unknown) => any;
|
|
7
7
|
export declare const sanitizeMultilineLucene: (query: string) => string;
|
|
8
|
+
export declare const validateRegex: (regex: string) => boolean;
|
package/utils/stringUtils.js
CHANGED
|
@@ -36,3 +36,12 @@ export const safeStringPropertyCompare = (propertyPath) => {
|
|
|
36
36
|
export const sanitizeMultilineLucene = (query) => {
|
|
37
37
|
return query.replace(/#.+/g, '').replace(/\n{2,}/, '\n');
|
|
38
38
|
};
|
|
39
|
+
export const validateRegex = (regex) => {
|
|
40
|
+
try {
|
|
41
|
+
new RegExp(regex);
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
};
|