@cccsaurora/clue-ui 1.1.1 → 1.1.2
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/{AnnotationDetails-BdfWMISw.js → AnnotationDetails-BChWwaXw.js} +1 -1
- package/{AnnotationPreview-CKMGCoUH.js → AnnotationPreview-D060vmy2.js} +1 -1
- package/ClueEnrichContext-DJNjbXu_.js +418 -0
- 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 +1 -1
- package/components/EnrichedTypography.js +1 -1
- package/hooks/ClueEnrichContext.js +1 -1
- package/hooks/CluePopupContext.js +2 -2
- package/hooks/ClueProvider.js +2 -2
- package/hooks/selectors.js +1 -1
- package/hooks/useAnnotations.js +1 -1
- package/hooks/useClue.js +1 -1
- package/icons/Action.js +1 -1
- package/icons/Assessment.js +1 -1
- package/icons/Context.js +1 -1
- package/icons/Opinion.js +1 -1
- package/main.js +3 -3
- package/package.json +1 -1
- package/ClueEnrichContext-CrFpdYhh.js +0 -414
|
@@ -10,7 +10,7 @@ import L from "./hooks/useErrors.js";
|
|
|
10
10
|
import { ICON_MAP as T } from "./icons/iconMap.js";
|
|
11
11
|
import { safeDispatchEvent as U } from "./utils/window.js";
|
|
12
12
|
import { g as V } from "./groupBy-BheQYl6f.js";
|
|
13
|
-
import { u as W } from "./ClueEnrichContext-
|
|
13
|
+
import { u as W } from "./ClueEnrichContext-DJNjbXu_.js";
|
|
14
14
|
import { memo as G, useState as J, useMemo as k, useCallback as P, useEffect as Q } from "react";
|
|
15
15
|
import { u as X } from "./index-E7g8cRyW.js";
|
|
16
16
|
import Y from "./components/actions/ExecutePopover.js";
|
|
@@ -8,7 +8,7 @@ import { useState as v, useRef as Y, useCallback as x, useEffect as Z, useMemo a
|
|
|
8
8
|
import { c as B, u as G } from "./index-E7g8cRyW.js";
|
|
9
9
|
import { SHOW_EVENT_ID as g, HIDE_EVENT_ID as D } from "./data/event.js";
|
|
10
10
|
import { safeDispatchEvent as A, safeAddEventListener as S } from "./utils/window.js";
|
|
11
|
-
import { i as J } from "./AnnotationDetails-
|
|
11
|
+
import { i as J } from "./AnnotationDetails-BChWwaXw.js";
|
|
12
12
|
const b = B(null), rt = ({ children: c }) => {
|
|
13
13
|
const [l, e] = v(null), [p, i] = v(null), [r, d] = v(null), [u, m] = v(null), [f, t] = v({}), a = Y(null), P = x((s, o, z, N) => {
|
|
14
14
|
A(
|
|
@@ -0,0 +1,418 @@
|
|
|
1
|
+
import { jsx as xt } from "react/jsx-runtime";
|
|
2
|
+
import { a as Dt } from "./iconify-BBckr5AQ.js";
|
|
3
|
+
import { u as Et, a as It, p as ct } from "./useClueTypeConfig-DyeBcXQX.js";
|
|
4
|
+
import { clueDebugLogger as _ } from "./utils/loggerUtil.js";
|
|
5
|
+
import { b as Ct } from "./_baseSlice-M5RKzt1A.js";
|
|
6
|
+
import { t as gt } from "./toFinite-BMy6GObD.js";
|
|
7
|
+
import { d as $t } from "./debounce-DryYcbJ4.js";
|
|
8
|
+
import { g as at } from "./groupBy-BheQYl6f.js";
|
|
9
|
+
import { b as ft } from "./_baseUniq-tMFmk80M.js";
|
|
10
|
+
import { b as Ot } from "./_baseIteratee-CP1bocOX.js";
|
|
11
|
+
import { useContext as jt, useState as H, useMemo as G, useCallback as g, useRef as Pt, useEffect as q } from "react";
|
|
12
|
+
import { c as bt } from "./index-E7g8cRyW.js";
|
|
13
|
+
import { ClueDatabaseContext as Mt } from "./hooks/ClueDatabaseContext.js";
|
|
14
|
+
import qt from "./hooks/useClueConfig.js";
|
|
15
|
+
function At(e) {
|
|
16
|
+
var n = gt(e), p = n % 1;
|
|
17
|
+
return n === n ? p ? n - p : n : 0;
|
|
18
|
+
}
|
|
19
|
+
var Bt = Math.ceil, Rt = Math.max;
|
|
20
|
+
function Vt(e, n, p) {
|
|
21
|
+
n === void 0 ? n = 1 : n = Rt(At(n), 0);
|
|
22
|
+
var l = e == null ? 0 : e.length;
|
|
23
|
+
if (!l || n < 1)
|
|
24
|
+
return [];
|
|
25
|
+
for (var h = 0, v = 0, O = Array(Bt(l / n)); h < l; )
|
|
26
|
+
O[v++] = Ct(e, h, h += n);
|
|
27
|
+
return O;
|
|
28
|
+
}
|
|
29
|
+
function ut(e) {
|
|
30
|
+
return e && e.length ? ft(e) : [];
|
|
31
|
+
}
|
|
32
|
+
function Ut(e, n) {
|
|
33
|
+
return e && e.length ? ft(e, Ot(n)) : [];
|
|
34
|
+
}
|
|
35
|
+
let J;
|
|
36
|
+
const Wt = new Uint8Array(16);
|
|
37
|
+
function Ft() {
|
|
38
|
+
if (!J && (J = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !J))
|
|
39
|
+
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
40
|
+
return J(Wt);
|
|
41
|
+
}
|
|
42
|
+
const d = [];
|
|
43
|
+
for (let e = 0; e < 256; ++e)
|
|
44
|
+
d.push((e + 256).toString(16).slice(1));
|
|
45
|
+
function Ht(e, n = 0) {
|
|
46
|
+
return d[e[n + 0]] + d[e[n + 1]] + d[e[n + 2]] + d[e[n + 3]] + "-" + d[e[n + 4]] + d[e[n + 5]] + "-" + d[e[n + 6]] + d[e[n + 7]] + "-" + d[e[n + 8]] + d[e[n + 9]] + "-" + d[e[n + 10]] + d[e[n + 11]] + d[e[n + 12]] + d[e[n + 13]] + d[e[n + 14]] + d[e[n + 15]];
|
|
47
|
+
}
|
|
48
|
+
const Jt = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), lt = {
|
|
49
|
+
randomUUID: Jt
|
|
50
|
+
};
|
|
51
|
+
function $(e, n, p) {
|
|
52
|
+
if (lt.randomUUID && !e)
|
|
53
|
+
return lt.randomUUID();
|
|
54
|
+
e = e || {};
|
|
55
|
+
const l = e.random || (e.rng || Ft)();
|
|
56
|
+
return l[6] = l[6] & 15 | 64, l[8] = l[8] & 63 | 128, Ht(l);
|
|
57
|
+
}
|
|
58
|
+
const Qt = bt(null), se = ({
|
|
59
|
+
children: e,
|
|
60
|
+
classification: n,
|
|
61
|
+
baseURL: p,
|
|
62
|
+
getToken: l,
|
|
63
|
+
onNetworkCall: h,
|
|
64
|
+
pickSources: v,
|
|
65
|
+
chunkSize: O = 15,
|
|
66
|
+
maxRequestCount: Q = 4,
|
|
67
|
+
defaultTimeout: A = 5,
|
|
68
|
+
enabled: B = !0,
|
|
69
|
+
ready: dt = !1,
|
|
70
|
+
publicIconify: K = !0,
|
|
71
|
+
skipConfigCall: X = !1,
|
|
72
|
+
customIconify: R,
|
|
73
|
+
debugLogging: x = !0
|
|
74
|
+
}) => {
|
|
75
|
+
var st, nt, it, ot, rt;
|
|
76
|
+
const I = qt(), s = jt(Mt), [Y, pt] = H(null), w = G(
|
|
77
|
+
() => {
|
|
78
|
+
var t, i;
|
|
79
|
+
return Y ?? n ?? ((i = (t = I.config) == null ? void 0 : t.c12nDef) == null ? void 0 : i.RESTRICTED);
|
|
80
|
+
},
|
|
81
|
+
[n, (nt = (st = I.config) == null ? void 0 : st.c12nDef) == null ? void 0 : nt.RESTRICTED, Y]
|
|
82
|
+
), Z = g(
|
|
83
|
+
(t) => {
|
|
84
|
+
var i;
|
|
85
|
+
return pt(t((i = I.config) == null ? void 0 : i.c12nDef));
|
|
86
|
+
},
|
|
87
|
+
[(it = I.config) == null ? void 0 : it.c12nDef]
|
|
88
|
+
), [C, mt] = H(dt), j = Pt(0), [D, ht] = H([]), { availableSources: P, typesDetection: V } = Et(
|
|
89
|
+
B && C,
|
|
90
|
+
p,
|
|
91
|
+
x,
|
|
92
|
+
l,
|
|
93
|
+
h
|
|
94
|
+
);
|
|
95
|
+
q(() => {
|
|
96
|
+
if (X || !B || !C)
|
|
97
|
+
return;
|
|
98
|
+
const t = {}, i = l == null ? void 0 : l();
|
|
99
|
+
i && (t.Authorization = `Bearer ${i}`);
|
|
100
|
+
let u = { baseURL: p, headers: t };
|
|
101
|
+
h && (u = h(u)), It.configs.get(u).then(I.setConfig);
|
|
102
|
+
}, [p, h, X, C]);
|
|
103
|
+
const [z, N] = H(R);
|
|
104
|
+
q(() => {
|
|
105
|
+
R && N(R);
|
|
106
|
+
}, [R]), q(() => {
|
|
107
|
+
if (K)
|
|
108
|
+
return;
|
|
109
|
+
let t = z ?? void 0 ?? (p == null ? void 0 : p.replace(/^[^.]+/, "icons"));
|
|
110
|
+
!t && typeof window < "u" && window && !window.location.origin.includes("localhost") && (t = window.location.protocol + "//" + window.location.origin.replace(/^[^.]+/, "icons")), t && (_(`Using ${t} for iconify`, x), Dt("", {
|
|
111
|
+
resources: [t]
|
|
112
|
+
}));
|
|
113
|
+
}, [p, z, x, K]);
|
|
114
|
+
const U = g(
|
|
115
|
+
async (t) => {
|
|
116
|
+
const i = [];
|
|
117
|
+
for (const c of t) {
|
|
118
|
+
const { latency: r, source: f, type: o, value: y, items: a, error: m } = c;
|
|
119
|
+
m && i.push({
|
|
120
|
+
id: $(),
|
|
121
|
+
source: f,
|
|
122
|
+
type: o,
|
|
123
|
+
value: y,
|
|
124
|
+
annotations: [],
|
|
125
|
+
classification: w,
|
|
126
|
+
latency: r,
|
|
127
|
+
count: 0,
|
|
128
|
+
error: m
|
|
129
|
+
});
|
|
130
|
+
for (const E of a) {
|
|
131
|
+
const { classification: b, count: M, link: F, annotations: wt } = E;
|
|
132
|
+
await s.selectors.find({ selector: { type: o, value: y, source: f, classification: b } }).incrementalRemove();
|
|
133
|
+
const S = {
|
|
134
|
+
id: $(),
|
|
135
|
+
source: f,
|
|
136
|
+
type: o,
|
|
137
|
+
value: y,
|
|
138
|
+
annotations: wt,
|
|
139
|
+
classification: b,
|
|
140
|
+
latency: r,
|
|
141
|
+
count: M,
|
|
142
|
+
link: F,
|
|
143
|
+
error: m
|
|
144
|
+
};
|
|
145
|
+
i.some((vt) => vt.id === S.id) && (S.id = $()), i.push(S);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
const u = await s.selectors.bulkInsert(i);
|
|
149
|
+
u.error.length > 0 && (console.warn("Errors on upsert:"), u.error.forEach((c) => console.warn(c.documentId, c.validationErrors ?? c.status)));
|
|
150
|
+
},
|
|
151
|
+
[s, w]
|
|
152
|
+
), T = g(
|
|
153
|
+
async (t, i, u = {}) => {
|
|
154
|
+
var E, b;
|
|
155
|
+
if (!t || !i)
|
|
156
|
+
return console.error(`Type (${t}) or value (${i}) is empty, returning empty response`), {};
|
|
157
|
+
const c = (v == null ? void 0 : v(D, P, [{ type: t, value: i, classification: u.classification }])) ?? D, r = {
|
|
158
|
+
timeout: A,
|
|
159
|
+
force: !1,
|
|
160
|
+
includeRaw: !1,
|
|
161
|
+
noCache: !1,
|
|
162
|
+
classification: w,
|
|
163
|
+
sources: c,
|
|
164
|
+
...u
|
|
165
|
+
}, f = {}, o = l == null ? void 0 : l();
|
|
166
|
+
o && (f.Authorization = `Bearer ${o}`);
|
|
167
|
+
let y = { baseURL: p, headers: f };
|
|
168
|
+
h && (y = h(y));
|
|
169
|
+
const a = {
|
|
170
|
+
type: t,
|
|
171
|
+
value: i,
|
|
172
|
+
classification: r.classification
|
|
173
|
+
};
|
|
174
|
+
let m = await ((E = s.status) == null ? void 0 : E.findOne({ selector: { ...a } }).exec());
|
|
175
|
+
m ? await m.incrementalPatch({ status: "in-progress" }) : m = await ((b = s.status) == null ? void 0 : b.insert({
|
|
176
|
+
id: $(),
|
|
177
|
+
type: a.type,
|
|
178
|
+
value: a.value,
|
|
179
|
+
classification: a.classification ?? w,
|
|
180
|
+
status: "in-progress"
|
|
181
|
+
}));
|
|
182
|
+
try {
|
|
183
|
+
const M = await ct([a], r.sources, r, y), F = Object.values(Object.values(M)[0])[0];
|
|
184
|
+
return await U(Object.values(F)), F;
|
|
185
|
+
} catch (M) {
|
|
186
|
+
return console.error(M), {};
|
|
187
|
+
} finally {
|
|
188
|
+
await (m == null ? void 0 : m.incrementalPatch({ status: "complete" }));
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
[
|
|
192
|
+
U,
|
|
193
|
+
P,
|
|
194
|
+
p,
|
|
195
|
+
s,
|
|
196
|
+
w,
|
|
197
|
+
A,
|
|
198
|
+
l,
|
|
199
|
+
h,
|
|
200
|
+
v,
|
|
201
|
+
D
|
|
202
|
+
]
|
|
203
|
+
), W = g(
|
|
204
|
+
async (t, i) => {
|
|
205
|
+
const u = (v == null ? void 0 : v(D, P, t)) ?? D, c = {
|
|
206
|
+
timeout: A,
|
|
207
|
+
includeRaw: !1,
|
|
208
|
+
noCache: !1,
|
|
209
|
+
classification: w,
|
|
210
|
+
sources: u,
|
|
211
|
+
...i
|
|
212
|
+
}, r = {}, f = l == null ? void 0 : l();
|
|
213
|
+
f && (r.Authorization = `Bearer ${f}`);
|
|
214
|
+
let o = { baseURL: p, headers: r };
|
|
215
|
+
h && (o = h(o));
|
|
216
|
+
const y = [];
|
|
217
|
+
for (const a of t) {
|
|
218
|
+
const m = { type: a.type, value: a.value, classification: c.classification };
|
|
219
|
+
let E = await s.status.findOne({
|
|
220
|
+
selector: m
|
|
221
|
+
}).incrementalPatch({
|
|
222
|
+
status: "in-progress"
|
|
223
|
+
});
|
|
224
|
+
E || (E = await s.status.insert({
|
|
225
|
+
id: $(),
|
|
226
|
+
...m,
|
|
227
|
+
status: "in-progress",
|
|
228
|
+
sources: c.sources
|
|
229
|
+
})), y.push(E.toMutableJSON());
|
|
230
|
+
}
|
|
231
|
+
try {
|
|
232
|
+
const a = await ct(t, c.sources, c, o), m = Object.values(a).flatMap(Object.values).flatMap(Object.values);
|
|
233
|
+
return await U(m), a;
|
|
234
|
+
} catch (a) {
|
|
235
|
+
return console.error(a), {};
|
|
236
|
+
} finally {
|
|
237
|
+
s.status.bulkUpsert(
|
|
238
|
+
Ut(y, (a) => a.id).map((a) => (a.status = "complete", a))
|
|
239
|
+
);
|
|
240
|
+
}
|
|
241
|
+
},
|
|
242
|
+
[
|
|
243
|
+
v,
|
|
244
|
+
D,
|
|
245
|
+
P,
|
|
246
|
+
A,
|
|
247
|
+
w,
|
|
248
|
+
l,
|
|
249
|
+
p,
|
|
250
|
+
h,
|
|
251
|
+
s,
|
|
252
|
+
U
|
|
253
|
+
]
|
|
254
|
+
), L = g(async () => {
|
|
255
|
+
const t = await s.selectors.find({ selector: { error: { $exists: !0 } } }).exec(), i = at(t, "classification"), u = [];
|
|
256
|
+
for (const [c, r] of Object.entries(i)) {
|
|
257
|
+
const f = at(r, (o) => `${o.type}:${o.value}`);
|
|
258
|
+
Object.values(f).forEach((o) => {
|
|
259
|
+
u.push({
|
|
260
|
+
id: $(),
|
|
261
|
+
type: o[0].type,
|
|
262
|
+
value: o[0].value,
|
|
263
|
+
classification: c,
|
|
264
|
+
sources: ut(o.map((y) => y.source)).sort(),
|
|
265
|
+
status: "pending"
|
|
266
|
+
});
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
await s.status.bulkInsert(u), await s.selectors.bulkRemove(t);
|
|
270
|
+
}, [s]), k = G(
|
|
271
|
+
() => $t(
|
|
272
|
+
async () => {
|
|
273
|
+
if (s != null && s.status) {
|
|
274
|
+
if (s.status.closed) {
|
|
275
|
+
console.warn("Status database is closed, will not enrich");
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
} else return;
|
|
279
|
+
const t = await s.status.find({ selector: { status: "pending" } }).update({ $set: { status: "in-progress" } });
|
|
280
|
+
if (t.length < 1)
|
|
281
|
+
return;
|
|
282
|
+
const i = Vt(t, O);
|
|
283
|
+
_(
|
|
284
|
+
`Enriching ${t.length} selectors in ${i.length} chunks of ${O}.`,
|
|
285
|
+
x
|
|
286
|
+
), await Promise.all(
|
|
287
|
+
// For performance reasons, we chunk the requests. This will allow us to take advantage of parellelization in the
|
|
288
|
+
// backend, both on the pod level and kubernetes level
|
|
289
|
+
i.map(async (u) => {
|
|
290
|
+
let c = null;
|
|
291
|
+
if (j.current <= Q)
|
|
292
|
+
j.current += 1;
|
|
293
|
+
else {
|
|
294
|
+
let r = Date.now();
|
|
295
|
+
await new Promise((f) => {
|
|
296
|
+
c = setInterval(() => {
|
|
297
|
+
_(
|
|
298
|
+
`Waiting on ${j.current} existing requests to complete (total delay: ${Date.now() - r}ms)`,
|
|
299
|
+
x
|
|
300
|
+
), j.current < Q && f();
|
|
301
|
+
}, 400);
|
|
302
|
+
}).finally(() => {
|
|
303
|
+
j.current += 1, clearInterval(c);
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
try {
|
|
307
|
+
const r = {}, f = ut(u.flatMap((o) => o.sources ?? []));
|
|
308
|
+
f.length > 0 && (r.sources = f), await W(
|
|
309
|
+
u.map((o) => o.toSelector()),
|
|
310
|
+
r
|
|
311
|
+
), await s.status.findByIds(u.map((o) => o.id)).update({ $set: { status: "complete" } });
|
|
312
|
+
} catch (r) {
|
|
313
|
+
console.error(r);
|
|
314
|
+
} finally {
|
|
315
|
+
j.current -= 1, c && clearInterval(c);
|
|
316
|
+
}
|
|
317
|
+
})
|
|
318
|
+
);
|
|
319
|
+
},
|
|
320
|
+
200,
|
|
321
|
+
{ maxWait: 500, leading: !1 }
|
|
322
|
+
),
|
|
323
|
+
[W, O, s, x, Q]
|
|
324
|
+
);
|
|
325
|
+
q(() => {
|
|
326
|
+
}, [s, x]), q(() => {
|
|
327
|
+
if (!B || !C || !(s != null && s.status))
|
|
328
|
+
return;
|
|
329
|
+
if (s != null && s.status.closed) {
|
|
330
|
+
console.warn("Status collection is closed");
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
const t = s.status.find({
|
|
334
|
+
selector: {
|
|
335
|
+
status: "pending"
|
|
336
|
+
}
|
|
337
|
+
}).$.subscribe(() => k());
|
|
338
|
+
return () => {
|
|
339
|
+
try {
|
|
340
|
+
t == null || t.unsubscribe();
|
|
341
|
+
} catch (i) {
|
|
342
|
+
console.warn(i);
|
|
343
|
+
}
|
|
344
|
+
};
|
|
345
|
+
}, [B, C, s, x, k, (ot = s == null ? void 0 : s.status) == null ? void 0 : ot.closed]);
|
|
346
|
+
const tt = g(
|
|
347
|
+
async (t, i, u) => {
|
|
348
|
+
if (!t)
|
|
349
|
+
throw new Error("Type cannot be null");
|
|
350
|
+
if (!i)
|
|
351
|
+
throw new Error("Value cannot be null");
|
|
352
|
+
const c = { type: t, value: i, classification: u ?? w };
|
|
353
|
+
let r = await s.status.findOne({
|
|
354
|
+
selector: c
|
|
355
|
+
}).exec();
|
|
356
|
+
return r || (r = await s.status.queueInsert({
|
|
357
|
+
id: $(),
|
|
358
|
+
...c,
|
|
359
|
+
status: "pending"
|
|
360
|
+
})), r;
|
|
361
|
+
},
|
|
362
|
+
[w, s]
|
|
363
|
+
), et = g(
|
|
364
|
+
(t) => {
|
|
365
|
+
var f, o;
|
|
366
|
+
if (!t)
|
|
367
|
+
return null;
|
|
368
|
+
const i = Object.entries(V), u = (f = i.find(([y, a]) => a.exec(t))) == null ? void 0 : f[0];
|
|
369
|
+
if (u)
|
|
370
|
+
return u;
|
|
371
|
+
const c = t.toLowerCase(), r = (o = i.find(([y, a]) => a.exec(c))) == null ? void 0 : o[0];
|
|
372
|
+
return r || null;
|
|
373
|
+
},
|
|
374
|
+
[V]
|
|
375
|
+
), yt = G(
|
|
376
|
+
() => {
|
|
377
|
+
var t;
|
|
378
|
+
return {
|
|
379
|
+
bulkEnrich: W,
|
|
380
|
+
enrich: T,
|
|
381
|
+
enrichFailedEnrichments: L,
|
|
382
|
+
sources: D,
|
|
383
|
+
setSources: ht,
|
|
384
|
+
typesDetection: V,
|
|
385
|
+
availableSources: P,
|
|
386
|
+
guessType: et,
|
|
387
|
+
queueEnrich: tt,
|
|
388
|
+
setCustomIconify: N,
|
|
389
|
+
setDefaultClassification: Z,
|
|
390
|
+
setReady: mt,
|
|
391
|
+
defaultClassification: w,
|
|
392
|
+
ready: C && !!s && !!((t = I.config) != null && t.c12nDef)
|
|
393
|
+
};
|
|
394
|
+
},
|
|
395
|
+
[
|
|
396
|
+
W,
|
|
397
|
+
T,
|
|
398
|
+
L,
|
|
399
|
+
D,
|
|
400
|
+
V,
|
|
401
|
+
P,
|
|
402
|
+
et,
|
|
403
|
+
tt,
|
|
404
|
+
Z,
|
|
405
|
+
w,
|
|
406
|
+
C,
|
|
407
|
+
s,
|
|
408
|
+
(rt = I.config) == null ? void 0 : rt.c12nDef
|
|
409
|
+
]
|
|
410
|
+
);
|
|
411
|
+
return /* @__PURE__ */ xt(Qt.Provider, { value: yt, children: e });
|
|
412
|
+
};
|
|
413
|
+
export {
|
|
414
|
+
Qt as C,
|
|
415
|
+
se as a,
|
|
416
|
+
Ut as b,
|
|
417
|
+
ut as u
|
|
418
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as d } from "react/jsx-runtime";
|
|
2
2
|
import { Popover as r } from "@mui/material";
|
|
3
3
|
import v, { useRef as c, useState as g, useEffect as R } from "react";
|
|
4
|
-
import { A as k } from "../AnnotationDetails-
|
|
4
|
+
import { A as k } from "../AnnotationDetails-BChWwaXw.js";
|
|
5
5
|
const S = v.memo(({ anchorEl: t, enrichRequest: u, open: o, onClose: l, ...e }) => {
|
|
6
6
|
var f, s, m;
|
|
7
7
|
const a = c(), [x, n] = g(!1);
|
|
@@ -10,8 +10,8 @@ import "../hooks/useErrors.js";
|
|
|
10
10
|
import "../icons/iconMap.js";
|
|
11
11
|
import "../utils/window.js";
|
|
12
12
|
import "../groupBy-BheQYl6f.js";
|
|
13
|
-
import { A as n } from "../AnnotationDetails-
|
|
14
|
-
import "../ClueEnrichContext-
|
|
13
|
+
import { A as n } from "../AnnotationDetails-BChWwaXw.js";
|
|
14
|
+
import "../ClueEnrichContext-DJNjbXu_.js";
|
|
15
15
|
import "react";
|
|
16
16
|
import "../index-E7g8cRyW.js";
|
|
17
17
|
import "./actions/ExecutePopover.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
2
|
import "../iconify-BBckr5AQ.js";
|
|
3
3
|
import "@mui/material";
|
|
4
|
-
import { A as d } from "../AnnotationPreview-
|
|
4
|
+
import { A as d } from "../AnnotationPreview-D060vmy2.js";
|
|
5
5
|
import "../hooks/useAnnotations.js";
|
|
6
6
|
import "../utils-BnmI_6N8.js";
|
|
7
7
|
import "react";
|
|
@@ -10,7 +10,7 @@ import L from "../icons/Context.js";
|
|
|
10
10
|
import Q from "../icons/Opinion.js";
|
|
11
11
|
import { ICON_MAP as y } from "../icons/iconMap.js";
|
|
12
12
|
import U from "../text/Frequency.js";
|
|
13
|
-
import { u as V } from "../ClueEnrichContext-
|
|
13
|
+
import { u as V } from "../ClueEnrichContext-DJNjbXu_.js";
|
|
14
14
|
import { memo as X, useState as Y, useMemo as T, useCallback as Z } from "react";
|
|
15
15
|
import { u as _ } from "../index-E7g8cRyW.js";
|
|
16
16
|
import P from "./AnnotationEntry.js";
|
|
@@ -3,7 +3,7 @@ import { Chip as B, Tooltip as G, Box as $, Stack as H, CircularProgress as J }
|
|
|
3
3
|
import K from "./display/icons/Iconified.js";
|
|
4
4
|
import { ClueComponentContext as L } from "../hooks/ClueComponentContext.js";
|
|
5
5
|
import { ClueGroupContext as N } from "../hooks/ClueGroupContext.js";
|
|
6
|
-
import { C as E } from "../AnnotationPreview-
|
|
6
|
+
import { C as E } from "../AnnotationPreview-D060vmy2.js";
|
|
7
7
|
import { useClueEnrichSelector as Q } from "../hooks/selectors.js";
|
|
8
8
|
import U from "../hooks/useAnnotations.js";
|
|
9
9
|
import V from "../icons/Action.js";
|
|
@@ -3,7 +3,7 @@ import { useTheme as K, Stack as L, CircularProgress as Q, Tooltip as U, IconBut
|
|
|
3
3
|
import W from "./display/icons/Iconified.js";
|
|
4
4
|
import { ClueComponentContext as X } from "../hooks/ClueComponentContext.js";
|
|
5
5
|
import { ClueGroupContext as Y } from "../hooks/ClueGroupContext.js";
|
|
6
|
-
import { C as $ } from "../AnnotationPreview-
|
|
6
|
+
import { C as $ } from "../AnnotationPreview-D060vmy2.js";
|
|
7
7
|
import { useClueEnrichSelector as Z } from "../hooks/selectors.js";
|
|
8
8
|
import F from "../hooks/useAnnotations.js";
|
|
9
9
|
import _ from "../icons/Action.js";
|
|
@@ -2,7 +2,7 @@ import "react/jsx-runtime";
|
|
|
2
2
|
import "../iconify-BBckr5AQ.js";
|
|
3
3
|
import "../useClueTypeConfig-DyeBcXQX.js";
|
|
4
4
|
import "../utils/loggerUtil.js";
|
|
5
|
-
import { C as l, a as s } from "../ClueEnrichContext-
|
|
5
|
+
import { C as l, a as s } from "../ClueEnrichContext-DJNjbXu_.js";
|
|
6
6
|
import "../debounce-DryYcbJ4.js";
|
|
7
7
|
import "../groupBy-BheQYl6f.js";
|
|
8
8
|
import "react";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
2
|
import "../components/AnnotationDetailPopover.js";
|
|
3
|
-
import { C as a, a as P } from "../AnnotationPreview-
|
|
3
|
+
import { C as a, a as P } from "../AnnotationPreview-D060vmy2.js";
|
|
4
4
|
import "../data/event.js";
|
|
5
5
|
import "../utils/window.js";
|
|
6
|
-
import "../AnnotationDetails-
|
|
6
|
+
import "../AnnotationDetails-BChWwaXw.js";
|
|
7
7
|
import "react";
|
|
8
8
|
import "../index-E7g8cRyW.js";
|
|
9
9
|
export {
|
package/hooks/ClueProvider.js
CHANGED
|
@@ -3,9 +3,9 @@ import { C as i } from "../ActionForm-myEAs2UC.js";
|
|
|
3
3
|
import { ClueComponentProvider as m } from "./ClueComponentContext.js";
|
|
4
4
|
import { ClueConfigProvider as n } from "./ClueConfigProvider.js";
|
|
5
5
|
import { ClueDatabaseProvider as t } from "./ClueDatabaseContext.js";
|
|
6
|
-
import { a as d } from "../ClueEnrichContext-
|
|
6
|
+
import { a as d } from "../ClueEnrichContext-DJNjbXu_.js";
|
|
7
7
|
import { ClueFetcherProvider as l } from "./ClueFetcherContext.js";
|
|
8
|
-
import { a as c } from "../AnnotationPreview-
|
|
8
|
+
import { a as c } from "../AnnotationPreview-D060vmy2.js";
|
|
9
9
|
const p = ({ children: o, ...e }) => /* @__PURE__ */ r(m, { ...e, children: /* @__PURE__ */ r(n, { config: e.config, children: /* @__PURE__ */ r(t, { ...e, children: /* @__PURE__ */ r(d, { ...e, children: /* @__PURE__ */ r(l, { ...e, children: /* @__PURE__ */ r(i, { ...e, children: /* @__PURE__ */ r(c, { children: o }) }) }) }) }) }) });
|
|
10
10
|
export {
|
|
11
11
|
p as ClueProvider
|
package/hooks/selectors.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as o } from "../ActionForm-myEAs2UC.js";
|
|
2
2
|
import { ClueComponentContext as r } from "./ClueComponentContext.js";
|
|
3
|
-
import { C as n } from "../ClueEnrichContext-
|
|
3
|
+
import { C as n } from "../ClueEnrichContext-DJNjbXu_.js";
|
|
4
4
|
import { ClueFetcherContext as u } from "./ClueFetcherContext.js";
|
|
5
5
|
import { u as t } from "../index-E7g8cRyW.js";
|
|
6
6
|
const i = (e) => t(u, e), p = (e) => t(o, e), x = (e) => t(n, e), f = (e) => t(r, e);
|
package/hooks/useAnnotations.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as p } from "../ClueEnrichContext-
|
|
1
|
+
import { b as p } from "../ClueEnrichContext-DJNjbXu_.js";
|
|
2
2
|
import { useContext as q, useMemo as g, useState as h, useEffect as a } from "react";
|
|
3
3
|
import { ClueDatabaseContext as A } from "./ClueDatabaseContext.js";
|
|
4
4
|
import { useClueEnrichSelector as c } from "./selectors.js";
|
package/hooks/useClue.js
CHANGED
package/icons/Action.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsx as e, jsxs as z } from "react/jsx-runtime";
|
|
|
2
2
|
import { I } from "../iconify-BBckr5AQ.js";
|
|
3
3
|
import { useTheme as j, Stack as i, Divider as l, Typography as C } from "@mui/material";
|
|
4
4
|
import R from "../components/CountBadge.js";
|
|
5
|
-
import { C as v } from "../AnnotationPreview-
|
|
5
|
+
import { C as v } from "../AnnotationPreview-D060vmy2.js";
|
|
6
6
|
import { u as B } from "../ActionForm-myEAs2UC.js";
|
|
7
7
|
import { g as D } from "../groupBy-BheQYl6f.js";
|
|
8
8
|
import { memo as L, useRef as A, useMemo as s, useEffect as O } from "react";
|
package/icons/Assessment.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsxs as b, jsx as s, Fragment as k } from "react/jsx-runtime";
|
|
|
2
2
|
import { I as l } from "../iconify-BBckr5AQ.js";
|
|
3
3
|
import { useTheme as j, Stack as y, Chip as I, Divider as q, Grid as C, Tooltip as A } from "@mui/material";
|
|
4
4
|
import z from "../components/CountBadge.js";
|
|
5
|
-
import { C as w } from "../AnnotationPreview-
|
|
5
|
+
import { C as w } from "../AnnotationPreview-D060vmy2.js";
|
|
6
6
|
import { g as O } from "../groupBy-BheQYl6f.js";
|
|
7
7
|
import { l as P } from "../last-7CdUxN0r.js";
|
|
8
8
|
import { m as L, s as R } from "../sortBy-ITdmD17L.js";
|
package/icons/Context.js
CHANGED
|
@@ -4,7 +4,7 @@ import { Stack as u, Divider as z } from "@mui/material";
|
|
|
4
4
|
import v from "../components/AnnotationEntry.js";
|
|
5
5
|
import E from "../components/CountBadge.js";
|
|
6
6
|
import M from "../components/display/icons/Iconified.js";
|
|
7
|
-
import { C as x } from "../AnnotationPreview-
|
|
7
|
+
import { C as x } from "../AnnotationPreview-D060vmy2.js";
|
|
8
8
|
import { g as O } from "../groupBy-BheQYl6f.js";
|
|
9
9
|
import { memo as j, useRef as k, useMemo as h, useEffect as B } from "react";
|
|
10
10
|
import { u as g } from "../index-E7g8cRyW.js";
|
package/icons/Opinion.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsxs as d, jsx as r, Fragment as $ } from "react/jsx-runtime";
|
|
|
2
2
|
import { I as u } from "../iconify-BBckr5AQ.js";
|
|
3
3
|
import { useTheme as B, Stack as x, Chip as v, Divider as O, Grid as y } from "@mui/material";
|
|
4
4
|
import k from "../components/CountBadge.js";
|
|
5
|
-
import { C as b } from "../AnnotationPreview-
|
|
5
|
+
import { C as b } from "../AnnotationPreview-D060vmy2.js";
|
|
6
6
|
import j from "../utils/chain.js";
|
|
7
7
|
import { g as q } from "../groupBy-BheQYl6f.js";
|
|
8
8
|
import { s as M } from "../sortBy-ITdmD17L.js";
|
package/main.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { A as t, u as r } from "./ActionForm-myEAs2UC.js";
|
|
2
2
|
import { default as f } from "./components/AnnotationDetailPopover.js";
|
|
3
|
-
import { A as n } from "./AnnotationDetails-
|
|
3
|
+
import { A as n } from "./AnnotationDetails-BChWwaXw.js";
|
|
4
4
|
import { default as p } from "./components/AnnotationEntry.js";
|
|
5
|
-
import { A as x, C as m } from "./AnnotationPreview-
|
|
5
|
+
import { A as x, C as m } from "./AnnotationPreview-D060vmy2.js";
|
|
6
6
|
import { default as d } from "./components/CountBadge.js";
|
|
7
7
|
import { default as c } from "./components/EnrichedCard.js";
|
|
8
8
|
import { default as h } from "./components/EnrichedChip.js";
|
|
@@ -18,7 +18,7 @@ import { b as w } from "./index-BXxfAxFt.js";
|
|
|
18
18
|
import { ClueComponentContext as O } from "./hooks/ClueComponentContext.js";
|
|
19
19
|
import { ClueConfigContext as V } from "./hooks/ClueConfigProvider.js";
|
|
20
20
|
import { ClueDatabaseContext as z } from "./hooks/ClueDatabaseContext.js";
|
|
21
|
-
import { C as J } from "./ClueEnrichContext-
|
|
21
|
+
import { C as J } from "./ClueEnrichContext-DJNjbXu_.js";
|
|
22
22
|
import { ClueProvider as M } from "./hooks/ClueProvider.js";
|
|
23
23
|
import { useClueActionsSelector as U, useClueEnrichSelector as W, useClueFetcherSelector as X } from "./hooks/selectors.js";
|
|
24
24
|
import { default as Z } from "./hooks/useClue.js";
|
package/package.json
CHANGED
|
@@ -1,414 +0,0 @@
|
|
|
1
|
-
import { jsx as vt } from "react/jsx-runtime";
|
|
2
|
-
import { a as xt } from "./iconify-BBckr5AQ.js";
|
|
3
|
-
import { u as Dt, a as Et, p as ot } from "./useClueTypeConfig-DyeBcXQX.js";
|
|
4
|
-
import { clueDebugLogger as G } from "./utils/loggerUtil.js";
|
|
5
|
-
import { b as It } from "./_baseSlice-M5RKzt1A.js";
|
|
6
|
-
import { t as Ct } from "./toFinite-BMy6GObD.js";
|
|
7
|
-
import { d as gt } from "./debounce-DryYcbJ4.js";
|
|
8
|
-
import { g as ct } from "./groupBy-BheQYl6f.js";
|
|
9
|
-
import { b as lt } from "./_baseUniq-tMFmk80M.js";
|
|
10
|
-
import { b as $t } from "./_baseIteratee-CP1bocOX.js";
|
|
11
|
-
import { useContext as Ot, useState as H, useMemo as K, useCallback as g, useRef as bt, useEffect as q } from "react";
|
|
12
|
-
import { c as jt } from "./index-E7g8cRyW.js";
|
|
13
|
-
import { ClueDatabaseContext as Pt } from "./hooks/ClueDatabaseContext.js";
|
|
14
|
-
import Mt from "./hooks/useClueConfig.js";
|
|
15
|
-
function qt(e) {
|
|
16
|
-
var s = Ct(e), p = s % 1;
|
|
17
|
-
return s === s ? p ? s - p : s : 0;
|
|
18
|
-
}
|
|
19
|
-
var At = Math.ceil, Bt = Math.max;
|
|
20
|
-
function Rt(e, s, p) {
|
|
21
|
-
s === void 0 ? s = 1 : s = Bt(qt(s), 0);
|
|
22
|
-
var l = e == null ? 0 : e.length;
|
|
23
|
-
if (!l || s < 1)
|
|
24
|
-
return [];
|
|
25
|
-
for (var h = 0, v = 0, O = Array(At(l / s)); h < l; )
|
|
26
|
-
O[v++] = It(e, h, h += s);
|
|
27
|
-
return O;
|
|
28
|
-
}
|
|
29
|
-
function at(e) {
|
|
30
|
-
return e && e.length ? lt(e) : [];
|
|
31
|
-
}
|
|
32
|
-
function Vt(e, s) {
|
|
33
|
-
return e && e.length ? lt(e, $t(s)) : [];
|
|
34
|
-
}
|
|
35
|
-
let J;
|
|
36
|
-
const Ut = new Uint8Array(16);
|
|
37
|
-
function Wt() {
|
|
38
|
-
if (!J && (J = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !J))
|
|
39
|
-
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
40
|
-
return J(Ut);
|
|
41
|
-
}
|
|
42
|
-
const d = [];
|
|
43
|
-
for (let e = 0; e < 256; ++e)
|
|
44
|
-
d.push((e + 256).toString(16).slice(1));
|
|
45
|
-
function Ft(e, s = 0) {
|
|
46
|
-
return d[e[s + 0]] + d[e[s + 1]] + d[e[s + 2]] + d[e[s + 3]] + "-" + d[e[s + 4]] + d[e[s + 5]] + "-" + d[e[s + 6]] + d[e[s + 7]] + "-" + d[e[s + 8]] + d[e[s + 9]] + "-" + d[e[s + 10]] + d[e[s + 11]] + d[e[s + 12]] + d[e[s + 13]] + d[e[s + 14]] + d[e[s + 15]];
|
|
47
|
-
}
|
|
48
|
-
const Ht = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), ut = {
|
|
49
|
-
randomUUID: Ht
|
|
50
|
-
};
|
|
51
|
-
function $(e, s, p) {
|
|
52
|
-
if (ut.randomUUID && !e)
|
|
53
|
-
return ut.randomUUID();
|
|
54
|
-
e = e || {};
|
|
55
|
-
const l = e.random || (e.rng || Wt)();
|
|
56
|
-
return l[6] = l[6] & 15 | 64, l[8] = l[8] & 63 | 128, Ft(l);
|
|
57
|
-
}
|
|
58
|
-
const Jt = jt(null), ee = ({
|
|
59
|
-
children: e,
|
|
60
|
-
classification: s,
|
|
61
|
-
baseURL: p,
|
|
62
|
-
getToken: l,
|
|
63
|
-
onNetworkCall: h,
|
|
64
|
-
pickSources: v,
|
|
65
|
-
chunkSize: O = 15,
|
|
66
|
-
maxRequestCount: Q = 4,
|
|
67
|
-
defaultTimeout: A = 5,
|
|
68
|
-
enabled: B = !0,
|
|
69
|
-
ready: ft = !1,
|
|
70
|
-
publicIconify: S = !0,
|
|
71
|
-
skipConfigCall: X = !1,
|
|
72
|
-
customIconify: R,
|
|
73
|
-
debugLogging: x = !0
|
|
74
|
-
}) => {
|
|
75
|
-
var st, nt, it, rt;
|
|
76
|
-
const I = Mt(), i = Ot(Pt), [Y, dt] = H(null), w = K(
|
|
77
|
-
() => {
|
|
78
|
-
var t, n;
|
|
79
|
-
return Y ?? s ?? ((n = (t = I.config) == null ? void 0 : t.c12nDef) == null ? void 0 : n.RESTRICTED);
|
|
80
|
-
},
|
|
81
|
-
[s, (nt = (st = I.config) == null ? void 0 : st.c12nDef) == null ? void 0 : nt.RESTRICTED, Y]
|
|
82
|
-
), Z = g(
|
|
83
|
-
(t) => {
|
|
84
|
-
var n;
|
|
85
|
-
return dt(t((n = I.config) == null ? void 0 : n.c12nDef));
|
|
86
|
-
},
|
|
87
|
-
[(it = I.config) == null ? void 0 : it.c12nDef]
|
|
88
|
-
), [C, pt] = H(ft), b = bt(0), [D, mt] = H([]), { availableSources: j, typesDetection: V } = Dt(
|
|
89
|
-
B && C,
|
|
90
|
-
p,
|
|
91
|
-
x,
|
|
92
|
-
l,
|
|
93
|
-
h
|
|
94
|
-
);
|
|
95
|
-
q(() => {
|
|
96
|
-
if (X || !B || !C)
|
|
97
|
-
return;
|
|
98
|
-
const t = {}, n = l == null ? void 0 : l();
|
|
99
|
-
n && (t.Authorization = `Bearer ${n}`);
|
|
100
|
-
let u = { baseURL: p, headers: t };
|
|
101
|
-
h && (u = h(u)), Et.configs.get(u).then(I.setConfig);
|
|
102
|
-
}, [p, h, X, C]);
|
|
103
|
-
const [z, N] = H(R);
|
|
104
|
-
q(() => {
|
|
105
|
-
R && N(R);
|
|
106
|
-
}, [R]), q(() => {
|
|
107
|
-
if (S)
|
|
108
|
-
return;
|
|
109
|
-
let t = z ?? void 0 ?? (p == null ? void 0 : p.replace(/^[^.]+/, "icons"));
|
|
110
|
-
!t && typeof window < "u" && window && !window.location.origin.includes("localhost") && (t = window.location.protocol + "//" + window.location.origin.replace(/^[^.]+/, "icons")), t && (G(`Using ${t} for iconify`, x), xt("", {
|
|
111
|
-
resources: [t]
|
|
112
|
-
}));
|
|
113
|
-
}, [p, z, x, S]);
|
|
114
|
-
const U = g(
|
|
115
|
-
async (t) => {
|
|
116
|
-
const n = [];
|
|
117
|
-
for (const c of t) {
|
|
118
|
-
const { latency: o, source: f, type: r, value: y, items: a, error: m } = c;
|
|
119
|
-
m && n.push({
|
|
120
|
-
id: $(),
|
|
121
|
-
source: f,
|
|
122
|
-
type: r,
|
|
123
|
-
value: y,
|
|
124
|
-
annotations: [],
|
|
125
|
-
classification: w,
|
|
126
|
-
latency: o,
|
|
127
|
-
count: 0,
|
|
128
|
-
error: m
|
|
129
|
-
});
|
|
130
|
-
for (const E of a) {
|
|
131
|
-
const { classification: P, count: M, link: F, annotations: yt } = E;
|
|
132
|
-
await i.selectors.find({ selector: { type: r, value: y, source: f, classification: P } }).incrementalRemove();
|
|
133
|
-
const _ = {
|
|
134
|
-
id: $(),
|
|
135
|
-
source: f,
|
|
136
|
-
type: r,
|
|
137
|
-
value: y,
|
|
138
|
-
annotations: yt,
|
|
139
|
-
classification: P,
|
|
140
|
-
latency: o,
|
|
141
|
-
count: M,
|
|
142
|
-
link: F,
|
|
143
|
-
error: m
|
|
144
|
-
};
|
|
145
|
-
n.some((wt) => wt.id === _.id) && (_.id = $()), n.push(_);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
const u = await i.selectors.bulkInsert(n);
|
|
149
|
-
u.error.length > 0 && (console.warn("Errors on upsert:"), u.error.forEach((c) => console.warn(c.documentId, c.validationErrors ?? c.status)));
|
|
150
|
-
},
|
|
151
|
-
[i, w]
|
|
152
|
-
), T = g(
|
|
153
|
-
async (t, n, u = {}) => {
|
|
154
|
-
var E, P;
|
|
155
|
-
if (!t || !n)
|
|
156
|
-
return console.error(`Type (${t}) or value (${n}) is empty, returning empty response`), {};
|
|
157
|
-
const c = (v == null ? void 0 : v(D, j, [{ type: t, value: n, classification: u.classification }])) ?? D, o = {
|
|
158
|
-
timeout: A,
|
|
159
|
-
force: !1,
|
|
160
|
-
includeRaw: !1,
|
|
161
|
-
noCache: !1,
|
|
162
|
-
classification: w,
|
|
163
|
-
sources: c,
|
|
164
|
-
...u
|
|
165
|
-
}, f = {}, r = l == null ? void 0 : l();
|
|
166
|
-
r && (f.Authorization = `Bearer ${r}`);
|
|
167
|
-
let y = { baseURL: p, headers: f };
|
|
168
|
-
h && (y = h(y));
|
|
169
|
-
const a = {
|
|
170
|
-
type: t,
|
|
171
|
-
value: n,
|
|
172
|
-
classification: o.classification
|
|
173
|
-
};
|
|
174
|
-
let m = await ((E = i.status) == null ? void 0 : E.findOne({ selector: { ...a } }).exec());
|
|
175
|
-
m ? await m.incrementalPatch({ status: "in-progress" }) : m = await ((P = i.status) == null ? void 0 : P.insert({
|
|
176
|
-
id: $(),
|
|
177
|
-
type: a.type,
|
|
178
|
-
value: a.value,
|
|
179
|
-
classification: a.classification ?? w,
|
|
180
|
-
status: "in-progress"
|
|
181
|
-
}));
|
|
182
|
-
try {
|
|
183
|
-
const M = await ot([a], o.sources, o, y), F = Object.values(Object.values(M)[0])[0];
|
|
184
|
-
return await U(Object.values(F)), F;
|
|
185
|
-
} catch (M) {
|
|
186
|
-
return console.error(M), {};
|
|
187
|
-
} finally {
|
|
188
|
-
await (m == null ? void 0 : m.incrementalPatch({ status: "complete" }));
|
|
189
|
-
}
|
|
190
|
-
},
|
|
191
|
-
[
|
|
192
|
-
U,
|
|
193
|
-
j,
|
|
194
|
-
p,
|
|
195
|
-
i,
|
|
196
|
-
w,
|
|
197
|
-
A,
|
|
198
|
-
l,
|
|
199
|
-
h,
|
|
200
|
-
v,
|
|
201
|
-
D
|
|
202
|
-
]
|
|
203
|
-
), W = g(
|
|
204
|
-
async (t, n) => {
|
|
205
|
-
const u = (v == null ? void 0 : v(D, j, t)) ?? D, c = {
|
|
206
|
-
timeout: A,
|
|
207
|
-
includeRaw: !1,
|
|
208
|
-
noCache: !1,
|
|
209
|
-
classification: w,
|
|
210
|
-
sources: u,
|
|
211
|
-
...n
|
|
212
|
-
}, o = {}, f = l == null ? void 0 : l();
|
|
213
|
-
f && (o.Authorization = `Bearer ${f}`);
|
|
214
|
-
let r = { baseURL: p, headers: o };
|
|
215
|
-
h && (r = h(r));
|
|
216
|
-
const y = [];
|
|
217
|
-
for (const a of t) {
|
|
218
|
-
const m = { type: a.type, value: a.value, classification: c.classification };
|
|
219
|
-
let E = await i.status.findOne({
|
|
220
|
-
selector: m
|
|
221
|
-
}).incrementalPatch({
|
|
222
|
-
status: "in-progress"
|
|
223
|
-
});
|
|
224
|
-
E || (E = await i.status.insert({
|
|
225
|
-
id: $(),
|
|
226
|
-
...m,
|
|
227
|
-
status: "in-progress",
|
|
228
|
-
sources: c.sources
|
|
229
|
-
})), y.push(E.toMutableJSON());
|
|
230
|
-
}
|
|
231
|
-
try {
|
|
232
|
-
const a = await ot(t, c.sources, c, r), m = Object.values(a).flatMap(Object.values).flatMap(Object.values);
|
|
233
|
-
return await U(m), a;
|
|
234
|
-
} catch (a) {
|
|
235
|
-
return console.error(a), {};
|
|
236
|
-
} finally {
|
|
237
|
-
i.status.bulkUpsert(
|
|
238
|
-
Vt(y, (a) => a.id).map((a) => (a.status = "complete", a))
|
|
239
|
-
);
|
|
240
|
-
}
|
|
241
|
-
},
|
|
242
|
-
[
|
|
243
|
-
v,
|
|
244
|
-
D,
|
|
245
|
-
j,
|
|
246
|
-
A,
|
|
247
|
-
w,
|
|
248
|
-
l,
|
|
249
|
-
p,
|
|
250
|
-
h,
|
|
251
|
-
i,
|
|
252
|
-
U
|
|
253
|
-
]
|
|
254
|
-
), L = g(async () => {
|
|
255
|
-
const t = await i.selectors.find({ selector: { error: { $exists: !0 } } }).exec(), n = ct(t, "classification"), u = [];
|
|
256
|
-
for (const [c, o] of Object.entries(n)) {
|
|
257
|
-
const f = ct(o, (r) => `${r.type}:${r.value}`);
|
|
258
|
-
Object.values(f).forEach((r) => {
|
|
259
|
-
u.push({
|
|
260
|
-
id: $(),
|
|
261
|
-
type: r[0].type,
|
|
262
|
-
value: r[0].value,
|
|
263
|
-
classification: c,
|
|
264
|
-
sources: at(r.map((y) => y.source)).sort(),
|
|
265
|
-
status: "pending"
|
|
266
|
-
});
|
|
267
|
-
});
|
|
268
|
-
}
|
|
269
|
-
await i.status.bulkInsert(u), await i.selectors.bulkRemove(t);
|
|
270
|
-
}, [i]), k = K(
|
|
271
|
-
() => gt(
|
|
272
|
-
async () => {
|
|
273
|
-
if (i != null && i.status) {
|
|
274
|
-
if (i.status.closed) {
|
|
275
|
-
console.warn("Status database is closed, will not enrich");
|
|
276
|
-
return;
|
|
277
|
-
}
|
|
278
|
-
} else return;
|
|
279
|
-
const t = await i.status.find({ selector: { status: "pending" } }).update({ $set: { status: "in-progress" } });
|
|
280
|
-
if (t.length < 1)
|
|
281
|
-
return;
|
|
282
|
-
const n = Rt(t, O);
|
|
283
|
-
G(
|
|
284
|
-
`Enriching ${t.length} selectors in ${n.length} chunks of ${O}.`,
|
|
285
|
-
x
|
|
286
|
-
), await Promise.all(
|
|
287
|
-
// For performance reasons, we chunk the requests. This will allow us to take advantage of parellelization in the
|
|
288
|
-
// backend, both on the pod level and kubernetes level
|
|
289
|
-
n.map(async (u) => {
|
|
290
|
-
let c = null;
|
|
291
|
-
if (b.current <= Q)
|
|
292
|
-
b.current += 1;
|
|
293
|
-
else {
|
|
294
|
-
let o = Date.now();
|
|
295
|
-
await new Promise((f) => {
|
|
296
|
-
c = setInterval(() => {
|
|
297
|
-
G(
|
|
298
|
-
`Waiting on ${b.current} existing requests to complete (total delay: ${Date.now() - o}ms)`,
|
|
299
|
-
x
|
|
300
|
-
), b.current < Q && f();
|
|
301
|
-
}, 400);
|
|
302
|
-
}).finally(() => {
|
|
303
|
-
b.current += 1, clearInterval(c);
|
|
304
|
-
});
|
|
305
|
-
}
|
|
306
|
-
try {
|
|
307
|
-
const o = {}, f = at(u.flatMap((r) => r.sources ?? []));
|
|
308
|
-
f.length > 0 && (o.sources = f), await W(
|
|
309
|
-
u.map((r) => r.toSelector()),
|
|
310
|
-
o
|
|
311
|
-
), await i.status.findByIds(u.map((r) => r.id)).update({ $set: { status: "complete" } });
|
|
312
|
-
} catch (o) {
|
|
313
|
-
console.error(o);
|
|
314
|
-
} finally {
|
|
315
|
-
b.current -= 1, c && clearInterval(c);
|
|
316
|
-
}
|
|
317
|
-
})
|
|
318
|
-
);
|
|
319
|
-
},
|
|
320
|
-
200,
|
|
321
|
-
{ maxWait: 500, leading: !1 }
|
|
322
|
-
),
|
|
323
|
-
[W, O, i, x, Q]
|
|
324
|
-
);
|
|
325
|
-
q(() => {
|
|
326
|
-
}, [i, x]), q(() => {
|
|
327
|
-
if (!B || !C || !(i != null && i.status))
|
|
328
|
-
return;
|
|
329
|
-
const t = i.status.find({
|
|
330
|
-
selector: {
|
|
331
|
-
status: "pending"
|
|
332
|
-
}
|
|
333
|
-
}).$.subscribe(() => k());
|
|
334
|
-
return () => {
|
|
335
|
-
try {
|
|
336
|
-
t == null || t.unsubscribe();
|
|
337
|
-
} catch (n) {
|
|
338
|
-
console.warn(n);
|
|
339
|
-
}
|
|
340
|
-
};
|
|
341
|
-
}, [B, C, i, x, k]);
|
|
342
|
-
const tt = g(
|
|
343
|
-
async (t, n, u) => {
|
|
344
|
-
if (!t)
|
|
345
|
-
throw new Error("Type cannot be null");
|
|
346
|
-
if (!n)
|
|
347
|
-
throw new Error("Value cannot be null");
|
|
348
|
-
const c = { type: t, value: n, classification: u ?? w };
|
|
349
|
-
let o = await i.status.findOne({
|
|
350
|
-
selector: c
|
|
351
|
-
}).exec();
|
|
352
|
-
return o || (o = await i.status.queueInsert({
|
|
353
|
-
id: $(),
|
|
354
|
-
...c,
|
|
355
|
-
status: "pending"
|
|
356
|
-
})), o;
|
|
357
|
-
},
|
|
358
|
-
[w, i]
|
|
359
|
-
), et = g(
|
|
360
|
-
(t) => {
|
|
361
|
-
var f, r;
|
|
362
|
-
if (!t)
|
|
363
|
-
return null;
|
|
364
|
-
const n = Object.entries(V), u = (f = n.find(([y, a]) => a.exec(t))) == null ? void 0 : f[0];
|
|
365
|
-
if (u)
|
|
366
|
-
return u;
|
|
367
|
-
const c = t.toLowerCase(), o = (r = n.find(([y, a]) => a.exec(c))) == null ? void 0 : r[0];
|
|
368
|
-
return o || null;
|
|
369
|
-
},
|
|
370
|
-
[V]
|
|
371
|
-
), ht = K(
|
|
372
|
-
() => {
|
|
373
|
-
var t;
|
|
374
|
-
return {
|
|
375
|
-
bulkEnrich: W,
|
|
376
|
-
enrich: T,
|
|
377
|
-
enrichFailedEnrichments: L,
|
|
378
|
-
sources: D,
|
|
379
|
-
setSources: mt,
|
|
380
|
-
typesDetection: V,
|
|
381
|
-
availableSources: j,
|
|
382
|
-
guessType: et,
|
|
383
|
-
queueEnrich: tt,
|
|
384
|
-
setCustomIconify: N,
|
|
385
|
-
setDefaultClassification: Z,
|
|
386
|
-
setReady: pt,
|
|
387
|
-
defaultClassification: w,
|
|
388
|
-
ready: C && !!i && !!((t = I.config) != null && t.c12nDef)
|
|
389
|
-
};
|
|
390
|
-
},
|
|
391
|
-
[
|
|
392
|
-
W,
|
|
393
|
-
T,
|
|
394
|
-
L,
|
|
395
|
-
D,
|
|
396
|
-
V,
|
|
397
|
-
j,
|
|
398
|
-
et,
|
|
399
|
-
tt,
|
|
400
|
-
Z,
|
|
401
|
-
w,
|
|
402
|
-
C,
|
|
403
|
-
i,
|
|
404
|
-
(rt = I.config) == null ? void 0 : rt.c12nDef
|
|
405
|
-
]
|
|
406
|
-
);
|
|
407
|
-
return /* @__PURE__ */ vt(Jt.Provider, { value: ht, children: e });
|
|
408
|
-
};
|
|
409
|
-
export {
|
|
410
|
-
Jt as C,
|
|
411
|
-
ee as a,
|
|
412
|
-
Vt as b,
|
|
413
|
-
at as u
|
|
414
|
-
};
|