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