@cccsaurora/clue-ui 1.5.0-dev.477 → 1.5.0-dev.481
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/{ActionForm-DIAUGhSr.js → ActionForm-Bw8N20TK.js} +1 -1
- package/{AnnotationDetails-DmrYK0Qc.js → AnnotationDetails-CP3LACKv.js} +1 -1
- package/{AnnotationPreview-DAswA7fu.js → AnnotationPreview-BgiL1Xny.js} +1 -1
- package/components/AnnotationDetailPopover.js +1 -1
- package/components/AnnotationDetails.js +2 -2
- package/components/AnnotationPreview.js +1 -1
- package/components/EnrichedCard.js +1 -1
- package/components/EnrichedChip.js +2 -2
- package/components/EnrichedTypography.js +2 -2
- package/components/RetryFailedEnrichments.js +1 -1
- package/components/SourcePicker.js +1 -1
- package/components/actions/ActionForm.js +1 -1
- package/components/actions/ExecutePopover.js +1 -1
- package/components/actions/ResultModal.js +1 -1
- package/components/enrichment/EnrichPopover.js +1 -1
- package/components/fetchers/Fetcher.js +1 -1
- package/components/group/GroupControl.js +1 -1
- package/components/stats/QueryStatus.js +1 -1
- package/database/errors.d.ts +11 -0
- package/database/errors.js +18 -0
- package/database/index.js +2 -2
- package/database/replication.js +2 -1
- package/database/types.d.ts +22 -0
- package/hooks/ClueActionContext.js +1 -1
- package/hooks/ClueDatabaseContext.js +1 -1
- package/hooks/ClueGroupContext.js +1 -1
- package/hooks/CluePopupContext.js +2 -2
- package/hooks/ClueProvider.js +2 -2
- package/hooks/selectors.js +1 -1
- package/hooks/useActionResult.js +1 -1
- package/hooks/useAnnotations.js +1 -1
- package/hooks/useClueActions.js +1 -1
- package/hooks/useErrors.js +1 -1
- package/hooks/useFetcherResult.js +1 -1
- package/icons/Action.js +2 -2
- package/icons/Assessment.js +1 -1
- package/icons/Context.js +1 -1
- package/icons/Opinion.js +1 -1
- package/{index-DT_sunCV.js → index-CijTTmTT.js} +1 -1
- package/{index-8lXdRRpV.js → index-EUvbYwEJ.js} +2 -2
- package/main.d.ts +4 -3
- package/main.js +6 -4
- package/package.json +1 -1
- package/{replication-DDxxY_CX.js → replication-D4yDBTWp.js} +114 -42
|
@@ -6,7 +6,7 @@ import Iconified from "./components/display/icons/Iconified.js";
|
|
|
6
6
|
import { J as JSONViewer } from "./index-DUEubgWN.js";
|
|
7
7
|
import { ClueComponentContext } from "./hooks/ClueComponentContext.js";
|
|
8
8
|
import { g as getDefaultExportFromCjs } from "./_commonjsHelpers-CUmg6egw.js";
|
|
9
|
-
import { c as requireJsonSchemaTraverse, r as requireFastDeepEqual, a as requireFastUri } from "./index-
|
|
9
|
+
import { c as requireJsonSchemaTraverse, r as requireFastDeepEqual, a as requireFastUri } from "./index-EUvbYwEJ.js";
|
|
10
10
|
import { a as api } from "./index-CPetQxOc.js";
|
|
11
11
|
import { d as toString } from "./_baseGet-Cmp6FztG.js";
|
|
12
12
|
import { b as baseSlice } from "./_baseSlice-GAv_YFTT.js";
|
|
@@ -4,7 +4,7 @@ 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 { f as useClueEnrichSelector } from "./ActionForm-
|
|
7
|
+
import { f as useClueEnrichSelector } from "./ActionForm-Bw8N20TK.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";
|
|
@@ -8,7 +8,7 @@ import { useState, useRef, useCallback, useEffect, useMemo } from "react";
|
|
|
8
8
|
import { c as createContext, a as useContextSelector } from "./index-_gpzM2Px.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-
|
|
11
|
+
import { i as isNull } from "./AnnotationDetails-CP3LACKv.js";
|
|
12
12
|
const CluePopupContext = createContext(null);
|
|
13
13
|
const CluePopupProvider = ({ children }) => {
|
|
14
14
|
const [popupType, setPopupType] = useState(null);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Popover } from "@mui/material";
|
|
3
3
|
import React3__default, { useRef, useState, useEffect } from "react";
|
|
4
|
-
import { A as AnnotationDetails } from "../AnnotationDetails-
|
|
4
|
+
import { A as AnnotationDetails } from "../AnnotationDetails-CP3LACKv.js";
|
|
5
5
|
const AnnotationDetailPopover = React3__default.memo(({ anchorEl, enrichRequest, open, onClose, ...otherProps }) => {
|
|
6
6
|
var _a, _b, _c;
|
|
7
7
|
const actionRef = useRef();
|
|
@@ -4,13 +4,13 @@ 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-
|
|
7
|
+
import "../ActionForm-Bw8N20TK.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-BVV07EGQ.js";
|
|
13
|
-
import { A } from "../AnnotationDetails-
|
|
13
|
+
import { A } from "../AnnotationDetails-CP3LACKv.js";
|
|
14
14
|
import "../uniq-CahZPAwp.js";
|
|
15
15
|
import "react";
|
|
16
16
|
import "../index-_gpzM2Px.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
2
|
import "../iconify-CYJTToEF.js";
|
|
3
3
|
import "@mui/material";
|
|
4
|
-
import { A } from "../AnnotationPreview-
|
|
4
|
+
import { A } from "../AnnotationPreview-BgiL1Xny.js";
|
|
5
5
|
import "../hooks/useAnnotations.js";
|
|
6
6
|
import "../utils-CEySTPtg.js";
|
|
7
7
|
import "react";
|
|
@@ -2,7 +2,7 @@ import { jsxs, jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { I as Icon } from "../iconify-CYJTToEF.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 { f as useClueEnrichSelector } from "../ActionForm-
|
|
5
|
+
import { f as useClueEnrichSelector } from "../ActionForm-Bw8N20TK.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";
|
|
@@ -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-
|
|
7
|
-
import { f as useClueEnrichSelector } from "../ActionForm-
|
|
6
|
+
import { C as CluePopupContext } from "../AnnotationPreview-BgiL1Xny.js";
|
|
7
|
+
import { f as useClueEnrichSelector } from "../ActionForm-Bw8N20TK.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-
|
|
7
|
-
import { f as useClueEnrichSelector } from "../ActionForm-
|
|
6
|
+
import { C as CluePopupContext } from "../AnnotationPreview-BgiL1Xny.js";
|
|
7
|
+
import { f as useClueEnrichSelector } from "../ActionForm-Bw8N20TK.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 { f as useClueEnrichSelector } from "../ActionForm-
|
|
4
|
+
import { f as useClueEnrichSelector } from "../ActionForm-Bw8N20TK.js";
|
|
5
5
|
import { a as useContextSelector } from "../index-_gpzM2Px.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 { e as useClueComponentSelector, f as useClueEnrichSelector } from "../ActionForm-
|
|
3
|
+
import { e as useClueComponentSelector, f as useClueEnrichSelector } from "../ActionForm-Bw8N20TK.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-DUEubgWN.js";
|
|
7
7
|
import "../../hooks/ClueComponentContext.js";
|
|
8
|
-
import { A } from "../../ActionForm-
|
|
8
|
+
import { A } from "../../ActionForm-Bw8N20TK.js";
|
|
9
9
|
import "../../utils-CEySTPtg.js";
|
|
10
10
|
import "react";
|
|
11
11
|
import "../../index-_gpzM2Px.js";
|
|
@@ -3,7 +3,7 @@ import { I as Icon } from "../../iconify-CYJTToEF.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 { d as useClueActionsSelector } from "../../ActionForm-
|
|
6
|
+
import { d as useClueActionsSelector } from "../../ActionForm-Bw8N20TK.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-CYJTToEF.js";
|
|
3
3
|
import "@mui/material";
|
|
4
4
|
import "../../hooks/ClueComponentContext.js";
|
|
5
|
-
import { R } from "../../ActionForm-
|
|
5
|
+
import { R } from "../../ActionForm-Bw8N20TK.js";
|
|
6
6
|
import "react";
|
|
7
7
|
import "../../index-_gpzM2Px.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 { e as useClueComponentSelector, f as useClueEnrichSelector, c as capitalize } from "../../ActionForm-
|
|
3
|
+
import { e as useClueComponentSelector, f as useClueEnrichSelector, c as capitalize } from "../../ActionForm-Bw8N20TK.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 }) => {
|
|
@@ -4,7 +4,7 @@ import { useTheme, Skeleton, Chip, Tooltip, Stack, Typography, LinearProgress, P
|
|
|
4
4
|
import { F as FlexOne } from "../../FlexOne-BSYAhhtG.js";
|
|
5
5
|
import Iconified from "../display/icons/Iconified.js";
|
|
6
6
|
import { ClueComponentContext } from "../../hooks/ClueComponentContext.js";
|
|
7
|
-
import { g as useClueFetcherSelector } from "../../ActionForm-
|
|
7
|
+
import { g as useClueFetcherSelector } from "../../ActionForm-Bw8N20TK.js";
|
|
8
8
|
import React3__default, { useState, useRef, useMemo, useEffect, memo } from "react";
|
|
9
9
|
import { a as useContextSelector } from "../../index-_gpzM2Px.js";
|
|
10
10
|
import { FetcherResultView } from "./FetcherResultView.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 { e as useClueComponentSelector, f as useClueEnrichSelector, c as capitalize } from "../../ActionForm-
|
|
7
|
+
import { e as useClueComponentSelector, f as useClueEnrichSelector, c as capitalize } from "../../ActionForm-Bw8N20TK.js";
|
|
8
8
|
import { safeDispatchEvent } from "../../utils/window.js";
|
|
9
9
|
import { useState, useMemo, useCallback } from "react";
|
|
10
10
|
import { a as useContextSelector } from "../../index-_gpzM2Px.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 { e as useClueComponentSelector, f as useClueEnrichSelector } from "../../ActionForm-
|
|
4
|
+
import { e as useClueComponentSelector, f as useClueEnrichSelector } from "../../ActionForm-Bw8N20TK.js";
|
|
5
5
|
import { useContext, useState, useEffect } from "react";
|
|
6
6
|
const QueryStatus = () => {
|
|
7
7
|
const { t } = useClueComponentSelector((ctx) => ctx.i18next);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A safe description of an HTTP failure from the selector replication stream.
|
|
3
|
+
*
|
|
4
|
+
* The error intentionally contains request metadata only; authorization tokens and response bodies are never included.
|
|
5
|
+
*/
|
|
6
|
+
export declare class ClueReplicationError extends Error {
|
|
7
|
+
readonly status: number;
|
|
8
|
+
readonly url: string;
|
|
9
|
+
readonly collection: string;
|
|
10
|
+
constructor(status: number, url: string, collection: string);
|
|
11
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
+
class ClueReplicationError extends Error {
|
|
5
|
+
constructor(status, url, collection) {
|
|
6
|
+
super(`Replication stream for collection "${collection}" failed with HTTP status ${status}`);
|
|
7
|
+
__publicField(this, "status");
|
|
8
|
+
__publicField(this, "url");
|
|
9
|
+
__publicField(this, "collection");
|
|
10
|
+
this.name = "ClueReplicationError";
|
|
11
|
+
this.status = status;
|
|
12
|
+
this.url = url;
|
|
13
|
+
this.collection = collection;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
ClueReplicationError
|
|
18
|
+
};
|
package/database/index.js
CHANGED
package/database/replication.js
CHANGED
package/database/types.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Annotation, Selector, WithExtra } from 'lib/types/lookup';
|
|
2
2
|
import { RxCollection, RxDatabase, RxDocument } from 'rxdb';
|
|
3
|
+
import { ClueReplicationError } from './errors';
|
|
3
4
|
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -66,6 +67,27 @@ export interface DatabaseConfig {
|
|
|
66
67
|
* @returns An access token valid for use with the clue API.
|
|
67
68
|
*/
|
|
68
69
|
getToken?: () => string;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Handle an HTTP error from the selector replication stream. For an expired-token (401) response,
|
|
73
|
+
* return `true` only after refreshing the token returned by `getToken`; replication resumes when that
|
|
74
|
+
* token is nonempty and differs from the token rejected by the server. Returning `false`, throwing,
|
|
75
|
+
* or leaving the token unchanged stops stream retries for that connection. Other 4xx responses are
|
|
76
|
+
* terminal, while network and 5xx failures retry with exponential backoff regardless of this callback's result.
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```ts
|
|
80
|
+
* {
|
|
81
|
+
* getToken: () => accessToken,
|
|
82
|
+
* onReplicationError: async error => {
|
|
83
|
+
* if (error.status !== 401) return false;
|
|
84
|
+
* accessToken = await refreshAccessToken();
|
|
85
|
+
* return true;
|
|
86
|
+
* }
|
|
87
|
+
* }
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
onReplicationError?: (error: ClueReplicationError) => boolean | Promise<boolean>;
|
|
69
91
|
}
|
|
70
92
|
|
|
71
93
|
export type WithLastUpdated<T> = T & {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
2
|
import "@mui/material";
|
|
3
|
-
import { C, a } from "../ActionForm-
|
|
3
|
+
import { C, a } from "../ActionForm-Bw8N20TK.js";
|
|
4
4
|
import "../index-CPetQxOc.js";
|
|
5
5
|
import "../components/display/icons/Iconified.js";
|
|
6
6
|
import "../components/ErrorBoundary.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { b as buildDatabase } from "../index-
|
|
2
|
+
import { b as buildDatabase } from "../index-EUvbYwEJ.js";
|
|
3
3
|
import { createContext, useState, useRef, useEffect } from "react";
|
|
4
4
|
const ClueDatabaseContext = createContext(null);
|
|
5
5
|
const ClueDatabaseProvider = ({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useMemo } from "react";
|
|
3
3
|
import { c as createContext } from "../index-_gpzM2Px.js";
|
|
4
|
-
import { f as useClueEnrichSelector } from "../ActionForm-
|
|
4
|
+
import { f as useClueEnrichSelector } from "../ActionForm-Bw8N20TK.js";
|
|
5
5
|
const ClueGroupContext = createContext(null);
|
|
6
6
|
const ClueGroupProvider = ({ children, type, classification }) => {
|
|
7
7
|
const defaultClassification = useClueEnrichSelector((ctx) => ctx.defaultClassification);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
2
|
import "../components/AnnotationDetailPopover.js";
|
|
3
|
-
import { C, a } from "../AnnotationPreview-
|
|
3
|
+
import { C, a } from "../AnnotationPreview-BgiL1Xny.js";
|
|
4
4
|
import "../data/event.js";
|
|
5
5
|
import "../utils/window.js";
|
|
6
|
-
import "../AnnotationDetails-
|
|
6
|
+
import "../AnnotationDetails-CP3LACKv.js";
|
|
7
7
|
import "react";
|
|
8
8
|
import "../index-_gpzM2Px.js";
|
|
9
9
|
export {
|
package/hooks/ClueProvider.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { ClueUIPluginProvider } from "./ClueUIPluginContext.js";
|
|
3
|
-
import { a as ClueActionProvider } from "../ActionForm-
|
|
3
|
+
import { a as ClueActionProvider } from "../ActionForm-Bw8N20TK.js";
|
|
4
4
|
import { ClueComponentProvider } from "./ClueComponentContext.js";
|
|
5
5
|
import { ClueConfigProvider } from "./ClueConfigProvider.js";
|
|
6
6
|
import { ClueDatabaseProvider } from "./ClueDatabaseContext.js";
|
|
7
7
|
import { a as ClueEnrichProvider } from "../ClueEnrichContext-B76X-cLH.js";
|
|
8
8
|
import { ClueFetcherProvider } from "./ClueFetcherContext.js";
|
|
9
|
-
import { a as CluePopupProvider } from "../AnnotationPreview-
|
|
9
|
+
import { a as CluePopupProvider } from "../AnnotationPreview-BgiL1Xny.js";
|
|
10
10
|
const ClueProvider = ({ children, ...props }) => {
|
|
11
11
|
return /* @__PURE__ */ jsx(ClueComponentProvider, { ...props, children: /* @__PURE__ */ jsx(ClueConfigProvider, { config: props.config, children: /* @__PURE__ */ jsx(ClueDatabaseProvider, { ...props, children: /* @__PURE__ */ jsx(ClueUIPluginProvider, { ...props, children: /* @__PURE__ */ jsx(ClueEnrichProvider, { ...props, children: /* @__PURE__ */ jsx(ClueFetcherProvider, { ...props, children: /* @__PURE__ */ jsx(ClueActionProvider, { ...props, children: /* @__PURE__ */ jsx(CluePopupProvider, { children }) }) }) }) }) }) }) });
|
|
12
12
|
};
|
package/hooks/selectors.js
CHANGED
package/hooks/useActionResult.js
CHANGED
package/hooks/useAnnotations.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { u as uniqBy } from "../ClueEnrichContext-B76X-cLH.js";
|
|
2
2
|
import { useContext, useMemo, useState, useEffect } from "react";
|
|
3
3
|
import { ClueDatabaseContext } from "./ClueDatabaseContext.js";
|
|
4
|
-
import { f as useClueEnrichSelector } from "../ActionForm-
|
|
4
|
+
import { f as useClueEnrichSelector } from "../ActionForm-Bw8N20TK.js";
|
|
5
5
|
const useAnnotations = (type, value, _classification, { skipEnrichment } = { skipEnrichment: false }) => {
|
|
6
6
|
var _a;
|
|
7
7
|
const database = useContext(ClueDatabaseContext);
|
package/hooks/useClueActions.js
CHANGED
package/hooks/useErrors.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useContext, useState, useEffect } from "react";
|
|
2
2
|
import { ClueDatabaseContext } from "./ClueDatabaseContext.js";
|
|
3
|
-
import { f as useClueEnrichSelector } from "../ActionForm-
|
|
3
|
+
import { f as useClueEnrichSelector } from "../ActionForm-Bw8N20TK.js";
|
|
4
4
|
const useErrors = (value) => {
|
|
5
5
|
const database = useContext(ClueDatabaseContext);
|
|
6
6
|
const ready = useClueEnrichSelector((ctx) => ctx.ready);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useState, useRef, useMemo, useEffect } from "react";
|
|
2
|
-
import { b as useClueActions } from "../ActionForm-
|
|
2
|
+
import { b as useClueActions } from "../ActionForm-Bw8N20TK.js";
|
|
3
3
|
const useActionResult = (resultWithData, interval = 2e3) => {
|
|
4
4
|
const [result, setResult] = useState(resultWithData);
|
|
5
5
|
const timeoutRef = useRef(null);
|
package/icons/Action.js
CHANGED
|
@@ -2,8 +2,8 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { I as Icon } from "../iconify-CYJTToEF.js";
|
|
3
3
|
import { useTheme, Stack, Divider, Typography } from "@mui/material";
|
|
4
4
|
import CountBadge from "../components/CountBadge.js";
|
|
5
|
-
import { C as CluePopupContext } from "../AnnotationPreview-
|
|
6
|
-
import { b as useClueActions } from "../ActionForm-
|
|
5
|
+
import { C as CluePopupContext } from "../AnnotationPreview-BgiL1Xny.js";
|
|
6
|
+
import { b as useClueActions } from "../ActionForm-Bw8N20TK.js";
|
|
7
7
|
import { g as groupBy } from "../groupBy-BVV07EGQ.js";
|
|
8
8
|
import { memo, useRef, useMemo, useEffect } from "react";
|
|
9
9
|
import { a as useContextSelector } from "../index-_gpzM2Px.js";
|
package/icons/Assessment.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { I as Icon } from "../iconify-CYJTToEF.js";
|
|
3
3
|
import { useTheme, Stack, Chip, Divider, Grid, Tooltip } from "@mui/material";
|
|
4
4
|
import CountBadge from "../components/CountBadge.js";
|
|
5
|
-
import { C as CluePopupContext } from "../AnnotationPreview-
|
|
5
|
+
import { C as CluePopupContext } from "../AnnotationPreview-BgiL1Xny.js";
|
|
6
6
|
import { g as groupBy } from "../groupBy-BVV07EGQ.js";
|
|
7
7
|
import { l as last } from "../last-CUCl67Im.js";
|
|
8
8
|
import { m as maxBy } from "../maxBy-BjjQmX5t.js";
|
package/icons/Context.js
CHANGED
|
@@ -4,7 +4,7 @@ import { Stack, Divider } from "@mui/material";
|
|
|
4
4
|
import AnnotationEntry from "../components/AnnotationEntry.js";
|
|
5
5
|
import CountBadge from "../components/CountBadge.js";
|
|
6
6
|
import Iconified from "../components/display/icons/Iconified.js";
|
|
7
|
-
import { C as CluePopupContext } from "../AnnotationPreview-
|
|
7
|
+
import { C as CluePopupContext } from "../AnnotationPreview-BgiL1Xny.js";
|
|
8
8
|
import { g as groupBy } from "../groupBy-BVV07EGQ.js";
|
|
9
9
|
import { memo, useRef, useMemo, useEffect } from "react";
|
|
10
10
|
import { a as useContextSelector } from "../index-_gpzM2Px.js";
|
package/icons/Opinion.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { I as Icon } from "../iconify-CYJTToEF.js";
|
|
3
3
|
import { useTheme, Stack, Chip, Divider, Grid } from "@mui/material";
|
|
4
4
|
import CountBadge from "../components/CountBadge.js";
|
|
5
|
-
import { C as CluePopupContext } from "../AnnotationPreview-
|
|
5
|
+
import { C as CluePopupContext } from "../AnnotationPreview-BgiL1Xny.js";
|
|
6
6
|
import { g as groupBy } from "../groupBy-BVV07EGQ.js";
|
|
7
7
|
import { s as sortBy } from "../sortBy-B8JVsLQY.js";
|
|
8
8
|
import { s as sumBy } from "../sumBy-D-HCzM2i.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { N as NON_PREMIUM_COLLECTION_LIMIT, E as RxDatabaseBase, D as RxCollectionBase, Z as createRxDocumentConstructor, J as basePrototype, aH as newRxError, az as isMaybeReadonlyArray, al as getSchemaByObjectPath, ad as flattenObject, aj as getProperty, a$ as trimDots, G as appendToArray, ai as getPrimaryFieldOfPrimaryKey, aI as newRxTypeError, ah as getPreviousVersions, aw as isFolderPath, aN as prepareQuery, a9 as findUndefinedPath, a1 as deepEqual, a7 as fillPrimaryKey, ao as hasPremiumFlag, R as RXDB_VERSION, ap as hashStringToNumber, a2 as deepFreeze } from "./replication-
|
|
1
|
+
import { N as NON_PREMIUM_COLLECTION_LIMIT, E as RxDatabaseBase, D as RxCollectionBase, Z as createRxDocumentConstructor, J as basePrototype, aH as newRxError, az as isMaybeReadonlyArray, al as getSchemaByObjectPath, ad as flattenObject, aj as getProperty, a$ as trimDots, G as appendToArray, ai as getPrimaryFieldOfPrimaryKey, aI as newRxTypeError, ah as getPreviousVersions, aw as isFolderPath, aN as prepareQuery, a9 as findUndefinedPath, a1 as deepEqual, a7 as fillPrimaryKey, ao as hasPremiumFlag, R as RXDB_VERSION, ap as hashStringToNumber, a2 as deepFreeze } from "./replication-D4yDBTWp.js";
|
|
2
2
|
var ERROR_MESSAGES = {
|
|
3
3
|
// util.js / config
|
|
4
4
|
UT1: "given name is no string or empty",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { d as debounce } from "./sessionStorage-B68y-wnE.js";
|
|
2
2
|
import { i as isObject } from "./isObject-FTY-5JQX.js";
|
|
3
|
-
import { aq as identity, aL as operate, W as createOperatorSubscriber, ax as isFunction, U as computeValue, b0 as truthy, H as assert, a4 as ensureArray, at as isArray, T as compare, V as createExpressionOperator, c as $eq$1, f as $gt$1, h as $gte$1, k as $lt$1, m as $lte$1, p as $ne$1, M as MingoError, ay as isFunction$1, X as createQueryOperator, $ as $all$1, al as getSchemaByObjectPath, aK as objectPathMonad, y as INDEX_MIN, I as INDEX_MAX, a5 as ensureNotFalsy, ag as getFromMapOrCreate, ai as getPrimaryFieldOfPrimaryKey, aS as requestIdleCallbackIfAvailable, B as BehaviorSubject, aG as mergeMap, aa as firstValueFrom, a8 as filter, ab as flatClone$1, a0 as createRxQuery, _ as _getDefaultQuery, aP as queryCollection, aH as newRxError, af as getDefaultRevision, aJ as now, aN as prepareQuery, aM as overwritable, az as isMaybeReadonlyArray, ac as flatCloneDocWithMeta, S as Subject, a_ as toArray, K as categorizeBulkWriteRows, aO as pushAtSortPosition, ak as getQueryMatcher, am as getSortComparator, P as PROMISE_RESOLVE_TRUE, z as PROMISE_RESOLVE_VOID, R as RXDB_VERSION, a6 as ensureRxStorageInstanceParamsAreCorrect, aQ as randomToken, a1 as deepEqual, aT as requestIdlePromiseNoQueue, a as $and$1, b as $elemMatch, d as $eq$2, e as $exists, g as $gt$2, i as $gte$2, j as $in, l as $lt$2, n as $lte$2, o as $mod, q as $ne$2, r as $nin, s as $nor, t as $not$1, u as $or$1, v as $regex, w as $size, x as $type, ar as initOptions, C as Context, Q as Query, b2 as walk, aU as resolve$1, au as isDate, aB as isObject$1, aD as isRegExp, O as cloneDeep, an as has, as as intersection, b1 as unique, aA as isNumber, aC as isOperator, av as isEqual, L as clone$1, aW as runQueryUpdateFunction, ae as getChangedDocumentsSince, aV as runPluginHooks, aX as setProperty, aF as merge, aY as shareReplay, A as RXJS_SHARE_REPLAY_DEFAULTS, aE as map, G as appendToArray, aj as getProperty, aZ as startWith, a3 as distinctUntilChanged, F as addRxPlugin, Y as createRxDatabase, aR as replicateSelectorCollection } from "./replication-
|
|
3
|
+
import { aq as identity, aL as operate, W as createOperatorSubscriber, ax as isFunction, U as computeValue, b0 as truthy, H as assert, a4 as ensureArray, at as isArray, T as compare, V as createExpressionOperator, c as $eq$1, f as $gt$1, h as $gte$1, k as $lt$1, m as $lte$1, p as $ne$1, M as MingoError, ay as isFunction$1, X as createQueryOperator, $ as $all$1, al as getSchemaByObjectPath, aK as objectPathMonad, y as INDEX_MIN, I as INDEX_MAX, a5 as ensureNotFalsy, ag as getFromMapOrCreate, ai as getPrimaryFieldOfPrimaryKey, aS as requestIdleCallbackIfAvailable, B as BehaviorSubject, aG as mergeMap, aa as firstValueFrom, a8 as filter, ab as flatClone$1, a0 as createRxQuery, _ as _getDefaultQuery, aP as queryCollection, aH as newRxError, af as getDefaultRevision, aJ as now, aN as prepareQuery, aM as overwritable, az as isMaybeReadonlyArray, ac as flatCloneDocWithMeta, S as Subject, a_ as toArray, K as categorizeBulkWriteRows, aO as pushAtSortPosition, ak as getQueryMatcher, am as getSortComparator, P as PROMISE_RESOLVE_TRUE, z as PROMISE_RESOLVE_VOID, R as RXDB_VERSION, a6 as ensureRxStorageInstanceParamsAreCorrect, aQ as randomToken, a1 as deepEqual, aT as requestIdlePromiseNoQueue, a as $and$1, b as $elemMatch, d as $eq$2, e as $exists, g as $gt$2, i as $gte$2, j as $in, l as $lt$2, n as $lte$2, o as $mod, q as $ne$2, r as $nin, s as $nor, t as $not$1, u as $or$1, v as $regex, w as $size, x as $type, ar as initOptions, C as Context, Q as Query, b2 as walk, aU as resolve$1, au as isDate, aB as isObject$1, aD as isRegExp, O as cloneDeep, an as has, as as intersection, b1 as unique, aA as isNumber, aC as isOperator, av as isEqual, L as clone$1, aW as runQueryUpdateFunction, ae as getChangedDocumentsSince, aV as runPluginHooks, aX as setProperty, aF as merge, aY as shareReplay, A as RXJS_SHARE_REPLAY_DEFAULTS, aE as map, G as appendToArray, aj as getProperty, aZ as startWith, a3 as distinctUntilChanged, F as addRxPlugin, Y as createRxDatabase, aR as replicateSelectorCollection } from "./replication-D4yDBTWp.js";
|
|
4
4
|
import { g as getDefaultExportFromCjs } from "./_commonjsHelpers-CUmg6egw.js";
|
|
5
5
|
import { REPLICATE } from "./utils/constants.js";
|
|
6
6
|
import { REPLICATORS } from "./database/globals.js";
|
|
@@ -9656,7 +9656,7 @@ const buildDatabase = async (_config = {}) => {
|
|
|
9656
9656
|
addRxPlugin(RxDBStatePlugin);
|
|
9657
9657
|
/* v8 ignore next 10 -- @preserve */
|
|
9658
9658
|
if (config.devMode) {
|
|
9659
|
-
await import("./index-
|
|
9659
|
+
await import("./index-CijTTmTT.js").then((module) => {
|
|
9660
9660
|
addRxPlugin(module.RxDBDevModePlugin);
|
|
9661
9661
|
if (config.testing) {
|
|
9662
9662
|
module.disableWarnings();
|
package/main.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ClueDatabase, ClueDatabaseCollections, SelectorCollection, SelectorCollectionMethods, SelectorDocMethods, SelectorDocType, SelectorDocument, StatusCollection, StatusCollectionMethods, StatusDocMethods, StatusDocType, StatusDocument } from "./database/types";
|
|
1
|
+
import { ClueDatabase, ClueDatabaseCollections, DatabaseConfig, SelectorCollection, SelectorCollectionMethods, SelectorDocMethods, SelectorDocType, SelectorDocument, StatusCollection, StatusCollectionMethods, StatusDocMethods, StatusDocType, StatusDocument } from "./database/types";
|
|
2
2
|
import { ActionDefinition, ActionDefinitionsResponse, ActionResult } from "./types/action";
|
|
3
3
|
import { default as EnrichmentProps } from "./types/EnrichmentProps";
|
|
4
4
|
import { FetcherDefinition, FetcherDefinitionsResponse, FetcherResult } from "./types/fetcher";
|
|
@@ -22,6 +22,7 @@ import { default as GroupControl } from './components/group/GroupControl';
|
|
|
22
22
|
import { default as SourcePicker } from './components/SourcePicker';
|
|
23
23
|
import { SNACKBAR_EVENT_ID, SnackbarEvents } from './data/event';
|
|
24
24
|
import { default as buildDatabase } from './database';
|
|
25
|
+
import { ClueReplicationError } from './database/errors';
|
|
25
26
|
import { ClueComponentContext } from './hooks/ClueComponentContext';
|
|
26
27
|
import { ClueConfigContextProps, ClueConfigContext } from './hooks/ClueConfigProvider';
|
|
27
28
|
import { ClueDatabaseContext, ClueDatabaseContextProps } from './hooks/ClueDatabaseContext';
|
|
@@ -39,6 +40,6 @@ import { default as ClueUIPlugin } from './plugins/ClueUIPlugin';
|
|
|
39
40
|
import { ClueUIPluginDefinition } from './plugins/registry';
|
|
40
41
|
import { default as FrequencyText } from './text/Frequency';
|
|
41
42
|
|
|
42
|
-
export { ActionForm, AnnotationDetailPopover, AnnotationDetails, AnnotationEntry, AnnotationPreview, AssessmentIcon, buildDatabase, ClueComponentContext, ClueConfigContext, ClueDatabaseContext, ClueEnrichContext, CluePopupContext, ClueProvider, ClueUIPlugin, ContextIcon, CountBadge, EnrichedCard, EnrichedChip, EnrichedTypography, Entry, Fetcher, FrequencyText, Group, GroupControl, OpinionIcon, SNACKBAR_EVENT_ID, SourcePicker, StatusChip, useClue, useClueActions, useClueActionsSelector, useClueConfig, useClueEnrichSelector, useClueFetcherSelector };
|
|
43
|
-
export type { ActionDefinition, ActionDefinitionsResponse, ActionResult, Annotation, BulkEnrichRequest, BulkEnrichResponses, ClueConfigContextProps, ClueDatabase, ClueDatabaseCollections, ClueDatabaseContextProps, ClueResponse, ClueUIPluginDefinition, EnrichedCardProps, EnrichedTypographyProps, Enrichment, EnrichmentProps, EnrichResponse, EnrichResponses, FailedRequest, FetcherDefinition, FetcherDefinitionsResponse, FetcherResult, RunningActionData, Selector, SelectorCollection, SelectorCollectionMethods, SelectorDocMethods, SelectorDocType, SelectorDocument, SnackbarEvents, StatusCollection, StatusCollectionMethods, StatusDocMethods, StatusDocType, StatusDocument, TypesDetectionResponse, TypesResponse, WithExtra };
|
|
43
|
+
export { ActionForm, AnnotationDetailPopover, AnnotationDetails, AnnotationEntry, AnnotationPreview, AssessmentIcon, buildDatabase, ClueComponentContext, ClueConfigContext, ClueDatabaseContext, ClueEnrichContext, CluePopupContext, ClueProvider, ClueReplicationError, ClueUIPlugin, ContextIcon, CountBadge, EnrichedCard, EnrichedChip, EnrichedTypography, Entry, Fetcher, FrequencyText, Group, GroupControl, OpinionIcon, SNACKBAR_EVENT_ID, SourcePicker, StatusChip, useClue, useClueActions, useClueActionsSelector, useClueConfig, useClueEnrichSelector, useClueFetcherSelector };
|
|
44
|
+
export type { ActionDefinition, ActionDefinitionsResponse, ActionResult, Annotation, BulkEnrichRequest, BulkEnrichResponses, ClueConfigContextProps, ClueDatabase, ClueDatabaseCollections, ClueDatabaseContextProps, ClueResponse, ClueUIPluginDefinition, DatabaseConfig, EnrichedCardProps, EnrichedTypographyProps, Enrichment, EnrichmentProps, EnrichResponse, EnrichResponses, FailedRequest, FetcherDefinition, FetcherDefinitionsResponse, FetcherResult, RunningActionData, Selector, SelectorCollection, SelectorCollectionMethods, SelectorDocMethods, SelectorDocType, SelectorDocument, SnackbarEvents, StatusCollection, StatusCollectionMethods, StatusDocMethods, StatusDocType, StatusDocument, TypesDetectionResponse, TypesResponse, WithExtra };
|
|
44
45
|
export type { ClueConfigContextProps as BorealisConfigContextProps, ClueDatabase as BorealisDatabase, ClueDatabaseCollections as BorealisDatabaseCollections, ClueDatabaseContextProps as BorealisDatabaseContextProps, ClueResponse as BorealisResponse };
|
package/main.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { A, b, d, f, g } from "./ActionForm-
|
|
1
|
+
import { A, b, d, f, g } from "./ActionForm-Bw8N20TK.js";
|
|
2
2
|
import { default as default2 } from "./components/AnnotationDetailPopover.js";
|
|
3
|
-
import { A as A2 } from "./AnnotationDetails-
|
|
3
|
+
import { A as A2 } from "./AnnotationDetails-CP3LACKv.js";
|
|
4
4
|
import { default as default3 } from "./components/AnnotationEntry.js";
|
|
5
|
-
import { A as A3, C } from "./AnnotationPreview-
|
|
5
|
+
import { A as A3, C } from "./AnnotationPreview-BgiL1Xny.js";
|
|
6
6
|
import { default as default4 } from "./components/CountBadge.js";
|
|
7
7
|
import { default as default5 } from "./components/EnrichedCard.js";
|
|
8
8
|
import { default as default6 } from "./components/EnrichedChip.js";
|
|
@@ -14,7 +14,8 @@ import { default as default11 } from "./components/group/Group.js";
|
|
|
14
14
|
import { default as default12 } from "./components/group/GroupControl.js";
|
|
15
15
|
import { default as default13 } from "./components/SourcePicker.js";
|
|
16
16
|
import { SNACKBAR_EVENT_ID } from "./data/event.js";
|
|
17
|
-
import { b as b2 } from "./index-
|
|
17
|
+
import { b as b2 } from "./index-EUvbYwEJ.js";
|
|
18
|
+
import { ClueReplicationError } from "./database/errors.js";
|
|
18
19
|
import { ClueComponentContext } from "./hooks/ClueComponentContext.js";
|
|
19
20
|
import { ClueConfigContext } from "./hooks/ClueConfigProvider.js";
|
|
20
21
|
import { ClueDatabaseContext } from "./hooks/ClueDatabaseContext.js";
|
|
@@ -40,6 +41,7 @@ export {
|
|
|
40
41
|
C2 as ClueEnrichContext,
|
|
41
42
|
C as CluePopupContext,
|
|
42
43
|
ClueProvider,
|
|
44
|
+
ClueReplicationError,
|
|
43
45
|
default19 as ClueUIPlugin,
|
|
44
46
|
default17 as ContextIcon,
|
|
45
47
|
default4 as CountBadge,
|
package/package.json
CHANGED
|
@@ -10,6 +10,7 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
|
|
|
10
10
|
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
11
11
|
var _hashFn, _keyMap, _unpack, _options, _root, _local, _operators, _iteratees, _yieldedValues, _getNext, _a, _source, _predicate, _projection, _options2, _operators2, _result, _buffer, _compiled, _options3, _condition;
|
|
12
12
|
import { a as api, j as joinAllUri, u as uri } from "./index-CPetQxOc.js";
|
|
13
|
+
import { ClueReplicationError } from "./database/errors.js";
|
|
13
14
|
import { REPLICATORS } from "./database/globals.js";
|
|
14
15
|
import { l as last$1 } from "./last-CUCl67Im.js";
|
|
15
16
|
function _typeof(o) {
|
|
@@ -11538,74 +11539,145 @@ const buildRequestConfig = (config2) => {
|
|
|
11538
11539
|
}
|
|
11539
11540
|
return requestConfig;
|
|
11540
11541
|
};
|
|
11542
|
+
const parseStreamEvent = (line) => {
|
|
11543
|
+
var _a2, _b, _c;
|
|
11544
|
+
try {
|
|
11545
|
+
const event = JSON.parse(line);
|
|
11546
|
+
const lastUpdated = ((_a2 = event == null ? void 0 : event.checkpoint) == null ? void 0 : _a2.last_updated) ?? ((_b = event == null ? void 0 : event.checkpoint) == null ? void 0 : _b.updated_at);
|
|
11547
|
+
const checkpoint = (event == null ? void 0 : event.checkpoint) === null ? null : typeof ((_c = event == null ? void 0 : event.checkpoint) == null ? void 0 : _c.id) === "string" && Number.isFinite(lastUpdated) ? { id: event.checkpoint.id, last_updated: lastUpdated } : void 0;
|
|
11548
|
+
if (!Number.isFinite(event == null ? void 0 : event.id) || !Array.isArray(event.documents) || checkpoint === void 0) {
|
|
11549
|
+
return null;
|
|
11550
|
+
}
|
|
11551
|
+
return { ...event, checkpoint };
|
|
11552
|
+
} catch {
|
|
11553
|
+
return null;
|
|
11554
|
+
}
|
|
11555
|
+
};
|
|
11541
11556
|
const stream = (collection, config2) => {
|
|
11542
11557
|
const stream$ = new Subject();
|
|
11543
11558
|
const MAX_RETRY_DELAY = 6e4;
|
|
11559
|
+
const INITIAL_RETRY_DELAY = 1e3;
|
|
11544
11560
|
const loggedEvents = [];
|
|
11545
11561
|
let currentXhr = null;
|
|
11546
|
-
|
|
11547
|
-
|
|
11548
|
-
|
|
11549
|
-
const
|
|
11562
|
+
let retryTimer = null;
|
|
11563
|
+
let closed = false;
|
|
11564
|
+
const isClosed = () => closed || collection.closed;
|
|
11565
|
+
const getToken = () => {
|
|
11550
11566
|
var _a2;
|
|
11567
|
+
try {
|
|
11568
|
+
return (_a2 = config2.getToken) == null ? void 0 : _a2.call(config2);
|
|
11569
|
+
} catch {
|
|
11570
|
+
return void 0;
|
|
11571
|
+
}
|
|
11572
|
+
};
|
|
11573
|
+
const reportHttpFailure = async (error) => {
|
|
11574
|
+
try {
|
|
11575
|
+
if (!config2.onReplicationError) {
|
|
11576
|
+
console.error(error);
|
|
11577
|
+
return false;
|
|
11578
|
+
}
|
|
11579
|
+
return await config2.onReplicationError(error) === true;
|
|
11580
|
+
} catch {
|
|
11581
|
+
return false;
|
|
11582
|
+
}
|
|
11583
|
+
};
|
|
11584
|
+
const emitResyncIfNeeded = () => {
|
|
11585
|
+
if (!isClosed() && collection.synced) {
|
|
11586
|
+
stream$.next("RESYNC");
|
|
11587
|
+
}
|
|
11588
|
+
};
|
|
11589
|
+
const connect = (timeout = INITIAL_RETRY_DELAY, token = getToken()) => {
|
|
11590
|
+
if (isClosed()) {
|
|
11591
|
+
return;
|
|
11592
|
+
}
|
|
11551
11593
|
let lastProcessedIndex = 0;
|
|
11552
|
-
|
|
11553
|
-
|
|
11594
|
+
let done = false;
|
|
11595
|
+
const xhr = new XMLHttpRequest();
|
|
11596
|
+
currentXhr = xhr;
|
|
11597
|
+
const fullUrl = (config2.baseURL ?? "") + joinAllUri(uri(), collection.name, "stream");
|
|
11598
|
+
xhr.open("GET", fullUrl, true);
|
|
11599
|
+
xhr.setRequestHeader("Accept", "text/event-stream");
|
|
11600
|
+
if (token) {
|
|
11601
|
+
xhr.setRequestHeader("Authorization", `Bearer ${token}`);
|
|
11602
|
+
}
|
|
11554
11603
|
const reconnect = () => {
|
|
11555
|
-
if (
|
|
11604
|
+
if (isClosed()) {
|
|
11556
11605
|
return;
|
|
11557
11606
|
}
|
|
11558
11607
|
{
|
|
11559
11608
|
console.log(`Retrying live connection in ${timeout}ms...`);
|
|
11560
11609
|
}
|
|
11561
|
-
setTimeout(() => {
|
|
11610
|
+
retryTimer = setTimeout(() => {
|
|
11611
|
+
retryTimer = null;
|
|
11562
11612
|
connect(Math.min(timeout * 2, MAX_RETRY_DELAY));
|
|
11563
11613
|
}, timeout);
|
|
11614
|
+
emitResyncIfNeeded();
|
|
11564
11615
|
};
|
|
11565
|
-
const
|
|
11566
|
-
|
|
11567
|
-
|
|
11568
|
-
|
|
11569
|
-
if (token) {
|
|
11570
|
-
_xhr.setRequestHeader("Authorization", `Bearer ${token}`);
|
|
11571
|
-
}
|
|
11572
|
-
_xhr.onload = () => {
|
|
11573
|
-
reconnect();
|
|
11574
|
-
if (collection.synced) {
|
|
11575
|
-
stream$.next("RESYNC");
|
|
11616
|
+
const processLines = (flush = false) => {
|
|
11617
|
+
var _a2;
|
|
11618
|
+
if (done || isClosed() || xhr.status < 200 || xhr.status >= 300) {
|
|
11619
|
+
return;
|
|
11576
11620
|
}
|
|
11577
|
-
|
|
11578
|
-
|
|
11579
|
-
|
|
11580
|
-
|
|
11581
|
-
|
|
11621
|
+
const lines = xhr.responseText.slice(lastProcessedIndex).split("\n");
|
|
11622
|
+
lastProcessedIndex = xhr.responseText.length - (flush ? 0 : ((_a2 = lines.pop()) == null ? void 0 : _a2.length) ?? 0);
|
|
11623
|
+
for (const line of lines) {
|
|
11624
|
+
const event = line.trim() ? parseStreamEvent(line) : null;
|
|
11625
|
+
if (!event) {
|
|
11626
|
+
continue;
|
|
11627
|
+
}
|
|
11628
|
+
timeout = INITIAL_RETRY_DELAY;
|
|
11629
|
+
if (loggedEvents.includes(event.id)) {
|
|
11630
|
+
continue;
|
|
11631
|
+
}
|
|
11632
|
+
if (loggedEvents.length >= 1e3) {
|
|
11633
|
+
loggedEvents.shift();
|
|
11634
|
+
}
|
|
11635
|
+
loggedEvents.push(event.id);
|
|
11636
|
+
stream$.next(event);
|
|
11582
11637
|
}
|
|
11583
11638
|
};
|
|
11584
|
-
|
|
11585
|
-
|
|
11586
|
-
|
|
11639
|
+
const handleEnd = async () => {
|
|
11640
|
+
var _a2;
|
|
11641
|
+
if (done || isClosed()) {
|
|
11642
|
+
return;
|
|
11587
11643
|
}
|
|
11588
|
-
|
|
11589
|
-
|
|
11590
|
-
|
|
11591
|
-
|
|
11592
|
-
|
|
11593
|
-
|
|
11594
|
-
|
|
11595
|
-
|
|
11596
|
-
|
|
11597
|
-
|
|
11644
|
+
if (xhr.status < 400) {
|
|
11645
|
+
processLines(true);
|
|
11646
|
+
}
|
|
11647
|
+
done = true;
|
|
11648
|
+
if (xhr.status >= 400) {
|
|
11649
|
+
const error = new ClueReplicationError(xhr.status, fullUrl, collection.name);
|
|
11650
|
+
if (xhr.status >= 500) {
|
|
11651
|
+
void reportHttpFailure(error);
|
|
11652
|
+
reconnect();
|
|
11653
|
+
} else if (xhr.status === 401) {
|
|
11654
|
+
if (await reportHttpFailure(error)) {
|
|
11655
|
+
const refreshedToken = (_a2 = getToken()) == null ? void 0 : _a2.trim();
|
|
11656
|
+
if (refreshedToken && refreshedToken !== token && !isClosed()) {
|
|
11657
|
+
connect(INITIAL_RETRY_DELAY, refreshedToken);
|
|
11658
|
+
emitResyncIfNeeded();
|
|
11659
|
+
}
|
|
11598
11660
|
}
|
|
11599
|
-
|
|
11600
|
-
|
|
11661
|
+
} else {
|
|
11662
|
+
void reportHttpFailure(error);
|
|
11601
11663
|
}
|
|
11602
|
-
} catch {
|
|
11603
11664
|
return;
|
|
11604
11665
|
}
|
|
11605
|
-
|
|
11666
|
+
reconnect();
|
|
11606
11667
|
};
|
|
11607
|
-
|
|
11668
|
+
xhr.onload = () => void handleEnd();
|
|
11669
|
+
xhr.onerror = () => void handleEnd();
|
|
11670
|
+
xhr.onprogress = () => processLines();
|
|
11671
|
+
xhr.send();
|
|
11608
11672
|
};
|
|
11673
|
+
collection.onClose.push(() => {
|
|
11674
|
+
closed = true;
|
|
11675
|
+
if (retryTimer !== null) {
|
|
11676
|
+
clearTimeout(retryTimer);
|
|
11677
|
+
retryTimer = null;
|
|
11678
|
+
}
|
|
11679
|
+
currentXhr == null ? void 0 : currentXhr.abort();
|
|
11680
|
+
});
|
|
11609
11681
|
connect();
|
|
11610
11682
|
return stream$;
|
|
11611
11683
|
};
|