@cccsaurora/clue-ui 0.15.0 → 1.0.0-dev.49

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.
Files changed (257) hide show
  1. package/ActionForm-c5hLIfQ-.js +436 -0
  2. package/AnnotationPreview-BvNpZOP0.js +188 -0
  3. package/ClueEnrichContext-m-4vn9rz.js +518 -0
  4. package/FlexOne-BSYAhhtG.js +9 -0
  5. package/_Map-kgDsDYxq.js +64 -0
  6. package/_MapCache-DabaaWfq.js +161 -0
  7. package/_Uint8Array-BlVVH1tp.js +129 -0
  8. package/_baseAssignValue-CNbcU6Nb.js +25 -0
  9. package/_baseClone-D3a8Pa4T.js +284 -0
  10. package/_baseExtremum-B1o1zHjR.js +33 -0
  11. package/_baseFlatten-D4huXoEI.js +92 -0
  12. package/_baseGet-BSK_nnoz.js +109 -0
  13. package/_baseIsEqual-B5xLoweL.js +238 -0
  14. package/_baseIteratee-p6Nj07-n.js +126 -0
  15. package/_baseSlice-GAv_YFTT.js +20 -0
  16. package/_baseSum-D0WC1dN0.js +13 -0
  17. package/_baseUniq-CpupKWcL.js +89 -0
  18. package/_commonjsHelpers-CUmg6egw.js +6 -0
  19. package/_createAggregator-BpVy5xMi.js +63 -0
  20. package/_getPrototype-D1LAdQKO.js +5 -0
  21. package/_getTag-D3ToyefI.js +126 -0
  22. package/api/lookup/enrich.d.ts +10 -0
  23. package/api/lookup/index.d.ts +5 -0
  24. package/api/lookup/types.d.ts +5 -0
  25. package/api/lookup/types_detection.d.ts +5 -0
  26. package/cloneDeep-CjP5k9zW.js +8 -0
  27. package/components/AnnotationBody.d.ts +6 -0
  28. package/components/AnnotationBody.js +56 -0
  29. package/components/AnnotationDetailPopover.d.ts +14 -0
  30. package/components/AnnotationDetailPopover.js +61 -0
  31. package/components/AnnotationDetails.d.ts +8 -0
  32. package/components/AnnotationDetails.js +172 -0
  33. package/components/AnnotationEntry.d.ts +6 -0
  34. package/components/AnnotationEntry.js +59 -0
  35. package/components/AnnotationPreview.d.ts +14 -0
  36. package/components/AnnotationPreview.js +11 -0
  37. package/components/ClassificationChip.d.ts +11 -0
  38. package/components/ClassificationChip.js +52 -0
  39. package/components/CountBadge.d.ts +8 -0
  40. package/components/CountBadge.js +34 -0
  41. package/components/EnrichedCard.d.ts +14 -0
  42. package/components/EnrichedCard.js +162 -0
  43. package/components/EnrichedChip.d.ts +9 -0
  44. package/components/EnrichedChip.js +176 -0
  45. package/components/EnrichedTypography.d.ts +16 -0
  46. package/components/EnrichedTypography.js +178 -0
  47. package/components/ErrorBoundary.d.ts +15 -0
  48. package/components/ErrorBoundary.js +36 -0
  49. package/components/RetryFailedEnrichments.d.ts +2 -0
  50. package/components/RetryFailedEnrichments.js +13 -0
  51. package/components/SourcePicker.d.ts +2 -0
  52. package/components/SourcePicker.js +98 -0
  53. package/components/actions/ActionForm.d.ts +6 -0
  54. package/components/actions/ActionForm.js +16 -0
  55. package/components/actions/ExecutePopover.d.ts +10 -0
  56. package/components/actions/ExecutePopover.js +93 -0
  57. package/components/actions/ResultModal.d.ts +9 -0
  58. package/components/actions/ResultModal.js +46 -0
  59. package/components/actions/form/schemaAdapter.d.ts +3 -0
  60. package/components/actions/form/schemaAdapter.js +47 -0
  61. package/components/display/graph/ExpandMoreButton.d.ts +7 -0
  62. package/components/display/graph/ExpandMoreButton.js +18 -0
  63. package/components/display/graph/elements/NodeCard.d.ts +10 -0
  64. package/components/display/graph/elements/NodeCard.js +146 -0
  65. package/components/display/graph/elements/NodeTag.d.ts +9 -0
  66. package/components/display/graph/elements/NodeTag.js +17 -0
  67. package/components/display/graph/index.d.ts +9 -0
  68. package/components/display/graph/index.js +438 -0
  69. package/components/display/graph/visualizations/Leaf.d.ts +25 -0
  70. package/components/display/graph/visualizations/Leaf.js +125 -0
  71. package/components/display/graph/visualizations/cloud/index.d.ts +24 -0
  72. package/components/display/graph/visualizations/cloud/index.js +141 -0
  73. package/components/display/graph/visualizations/icons/BaseIcon.d.ts +12 -0
  74. package/components/display/graph/visualizations/icons/BaseIcon.js +37 -0
  75. package/components/display/graph/visualizations/icons/BugIcon.d.ts +5 -0
  76. package/components/display/graph/visualizations/icons/BugIcon.js +18 -0
  77. package/components/display/graph/visualizations/icons/HostIcon.d.ts +5 -0
  78. package/components/display/graph/visualizations/icons/HostIcon.js +24 -0
  79. package/components/display/graph/visualizations/icons/NetworkIcon.d.ts +5 -0
  80. package/components/display/graph/visualizations/icons/NetworkIcon.js +24 -0
  81. package/components/display/graph/visualizations/icons/ProcessIcon.d.ts +5 -0
  82. package/components/display/graph/visualizations/icons/ProcessIcon.js +18 -0
  83. package/components/display/graph/visualizations/icons/TargetIcon.d.ts +5 -0
  84. package/components/display/graph/visualizations/icons/TargetIcon.js +19 -0
  85. package/components/display/graph/visualizations/icons/index.d.ts +2 -0
  86. package/components/display/graph/visualizations/icons/index.js +16 -0
  87. package/components/display/graph/visualizations/panels/NodePanel.d.ts +8 -0
  88. package/components/display/graph/visualizations/panels/NodePanel.js +12 -0
  89. package/components/display/graph/visualizations/tree/BundleLine.d.ts +29 -0
  90. package/components/display/graph/visualizations/tree/BundleLine.js +121 -0
  91. package/components/display/graph/visualizations/tree/Triangle.d.ts +9 -0
  92. package/components/display/graph/visualizations/tree/Triangle.js +26 -0
  93. package/components/display/graph/visualizations/tree/index.d.ts +36 -0
  94. package/components/display/graph/visualizations/tree/index.js +485 -0
  95. package/components/display/graph/visualizations/tree/types.d.ts +11 -0
  96. package/components/display/graph/visualizations/tree/types.js +1 -0
  97. package/components/display/icons/Iconified.d.ts +9 -0
  98. package/components/display/icons/Iconified.js +29 -0
  99. package/components/display/json/index.d.ts +14 -0
  100. package/components/display/json/index.js +12 -0
  101. package/components/display/markdown/DynamicTabs.d.ts +8 -0
  102. package/components/display/markdown/DynamicTabs.js +26 -0
  103. package/components/display/markdown/index.d.ts +9 -0
  104. package/components/display/markdown/index.js +13389 -0
  105. package/components/display/markdown/markdownPlugins/tabs.d.ts +3 -0
  106. package/components/display/markdown/markdownPlugins/tabs.js +4 -0
  107. package/components/enrichment/EnrichPopover.d.ts +10 -0
  108. package/components/enrichment/EnrichPopover.js +88 -0
  109. package/components/fetchers/Fetcher.d.ts +17 -0
  110. package/components/fetchers/Fetcher.js +188 -0
  111. package/components/fetchers/PreviewModal.d.ts +8 -0
  112. package/components/fetchers/PreviewModal.js +22 -0
  113. package/components/fetchers/StatusChip.d.ts +8 -0
  114. package/components/fetchers/StatusChip.js +30 -0
  115. package/components/group/Entry.d.ts +8 -0
  116. package/components/group/Entry.js +15 -0
  117. package/components/group/Group.d.ts +12 -0
  118. package/components/group/Group.js +15 -0
  119. package/components/group/GroupControl.d.ts +4 -0
  120. package/components/group/GroupControl.js +103 -0
  121. package/components/stats/QueryStatus.d.ts +4 -0
  122. package/components/stats/QueryStatus.js +61 -0
  123. package/countBy-C69WslUA.js +14 -0
  124. package/data/event.d.ts +12 -0
  125. package/data/event.js +8 -0
  126. package/database/index.d.ts +4 -0
  127. package/database/index.js +4 -0
  128. package/database/selector.schema.json.d.ts +119 -0
  129. package/database/status.schema.json.d.ts +38 -0
  130. package/database/types.d.ts +64 -0
  131. package/debounce-bV0h5FC5.js +92 -0
  132. package/en/translation.json +135 -0
  133. package/fr/translation.json +134 -0
  134. package/get-D3C3lEU3.js +8 -0
  135. package/groupBy-DC2oOuBN.js +14 -0
  136. package/hooks/ClueActionContext.d.ts +86 -0
  137. package/hooks/ClueActionContext.js +18 -0
  138. package/hooks/ClueComponentContext.d.ts +10 -0
  139. package/hooks/ClueComponentContext.js +40 -0
  140. package/hooks/ClueConfigProvider.d.ts +12 -0
  141. package/hooks/ClueConfigProvider.js +23 -0
  142. package/hooks/ClueDatabaseContext.d.ts +10 -0
  143. package/hooks/ClueDatabaseContext.js +23 -0
  144. package/hooks/ClueEnrichContext.d.ts +6 -0
  145. package/hooks/ClueEnrichContext.js +15 -0
  146. package/hooks/ClueEnrichContextType.d.ts +113 -0
  147. package/hooks/ClueEnrichProps.d.ts +81 -0
  148. package/hooks/ClueFetcherContext.d.ts +35 -0
  149. package/hooks/ClueFetcherContext.js +88 -0
  150. package/hooks/ClueGroupContext.d.ts +14 -0
  151. package/hooks/ClueGroupContext.js +23 -0
  152. package/hooks/CluePopupContext.d.ts +24 -0
  153. package/hooks/CluePopupContext.js +12 -0
  154. package/hooks/ClueProvider.d.ts +9 -0
  155. package/hooks/ClueProvider.js +14 -0
  156. package/hooks/selectors.d.ts +10 -0
  157. package/hooks/selectors.js +24 -0
  158. package/hooks/useAnnotations.d.ts +24 -0
  159. package/hooks/useAnnotations.js +69 -0
  160. package/hooks/useClue.d.ts +4 -0
  161. package/hooks/useClue.js +8 -0
  162. package/hooks/useClueActions.d.ts +4 -0
  163. package/hooks/useClueActions.js +5 -0
  164. package/hooks/useClueConfig.d.ts +1 -0
  165. package/hooks/useClueConfig.js +8 -0
  166. package/hooks/useClueTypeConfig.d.ts +17 -0
  167. package/hooks/useClueTypeConfig.js +7 -0
  168. package/hooks/useComparator.d.ts +16 -0
  169. package/hooks/useComparator.js +1060 -0
  170. package/hooks/useErrors.d.ts +17 -0
  171. package/hooks/useErrors.js +35 -0
  172. package/hooks/useMyHighlights.d.ts +11 -0
  173. package/hooks/useMyHighlights.js +74 -0
  174. package/hooks/useMyLocalStorage.d.ts +16 -0
  175. package/hooks/useMyLocalStorage.js +80 -0
  176. package/iconify-CXMreGTg.js +1782 -0
  177. package/icons/Action.d.ts +9 -0
  178. package/icons/Action.js +90 -0
  179. package/icons/Assessment.d.ts +11 -0
  180. package/icons/Assessment.js +123 -0
  181. package/icons/Context.d.ts +12 -0
  182. package/icons/Context.js +83 -0
  183. package/icons/Opinion.d.ts +11 -0
  184. package/icons/Opinion.js +125 -0
  185. package/icons/iconMap.d.ts +7 -0
  186. package/icons/iconMap.js +10 -0
  187. package/identity-CPGTqrE4.js +6 -0
  188. package/index-BDVjGvMI.js +696 -0
  189. package/index-BDrtH5ec.js +465 -0
  190. package/index-BbPn6-Mw.js +15750 -0
  191. package/index-C9lySIVX.js +1172 -0
  192. package/index-Dn2NHyXg.js +17654 -0
  193. package/index.css +21 -0
  194. package/isEmpty-BQkZubqU.js +29 -0
  195. package/isNil-CIubwp4T.js +6 -0
  196. package/isObject-FTY-5JQX.js +7 -0
  197. package/isObjectLike-OAgjjZye.js +48 -0
  198. package/isSymbol-Xd2FsJyp.js +8 -0
  199. package/isUndefined-CE8h73dH.js +10 -0
  200. package/last-CUCl67Im.js +7 -0
  201. package/main.d.ts +42 -0
  202. package/main.js +70 -0
  203. package/package.json +39 -143
  204. package/public/manifest.json +16 -0
  205. package/public/robots.txt +3 -0
  206. package/public/svg/dark/clue-h.svg +52 -0
  207. package/public/svg/dark/clue-icon1-simple.svg +33 -0
  208. package/public/svg/dark/clue-icon1.svg +44 -0
  209. package/public/svg/dark/clue-icon2-simple.svg +26 -0
  210. package/public/svg/dark/clue-icon2.svg +37 -0
  211. package/public/svg/dark/clue-name.svg +14 -0
  212. package/public/svg/dark/clue-v.svg +52 -0
  213. package/public/svg/light/clue-h.svg +60 -0
  214. package/public/svg/light/clue-icon1-simple.svg +37 -0
  215. package/public/svg/light/clue-icon1.svg +48 -0
  216. package/public/svg/light/clue-icon2-simple.svg +30 -0
  217. package/public/svg/light/clue-icon2.svg +41 -0
  218. package/public/svg/light/clue-name.svg +14 -0
  219. package/public/svg/light/clue-v.svg +60 -0
  220. package/sortBy-B-UKp4GT.js +100 -0
  221. package/sumBy-MYkDPHZL.js +8 -0
  222. package/tabs-xGuUGsJd.js +254 -0
  223. package/text/Frequency.d.ts +9 -0
  224. package/text/Frequency.js +49 -0
  225. package/toFinite-Bc55msYj.js +16 -0
  226. package/toNumber-DPxy1FBy.js +39 -0
  227. package/types/EnrichmentProps.d.ts +73 -0
  228. package/types/RunningActionData.d.ts +15 -0
  229. package/types/WithActionData.d.ts +9 -0
  230. package/types/action.d.ts +25 -0
  231. package/types/config.d.ts +16 -0
  232. package/types/fetcher.d.ts +60 -0
  233. package/types/graph.d.ts +101 -0
  234. package/types/lookup.d.ts +62 -0
  235. package/types/network.d.ts +9 -0
  236. package/useClueTypeConfig-D4zcy8Gr.js +3184 -0
  237. package/utils/chain.d.ts +14 -0
  238. package/utils/chain.js +106 -0
  239. package/utils/classificationParser.d.ts +195 -0
  240. package/utils/classificationParser.js +553 -0
  241. package/utils/constants.d.ts +27 -0
  242. package/utils/constants.js +37 -0
  243. package/utils/graph.d.ts +13 -0
  244. package/utils/graph.js +79 -0
  245. package/utils/hashUtil.d.ts +6 -0
  246. package/utils/hashUtil.js +11 -0
  247. package/utils/line.d.ts +28 -0
  248. package/utils/line.js +136 -0
  249. package/utils/loggerUtil.d.ts +6 -0
  250. package/utils/loggerUtil.js +8 -0
  251. package/utils/sessionStorage.d.ts +9 -0
  252. package/utils/sessionStorage.js +51 -0
  253. package/utils/utils.d.ts +13 -0
  254. package/utils/utils.js +11 -0
  255. package/utils/window.d.ts +3 -0
  256. package/utils/window.js +24 -0
  257. package/utils-CxIhC2xH.js +4182 -0
