@sinequa/atomic 1.0.1 → 1.1.3
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/README.md +219 -219
- package/dist/atomic.js +653 -528
- package/dist/atomic.umd.cjs +1 -1
- package/dist/authentication/index.d.ts +1 -1
- package/dist/authentication/index.d.ts.map +1 -1
- package/dist/authentication/session/index.d.ts +1 -1
- package/dist/authentication/session/index.d.ts.map +1 -1
- package/dist/authentication/session/login.d.ts.map +1 -1
- package/dist/authentication/session/logout.d.ts +7 -3
- package/dist/authentication/session/logout.d.ts.map +1 -1
- package/dist/authentication/tokens/delete-web-token-cookie.d.ts +1 -0
- package/dist/authentication/tokens/delete-web-token-cookie.d.ts.map +1 -1
- package/dist/authentication/tokens/get-csrf-token.d.ts +5 -4
- package/dist/authentication/tokens/get-csrf-token.d.ts.map +1 -1
- package/dist/helpers/filters.d.ts +82 -0
- package/dist/helpers/filters.d.ts.map +1 -0
- package/dist/helpers/index.d.ts +1 -0
- package/dist/helpers/index.d.ts.map +1 -1
- package/dist/types/interfaces/Query.d.ts +11 -3
- package/dist/types/interfaces/Query.d.ts.map +1 -1
- package/dist/utils/to-sql.d.ts +21 -0
- package/dist/utils/to-sql.d.ts.map +1 -1
- package/dist/web-api/helpers/handle-response.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/atomic.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function
|
|
1
|
+
function w(e) {
|
|
2
2
|
if (typeof CustomEvent > "u" || typeof dispatchEvent > "u")
|
|
3
3
|
return;
|
|
4
4
|
const t = new CustomEvent("authenticated", {
|
|
@@ -15,82 +15,82 @@ const u = {
|
|
|
15
15
|
function k(e) {
|
|
16
16
|
Object.assign(u, e);
|
|
17
17
|
}
|
|
18
|
-
const
|
|
19
|
-
function
|
|
20
|
-
return !e?.items || e?.items?.length === 0 ? [] : e.items.reduce((
|
|
21
|
-
if (!
|
|
22
|
-
const s =
|
|
23
|
-
return
|
|
18
|
+
const ce = /.*\:\(?([><=\d\-\.AND ]+)\)?/;
|
|
19
|
+
function ut(e, t) {
|
|
20
|
+
return !e?.items || e?.items?.length === 0 ? [] : e.items.reduce((o, a) => {
|
|
21
|
+
if (!a.value || a.value === "") return o;
|
|
22
|
+
const s = le(a, e.column);
|
|
23
|
+
return o.push({
|
|
24
24
|
operator: s.operator,
|
|
25
25
|
value: s.value,
|
|
26
|
-
display:
|
|
26
|
+
display: a.display || s.display,
|
|
27
27
|
filters: s.filters,
|
|
28
|
-
disabled:
|
|
29
|
-
hidden:
|
|
30
|
-
}),
|
|
28
|
+
disabled: a.count === 0,
|
|
29
|
+
hidden: a.count === 0 && e.isDistribution ? !t : !1
|
|
30
|
+
}), o;
|
|
31
31
|
}, []);
|
|
32
32
|
}
|
|
33
|
-
function
|
|
34
|
-
const r = t, n = e.value.match(
|
|
33
|
+
function le(e, t) {
|
|
34
|
+
const r = t, n = e.value.match(ce);
|
|
35
35
|
if (n?.[1]) {
|
|
36
|
-
const
|
|
36
|
+
const a = (n?.[1].split(" AND ")).map((s) => {
|
|
37
37
|
const i = s.indexOf(">=") !== -1 ? "gte" : "lt";
|
|
38
38
|
let c = s.substring(s.indexOf(" ") + 1);
|
|
39
39
|
return { field: r, operator: i, value: c, display: e.display || e.value };
|
|
40
40
|
});
|
|
41
|
-
if (
|
|
42
|
-
return { field: r, operator: "and", filters:
|
|
43
|
-
if (
|
|
44
|
-
return { ...
|
|
41
|
+
if (a.length === 2)
|
|
42
|
+
return { field: r, operator: "and", filters: a, value: e.value, display: a[0].display || a[0].value };
|
|
43
|
+
if (a.length === 1)
|
|
44
|
+
return { ...a[0], field: r };
|
|
45
45
|
throw new Error("Failed to parse distribution expression");
|
|
46
46
|
}
|
|
47
47
|
return { field: r, operator: "eq", value: e.value, display: e.display };
|
|
48
48
|
}
|
|
49
|
-
function
|
|
49
|
+
function dt(e, t, r) {
|
|
50
50
|
return e.valuesAreExpressions ? t.display === r.display : t.value === r.value;
|
|
51
51
|
}
|
|
52
|
-
function
|
|
53
|
-
return e.items && (e.items = e.items.map((t) =>
|
|
52
|
+
function ue(e) {
|
|
53
|
+
return e.items && (e.items = e.items.map((t) => ue(t))), e.items && e.items.some((t) => t.$selected || t.$opened) && (e.$opened = !0), e;
|
|
54
54
|
}
|
|
55
|
-
function
|
|
55
|
+
function ft(e, t) {
|
|
56
56
|
const r = [];
|
|
57
57
|
if (e.length > 0) {
|
|
58
|
-
const n = /* @__PURE__ */ new Map(),
|
|
58
|
+
const n = /* @__PURE__ */ new Map(), a = t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&").normalize("NFD").replace(/[\u0300-\u036f]/g, ""), s = new RegExp("\\b" + a, "i");
|
|
59
59
|
e.forEach((i) => {
|
|
60
60
|
if (i.display.length > 1) {
|
|
61
61
|
const c = i.display.normalize("NFD").replace(/[\u0300-\u036f]/g, ""), d = s.exec(c);
|
|
62
|
-
|
|
62
|
+
ee(r, n, "/", i.display, +(i.frequency || 0), 1, (d?.index || 0) + t.length);
|
|
63
63
|
}
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
66
|
return r;
|
|
67
67
|
}
|
|
68
|
-
function
|
|
68
|
+
function ee(e, t, r, n, o, a, s) {
|
|
69
69
|
const i = n.indexOf("/", r.length), c = n.substring(0, i + 1);
|
|
70
70
|
let d = t.get(c);
|
|
71
71
|
if (!d) {
|
|
72
72
|
const _ = c.replace(/^\/|\/$/g, "");
|
|
73
73
|
d = {
|
|
74
74
|
value: n.substring(r.length, i),
|
|
75
|
-
count:
|
|
75
|
+
count: o,
|
|
76
76
|
items: [],
|
|
77
77
|
hasChildren: !1,
|
|
78
|
-
$level:
|
|
78
|
+
$level: a,
|
|
79
79
|
$opened: s >= c.length,
|
|
80
80
|
$path: _
|
|
81
81
|
}, t.set(c, d), e.push(d);
|
|
82
82
|
}
|
|
83
|
-
c.length < n.length && (d.hasChildren = !0,
|
|
83
|
+
c.length < n.length && (d.hasChildren = !0, ee(d.items, t, c, n, o, a + 1, s));
|
|
84
84
|
}
|
|
85
|
-
function
|
|
85
|
+
function ht(e, t) {
|
|
86
86
|
return e.reduce((r, n) => (t(n) ? r.true.push(n) : r.false.push(n), r), { true: [], false: [] });
|
|
87
87
|
}
|
|
88
|
-
const
|
|
88
|
+
const de = /(([\+\-])?\(([^\)]+)\))|(([\+\-])?\[([^\]]+)\])|(([\+\-])?\"([^\"]+)\")|(([\+\-])?\/([^\/]+)\/)|(([\+\-])?(\S+))/g, fe = 2, M = 3, he = 5, X = 6, ge = 8, Y = 9, pe = 11, K = 12, me = 14, Z = 15;
|
|
89
89
|
function A(e) {
|
|
90
90
|
if (!e) return [];
|
|
91
|
-
const t = [], r = e.matchAll(
|
|
91
|
+
const t = [], r = e.matchAll(de);
|
|
92
92
|
for (let n of r)
|
|
93
|
-
n[M] ? t.push({ type: "group", value: n[M], op: n[
|
|
93
|
+
n[M] ? t.push({ type: "group", value: n[M], op: n[fe] }) : n[X] ? t.push({ type: "adjacent", value: n[X], op: n[he] }) : n[Y] ? t.push({ type: "exact", value: n[Y], op: n[ge] }) : n[K] ? t.push({ type: "regex", value: n[K], op: n[pe] }) : n[Z] && t.push({ type: "token", value: n[Z], op: n[me] });
|
|
94
94
|
return t;
|
|
95
95
|
}
|
|
96
96
|
function G(e) {
|
|
@@ -110,66 +110,66 @@ function G(e) {
|
|
|
110
110
|
}
|
|
111
111
|
}).join(" ");
|
|
112
112
|
}
|
|
113
|
-
function
|
|
113
|
+
function gt(e, t, r) {
|
|
114
114
|
let n = A(e);
|
|
115
|
-
for (let
|
|
116
|
-
n.push({ type: "adjacent", value:
|
|
115
|
+
for (let o of t)
|
|
116
|
+
n.push({ type: "adjacent", value: o, op: r });
|
|
117
117
|
return G(n);
|
|
118
118
|
}
|
|
119
|
-
function
|
|
120
|
-
const r = A(t), n = r.findIndex((
|
|
119
|
+
function pt(e, t) {
|
|
120
|
+
const r = A(t), n = r.findIndex((o) => o.value === e);
|
|
121
121
|
return n !== -1 ? (r.splice(n, 1), t = G(r)) : t;
|
|
122
122
|
}
|
|
123
|
-
function
|
|
123
|
+
function mt(e) {
|
|
124
124
|
const t = A(e).filter((r) => r.type !== "adjacent");
|
|
125
125
|
return G(t);
|
|
126
126
|
}
|
|
127
|
-
function
|
|
127
|
+
function wt(e) {
|
|
128
128
|
return A(e).filter((t) => t.type === "adjacent").map((t) => t.value);
|
|
129
129
|
}
|
|
130
|
-
function
|
|
131
|
-
const n = new Intl.RelativeTimeFormat(e, { numeric: "auto" }), { offset:
|
|
132
|
-
return n.format(
|
|
130
|
+
function _t(e, t, r) {
|
|
131
|
+
const n = new Intl.RelativeTimeFormat(e, { numeric: "auto" }), { offset: o, unit: a, isFuture: s } = we(t, r);
|
|
132
|
+
return n.format(o * (s ? 1 : -1), a);
|
|
133
133
|
}
|
|
134
|
-
function
|
|
135
|
-
const r = new Date(e), n = t ? new Date(t) : /* @__PURE__ */ new Date(),
|
|
134
|
+
function we(e, t) {
|
|
135
|
+
const r = new Date(e), n = t ? new Date(t) : /* @__PURE__ */ new Date(), o = Math.abs(n.getTime() - r.getTime());
|
|
136
136
|
return {
|
|
137
|
-
offset: Math.floor(
|
|
137
|
+
offset: Math.floor(o / (1e3 * 60 * 60 * 24)),
|
|
138
138
|
unit: "day",
|
|
139
139
|
isFuture: r > n
|
|
140
140
|
};
|
|
141
141
|
}
|
|
142
|
-
function
|
|
142
|
+
function St(e) {
|
|
143
143
|
const t = e.target;
|
|
144
144
|
return t && t.nodeName !== "INPUT" && t.nodeName !== "TEXTAREA";
|
|
145
145
|
}
|
|
146
|
-
function
|
|
146
|
+
function kt(e) {
|
|
147
147
|
if (e === void 0) return;
|
|
148
|
-
const { q: t, f: r, p: n, s:
|
|
148
|
+
const { q: t, f: r, p: n, s: o, t: a, n: s, b: i } = y(e), [c] = e.split("?");
|
|
149
149
|
return {
|
|
150
150
|
path: c,
|
|
151
151
|
text: t,
|
|
152
|
-
filters: r ?
|
|
152
|
+
filters: r ? te(r) : void 0,
|
|
153
153
|
page: n ? parseInt(n, 10) : void 0,
|
|
154
|
-
sort:
|
|
155
|
-
tab:
|
|
154
|
+
sort: o,
|
|
155
|
+
tab: a,
|
|
156
156
|
name: s,
|
|
157
157
|
basket: i
|
|
158
158
|
};
|
|
159
159
|
}
|
|
160
|
-
function
|
|
160
|
+
function bt(e) {
|
|
161
161
|
if (!e) return "";
|
|
162
|
-
const { text: t, filters: r, page: n, sort:
|
|
163
|
-
t && (c.q = t), r && (c.f = JSON.stringify(r)), n && (c.p = n.toString()),
|
|
162
|
+
const { text: t, filters: r, page: n, sort: o, tab: a, name: s, basket: i } = e, c = {};
|
|
163
|
+
t && (c.q = t), r && (c.f = JSON.stringify(r)), n && (c.p = n.toString()), o && (c.s = o), a && (c.t = a), s && (c.n = s), i && (c.b = i);
|
|
164
164
|
const d = new URLSearchParams(c).toString();
|
|
165
165
|
return d || "";
|
|
166
166
|
}
|
|
167
|
-
function
|
|
167
|
+
function vt(e) {
|
|
168
168
|
if (e === void 0) return [];
|
|
169
|
-
const { f: t } =
|
|
170
|
-
return
|
|
169
|
+
const { f: t } = y(e);
|
|
170
|
+
return te(t);
|
|
171
171
|
}
|
|
172
|
-
function
|
|
172
|
+
function te(e) {
|
|
173
173
|
const t = decodeURIComponent(e);
|
|
174
174
|
try {
|
|
175
175
|
return JSON.parse(t ?? "[]");
|
|
@@ -177,55 +177,55 @@ function ee(e) {
|
|
|
177
177
|
return console.error(`Error parsing filters from URI: ${e}`), [];
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
|
-
function
|
|
180
|
+
function y(e) {
|
|
181
181
|
const t = e.split("?")[1];
|
|
182
182
|
if (t === void 0) return {};
|
|
183
183
|
const r = new URLSearchParams(t);
|
|
184
184
|
return Object.fromEntries(r);
|
|
185
185
|
}
|
|
186
|
-
function
|
|
187
|
-
const { q: t = "" } =
|
|
186
|
+
function Ct(e) {
|
|
187
|
+
const { q: t = "" } = y(e);
|
|
188
188
|
return t;
|
|
189
189
|
}
|
|
190
|
-
function
|
|
191
|
-
const { id: t } =
|
|
190
|
+
function Rt(e) {
|
|
191
|
+
const { id: t } = y(e);
|
|
192
192
|
return decodeURIComponent(t);
|
|
193
193
|
}
|
|
194
|
-
function
|
|
195
|
-
const { p: t = "0" } =
|
|
194
|
+
function Pt(e) {
|
|
195
|
+
const { p: t = "0" } = y(e);
|
|
196
196
|
return parseInt(t, 10);
|
|
197
197
|
}
|
|
198
|
-
function
|
|
199
|
-
const { t } =
|
|
198
|
+
function yt(e) {
|
|
199
|
+
const { t } = y(e);
|
|
200
200
|
return t;
|
|
201
201
|
}
|
|
202
|
-
function
|
|
202
|
+
function xt(e, t) {
|
|
203
203
|
if (!e)
|
|
204
204
|
return e;
|
|
205
205
|
let r = 0;
|
|
206
206
|
const n = e.length;
|
|
207
|
-
let
|
|
208
|
-
if (e[
|
|
209
|
-
for (;
|
|
210
|
-
|
|
211
|
-
e[
|
|
207
|
+
let o = 0;
|
|
208
|
+
if (e[o] === "[") {
|
|
209
|
+
for (; o < n && /[0-9]/.test(e[o]); )
|
|
210
|
+
o++;
|
|
211
|
+
e[o] === "]" && (r = o + 1);
|
|
212
212
|
}
|
|
213
|
-
const
|
|
214
|
-
if (!
|
|
213
|
+
const a = F(e, r, !1);
|
|
214
|
+
if (!a)
|
|
215
215
|
return e;
|
|
216
216
|
const s = t.charCodeAt(0), i = t.charCodeAt(1);
|
|
217
|
-
let c =
|
|
217
|
+
let c = a;
|
|
218
218
|
for (; c; )
|
|
219
219
|
if (s === c.lang1 && i === c.lang2) {
|
|
220
|
-
const _ =
|
|
220
|
+
const _ = F(e, c.end + 4, !0);
|
|
221
221
|
return e.substring(_.start, _.end);
|
|
222
222
|
} else
|
|
223
|
-
c =
|
|
224
|
-
const d = e.substring(
|
|
223
|
+
c = F(e, c.end + 4, !1);
|
|
224
|
+
const d = e.substring(a.start, a.end);
|
|
225
225
|
return d || e;
|
|
226
226
|
}
|
|
227
|
-
function
|
|
228
|
-
for (let n = t,
|
|
227
|
+
function F(e, t, r) {
|
|
228
|
+
for (let n = t, o = e.length - 3; n < o; n++)
|
|
229
229
|
if (e[n] === "[" && e[n + 3] === "]")
|
|
230
230
|
return {
|
|
231
231
|
start: t,
|
|
@@ -241,11 +241,11 @@ function q(e, t, r) {
|
|
|
241
241
|
lang2: -1
|
|
242
242
|
};
|
|
243
243
|
}
|
|
244
|
-
function
|
|
245
|
-
const { useLocale: r, useLocaleAsPrefix: n, indexFile:
|
|
246
|
-
return [
|
|
244
|
+
function Lt(e, t) {
|
|
245
|
+
const { useLocale: r, useLocaleAsPrefix: n, indexFile: o, path: a, folder: s } = t, i = r ? `${e}/` : null, c = n ? `${e}.${o}` : o ?? "";
|
|
246
|
+
return [a, s, `${i || ""}${c}`].filter((d) => d !== void 0).join("/");
|
|
247
247
|
}
|
|
248
|
-
function
|
|
248
|
+
function $(e) {
|
|
249
249
|
const t = new CustomEvent("notification", {
|
|
250
250
|
bubbles: !0,
|
|
251
251
|
cancelable: !1,
|
|
@@ -253,80 +253,80 @@ function U(e) {
|
|
|
253
253
|
});
|
|
254
254
|
dispatchEvent(t);
|
|
255
255
|
}
|
|
256
|
-
const
|
|
256
|
+
const Ot = {
|
|
257
257
|
success: (e, t) => {
|
|
258
|
-
|
|
258
|
+
$({
|
|
259
259
|
type: "success",
|
|
260
260
|
message: e,
|
|
261
261
|
options: t
|
|
262
262
|
});
|
|
263
263
|
},
|
|
264
264
|
info: (e, t) => {
|
|
265
|
-
|
|
265
|
+
$({
|
|
266
266
|
type: "info",
|
|
267
267
|
message: e,
|
|
268
268
|
options: t
|
|
269
269
|
});
|
|
270
270
|
},
|
|
271
271
|
warning: (e, t) => {
|
|
272
|
-
|
|
272
|
+
$({
|
|
273
273
|
type: "warning",
|
|
274
274
|
message: e,
|
|
275
275
|
options: t
|
|
276
276
|
});
|
|
277
277
|
},
|
|
278
278
|
error: (e, t) => {
|
|
279
|
-
|
|
279
|
+
$({
|
|
280
280
|
type: "error",
|
|
281
281
|
message: e,
|
|
282
282
|
options: t
|
|
283
283
|
});
|
|
284
284
|
}
|
|
285
285
|
};
|
|
286
|
-
var
|
|
287
|
-
let
|
|
286
|
+
var re = /* @__PURE__ */ ((e) => (e[e.DEBUG = 0] = "DEBUG", e[e.INFO = 1] = "INFO", e[e.WARN = 2] = "WARN", e[e.ERROR = 3] = "ERROR", e[e.NONE = 4] = "NONE", e))(re || {});
|
|
287
|
+
let U = {
|
|
288
288
|
level: 1,
|
|
289
289
|
enableConsoleOutput: !0
|
|
290
290
|
};
|
|
291
|
-
function
|
|
292
|
-
|
|
291
|
+
function $t(e) {
|
|
292
|
+
U = { ...U, ...e };
|
|
293
293
|
}
|
|
294
294
|
function N(e, t, r) {
|
|
295
|
-
if (e <
|
|
296
|
-
const
|
|
297
|
-
if (
|
|
295
|
+
if (e < U.level) return;
|
|
296
|
+
const o = `${`[${re[e]}]`} ${t}`;
|
|
297
|
+
if (U.enableConsoleOutput)
|
|
298
298
|
switch (e) {
|
|
299
299
|
case 0:
|
|
300
|
-
console.debug(
|
|
300
|
+
console.debug(o, r || "");
|
|
301
301
|
break;
|
|
302
302
|
case 1:
|
|
303
|
-
console.info(
|
|
303
|
+
console.info(o, r || "");
|
|
304
304
|
break;
|
|
305
305
|
case 2:
|
|
306
|
-
console.warn(
|
|
306
|
+
console.warn(o, r || "");
|
|
307
307
|
break;
|
|
308
308
|
case 3:
|
|
309
|
-
console.error(
|
|
309
|
+
console.error(o, r || "");
|
|
310
310
|
break;
|
|
311
311
|
}
|
|
312
312
|
}
|
|
313
|
-
function
|
|
313
|
+
function x(e, t) {
|
|
314
314
|
N(0, e, t);
|
|
315
315
|
}
|
|
316
316
|
function S(e, t) {
|
|
317
317
|
N(1, e, t);
|
|
318
318
|
}
|
|
319
|
-
function
|
|
319
|
+
function D(e, t) {
|
|
320
320
|
N(2, e, t);
|
|
321
321
|
}
|
|
322
322
|
function f(e, t) {
|
|
323
323
|
N(3, e, t);
|
|
324
324
|
}
|
|
325
|
-
function
|
|
325
|
+
function L(e) {
|
|
326
326
|
const t = W(), r = new Headers(e);
|
|
327
327
|
r.append("Sinequa-Force-Camel-Case", "true"), r.append("accept", "application/json"), t && r.append("Sinequa-csrf-token", t);
|
|
328
|
-
const { userOverride: n, userOverrideActive:
|
|
329
|
-
return
|
|
328
|
+
const { userOverride: n, userOverrideActive: o, bearerToken: a } = u;
|
|
329
|
+
return a && r.append("Authorization", `Bearer ${a}`), n && o && (r.append("sinequa-override-user", n.username), r.append("sinequa-override-domain", n.domain)), r;
|
|
330
330
|
}
|
|
331
331
|
class R extends Error {
|
|
332
332
|
status;
|
|
@@ -339,7 +339,7 @@ class E extends R {
|
|
|
339
339
|
super(t, 500), this.name = "ServerError";
|
|
340
340
|
}
|
|
341
341
|
}
|
|
342
|
-
class
|
|
342
|
+
class _e extends R {
|
|
343
343
|
constructor(t = "Request timed out") {
|
|
344
344
|
super(t, 408), this.name = "TimeoutError";
|
|
345
345
|
}
|
|
@@ -363,13 +363,22 @@ async function P(e, t = "json") {
|
|
|
363
363
|
return await e.json();
|
|
364
364
|
}
|
|
365
365
|
if (e.status === 401) {
|
|
366
|
-
if (u.userOverrideActive)
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
366
|
+
if (u.userOverrideActive) {
|
|
367
|
+
let n = {};
|
|
368
|
+
try {
|
|
369
|
+
n = await e.clone().json();
|
|
370
|
+
} catch {
|
|
371
|
+
}
|
|
372
|
+
throw D("Unauthorized access attempt with user override", {
|
|
373
|
+
endpoint: e.url,
|
|
374
|
+
error: n
|
|
375
|
+
}), new V(
|
|
376
|
+
n.errorMessage ?? n.message ?? "Unauthorized... User override failed."
|
|
377
|
+
);
|
|
378
|
+
}
|
|
370
379
|
return await B(e, 401);
|
|
371
380
|
}
|
|
372
|
-
return e.status === 500 ? (f("Server error occurred", { endpoint: e.url }), await B(e, 500)) : (
|
|
381
|
+
return e.status === 500 ? (f("Server error occurred", { endpoint: e.url }), await B(e, 500)) : (D(`Unexpected response status: ${e.status}`, {
|
|
373
382
|
endpoint: e.url
|
|
374
383
|
}), await B(e, e.status));
|
|
375
384
|
}
|
|
@@ -381,13 +390,13 @@ async function B(e, t) {
|
|
|
381
390
|
};
|
|
382
391
|
if (r || !n)
|
|
383
392
|
throw t === 401 ? new V() : t === 500 ? new E() : new R(`Request failed with status ${t}`, t);
|
|
384
|
-
const
|
|
393
|
+
const o = JSON.parse(new TextDecoder().decode(n));
|
|
385
394
|
throw new Error(
|
|
386
|
-
|
|
395
|
+
o.errorMessage || o.message || `Request failed with status ${t}`,
|
|
387
396
|
{
|
|
388
397
|
cause: {
|
|
389
|
-
errorCode:
|
|
390
|
-
errorCodeTest:
|
|
398
|
+
errorCode: o.errorCode,
|
|
399
|
+
errorCodeTest: o.errorCodeTest
|
|
391
400
|
}
|
|
392
401
|
}
|
|
393
402
|
);
|
|
@@ -398,9 +407,9 @@ async function B(e, t) {
|
|
|
398
407
|
);
|
|
399
408
|
}
|
|
400
409
|
}
|
|
401
|
-
async function
|
|
402
|
-
const n =
|
|
403
|
-
|
|
410
|
+
async function Se(e, t, r) {
|
|
411
|
+
const n = L(r?.headers), { backendUrl: o } = u, a = t ? `?${new URLSearchParams(t)}` : "", s = o ? `${o}/${e}${a}` : `${e}${a}`;
|
|
412
|
+
x(`Making DELETE request to: ${s}`);
|
|
404
413
|
try {
|
|
405
414
|
const i = await fetch(s, {
|
|
406
415
|
method: "DELETE",
|
|
@@ -412,11 +421,11 @@ async function we(e, t, r) {
|
|
|
412
421
|
throw f("Error making DELETE request:", i), i;
|
|
413
422
|
}
|
|
414
423
|
}
|
|
415
|
-
async function
|
|
416
|
-
const n =
|
|
424
|
+
async function m(e, t, r) {
|
|
425
|
+
const n = L(r?.headers), { backendUrl: o } = u, a = t ? `?${new URLSearchParams(t)}` : "";
|
|
417
426
|
e.startsWith("plugin") && (e = `api/v1/${e}`);
|
|
418
|
-
const s =
|
|
419
|
-
|
|
427
|
+
const s = o ? `${o}/${e}${a}` : `${e}${a}`;
|
|
428
|
+
x(`Making GET request to: ${s}`);
|
|
420
429
|
try {
|
|
421
430
|
const i = await fetch(s, {
|
|
422
431
|
method: "GET",
|
|
@@ -429,17 +438,17 @@ async function w(e, t, r) {
|
|
|
429
438
|
throw f("Error making GET request:", i), i;
|
|
430
439
|
}
|
|
431
440
|
}
|
|
432
|
-
async function
|
|
433
|
-
const n =
|
|
441
|
+
async function ke(e, t, r) {
|
|
442
|
+
const n = L(r?.headers);
|
|
434
443
|
n.append("content-type", "application/json");
|
|
435
|
-
const { app:
|
|
436
|
-
app:
|
|
444
|
+
const { app: o, backendUrl: a } = u, s = {
|
|
445
|
+
app: o,
|
|
437
446
|
...t,
|
|
438
447
|
locale: t.locale || navigator.language,
|
|
439
448
|
noUserOverride: !0,
|
|
440
449
|
noAutoAuthentication: !0
|
|
441
|
-
}, i =
|
|
442
|
-
|
|
450
|
+
}, i = a ? `${a}/${e}` : `${e}`;
|
|
451
|
+
x(`Making PATCH request to: ${i}`);
|
|
443
452
|
try {
|
|
444
453
|
const c = await fetch(i, {
|
|
445
454
|
method: "PATCH",
|
|
@@ -453,18 +462,18 @@ async function _e(e, t, r) {
|
|
|
453
462
|
}
|
|
454
463
|
}
|
|
455
464
|
async function l(e, t, r) {
|
|
456
|
-
const n =
|
|
465
|
+
const n = L(r?.headers), { app: o, backendUrl: a } = u;
|
|
457
466
|
n.has("Content-Type") || n.set("Content-Type", "application/json");
|
|
458
467
|
const s = {
|
|
459
|
-
app:
|
|
468
|
+
app: o,
|
|
460
469
|
...t,
|
|
461
470
|
locale: t.locale || navigator.language,
|
|
462
471
|
noUserOverride: !0,
|
|
463
472
|
noAutoAuthentication: !0
|
|
464
473
|
};
|
|
465
474
|
e.startsWith("plugin") && (e = `api/v1/${e}`);
|
|
466
|
-
const i =
|
|
467
|
-
|
|
475
|
+
const i = a ? `${a}/${e}` : `${e}`;
|
|
476
|
+
x(`Making POST request to: ${i}`);
|
|
468
477
|
try {
|
|
469
478
|
const c = await fetch(i, {
|
|
470
479
|
method: "POST",
|
|
@@ -478,15 +487,15 @@ async function l(e, t, r) {
|
|
|
478
487
|
throw f("Error making POST request:", c), c;
|
|
479
488
|
}
|
|
480
489
|
}
|
|
481
|
-
async function
|
|
482
|
-
const n =
|
|
483
|
-
app:
|
|
490
|
+
async function Ut(e, t, r) {
|
|
491
|
+
const n = L(r?.headers), { app: o, backendUrl: a } = u, s = {
|
|
492
|
+
app: o,
|
|
484
493
|
...t,
|
|
485
494
|
locale: t.locale || navigator.language,
|
|
486
495
|
noUserOverride: !0,
|
|
487
496
|
noAutoAuthentication: !0
|
|
488
|
-
}, i = `${
|
|
489
|
-
|
|
497
|
+
}, i = `${a}/${e}`;
|
|
498
|
+
x(`Making PUT request to: ${i}`);
|
|
490
499
|
try {
|
|
491
500
|
const c = await fetch(i, {
|
|
492
501
|
method: "PUT",
|
|
@@ -502,52 +511,52 @@ async function Lt(e, t, r) {
|
|
|
502
511
|
function b(e) {
|
|
503
512
|
const t = new AbortController(), { signal: r } = t;
|
|
504
513
|
return e && setTimeout(() => {
|
|
505
|
-
r.aborted || t.abort(new
|
|
514
|
+
r.aborted || t.abort(new _e(`Request timed out after ${e}ms`));
|
|
506
515
|
}, e), { controller: t, signal: r };
|
|
507
516
|
}
|
|
508
|
-
function
|
|
517
|
+
function ne(e) {
|
|
509
518
|
if (!e) return;
|
|
510
519
|
const t = new Date(e);
|
|
511
520
|
return Number.isNaN(t.getTime()) ? void 0 : t;
|
|
512
521
|
}
|
|
513
|
-
function
|
|
514
|
-
const t =
|
|
522
|
+
function Dt(e) {
|
|
523
|
+
const t = ne(e);
|
|
515
524
|
return !!t && t.getTime() <= Date.now();
|
|
516
525
|
}
|
|
517
|
-
function
|
|
518
|
-
const r =
|
|
526
|
+
function It(e, t = 7) {
|
|
527
|
+
const r = ne(e);
|
|
519
528
|
if (!r) return !1;
|
|
520
|
-
const n = Date.now(),
|
|
521
|
-
return
|
|
529
|
+
const n = Date.now(), o = n + t * 24 * 60 * 60 * 1e3, a = r.getTime();
|
|
530
|
+
return a > n && a <= o;
|
|
522
531
|
}
|
|
523
|
-
async function
|
|
532
|
+
async function At(e, t = 0, r = 1e3) {
|
|
524
533
|
let n;
|
|
525
|
-
for (let
|
|
534
|
+
for (let o = 0; o <= t; o++)
|
|
526
535
|
try {
|
|
527
536
|
return await e();
|
|
528
|
-
} catch (
|
|
529
|
-
if (n =
|
|
530
|
-
throw
|
|
531
|
-
|
|
537
|
+
} catch (a) {
|
|
538
|
+
if (n = a, a instanceof R && a.status >= 400 && a.status < 500 && a.status !== 429 || a instanceof DOMException && a.name === "AbortError")
|
|
539
|
+
throw a;
|
|
540
|
+
o < t && (D(`Retrying request (${o + 1}/${t})`, { error: a }), await new Promise((s) => setTimeout(s, r)));
|
|
532
541
|
}
|
|
533
542
|
throw n;
|
|
534
543
|
}
|
|
535
|
-
function
|
|
544
|
+
function Nt(e, t, r) {
|
|
536
545
|
if (!e || !t) return;
|
|
537
546
|
if (r) {
|
|
538
|
-
const
|
|
547
|
+
const a = Object.keys(t.queries).find((c) => c === r?.toLowerCase());
|
|
539
548
|
let s;
|
|
540
|
-
|
|
549
|
+
a && (s = t.queries[a]);
|
|
541
550
|
const i = (s?.columnsInfo?.columns || [])?.find((c) => c.aliases?.split(",")?.includes(e));
|
|
542
551
|
if (i) return i.name;
|
|
543
552
|
}
|
|
544
|
-
const n = t.indexes?._?.columns,
|
|
545
|
-
if (
|
|
553
|
+
const n = t.indexes?._?.columns, o = Object.entries(n).find((a) => a[1].aliases?.includes(e));
|
|
554
|
+
if (o) return o[0];
|
|
546
555
|
}
|
|
547
|
-
var C = /* @__PURE__ */ ((e) => (e.None = "None", e.Search_FirstPage = "Search_FirstPage", e.Search_Text = "Search_Text", e.Search_Refine = "Search_Refine", e.Search_Select_Item = "Search_Select_Item", e.Search_Select_Custom = "Search_Select_Custom", e.Search_Select_Concept = "Search_Select_Concept", e.Search_Select_Correction = "Search_Select_Correction", e.Search_GotoPage = "Search_GotoPage", e.Search_GotoTab = "Search_GotoTab", e.Search_DisplayResult = "Search_DisplayResult", e.Search_RemoveResult = "Search_RemoveResult", e.Search_RemoveAdvanced = "Search_RemoveAdvanced", e.Search_SavedQuery = "Search_SavedQuery", e.Search_WebService = "Search_WebService", e.Search_DidYouMean_Original = "Search_DidYouMean_Original", e.Search_DidYouMean_Correction = "Search_DidYouMean_Correction", e.Search_ExportCSV = "Search_ExportCSV", e.Search_SavedQuery_ExportCSV = "Search_SavedQuery_ExportCSV", e.Search_Selection_ExportCSV = "Search_Selection_ExportCSV", e.Search_AlertQuery = "Search_AlertQuery", e.Search_Select_AnalyticsItem = "Search_Select_AnalyticsItem", e.Search_Sort = "Search_Sort", e.Search_Exit_Logout = "Search_Exit_Logout", e.Search_Timeline_Usage = "Search_Timeline_Usage", e.Search_AutoComplete = "Search_Autocomplete", e.Search_Login_Success = "Login_Success_Form", e.Search_QueryIntent_Detected = "Search_QueryIntent_Detected", e.SavedQuery_Add = "SavedQuery_Add", e.SavedQuery_Delete = "SavedQuery_Delete", e.SavedQuery_DeleteAll = "SavedQuery_DeleteAll", e.SavedQuery_Rename = "SavedQuery_Rename", e.Alert_Edit = "Alert_Edit", e.Alert_Delete = "Alert_Delete", e.Alert_DeleteAll = "Alert_DeleteAll", e.Link_Display = "Link_Display", e.Link_Click = "Link_Click", e.Basket_Add = "Basket_Add", e.Basket_Delete = "Basket_Delete", e.Basket_DeleteAll = "Basket_DeleteAll", e.Basket_Rename = "Basket_Rename", e.Basket_AddDoc = "Basket_AddDoc", e.Basket_RemoveDoc = "Basket_RemoveDoc", e.Basket_Open = "Basket_Open", e.Basket_ExportCSV = "Basket_ExportCSV", e.Label_Add = "Label_Add", e.Label_Delete = "Label_Delete", e.Label_Rename = "Label_Rename", e.Label_Open = "Label_Open", e.Label_AddDoc = "Label_AddDoc", e.Label_RemoveDoc = "Label_RemoveDoc", e.Label_ExportCSV = "Label_ExportCSV", e.Label_Menu_ExportCSV = "Label_Menu_ExportCSV", e.Rating_Set = "Rating_Set", e.Rating_Delete = "Rating_Delete", e.Doc_Preview = "Doc_Preview", e.Doc_CacheHtml = "Doc_CacheHtml", e.Doc_CachePdf = "Doc_CachePdf", e.Doc_CacheOriginal = "Doc_CacheOriginal", e.Doc_Url1 = "Doc_Url1", e.Doc_Url2 = "Doc_Url2", e.Preview_Close = "Preview_Close", e.Click_ResultLink = "Click_ResultLink", e.Click_ResultLink1 = "Click_ResultLink1", e.Click_ResultLink2 = "Click_ResultLink2", e.Click_ResultLink3 = "Click_ResultLink3", e.Click_ResultLink4 = "Click_ResultLink4", e.Click_ResultLink5 = "Click_ResultLink5", e.Click_ResultLink6 = "Click_ResultLink6", e.Click_ResultLink7 = "Click_ResultLink7", e.Click_ResultLink8 = "Click_ResultLink8", e.Click_ResultLink9 = "Click_ResultLink9", e.Click_ResultLink10 = "Click_ResultLink10", e.Click_PreviewLink1 = "Click_PreviewLink1", e.Click_PreviewLink2 = "Click_PreviewLink2", e.Click_PreviewLink3 = "Click_PreviewLink3", e.Click_PreviewLink4 = "Click_PreviewLink4", e.Click_PreviewLink5 = "Click_PreviewLink5", e.Click_PreviewLink6 = "Click_PreviewLink6", e.Click_PreviewLink7 = "Click_PreviewLink7", e.Click_PreviewLink8 = "Click_PreviewLink8", e.Click_PreviewLink9 = "Click_PreviewLink9", e.Click_PreviewLink10 = "Click_PreviewLink10", e.RFM_ClickSet = "RFM_ClickSet", e.RFM_ClickReset = "RFM_ClickReset", e.RFM_Like = "RFM_Like", e.RFM_LikeReset = "RFM_LikeReset", e.RFM_Dislike = "RFM_Dislike", e.RFM_Important = "RFM_Important", e.RFM_ImportantReset = "RFM_ImportantReset", e.RFM_Ban = "RFM_Ban", e.Navigation_Exit = "Navigation_Exit", e.Navigation_Return = "Navigation_Return", e.Navigation_Route = "Navigation_Route", e.Answer_Display = "Answer_Display", e.Answer_Click = "Answer_Click", e.Answer_Result = "Answer_Result", e.Answer_Liked = "Answer_Liked", e.Answer_Disliked = "Answer_Disliked", e.Answer_Liked_Cancelled = "Answer_Liked_Cancelled", e.Answer_Disliked_Cancelled = "Answer_Disliked_Cancelled", e.TopPassages_Display = "TopPassages_Display", e.TopPassages_Click = "TopPassages_Click", e.UserSettings_Reset = "UserSettings_Reset", e.Change_Password_Failed = "change.password.failed", e.Change_Password_Success_Form = "change.password.success.form", e.Forgot_Password_Request = "forgot.password.request", e.Login_Denied = "login.denied", e.Login_Success_Form = "login.success.form", e.Send_Reset_Password_Link = "send.reset.password.link", e.Xrest_ChangePassword = "xrest.changepassword", e))(C || {}), h = /* @__PURE__ */ ((e) => (e[e.none = 0] = "none", e[e.bool = 1] = "bool", e[e.date = 2] = "date", e[e.dateTime = 3] = "dateTime", e[e.time = 4] = "time", e[e.unsigned = 5] = "unsigned", e[e.integer = 6] = "integer", e[e.float = 7] = "float", e[e.double = 8] = "double", e[e.dates = 9] = "dates", e[e.dateTimes = 10] = "dateTimes", e[e.times = 11] = "times", e[e.varchar = 12] = "varchar", e[e.binary = 13] = "binary", e[e.string = 14] = "string", e[e.csv = 15] = "csv", e))(h || {}),
|
|
548
|
-
const
|
|
549
|
-
var
|
|
550
|
-
function
|
|
556
|
+
var C = /* @__PURE__ */ ((e) => (e.None = "None", e.Search_FirstPage = "Search_FirstPage", e.Search_Text = "Search_Text", e.Search_Refine = "Search_Refine", e.Search_Select_Item = "Search_Select_Item", e.Search_Select_Custom = "Search_Select_Custom", e.Search_Select_Concept = "Search_Select_Concept", e.Search_Select_Correction = "Search_Select_Correction", e.Search_GotoPage = "Search_GotoPage", e.Search_GotoTab = "Search_GotoTab", e.Search_DisplayResult = "Search_DisplayResult", e.Search_RemoveResult = "Search_RemoveResult", e.Search_RemoveAdvanced = "Search_RemoveAdvanced", e.Search_SavedQuery = "Search_SavedQuery", e.Search_WebService = "Search_WebService", e.Search_DidYouMean_Original = "Search_DidYouMean_Original", e.Search_DidYouMean_Correction = "Search_DidYouMean_Correction", e.Search_ExportCSV = "Search_ExportCSV", e.Search_SavedQuery_ExportCSV = "Search_SavedQuery_ExportCSV", e.Search_Selection_ExportCSV = "Search_Selection_ExportCSV", e.Search_AlertQuery = "Search_AlertQuery", e.Search_Select_AnalyticsItem = "Search_Select_AnalyticsItem", e.Search_Sort = "Search_Sort", e.Search_Exit_Logout = "Search_Exit_Logout", e.Search_Timeline_Usage = "Search_Timeline_Usage", e.Search_AutoComplete = "Search_Autocomplete", e.Search_Login_Success = "Login_Success_Form", e.Search_QueryIntent_Detected = "Search_QueryIntent_Detected", e.SavedQuery_Add = "SavedQuery_Add", e.SavedQuery_Delete = "SavedQuery_Delete", e.SavedQuery_DeleteAll = "SavedQuery_DeleteAll", e.SavedQuery_Rename = "SavedQuery_Rename", e.Alert_Edit = "Alert_Edit", e.Alert_Delete = "Alert_Delete", e.Alert_DeleteAll = "Alert_DeleteAll", e.Link_Display = "Link_Display", e.Link_Click = "Link_Click", e.Basket_Add = "Basket_Add", e.Basket_Delete = "Basket_Delete", e.Basket_DeleteAll = "Basket_DeleteAll", e.Basket_Rename = "Basket_Rename", e.Basket_AddDoc = "Basket_AddDoc", e.Basket_RemoveDoc = "Basket_RemoveDoc", e.Basket_Open = "Basket_Open", e.Basket_ExportCSV = "Basket_ExportCSV", e.Label_Add = "Label_Add", e.Label_Delete = "Label_Delete", e.Label_Rename = "Label_Rename", e.Label_Open = "Label_Open", e.Label_AddDoc = "Label_AddDoc", e.Label_RemoveDoc = "Label_RemoveDoc", e.Label_ExportCSV = "Label_ExportCSV", e.Label_Menu_ExportCSV = "Label_Menu_ExportCSV", e.Rating_Set = "Rating_Set", e.Rating_Delete = "Rating_Delete", e.Doc_Preview = "Doc_Preview", e.Doc_CacheHtml = "Doc_CacheHtml", e.Doc_CachePdf = "Doc_CachePdf", e.Doc_CacheOriginal = "Doc_CacheOriginal", e.Doc_Url1 = "Doc_Url1", e.Doc_Url2 = "Doc_Url2", e.Preview_Close = "Preview_Close", e.Click_ResultLink = "Click_ResultLink", e.Click_ResultLink1 = "Click_ResultLink1", e.Click_ResultLink2 = "Click_ResultLink2", e.Click_ResultLink3 = "Click_ResultLink3", e.Click_ResultLink4 = "Click_ResultLink4", e.Click_ResultLink5 = "Click_ResultLink5", e.Click_ResultLink6 = "Click_ResultLink6", e.Click_ResultLink7 = "Click_ResultLink7", e.Click_ResultLink8 = "Click_ResultLink8", e.Click_ResultLink9 = "Click_ResultLink9", e.Click_ResultLink10 = "Click_ResultLink10", e.Click_PreviewLink1 = "Click_PreviewLink1", e.Click_PreviewLink2 = "Click_PreviewLink2", e.Click_PreviewLink3 = "Click_PreviewLink3", e.Click_PreviewLink4 = "Click_PreviewLink4", e.Click_PreviewLink5 = "Click_PreviewLink5", e.Click_PreviewLink6 = "Click_PreviewLink6", e.Click_PreviewLink7 = "Click_PreviewLink7", e.Click_PreviewLink8 = "Click_PreviewLink8", e.Click_PreviewLink9 = "Click_PreviewLink9", e.Click_PreviewLink10 = "Click_PreviewLink10", e.RFM_ClickSet = "RFM_ClickSet", e.RFM_ClickReset = "RFM_ClickReset", e.RFM_Like = "RFM_Like", e.RFM_LikeReset = "RFM_LikeReset", e.RFM_Dislike = "RFM_Dislike", e.RFM_Important = "RFM_Important", e.RFM_ImportantReset = "RFM_ImportantReset", e.RFM_Ban = "RFM_Ban", e.Navigation_Exit = "Navigation_Exit", e.Navigation_Return = "Navigation_Return", e.Navigation_Route = "Navigation_Route", e.Answer_Display = "Answer_Display", e.Answer_Click = "Answer_Click", e.Answer_Result = "Answer_Result", e.Answer_Liked = "Answer_Liked", e.Answer_Disliked = "Answer_Disliked", e.Answer_Liked_Cancelled = "Answer_Liked_Cancelled", e.Answer_Disliked_Cancelled = "Answer_Disliked_Cancelled", e.TopPassages_Display = "TopPassages_Display", e.TopPassages_Click = "TopPassages_Click", e.UserSettings_Reset = "UserSettings_Reset", e.Change_Password_Failed = "change.password.failed", e.Change_Password_Success_Form = "change.password.success.form", e.Forgot_Password_Request = "forgot.password.request", e.Login_Denied = "login.denied", e.Login_Success_Form = "login.success.form", e.Send_Reset_Password_Link = "send.reset.password.link", e.Xrest_ChangePassword = "xrest.changepassword", e))(C || {}), h = /* @__PURE__ */ ((e) => (e[e.none = 0] = "none", e[e.bool = 1] = "bool", e[e.date = 2] = "date", e[e.dateTime = 3] = "dateTime", e[e.time = 4] = "time", e[e.unsigned = 5] = "unsigned", e[e.integer = 6] = "integer", e[e.float = 7] = "float", e[e.double = 8] = "double", e[e.dates = 9] = "dates", e[e.dateTimes = 10] = "dateTimes", e[e.times = 11] = "times", e[e.varchar = 12] = "varchar", e[e.binary = 13] = "binary", e[e.string = 14] = "string", e[e.csv = 15] = "csv", e))(h || {}), p = /* @__PURE__ */ ((e) => (e[e.none = 0] = "none", e[e.a = 2053] = "a", e[e.c = 4] = "c", e[e.d = 8] = "d", e[e.e = 2068] = "e", e[e.i = 256] = "i", e[e.l = 2052] = "l", e[e.n = 8192] = "n", e[e.t = 524292] = "t", e[e.x = 8388608] = "x", e[e.z = 33554432] = "z", e[e.f_ordinal = 8192] = "f_ordinal", e[e.f_multidates = 8192] = "f_multidates", e[e.f_varchar = 33554432] = "f_varchar", e[e.f_binary = 33562624] = "f_binary", e[e.f_string = 33562888] = "f_string", e[e.f_csv = 42477853] = "f_csv", e[e.f_overridable = 33554696] = "f_overridable", e))(p || {});
|
|
557
|
+
const qt = "1.0";
|
|
558
|
+
var be = /* @__PURE__ */ ((e) => (e[e.Original = 0] = "Original", e[e.Corrected = 1] = "Corrected", e))(be || {}), ve = /* @__PURE__ */ ((e) => (e[e.none = 0] = "none", e[e.positiveRate = 1] = "positiveRate", e[e.mainlyPosRate = 2] = "mainlyPosRate", e[e.unrate = 4] = "unrate", e[e.mainlyNegRate = 8] = "mainlyNegRate", e[e.negativeRate = 16] = "negativeRate", e[e.all = 31] = "all", e[e.positiveOnly = 7] = "positiveOnly", e[e.negativeOnly = 28] = "negativeOnly", e[e.personalAll = 21] = "personalAll", e[e.personalPosOnly = 5] = "personalPosOnly", e[e.personalNegOnly = 20] = "personalNegOnly", e))(ve || {});
|
|
559
|
+
function Ce(e) {
|
|
551
560
|
if (!e)
|
|
552
561
|
return h.none;
|
|
553
562
|
switch (e.toLocaleLowerCase()) {
|
|
@@ -586,70 +595,171 @@ function be(e) {
|
|
|
586
595
|
return h.none;
|
|
587
596
|
}
|
|
588
597
|
}
|
|
589
|
-
function
|
|
598
|
+
function Re(e) {
|
|
590
599
|
switch (e) {
|
|
591
600
|
case "a":
|
|
592
|
-
return
|
|
601
|
+
return p.a;
|
|
593
602
|
case "c":
|
|
594
|
-
return
|
|
603
|
+
return p.c;
|
|
595
604
|
case "d":
|
|
596
|
-
return
|
|
605
|
+
return p.d;
|
|
597
606
|
case "e":
|
|
598
|
-
return
|
|
607
|
+
return p.e;
|
|
599
608
|
case "i":
|
|
600
|
-
return
|
|
609
|
+
return p.i;
|
|
601
610
|
case "l":
|
|
602
|
-
return
|
|
611
|
+
return p.l;
|
|
603
612
|
case "n":
|
|
604
|
-
return
|
|
613
|
+
return p.n;
|
|
605
614
|
case "t":
|
|
606
|
-
return
|
|
615
|
+
return p.t;
|
|
607
616
|
case "x":
|
|
608
|
-
return
|
|
617
|
+
return p.x;
|
|
609
618
|
case "z":
|
|
610
|
-
return
|
|
619
|
+
return p.z;
|
|
611
620
|
default:
|
|
612
|
-
return
|
|
621
|
+
return p.none;
|
|
613
622
|
}
|
|
614
623
|
}
|
|
615
|
-
function
|
|
616
|
-
let t =
|
|
624
|
+
function Pe(e) {
|
|
625
|
+
let t = p.none;
|
|
617
626
|
if (e)
|
|
618
627
|
for (const r of e)
|
|
619
|
-
t |=
|
|
628
|
+
t |= Re(r);
|
|
620
629
|
return t;
|
|
621
630
|
}
|
|
622
|
-
function
|
|
623
|
-
const
|
|
631
|
+
function g(e, t, r, n) {
|
|
632
|
+
const o = Ce(t), a = Pe(r || "");
|
|
624
633
|
return {
|
|
625
634
|
name: e,
|
|
626
635
|
type: t,
|
|
627
636
|
typeModifier: r,
|
|
628
|
-
eType:
|
|
629
|
-
eTypeModifier:
|
|
637
|
+
eType: o,
|
|
638
|
+
eTypeModifier: a,
|
|
630
639
|
aliases: n
|
|
631
640
|
};
|
|
632
641
|
}
|
|
633
|
-
const
|
|
634
|
-
id:
|
|
635
|
-
text:
|
|
636
|
-
documentlanguages:
|
|
637
|
-
databasealias:
|
|
638
|
-
globalrelevance:
|
|
639
|
-
matchingpartnames:
|
|
640
|
-
matchlocations:
|
|
641
|
-
matchlocationsperpartname:
|
|
642
|
+
const Ft = {
|
|
643
|
+
id: g("id", "string"),
|
|
644
|
+
text: g("text", "varchar"),
|
|
645
|
+
documentlanguages: g("documentlanguages", "csv", "ci", ["language"]),
|
|
646
|
+
databasealias: g("databasealias", "varchar"),
|
|
647
|
+
globalrelevance: g("globalrelevance", "double"),
|
|
648
|
+
matchingpartnames: g("matchingpartnames", "csv"),
|
|
649
|
+
matchlocations: g("matchlocations", "csv"),
|
|
650
|
+
matchlocationsperpartname: g("matchlocationsperpartname", "varchar"),
|
|
642
651
|
// json
|
|
643
|
-
extracts:
|
|
644
|
-
extractsperpartname:
|
|
652
|
+
extracts: g("extracts", "csv"),
|
|
653
|
+
extractsperpartname: g("extractsperpartname", "varchar"),
|
|
645
654
|
// json
|
|
646
|
-
extractslocations:
|
|
647
|
-
documentweight:
|
|
648
|
-
groupcount:
|
|
649
|
-
accesslists:
|
|
655
|
+
extractslocations: g("extractslocations", "csv"),
|
|
656
|
+
documentweight: g("documentweight", "varchar"),
|
|
657
|
+
groupcount: g("groupcount", "integer"),
|
|
658
|
+
accesslists: g("accesslists", "varchar", void 0, ["accessLists"])
|
|
650
659
|
// json
|
|
651
660
|
};
|
|
652
|
-
function
|
|
661
|
+
function oe(e) {
|
|
662
|
+
return e.filter((t) => !!t);
|
|
663
|
+
}
|
|
664
|
+
const Bt = {
|
|
665
|
+
// ── Scalar (leaf) operators ───────────────────────────────────────────────
|
|
666
|
+
/** `field = value`. */
|
|
667
|
+
eq: (e, t) => ({
|
|
668
|
+
field: e,
|
|
669
|
+
operator: "eq",
|
|
670
|
+
value: t
|
|
671
|
+
}),
|
|
672
|
+
/** `field <> value`. */
|
|
673
|
+
neq: (e, t) => ({
|
|
674
|
+
field: e,
|
|
675
|
+
operator: "neq",
|
|
676
|
+
value: t
|
|
677
|
+
}),
|
|
678
|
+
/** `field > value`. */
|
|
679
|
+
gt: (e, t) => ({
|
|
680
|
+
field: e,
|
|
681
|
+
operator: "gt",
|
|
682
|
+
value: t
|
|
683
|
+
}),
|
|
684
|
+
/** `field >= value`. */
|
|
685
|
+
gte: (e, t) => ({
|
|
686
|
+
field: e,
|
|
687
|
+
operator: "gte",
|
|
688
|
+
value: t
|
|
689
|
+
}),
|
|
690
|
+
/** `field < value`. */
|
|
691
|
+
lt: (e, t) => ({
|
|
692
|
+
field: e,
|
|
693
|
+
operator: "lt",
|
|
694
|
+
value: t
|
|
695
|
+
}),
|
|
696
|
+
/** `field <= value`. */
|
|
697
|
+
lte: (e, t) => ({
|
|
698
|
+
field: e,
|
|
699
|
+
operator: "lte",
|
|
700
|
+
value: t
|
|
701
|
+
}),
|
|
702
|
+
/** SQL `LIKE` pattern match (use `*`/`?` wildcards as supported by the engine). */
|
|
703
|
+
like: (e, t) => ({
|
|
704
|
+
field: e,
|
|
705
|
+
operator: "like",
|
|
706
|
+
value: t
|
|
707
|
+
}),
|
|
708
|
+
/** Substring containment. */
|
|
709
|
+
contains: (e, t) => ({
|
|
710
|
+
field: e,
|
|
711
|
+
operator: "contains",
|
|
712
|
+
value: t
|
|
713
|
+
}),
|
|
714
|
+
/** Regular-expression match. */
|
|
715
|
+
regex: (e, t) => ({
|
|
716
|
+
field: e,
|
|
717
|
+
operator: "regex",
|
|
718
|
+
value: t
|
|
719
|
+
}),
|
|
720
|
+
/** `field IS NULL` (no value). */
|
|
721
|
+
isNull: (e) => ({ field: e, operator: "null" }),
|
|
722
|
+
/** `field IS NOT NULL` (no value). */
|
|
723
|
+
isNotNull: (e) => ({ field: e, operator: "notnull" }),
|
|
724
|
+
// ── Range operators ───────────────────────────────────────────────────────
|
|
725
|
+
/**
|
|
726
|
+
* `field IN (...values)` — matches any of the values (logical OR within a field).
|
|
727
|
+
* Prefer this over several `eq` combined with `or` for the same field.
|
|
728
|
+
*/
|
|
729
|
+
in: (e, t) => ({
|
|
730
|
+
field: e,
|
|
731
|
+
operator: "in",
|
|
732
|
+
values: t
|
|
733
|
+
}),
|
|
734
|
+
/** `field BETWEEN start AND end` (inclusive). Works for numbers and ISO dates. */
|
|
735
|
+
between: (e, t, r) => ({
|
|
736
|
+
field: e,
|
|
737
|
+
operator: "between",
|
|
738
|
+
start: t,
|
|
739
|
+
end: r
|
|
740
|
+
}),
|
|
741
|
+
// ── Boolean combinators ───────────────────────────────────────────────────
|
|
742
|
+
/**
|
|
743
|
+
* Combine filters with logical AND. Falsy operands are ignored; with a single
|
|
744
|
+
* effective operand the operand is returned as-is, with none `undefined`.
|
|
745
|
+
*/
|
|
746
|
+
and: (...e) => T("and", e),
|
|
747
|
+
/** Combine filters with logical OR. Same collapsing rules as {@link filter.and}. */
|
|
748
|
+
or: (...e) => T("or", e),
|
|
749
|
+
/**
|
|
750
|
+
* Negate filters. Falsy operands are ignored; returns `undefined` if nothing
|
|
751
|
+
* remains. A `not` node is always kept (even with a single operand).
|
|
752
|
+
*/
|
|
753
|
+
not: (...e) => {
|
|
754
|
+
const t = oe(e);
|
|
755
|
+
return t.length ? { operator: "not", filters: t } : void 0;
|
|
756
|
+
}
|
|
757
|
+
};
|
|
758
|
+
function T(e, t) {
|
|
759
|
+
const r = oe(t);
|
|
760
|
+
return r.length === 0 ? void 0 : r.length === 1 ? r[0] : { operator: e, filters: r };
|
|
761
|
+
}
|
|
762
|
+
function jt(e, t) {
|
|
653
763
|
let r = e[t];
|
|
654
764
|
return r === void 0 ? [] : (typeof r == "string" && (r = String(r).split(",")), Array.isArray(r) ? r.map((n) => {
|
|
655
765
|
if (typeof n == "string") return n.trim();
|
|
@@ -657,64 +767,64 @@ function Nt(e, t) {
|
|
|
657
767
|
return n.display.trim();
|
|
658
768
|
}).filter((n) => n !== void 0) : [String(r).trim()]);
|
|
659
769
|
}
|
|
660
|
-
function
|
|
770
|
+
function Qt(e, t) {
|
|
661
771
|
let r = e[t];
|
|
662
772
|
if (r === void 0) return [];
|
|
663
773
|
if (typeof r == "string" && (r = String(r).split(",")), Array.isArray(r))
|
|
664
|
-
return r.map((
|
|
665
|
-
if (typeof
|
|
666
|
-
return { display:
|
|
667
|
-
if (typeof
|
|
668
|
-
const
|
|
669
|
-
return { display:
|
|
774
|
+
return r.map((o) => {
|
|
775
|
+
if (typeof o == "string")
|
|
776
|
+
return { display: o.trim(), value: o.trim() };
|
|
777
|
+
if (typeof o == "object" && o !== null && "display" in o) {
|
|
778
|
+
const a = o.display.trim(), s = "value" in o ? String(o.value).trim() : a;
|
|
779
|
+
return { display: a, value: s };
|
|
670
780
|
}
|
|
671
781
|
}).filter(
|
|
672
|
-
(
|
|
782
|
+
(o) => o !== void 0
|
|
673
783
|
);
|
|
674
784
|
const n = String(r).trim();
|
|
675
785
|
return [{ display: n, value: n }];
|
|
676
786
|
}
|
|
677
|
-
function
|
|
787
|
+
function q(e) {
|
|
678
788
|
return e !== null && typeof e == "object";
|
|
679
789
|
}
|
|
680
|
-
function
|
|
681
|
-
return
|
|
790
|
+
function ye(e) {
|
|
791
|
+
return q(e) && Object.prototype.toString.call(e) === "[object ArrayBuffer]";
|
|
682
792
|
}
|
|
683
|
-
function
|
|
684
|
-
return
|
|
793
|
+
function xe(e) {
|
|
794
|
+
return q(e) && Object.prototype.toString.call(e) === "[object Blob]";
|
|
685
795
|
}
|
|
686
|
-
function
|
|
796
|
+
function Le(e) {
|
|
687
797
|
return Object.prototype.toString.call(e) === "[object Date]";
|
|
688
798
|
}
|
|
689
|
-
function
|
|
799
|
+
function Oe(e) {
|
|
690
800
|
return typeof e == "string";
|
|
691
801
|
}
|
|
692
|
-
function
|
|
693
|
-
return (
|
|
802
|
+
function Vt(e) {
|
|
803
|
+
return (q(e) || Array.isArray(e)) && !ye(e) && !xe(e) && !Oe(e);
|
|
694
804
|
}
|
|
695
|
-
function
|
|
805
|
+
function $e(e) {
|
|
696
806
|
return e ? (e.getHours() * 60 * 60 + e.getMinutes() * 60 + e.getSeconds()) * 1e3 + e.getMilliseconds() : 0;
|
|
697
807
|
}
|
|
698
|
-
function
|
|
808
|
+
function Ue(e = !0) {
|
|
699
809
|
let t = Date.now();
|
|
700
810
|
return (e ? "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx" : "xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx").replace(/[xy]/g, (n) => {
|
|
701
|
-
const
|
|
702
|
-
return t = Math.floor(t / 16), (n === "x" ?
|
|
811
|
+
const o = (t + Math.random() * 16) % 16 | 0;
|
|
812
|
+
return t = Math.floor(t / 16), (n === "x" ? o : o & 3 | 8).toString(16);
|
|
703
813
|
});
|
|
704
814
|
}
|
|
705
|
-
function
|
|
815
|
+
function Gt(e) {
|
|
706
816
|
if (!e)
|
|
707
817
|
return "``";
|
|
708
818
|
if (e = String(e), e.search(/[\\`]/) === -1)
|
|
709
819
|
return `\`${e}\``;
|
|
710
820
|
const t = ["`"];
|
|
711
821
|
for (let r = 0, n = e.length; r < n; r++) {
|
|
712
|
-
const
|
|
713
|
-
(
|
|
822
|
+
const o = e[r];
|
|
823
|
+
(o === "\\" || o === "`") && t.push("\\"), t.push(o);
|
|
714
824
|
}
|
|
715
825
|
return t.push("`"), t.join("");
|
|
716
826
|
}
|
|
717
|
-
function
|
|
827
|
+
function zt(e) {
|
|
718
828
|
if (typeof crypto < "u" && crypto.subtle && typeof crypto.subtle.digest == "function")
|
|
719
829
|
try {
|
|
720
830
|
return crypto.subtle.digest("SHA-512", new TextEncoder().encode(e)).then(
|
|
@@ -729,21 +839,21 @@ function j(e) {
|
|
|
729
839
|
let n = 2166136261;
|
|
730
840
|
for (let _ = 0; _ < e.length; _++)
|
|
731
841
|
n ^= e.charCodeAt(_), n = n * 16777619 >>> 0;
|
|
732
|
-
const
|
|
842
|
+
const o = n.toString(16).padStart(8, "0"), a = ((n ^ 2863311530) >>> 0).toString(16).padStart(8, "0"), s = ((n ^ 1431655765) >>> 0).toString(16).padStart(8, "0"), i = ((n ^ 3435973836) >>> 0).toString(16).padStart(8, "0"), c = o + a + s + i;
|
|
733
843
|
return (c + c + c + c).substring(0, 128);
|
|
734
844
|
}
|
|
735
|
-
let Q,
|
|
736
|
-
function
|
|
737
|
-
let r =
|
|
738
|
-
r && (
|
|
845
|
+
let Q, ae;
|
|
846
|
+
function O(e, t = !0) {
|
|
847
|
+
let r = De(e.$auditRecord);
|
|
848
|
+
r && (Ie(r), t && Ae(r)), e.$auditRecord = r;
|
|
739
849
|
}
|
|
740
|
-
function
|
|
850
|
+
function De(e) {
|
|
741
851
|
if (!e)
|
|
742
852
|
return;
|
|
743
853
|
let t;
|
|
744
854
|
if (Array.isArray(e))
|
|
745
855
|
t = e;
|
|
746
|
-
else if (
|
|
856
|
+
else if (q(e)) {
|
|
747
857
|
const r = e;
|
|
748
858
|
if (r.auditEvents || r.mlAuditEvents)
|
|
749
859
|
return r;
|
|
@@ -751,53 +861,53 @@ function $e(e) {
|
|
|
751
861
|
}
|
|
752
862
|
return { auditEvents: t };
|
|
753
863
|
}
|
|
754
|
-
function
|
|
755
|
-
const t =
|
|
864
|
+
function Ie(e) {
|
|
865
|
+
const t = Ne();
|
|
756
866
|
return e.auditEvents?.forEach((r) => {
|
|
757
867
|
r.detail || (r.detail = {}), r.detail.sessionid = t;
|
|
758
868
|
}), e;
|
|
759
869
|
}
|
|
760
|
-
function
|
|
870
|
+
function Ae(e) {
|
|
761
871
|
const t = typeof window < "u" ? decodeURIComponent(window.location.href) : "http://localhost";
|
|
762
872
|
return e?.auditEvents?.forEach((r) => {
|
|
763
873
|
r.detail || (r.detail = {}), r.detail.url = t;
|
|
764
874
|
}), e;
|
|
765
875
|
}
|
|
766
|
-
function
|
|
767
|
-
return (!Q ||
|
|
876
|
+
function Ne() {
|
|
877
|
+
return (!Q || qe()) && (Q = Ue()), ae = /* @__PURE__ */ new Date(), Q;
|
|
768
878
|
}
|
|
769
|
-
function
|
|
770
|
-
return (/* @__PURE__ */ new Date()).getTime() -
|
|
879
|
+
function qe() {
|
|
880
|
+
return (/* @__PURE__ */ new Date()).getTime() - ae.getTime() > 600 * 1e3;
|
|
771
881
|
}
|
|
772
|
-
async function
|
|
882
|
+
async function Fe(e, t = !0) {
|
|
773
883
|
const r = {
|
|
774
884
|
event: C.None,
|
|
775
885
|
$auditRecord: e
|
|
776
886
|
};
|
|
777
|
-
return
|
|
887
|
+
return O(r, t), l("api/v1/audit.notify", r);
|
|
778
888
|
}
|
|
779
|
-
const
|
|
780
|
-
async function
|
|
781
|
-
const n = e.items?.length || 0,
|
|
782
|
-
query: { ...t, action: "aggregate", aggregations: { [e.name]: { skip: n, count:
|
|
889
|
+
const Ht = { notify: Fe };
|
|
890
|
+
async function Jt(e, t, r) {
|
|
891
|
+
const n = e.items?.length || 0, o = 10, a = {
|
|
892
|
+
query: { ...t, action: "aggregate", aggregations: { [e.name]: { skip: n, count: o } } },
|
|
783
893
|
$auditRecord: { auditEvents: [r] }
|
|
784
894
|
};
|
|
785
|
-
|
|
786
|
-
const s = await l("api/v1/query",
|
|
787
|
-
return d.$hasMore = d.items.length >
|
|
895
|
+
O(a);
|
|
896
|
+
const s = await l("api/v1/query", a), i = await P(s), { aggregations: c } = i, d = c[0];
|
|
897
|
+
return d.$hasMore = d.items.length > o, d.items = [...e.items, ...d.items], Promise.resolve(d);
|
|
788
898
|
}
|
|
789
|
-
async function
|
|
899
|
+
async function Wt(e) {
|
|
790
900
|
const t = e || u.app, r = new URLSearchParams({ app: t || "" });
|
|
791
|
-
return
|
|
901
|
+
return m("api/v1/app", r);
|
|
792
902
|
}
|
|
793
|
-
async function
|
|
903
|
+
async function Be() {
|
|
794
904
|
const { app: e } = u, t = new URLSearchParams({
|
|
795
905
|
app: e || "",
|
|
796
906
|
preLogin: "true"
|
|
797
907
|
});
|
|
798
|
-
return
|
|
908
|
+
return m("api/v1/app", t);
|
|
799
909
|
}
|
|
800
|
-
function
|
|
910
|
+
function Mt() {
|
|
801
911
|
let { backendUrl: e, app: t, useCredentials: r } = u;
|
|
802
912
|
if (typeof window < "u") {
|
|
803
913
|
if (e || (e = window.location.origin), !t) {
|
|
@@ -820,12 +930,12 @@ function zt() {
|
|
|
820
930
|
autoSAMLProvider: void 0,
|
|
821
931
|
bearerToken: void 0,
|
|
822
932
|
useSAML: void 0
|
|
823
|
-
}), Promise.resolve({})) :
|
|
824
|
-
const { autoOAuthProvider:
|
|
933
|
+
}), Promise.resolve({})) : Be().then((n) => {
|
|
934
|
+
const { autoOAuthProvider: o, autoSAMLProvider: a } = u, s = !o && !n.autoOAuthProvider && !a && !n.autoSAMLProvider;
|
|
825
935
|
return k({
|
|
826
936
|
...u,
|
|
827
|
-
autoOAuthProvider:
|
|
828
|
-
autoSAMLProvider:
|
|
937
|
+
autoOAuthProvider: o || n.autoOAuthProvider,
|
|
938
|
+
autoSAMLProvider: a || n.autoSAMLProvider,
|
|
829
939
|
useCredentials: s,
|
|
830
940
|
useSSO: s
|
|
831
941
|
}), n;
|
|
@@ -833,20 +943,20 @@ function zt() {
|
|
|
833
943
|
throw f("atomic:fetchAppPreLogin error", n), n;
|
|
834
944
|
});
|
|
835
945
|
}
|
|
836
|
-
async function
|
|
837
|
-
const n = `api/v1/search.dataset/${e}/${t}`,
|
|
946
|
+
async function Xt(e, t, r = {}) {
|
|
947
|
+
const n = `api/v1/search.dataset/${e}/${t}`, o = await l(n, { parameters: r }), a = t[0].toLowerCase() + t.slice(1), s = o.datasets[a];
|
|
838
948
|
if ("errorCode" in s && "errorMessage" in s)
|
|
839
949
|
throw new Error(s.errorMessage);
|
|
840
950
|
return s;
|
|
841
951
|
}
|
|
842
|
-
async function
|
|
843
|
-
const r = `api/v1/search.dataset/${e}`, { parameters: n = {}, datasets:
|
|
844
|
-
return (await l(r, { parameters: n, datasets:
|
|
952
|
+
async function Yt(e, t) {
|
|
953
|
+
const r = `api/v1/search.dataset/${e}`, { parameters: n = {}, datasets: o = [] } = t;
|
|
954
|
+
return (await l(r, { parameters: n, datasets: o })).datasets;
|
|
845
955
|
}
|
|
846
|
-
async function
|
|
847
|
-
return await
|
|
956
|
+
async function Kt(e) {
|
|
957
|
+
return await m(`api/v1/search.dataset/${e}`);
|
|
848
958
|
}
|
|
849
|
-
async function
|
|
959
|
+
async function Zt(e, t = !0, r) {
|
|
850
960
|
try {
|
|
851
961
|
return (await l("api/v1/labels", {
|
|
852
962
|
action: "list",
|
|
@@ -859,18 +969,18 @@ async function Mt(e, t = !0, r) {
|
|
|
859
969
|
throw f("Error in fetchLabels", n), n;
|
|
860
970
|
}
|
|
861
971
|
}
|
|
862
|
-
async function
|
|
972
|
+
async function je() {
|
|
863
973
|
try {
|
|
864
974
|
const { app: e = "" } = u, t = new URLSearchParams({
|
|
865
975
|
app: e,
|
|
866
976
|
action: "getUserRights"
|
|
867
977
|
});
|
|
868
|
-
return
|
|
978
|
+
return m("api/v1/labels", t);
|
|
869
979
|
} catch (e) {
|
|
870
980
|
throw f("Error in getUserRights", e), e;
|
|
871
981
|
}
|
|
872
982
|
}
|
|
873
|
-
async function
|
|
983
|
+
async function Qe(e, t, r = !0) {
|
|
874
984
|
try {
|
|
875
985
|
const n = {
|
|
876
986
|
action: "add",
|
|
@@ -901,7 +1011,7 @@ async function Be(e, t, r = !0) {
|
|
|
901
1011
|
throw f("Error in add", n), n;
|
|
902
1012
|
}
|
|
903
1013
|
}
|
|
904
|
-
async function
|
|
1014
|
+
async function Ve(e, t, r = !0) {
|
|
905
1015
|
try {
|
|
906
1016
|
const n = {
|
|
907
1017
|
action: "remove",
|
|
@@ -932,7 +1042,7 @@ async function je(e, t, r = !0) {
|
|
|
932
1042
|
throw f("Error in remove", n), n;
|
|
933
1043
|
}
|
|
934
1044
|
}
|
|
935
|
-
async function
|
|
1045
|
+
async function Ge(e, t, r = !0) {
|
|
936
1046
|
try {
|
|
937
1047
|
const n = {
|
|
938
1048
|
action: "rename",
|
|
@@ -953,7 +1063,7 @@ async function Qe(e, t, r = !0) {
|
|
|
953
1063
|
throw f("Error in rename", n), n;
|
|
954
1064
|
}
|
|
955
1065
|
}
|
|
956
|
-
async function
|
|
1066
|
+
async function ze(e, t = !0) {
|
|
957
1067
|
try {
|
|
958
1068
|
const r = {
|
|
959
1069
|
action: "delete",
|
|
@@ -972,7 +1082,7 @@ async function Ve(e, t = !0) {
|
|
|
972
1082
|
throw f("Error in deleteLabels", r), r;
|
|
973
1083
|
}
|
|
974
1084
|
}
|
|
975
|
-
async function
|
|
1085
|
+
async function He(e, t, r = !0) {
|
|
976
1086
|
try {
|
|
977
1087
|
const n = {
|
|
978
1088
|
action: "bulkAdd",
|
|
@@ -993,7 +1103,7 @@ async function Ge(e, t, r = !0) {
|
|
|
993
1103
|
throw f("Error in bulkAdd", n), n;
|
|
994
1104
|
}
|
|
995
1105
|
}
|
|
996
|
-
async function
|
|
1106
|
+
async function Je(e, t, r = !0) {
|
|
997
1107
|
try {
|
|
998
1108
|
const n = {
|
|
999
1109
|
action: "bulkRemove",
|
|
@@ -1014,16 +1124,16 @@ async function ze(e, t, r = !0) {
|
|
|
1014
1124
|
throw f("Error in bulkRemove", n), n;
|
|
1015
1125
|
}
|
|
1016
1126
|
}
|
|
1017
|
-
const
|
|
1018
|
-
getUserRights:
|
|
1019
|
-
add:
|
|
1020
|
-
remove:
|
|
1021
|
-
rename:
|
|
1022
|
-
delete:
|
|
1023
|
-
bulkAdd:
|
|
1024
|
-
bulkRemove:
|
|
1127
|
+
const Et = {
|
|
1128
|
+
getUserRights: je,
|
|
1129
|
+
add: Qe,
|
|
1130
|
+
remove: Ve,
|
|
1131
|
+
rename: Ge,
|
|
1132
|
+
delete: ze,
|
|
1133
|
+
bulkAdd: He,
|
|
1134
|
+
bulkRemove: Je
|
|
1025
1135
|
};
|
|
1026
|
-
async function
|
|
1136
|
+
async function Tt(e, t) {
|
|
1027
1137
|
if (typeof window > "u")
|
|
1028
1138
|
return l("api/v1/preview", {
|
|
1029
1139
|
action: "get",
|
|
@@ -1038,7 +1148,7 @@ async function Yt(e, t) {
|
|
|
1038
1148
|
browserUrl: r
|
|
1039
1149
|
});
|
|
1040
1150
|
}
|
|
1041
|
-
async function
|
|
1151
|
+
async function er(e) {
|
|
1042
1152
|
const t = new Headers();
|
|
1043
1153
|
t.append("content-type", "text");
|
|
1044
1154
|
const r = await fetch(
|
|
@@ -1050,23 +1160,23 @@ async function Kt(e) {
|
|
|
1050
1160
|
);
|
|
1051
1161
|
P(r);
|
|
1052
1162
|
}
|
|
1053
|
-
async function
|
|
1163
|
+
async function se() {
|
|
1054
1164
|
const e = new URLSearchParams({
|
|
1055
1165
|
action: "get",
|
|
1056
1166
|
noAutoAuthentication: "true"
|
|
1057
1167
|
});
|
|
1058
|
-
return
|
|
1168
|
+
return m("api/v1/principal", e);
|
|
1059
1169
|
}
|
|
1060
|
-
async function
|
|
1170
|
+
async function We(e) {
|
|
1061
1171
|
const t = {
|
|
1062
1172
|
noAutoAuthentication: "true",
|
|
1063
1173
|
...e
|
|
1064
1174
|
}, r = new URLSearchParams();
|
|
1065
|
-
return Object.entries(t).forEach(([n,
|
|
1066
|
-
|
|
1067
|
-
}),
|
|
1175
|
+
return Object.entries(t).forEach(([n, o]) => {
|
|
1176
|
+
o !== void 0 && r.append(n, String(o));
|
|
1177
|
+
}), m("api/v1/principal/list", r);
|
|
1068
1178
|
}
|
|
1069
|
-
async function
|
|
1179
|
+
async function Me(e) {
|
|
1070
1180
|
if (!e)
|
|
1071
1181
|
return Promise.reject(new Error("userid is required"));
|
|
1072
1182
|
const t = new URLSearchParams({
|
|
@@ -1074,73 +1184,73 @@ async function Je(e) {
|
|
|
1074
1184
|
noAutoAuthentication: "true",
|
|
1075
1185
|
userid: e
|
|
1076
1186
|
});
|
|
1077
|
-
return
|
|
1187
|
+
return m("api/v1/principal", t);
|
|
1078
1188
|
}
|
|
1079
|
-
async function
|
|
1189
|
+
async function Xe(e) {
|
|
1080
1190
|
if (e.length === 0)
|
|
1081
1191
|
return Promise.reject(new Error("userids is required"));
|
|
1082
1192
|
const t = new URLSearchParams({
|
|
1083
1193
|
noAutoAuthentication: "true",
|
|
1084
1194
|
userids: [...e].join(",")
|
|
1085
1195
|
});
|
|
1086
|
-
return
|
|
1196
|
+
return m("api/v1/principal/userids", t);
|
|
1087
1197
|
}
|
|
1088
|
-
const
|
|
1198
|
+
const tr = {
|
|
1089
1199
|
principal: {
|
|
1090
|
-
get:
|
|
1091
|
-
list:
|
|
1092
|
-
userid:
|
|
1093
|
-
userids:
|
|
1200
|
+
get: se,
|
|
1201
|
+
list: We,
|
|
1202
|
+
userid: Me,
|
|
1203
|
+
userids: Xe
|
|
1094
1204
|
}
|
|
1095
|
-
},
|
|
1096
|
-
async function
|
|
1097
|
-
const
|
|
1205
|
+
}, ie = 11;
|
|
1206
|
+
async function rr(e, t, r) {
|
|
1207
|
+
const o = await l("api/v1/query", {
|
|
1098
1208
|
query: e,
|
|
1099
1209
|
$auditRecord: t,
|
|
1100
1210
|
queryIntentData: r
|
|
1101
1211
|
});
|
|
1102
|
-
|
|
1103
|
-
s.$hasMore = !1, !s.isDistribution && !s.isTree && s.items && (s.$hasMore = s.items.length ===
|
|
1104
|
-
}),
|
|
1105
|
-
const
|
|
1106
|
-
return Promise.resolve(
|
|
1107
|
-
}
|
|
1108
|
-
async function
|
|
1109
|
-
const { app: n = "" } = u,
|
|
1212
|
+
o.aggregations.forEach((s) => {
|
|
1213
|
+
s.$hasMore = !1, !s.isDistribution && !s.isTree && s.items && (s.$hasMore = s.items.length === ie), s.isTree && s.items && z(s);
|
|
1214
|
+
}), o.records?.map((s) => Object.assign(s, { value: s.title, type: "default" }));
|
|
1215
|
+
const a = { ...o, nextPage: o.page < Math.ceil(o.rowCount / o.pageSize) ? o.page + 1 : void 0, previousPage: o.page > 1 ? o.page - 1 : void 0 };
|
|
1216
|
+
return Promise.resolve(a);
|
|
1217
|
+
}
|
|
1218
|
+
async function nr(e, t, r) {
|
|
1219
|
+
const { app: n = "" } = u, o = {
|
|
1110
1220
|
methods: [],
|
|
1111
1221
|
mode: t,
|
|
1112
1222
|
propagateErrors: !0,
|
|
1113
1223
|
$auditRecord: { auditEvents: [r] }
|
|
1114
1224
|
};
|
|
1115
1225
|
for (const i of e)
|
|
1116
|
-
|
|
1226
|
+
o.methods.push({
|
|
1117
1227
|
method: "query",
|
|
1118
1228
|
app: n,
|
|
1119
1229
|
query: i
|
|
1120
1230
|
});
|
|
1121
|
-
const
|
|
1122
|
-
|
|
1231
|
+
const a = await l("api/v1/multi", o);
|
|
1232
|
+
a.results.forEach((i) => {
|
|
1123
1233
|
i.aggregations.forEach((c) => {
|
|
1124
|
-
c.$hasMore = !1, !c.isDistribution && !c.isTree && c.items && (c.$hasMore = c.items.length ===
|
|
1234
|
+
c.$hasMore = !1, !c.isDistribution && !c.isTree && c.items && (c.$hasMore = c.items.length === ie), c.isTree && z(c);
|
|
1125
1235
|
});
|
|
1126
|
-
}),
|
|
1127
|
-
const s =
|
|
1236
|
+
}), a.results.forEach((i) => i.records?.map((c) => Object.assign(c, { value: c.title, type: "default" })));
|
|
1237
|
+
const s = a.results.map((i) => ({ ...i, nextPage: i.page < Math.ceil(i.rowCount / i.pageSize) ? i.page + 1 : void 0, previousPage: i.page > 1 ? i.page - 1 : void 0 }));
|
|
1128
1238
|
return Promise.resolve(s);
|
|
1129
1239
|
}
|
|
1130
1240
|
function z(e, t = "", r = 0) {
|
|
1131
1241
|
let n = [];
|
|
1132
|
-
return e.items && e.items.forEach((
|
|
1133
|
-
let
|
|
1134
|
-
n.push({ path:
|
|
1242
|
+
return e.items && e.items.forEach((o) => {
|
|
1243
|
+
let a = t ? `${t}/${o.value}` : o.value, s = r + 1;
|
|
1244
|
+
n.push({ path: a, level: s }), o.$path = a, o.$level = s, o.hasChildren ? n = n.concat(z(o, a, s)) : o.hasChildren = !1;
|
|
1135
1245
|
}), n;
|
|
1136
1246
|
}
|
|
1137
|
-
async function
|
|
1138
|
-
const { webservice:
|
|
1247
|
+
async function or({ model: e, appName: t, query: r, article: n }) {
|
|
1248
|
+
const { webservice: o, format: a, maxcount: s, exportedColumns: i, export: c } = e, d = {
|
|
1139
1249
|
app: t,
|
|
1140
|
-
webservice:
|
|
1250
|
+
webservice: o,
|
|
1141
1251
|
query: r,
|
|
1142
1252
|
type: c,
|
|
1143
|
-
format:
|
|
1253
|
+
format: a,
|
|
1144
1254
|
maxcount: s,
|
|
1145
1255
|
exportedColumns: i,
|
|
1146
1256
|
$auditRecord: {
|
|
@@ -1152,14 +1262,14 @@ async function er({ model: e, appName: t, query: r, article: n }) {
|
|
|
1152
1262
|
}]
|
|
1153
1263
|
}
|
|
1154
1264
|
};
|
|
1155
|
-
return
|
|
1265
|
+
return O(d), await l("api/v1/search.queryexport", d, { responseType: "blob" });
|
|
1156
1266
|
}
|
|
1157
|
-
async function
|
|
1267
|
+
async function ar(e) {
|
|
1158
1268
|
return (await l("api/v1/queryintent", {
|
|
1159
1269
|
query: e
|
|
1160
1270
|
}))?.intents;
|
|
1161
1271
|
}
|
|
1162
|
-
async function
|
|
1272
|
+
async function sr(e, t, r) {
|
|
1163
1273
|
return (await l(
|
|
1164
1274
|
"api/v1/similardocuments",
|
|
1165
1275
|
{
|
|
@@ -1171,17 +1281,17 @@ async function rr(e, t, r) {
|
|
|
1171
1281
|
{ signal: r }
|
|
1172
1282
|
)).data;
|
|
1173
1283
|
}
|
|
1174
|
-
async function
|
|
1284
|
+
async function ir(e, t) {
|
|
1175
1285
|
return (await l("api/v1/query.links", {
|
|
1176
1286
|
webservice: e,
|
|
1177
1287
|
query: t
|
|
1178
|
-
}))?.links?.map((
|
|
1288
|
+
}))?.links?.map((o) => ({ ...o, query: t }));
|
|
1179
1289
|
}
|
|
1180
|
-
function
|
|
1290
|
+
function Ye(e, t) {
|
|
1181
1291
|
if (typeof e == "number")
|
|
1182
1292
|
return `${e}`;
|
|
1183
|
-
if (
|
|
1184
|
-
return
|
|
1293
|
+
if (Le(e))
|
|
1294
|
+
return Ke(e);
|
|
1185
1295
|
if (typeof e == "boolean")
|
|
1186
1296
|
return e ? "true" : "false";
|
|
1187
1297
|
if (e === null)
|
|
@@ -1194,11 +1304,11 @@ function Me(e, t) {
|
|
|
1194
1304
|
}
|
|
1195
1305
|
return e;
|
|
1196
1306
|
}
|
|
1197
|
-
function
|
|
1307
|
+
function Ke(e) {
|
|
1198
1308
|
if (!e)
|
|
1199
1309
|
return "";
|
|
1200
1310
|
try {
|
|
1201
|
-
if (
|
|
1311
|
+
if ($e(e) === 0)
|
|
1202
1312
|
return new Intl.DateTimeFormat("en-CA", {
|
|
1203
1313
|
year: "numeric",
|
|
1204
1314
|
month: "2-digit",
|
|
@@ -1217,14 +1327,14 @@ function Xe(e) {
|
|
|
1217
1327
|
return "Invalid date";
|
|
1218
1328
|
}
|
|
1219
1329
|
}
|
|
1220
|
-
async function
|
|
1221
|
-
const { app:
|
|
1222
|
-
app:
|
|
1330
|
+
async function cr(e, t, r, n, o) {
|
|
1331
|
+
const { app: a } = u, s = {
|
|
1332
|
+
app: a || "",
|
|
1223
1333
|
suggestQuery: e,
|
|
1224
1334
|
text: t,
|
|
1225
1335
|
filter: r,
|
|
1226
1336
|
kinds: n,
|
|
1227
|
-
showSource:
|
|
1337
|
+
showSource: o
|
|
1228
1338
|
};
|
|
1229
1339
|
try {
|
|
1230
1340
|
return (await l(
|
|
@@ -1235,12 +1345,12 @@ async function ar(e, t, r, n, a) {
|
|
|
1235
1345
|
throw console.error("Error fetching suggestions:", i), i;
|
|
1236
1346
|
}
|
|
1237
1347
|
}
|
|
1238
|
-
async function
|
|
1239
|
-
const { app:
|
|
1348
|
+
async function lr(e, t, r, n) {
|
|
1349
|
+
const { app: o } = u;
|
|
1240
1350
|
return (await l(
|
|
1241
1351
|
"api/v1/suggestquery",
|
|
1242
1352
|
{
|
|
1243
|
-
app:
|
|
1353
|
+
app: o || "",
|
|
1244
1354
|
suggestQuery: e,
|
|
1245
1355
|
text: t,
|
|
1246
1356
|
query: r,
|
|
@@ -1248,9 +1358,9 @@ async function or(e, t, r, n) {
|
|
|
1248
1358
|
}
|
|
1249
1359
|
)).suggests;
|
|
1250
1360
|
}
|
|
1251
|
-
async function
|
|
1361
|
+
async function ur(e, t, r) {
|
|
1252
1362
|
if (!t) return Promise.resolve([]);
|
|
1253
|
-
const { app: n } = u,
|
|
1363
|
+
const { app: n } = u, a = await l(
|
|
1254
1364
|
"api/v1/suggestfield",
|
|
1255
1365
|
{
|
|
1256
1366
|
app: n || "",
|
|
@@ -1259,81 +1369,81 @@ async function sr(e, t, r) {
|
|
|
1259
1369
|
query: r
|
|
1260
1370
|
}
|
|
1261
1371
|
);
|
|
1262
|
-
return
|
|
1263
|
-
s.display =
|
|
1264
|
-
}),
|
|
1372
|
+
return a.suggests.forEach((s) => {
|
|
1373
|
+
s.display = Ye(s.display);
|
|
1374
|
+
}), a.suggests;
|
|
1265
1375
|
}
|
|
1266
|
-
async function
|
|
1376
|
+
async function dr(e, t, r, n, o, a) {
|
|
1267
1377
|
return l("api/v1/doc.textchunks", {
|
|
1268
1378
|
id: e,
|
|
1269
1379
|
textChunks: t,
|
|
1270
1380
|
highlights: r,
|
|
1271
1381
|
query: n,
|
|
1272
|
-
leftSentencesCount:
|
|
1273
|
-
rightSentencesCount:
|
|
1382
|
+
leftSentencesCount: o,
|
|
1383
|
+
rightSentencesCount: a
|
|
1274
1384
|
});
|
|
1275
1385
|
}
|
|
1276
|
-
async function
|
|
1386
|
+
async function fr() {
|
|
1277
1387
|
const { app: e } = u, t = new URLSearchParams({
|
|
1278
1388
|
app: e || "",
|
|
1279
1389
|
action: "load"
|
|
1280
1390
|
});
|
|
1281
|
-
return
|
|
1391
|
+
return m("api/v1/usersettings", t);
|
|
1282
1392
|
}
|
|
1283
|
-
async function
|
|
1393
|
+
async function Ze(e, t) {
|
|
1284
1394
|
const r = {
|
|
1285
1395
|
action: "save",
|
|
1286
1396
|
userSettings: e,
|
|
1287
1397
|
$auditRecord: { auditEvents: [t] }
|
|
1288
1398
|
};
|
|
1289
|
-
return
|
|
1399
|
+
return O(r), l("api/v1/usersettings", r);
|
|
1290
1400
|
}
|
|
1291
|
-
async function
|
|
1401
|
+
async function hr(e, t) {
|
|
1292
1402
|
const n = {
|
|
1293
1403
|
action: "patch",
|
|
1294
1404
|
userSettings: e,
|
|
1295
1405
|
$auditRecord: t ? { auditEvents: [t] } : void 0
|
|
1296
1406
|
};
|
|
1297
|
-
return
|
|
1407
|
+
return O(n), l("api/v1/usersettings", n);
|
|
1298
1408
|
}
|
|
1299
|
-
async function
|
|
1300
|
-
return
|
|
1409
|
+
async function gr() {
|
|
1410
|
+
return Ze({}, { type: "UserSettings_Reset" });
|
|
1301
1411
|
}
|
|
1302
|
-
async function
|
|
1412
|
+
async function pr(e, t) {
|
|
1303
1413
|
return l("api/v2/security/password/change", { newPassword: e, currentPassword: t });
|
|
1304
1414
|
}
|
|
1305
|
-
async function
|
|
1415
|
+
async function mr(e) {
|
|
1306
1416
|
const t = "api/v2/security/password/ask-reset-email", n = {
|
|
1307
1417
|
changePasswordRedirectUrl: `${window.location.origin}/login?mode=changepassword`,
|
|
1308
1418
|
userName: e
|
|
1309
1419
|
};
|
|
1310
1420
|
return l(t, n);
|
|
1311
1421
|
}
|
|
1312
|
-
async function
|
|
1313
|
-
return await
|
|
1422
|
+
async function wr(e) {
|
|
1423
|
+
return await m(`api/v2/user-profile/${e}`);
|
|
1314
1424
|
}
|
|
1315
|
-
async function
|
|
1425
|
+
async function _r(e) {
|
|
1316
1426
|
return await l("api/v2/user-profile", e);
|
|
1317
1427
|
}
|
|
1318
|
-
async function
|
|
1319
|
-
return await
|
|
1428
|
+
async function Sr(e, t, r) {
|
|
1429
|
+
return await ke(
|
|
1320
1430
|
`api/v2/user-profile/${e.data?.id}/${t}/${r}`,
|
|
1321
1431
|
e
|
|
1322
1432
|
);
|
|
1323
1433
|
}
|
|
1324
|
-
async function
|
|
1434
|
+
async function kr(e, t, r) {
|
|
1325
1435
|
try {
|
|
1326
|
-
return (await
|
|
1436
|
+
return (await Se(
|
|
1327
1437
|
`api/v2/user-profile/${e.data?.id}/${t}/${r}`
|
|
1328
1438
|
)).success === !0;
|
|
1329
1439
|
} catch {
|
|
1330
1440
|
return !1;
|
|
1331
1441
|
}
|
|
1332
1442
|
}
|
|
1333
|
-
async function
|
|
1334
|
-
return await
|
|
1443
|
+
async function br() {
|
|
1444
|
+
return await m("api/v2/version");
|
|
1335
1445
|
}
|
|
1336
|
-
const v = 1e4,
|
|
1446
|
+
const v = 1e4, Ee = async () => {
|
|
1337
1447
|
const { autoOAuthProvider: e } = u;
|
|
1338
1448
|
if (!e)
|
|
1339
1449
|
throw new Error("autoOAuthProvider is not configured in globalConfig");
|
|
@@ -1366,14 +1476,14 @@ const v = 1e4, Ke = async () => {
|
|
|
1366
1476
|
{ signal: r }
|
|
1367
1477
|
);
|
|
1368
1478
|
if (n.redirectUrl) {
|
|
1369
|
-
const
|
|
1370
|
-
(
|
|
1479
|
+
const o = new URL(n.redirectUrl, window.location.origin);
|
|
1480
|
+
(o.protocol === "https:" || o.protocol === "http:") && (window.location.href = o.href);
|
|
1371
1481
|
}
|
|
1372
1482
|
return n;
|
|
1373
1483
|
} catch (r) {
|
|
1374
1484
|
throw f("Failed to authenticate with OAuth", r), r;
|
|
1375
1485
|
}
|
|
1376
|
-
},
|
|
1486
|
+
}, Te = async () => {
|
|
1377
1487
|
const { autoSAMLProvider: e } = u;
|
|
1378
1488
|
if (!e)
|
|
1379
1489
|
throw new Error("autoSAMLProvider is not configured in globalConfig");
|
|
@@ -1406,8 +1516,8 @@ const v = 1e4, Ke = async () => {
|
|
|
1406
1516
|
{ signal: r }
|
|
1407
1517
|
);
|
|
1408
1518
|
if (n.redirectUrl) {
|
|
1409
|
-
const
|
|
1410
|
-
(
|
|
1519
|
+
const o = new URL(n.redirectUrl, window.location.origin);
|
|
1520
|
+
(o.protocol === "https:" || o.protocol === "http:") && (window.location.href = o.href);
|
|
1411
1521
|
}
|
|
1412
1522
|
return n;
|
|
1413
1523
|
} catch (r) {
|
|
@@ -1428,37 +1538,39 @@ const v = 1e4, Ke = async () => {
|
|
|
1428
1538
|
this.store = {};
|
|
1429
1539
|
}
|
|
1430
1540
|
}, J = H;
|
|
1431
|
-
function
|
|
1541
|
+
function et(e) {
|
|
1432
1542
|
return typeof window > "u" || !window.localStorage ? H.getItem(e) : window.localStorage.getItem(e);
|
|
1433
1543
|
}
|
|
1434
|
-
function
|
|
1544
|
+
function tt(e) {
|
|
1435
1545
|
typeof window > "u" || !window.localStorage ? H.removeItem(e) : window.localStorage.removeItem(e);
|
|
1436
1546
|
}
|
|
1437
|
-
function
|
|
1547
|
+
function rt(e) {
|
|
1438
1548
|
return typeof window > "u" || !window.sessionStorage ? J.getItem(e) : window.sessionStorage.getItem(e);
|
|
1439
1549
|
}
|
|
1440
|
-
function
|
|
1550
|
+
function nt(e, t) {
|
|
1441
1551
|
typeof window > "u" || !window.sessionStorage ? J.setItem(e, t) : window.sessionStorage.setItem(e, t);
|
|
1442
1552
|
}
|
|
1443
|
-
function
|
|
1553
|
+
function ot(e) {
|
|
1444
1554
|
typeof window > "u" || !window.sessionStorage ? J.removeItem(e) : window.sessionStorage.removeItem(e);
|
|
1445
1555
|
}
|
|
1446
|
-
const I = (e) =>
|
|
1556
|
+
const I = (e) => nt(
|
|
1447
1557
|
"sinequa-credentials",
|
|
1448
1558
|
JSON.stringify({ data: { csrfToken: e } })
|
|
1449
|
-
),
|
|
1559
|
+
), at = async () => {
|
|
1450
1560
|
try {
|
|
1451
|
-
const { signal: e } = b(v), t = await
|
|
1561
|
+
const { signal: e } = b(v), t = await m(
|
|
1452
1562
|
"api/v1/challenge?action=getCsrfToken&suppressErrors=true",
|
|
1453
1563
|
void 0,
|
|
1454
1564
|
{ signal: e }
|
|
1455
1565
|
);
|
|
1456
|
-
|
|
1566
|
+
if (t?.csrfToken)
|
|
1567
|
+
return I(t.csrfToken), t.csrfToken;
|
|
1568
|
+
throw new Error("No CSRF token returned");
|
|
1457
1569
|
} catch (e) {
|
|
1458
1570
|
throw f("Failed to get CSRF token", e), e;
|
|
1459
1571
|
}
|
|
1460
1572
|
};
|
|
1461
|
-
async function
|
|
1573
|
+
async function st(e) {
|
|
1462
1574
|
if (e) {
|
|
1463
1575
|
const { username: t, password: r } = e, n = {
|
|
1464
1576
|
action: "get",
|
|
@@ -1469,14 +1581,14 @@ async function at(e) {
|
|
|
1469
1581
|
noAutoAuthentication: !0
|
|
1470
1582
|
};
|
|
1471
1583
|
try {
|
|
1472
|
-
const { signal:
|
|
1584
|
+
const { signal: o } = b(v), a = await l(
|
|
1473
1585
|
"api/v1/security.webtoken",
|
|
1474
1586
|
n,
|
|
1475
|
-
{ signal:
|
|
1587
|
+
{ signal: o }
|
|
1476
1588
|
);
|
|
1477
|
-
return
|
|
1478
|
-
} catch (
|
|
1479
|
-
throw f("Failed to get JWT",
|
|
1589
|
+
return a?.csrfToken ? (I(a.csrfToken), a.csrfToken) : null;
|
|
1590
|
+
} catch (o) {
|
|
1591
|
+
throw f("Failed to get JWT", o), o;
|
|
1480
1592
|
}
|
|
1481
1593
|
} else {
|
|
1482
1594
|
const t = {
|
|
@@ -1493,225 +1605,238 @@ async function at(e) {
|
|
|
1493
1605
|
const n = new Headers();
|
|
1494
1606
|
n.append("Sinequa-Force-Camel-Case", "true"), n.append("accept", "application/json"), n.append("Content-Type", "application/json"), n.append("Authorization", `Bearer ${r}`);
|
|
1495
1607
|
try {
|
|
1496
|
-
const { signal:
|
|
1608
|
+
const { signal: o } = b(v), a = await l(
|
|
1497
1609
|
"api/v1/security.webtoken",
|
|
1498
1610
|
t,
|
|
1499
|
-
{ headers: n, signal:
|
|
1611
|
+
{ headers: n, signal: o }
|
|
1500
1612
|
);
|
|
1501
|
-
return
|
|
1502
|
-
} catch (
|
|
1503
|
-
throw f("Failed to get JWT without credentials",
|
|
1613
|
+
return a?.csrfToken ? (I(a.csrfToken), a.csrfToken) : null;
|
|
1614
|
+
} catch (o) {
|
|
1615
|
+
throw f("Failed to get JWT without credentials", o), o;
|
|
1504
1616
|
}
|
|
1505
1617
|
}
|
|
1506
1618
|
}
|
|
1507
1619
|
const W = () => {
|
|
1508
|
-
const e =
|
|
1620
|
+
const e = rt("sinequa-credentials");
|
|
1509
1621
|
if (e)
|
|
1510
1622
|
try {
|
|
1511
1623
|
const n = JSON.parse(e).data?.csrfToken;
|
|
1512
1624
|
if (n) return n;
|
|
1513
1625
|
} catch (r) {
|
|
1514
|
-
|
|
1626
|
+
D(
|
|
1515
1627
|
"Failed to parse session storage credentials, falling back to local storage",
|
|
1516
1628
|
r
|
|
1517
1629
|
);
|
|
1518
1630
|
}
|
|
1519
|
-
const t =
|
|
1631
|
+
const t = et("csrfToken");
|
|
1520
1632
|
return t || null;
|
|
1521
|
-
},
|
|
1633
|
+
}, vr = async (e) => {
|
|
1522
1634
|
if (e)
|
|
1523
1635
|
S("Attempting authentication using credentials"), k({ useCredentials: !0, useSSO: !1 });
|
|
1524
1636
|
else {
|
|
1525
1637
|
let i = null;
|
|
1526
1638
|
try {
|
|
1527
|
-
S("Attempting to retrieve CSRF token from the backend"), i = await
|
|
1639
|
+
S("Attempting to retrieve CSRF token from the backend"), i = await at(), x("CSRF token retrieval result", i ? "success" : "failed");
|
|
1528
1640
|
} catch {
|
|
1529
1641
|
}
|
|
1530
1642
|
try {
|
|
1531
1643
|
if (i === null) {
|
|
1532
1644
|
const { autoOAuthProvider: c, autoSAMLProvider: d, useSAML: _ } = u;
|
|
1533
1645
|
if (c && !_)
|
|
1534
|
-
return S("Initiating OAuth authentication flow"), await
|
|
1646
|
+
return S("Initiating OAuth authentication flow"), await Ee(), w(!1), !1;
|
|
1535
1647
|
if (d)
|
|
1536
|
-
return S("Initiating SAML authentication flow"), await
|
|
1648
|
+
return S("Initiating SAML authentication flow"), await Te(), w(!1), !1;
|
|
1537
1649
|
S(
|
|
1538
1650
|
"No direct authentication method available, will try SSO then credentials"
|
|
1539
1651
|
), k({ useCredentials: !0, useSSO: !0 });
|
|
1540
1652
|
} else
|
|
1541
|
-
return S("User authenticated via existing token"),
|
|
1653
|
+
return S("User authenticated via existing token"), w(!0), !0;
|
|
1542
1654
|
} catch (c) {
|
|
1543
|
-
throw f("Unexpected error during authentication", c),
|
|
1655
|
+
throw f("Unexpected error during authentication", c), w(!1), c;
|
|
1544
1656
|
}
|
|
1657
|
+
return !1;
|
|
1545
1658
|
}
|
|
1546
1659
|
if (u.useCredentials && u.useSSO)
|
|
1547
1660
|
try {
|
|
1548
|
-
if (S("Checking if user is authenticated via SSO"), await
|
|
1549
|
-
return S("User authenticated using SSO"), k({ useCredentials: !1, useSSO: !0 }),
|
|
1661
|
+
if (S("Checking if user is authenticated via SSO"), await se())
|
|
1662
|
+
return S("User authenticated using SSO"), k({ useCredentials: !1, useSSO: !0 }), w(!0), !0;
|
|
1550
1663
|
} catch (i) {
|
|
1551
1664
|
if (i?.status === 401)
|
|
1552
1665
|
return S("SSO authentication failed with 401, falling back to credentials"), k({ useCredentials: !0, useSSO: !1 }), !1;
|
|
1553
|
-
throw f("SSO authentication failed with unexpected error", i),
|
|
1666
|
+
throw f("SSO authentication failed with unexpected error", i), w(!1), i;
|
|
1554
1667
|
}
|
|
1555
1668
|
const { useSSO: r } = u, n = W();
|
|
1556
1669
|
if (n || r)
|
|
1557
|
-
return S("user already authenticated", n), k({ isRedirectUrl: !1 }),
|
|
1558
|
-
const { useCredentials:
|
|
1559
|
-
if (
|
|
1560
|
-
return f("Credentials are required for authentication"),
|
|
1561
|
-
if (
|
|
1670
|
+
return S("user already authenticated", n), k({ isRedirectUrl: !1 }), w(!0), !0;
|
|
1671
|
+
const { useCredentials: o } = u, { username: a, password: s } = e || {};
|
|
1672
|
+
if (o && (!a || !s))
|
|
1673
|
+
return f("Credentials are required for authentication"), w(!1), !1;
|
|
1674
|
+
if (a && s)
|
|
1562
1675
|
try {
|
|
1563
1676
|
S("authentication using credentials..."), k({ useCredentials: !0, useSSO: !1 });
|
|
1564
1677
|
const { userOverrideActive: i, useroverride: c } = u;
|
|
1565
|
-
return k({ userOverrideActive: !1, useroverride: void 0 }), await
|
|
1678
|
+
return k({ userOverrideActive: !1, useroverride: void 0 }), await st({ username: a, password: s }), k({ userOverrideActive: i, useroverride: c }), w(!0), !0;
|
|
1566
1679
|
} catch (i) {
|
|
1567
|
-
throw
|
|
1680
|
+
throw w(!1), i;
|
|
1568
1681
|
}
|
|
1569
|
-
return
|
|
1682
|
+
return w(!1), f(
|
|
1570
1683
|
"No authentication method available. Please provide credentials or configure OAuth/SAML."
|
|
1571
1684
|
), !1;
|
|
1572
|
-
},
|
|
1685
|
+
}, it = async () => {
|
|
1573
1686
|
const e = new URLSearchParams({
|
|
1574
1687
|
action: "deleteWebTokenCookie",
|
|
1575
1688
|
noUserOverride: "true",
|
|
1576
1689
|
noAutoAuthentication: "true"
|
|
1577
1690
|
}), { signal: t } = b(v);
|
|
1578
|
-
return
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1691
|
+
return m(
|
|
1692
|
+
"api/v1/challenge",
|
|
1693
|
+
e,
|
|
1694
|
+
{ signal: t }
|
|
1695
|
+
);
|
|
1696
|
+
};
|
|
1697
|
+
async function Cr() {
|
|
1698
|
+
const { userOverrideActive: e } = u;
|
|
1699
|
+
if (ct(), !e)
|
|
1582
1700
|
try {
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1701
|
+
const { methodresult: t, logoutUrl: r } = await it();
|
|
1702
|
+
if (t === "ok")
|
|
1703
|
+
return r;
|
|
1704
|
+
f("logout failed");
|
|
1705
|
+
} catch (t) {
|
|
1706
|
+
f("logout failed", t);
|
|
1586
1707
|
}
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1708
|
+
}
|
|
1709
|
+
function ct() {
|
|
1710
|
+
tt("csrfToken"), ot("sinequa-credentials"), w(!1);
|
|
1711
|
+
}
|
|
1712
|
+
const Rr = () => !!W();
|
|
1590
1713
|
export {
|
|
1591
|
-
|
|
1714
|
+
tr as API,
|
|
1592
1715
|
R as ApiError,
|
|
1593
|
-
|
|
1716
|
+
Ht as Audit,
|
|
1594
1717
|
C as AuditEventType,
|
|
1595
|
-
|
|
1718
|
+
be as DidYouMeanKind,
|
|
1596
1719
|
h as EngineType,
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1720
|
+
p as EngineTypeModifier,
|
|
1721
|
+
re as LogLevel,
|
|
1722
|
+
qt as MINIMUM_COMPATIBLE_SERVER_API_VERSION,
|
|
1723
|
+
ve as RFMDisplay,
|
|
1601
1724
|
E as ServerError,
|
|
1602
|
-
|
|
1725
|
+
_e as TimeoutError,
|
|
1603
1726
|
V as UnauthorizedError,
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1727
|
+
O as addAuditAdditionalInfo,
|
|
1728
|
+
gt as addConcepts,
|
|
1729
|
+
Ie as addSessionId,
|
|
1730
|
+
Ae as addUrl,
|
|
1731
|
+
ce as aggItemRegex,
|
|
1732
|
+
dt as aggregationItemStrictCompare,
|
|
1733
|
+
Mt as appInitializerFn,
|
|
1734
|
+
ht as bisect,
|
|
1612
1735
|
z as buildPathsAndLevels,
|
|
1613
|
-
|
|
1614
|
-
|
|
1736
|
+
ct as clearSessionTokens,
|
|
1737
|
+
$t as configureLogger,
|
|
1738
|
+
L as createHeaders,
|
|
1615
1739
|
b as createTimeoutController,
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1740
|
+
_r as createUserProfile,
|
|
1741
|
+
x as debug,
|
|
1742
|
+
Se as del,
|
|
1743
|
+
kr as deleteUserProfileProperty,
|
|
1744
|
+
gr as deleteUserSettings,
|
|
1745
|
+
it as deleteWebTokenCookie,
|
|
1746
|
+
w as emitAuthenticatedEvent,
|
|
1623
1747
|
f as error,
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1748
|
+
Gt as escapeExpr,
|
|
1749
|
+
It as expiresSoon,
|
|
1750
|
+
Ft as extraColumns,
|
|
1751
|
+
Jt as fetchAggregation,
|
|
1752
|
+
Wt as fetchApp,
|
|
1753
|
+
Be as fetchAppPreLogin,
|
|
1754
|
+
nr as fetchBulkQuery,
|
|
1755
|
+
pr as fetchChangePassword,
|
|
1756
|
+
Xt as fetchDataset,
|
|
1757
|
+
Kt as fetchDatasetList,
|
|
1758
|
+
Yt as fetchDatasets,
|
|
1759
|
+
Zt as fetchLabels,
|
|
1760
|
+
Tt as fetchPreview,
|
|
1761
|
+
er as fetchPreviewUrl,
|
|
1762
|
+
se as fetchPrincipal,
|
|
1763
|
+
We as fetchPrincipalList,
|
|
1764
|
+
Me as fetchPrincipalUserid,
|
|
1765
|
+
Xe as fetchPrincipalUserids,
|
|
1766
|
+
rr as fetchQuery,
|
|
1767
|
+
or as fetchQueryExport,
|
|
1768
|
+
ar as fetchQueryIntent,
|
|
1769
|
+
mr as fetchSendPasswordResetEmail,
|
|
1770
|
+
sr as fetchSimilarDocuments,
|
|
1771
|
+
ir as fetchSponsoredLinks,
|
|
1772
|
+
cr as fetchSuggest,
|
|
1773
|
+
ur as fetchSuggestField,
|
|
1774
|
+
lr as fetchSuggestQuery,
|
|
1775
|
+
dr as fetchTextChunks,
|
|
1776
|
+
wr as fetchUserProfile,
|
|
1777
|
+
fr as fetchUserSettings,
|
|
1778
|
+
br as fetchVersion,
|
|
1779
|
+
Bt as filter,
|
|
1780
|
+
m as get,
|
|
1781
|
+
wt as getConcepts,
|
|
1782
|
+
at as getCsrfToken,
|
|
1783
|
+
te as getFiltersFromURI,
|
|
1784
|
+
vt as getFiltersFromUrl,
|
|
1785
|
+
Lt as getHelpIndexUrl,
|
|
1786
|
+
Rt as getIdFromUrl,
|
|
1787
|
+
st as getJWToken,
|
|
1788
|
+
jt as getMetadata,
|
|
1789
|
+
Qt as getMetadataWithValues,
|
|
1790
|
+
we as getOffsetFromDates,
|
|
1791
|
+
Pt as getQueryPageFromUrl,
|
|
1792
|
+
kt as getQueryParamsFromUrl,
|
|
1793
|
+
yt as getQueryTabFromUrl,
|
|
1794
|
+
Ct as getQueryTextFromUrl,
|
|
1795
|
+
_t as getRelativeDate,
|
|
1796
|
+
$e as getTime,
|
|
1672
1797
|
W as getToken,
|
|
1673
|
-
|
|
1798
|
+
bt as getUrlParamsFromQueryParams,
|
|
1674
1799
|
u as globalConfig,
|
|
1675
|
-
|
|
1800
|
+
Ue as guid,
|
|
1676
1801
|
P as handleResponse,
|
|
1677
1802
|
S as info,
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1803
|
+
ye as isArrayBuffer,
|
|
1804
|
+
Rr as isAuthenticated,
|
|
1805
|
+
xe as isBlob,
|
|
1806
|
+
Le as isDate,
|
|
1807
|
+
Dt as isExpired,
|
|
1808
|
+
Vt as isJsonable,
|
|
1809
|
+
St as isNotInputEvent,
|
|
1810
|
+
q as isObject,
|
|
1811
|
+
Oe as isString,
|
|
1812
|
+
Et as labels,
|
|
1813
|
+
vr as login,
|
|
1814
|
+
Cr as logout,
|
|
1815
|
+
g as makeColumn,
|
|
1816
|
+
Ot as notify,
|
|
1817
|
+
ue as openParentNodes,
|
|
1693
1818
|
A as parseText,
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1819
|
+
le as parseValueAndOperatorFromItem,
|
|
1820
|
+
ke as patch,
|
|
1821
|
+
Sr as patchUserProfile,
|
|
1822
|
+
hr as patchUserSettings,
|
|
1698
1823
|
l as post,
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1824
|
+
Ut as put,
|
|
1825
|
+
y as queryParamsFromUrl,
|
|
1826
|
+
pt as removeConcept,
|
|
1827
|
+
mt as removeConcepts,
|
|
1828
|
+
Nt as resolveToColumnName,
|
|
1704
1829
|
G as rewriteText,
|
|
1705
|
-
|
|
1830
|
+
Ze as saveUserSettings,
|
|
1706
1831
|
k as setGlobalConfig,
|
|
1707
1832
|
I as setToken,
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1833
|
+
zt as sha512,
|
|
1834
|
+
ft as suggestionsToTreeAggregationNodes,
|
|
1835
|
+
xt as sysLang,
|
|
1836
|
+
ne as toDate,
|
|
1837
|
+
ut as translateAggregationToDateOptions,
|
|
1838
|
+
Ee as tryOAuthAuthentication,
|
|
1839
|
+
Te as trySAMLAuthentication,
|
|
1840
|
+
D as warn,
|
|
1841
|
+
At as withRetry
|
|
1717
1842
|
};
|