@cccsaurora/clue-ui 1.3.0-dev.268 → 1.3.0-dev.284

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 (58) hide show
  1. package/{ActionForm-C4mWgND1.js → ActionForm-Cdo8jBDU.js} +7 -7
  2. package/{AnnotationDetails-CFsyeAZD.js → AnnotationDetails-CUU61Vwl.js} +4 -3
  3. package/{AnnotationPreview-CEopHIPL.js → AnnotationPreview-WuxXgLCE.js} +1 -1
  4. package/{ClueEnrichContext-CJEJxrgs.js → ClueEnrichContext-CZkS1jpb.js} +24 -9
  5. package/components/AnnotationDetailPopover.js +1 -1
  6. package/components/AnnotationDetails.js +3 -3
  7. package/components/AnnotationPreview.js +1 -1
  8. package/components/EnrichedCard.js +2 -2
  9. package/components/EnrichedChip.js +2 -2
  10. package/components/EnrichedTypography.js +2 -2
  11. package/components/RetryFailedEnrichments.js +1 -1
  12. package/components/SourcePicker.js +1 -1
  13. package/components/actions/ActionForm.js +1 -1
  14. package/components/actions/ExecutePopover.js +1 -1
  15. package/components/actions/ResultModal.js +1 -1
  16. package/components/enrichment/EnrichPopover.js +1 -1
  17. package/components/fetchers/Fetcher.js +1 -1
  18. package/components/group/GroupControl.js +1 -1
  19. package/components/stats/QueryStatus.js +1 -1
  20. package/database/globals.d.ts +5 -0
  21. package/database/globals.js +4 -0
  22. package/database/index.js +4 -1
  23. package/database/replication.d.ts +4 -0
  24. package/database/replication.js +7 -0
  25. package/database/selector.schema.json.d.ts +94 -71
  26. package/database/sync.d.ts +12 -0
  27. package/database/types.d.ts +58 -1
  28. package/hooks/ClueActionContext.js +2 -2
  29. package/hooks/ClueDatabaseContext.d.ts +33 -0
  30. package/hooks/ClueDatabaseContext.js +22 -5
  31. package/hooks/ClueEnrichContext.js +6 -3
  32. package/hooks/ClueFetcherContext.js +1 -1
  33. package/hooks/ClueGroupContext.js +1 -1
  34. package/hooks/CluePopupContext.js +2 -2
  35. package/hooks/ClueProvider.js +3 -3
  36. package/hooks/selectors.js +2 -2
  37. package/hooks/useActionResult.js +1 -1
  38. package/hooks/useAnnotations.js +6 -4
  39. package/hooks/useClue.js +1 -1
  40. package/hooks/useClueActions.js +1 -1
  41. package/hooks/useClueTypeConfig.js +3 -2
  42. package/hooks/useErrors.js +1 -1
  43. package/hooks/useFetcherResult.js +1 -1
  44. package/icons/Action.js +2 -2
  45. package/icons/Assessment.js +1 -1
  46. package/icons/Context.js +1 -1
  47. package/icons/Opinion.js +1 -1
  48. package/{index-C12gPw2W.js → index-BXnMCI65.js} +775 -9162
  49. package/{useClueTypeConfig-Z1LFp01b.js → index-BfslcSud.js} +104 -129
  50. package/{index-B6C2a_Lg.js → index-NaBSmVOx.js} +1 -1
  51. package/main.js +5 -5
  52. package/package.json +1 -1
  53. package/replication-BCvfRqsy.js +11777 -0
  54. package/{debounce-bV0h5FC5.js → sessionStorage-Dbmo2Exe.js} +49 -1
  55. package/useClueTypeConfig-DnF4rLsl.js +59 -0
  56. package/utils/constants.d.ts +1 -0
  57. package/utils/constants.js +2 -0
  58. package/utils/sessionStorage.js +8 -49
@@ -1,3 +1,4 @@
1
+ import { StorageKey, MY_SESSION_STORAGE_PREFIX } from "./utils/constants.js";
1
2
  import { i as isObject } from "./isObject-FTY-5JQX.js";
2
3
  import { r as root } from "./isObjectLike-OAgjjZye.js";
