@cccsaurora/clue-ui 1.3.0-dev.279 → 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 +17 -17
  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
@@ -6,8 +6,8 @@ import Iconified from "./components/display/icons/Iconified.js";
6
6
  import { J as JSONViewer } from "./index-JcKyZeoY.js";
7
7
  import { ClueComponentContext } from "./hooks/ClueComponentContext.js";
8
8
  import { g as getDefaultExportFromCjs } from "./_commonjsHelpers-DWwsNxpa.js";
9
- import { x as jsonSchemaTraverseExports, y as fastDeepEqual, z as fastUriExports } from "./index-C12gPw2W.js";
10
- import { a as api } from "./useClueTypeConfig-Z1LFp01b.js";
9
+ import { j as jsonSchemaTraverseExports, f as fastDeepEqual, a as fastUriExports } from "./index-BXnMCI65.js";
10
+ import { a as api } from "./index-BfslcSud.js";
11
11
  import { d as toString } from "./_baseGet-Bx3A4Qfp.js";
12
12
  import { b as baseSlice } from "./_baseSlice-GAv_YFTT.js";
13
13
  import { i as isEqual } from "./utils-HmNPuoDB.js";
@@ -16,7 +16,7 @@ import { u as useContextSelector, c as createContext, a as useContext } from "./
16
16
  import ErrorBoundary from "./components/ErrorBoundary.js";
17
17
  import { adaptSchema } from "./components/actions/form/schemaAdapter.js";
18
18
  import { I as Icon } from "./iconify-CXMreGTg.js";
19
- import { C as ClueEnrichContext } from "./ClueEnrichContext-CJEJxrgs.js";
19
+ import { C as ClueEnrichContext } from "./ClueEnrichContext-CZkS1jpb.js";
20
20
  import { ClueFetcherContext } from "./hooks/ClueFetcherContext.js";
21
21
  import ClassificationChip from "./components/ClassificationChip.js";
22
22
  import Result from "./components/actions/formats/index.js";