@@ -0,0 +1,86 @@
1
+ import { AxiosRequestConfig } from 'axios';
2
+ import { ActionDefinitionsResponse, ActionResult } from "../types/action";
3
+ import { Selector } from "../types/lookup";
4
+ import { default as WithActionData } from "../types/WithActionData";
5
+ import { FC, PropsWithChildren } from 'react';
6
+
7
+ export interface ClueActionContextType {
8
+ /**
9
+ * What actions are available to execute?
10
+ */
11
+ availableActions: ActionDefinitionsResponse;
12
+ /**
13
+ * Refresh the list of actions
14
+ */
15
+ refreshActions: () => Promise<ActionDefinitionsResponse>;
16
+ /**
17
+ * Execute an action.
18
+ *
19
+ * @param actionId The ID of the action to execute
20
+ * @param type The type of the selector you're executing on
21
+ * @param value The value of the selector
22
+ * @param classification The clasification of the selector
23
+ * @param params The additional arguments required by the action
24
+ */
25
+ executeAction: (actionId: string, values: Selector[], params?: {
26
+ [index: string]: any;
27
+ }, options?: {
28
+ /**
29
+ * Should the action form show up regardless of if the form is completed?
30
+ */
31
+ forceMenu?: boolean;
32
+ /**
33
+ * Should the function raise an exception instead of showing the menu if the form is not completed?
34
+ */
35
+ skipMenu?: boolean;
36
+ /**
37
+ * Callback for post-execution.
38
+ * @param result
39
+ * @returns The action result
40
+ */
41
+ onComplete?: (result: WithActionData<ActionResult>) => void;
42
+ /**
43
+ * how long should the action have to respond?
44
+ */
45
+ timeout?: number;
46
+ }) => Promise<void>;
47
+ /**
48
+ * Cancel an action pending user input.
49
+ */
50
+ cancelAction: () => void;
51
+ /**
52
+ * Get a list of the results of actions executed on a selector
53
+ * @param type The type of the selector you're executing on
54
+ * @param value The value of the selector
55
+ * @param classification The clasification of the selector
56
+ * @returns the list of results for a given selector
57
+ */
58
+ getActionResults: (type: string, value: string, classification?: string) => WithActionData<ActionResult>[];
59
+ /**
60
+ * Is there currently an action executing?
61
+ */
62
+ loading: boolean;
63
+ }
64
+ export declare const ClueActionContext: import('use-context-selector').Context<ClueActionContextType>;
65
+ export interface ClueActionProps {
66
+ /**
67
+ * The base URL that refers to the clue API. leaving this empty will forward requests to the current origin.
68
+ */
69
+ baseURL?: string;
70
+ /**
71
+ * What should the default classification be when executing actions?
72
+ */
73
+ classification?: string;
74
+ /**
75
+ * Get an access token for the clue API.
76
+ *
77
+ * @returns An access token valid for use with the clue API.
78
+ */
79
+ getToken?: () => string;
80
+ /**
81
+ * Add modify the Axios request configuration before the request is sent
82
+ * @param config The existing axios request config
83
+ */
84
+ onNetworkCall?: (config: AxiosRequestConfig) => AxiosRequestConfig;
85
+ }
86
+ export declare const ClueActionProvider: FC<PropsWithChildren<ClueActionProps>>;
@@ -0,0 +1,18 @@
1
+ import "react/jsx-runtime";
2
+ import "@mui/material";
3
+ import "../index-Dn2NHyXg.js";
4
+ import "../useClueTypeConfig-D4zcy8Gr.js";
5
+ import { a, C } from "../ActionForm-c5hLIfQ-.js";
6
+ import "../components/actions/ResultModal.js";
7
+ import "../components/display/icons/Iconified.js";
8
+ import "../components/ErrorBoundary.js";
9
+ import "../data/event.js";
10
+ import "../utils/window.js";
11
+ import "react";
12
+ import "../index-BDVjGvMI.js";
13
+ import "./ClueComponentContext.js";
14
+ import "./useClue.js";
15
+ export {
16
+ a as ClueActionContext,
17
+ C as ClueActionProvider
18
+ };
@@ -0,0 +1,10 @@
1
+ import { ReactJsonViewProps } from '@microlink/react-json-view';
2
+ import { ComponentType, FC, PropsWithChildren } from 'react';
3
+ import { useTranslation } from 'react-i18next';
4
+
5
+ export type ClueComponentContextType = {
6
+ ReactJson?: ComponentType<ReactJsonViewProps>;
7
+ i18next?: ReturnType<typeof useTranslation>;
8
+ };
9
+ export declare const ClueComponentContext: import('use-context-selector').Context<ClueComponentContextType>;
10
+ export declare const ClueComponentProvider: FC<PropsWithChildren<ClueComponentContextType>>;
@@ -0,0 +1,40 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useMemo } from "react";
3
+ import { useTranslation } from "react-i18next";
4
+ import { c as createContext } from "../index-BDVjGvMI.js";
5
+ const ClueComponentContext = createContext(null);
6
+ const ClueComponentI18nProvider = ({
7
+ children,
8
+ ReactJson
9
+ }) => {
10
+ const i18next = useTranslation();
11
+ const context = useMemo(
12
+ () => ({
13
+ ReactJson,
14
+ i18next
15
+ }),
16
+ [ReactJson, i18next]
17
+ );
18
+ return /* @__PURE__ */ jsx(ClueComponentContext.Provider, { value: context, children });
19
+ };
20
+ const ClueComponentProvider = ({
21
+ children,
22
+ ReactJson,
23
+ i18next = null
24
+ }) => {
25
+ const context = useMemo(
26
+ () => ({
27
+ ReactJson,
28
+ i18next
29
+ }),
30
+ [ReactJson, i18next]
31
+ );
32
+ if (!i18next) {
33
+ return /* @__PURE__ */ jsx(ClueComponentI18nProvider, { ReactJson, children });
34
+ }
35
+ return /* @__PURE__ */ jsx(ClueComponentContext.Provider, { value: context, children });
36
+ };
37
+ export {
38
+ ClueComponentContext,
39
+ ClueComponentProvider
40
+ };
@@ -0,0 +1,12 @@
1
+ import { ApiType } from "../types/config";
2
+ import { FC, PropsWithChildren } from 'react';
3
+
4
+ export type ClueConfigContextProps = {
5
+ config?: ApiType;
6
+ };
7
+ export type ClueConfigContextType = {
8
+ config: ApiType;
9
+ setConfig: (config: ApiType) => void;
10
+ };
11
+ export declare const ClueConfigContext: import('react').Context<ClueConfigContextType>;
12
+ export declare const ClueConfigProvider: FC<PropsWithChildren<ClueConfigContextProps>>;
@@ -0,0 +1,23 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { createContext, useState, useMemo } from "react";
3
+ const ClueConfigContext = createContext(null);
4
+ const ClueConfigProvider = ({ children, config: _config }) => {
5
+ const [config, setConfig] = useState(
6
+ _config ?? {
7
+ configuration: null,
8
+ c12nDef: null
9
+ }
10
+ );
11
+ const context = useMemo(
12
+ () => ({
13
+ config,
14
+ setConfig
15
+ }),
16
+ [config, setConfig]
17
+ );
18
+ return /* @__PURE__ */ jsx(ClueConfigContext.Provider, { value: context, children });
19
+ };
20
+ export {
21
+ ClueConfigContext,
22
+ ClueConfigProvider
23
+ };
@@ -0,0 +1,10 @@
1
+ import { ClueDatabase, DatabaseConfig } from "../database/types";
2
+ import { FC, PropsWithChildren } from 'react';
3
+
4
+ export interface ClueDatabaseContextProps {
5
+ database?: ClueDatabase;
6
+ databaseConfig?: DatabaseConfig;
7
+ }
8
+ export type ClueDatabaseContextType = ClueDatabase;
9
+ export declare const ClueDatabaseContext: import('react').Context<ClueDatabase>;
10
+ export declare const ClueDatabaseProvider: FC<PropsWithChildren<ClueDatabaseContextProps>>;
@@ -0,0 +1,23 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { b as buildDatabase } from "../index-Dn2NHyXg.js";
3
+ import { createContext, useState, useEffect } from "react";
4
+ const ClueDatabaseContext = createContext(null);
5
+ const ClueDatabaseProvider = ({
6
+ children,
7
+ database: _database,
8
+ databaseConfig
9
+ }) => {
10
+ const [database, setDatabase] = useState();
11
+ useEffect(() => {
12
+ if (_database) {
13
+ setDatabase(_database);
14
+ } else {
15
+ buildDatabase(databaseConfig).then(setDatabase);
16
+ }
17
+ }, [_database, databaseConfig]);
18
+ return /* @__PURE__ */ jsx(ClueDatabaseContext.Provider, { value: database, children });
19
+ };
20
+ export {
21
+ ClueDatabaseContext,
22
+ ClueDatabaseProvider
23
+ };
@@ -0,0 +1,6 @@
1
+ import { FC, PropsWithChildren } from 'react';
2
+ import { ClueEnrichContextType } from './ClueEnrichContextType';
3
+ import { ClueEnrichProps } from './ClueEnrichProps';
4
+
5
+ export declare const ClueEnrichContext: import('use-context-selector').Context<ClueEnrichContextType>;
6
+ export declare const ClueEnrichProvider: FC<PropsWithChildren<ClueEnrichProps>>;
@@ -0,0 +1,15 @@
1
+ import "react/jsx-runtime";
2
+ import "../iconify-CXMreGTg.js";
3
+ import "../useClueTypeConfig-D4zcy8Gr.js";
4
+ import "../utils/loggerUtil.js";
5
+ import "react";
6
+ import "../index-BDVjGvMI.js";
7
+ import "./ClueDatabaseContext.js";
8
+ import "./useClueConfig.js";
9
+ import { C, a } from "../ClueEnrichContext-m-4vn9rz.js";
10
+ import "../groupBy-DC2oOuBN.js";
11
+ import "../debounce-bV0h5FC5.js";
12
+ export {
13
+ C as ClueEnrichContext,
14
+ a as ClueEnrichProvider
15
+ };
@@ -0,0 +1,113 @@
1
+ import { StatusDocument } from "../database/types";
2
+ import { BulkEnrichResponses, EnrichResponses, FailedRequest, Selector } from "../types/lookup";
3
+
4
+
5
+ export interface ClueEnrichContextType {
6
+ /**
7
+ * What sources are available to query?
8
+ */
9
+ availableSources: string[];
10
+
11
+ /**
12
+ * The sources a user has selected to query data from. An empty array means all available sources will be used.
13
+ */
14
+ sources: string[];
15
+
16
+ /**
17
+ * Set the list of enrichments to enrich data with.
18
+ * @param enrichments The list of enrichments
19
+ */
20
+ setSources: (enrichments: string[]) => void;
21
+
22
+ /**
23
+ * List of all failed enrichments
24
+ */
25
+ failedEnrichments?: FailedRequest[];
26
+
27
+ /**
28
+ * Bulk enrich a large number of values in a single request.
29
+ * @param bulkData A list of bulk enrich requests, specifying the type and value
30
+ * @param options Set some options about how the enrichment should be enriched
31
+ * @returns a list of enrichment results broken down by type and value
32
+ */
33
+ bulkEnrich: (
34
+ bulkData: Selector[],
35
+ options?: {
36
+ classification?: string;
37
+ timeout?: number;
38
+ force?: boolean;
39
+ includeRaw?: boolean;
40
+ noCache?: boolean;
41
+ sources?: string[];
42
+ }
43
+ ) => Promise<BulkEnrichResponses>;
44
+
45
+ /**
46
+ * Enrich a single item
47
+ * @param type The type of the data to enrich
48
+ * @param value The value itself
49
+ * @param options Set some options about how the enrichment should be enriched
50
+ * @returns a list of enrichment results for the given type and value
51
+ */
52
+ enrich: (
53
+ type: string,
54
+ value: string,
55
+ options?: {
56
+ classification?: string;
57
+ timeout?: number;
58
+ force?: boolean;
59
+ includeRaw?: boolean;
60
+ noCache?: boolean;
61
+ sources?: string[];
62
+ append?: boolean;
63
+ }
64
+ ) => Promise<EnrichResponses>;
65
+
66
+ /**
67
+ * Enrich failed enrichments by source
68
+ * @returns a list of enrichment results for all failed enrichments
69
+ */
70
+ enrichFailedEnrichments: () => Promise<void>;
71
+
72
+ /**
73
+ * Queue a value for asynchronous enrichment. Slightly slower, but massively more efficient for your network as it
74
+ * uses bulkEnrich, while returning a single value.
75
+ * @param type The type of the data to enrich
76
+ * @param value The value itself
77
+ * @param classification An optional indicator-specific classification
78
+ * @returns a list of enrichment results for the given type and value
79
+ */
80
+ queueEnrich: (type: string, value: string, classification?: string) => Promise<StatusDocument>;
81
+
82
+ /**
83
+ * A set of regexes applications can use for detecting the clue type of a given string
84
+ */
85
+ typesDetection: { [type: string]: RegExp };
86
+
87
+ /**
88
+ * A helper function that automatically returns the clue type (or null if the type can't be inferred) of a given value
89
+ * @param value The value whose type we should infer
90
+ * @returns the inferred type
91
+ */
92
+ guessType: (value: string) => string | null;
93
+
94
+ /**
95
+ * Set the is ready state of the provider, when set to true, the provider will be able to issue http queries
96
+ * @param value The value whose type we should infer
97
+ * @returns the inferred type
98
+ */
99
+ setReady: (ready: boolean) => void;
100
+
101
+ /**
102
+ * Set the custom Iconify URL
103
+ * @param value the URL to use for iconify
104
+ */
105
+ setCustomIconify: (value: string) => void;
106
+
107
+ /**
108
+ * Is the clue context ready to enrich?
109
+ */
110
+ ready: boolean;
111
+
112
+ defaultClassification: string;
113
+ }
@@ -0,0 +1,81 @@
1
+ import { AxiosRequestConfig } from 'axios';
2
+ import { Selector } from "../types/lookup";
3
+
4
+
5
+ export interface ClueEnrichProps {
6
+ /**
7
+ * The base URL that refers to the clue API. leaving this empty will forward requests to the current origin.
8
+ */
9
+ baseURL?: string;
10
+
11
+ /**
12
+ * How many IOCs should be sent in each network request? Defaults to 20.
13
+ */
14
+ chunkSize?: number;
15
+
16
+ /**
17
+ * How many requests should clue dispatch at once?
18
+ */
19
+ maxRequestCount?: number;
20
+
21
+ /**
22
+ * What should the default timeout be, if no timeout is supplied in an enrichment call?
23
+ */
24
+ defaultTimeout?: number;
25
+
26
+ /**
27
+ * Should enrichment be enabled? If set to false, enrichment will only be used when explicitly called.
28
+ */
29
+ enabled?: boolean;
30
+
31
+ /**
32
+ * What should the default classification be for indicators?
33
+ */
34
+ classification?: string;
35
+
36
+ /**
37
+ * Is the clue provider ready to do queries?
38
+ */
39
+ ready?: boolean;
40
+
41
+ /**
42
+ * Get an access token for the clue API.
43
+ *
44
+ * @returns An access token valid for use with the clue API.
45
+ */
46
+ getToken?: () => string;
47
+
48
+ /**
49
+ * Should we use custom deployment or public deployment of Iconify
50
+ */
51
+ publicIconify?: boolean;
52
+
53
+ /**
54
+ * Add modify the Axios request configuration before the request is sent
55
+ * @param config The existing axios request config
56
+ */
57
+ onNetworkCall?: (config: AxiosRequestConfig) => AxiosRequestConfig;
58
+
59
+ /**
60
+ * Modify the list of sources enrichments are requested from before the
61
+ * @param configuredSources The list of sources configured globally to execute
62
+ * @param availableSources The full list of available sources in clue
63
+ * @param selectors The list of selectors about to be enriched
64
+ */
65
+ pickSources?: (configuredSources: string[], availableSources: string[], selectors: Selector[]) => string[] | null;
66
+
67
+ /**
68
+ * Should we skip making the clue config call? Only set this if you'll manually make the call. Likely only for internal use.
69
+ */
70
+ skipConfigCall?: boolean;
71
+
72
+ /**
73
+ * A hostname for the custom Iconify domain to use. Only used if publicIconify is set to false.
74
+ */
75
+ customIconify?: string;
76
+
77
+ /**
78
+ * Flag for enabled/disabling Debug logging. Default is true.
79
+ */
80
+ debugLogging?: boolean;
81
+ }
@@ -0,0 +1,35 @@
1
+ import { AxiosRequestConfig } from 'axios';
2
+ import { FetcherDefinition, FetcherResult } from "../types/fetcher";
3
+ import { Selector } from "../types/lookup";
4
+ import { FC, PropsWithChildren } from 'react';
5
+
6
+ export interface ClueFetcherContextProps {
7
+ /**
8
+ * The base URL that refers to the clue API. leaving this empty will forward requests to the current origin.
9
+ */
10
+ baseURL?: string;
11
+ /**
12
+ * What should the default classification be for indicators?
13
+ */
14
+ classification?: string;
15
+ /**
16
+ * Get an access token for the clue API.
17
+ *
18
+ * @returns An access token valid for use with the clue API.
19
+ */
20
+ getToken?: () => string;
21
+ /**
22
+ * Add modify the Axios request configuration before the request is sent
23
+ * @param config The existing axios request config
24
+ */
25
+ onNetworkCall?: (config: AxiosRequestConfig) => AxiosRequestConfig;
26
+ }
27
+ export type ClueFetcherContextType = {
28
+ fetchSelector: (fetcherId: string, selector: Selector) => Promise<FetcherResult>;
29
+ fetchers: {
30
+ [index: string]: FetcherDefinition;
31
+ };
32
+ fetchCompleted: boolean;
33
+ };
34
+ export declare const ClueFetcherContext: import('use-context-selector').Context<ClueFetcherContextType>;
35
+ export declare const ClueFetcherProvider: FC<PropsWithChildren<ClueFetcherContextProps>>;
@@ -0,0 +1,88 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { a as api } from "../useClueTypeConfig-D4zcy8Gr.js";
3
+ import { useState, useRef, useCallback, useEffect, useMemo } from "react";
4
+ import { c as createContext } from "../index-BDVjGvMI.js";
5
+ import useClue from "./useClue.js";
6
+ import useClueConfig from "./useClueConfig.js";
7
+ const ClueFetcherContext = createContext(null);
8
+ const ClueFetcherProvider = ({
9
+ baseURL,
10
+ children,
11
+ classification: _defaultClassification,
12
+ getToken,
13
+ onNetworkCall
14
+ }) => {
15
+ var _a, _b;
16
+ const clueConfig = useClueConfig();
17
+ const { ready } = useClue();
18
+ const [defaultClassification, setDefaultClasification] = useState(_defaultClassification);
19
+ const [fetchCompleted, setFetchCompleted] = useState(false);
20
+ const [fetchers, setFetchers] = useState({});
21
+ const fetchRequests = useRef({});
22
+ const getHashKey = useCallback(
23
+ ({ type, value, classification }) => JSON.stringify({ type, value, classification: classification ?? defaultClassification }),
24
+ [defaultClassification]
25
+ );
26
+ const fetchSelector = useCallback(
27
+ async (fetcherId, selector) => {
28
+ var _a2;
29
+ if ((_a2 = fetchRequests.current[fetcherId]) == null ? void 0 : _a2[getHashKey(selector)]) {
30
+ return fetchRequests.current[fetcherId][getHashKey(selector)];
31
+ }
32
+ try {
33
+ const headers = {};
34
+ const token = getToken == null ? void 0 : getToken();
35
+ if (token) {
36
+ headers.Authorization = `Bearer ${token}`;
37
+ }
38
+ let requestConfig = { baseURL, headers };
39
+ if (onNetworkCall) {
40
+ requestConfig = onNetworkCall(requestConfig);
41
+ }
42
+ const result = api.fetchers.post(fetcherId, selector, requestConfig);
43
+ if (!fetchRequests.current[fetcherId]) {
44
+ fetchRequests.current[fetcherId] = {};
45
+ }
46
+ fetchRequests.current[fetcherId][getHashKey(selector)] = result;
47
+ return await result;
48
+ } catch {
49
+ return null;
50
+ }
51
+ },
52
+ [baseURL, getHashKey, getToken, onNetworkCall]
53
+ );
54
+ useEffect(() => {
55
+ var _a2, _b2, _c, _d;
56
+ if (!defaultClassification && ((_b2 = (_a2 = clueConfig.config) == null ? void 0 : _a2.c12nDef) == null ? void 0 : _b2.UNRESTRICTED)) {
57
+ setDefaultClasification((_d = (_c = clueConfig.config) == null ? void 0 : _c.c12nDef) == null ? void 0 : _d.UNRESTRICTED);
58
+ }
59
+ }, [(_b = (_a = clueConfig.config) == null ? void 0 : _a.c12nDef) == null ? void 0 : _b.UNRESTRICTED, defaultClassification]);
60
+ useEffect(() => {
61
+ if (!ready) {
62
+ return;
63
+ }
64
+ const headers = {};
65
+ const token = getToken == null ? void 0 : getToken();
66
+ if (token) {
67
+ headers.Authorization = `Bearer ${token}`;
68
+ }
69
+ let requestConfig = { baseURL, headers };
70
+ if (onNetworkCall) {
71
+ requestConfig = onNetworkCall(requestConfig);
72
+ }
73
+ api.fetchers.get(requestConfig).then(setFetchers).finally(() => setFetchCompleted(true));
74
+ }, [baseURL, ready]);
75
+ const context = useMemo(
76
+ () => ({
77
+ fetchSelector,
78
+ fetchers,
79
+ fetchCompleted
80
+ }),
81
+ [fetchCompleted, fetchSelector, fetchers]
82
+ );
83
+ return /* @__PURE__ */ jsx(ClueFetcherContext.Provider, { value: context, children });
84
+ };
85
+ export {
86
+ ClueFetcherContext,
87
+ ClueFetcherProvider
88
+ };
@@ -0,0 +1,14 @@
1
+ import { Dispatch, FC, PropsWithChildren, SetStateAction } from 'react';
2
+
3
+ export type ClueGroupContextProps = {
4
+ type: string;
5
+ classification?: string;
6
+ };
7
+ export type ClueGroupContextType = {
8
+ type: string;
9
+ classification: string;
10
+ values: any[];
11
+ setValues: Dispatch<SetStateAction<any[]>>;
12
+ };
13
+ export declare const ClueGroupContext: import('use-context-selector').Context<ClueGroupContextType>;
14
+ export declare const ClueGroupProvider: FC<PropsWithChildren<ClueGroupContextProps>>;
@@ -0,0 +1,23 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useState, useMemo } from "react";
3
+ import { c as createContext } from "../index-BDVjGvMI.js";
4
+ import { useClueEnrichSelector } from "./selectors.js";
5
+ const ClueGroupContext = createContext(null);
6
+ const ClueGroupProvider = ({ children, type, classification }) => {
7
+ const defaultClassification = useClueEnrichSelector((ctx) => ctx.defaultClassification);
8
+ const [values, setValues] = useState([]);
9
+ const context = useMemo(
10
+ () => ({
11
+ type,
12
+ values,
13
+ setValues,
14
+ classification: classification ?? defaultClassification
15
+ }),
16
+ [classification, defaultClassification, type, values]
17
+ );
18
+ return /* @__PURE__ */ jsx(ClueGroupContext.Provider, { value: context, children });
19
+ };
20
+ export {
21
+ ClueGroupContext,
22
+ ClueGroupProvider
23
+ };
@@ -0,0 +1,24 @@
1
+ import { PopoverProps } from '@mui/material';
2
+ import { Annotation, Selector } from "../types/lookup";
3
+ import { FC, PropsWithChildren, default as React } from 'react';
4
+
5
+ type PopupType = 'details' | 'actionResults' | Annotation['type'];
6
+ export interface ShowInfoOptions {
7
+ content?: React.ReactNode;
8
+ onClose?: () => void;
9
+ popoverProps?: Omit<PopoverProps, 'open'>;
10
+ }
11
+ export interface CluePopupContextType {
12
+ showInfo: (type: PopupType, anchorEl: HTMLElement, value: Selector, options?: ShowInfoOptions) => void;
13
+ closeInfo: (type: PopupType, value: Selector) => void;
14
+ __detailsContent: React.ReactNode | null;
15
+ }
16
+ export interface PopupEventType {
17
+ type: PopupType;
18
+ value: Selector;
19
+ anchorEl: HTMLElement;
20
+ options?: ShowInfoOptions;
21
+ }
22
+ export declare const CluePopupContext: import('use-context-selector').Context<CluePopupContextType>;
23
+ export declare const CluePopupProvider: FC<PropsWithChildren>;
24
+ export {};
@@ -0,0 +1,12 @@
1
+ import "react/jsx-runtime";
2
+ import "../components/AnnotationDetailPopover.js";
3
+ import { C, a } from "../AnnotationPreview-BvNpZOP0.js";
4
+ import "../data/event.js";
5
+ import "../utils/window.js";
6
+ import "react";
7
+ import "../index-BDVjGvMI.js";
8
+ import "../isUndefined-CE8h73dH.js";
9
+ export {
10
+ C as CluePopupContext,
11
+ a as CluePopupProvider
12
+ };
@@ -0,0 +1,9 @@
1
+ import { FC, PropsWithChildren } from 'react';
2
+ import { ClueActionProps } from './ClueActionContext';
3
+ import { ClueComponentContextType } from './ClueComponentContext';
4
+ import { ClueConfigContextProps } from './ClueConfigProvider';
5
+ import { ClueDatabaseContextProps } from './ClueDatabaseContext';
6
+ import { ClueEnrichProps } from './ClueEnrichProps';
7
+
8
+ declare const ClueProvider: FC<PropsWithChildren<ClueEnrichProps & ClueActionProps & ClueComponentContextType & ClueDatabaseContextProps & ClueConfigContextProps>>;
9
+ export { ClueProvider };
@@ -0,0 +1,14 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { C as ClueActionProvider } from "../ActionForm-c5hLIfQ-.js";
3
+ import { ClueComponentProvider } from "./ClueComponentContext.js";
4
+ import { ClueConfigProvider } from "./ClueConfigProvider.js";
5
+ import { ClueDatabaseProvider } from "./ClueDatabaseContext.js";
6
+ import { a as ClueEnrichProvider } from "../ClueEnrichContext-m-4vn9rz.js";
7
+ import { ClueFetcherProvider } from "./ClueFetcherContext.js";
8
+ import { a as CluePopupProvider } from "../AnnotationPreview-BvNpZOP0.js";
9
+ const ClueProvider = ({ children, ...props }) => {
10
+ return /* @__PURE__ */ jsx(ClueComponentProvider, { ...props, children: /* @__PURE__ */ jsx(ClueConfigProvider, { config: props.config, children: /* @__PURE__ */ jsx(ClueDatabaseProvider, { ...props, children: /* @__PURE__ */ jsx(ClueEnrichProvider, { ...props, children: /* @__PURE__ */ jsx(ClueFetcherProvider, { ...props, children: /* @__PURE__ */ jsx(ClueActionProvider, { ...props, children: /* @__PURE__ */ jsx(CluePopupProvider, { children }) }) }) }) }) }) });
11
+ };
12
+ export {
13
+ ClueProvider
14
+ };