3
4
  import { t as toNumber } from "./toNumber-DPxy1FBy.js";
@@ -87,6 +88,53 @@ function debounce(func, wait, options) {
87
88
  debounced.flush = flush;
88
89
  return debounced;
89
90
  }
91
+ const buildName = (name) => `${MY_SESSION_STORAGE_PREFIX}.${name}`;
92
+ const {
93
+ _getStored: getStored,
94
+ _removeStored: removeStored,
95
+ _setStored: setStored
96
+ } = /* @__PURE__ */ (() => {
97
+ let changes = {};
98
+ const _getStored = (name) => {
99
+ return changes[buildName(name)] ?? JSON.parse(sessionStorage.getItem(buildName(name)));
100
+ };
101
+ const _removeStored = (name) => {
102
+ delete changes[buildName(name)];
103
+ sessionStorage.removeItem(buildName(name));
104
+ };
105
+ const _setStored = (name, item) => {
106
+ changes[buildName(name)] = item;
107
+ debounce(
108
+ () => {
109
+ Object.entries(changes).forEach(([_name, data]) => {
110
+ try {
111
+ sessionStorage.setItem(_name, JSON.stringify(data));
112
+ } catch (e) {
113
+ console.warn("Quota Error when saving to sessionStorage", e);
114
+ }
115
+ });
116
+ changes = {};
117
+ },
118
+ 250,
119
+ { leading: false, trailing: true, maxWait: 800 }
120
+ );
121
+ };
122
+ return { _getStored, _removeStored, _setStored };
123
+ })();
124
+ const getAxiosCache = () => {
125
+ return getStored(StorageKey.AXIOS_CACHE) ?? {};
126
+ };
127
+ const setAxiosCache = (etag, value) => {
128
+ const cache = getAxiosCache();
129
+ cache[etag] = value;
130
+ setStored(StorageKey.AXIOS_CACHE, cache);
131
+ };
90
132
  export {
91
- debounce as d
133
+ getStored as a,
134
+ buildName as b,
135
+ setStored as c,
136
+ debounce as d,
137
+ getAxiosCache as g,
138
+ removeStored as r,
139
+ setAxiosCache as s
92
140
  };
@@ -0,0 +1,59 @@
1
+ import { g as get, b as get$1 } from "./index-BfslcSud.js";
2
+ import { clueDebugLogger } from "./utils/loggerUtil.js";
3
+ import { b as baseUniq, i as isEmpty } from "./_baseUniq-BI9GIHMF.js";
4
+ import { useState, useEffect } from "react";
5
+ function uniq(array) {
6
+ return array && array.length ? baseUniq(array) : [];
7
+ }
8
+ const useClueTypeConfig = (ready, baseURL, debugLogging, getToken, onNetworkCall) => {
9
+ const [availableSources, setAvailableSources] = useState([]);
10
+ const [typesDetection, setTypesDetection] = useState({});
11
+ const [supportedTypes, setSupportedTypes] = useState([]);
12
+ useEffect(() => {
13
+ if (!ready) {
14
+ return;
15
+ }
16
+ if ((availableSources == null ? void 0 : availableSources.length) > 0 && !isEmpty(typesDetection)) {
17
+ return;
18
+ }
19
+ const headers = {};
20
+ const token = getToken == null ? void 0 : getToken();
21
+ if (token) {
22
+ headers.Authorization = `Bearer ${token}`;
23
+ }
24
+ (async () => {
25
+ let requestConfig = { baseURL, headers };
26
+ if (onNetworkCall) {
27
+ requestConfig = onNetworkCall(requestConfig);
28
+ }
29
+ clueDebugLogger("Executing types and type detection lookup", debugLogging);
30
+ const [_typesPerSource, _typesDetections] = await Promise.all([
31
+ get(requestConfig),
32
+ get$1(requestConfig)
33
+ ]);
34
+ if (_typesPerSource) {
35
+ setAvailableSources(Object.keys(_typesPerSource));
36
+ setSupportedTypes(uniq(Object.values(_typesPerSource).flat()));
37
+ }
38
+ if (_typesDetections) {
39
+ setTypesDetection(
40
+ Object.entries(_typesDetections).reduce((acc, [key, regex]) => {
41
+ if (regex !== null) {
42
+ acc[key] = new RegExp(regex);
43
+ }
44
+ return acc;
45
+ }, {})
46
+ );
47
+ }
48
+ })();
49
+ }, [baseURL, ready]);
50
+ return {
51
+ availableSources,
52
+ typesDetection,
53
+ supportedTypes
54
+ };
55
+ };
56
+ export {
57
+ useClueTypeConfig as a,
58
+ uniq as u
59
+ };
@@ -1,6 +1,7 @@
1
1
  export declare const CLUE_API: any;