@@ -5523,7 +5523,7 @@ const ClueActionProvider = ({
5523
5523
  const [lastResult, setLastResult] = useState(null);
5524
5524
  const [loading, setLoading] = useState(false);
5525
5525
  const [availableActions, setAvailableActions] = useState({});
5526
- const requestConfig = useMemo(() => {
5526
+ const requestConfig = useCallback(() => {
5527
5527
  const headers = {};
5528
5528
  const token = getToken == null ? void 0 : getToken();
5529
5529
  if (token) {
@@ -5536,7 +5536,7 @@ const ClueActionProvider = ({
5536
5536
  if (!ready) {
5537
5537
  return;
5538
5538
  }
5539
- const _actions = await api.actions.get(requestConfig);
5539
+ const _actions = await api.actions.get(requestConfig());
5540
5540
  if (_actions) {
5541
5541
  setAvailableActions(_actions);
5542
5542
  }
@@ -5622,7 +5622,7 @@ const ClueActionProvider = ({
5622
5622
  validatedParams ?? {},
5623
5623
  context2,
5624
5624
  { timeout },
5625
- requestConfig
5625
+ requestConfig()
5626
5626
  );
5627
5627
  const actionResultWithData = { ...actionResult, actionId, action: actionToRun, params: validatedParams };
5628
5628
  onComplete == null ? void 0 : onComplete(actionResultWithData);
@@ -5697,7 +5697,7 @@ const ClueActionProvider = ({
5697
5697
  const getActionStatus = useCallback(
5698
5698
  async (actionId, taskId) => {
5699
5699
  try {
5700
- const res = await api.actions.status.get(actionId, taskId, {}, requestConfig);
5700
+ const res = await api.actions.status.get(actionId, taskId, {}, requestConfig());
5701
5701
  return res;
5702
5702
  } catch (e) {
5703
5703
  safeDispatchEvent(
@@ -4,13 +4,13 @@ import { useTheme, Stack, Typography, Tooltip, Box, IconButton, CircularProgress
4
4
  import Iconified from "./components/display/icons/Iconified.js";
5
5
  import { SNACKBAR_EVENT_ID } from "./data/event.js";
6
6
  import { ClueComponentContext } from "./hooks/ClueComponentContext.js";
7
- import { b as useClueEnrichSelector } from "./ActionForm-C4mWgND1.js";
7
+ import { b as useClueEnrichSelector } from "./ActionForm-Cdo8jBDU.js";
8
8
  import useAnnotations from "./hooks/useAnnotations.js";
9
9
  import useErrors from "./hooks/useErrors.js";
10
10
  import { ICON_MAP } from "./icons/iconMap.js";
11
11
  import { safeDispatchEvent } from "./utils/window.js";
12
12
  import { g as groupBy } from "./groupBy-xqz-n0Vd.js";
13
- import { u as uniq } from "./useClueTypeConfig-Z1LFp01b.js";
13
+ import { u as uniq } from "./useClueTypeConfig-DnF4rLsl.js";
14
14
  import { memo, useState, useMemo, useCallback, useEffect } from "react";
15
15
  import { u as useContextSelector } from "./index-AMfoEg_6.js";
16
16
  import ExecutePopover from "./components/actions/ExecutePopover.js";
@@ -25,6 +25,7 @@ const AnnotationDetails = ({ enrichRequest, setReady, updatePosition }) => {
25
25
  const { t } = useContextSelector(ClueComponentContext, (ctx) => ctx.i18next);
26
26
  const [filter, setFilter] = useState("all");
27
27
  const enrich = useClueEnrichSelector((state) => state.enrich);
28
+ const ready = useClueEnrichSelector((state) => state.ready);
28
29
  const [annotations, loading] = useAnnotations(
29
30
  enrichRequest == null ? void 0 : enrichRequest.type,
30
31
  enrichRequest == null ? void 0 : enrichRequest.value,
@@ -66,7 +67,7 @@ const AnnotationDetails = ({ enrichRequest, setReady, updatePosition }) => {
66
67
  ] })
67
68
  ] }),
68
69
  /* @__PURE__ */ jsx("div", { style: { flex: 1 } }),
69
- /* @__PURE__ */ jsx(Tooltip, { title: t("refresh"), children: /* @__PURE__ */ jsx(Box, { sx: { alignSelf: "center", m: -1 }, children: /* @__PURE__ */ jsx(IconButton, { onClick: () => forceEnrich(), disabled: loading, children: loading ? /* @__PURE__ */ jsx(CircularProgress, { variant: "indeterminate", size: 20 }) : /* @__PURE__ */ jsx(Iconified, { icon: "ic:baseline-replay", fontSize: "small" }) }) }) }),
70
+ /* @__PURE__ */ jsx(Tooltip, { title: t("refresh"), children: /* @__PURE__ */ jsx(Box, { sx: { alignSelf: "center", m: -1 }, children: /* @__PURE__ */ jsx(IconButton, { onClick: () => forceEnrich(), disabled: loading || !ready, children: loading ? /* @__PURE__ */ jsx(CircularProgress, { variant: "indeterminate", size: 20 }) : /* @__PURE__ */ jsx(Iconified, { icon: "ic:baseline-replay", fontSize: "small" }) }) }) }),
70
71
  /* @__PURE__ */ jsx(Tooltip, { title: t("clipboard"), children: /* @__PURE__ */ jsx(
71
72
  IconButton,
72
73
  {
@@ -8,7 +8,7 @@ import { useState, useRef, useCallback, useEffect, useMemo } from "react";
8
8
  import { c as createContext, u as useContextSelector } from "./index-AMfoEg_6.js";
9
9
  import { SHOW_EVENT_ID, HIDE_EVENT_ID } from "./data/event.js";
10
10
  import { safeDispatchEvent, safeAddEventListener } from "./utils/window.js";
11
- import { i as isNull } from "./AnnotationDetails-CFsyeAZD.js";
11
+ import { i as isNull } from "./AnnotationDetails-CUU61Vwl.js";
12
12
  const CluePopupContext = createContext(null);
13
13
  const CluePopupProvider = ({ children }) => {
14
14
  const [popupType, setPopupType] = useState(null);
@@ -1,13 +1,15 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { a as addAPIProvider } from "./iconify-CXMreGTg.js";
3
- import { b as useClueTypeConfig, a as api, p as post, u as uniq } from "./useClueTypeConfig-Z1LFp01b.js";
3
+ import { a as api, p as post } from "./index-BfslcSud.js";
4
+ import { REPLICATORS } from "./database/globals.js";
4
5
  import { clueDebugLogger } from "./utils/loggerUtil.js";
5
6
  import { b as baseSlice } from "./_baseSlice-GAv_YFTT.js";
6
7
  import { t as toFinite } from "./toFinite-Bc55msYj.js";
7
- import { d as debounce } from "./debounce-bV0h5FC5.js";
8
+ import { d as debounce } from "./sessionStorage-Dbmo2Exe.js";
8
9
  import { g as groupBy } from "./groupBy-xqz-n0Vd.js";
10
+ import { a as useClueTypeConfig, u as uniq } from "./useClueTypeConfig-DnF4rLsl.js";
9
11
  import { b as baseIteratee } from "./_baseIteratee-avi7MX2o.js";
10
- import { b as baseUniq } from "./_baseUniq-BI9GIHMF.js";
12
+ import { b as baseUniq, i as isEmpty } from "./_baseUniq-BI9GIHMF.js";
11
13
  import { useContext, useState, useMemo, useCallback, useRef, useEffect } from "react";
12
14
  import { c as createContext } from "./index-AMfoEg_6.js";
13
15
  import { ClueDatabaseContext } from "./hooks/ClueDatabaseContext.js";
@@ -129,6 +131,19 @@ const ClueEnrichProvider = ({
129
131
  }
130
132
  api.configs.get(requestConfig).then(clueConfig.setConfig);
131
133
  }, [baseURL, onNetworkCall, skipConfigCall, isReady]);
134
+ useEffect(() => {
135
+ if (isReady) {
136
+ Object.values(REPLICATORS).forEach((replicator) => {
137
+ replicator.reSync();
138
+ replicator.start();
139
+ });
140
+ }
141
+ return () => {
142
+ Object.values(REPLICATORS).forEach((replicator) => {
143
+ replicator.pause();
144
+ });
145
+ };
146
+ }, [isReady]);
132
147
  const [customIconify, setCustomIconify] = useState(_customIconify);
133
148
  useEffect(() => {
134
149
  if (_customIconify) {
@@ -155,6 +170,7 @@ const ClueEnrichProvider = ({
155
170
  const newRecords = [];
156
171
  for (const entry of entries) {
157
172
  const { latency, source, type, value: value2, items, error } = entry;
173
+ await database.selectors.find({ selector: { type, value: value2, source } }).incrementalRemove();
158
174
  if (error) {
159
175
  newRecords.push({
160
176
  id: v4(),
@@ -170,7 +186,6 @@ const ClueEnrichProvider = ({
170
186
  }
171
187
  for (const item of items) {
172
188
  const { classification, count, link, annotations } = item;
173
- await database.selectors.find({ selector: { type, value: value2, source, classification } }).incrementalRemove();
174
189
  const record = {
175
190
  id: v4(),
176
191
  source,
@@ -199,7 +214,7 @@ const ClueEnrichProvider = ({
199
214
  );
200
215
  const enrich = useCallback(
201
216
  async (type, value2, _options = {}) => {
202
- var _a2, _b2;
217
+ var _a2;
203
218
  if (!type || !value2) {
204
219
  console.error(`Type (${type}) or value (${value2}) is empty, returning empty response`);
205
220
  return {};
@@ -228,9 +243,9 @@ const ClueEnrichProvider = ({
228
243
  value: value2,
229
244
  classification: options.classification
230
245
  };
231
- let statusRecord = await ((_a2 = database.status) == null ? void 0 : _a2.findOne({ selector: { ...selector } }).exec());
246
+ let statusRecord = await database.status.findOne({ selector: { ...selector } }).exec();
232
247
  if (!statusRecord) {
233
- statusRecord = await ((_b2 = database.status) == null ? void 0 : _b2.insert({
248
+ statusRecord = await ((_a2 = database.status) == null ? void 0 : _a2.insert({
234
249
  id: v4(),
235
250
  type: selector.type,
236
251
  value: selector.value,
@@ -496,7 +511,7 @@ const ClueEnrichProvider = ({
496
511
  );
497
512
  const value = useMemo(
498
513
  () => {
499
- var _a2;
514
+ var _a2, _b2;
500
515
  return {
501
516
  bulkEnrich,
502
517
  enrich,
@@ -512,7 +527,7 @@ const ClueEnrichProvider = ({
512
527
  setDefaultClassification,
513
528
  setReady: setIsReady,
514
529
  defaultClassification,
515
- ready: isReady && !!database && !!((_a2 = clueConfig.config) == null ? void 0 : _a2.c12nDef)
530
+ ready: isReady && !!database && !!((_a2 = clueConfig.config) == null ? void 0 : _a2.c12nDef) && (isEmpty(REPLICATORS) || ((_b2 = database.selectors) == null ? void 0 : _b2.synced))
516
531
  };
517
532
  },
518
533
  [
@@ -1,7 +1,7 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { Popover } from "@mui/material";
3
3
  import React__default, { useRef, useState, useEffect } from "react";
4
- import { A as AnnotationDetails } from "../AnnotationDetails-CFsyeAZD.js";
4
+ import { A as AnnotationDetails } from "../AnnotationDetails-CUU61Vwl.js";
5
5
  const AnnotationDetailPopover = React__default.memo(({ anchorEl, enrichRequest, open, onClose, ...otherProps }) => {
6
6
  var _a, _b, _c;
7
7
  const actionRef = useRef();
@@ -4,14 +4,14 @@ import "@mui/material";
4
4
  import "./display/icons/Iconified.js";
5
5
  import "../data/event.js";
6
6
  import "../hooks/ClueComponentContext.js";
7
- import "../ActionForm-C4mWgND1.js";
7
+ import "../ActionForm-Cdo8jBDU.js";
8
8
  import "../hooks/useAnnotations.js";
9
9
  import "../hooks/useErrors.js";
10
10
  import "../icons/iconMap.js";
11
11
  import "../utils/window.js";
12
12
  import "../groupBy-xqz-n0Vd.js";
13
- import { A } from "../AnnotationDetails-CFsyeAZD.js";
14
- import "../useClueTypeConfig-Z1LFp01b.js";
13
+ import { A } from "../AnnotationDetails-CUU61Vwl.js";
14
+ import "../useClueTypeConfig-DnF4rLsl.js";
15
15
  import "react";
16
16
  import "../index-AMfoEg_6.js";
17
17
  import "./actions/ExecutePopover.js";
@@ -1,7 +1,7 @@
1
1
  import "react/jsx-runtime";
2
2
  import "../iconify-CXMreGTg.js";
3
3
  import "@mui/material";
4
- import { A } from "../AnnotationPreview-CEopHIPL.js";
4
+ import { A } from "../AnnotationPreview-WuxXgLCE.js";
5
5
  import "../hooks/useAnnotations.js";
6
6
  import "../utils-HmNPuoDB.js";
7
7
  import "react";
@@ -2,7 +2,7 @@ import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { I as Icon } from "../iconify-CXMreGTg.js";
3
3
  import { useTheme, Card, CardHeader, Stack, CircularProgress, Divider, CardContent, Grid, Chip, Typography, Tooltip, Box } from "@mui/material";
4
4
  import { ClueComponentContext } from "../hooks/ClueComponentContext.js";
5
- import { b as useClueEnrichSelector } from "../ActionForm-C4mWgND1.js";
5
+ import { b as useClueEnrichSelector } from "../ActionForm-Cdo8jBDU.js";
6
6
  import useAnnotations from "../hooks/useAnnotations.js";
7
7
  import useErrors from "../hooks/useErrors.js";
8
8
  import AssessmentIcon from "../icons/Assessment.js";
@@ -10,7 +10,7 @@ import ContextIcon from "../icons/Context.js";
10
10
  import OpinionIcon from "../icons/Opinion.js";
11
11
  import { ICON_MAP } from "../icons/iconMap.js";
12
12
  import FrequencyText from "../text/Frequency.js";
13
- import { u as uniq } from "../useClueTypeConfig-Z1LFp01b.js";
13
+ import { u as uniq } from "../useClueTypeConfig-DnF4rLsl.js";
14
14
  import { memo, useState, useMemo, useCallback } from "react";
15
15
  import { u as useContextSelector } from "../index-AMfoEg_6.js";
16
16
  import AnnotationEntry from "./AnnotationEntry.js";
@@ -3,8 +3,8 @@ import { Chip, Tooltip, Box, Stack, CircularProgress } from "@mui/material";
3
3
  import Iconified from "./display/icons/Iconified.js";
4
4
  import { ClueComponentContext } from "../hooks/ClueComponentContext.js";
5
5
  import { ClueGroupContext } from "../hooks/ClueGroupContext.js";
6
- import { C as CluePopupContext } from "../AnnotationPreview-CEopHIPL.js";
7
- import { b as useClueEnrichSelector } from "../ActionForm-C4mWgND1.js";
6
+ import { C as CluePopupContext } from "../AnnotationPreview-WuxXgLCE.js";
7
+ import { b as useClueEnrichSelector } from "../ActionForm-Cdo8jBDU.js";
8
8
  import useAnnotations from "../hooks/useAnnotations.js";
9
9
  import ActionIcon from "../icons/Action.js";
10
10
  import AssessmentIcon from "../icons/Assessment.js";
@@ -3,8 +3,8 @@ import { useTheme, Stack, CircularProgress, Tooltip, IconButton } from "@mui/mat
3
3
  import Iconified from "./display/icons/Iconified.js";
4
4
  import { ClueComponentContext } from "../hooks/ClueComponentContext.js";
5
5
  import { ClueGroupContext } from "../hooks/ClueGroupContext.js";
6
- import { C as CluePopupContext } from "../AnnotationPreview-CEopHIPL.js";
7
- import { b as useClueEnrichSelector } from "../ActionForm-C4mWgND1.js";
6
+ import { C as CluePopupContext } from "../AnnotationPreview-WuxXgLCE.js";
7
+ import { b as useClueEnrichSelector } from "../ActionForm-Cdo8jBDU.js";
8
8
  import useAnnotations from "../hooks/useAnnotations.js";
9
9
  import ActionIcon from "../icons/Action.js";
10
10
  import AssessmentIcon from "../icons/Assessment.js";
@@ -1,7 +1,7 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { Button } from "@mui/material";
3
3
  import { ClueComponentContext } from "../hooks/ClueComponentContext.js";
4
- import { b as useClueEnrichSelector } from "../ActionForm-C4mWgND1.js";
4
+ import { b as useClueEnrichSelector } from "../ActionForm-Cdo8jBDU.js";
5
5
  import { u as useContextSelector } from "../index-AMfoEg_6.js";
6
6
  const RetryFailedEnrichments = () => {
7
7
  const enrichFailedEnrichments = useClueEnrichSelector((ctx) => ctx.enrichFailedEnrichments);
@@ -1,6 +1,6 @@
1
1
  import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
2
  import { Button, Popover, TextField, Divider, Stack, FormControlLabel, Checkbox } from "@mui/material";
3
- import { d as useClueComponentSelector, b as useClueEnrichSelector } from "../ActionForm-C4mWgND1.js";
3
+ import { d as useClueComponentSelector, b as useClueEnrichSelector } from "../ActionForm-Cdo8jBDU.js";
4
4
  import { memo, useState, useEffect } from "react";
5
5
  const SourcePicker = () => {
6
6
  const { t } = useClueComponentSelector((ctx) => ctx.i18next);
@@ -5,7 +5,7 @@ import "@mui/material";
5
5
  import "../display/icons/Iconified.js";
6
6
  import "../../index-JcKyZeoY.js";
7
7
  import "../../hooks/ClueComponentContext.js";
8
- import { A } from "../../ActionForm-C4mWgND1.js";
8
+ import { A } from "../../ActionForm-Cdo8jBDU.js";
9
9
  import "../../utils-HmNPuoDB.js";
10
10
  import "react";
11
11
  import "../../index-AMfoEg_6.js";
@@ -3,7 +3,7 @@ import { I as Icon } from "../../iconify-CXMreGTg.js";
3
3
  import { useTheme, Tooltip, IconButton, CircularProgress, Button, Popover, Paper, Stack, Typography, Box, Divider } from "@mui/material";
4
4
  import Iconified from "../display/icons/Iconified.js";
5
5
  import { ClueComponentContext } from "../../hooks/ClueComponentContext.js";
6
- import { a as useClueActionsSelector } from "../../ActionForm-C4mWgND1.js";
6
+ import { a as useClueActionsSelector } from "../../ActionForm-Cdo8jBDU.js";
7
7
  import useClueConfig from "../../hooks/useClueConfig.js";
8
8
  import { isAccessible } from "../../utils/classificationParser.js";
9
9
  import { useState, useRef, useMemo, useEffect } from "react";
@@ -2,7 +2,7 @@ import "react/jsx-runtime";
2
2
  import "../../iconify-CXMreGTg.js";
3
3
  import "@mui/material";
4
4
  import "../../hooks/ClueComponentContext.js";
5
- import { R } from "../../ActionForm-C4mWgND1.js";
5
+ import { R } from "../../ActionForm-Cdo8jBDU.js";
6
6
  import "react";
7
7
  import "../../index-AMfoEg_6.js";
8
8
  import "../ClassificationChip.js";
@@ -1,6 +1,6 @@
1
1
  import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
2
  import { useTheme, Tooltip, IconButton, CircularProgress, Button, Popover, Paper, Stack, Box, Typography, Divider } from "@mui/material";
3
- import { d as useClueComponentSelector, b as useClueEnrichSelector, e as capitalize } from "../../ActionForm-C4mWgND1.js";
3
+ import { d as useClueComponentSelector, b as useClueEnrichSelector, e as capitalize } from "../../ActionForm-Cdo8jBDU.js";
4
4
  import { useState, useRef, useCallback, useEffect } from "react";
5
5
  import Iconified from "../display/icons/Iconified.js";
6
6
  const EnrichPopover = ({ show = false, size = "small", selector }) => {
@@ -5,7 +5,7 @@ import { F as FlexOne } from "../../FlexOne-BSYAhhtG.js";
5
5
  import Iconified from "../display/icons/Iconified.js";
6
6
  import { J as JSONViewer } from "../../index-JcKyZeoY.js";
7
7
  import { ClueComponentContext } from "../../hooks/ClueComponentContext.js";
8
- import { c as useClueFetcherSelector } from "../../ActionForm-C4mWgND1.js";
8
+ import { c as useClueFetcherSelector } from "../../ActionForm-Cdo8jBDU.js";
9
9
  import React__default, { useState, useRef, useMemo, useEffect, memo } from "react";
10
10
  import { u as useContextSelector } from "../../index-AMfoEg_6.js";
11
11
  import Graph from "../display/graph/index.js";
@@ -4,7 +4,7 @@ import { F as FlexOne } from "../../FlexOne-BSYAhhtG.js";
4
4
  import Iconified from "../display/icons/Iconified.js";
5
5
  import { SNACKBAR_EVENT_ID } from "../../data/event.js";
6
6
  import { ClueGroupContext } from "../../hooks/ClueGroupContext.js";
7
- import { d as useClueComponentSelector, b as useClueEnrichSelector, e as capitalize } from "../../ActionForm-C4mWgND1.js";
7
+ import { d as useClueComponentSelector, b as useClueEnrichSelector, e as capitalize } from "../../ActionForm-Cdo8jBDU.js";
8
8
  import { safeDispatchEvent } from "../../utils/window.js";
9
9
  import { useState, useMemo, useCallback } from "react";
10
10
  import { u as useContextSelector } from "../../index-AMfoEg_6.js";
@@ -1,7 +1,7 @@
1
1
  import { jsxs } from "react/jsx-runtime";
2
2
  import { Stack, Typography } from "@mui/material";
3
3
  import { ClueDatabaseContext } from "../../hooks/ClueDatabaseContext.js";
4
- import { d as useClueComponentSelector, b as useClueEnrichSelector } from "../../ActionForm-C4mWgND1.js";
4
+ import { d as useClueComponentSelector, b as useClueEnrichSelector } from "../../ActionForm-Cdo8jBDU.js";
5
5
  import { useContext, useState, useEffect } from "react";
6
6
  const QueryStatus = () => {
7
7
  const { t } = useClueComponentSelector((ctx) => ctx.i18next);
@@ -0,0 +1,5 @@
1
+ import { RxReplicationState } from 'rxdb/plugins/replication';
2
+
3
+ export declare const REPLICATORS: {
4
+ [timestamp: string]: RxReplicationState<any, any>;
5
+ };
@@ -0,0 +1,4 @@
1
+ const REPLICATORS = {};
2
+ export {
3
+ REPLICATORS
4
+ };
package/database/index.js CHANGED
@@ -1,4 +1,7 @@
1
- import { b } from "../index-C12gPw2W.js";
1
+ import { b } from "../index-BXnMCI65.js";
2
+ import "../utils/constants.js";
3
+ import "./globals.js";
4
+ import "../replication-BCvfRqsy.js";
2
5
  export {
3
6
  b as default
4
7
  };
@@ -0,0 +1,4 @@
1
+ import { Checkpoint } from './sync';
2
+ import { DatabaseConfig, SelectorCollection, SelectorDocType } from './types';
3
+
4
+ export declare const replicateSelectorCollection: (replicationId: string, collection: SelectorCollection, config: DatabaseConfig) => Promise<import('rxdb/plugins/replication').RxReplicationState<SelectorDocType, Checkpoint>>;
@@ -0,0 +1,7 @@
1
+ import "../index-BfslcSud.js";
2
+ import { b2 } from "../replication-BCvfRqsy.js";
3
+ import "./globals.js";
4
+ import "../last-CUCl67Im.js";
5
+ export {
6
+ b2 as replicateSelectorCollection
7
+ };
@@ -1,53 +1,12 @@
1
1
  declare const _default: {
2
+ "indexes": ["type", "value"],
2
3
  "keyCompression": true,
3
- "version": 0,
4
4
  "primaryKey": "id",
5
- "type": "object",
6
5
  "properties": {
7
- "id": {
8
- "type": "string",
9
- "maxLength": 64
10
- },
11
- "source": {
12
- "type": "string"
13
- },
14
- "type": {
15
- "type": "string",
16
- "maxLength": 255
17
- },
18
- "value": {
19
- "type": "string",
20
- "maxLength": 2048
21
- },
22
- "classification": {
23
- "type": "string"
24
- },
25
- "count": {
26
- "type": "number"
27
- },
28
- "link": {
29
- "type": "string"
30
- },
31
- "raw_data": {
32
- "type": "string"
33
- },
34
- "error": {
35
- "anyOf": [{ "type": "string" }, { "type": "null" }]
36
- },
37
- "maintainer": {
38
- "type": "string"
39
- },
40
- "datahub_link": {
41
- "type": "string"
42
- },
43
- "documentation_link": {
44
- "type": "string"
45
- },
46
- "latency": {
47
- "type": "number"
6
+ "_deleted": {
7
+ "type": "boolean"
48
8
  },
49
9
  "annotations": {
50
- "type": "array",
51
10
  "items": {
52
11
  "properties": {
53
12
  "analytic": {
@@ -59,60 +18,124 @@ declare const _default: {
59
18
  "author": {
60
19
  "type": "string"
61
20
  },
62
- "quantity": {
63
- "type": "integer"
21
+ "confidence": {
22
+ "maximum": 1,
23
+ "minimum": 0,
24
+ "type": "number"
64
25
  },
65
- "version": {
26
+ "details": {
66
27
  "type": "string"
67
28
  },
68
- "timestamp": {
29
+ "icon": {
69
30
  "type": "string"
70
31
  },
71
- "type": {
72
- "enum": ["opinion", "frequency", "assessment", "mitigation", "context"],
32
+ "link": {
33
+ "format": "uri",
34
+ "minLength": 1,
73
35
  "type": "string"
74
36
  },
75
- "value": {
76
- "anyOf": [{ "type": "string" }, { "type": "number" }, { "type": "integer" }]
77
- },
78
- "confidence": {
79
- "maximum": 1.0,
80
- "minimum": 0.0,
37
+ "priority": {
81
38
  "type": "number"
82
39
  },
83
- "severity": {
84
- "maximum": 1.0,
85
- "minimum": 0.0,
86
- "type": "number"
40
+ "quantity": {
41
+ "type": "integer"
87
42
  },
88
- "priority": {
43
+ "severity": {
44
+ "maximum": 1,
45
+ "minimum": 0,
89
46
  "type": "number"
90
47
  },
91
48
  "summary": {
92
49
  "type": "string"
93
50
  },
94
- "details": {
95
- "type": "string"
96
- },
97
- "link": {
98
- "format": "uri",
99
- "minLength": 1,
51
+ "timestamp": {
100
52
  "type": "string"
101
53
  },
102
- "icon": {
54
+ "type": {
55
+ "enum": ["opinion", "frequency", "assessment", "mitigation", "context"],
103
56
  "type": "string"
104
57
  },
105
58
  "ubiquitous": {
106
59
  "type": "boolean"
60
+ },
61
+ "value": {
62
+ "anyOf": [
63
+ {
64
+ "type": "string"
65
+ },
66
+ {
67
+ "type": "number"
68
+ },
69
+ {
70
+ "type": "integer"
71
+ }
72
+ ]
73
+ },
74
+ "version": {
75
+ "type": "string"
107
76
  }
108
77
  },
109
78
  "required": ["type", "value", "confidence", "summary"],
110
79
  "type": "object"
111
- }
80
+ },
81
+ "type": "array"
82
+ },
83
+ "classification": {
84
+ "type": "string"
85
+ },
86
+ "count": {
87
+ "type": "number"
88
+ },
89
+ "datahub_link": {
90
+ "type": "string"
91
+ },
92
+ "documentation_link": {
93
+ "type": "string"
94
+ },
95
+ "error": {
96
+ "anyOf": [
97
+ {
98
+ "type": "string"
99
+ },
100
+ {
101
+ "type": "null"
102
+ }
103
+ ]
104
+ },
105
+ "id": {
106
+ "maxLength": 64,
107
+ "type": "string"
108
+ },
109
+ "latency": {
110
+ "type": "number"
111
+ },
112
+ "link": {
113
+ "type": "string"
114
+ },
115
+ "maintainer": {
116
+ "type": "string"
117
+ },
118
+ "raw_data": {
119
+ "type": "string"
120
+ },
121
+ "source": {
122
+ "type": "string"
123
+ },
124
+ "type": {
125
+ "maxLength": 255,
126
+ "type": "string"
127
+ },
128
+ "updated_at": {
129
+ "type": "number"
130
+ },
131
+ "value": {
132
+ "maxLength": 2048,
133
+ "type": "string"
112
134
  }
113
135
  },
114
- "required": ["latency", "id", "type", "value", "classification", "count", "annotations"],
115
- "indexes": ["type", "value"]
136
+ "required": ["latency", "id", "type", "value", "classification", "count", "annotations", "_deleted"],
137
+ "type": "object",
138
+ "version": 0
116
139
  }
117
140
  ;
118
141
 
@@ -0,0 +1,12 @@
1
+ import { WithLastUpdated } from "../database/types";
2
+ import { RxReplicationWriteToMasterRow, WithDeleted } from 'rxdb';
3
+
4
+
5
+ export type SyncResponse<T> = WithDeleted<WithLastUpdated<T>>[];
6
+
7
+ export interface Checkpoint {
8
+ id: string;
9
+ last_updated: number;
10
+ }
11
+
12
+ export type PushPayload<T> = RxReplicationWriteToMasterRow<T>[];