2
2
  export declare const LOCAL: boolean;
3
3
  export declare const VERSION: any;
4
+ export declare const REPLICATE: boolean;
4
5
  export declare const MY_LOCAL_STORAGE_PREFIX = "clue.ui";
5
6
  export declare const MY_SESSION_STORAGE_PREFIX = "clue.ui.cache";
6
7
  export declare enum StorageKey {
@@ -1,6 +1,7 @@
1
1
  const CLUE_API = void 0;
2
2
  const LOCAL = CLUE_API === "MOCK";
3
3
  const VERSION = void 0;
4
+ const REPLICATE = false;
4
5
  const MY_LOCAL_STORAGE_PREFIX = "clue.ui";
5
6
  const MY_SESSION_STORAGE_PREFIX = `${MY_LOCAL_STORAGE_PREFIX}.cache`;
6
7
  var StorageKey = /* @__PURE__ */ ((StorageKey2) => {
@@ -32,6 +33,7 @@ export {
32
33
  LOCAL,
33
34
  MY_LOCAL_STORAGE_PREFIX,
34
35
  MY_SESSION_STORAGE_PREFIX,
36
+ REPLICATE,
35
37
  StorageKey,
36
38
  VERSION
37
39
  };
@@ -1,51 +1,10 @@
1
- import { StorageKey, MY_SESSION_STORAGE_PREFIX } from "./constants.js";
2
- import { d as debounce } from "../debounce-bV0h5FC5.js";
3
- const buildName = (name) => `${MY_SESSION_STORAGE_PREFIX}.${name}`;
4
- const {
5
- _getStored: getStored,
6
- _removeStored: removeStored,
7
- _setStored: setStored
8
- } = /* @__PURE__ */ (() => {
9
- let changes = {};
10
- const _getStored = (name) => {
11
- return changes[buildName(name)] ?? JSON.parse(sessionStorage.getItem(buildName(name)));
12
- };
13
- const _removeStored = (name) => {
14
- delete changes[buildName(name)];
15
- sessionStorage.removeItem(buildName(name));
16
- };
17
- const _setStored = (name, item) => {
18
- changes[buildName(name)] = item;
19
- debounce(
20
- () => {
21
- Object.entries(changes).forEach(([_name, data]) => {
22
- try {
23
- sessionStorage.setItem(_name, JSON.stringify(data));
24
- } catch (e) {
25
- console.warn("Quota Error when saving to sessionStorage", e);
26
- }
27
- });
28
- changes = {};
29
- },
30
- 250,
31
- { leading: false, trailing: true, maxWait: 800 }
32
- );
33
- };
34
- return { _getStored, _removeStored, _setStored };
35
- })();
36
- const getAxiosCache = () => {
37
- return getStored(StorageKey.AXIOS_CACHE) ?? {};
38
- };
39
- const setAxiosCache = (etag, value) => {
40
- const cache = getAxiosCache();
41
- cache[etag] = value;
42
- setStored(StorageKey.AXIOS_CACHE, cache);
43
- };
1
+ import "./constants.js";
2
+ import { b, g, a, r, s, c } from "../sessionStorage-Dbmo2Exe.js";
44
3
  export {
45
- buildName,
46
- getAxiosCache,
47
- getStored,
48
- removeStored,
49
- setAxiosCache,
50
- setStored
4
+ b as buildName,
5
+ g as getAxiosCache,
6
+ a as getStored,
7
+ r as removeStored,
8
+ s as setAxiosCache,
9
+ c as setStored
51
10
  };