@sinequa/atomic 2.3.1 → 2.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/atomic.cjs +1 -1
- package/dist/atomic.js +1 -1
- package/dist/authentication/events/emit-authenticated-event.d.ts.map +1 -1
- package/dist/authentication/session/logout.d.ts.map +1 -1
- package/dist/authentication/session/signed-out-guard.d.ts +23 -0
- package/dist/authentication/session/signed-out-guard.d.ts.map +1 -0
- package/dist/spfx/index.cjs +1 -1
- package/dist/spfx/index.js +1 -1
- package/dist/src-DQYL0h7T.cjs +1 -0
- package/dist/{src-BzPBKdDO.js → src-QHeKpRHd.js} +627 -614
- package/dist/web-api/helpers/methods/send-request.d.ts.map +1 -1
- package/dist/web-api/v1/fetch-audit.d.ts +7 -0
- package/dist/web-api/v1/fetch-audit.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/src-DeaVS0Tt.cjs +0 -1
|
@@ -171,7 +171,7 @@ function le(e, t) {
|
|
|
171
171
|
remove: (e) => n.removeItem(e)
|
|
172
172
|
};
|
|
173
173
|
}
|
|
174
|
-
var
|
|
174
|
+
var h = new class {
|
|
175
175
|
client = null;
|
|
176
176
|
initialize(e) {
|
|
177
177
|
this.client = e;
|
|
@@ -187,12 +187,12 @@ var ue = new class {
|
|
|
187
187
|
return this.client !== null;
|
|
188
188
|
}
|
|
189
189
|
}();
|
|
190
|
-
function
|
|
191
|
-
|
|
190
|
+
function ue(e) {
|
|
191
|
+
h.initialize(e);
|
|
192
192
|
}
|
|
193
193
|
//#endregion
|
|
194
194
|
//#region src/client/http-adapter.ts
|
|
195
|
-
function
|
|
195
|
+
function de(e) {
|
|
196
196
|
let t = e.constructor?.configurations?.v1;
|
|
197
197
|
return { fetch(n, r) {
|
|
198
198
|
let { method: i, headers: a, body: o, signal: s } = r;
|
|
@@ -213,46 +213,58 @@ function fe(e) {
|
|
|
213
213
|
}
|
|
214
214
|
//#endregion
|
|
215
215
|
//#region src/client/atomic-context.ts
|
|
216
|
-
function
|
|
217
|
-
return
|
|
216
|
+
function fe() {
|
|
217
|
+
return h.isInitialized() ? de(h.getClient()) : void 0;
|
|
218
218
|
}
|
|
219
|
-
var
|
|
219
|
+
var g = {
|
|
220
220
|
config: m,
|
|
221
221
|
events: t,
|
|
222
222
|
storagePrefix: "",
|
|
223
|
-
resolveHttpAdapter:
|
|
223
|
+
resolveHttpAdapter: fe
|
|
224
224
|
};
|
|
225
|
-
function
|
|
225
|
+
function pe(t) {
|
|
226
226
|
let { config: n, storagePrefix: r = "", httpAdapter: i } = t;
|
|
227
227
|
return {
|
|
228
228
|
config: n,
|
|
229
229
|
events: e(),
|
|
230
230
|
storagePrefix: r,
|
|
231
|
-
resolveHttpAdapter: i ? () => i :
|
|
231
|
+
resolveHttpAdapter: i ? () => i : fe
|
|
232
232
|
};
|
|
233
233
|
}
|
|
234
|
-
function
|
|
234
|
+
function _(e) {
|
|
235
235
|
return e.config.auth?.logger ?? oe;
|
|
236
236
|
}
|
|
237
|
-
function
|
|
237
|
+
function me(e) {
|
|
238
238
|
return e.config.auth?.fetch ?? ((e, t) => fetch(e, t));
|
|
239
239
|
}
|
|
240
|
-
function
|
|
240
|
+
function he(e) {
|
|
241
241
|
return e.config.auth?.credentials ?? "include";
|
|
242
242
|
}
|
|
243
|
-
function
|
|
243
|
+
function v(e, t) {
|
|
244
244
|
return le(t, e.config.auth?.storage?.[t]);
|
|
245
245
|
}
|
|
246
|
-
function
|
|
246
|
+
function y(e, t) {
|
|
247
247
|
return `${e.storagePrefix}${t}`;
|
|
248
248
|
}
|
|
249
|
-
function
|
|
249
|
+
function b(e, t) {
|
|
250
250
|
ae(e.config, t);
|
|
251
251
|
}
|
|
252
252
|
//#endregion
|
|
253
|
+
//#region src/authentication/session/signed-out-guard.ts
|
|
254
|
+
var ge = /* @__PURE__ */ new WeakSet();
|
|
255
|
+
function _e(e) {
|
|
256
|
+
ge.add(e);
|
|
257
|
+
}
|
|
258
|
+
function ve(e) {
|
|
259
|
+
return ge.has(e);
|
|
260
|
+
}
|
|
261
|
+
function ye(e) {
|
|
262
|
+
ge.delete(e);
|
|
263
|
+
}
|
|
264
|
+
//#endregion
|
|
253
265
|
//#region src/authentication/events/emit-authenticated-event.ts
|
|
254
|
-
function
|
|
255
|
-
if (e.events.emit("authenticated", { authenticated: t }), typeof CustomEvent > "u") return;
|
|
266
|
+
function x(e, t) {
|
|
267
|
+
if (t && ye(e), e.events.emit("authenticated", { authenticated: t }), typeof CustomEvent > "u") return;
|
|
256
268
|
let n = new CustomEvent("authenticated", {
|
|
257
269
|
bubbles: !0,
|
|
258
270
|
cancelable: !1,
|
|
@@ -260,67 +272,67 @@ function b(e, t) {
|
|
|
260
272
|
});
|
|
261
273
|
typeof document < "u" ? document.dispatchEvent(n) : typeof dispatchEvent < "u" && dispatchEvent(n);
|
|
262
274
|
}
|
|
263
|
-
function
|
|
264
|
-
|
|
275
|
+
function be(e) {
|
|
276
|
+
x(g, e);
|
|
265
277
|
}
|
|
266
|
-
var
|
|
278
|
+
var S = (e) => e.config.auth?.timeoutMs ?? 1e4, C = {
|
|
267
279
|
credentials: "sinequa-credentials",
|
|
268
280
|
legacyCsrfToken: "csrfToken",
|
|
269
281
|
authenticated: "sinequa-authenticated",
|
|
270
282
|
lastAuthMode: "sinequa-last-auth-mode"
|
|
271
|
-
},
|
|
272
|
-
let t =
|
|
283
|
+
}, w = "sinequa-auth-redirect-attempt", T = (e) => {
|
|
284
|
+
let t = v(e, "session").get(y(e, C.credentials));
|
|
273
285
|
if (t) try {
|
|
274
286
|
let e = JSON.parse(t).data?.csrfToken;
|
|
275
287
|
if (typeof e == "string" && e) return e;
|
|
276
288
|
} catch (t) {
|
|
277
|
-
|
|
289
|
+
_(e).warn("Failed to parse session storage credentials, falling back to local storage", t);
|
|
278
290
|
}
|
|
279
|
-
return
|
|
280
|
-
},
|
|
291
|
+
return v(e, "local").get(y(e, C.legacyCsrfToken)) || null;
|
|
292
|
+
}, xe = () => T(g);
|
|
281
293
|
//#endregion
|
|
282
294
|
//#region src/web-api/helpers/create-headers.ts
|
|
283
|
-
function
|
|
284
|
-
let n =
|
|
295
|
+
function E(e, t) {
|
|
296
|
+
let n = T(e), r = new Headers(t);
|
|
285
297
|
r.append("Sinequa-Force-Camel-Case", "true"), r.append("accept", "application/json"), n && r.append("Sinequa-csrf-token", n);
|
|
286
298
|
let { userOverride: i, userOverrideActive: a } = e.config, o = p(e.config);
|
|
287
299
|
return o && !e.resolveHttpAdapter() && r.append("Authorization", `Bearer ${o}`), i && a && (r.append("sinequa-override-user", i.username), r.append("sinequa-override-domain", i.domain)), r;
|
|
288
300
|
}
|
|
289
|
-
function
|
|
290
|
-
return
|
|
301
|
+
function Se(e) {
|
|
302
|
+
return E(g, e);
|
|
291
303
|
}
|
|
292
304
|
//#endregion
|
|
293
305
|
//#region src/web-api/helpers/utils/build-request-url.ts
|
|
294
|
-
function
|
|
306
|
+
function D(e, t, n) {
|
|
295
307
|
let r = t.startsWith("plugin") ? `api/v1/${t}` : t, i = n ? `?${new URLSearchParams(n)}` : "", { backendUrl: a } = e.config;
|
|
296
308
|
return a ? `${a}/${r}${i}` : `${r}${i}`;
|
|
297
309
|
}
|
|
298
310
|
//#endregion
|
|
299
311
|
//#region src/web-api/helpers/errors/api-error.ts
|
|
300
|
-
var
|
|
312
|
+
var O = class extends Error {
|
|
301
313
|
status;
|
|
302
314
|
constructor(e, t) {
|
|
303
315
|
super(e), Object.setPrototypeOf(this, new.target.prototype), this.name = "ApiError", this.status = t;
|
|
304
316
|
}
|
|
305
|
-
},
|
|
317
|
+
}, k = class extends O {
|
|
306
318
|
constructor(e = "Unauthorized access") {
|
|
307
319
|
super(e, 401), this.name = "UnauthorizedError";
|
|
308
320
|
}
|
|
309
|
-
},
|
|
310
|
-
|
|
311
|
-
},
|
|
321
|
+
}, A = (e, t) => {
|
|
322
|
+
v(e, "session").set(y(e, C.credentials), JSON.stringify({ data: { csrfToken: t } })), e.events.emit("tokenRefreshed", { token: t });
|
|
323
|
+
}, Ce = (e) => A(g, e), we = class extends O {
|
|
312
324
|
constructor(e = "Server error") {
|
|
313
325
|
super(e, 500), this.name = "ServerError";
|
|
314
326
|
}
|
|
315
327
|
};
|
|
316
328
|
//#endregion
|
|
317
329
|
//#region src/web-api/helpers/handle-response.ts
|
|
318
|
-
async function
|
|
319
|
-
return
|
|
330
|
+
async function Te(e, t = "json") {
|
|
331
|
+
return j(g, e, t);
|
|
320
332
|
}
|
|
321
|
-
async function
|
|
333
|
+
async function j(e, t, n = "json", r = t.url ?? "") {
|
|
322
334
|
let i = t.headers.get("sinequa-jwt-refresh");
|
|
323
|
-
if (i !== null &&
|
|
335
|
+
if (i !== null && A(e, i), t.status >= 200 && t.status < 300) {
|
|
324
336
|
if (n === "response") return t;
|
|
325
337
|
let e = t.headers.get("content-length");
|
|
326
338
|
if (t.status === 204 || e === "0") return;
|
|
@@ -337,16 +349,16 @@ async function A(e, t, n = "json", r = t.url ?? "") {
|
|
|
337
349
|
try {
|
|
338
350
|
n = await (t.clone?.() ?? t).json();
|
|
339
351
|
} catch {}
|
|
340
|
-
throw
|
|
352
|
+
throw _(e).warn("Unauthorized access attempt with user override", {
|
|
341
353
|
endpoint: t.url ?? "",
|
|
342
354
|
error: n
|
|
343
|
-
}), new
|
|
355
|
+
}), new k(n.errorMessage ?? n.message ?? "Unauthorized... User override failed.");
|
|
344
356
|
}
|
|
345
|
-
return await
|
|
357
|
+
return await Ee(e, t, 401, r);
|
|
346
358
|
}
|
|
347
|
-
return t.status === 500 ? (
|
|
359
|
+
return t.status === 500 ? (_(e).error("Server error occurred", { endpoint: r }), await Ee(e, t, 500, r)) : (_(e).warn(`Unexpected response status: ${t.status}`, { endpoint: r }), await Ee(e, t, t.status, r));
|
|
348
360
|
}
|
|
349
|
-
async function
|
|
361
|
+
async function Ee(e, t, n, r) {
|
|
350
362
|
let i = "";
|
|
351
363
|
try {
|
|
352
364
|
i = await t.text() ?? "";
|
|
@@ -359,64 +371,65 @@ async function Ce(e, t, n, r) {
|
|
|
359
371
|
errorCodeText: e.errorCodeText
|
|
360
372
|
};
|
|
361
373
|
} catch {}
|
|
362
|
-
let s = n === 401 ? new
|
|
374
|
+
let s = n === 401 ? new k(a) : n === 500 ? new we(a) : new O(a ?? `Request failed with status ${n}`, n);
|
|
363
375
|
throw o && (s.cause = o), e.events.emit("requestFailed", {
|
|
364
376
|
endpoint: r,
|
|
365
377
|
status: n,
|
|
366
378
|
error: s
|
|
367
|
-
}), s instanceof
|
|
379
|
+
}), s instanceof k && e.events.emit("unauthorized", {
|
|
368
380
|
endpoint: r,
|
|
369
381
|
error: s
|
|
370
382
|
}), s;
|
|
371
383
|
}
|
|
372
384
|
//#endregion
|
|
373
385
|
//#region src/web-api/helpers/utils/resolve-no-auto-authentication.ts
|
|
374
|
-
function
|
|
386
|
+
function M(e) {
|
|
375
387
|
return e.config.authMode?.kind !== "sso";
|
|
376
388
|
}
|
|
377
|
-
function
|
|
378
|
-
return
|
|
389
|
+
function De() {
|
|
390
|
+
return M(g);
|
|
379
391
|
}
|
|
380
392
|
//#endregion
|
|
381
393
|
//#region src/web-api/helpers/methods/send-request.ts
|
|
382
|
-
var
|
|
383
|
-
function
|
|
384
|
-
let r =
|
|
394
|
+
var Oe = /* @__PURE__ */ new WeakMap();
|
|
395
|
+
function ke(e, t, n) {
|
|
396
|
+
let r = Oe.get(e);
|
|
385
397
|
if (r) return r;
|
|
398
|
+
if (ve(e)) return _(e).debug(`Skipping session recovery for ${t}: the user signed out`), Promise.resolve(!1);
|
|
386
399
|
let i = e.config.auth?.recoverFromUnauthorized;
|
|
387
400
|
if (!i) return Promise.resolve(!1);
|
|
388
401
|
let a = Promise.resolve(i({
|
|
389
402
|
endpoint: t,
|
|
390
403
|
error: n
|
|
391
|
-
})).catch((t) => (
|
|
392
|
-
return
|
|
404
|
+
})).catch((t) => (_(e).debug("Session recovery failed", t), !1)).finally(() => Oe.delete(e));
|
|
405
|
+
return Oe.set(e, a), a;
|
|
393
406
|
}
|
|
394
|
-
async function
|
|
407
|
+
async function Ae(e, t, n, r) {
|
|
395
408
|
let i = e.resolveHttpAdapter();
|
|
396
|
-
return i ?
|
|
409
|
+
return i ? j(e, await i.fetch(t, {
|
|
397
410
|
...n,
|
|
398
411
|
signal: r?.signal
|
|
399
|
-
}), r?.responseType, t) :
|
|
412
|
+
}), r?.responseType, t) : j(e, await me(e)(t, {
|
|
400
413
|
...n,
|
|
401
|
-
credentials:
|
|
414
|
+
credentials: he(e),
|
|
402
415
|
signal: r?.signal,
|
|
403
416
|
redirect: r?.redirect
|
|
404
417
|
}), r?.responseType, t);
|
|
405
418
|
}
|
|
406
|
-
async function
|
|
419
|
+
async function N(e, t, n, r) {
|
|
407
420
|
try {
|
|
408
|
-
return await
|
|
421
|
+
return await Ae(e, t, n, r);
|
|
409
422
|
} catch (i) {
|
|
410
|
-
if (!(i instanceof
|
|
411
|
-
|
|
412
|
-
let a = new Headers(n.headers), o =
|
|
413
|
-
return o && a.set("Sinequa-csrf-token", o),
|
|
423
|
+
if (!(i instanceof k) || r?.noRecovery || !await ke(e, t, i)) throw i;
|
|
424
|
+
_(e).debug("Session recovered — replaying the request once");
|
|
425
|
+
let a = new Headers(n.headers), o = T(e);
|
|
426
|
+
return o && a.set("Sinequa-csrf-token", o), Ae(e, t, {
|
|
414
427
|
...n,
|
|
415
428
|
headers: a
|
|
416
429
|
}, r);
|
|
417
430
|
}
|
|
418
431
|
}
|
|
419
|
-
function
|
|
432
|
+
function P(e, t, n) {
|
|
420
433
|
let { uiLanguage: r } = e.config;
|
|
421
434
|
return JSON.stringify({
|
|
422
435
|
app: e.config.app,
|
|
@@ -424,42 +437,42 @@ function N(e, t, n) {
|
|
|
424
437
|
locale: t.locale || r || navigator.language,
|
|
425
438
|
...r ? { "ui-language": r } : {},
|
|
426
439
|
noUserOverride: !e.config.userOverrideActive,
|
|
427
|
-
noAutoAuthentication: n?.noAutoAuthentication ??
|
|
440
|
+
noAutoAuthentication: n?.noAutoAuthentication ?? M(e)
|
|
428
441
|
});
|
|
429
442
|
}
|
|
430
443
|
//#endregion
|
|
431
444
|
//#region src/web-api/helpers/methods/post.ts
|
|
432
|
-
async function
|
|
433
|
-
let i =
|
|
445
|
+
async function F(e, t, n, r) {
|
|
446
|
+
let i = E(e, r?.headers);
|
|
434
447
|
i.has("Content-Type") || i.set("Content-Type", "application/json");
|
|
435
|
-
let a =
|
|
436
|
-
|
|
448
|
+
let a = D(e, t);
|
|
449
|
+
_(e).debug(`Making POST request to: ${a}`);
|
|
437
450
|
try {
|
|
438
|
-
return await
|
|
451
|
+
return await N(e, a, {
|
|
439
452
|
method: "POST",
|
|
440
453
|
headers: i,
|
|
441
|
-
body:
|
|
454
|
+
body: P(e, n, r)
|
|
442
455
|
}, r);
|
|
443
456
|
} catch (t) {
|
|
444
|
-
throw
|
|
457
|
+
throw _(e).error("Error making POST request:", t), t;
|
|
445
458
|
}
|
|
446
459
|
}
|
|
447
|
-
async function
|
|
448
|
-
return
|
|
460
|
+
async function je(e, t, n) {
|
|
461
|
+
return F(g, e, t, n);
|
|
449
462
|
}
|
|
450
463
|
//#endregion
|
|
451
464
|
//#region src/web-api/helpers/errors/timeout-error.ts
|
|
452
|
-
var
|
|
465
|
+
var Me = class extends O {
|
|
453
466
|
constructor(e = "Request timed out") {
|
|
454
467
|
super(e, 408), this.name = "TimeoutError";
|
|
455
468
|
}
|
|
456
469
|
};
|
|
457
470
|
//#endregion
|
|
458
471
|
//#region src/web-api/helpers/utils/create-timeout-controller.ts
|
|
459
|
-
function
|
|
472
|
+
function I(e) {
|
|
460
473
|
let t = new AbortController(), { signal: n } = t;
|
|
461
474
|
return e && setTimeout(() => {
|
|
462
|
-
n.aborted || t.abort(new
|
|
475
|
+
n.aborted || t.abort(new Me(`Request timed out after ${e}ms`));
|
|
463
476
|
}, e), {
|
|
464
477
|
controller: t,
|
|
465
478
|
signal: n
|
|
@@ -467,7 +480,7 @@ function F(e) {
|
|
|
467
480
|
}
|
|
468
481
|
//#endregion
|
|
469
482
|
//#region src/authentication/providers/redirect-to-identity-provider.ts
|
|
470
|
-
var
|
|
483
|
+
var Ne = {
|
|
471
484
|
oauth: {
|
|
472
485
|
label: "OAuth",
|
|
473
486
|
endpoint: "api/v1/security.oauth",
|
|
@@ -479,8 +492,8 @@ var Ae = {
|
|
|
479
492
|
action: "getresponse"
|
|
480
493
|
}
|
|
481
494
|
};
|
|
482
|
-
async function
|
|
483
|
-
let { label: r, endpoint: i, action: a } =
|
|
495
|
+
async function Pe(e, { kind: t, provider: n }) {
|
|
496
|
+
let { label: r, endpoint: i, action: a } = Ne[t], o = typeof window < "u", s = v(e, "session"), c = y(e, w);
|
|
484
497
|
if (o && s.get(c)) throw Error(`${r} sign-in with provider "${n}" did not establish a session — its callback is likely not authorized for this application.`);
|
|
485
498
|
let l = {
|
|
486
499
|
action: a,
|
|
@@ -489,10 +502,10 @@ async function je(e, { kind: t, provider: n }) {
|
|
|
489
502
|
originalUrl: typeof window > "u" ? "http://localhost" : window.location.href
|
|
490
503
|
}, u;
|
|
491
504
|
try {
|
|
492
|
-
let { signal: t } =
|
|
493
|
-
u = await
|
|
505
|
+
let { signal: t } = I(S(e));
|
|
506
|
+
u = await F(e, i, l, { signal: t });
|
|
494
507
|
} catch (t) {
|
|
495
|
-
throw
|
|
508
|
+
throw _(e).error(`Failed to authenticate with ${r}`, t), t;
|
|
496
509
|
}
|
|
497
510
|
if (!o || !u.redirectUrl) return u;
|
|
498
511
|
let d = new URL(u.redirectUrl, window.location.origin);
|
|
@@ -500,24 +513,24 @@ async function je(e, { kind: t, provider: n }) {
|
|
|
500
513
|
}
|
|
501
514
|
//#endregion
|
|
502
515
|
//#region src/authentication/providers/oauth-authentication.ts
|
|
503
|
-
var
|
|
516
|
+
var Fe = async (e) => {
|
|
504
517
|
let t = ee(e.config);
|
|
505
518
|
if (!t) throw Error("No OAuth provider configured: set `authMode: AuthMode.oauth(provider)`, or the `autoOAuthProvider` key.");
|
|
506
|
-
return
|
|
519
|
+
return Pe(e, {
|
|
507
520
|
kind: "oauth",
|
|
508
521
|
provider: t
|
|
509
522
|
});
|
|
510
|
-
},
|
|
523
|
+
}, Ie = () => Fe(g), Le = async (e) => {
|
|
511
524
|
let t = te(e.config);
|
|
512
525
|
if (!t) throw Error("No SAML provider configured: set `authMode: AuthMode.saml(provider)`, or the `autoSAMLProvider` key.");
|
|
513
|
-
return
|
|
526
|
+
return Pe(e, {
|
|
514
527
|
kind: "saml",
|
|
515
528
|
provider: t
|
|
516
529
|
});
|
|
517
|
-
},
|
|
530
|
+
}, Re = () => Le(g);
|
|
518
531
|
//#endregion
|
|
519
532
|
//#region src/authentication/session/detect-auth-mode.ts
|
|
520
|
-
function
|
|
533
|
+
function ze(e, t) {
|
|
521
534
|
if (e.authMode && e.authMode.kind !== "unknown") return e.authMode;
|
|
522
535
|
if (e.bearerToken) return f.bearer(e.bearerToken);
|
|
523
536
|
let n = e.autoOAuthProvider || t?.autoOAuthProvider;
|
|
@@ -527,63 +540,63 @@ function Ie(e, t) {
|
|
|
527
540
|
}
|
|
528
541
|
//#endregion
|
|
529
542
|
//#region src/web-api/helpers/methods/get.ts
|
|
530
|
-
async function
|
|
531
|
-
let i =
|
|
543
|
+
async function L(e, t, n, r) {
|
|
544
|
+
let i = E(e, r?.headers), a = n;
|
|
532
545
|
r?.noAutoAuthentication !== void 0 && (a = new URLSearchParams(n), a.set("noAutoAuthentication", String(r.noAutoAuthentication)));
|
|
533
|
-
let o =
|
|
534
|
-
|
|
546
|
+
let o = D(e, t, a);
|
|
547
|
+
_(e).debug(`Making GET request to: ${o}`);
|
|
535
548
|
try {
|
|
536
|
-
return await
|
|
549
|
+
return await N(e, o, {
|
|
537
550
|
method: "GET",
|
|
538
551
|
headers: i
|
|
539
552
|
}, r);
|
|
540
553
|
} catch (t) {
|
|
541
|
-
throw
|
|
554
|
+
throw _(e).error("Error making GET request:", t), t;
|
|
542
555
|
}
|
|
543
556
|
}
|
|
544
|
-
async function
|
|
545
|
-
return
|
|
557
|
+
async function Be(e, t, n) {
|
|
558
|
+
return L(g, e, t, n);
|
|
546
559
|
}
|
|
547
560
|
//#endregion
|
|
548
561
|
//#region src/authentication/tokens/get-csrf-token.ts
|
|
549
|
-
var
|
|
562
|
+
var Ve = async (e) => {
|
|
550
563
|
let t;
|
|
551
564
|
try {
|
|
552
|
-
let { signal: n } =
|
|
553
|
-
t = await
|
|
565
|
+
let { signal: n } = I(S(e));
|
|
566
|
+
t = await L(e, "api/v1/challenge?action=getCsrfToken&suppressErrors=true", void 0, {
|
|
554
567
|
signal: n,
|
|
555
568
|
noRecovery: !0
|
|
556
569
|
});
|
|
557
570
|
} catch (t) {
|
|
558
|
-
throw
|
|
571
|
+
throw _(e).warn("CSRF token fetch failed", t), t;
|
|
559
572
|
}
|
|
560
|
-
return t?.csrfToken ? (
|
|
561
|
-
},
|
|
573
|
+
return t?.csrfToken ? (A(e, t.csrfToken), t.csrfToken) : null;
|
|
574
|
+
}, He = () => Ve(g);
|
|
562
575
|
//#endregion
|
|
563
576
|
//#region src/authentication/session/has-session.ts
|
|
564
|
-
async function
|
|
565
|
-
if (
|
|
577
|
+
async function Ue(e) {
|
|
578
|
+
if (T(e)) return _(e).info("Existing session (stored token)"), We(e), !0;
|
|
566
579
|
try {
|
|
567
|
-
return
|
|
580
|
+
return _(e).info("Checking for an existing session via CSRF token retrieval"), await Ve(e) === null ? !1 : (We(e), !0);
|
|
568
581
|
} catch (t) {
|
|
569
|
-
return
|
|
582
|
+
return _(e).debug("CSRF session probe failed — treated as no existing session", t), !1;
|
|
570
583
|
}
|
|
571
584
|
}
|
|
572
|
-
function
|
|
573
|
-
|
|
585
|
+
function We(e) {
|
|
586
|
+
v(e, "session").remove(y(e, w));
|
|
574
587
|
}
|
|
575
|
-
var
|
|
588
|
+
var Ge = () => Ue(g);
|
|
576
589
|
//#endregion
|
|
577
590
|
//#region src/helpers/ts-helper.ts
|
|
578
|
-
function
|
|
591
|
+
function Ke(e) {
|
|
579
592
|
throw Error(`Unexpected value: ${JSON.stringify(e)}`);
|
|
580
593
|
}
|
|
581
594
|
//#endregion
|
|
582
595
|
//#region src/authentication/tokens/get-jwt-token.ts
|
|
583
|
-
async function
|
|
596
|
+
async function qe(e, t, n) {
|
|
584
597
|
if (t) {
|
|
585
598
|
let { username: n, password: r } = t;
|
|
586
|
-
return
|
|
599
|
+
return Xe(e, {
|
|
587
600
|
action: "get",
|
|
588
601
|
tokenInCookie: !0,
|
|
589
602
|
user: n,
|
|
@@ -591,284 +604,284 @@ async function We(e, t, n) {
|
|
|
591
604
|
}, !0, "Failed to get JWT");
|
|
592
605
|
}
|
|
593
606
|
if (!p(e.config)) throw Error("A bearer token is required for credential-less authentication: set `authMode: AuthMode.bearer(token)`, or the legacy `bearerToken` key.");
|
|
594
|
-
return
|
|
607
|
+
return Xe(e, {
|
|
595
608
|
action: "get",
|
|
596
609
|
tokenInCookie: !0
|
|
597
610
|
}, !1, "Failed to get JWT without credentials", n?.recoverable);
|
|
598
611
|
}
|
|
599
|
-
async function
|
|
600
|
-
return
|
|
612
|
+
async function Je(e) {
|
|
613
|
+
return qe(g, e);
|
|
601
614
|
}
|
|
602
|
-
var
|
|
603
|
-
async function
|
|
615
|
+
var Ye = Je;
|
|
616
|
+
async function Xe(e, t, n, r, i = !1) {
|
|
604
617
|
try {
|
|
605
|
-
let { signal: r } =
|
|
618
|
+
let { signal: r } = I(S(e)), i = await F(e, "api/v1/security.webtoken", t, {
|
|
606
619
|
signal: r,
|
|
607
620
|
noAutoAuthentication: n,
|
|
608
621
|
noRecovery: !0
|
|
609
622
|
});
|
|
610
|
-
return i?.csrfToken ? (
|
|
623
|
+
return i?.csrfToken ? (A(e, i.csrfToken), i.csrfToken) : null;
|
|
611
624
|
} catch (t) {
|
|
612
|
-
throw
|
|
625
|
+
throw _(e)[i ? "debug" : "error"](r, t), t;
|
|
613
626
|
}
|
|
614
627
|
}
|
|
615
628
|
//#endregion
|
|
616
629
|
//#region src/authentication/session/auth-mode-marker.ts
|
|
617
|
-
var
|
|
618
|
-
storage:
|
|
619
|
-
key:
|
|
620
|
-
}),
|
|
621
|
-
let { storage: t, key: n } =
|
|
630
|
+
var Ze = (e) => ({
|
|
631
|
+
storage: v(e, "local"),
|
|
632
|
+
key: y(e, C.lastAuthMode)
|
|
633
|
+
}), Qe = (e) => {
|
|
634
|
+
let { storage: t, key: n } = Ze(e);
|
|
622
635
|
t.set(n, "credentials");
|
|
623
|
-
},
|
|
624
|
-
let { storage: t, key: n } =
|
|
636
|
+
}, $e = (e) => {
|
|
637
|
+
let { storage: t, key: n } = Ze(e);
|
|
625
638
|
return t.get(n) === "credentials";
|
|
626
|
-
},
|
|
627
|
-
let { storage: t, key: n } =
|
|
639
|
+
}, et = (e) => {
|
|
640
|
+
let { storage: t, key: n } = Ze(e);
|
|
628
641
|
t.remove(n);
|
|
629
|
-
},
|
|
630
|
-
let n =
|
|
642
|
+
}, tt = (e, t) => {
|
|
643
|
+
let n = v(e, "session"), r = y(e, C.authenticated);
|
|
631
644
|
t ? n.set(r, "true") : n.remove(r);
|
|
632
|
-
},
|
|
645
|
+
}, nt = (e) => v(e, "session").get(y(e, C.authenticated)) === "true", rt = "api/v1/principal", it = async (e) => {
|
|
633
646
|
try {
|
|
634
|
-
let { signal: t } =
|
|
635
|
-
return await
|
|
647
|
+
let { signal: t } = I(S(e));
|
|
648
|
+
return await L(e, e.config.auth?.probeEndpoint ?? rt, new URLSearchParams({ action: "get" }), {
|
|
636
649
|
signal: t,
|
|
637
650
|
redirect: "manual",
|
|
638
651
|
noRecovery: !0
|
|
639
|
-
}),
|
|
652
|
+
}), _(e).info("Protected endpoint accepted the request"), !0;
|
|
640
653
|
} catch (t) {
|
|
641
|
-
return
|
|
654
|
+
return _(e).debug("Protected-endpoint probe failed — not authenticated", t), !1;
|
|
642
655
|
}
|
|
643
|
-
},
|
|
644
|
-
if (
|
|
645
|
-
let t =
|
|
646
|
-
|
|
656
|
+
}, at = () => it(g), ot = (e) => e.resolveHttpAdapter() ? f.sso() : $e(e) ? f.credentials() : f.sso(), st = (e, t) => {
|
|
657
|
+
if (v(e, "session").remove(y(e, w)), t.kind === "unknown") {
|
|
658
|
+
let t = ot(e);
|
|
659
|
+
_(e).info(`Ambiguous auth mode resolved to "${t.kind}"`), b(e, { authMode: t });
|
|
647
660
|
}
|
|
648
|
-
return
|
|
649
|
-
},
|
|
661
|
+
return x(e, !0), !0;
|
|
662
|
+
}, ct = async (e) => await it(e) ? (_(e).info("User authenticated by the server (ambient SSO / OIDC)"), await Ve(e).catch((t) => _(e).debug("Best-effort CSRF refresh after auto-authentication failed", t)), tt(e, !0), !0) : !1, lt = async (e, t) => {
|
|
650
663
|
if (t) {
|
|
651
664
|
let { username: n, password: r } = t;
|
|
652
|
-
return !n || !r ? (
|
|
665
|
+
return !n || !r ? (_(e).error("Credentials are required for authentication"), x(e, !1), !1) : dt(e, {
|
|
653
666
|
username: n,
|
|
654
667
|
password: r
|
|
655
668
|
});
|
|
656
669
|
}
|
|
657
670
|
let n = e.config.authMode ?? f.unknown();
|
|
658
|
-
if (n.kind === "bearer") return
|
|
659
|
-
if (await
|
|
671
|
+
if (n.kind === "bearer") return ft(e, n);
|
|
672
|
+
if (await Ue(e)) return _(e).info("User already authenticated (existing session)"), st(e, n);
|
|
660
673
|
switch (n.kind) {
|
|
661
|
-
case "credentials": return
|
|
662
|
-
case "oauth": return
|
|
663
|
-
case "saml": return
|
|
664
|
-
case "sso": return
|
|
674
|
+
case "credentials": return x(e, !1), !1;
|
|
675
|
+
case "oauth": return _(e).info("Initiating OAuth authentication flow"), await Fe(e), x(e, !1), !1;
|
|
676
|
+
case "saml": return _(e).info("Initiating SAML authentication flow"), await Le(e), x(e, !1), !1;
|
|
677
|
+
case "sso": return _(e).info("Letting the server authenticate the request (ambient SSO)"), await ct(e) ? st(e, n) : (x(e, !1), !1);
|
|
665
678
|
case "unknown":
|
|
666
|
-
if (
|
|
679
|
+
if (_(e).info("No provider declared — probing for server-side auto-authentication"), await ct(e)) {
|
|
667
680
|
let t = f.sso();
|
|
668
|
-
return
|
|
681
|
+
return b(e, { authMode: t }), st(e, t);
|
|
669
682
|
}
|
|
670
|
-
return
|
|
671
|
-
default: return
|
|
683
|
+
return _(e).info("No provider, no session and no server-side authentication — falling back to the credentials form"), b(e, { authMode: f.credentials() }), x(e, !1), !1;
|
|
684
|
+
default: return Ke(n);
|
|
672
685
|
}
|
|
673
|
-
},
|
|
674
|
-
async function
|
|
675
|
-
|
|
686
|
+
}, ut = (e) => lt(g, e);
|
|
687
|
+
async function dt(e, t) {
|
|
688
|
+
_(e).info("Attempting authentication using credentials"), b(e, { authMode: f.credentials() }), Qe(e);
|
|
676
689
|
let { userOverrideActive: n, userOverride: r } = e.config;
|
|
677
|
-
|
|
690
|
+
b(e, {
|
|
678
691
|
userOverrideActive: !1,
|
|
679
692
|
userOverride: void 0
|
|
680
693
|
});
|
|
681
694
|
try {
|
|
682
|
-
await
|
|
695
|
+
await qe(e, t);
|
|
683
696
|
} catch (t) {
|
|
684
|
-
throw
|
|
697
|
+
throw x(e, !1), t;
|
|
685
698
|
} finally {
|
|
686
|
-
|
|
699
|
+
b(e, {
|
|
687
700
|
userOverrideActive: n,
|
|
688
701
|
userOverride: r
|
|
689
702
|
});
|
|
690
703
|
}
|
|
691
|
-
return
|
|
704
|
+
return x(e, !0), !0;
|
|
692
705
|
}
|
|
693
|
-
async function
|
|
694
|
-
if (
|
|
706
|
+
async function ft(e, t) {
|
|
707
|
+
if (_(e).info("Attempting authentication using bearer token"), !p(e.config)) throw x(e, !1), Error("Bearer mode requires a token: set `authMode: AuthMode.bearer(token)`, or the legacy `bearerToken` key.");
|
|
695
708
|
if (t.sessionCookie !== !1) try {
|
|
696
|
-
if (await
|
|
709
|
+
if (await qe(e, void 0, { recoverable: !0 })) return _(e).info("Bearer token exchanged for a server session"), x(e, !0), !0;
|
|
697
710
|
} catch (t) {
|
|
698
|
-
|
|
711
|
+
_(e).info("The server refused to exchange the bearer token for a session — continuing with the token alone. Requests this library issues stay authenticated, but what the browser loads by itself (document previews and their sub-resources, thumbnails, /xdownload links) cannot be. Allow the `webtoken` JSON method for this access token to get a session cookie, or set `AuthMode.bearer(token, { sessionCookie: false })` to stop asking.", t);
|
|
699
712
|
}
|
|
700
|
-
if (!await
|
|
701
|
-
return
|
|
713
|
+
if (!await it(e)) throw x(e, !1), Error("The server refused the configured bearer token: it may be expired or revoked, or its JSON method rules may not allow the probe endpoint (see `auth.probeEndpoint`).");
|
|
714
|
+
return tt(e, !0), x(e, !0), !0;
|
|
702
715
|
}
|
|
703
716
|
//#endregion
|
|
704
717
|
//#region src/authentication/tokens/delete-web-token-cookie.ts
|
|
705
|
-
var
|
|
718
|
+
var pt = async (e) => {
|
|
706
719
|
let t = new URLSearchParams({
|
|
707
720
|
action: "deleteWebTokenCookie",
|
|
708
721
|
noUserOverride: "true"
|
|
709
|
-
}), { signal: n } =
|
|
710
|
-
return
|
|
722
|
+
}), { signal: n } = I(S(e));
|
|
723
|
+
return L(e, "api/v1/challenge", t, {
|
|
711
724
|
signal: n,
|
|
712
725
|
noAutoAuthentication: !0,
|
|
713
726
|
noRecovery: !0
|
|
714
727
|
});
|
|
715
|
-
},
|
|
728
|
+
}, mt = () => pt(g);
|
|
716
729
|
//#endregion
|
|
717
730
|
//#region src/authentication/session/logout.ts
|
|
718
|
-
async function
|
|
731
|
+
async function ht(e) {
|
|
719
732
|
let { userOverrideActive: t } = e.config;
|
|
720
|
-
if (
|
|
721
|
-
let { methodresult: t, logoutUrl: n } = await
|
|
733
|
+
if (_t(e), et(e), v(e, "session").remove(y(e, w)), _e(e), e.events.emit("loggedOut", {}), !t) try {
|
|
734
|
+
let { methodresult: t, logoutUrl: n } = await pt(e);
|
|
722
735
|
if (t === "ok") return n;
|
|
723
|
-
|
|
736
|
+
_(e).error("logout failed");
|
|
724
737
|
} catch (t) {
|
|
725
|
-
|
|
738
|
+
_(e).error("logout failed", t);
|
|
726
739
|
}
|
|
727
740
|
}
|
|
728
|
-
async function
|
|
729
|
-
return
|
|
741
|
+
async function gt() {
|
|
742
|
+
return ht(g);
|
|
730
743
|
}
|
|
731
|
-
function
|
|
732
|
-
|
|
744
|
+
function _t(e) {
|
|
745
|
+
v(e, "local").remove(y(e, C.legacyCsrfToken)), v(e, "session").remove(y(e, C.credentials)), tt(e, !1), x(e, !1);
|
|
733
746
|
}
|
|
734
|
-
function
|
|
735
|
-
|
|
747
|
+
function vt() {
|
|
748
|
+
_t(g);
|
|
736
749
|
}
|
|
737
750
|
//#endregion
|
|
738
751
|
//#region src/authentication/session/redirect-guard.ts
|
|
739
|
-
function
|
|
740
|
-
return
|
|
752
|
+
function yt(e) {
|
|
753
|
+
return v(e, "session").get(y(e, w)) !== null;
|
|
741
754
|
}
|
|
742
|
-
var
|
|
755
|
+
var bt = () => yt(g), xt = (e) => !!T(e) || nt(e), St = () => xt(g);
|
|
743
756
|
//#endregion
|
|
744
757
|
//#region src/web-api/helpers/methods/del.ts
|
|
745
|
-
async function
|
|
746
|
-
let i =
|
|
747
|
-
r?.body && (i.has("Content-Type") || i.set("Content-Type", "application/json"), o =
|
|
758
|
+
async function R(e, t, n, r) {
|
|
759
|
+
let i = E(e, r?.headers), a = D(e, t, n), o;
|
|
760
|
+
r?.body && (i.has("Content-Type") || i.set("Content-Type", "application/json"), o = P(e, r.body, r)), _(e).debug(`Making DELETE request to: ${a}`);
|
|
748
761
|
try {
|
|
749
|
-
return await
|
|
762
|
+
return await N(e, a, {
|
|
750
763
|
method: "DELETE",
|
|
751
764
|
headers: i,
|
|
752
765
|
body: o
|
|
753
766
|
}, r);
|
|
754
767
|
} catch (t) {
|
|
755
|
-
throw
|
|
768
|
+
throw _(e).error("Error making DELETE request:", t), t;
|
|
756
769
|
}
|
|
757
770
|
}
|
|
758
|
-
async function
|
|
759
|
-
return
|
|
771
|
+
async function Ct(e, t, n) {
|
|
772
|
+
return R(g, e, t, n);
|
|
760
773
|
}
|
|
761
774
|
//#endregion
|
|
762
775
|
//#region src/web-api/helpers/methods/patch.ts
|
|
763
|
-
async function
|
|
764
|
-
let i =
|
|
776
|
+
async function z(e, t, n, r) {
|
|
777
|
+
let i = E(e, r?.headers);
|
|
765
778
|
i.append("content-type", "application/json");
|
|
766
|
-
let a =
|
|
767
|
-
|
|
779
|
+
let a = D(e, t);
|
|
780
|
+
_(e).debug(`Making PATCH request to: ${a}`);
|
|
768
781
|
try {
|
|
769
|
-
return await
|
|
782
|
+
return await N(e, a, {
|
|
770
783
|
method: "PATCH",
|
|
771
784
|
headers: i,
|
|
772
|
-
body:
|
|
785
|
+
body: P(e, n, r)
|
|
773
786
|
}, r);
|
|
774
787
|
} catch (t) {
|
|
775
|
-
throw
|
|
788
|
+
throw _(e).error("Error making PATCH request:", t), t;
|
|
776
789
|
}
|
|
777
790
|
}
|
|
778
|
-
async function
|
|
779
|
-
return
|
|
791
|
+
async function wt(e, t, n) {
|
|
792
|
+
return z(g, e, t, n);
|
|
780
793
|
}
|
|
781
794
|
//#endregion
|
|
782
795
|
//#region src/web-api/helpers/methods/put.ts
|
|
783
|
-
async function
|
|
784
|
-
let i =
|
|
796
|
+
async function B(e, t, n, r) {
|
|
797
|
+
let i = E(e, r?.headers);
|
|
785
798
|
i.has("Content-Type") || i.set("Content-Type", "application/json");
|
|
786
|
-
let a =
|
|
787
|
-
|
|
799
|
+
let a = D(e, t);
|
|
800
|
+
_(e).debug(`Making PUT request to: ${a}`);
|
|
788
801
|
try {
|
|
789
|
-
return await
|
|
802
|
+
return await N(e, a, {
|
|
790
803
|
method: "PUT",
|
|
791
804
|
headers: i,
|
|
792
|
-
body:
|
|
805
|
+
body: P(e, n, r)
|
|
793
806
|
}, r);
|
|
794
807
|
} catch (t) {
|
|
795
|
-
throw
|
|
808
|
+
throw _(e).error("Error making PUT request:", t), t;
|
|
796
809
|
}
|
|
797
810
|
}
|
|
798
|
-
async function
|
|
799
|
-
return
|
|
811
|
+
async function Tt(e, t, n) {
|
|
812
|
+
return B(g, e, t, n);
|
|
800
813
|
}
|
|
801
814
|
//#endregion
|
|
802
815
|
//#region src/web-api/v1/fetch-app.ts
|
|
803
|
-
async function
|
|
816
|
+
async function Et(e, t = g) {
|
|
804
817
|
let n = e || t.config.app;
|
|
805
|
-
return
|
|
818
|
+
return L(t, "api/v1/app", new URLSearchParams({ app: n || "" }));
|
|
806
819
|
}
|
|
807
|
-
async function
|
|
820
|
+
async function Dt(e = g) {
|
|
808
821
|
let { app: t } = e.config;
|
|
809
|
-
return
|
|
822
|
+
return L(e, "api/v1/app", new URLSearchParams({
|
|
810
823
|
app: t || "",
|
|
811
824
|
preLogin: "true"
|
|
812
825
|
}));
|
|
813
826
|
}
|
|
814
|
-
function
|
|
827
|
+
function Ot(e = g) {
|
|
815
828
|
let { backendUrl: t, app: n } = e.config;
|
|
816
829
|
if (typeof window < "u") {
|
|
817
830
|
if (t ||= window.location.origin, !n) {
|
|
818
831
|
let e = window.location.pathname.match(/\/app(?:-debug)?\/([^/#]+)/);
|
|
819
832
|
e && (n = e[1]);
|
|
820
833
|
}
|
|
821
|
-
|
|
834
|
+
b(e, {
|
|
822
835
|
backendUrl: t,
|
|
823
836
|
app: n
|
|
824
837
|
});
|
|
825
838
|
}
|
|
826
|
-
return e.config.authMode?.kind === "credentials" ? (
|
|
839
|
+
return e.config.authMode?.kind === "credentials" ? (b(e, {
|
|
827
840
|
authMode: f.credentials(),
|
|
828
841
|
autoOAuthProvider: void 0,
|
|
829
842
|
autoSAMLProvider: void 0,
|
|
830
843
|
bearerToken: void 0
|
|
831
|
-
}), Promise.resolve({})) :
|
|
832
|
-
authMode:
|
|
844
|
+
}), Promise.resolve({})) : Dt(e).then((t) => (b(e, {
|
|
845
|
+
authMode: ze(e.config, t),
|
|
833
846
|
autoOAuthProvider: e.config.autoOAuthProvider || t.autoOAuthProvider,
|
|
834
847
|
autoSAMLProvider: e.config.autoSAMLProvider || t.autoSAMLProvider
|
|
835
848
|
}), t)).catch((t) => {
|
|
836
|
-
throw
|
|
849
|
+
throw _(e).error("atomic:fetchAppPreLogin error", t), t;
|
|
837
850
|
});
|
|
838
851
|
}
|
|
839
|
-
var
|
|
852
|
+
var kt = Ot;
|
|
840
853
|
//#endregion
|
|
841
854
|
//#region src/web-api/helpers/utils/date-utils.ts
|
|
842
|
-
function
|
|
855
|
+
function At(e) {
|
|
843
856
|
if (!e) return;
|
|
844
857
|
let t = new Date(e);
|
|
845
858
|
return Number.isNaN(t.getTime()) ? void 0 : t;
|
|
846
859
|
}
|
|
847
|
-
function
|
|
848
|
-
let t =
|
|
860
|
+
function jt(e) {
|
|
861
|
+
let t = At(e);
|
|
849
862
|
return !!t && t.getTime() <= Date.now();
|
|
850
863
|
}
|
|
851
|
-
function
|
|
852
|
-
let n =
|
|
864
|
+
function Mt(e, t = 7) {
|
|
865
|
+
let n = At(e);
|
|
853
866
|
if (!n) return !1;
|
|
854
867
|
let r = Date.now(), i = r + t * 24 * 60 * 60 * 1e3, a = n.getTime();
|
|
855
868
|
return a > r && a <= i;
|
|
856
869
|
}
|
|
857
870
|
//#endregion
|
|
858
871
|
//#region src/web-api/helpers/utils/with-retry.ts
|
|
859
|
-
async function
|
|
872
|
+
async function Nt(e, t = 0, n = 1e3) {
|
|
860
873
|
let r;
|
|
861
874
|
for (let i = 0; i <= t; i++) try {
|
|
862
875
|
return await e();
|
|
863
876
|
} catch (e) {
|
|
864
|
-
if (r = e, e instanceof
|
|
877
|
+
if (r = e, e instanceof O && e.status >= 400 && e.status < 500 && e.status !== 429 || e instanceof DOMException && e.name === "AbortError") throw e;
|
|
865
878
|
i < t && (c(`Retrying request (${i + 1}/${t})`, { error: e }), await new Promise((e) => setTimeout(e, n)));
|
|
866
879
|
}
|
|
867
880
|
throw r;
|
|
868
881
|
}
|
|
869
882
|
//#endregion
|
|
870
883
|
//#region src/helpers/column-resolver.ts
|
|
871
|
-
function
|
|
884
|
+
function Pt(e, t, n) {
|
|
872
885
|
if (!e || !t) return;
|
|
873
886
|
if (n) {
|
|
874
887
|
let r = Object.keys(t.queries).find((e) => e === n?.toLowerCase()), i;
|
|
@@ -881,93 +894,93 @@ function jt(e, t, n) {
|
|
|
881
894
|
}
|
|
882
895
|
//#endregion
|
|
883
896
|
//#region src/types/audit/AuditEventType.ts
|
|
884
|
-
var
|
|
897
|
+
var V = /* @__PURE__ */ function(e) {
|
|
885
898
|
return 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;
|
|
886
|
-
}({}), V = /* @__PURE__ */ function(e) {
|
|
887
|
-
return 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;
|
|
888
899
|
}({}), H = /* @__PURE__ */ function(e) {
|
|
900
|
+
return 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;
|
|
901
|
+
}({}), U = /* @__PURE__ */ function(e) {
|
|
889
902
|
return 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;
|
|
890
|
-
}({}),
|
|
903
|
+
}({}), Ft = "1.0", It = /* @__PURE__ */ function(e) {
|
|
891
904
|
return e[e.Original = 0] = "Original", e[e.Corrected = 1] = "Corrected", e;
|
|
892
|
-
}({}),
|
|
905
|
+
}({}), Lt = /* @__PURE__ */ function(e) {
|
|
893
906
|
return 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;
|
|
894
907
|
}({});
|
|
895
908
|
//#endregion
|
|
896
909
|
//#region src/helpers/columns.ts
|
|
897
|
-
function
|
|
898
|
-
if (!e) return
|
|
910
|
+
function Rt(e) {
|
|
911
|
+
if (!e) return H.none;
|
|
899
912
|
switch (e.toLocaleLowerCase()) {
|
|
900
913
|
case "bool":
|
|
901
|
-
case "boolean": return
|
|
902
|
-
case "date": return
|
|
903
|
-
case "datetime": return
|
|
904
|
-
case "time": return
|
|
905
|
-
case "unsigned": return
|
|
906
|
-
case "integer": return
|
|
907
|
-
case "float": return
|
|
908
|
-
case "double": return
|
|
909
|
-
case "dates": return
|
|
910
|
-
case "datetimes": return
|
|
911
|
-
case "times": return
|
|
912
|
-
case "varchar": return
|
|
913
|
-
case "binary": return
|
|
914
|
-
case "string": return
|
|
915
|
-
case "csv": return
|
|
916
|
-
default: return
|
|
914
|
+
case "boolean": return H.bool;
|
|
915
|
+
case "date": return H.date;
|
|
916
|
+
case "datetime": return H.dateTime;
|
|
917
|
+
case "time": return H.time;
|
|
918
|
+
case "unsigned": return H.unsigned;
|
|
919
|
+
case "integer": return H.integer;
|
|
920
|
+
case "float": return H.float;
|
|
921
|
+
case "double": return H.double;
|
|
922
|
+
case "dates": return H.dates;
|
|
923
|
+
case "datetimes": return H.dateTimes;
|
|
924
|
+
case "times": return H.times;
|
|
925
|
+
case "varchar": return H.varchar;
|
|
926
|
+
case "binary": return H.binary;
|
|
927
|
+
case "string": return H.string;
|
|
928
|
+
case "csv": return H.csv;
|
|
929
|
+
default: return H.none;
|
|
917
930
|
}
|
|
918
931
|
}
|
|
919
|
-
function
|
|
932
|
+
function zt(e) {
|
|
920
933
|
switch (e) {
|
|
921
|
-
case "a": return
|
|
922
|
-
case "c": return
|
|
923
|
-
case "d": return
|
|
924
|
-
case "e": return
|
|
925
|
-
case "i": return
|
|
926
|
-
case "l": return
|
|
927
|
-
case "n": return
|
|
928
|
-
case "t": return
|
|
929
|
-
case "x": return
|
|
930
|
-
case "z": return
|
|
931
|
-
default: return
|
|
934
|
+
case "a": return U.a;
|
|
935
|
+
case "c": return U.c;
|
|
936
|
+
case "d": return U.d;
|
|
937
|
+
case "e": return U.e;
|
|
938
|
+
case "i": return U.i;
|
|
939
|
+
case "l": return U.l;
|
|
940
|
+
case "n": return U.n;
|
|
941
|
+
case "t": return U.t;
|
|
942
|
+
case "x": return U.x;
|
|
943
|
+
case "z": return U.z;
|
|
944
|
+
default: return U.none;
|
|
932
945
|
}
|
|
933
946
|
}
|
|
934
|
-
function
|
|
935
|
-
let t =
|
|
936
|
-
if (e) for (let n of e) t |=
|
|
947
|
+
function Bt(e) {
|
|
948
|
+
let t = U.none;
|
|
949
|
+
if (e) for (let n of e) t |= zt(n);
|
|
937
950
|
return t;
|
|
938
951
|
}
|
|
939
|
-
function
|
|
952
|
+
function W(e, t, n, r) {
|
|
940
953
|
return {
|
|
941
954
|
name: e,
|
|
942
955
|
type: t,
|
|
943
956
|
typeModifier: n,
|
|
944
|
-
eType:
|
|
945
|
-
eTypeModifier:
|
|
957
|
+
eType: Rt(t),
|
|
958
|
+
eTypeModifier: Bt(n || ""),
|
|
946
959
|
aliases: r
|
|
947
960
|
};
|
|
948
961
|
}
|
|
949
|
-
var
|
|
950
|
-
id:
|
|
951
|
-
text:
|
|
952
|
-
documentlanguages:
|
|
953
|
-
databasealias:
|
|
954
|
-
globalrelevance:
|
|
955
|
-
matchingpartnames:
|
|
956
|
-
matchlocations:
|
|
957
|
-
matchlocationsperpartname:
|
|
958
|
-
extracts:
|
|
959
|
-
extractsperpartname:
|
|
960
|
-
extractslocations:
|
|
961
|
-
documentweight:
|
|
962
|
-
groupcount:
|
|
963
|
-
accesslists:
|
|
962
|
+
var Vt = {
|
|
963
|
+
id: W("id", "string"),
|
|
964
|
+
text: W("text", "varchar"),
|
|
965
|
+
documentlanguages: W("documentlanguages", "csv", "ci", ["language"]),
|
|
966
|
+
databasealias: W("databasealias", "varchar"),
|
|
967
|
+
globalrelevance: W("globalrelevance", "double"),
|
|
968
|
+
matchingpartnames: W("matchingpartnames", "csv"),
|
|
969
|
+
matchlocations: W("matchlocations", "csv"),
|
|
970
|
+
matchlocationsperpartname: W("matchlocationsperpartname", "varchar"),
|
|
971
|
+
extracts: W("extracts", "csv"),
|
|
972
|
+
extractsperpartname: W("extractsperpartname", "varchar"),
|
|
973
|
+
extractslocations: W("extractslocations", "csv"),
|
|
974
|
+
documentweight: W("documentweight", "varchar"),
|
|
975
|
+
groupcount: W("groupcount", "integer"),
|
|
976
|
+
accesslists: W("accesslists", "varchar", void 0, ["accessLists"])
|
|
964
977
|
};
|
|
965
978
|
//#endregion
|
|
966
979
|
//#region src/helpers/filters.ts
|
|
967
|
-
function
|
|
980
|
+
function Ht(e) {
|
|
968
981
|
return e.filter((e) => !!e);
|
|
969
982
|
}
|
|
970
|
-
var
|
|
983
|
+
var G = {
|
|
971
984
|
eq: (e, t) => ({
|
|
972
985
|
field: e,
|
|
973
986
|
operator: "eq",
|
|
@@ -1038,44 +1051,44 @@ var W = {
|
|
|
1038
1051
|
if (!n) return;
|
|
1039
1052
|
let r = n.split(" AND ").map((e) => e.trim()).filter(Boolean).map((t) => {
|
|
1040
1053
|
let n = t.substring(t.search(/\s/) + 1).trim();
|
|
1041
|
-
return t.startsWith(">=") ?
|
|
1054
|
+
return t.startsWith(">=") ? G.gte(e, n) : t.startsWith(">") ? G.gt(e, n) : t.startsWith("<=") ? G.lte(e, n) : G.lt(e, n);
|
|
1042
1055
|
});
|
|
1043
|
-
return
|
|
1056
|
+
return G.and(...r);
|
|
1044
1057
|
},
|
|
1045
|
-
and: (...e) =>
|
|
1046
|
-
or: (...e) =>
|
|
1058
|
+
and: (...e) => Ut("and", e),
|
|
1059
|
+
or: (...e) => Ut("or", e),
|
|
1047
1060
|
not: (...e) => {
|
|
1048
|
-
let t =
|
|
1061
|
+
let t = Ht(e);
|
|
1049
1062
|
return t.length ? {
|
|
1050
1063
|
operator: "not",
|
|
1051
1064
|
filters: t
|
|
1052
1065
|
} : void 0;
|
|
1053
1066
|
}
|
|
1054
1067
|
};
|
|
1055
|
-
function
|
|
1056
|
-
let n =
|
|
1068
|
+
function Ut(e, t) {
|
|
1069
|
+
let n = Ht(t);
|
|
1057
1070
|
if (n.length !== 0) return n.length === 1 ? n[0] : {
|
|
1058
1071
|
operator: e,
|
|
1059
1072
|
filters: n
|
|
1060
1073
|
};
|
|
1061
1074
|
}
|
|
1062
|
-
function
|
|
1075
|
+
function Wt(e) {
|
|
1063
1076
|
if (!e) return;
|
|
1064
1077
|
let { operator: t, field: n } = e;
|
|
1065
1078
|
switch (t) {
|
|
1066
1079
|
case "and":
|
|
1067
1080
|
case "or": {
|
|
1068
|
-
let n = (e.filters ?? []).map((e) =>
|
|
1069
|
-
return t === "and" ?
|
|
1081
|
+
let n = (e.filters ?? []).map((e) => Wt(e));
|
|
1082
|
+
return t === "and" ? G.and(...n) : G.or(...n);
|
|
1070
1083
|
}
|
|
1071
1084
|
case "not": {
|
|
1072
|
-
let t = (e.filters ?? []).map((e) =>
|
|
1073
|
-
return
|
|
1085
|
+
let t = (e.filters ?? []).map((e) => Wt(e));
|
|
1086
|
+
return G.not(...t);
|
|
1074
1087
|
}
|
|
1075
|
-
case "in": return n && e.values?.length ?
|
|
1076
|
-
case "between": return n && e.start !== void 0 && e.end !== void 0 ?
|
|
1077
|
-
case "null": return n ?
|
|
1078
|
-
case "notnull": return n ?
|
|
1088
|
+
case "in": return n && e.values?.length ? G.in(n, e.values) : void 0;
|
|
1089
|
+
case "between": return n && e.start !== void 0 && e.end !== void 0 ? G.between(n, e.start, e.end) : void 0;
|
|
1090
|
+
case "null": return n ? G.isNull(n) : void 0;
|
|
1091
|
+
case "notnull": return n ? G.isNotNull(n) : void 0;
|
|
1079
1092
|
case "eq":
|
|
1080
1093
|
case "neq":
|
|
1081
1094
|
case "gt":
|
|
@@ -1084,21 +1097,21 @@ function Vt(e) {
|
|
|
1084
1097
|
case "lte":
|
|
1085
1098
|
case "like":
|
|
1086
1099
|
case "contains":
|
|
1087
|
-
case "regex": return n && e.value !== void 0 ?
|
|
1088
|
-
case void 0: return n && e.value !== void 0 ?
|
|
1100
|
+
case "regex": return n && e.value !== void 0 ? G[t](n, e.value) : void 0;
|
|
1101
|
+
case void 0: return n && e.value !== void 0 ? G.eq(n, e.value) : void 0;
|
|
1089
1102
|
default: return;
|
|
1090
1103
|
}
|
|
1091
1104
|
}
|
|
1092
1105
|
//#endregion
|
|
1093
1106
|
//#region src/helpers/metadata.ts
|
|
1094
|
-
function
|
|
1107
|
+
function Gt(e, t) {
|
|
1095
1108
|
let n = e[t];
|
|
1096
1109
|
return n === void 0 ? [] : (typeof n == "string" && (n = String(n).split(",")), Array.isArray(n) ? n.map((e) => {
|
|
1097
1110
|
if (typeof e == "string") return e.trim();
|
|
1098
1111
|
if (typeof e == "object" && e && "display" in e) return e.display.trim();
|
|
1099
1112
|
}).filter((e) => e !== void 0) : [String(n).trim()]);
|
|
1100
1113
|
}
|
|
1101
|
-
function
|
|
1114
|
+
function Kt(e, t) {
|
|
1102
1115
|
let n = e[t];
|
|
1103
1116
|
if (n === void 0) return [];
|
|
1104
1117
|
if (typeof n == "string" && (n = String(n).split(",")), Array.isArray(n)) return n.map((e) => {
|
|
@@ -1122,7 +1135,7 @@ function Ut(e, t) {
|
|
|
1122
1135
|
}
|
|
1123
1136
|
//#endregion
|
|
1124
1137
|
//#region src/helpers/pagination.ts
|
|
1125
|
-
function
|
|
1138
|
+
function qt(e) {
|
|
1126
1139
|
let { page: t, pageSize: n, rowCount: r } = e;
|
|
1127
1140
|
return t === void 0 || !n || r === void 0 ? {
|
|
1128
1141
|
nextPage: void 0,
|
|
@@ -1134,35 +1147,35 @@ function Wt(e) {
|
|
|
1134
1147
|
}
|
|
1135
1148
|
//#endregion
|
|
1136
1149
|
//#region src/helpers/utils.ts
|
|
1137
|
-
function
|
|
1150
|
+
function K(e) {
|
|
1138
1151
|
return typeof e == "object" && !!e;
|
|
1139
1152
|
}
|
|
1140
|
-
function
|
|
1141
|
-
return
|
|
1153
|
+
function Jt(e) {
|
|
1154
|
+
return K(e) && Object.prototype.toString.call(e) === "[object ArrayBuffer]";
|
|
1142
1155
|
}
|
|
1143
|
-
function
|
|
1144
|
-
return
|
|
1156
|
+
function Yt(e) {
|
|
1157
|
+
return K(e) && Object.prototype.toString.call(e) === "[object Blob]";
|
|
1145
1158
|
}
|
|
1146
|
-
function
|
|
1159
|
+
function Xt(e) {
|
|
1147
1160
|
return Object.prototype.toString.call(e) === "[object Date]";
|
|
1148
1161
|
}
|
|
1149
|
-
function
|
|
1162
|
+
function Zt(e) {
|
|
1150
1163
|
return typeof e == "string";
|
|
1151
1164
|
}
|
|
1152
|
-
function
|
|
1153
|
-
return (
|
|
1165
|
+
function Qt(e) {
|
|
1166
|
+
return (K(e) || Array.isArray(e)) && !Jt(e) && !Yt(e) && !Zt(e);
|
|
1154
1167
|
}
|
|
1155
|
-
function
|
|
1168
|
+
function $t(e) {
|
|
1156
1169
|
return e ? (e.getHours() * 60 * 60 + e.getMinutes() * 60 + e.getSeconds()) * 1e3 + e.getMilliseconds() : 0;
|
|
1157
1170
|
}
|
|
1158
|
-
function
|
|
1171
|
+
function en(e = !0) {
|
|
1159
1172
|
let t = Date.now();
|
|
1160
1173
|
return (e ? "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx" : "xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx").replace(/[xy]/g, (e) => {
|
|
1161
1174
|
let n = (t + Math.random() * 16) % 16 | 0;
|
|
1162
1175
|
return t = Math.floor(t / 16), (e === "x" ? n : n & 3 | 8).toString(16);
|
|
1163
1176
|
});
|
|
1164
1177
|
}
|
|
1165
|
-
function
|
|
1178
|
+
function tn(e) {
|
|
1166
1179
|
if (!e) return "``";
|
|
1167
1180
|
if (e = String(e), e.search(/[\\`]/) === -1) return `\`${e}\``;
|
|
1168
1181
|
let t = ["`"];
|
|
@@ -1172,15 +1185,15 @@ function Qt(e) {
|
|
|
1172
1185
|
}
|
|
1173
1186
|
return t.push("`"), t.join("");
|
|
1174
1187
|
}
|
|
1175
|
-
function
|
|
1188
|
+
function nn(e) {
|
|
1176
1189
|
if (typeof crypto < "u" && crypto.subtle && typeof crypto.subtle.digest == "function") try {
|
|
1177
|
-
return crypto.subtle.digest("SHA-512", new TextEncoder().encode(e)).then((e) => Array.prototype.map.call(new Uint8Array(e), (e) => `00${e.toString(16)}`.slice(-2)).join("")).catch(() => Promise.resolve(
|
|
1190
|
+
return crypto.subtle.digest("SHA-512", new TextEncoder().encode(e)).then((e) => Array.prototype.map.call(new Uint8Array(e), (e) => `00${e.toString(16)}`.slice(-2)).join("")).catch(() => Promise.resolve(rn(e)));
|
|
1178
1191
|
} catch {
|
|
1179
|
-
return Promise.resolve(
|
|
1192
|
+
return Promise.resolve(rn(e));
|
|
1180
1193
|
}
|
|
1181
|
-
return Promise.resolve(
|
|
1194
|
+
return Promise.resolve(rn(e));
|
|
1182
1195
|
}
|
|
1183
|
-
function
|
|
1196
|
+
function rn(e) {
|
|
1184
1197
|
let t = 2166136261;
|
|
1185
1198
|
for (let n = 0; n < e.length; n++) t ^= e.charCodeAt(n), t = t * 16777619 >>> 0;
|
|
1186
1199
|
let n = t.toString(16).padStart(8, "0"), r = ((t ^ 2863311530) >>> 0).toString(16).padStart(8, "0"), i = ((t ^ 1431655765) >>> 0).toString(16).padStart(8, "0"), a = ((t ^ 3435973836) >>> 0).toString(16).padStart(8, "0"), o = n + r + i + a;
|
|
@@ -1188,51 +1201,51 @@ function en(e) {
|
|
|
1188
1201
|
}
|
|
1189
1202
|
//#endregion
|
|
1190
1203
|
//#region src/web-api/v1/fetch-audit.ts
|
|
1191
|
-
var
|
|
1192
|
-
function
|
|
1193
|
-
let n =
|
|
1194
|
-
n && (
|
|
1204
|
+
var an, on;
|
|
1205
|
+
function q(e, t = !0) {
|
|
1206
|
+
let n = sn(e.$auditRecord);
|
|
1207
|
+
n && (cn(n), t && ln(n)), e.$auditRecord = n;
|
|
1195
1208
|
}
|
|
1196
|
-
function
|
|
1209
|
+
function sn(e) {
|
|
1197
1210
|
if (!e) return;
|
|
1198
1211
|
let t;
|
|
1199
1212
|
if (Array.isArray(e)) t = e;
|
|
1200
|
-
else if (
|
|
1213
|
+
else if (K(e)) {
|
|
1201
1214
|
let n = e;
|
|
1202
1215
|
if (n.auditEvents || n.mlAuditEvents) return n;
|
|
1203
1216
|
t = [e];
|
|
1204
1217
|
}
|
|
1205
1218
|
return { auditEvents: t };
|
|
1206
1219
|
}
|
|
1207
|
-
function
|
|
1208
|
-
let t =
|
|
1220
|
+
function cn(e) {
|
|
1221
|
+
let t = un();
|
|
1209
1222
|
return e.auditEvents?.forEach((e) => {
|
|
1210
1223
|
e.detail ||= {}, e.detail.sessionid = t;
|
|
1211
1224
|
}), e;
|
|
1212
1225
|
}
|
|
1213
|
-
function
|
|
1226
|
+
function ln(e) {
|
|
1214
1227
|
let t = typeof window < "u" ? decodeURIComponent(window.location.href) : "http://localhost";
|
|
1215
1228
|
return e?.auditEvents?.forEach((e) => {
|
|
1216
1229
|
e.detail ||= {}, e.detail.url = t;
|
|
1217
1230
|
}), e;
|
|
1218
1231
|
}
|
|
1219
|
-
function
|
|
1220
|
-
return (!
|
|
1232
|
+
function un() {
|
|
1233
|
+
return (!an || dn()) && (an = en()), on = /* @__PURE__ */ new Date(), an;
|
|
1221
1234
|
}
|
|
1222
|
-
function
|
|
1223
|
-
return Date.now() -
|
|
1235
|
+
function dn() {
|
|
1236
|
+
return Date.now() - on.getTime() > 600 * 1e3;
|
|
1224
1237
|
}
|
|
1225
|
-
async function
|
|
1238
|
+
async function fn(e, t = !0, n = g) {
|
|
1226
1239
|
let r = {
|
|
1227
|
-
event:
|
|
1240
|
+
event: V.None,
|
|
1228
1241
|
$auditRecord: e
|
|
1229
1242
|
};
|
|
1230
|
-
return
|
|
1243
|
+
return q(r, t), F(n, "api/v1/audit.notify", r, { noRecovery: !0 });
|
|
1231
1244
|
}
|
|
1232
|
-
var
|
|
1245
|
+
var pn = { notify: fn };
|
|
1233
1246
|
//#endregion
|
|
1234
1247
|
//#region src/web-api/v1/fetch-aggregation.ts
|
|
1235
|
-
async function
|
|
1248
|
+
async function mn(e, t, n, r = g) {
|
|
1236
1249
|
let i = e.items?.length || 0, a = {
|
|
1237
1250
|
query: {
|
|
1238
1251
|
...t,
|
|
@@ -1244,32 +1257,32 @@ async function dn(e, t, n, r = h) {
|
|
|
1244
1257
|
},
|
|
1245
1258
|
$auditRecord: { auditEvents: [n] }
|
|
1246
1259
|
};
|
|
1247
|
-
|
|
1248
|
-
let { aggregations: o } = await
|
|
1260
|
+
q(a);
|
|
1261
|
+
let { aggregations: o } = await Te(await F(r, "api/v1/query", a)), s = o[0];
|
|
1249
1262
|
return s.$hasMore = s.items.length > 10, s.items = [...e.items, ...s.items], Promise.resolve(s);
|
|
1250
1263
|
}
|
|
1251
1264
|
//#endregion
|
|
1252
1265
|
//#region src/web-api/v1/fetch-dataset.ts
|
|
1253
|
-
async function
|
|
1254
|
-
let i = await
|
|
1266
|
+
async function hn(e, t, n = {}, r = g) {
|
|
1267
|
+
let i = await F(r, `api/v1/search.dataset/${e}/${t}`, { parameters: n }), a = t[0].toLowerCase() + t.slice(1), o = i.datasets[a];
|
|
1255
1268
|
if ("errorCode" in o && "errorMessage" in o) throw Error(o.errorMessage);
|
|
1256
1269
|
return o;
|
|
1257
1270
|
}
|
|
1258
|
-
async function
|
|
1271
|
+
async function gn(e, t, n = g) {
|
|
1259
1272
|
let r = `api/v1/search.dataset/${e}`, { parameters: i = {}, datasets: a = [] } = t;
|
|
1260
|
-
return (await
|
|
1273
|
+
return (await F(n, r, {
|
|
1261
1274
|
parameters: i,
|
|
1262
1275
|
datasets: a
|
|
1263
1276
|
})).datasets;
|
|
1264
1277
|
}
|
|
1265
|
-
async function
|
|
1266
|
-
return await
|
|
1278
|
+
async function _n(e, t = g) {
|
|
1279
|
+
return await L(t, `api/v1/search.dataset/${e}`);
|
|
1267
1280
|
}
|
|
1268
1281
|
//#endregion
|
|
1269
1282
|
//#region src/web-api/v1/fetch-labels.ts
|
|
1270
|
-
async function
|
|
1283
|
+
async function vn(e, t = !0, n, r = g) {
|
|
1271
1284
|
try {
|
|
1272
|
-
return (await
|
|
1285
|
+
return (await F(r, "api/v1/labels", {
|
|
1273
1286
|
action: "list",
|
|
1274
1287
|
q: e,
|
|
1275
1288
|
public: t,
|
|
@@ -1280,10 +1293,10 @@ async function hn(e, t = !0, n, r = h) {
|
|
|
1280
1293
|
throw l("Error in fetchLabels", e), e;
|
|
1281
1294
|
}
|
|
1282
1295
|
}
|
|
1283
|
-
async function
|
|
1296
|
+
async function yn(e = g) {
|
|
1284
1297
|
try {
|
|
1285
1298
|
let { app: t = "" } = e.config;
|
|
1286
|
-
return
|
|
1299
|
+
return L(e, "api/v1/labels", new URLSearchParams({
|
|
1287
1300
|
app: t,
|
|
1288
1301
|
action: "getUserRights"
|
|
1289
1302
|
}));
|
|
@@ -1291,16 +1304,16 @@ async function gn(e = h) {
|
|
|
1291
1304
|
throw l("Error in getUserRights", e), e;
|
|
1292
1305
|
}
|
|
1293
1306
|
}
|
|
1294
|
-
async function
|
|
1307
|
+
async function bn(e, t, n = !0, r = g) {
|
|
1295
1308
|
try {
|
|
1296
|
-
return
|
|
1309
|
+
return F(r, "api/v1/labels", {
|
|
1297
1310
|
action: "add",
|
|
1298
1311
|
labels: e,
|
|
1299
1312
|
ids: t,
|
|
1300
1313
|
public: n,
|
|
1301
1314
|
$auditRecord: {
|
|
1302
1315
|
auditEvents: [{
|
|
1303
|
-
type:
|
|
1316
|
+
type: V.Label_AddDoc,
|
|
1304
1317
|
detail: {
|
|
1305
1318
|
public: n,
|
|
1306
1319
|
label: e ? e.toString() : null,
|
|
@@ -1317,16 +1330,16 @@ async function _n(e, t, n = !0, r = h) {
|
|
|
1317
1330
|
throw l("Error in add", e), e;
|
|
1318
1331
|
}
|
|
1319
1332
|
}
|
|
1320
|
-
async function
|
|
1333
|
+
async function xn(e, t, n = !0, r = g) {
|
|
1321
1334
|
try {
|
|
1322
|
-
return
|
|
1335
|
+
return F(r, "api/v1/labels", {
|
|
1323
1336
|
action: "remove",
|
|
1324
1337
|
labels: e,
|
|
1325
1338
|
ids: t,
|
|
1326
1339
|
public: n,
|
|
1327
1340
|
$auditRecord: {
|
|
1328
1341
|
auditEvents: [{
|
|
1329
|
-
type:
|
|
1342
|
+
type: V.Label_RemoveDoc,
|
|
1330
1343
|
detail: {
|
|
1331
1344
|
public: n,
|
|
1332
1345
|
label: e ? e.toString() : null,
|
|
@@ -1343,15 +1356,15 @@ async function vn(e, t, n = !0, r = h) {
|
|
|
1343
1356
|
throw l("Error in remove", e), e;
|
|
1344
1357
|
}
|
|
1345
1358
|
}
|
|
1346
|
-
async function
|
|
1359
|
+
async function Sn(e, t, n = !0, r = g) {
|
|
1347
1360
|
try {
|
|
1348
|
-
return
|
|
1361
|
+
return F(r, "api/v1/labels", {
|
|
1349
1362
|
action: "rename",
|
|
1350
1363
|
labels: e,
|
|
1351
1364
|
newLabel: t,
|
|
1352
1365
|
public: n,
|
|
1353
1366
|
auditEvents: {
|
|
1354
|
-
type:
|
|
1367
|
+
type: V.Label_Rename,
|
|
1355
1368
|
detail: {
|
|
1356
1369
|
public: n,
|
|
1357
1370
|
oldlabel: e ? e.toString() : null,
|
|
@@ -1363,14 +1376,14 @@ async function yn(e, t, n = !0, r = h) {
|
|
|
1363
1376
|
throw l("Error in rename", e), e;
|
|
1364
1377
|
}
|
|
1365
1378
|
}
|
|
1366
|
-
async function
|
|
1379
|
+
async function Cn(e, t = !0, n = g) {
|
|
1367
1380
|
try {
|
|
1368
|
-
return
|
|
1381
|
+
return F(n, "api/v1/labels", {
|
|
1369
1382
|
action: "delete",
|
|
1370
1383
|
labels: e,
|
|
1371
1384
|
public: t,
|
|
1372
1385
|
auditEvents: {
|
|
1373
|
-
type:
|
|
1386
|
+
type: V.Label_Delete,
|
|
1374
1387
|
detail: {
|
|
1375
1388
|
public: t,
|
|
1376
1389
|
label: e ? e.toString() : null
|
|
@@ -1381,15 +1394,15 @@ async function bn(e, t = !0, n = h) {
|
|
|
1381
1394
|
throw l("Error in deleteLabels", e), e;
|
|
1382
1395
|
}
|
|
1383
1396
|
}
|
|
1384
|
-
async function
|
|
1397
|
+
async function wn(e, t, n = !0, r = g) {
|
|
1385
1398
|
try {
|
|
1386
|
-
return
|
|
1399
|
+
return F(r, "api/v1/labels", {
|
|
1387
1400
|
action: "bulkAdd",
|
|
1388
1401
|
labels: e,
|
|
1389
1402
|
query: t,
|
|
1390
1403
|
public: n,
|
|
1391
1404
|
auditEvents: {
|
|
1392
|
-
type:
|
|
1405
|
+
type: V.Label_Add,
|
|
1393
1406
|
detail: {
|
|
1394
1407
|
public: n,
|
|
1395
1408
|
label: e ? e.toString() : null,
|
|
@@ -1401,15 +1414,15 @@ async function xn(e, t, n = !0, r = h) {
|
|
|
1401
1414
|
throw l("Error in bulkAdd", e), e;
|
|
1402
1415
|
}
|
|
1403
1416
|
}
|
|
1404
|
-
async function
|
|
1417
|
+
async function Tn(e, t, n = !0, r = g) {
|
|
1405
1418
|
try {
|
|
1406
|
-
return
|
|
1419
|
+
return F(r, "api/v1/labels", {
|
|
1407
1420
|
action: "bulkRemove",
|
|
1408
1421
|
labels: e,
|
|
1409
1422
|
query: t,
|
|
1410
1423
|
public: n,
|
|
1411
1424
|
auditEvents: {
|
|
1412
|
-
type:
|
|
1425
|
+
type: V.Label_Delete,
|
|
1413
1426
|
detail: {
|
|
1414
1427
|
public: n,
|
|
1415
1428
|
label: e ? e.toString() : null,
|
|
@@ -1421,25 +1434,25 @@ async function Sn(e, t, n = !0, r = h) {
|
|
|
1421
1434
|
throw l("Error in bulkRemove", e), e;
|
|
1422
1435
|
}
|
|
1423
1436
|
}
|
|
1424
|
-
var
|
|
1425
|
-
getUserRights:
|
|
1426
|
-
add:
|
|
1427
|
-
remove:
|
|
1428
|
-
rename:
|
|
1429
|
-
delete:
|
|
1430
|
-
bulkAdd:
|
|
1431
|
-
bulkRemove:
|
|
1437
|
+
var J = {
|
|
1438
|
+
getUserRights: yn,
|
|
1439
|
+
add: bn,
|
|
1440
|
+
remove: xn,
|
|
1441
|
+
rename: Sn,
|
|
1442
|
+
delete: Cn,
|
|
1443
|
+
bulkAdd: wn,
|
|
1444
|
+
bulkRemove: Tn
|
|
1432
1445
|
};
|
|
1433
1446
|
//#endregion
|
|
1434
1447
|
//#region src/web-api/v1/fetch-preview.ts
|
|
1435
|
-
async function
|
|
1436
|
-
if (typeof window > "u") return
|
|
1448
|
+
async function En(e, t, n = g) {
|
|
1449
|
+
if (typeof window > "u") return F(n, "api/v1/preview", {
|
|
1437
1450
|
action: "get",
|
|
1438
1451
|
id: e,
|
|
1439
1452
|
query: t
|
|
1440
1453
|
});
|
|
1441
1454
|
let r = `${window.location.origin}${window.location.pathname}`;
|
|
1442
|
-
return
|
|
1455
|
+
return F(n, "api/v1/preview", {
|
|
1443
1456
|
action: "get",
|
|
1444
1457
|
id: e,
|
|
1445
1458
|
query: {
|
|
@@ -1449,61 +1462,61 @@ async function Cn(e, t, n = h) {
|
|
|
1449
1462
|
browserUrl: r
|
|
1450
1463
|
});
|
|
1451
1464
|
}
|
|
1452
|
-
async function
|
|
1465
|
+
async function Dn(e) {
|
|
1453
1466
|
let t = new Headers();
|
|
1454
|
-
t.append("content-type", "text"),
|
|
1467
|
+
t.append("content-type", "text"), Te(await fetch(e, {
|
|
1455
1468
|
method: "GET",
|
|
1456
1469
|
headers: t
|
|
1457
1470
|
}));
|
|
1458
1471
|
}
|
|
1459
1472
|
//#endregion
|
|
1460
1473
|
//#region src/web-api/v1/fetch-principal.ts
|
|
1461
|
-
async function
|
|
1462
|
-
return
|
|
1463
|
-
noAutoAuthentication:
|
|
1474
|
+
async function On(e, t = g) {
|
|
1475
|
+
return L(t, "api/v1/principal", new URLSearchParams({ action: "get" }), {
|
|
1476
|
+
noAutoAuthentication: M(t),
|
|
1464
1477
|
...e
|
|
1465
1478
|
});
|
|
1466
1479
|
}
|
|
1467
|
-
async function
|
|
1480
|
+
async function kn(e, t = g) {
|
|
1468
1481
|
let n = new URLSearchParams();
|
|
1469
1482
|
return Object.entries(e).forEach(([e, t]) => {
|
|
1470
1483
|
t !== void 0 && n.append(e, String(t));
|
|
1471
|
-
}),
|
|
1484
|
+
}), L(t, "api/v1/principal/list", n, { noAutoAuthentication: M(t) });
|
|
1472
1485
|
}
|
|
1473
|
-
async function
|
|
1474
|
-
return e ?
|
|
1486
|
+
async function An(e, t = g) {
|
|
1487
|
+
return e ? L(t, "api/v1/principal", new URLSearchParams({
|
|
1475
1488
|
action: "userid",
|
|
1476
1489
|
userid: e
|
|
1477
|
-
}), { noAutoAuthentication:
|
|
1478
|
-
}
|
|
1479
|
-
async function
|
|
1480
|
-
return e.length === 0 ? Promise.reject(/* @__PURE__ */ Error("userids is required")) :
|
|
1481
|
-
}
|
|
1482
|
-
var
|
|
1483
|
-
get:
|
|
1484
|
-
list:
|
|
1485
|
-
userid:
|
|
1486
|
-
userids:
|
|
1487
|
-
} },
|
|
1488
|
-
async function
|
|
1489
|
-
let i = await
|
|
1490
|
+
}), { noAutoAuthentication: M(t) }) : Promise.reject(/* @__PURE__ */ Error("userid is required"));
|
|
1491
|
+
}
|
|
1492
|
+
async function jn(e, t = g) {
|
|
1493
|
+
return e.length === 0 ? Promise.reject(/* @__PURE__ */ Error("userids is required")) : L(t, "api/v1/principal/userids", new URLSearchParams({ userids: [...e].join(",") }), { noAutoAuthentication: M(t) });
|
|
1494
|
+
}
|
|
1495
|
+
var Mn = { principal: {
|
|
1496
|
+
get: On,
|
|
1497
|
+
list: kn,
|
|
1498
|
+
userid: An,
|
|
1499
|
+
userids: jn
|
|
1500
|
+
} }, Nn = 11;
|
|
1501
|
+
async function Pn(e, t, n, r = g) {
|
|
1502
|
+
let i = await F(r, "api/v1/query", {
|
|
1490
1503
|
query: e,
|
|
1491
1504
|
$auditRecord: t,
|
|
1492
1505
|
queryIntentData: n
|
|
1493
1506
|
});
|
|
1494
1507
|
i.aggregations.forEach((e) => {
|
|
1495
|
-
e.$hasMore = !1, !e.isDistribution && !e.isTree && e.items && (e.$hasMore = e.items.length ===
|
|
1508
|
+
e.$hasMore = !1, !e.isDistribution && !e.isTree && e.items && (e.$hasMore = e.items.length === Nn), e.isTree && e.items && Y(e);
|
|
1496
1509
|
}), i.records?.map((e) => Object.assign(e, {
|
|
1497
1510
|
value: e.title,
|
|
1498
1511
|
type: "default"
|
|
1499
1512
|
}));
|
|
1500
1513
|
let a = {
|
|
1501
1514
|
...i,
|
|
1502
|
-
...
|
|
1515
|
+
...qt(i)
|
|
1503
1516
|
};
|
|
1504
1517
|
return Promise.resolve(a);
|
|
1505
1518
|
}
|
|
1506
|
-
async function
|
|
1519
|
+
async function Fn(e, t, n, r = g) {
|
|
1507
1520
|
let { app: i = "" } = r.config, a = {
|
|
1508
1521
|
methods: [],
|
|
1509
1522
|
mode: t,
|
|
@@ -1515,10 +1528,10 @@ async function Mn(e, t, n, r = h) {
|
|
|
1515
1528
|
app: i,
|
|
1516
1529
|
query: t
|
|
1517
1530
|
});
|
|
1518
|
-
let o = await
|
|
1531
|
+
let o = await F(r, "api/v1/multi", a);
|
|
1519
1532
|
o.results.forEach((e) => {
|
|
1520
1533
|
e.aggregations.forEach((e) => {
|
|
1521
|
-
e.$hasMore = !1, !e.isDistribution && !e.isTree && e.items && (e.$hasMore = e.items.length ===
|
|
1534
|
+
e.$hasMore = !1, !e.isDistribution && !e.isTree && e.items && (e.$hasMore = e.items.length === Nn), e.isTree && Y(e);
|
|
1522
1535
|
});
|
|
1523
1536
|
}), o.results.forEach((e) => {
|
|
1524
1537
|
e.records?.map((e) => Object.assign(e, {
|
|
@@ -1528,23 +1541,23 @@ async function Mn(e, t, n, r = h) {
|
|
|
1528
1541
|
});
|
|
1529
1542
|
let s = o.results.map((e) => ({
|
|
1530
1543
|
...e,
|
|
1531
|
-
...
|
|
1544
|
+
...qt(e)
|
|
1532
1545
|
}));
|
|
1533
1546
|
return Promise.resolve(s);
|
|
1534
1547
|
}
|
|
1535
|
-
function
|
|
1548
|
+
function Y(e, t = "", n = 0) {
|
|
1536
1549
|
let r = [];
|
|
1537
1550
|
return e.items && e.items.forEach((e) => {
|
|
1538
1551
|
let i = t ? `${t}/${e.value}` : e.value, a = n + 1;
|
|
1539
1552
|
r.push({
|
|
1540
1553
|
path: i,
|
|
1541
1554
|
level: a
|
|
1542
|
-
}), e.$path = i, e.$level = a, e.hasChildren ? r = r.concat(
|
|
1555
|
+
}), e.$path = i, e.$level = a, e.hasChildren ? r = r.concat(Y(e, i, a)) : e.hasChildren = !1;
|
|
1543
1556
|
}), r;
|
|
1544
1557
|
}
|
|
1545
1558
|
//#endregion
|
|
1546
1559
|
//#region src/web-api/v1/fetch-query-export.ts
|
|
1547
|
-
async function
|
|
1560
|
+
async function In({ model: e, appName: t, query: n, article: r }, i = g) {
|
|
1548
1561
|
let { webservice: a, format: o, maxcount: s, exportedColumns: c, export: l } = e, u = {
|
|
1549
1562
|
app: t,
|
|
1550
1563
|
webservice: a,
|
|
@@ -1558,30 +1571,30 @@ async function Pn({ model: e, appName: t, query: n, article: r }, i = h) {
|
|
|
1558
1571
|
detail: { resultid: r ? r.id : void 0 }
|
|
1559
1572
|
}] }
|
|
1560
1573
|
};
|
|
1561
|
-
return
|
|
1574
|
+
return q(u), await F(i, "api/v1/search.queryexport", u, { responseType: "blob" });
|
|
1562
1575
|
}
|
|
1563
1576
|
//#endregion
|
|
1564
1577
|
//#region src/web-api/v1/fetch-query-intent.ts
|
|
1565
|
-
async function
|
|
1566
|
-
return (await
|
|
1578
|
+
async function Ln(e, t = g) {
|
|
1579
|
+
return (await F(t, "api/v1/queryintent", { query: e }))?.intents;
|
|
1567
1580
|
}
|
|
1568
1581
|
//#endregion
|
|
1569
1582
|
//#region src/web-api/v1/fetch-security-principal.ts
|
|
1570
|
-
function
|
|
1571
|
-
return
|
|
1583
|
+
function Rn(e, t, n = g) {
|
|
1584
|
+
return F(n, "api/v1/security.principal", e, { signal: t });
|
|
1572
1585
|
}
|
|
1573
1586
|
//#endregion
|
|
1574
1587
|
//#region src/web-api/v1/fetch-similar-documents.ts
|
|
1575
|
-
async function
|
|
1576
|
-
return (await
|
|
1588
|
+
async function zn(e, t, n, r = g) {
|
|
1589
|
+
return (await F(r, "api/v1/similardocuments", {
|
|
1577
1590
|
sourceDocumentId: e,
|
|
1578
1591
|
query: { name: t }
|
|
1579
1592
|
}, { signal: n })).data;
|
|
1580
1593
|
}
|
|
1581
1594
|
//#endregion
|
|
1582
1595
|
//#region src/web-api/v1/fetch-sponsored-links.ts
|
|
1583
|
-
async function
|
|
1584
|
-
return (await
|
|
1596
|
+
async function Bn(e, t, n = g) {
|
|
1597
|
+
return (await F(n, "api/v1/query.links", {
|
|
1585
1598
|
webservice: e,
|
|
1586
1599
|
query: t
|
|
1587
1600
|
}))?.links?.map((e) => ({
|
|
@@ -1591,9 +1604,9 @@ async function Rn(e, t, n = h) {
|
|
|
1591
1604
|
}
|
|
1592
1605
|
//#endregion
|
|
1593
1606
|
//#region src/utils/to-sql.ts
|
|
1594
|
-
function
|
|
1607
|
+
function Vn(e, t) {
|
|
1595
1608
|
if (typeof e == "number") return `${e}`;
|
|
1596
|
-
if (
|
|
1609
|
+
if (Xt(e)) return t ? `'${Hn(e)}'` : Hn(e);
|
|
1597
1610
|
if (typeof e == "boolean") return e ? "true" : "false";
|
|
1598
1611
|
if (e === null) return "null";
|
|
1599
1612
|
if (Array.isArray(e)) {
|
|
@@ -1604,10 +1617,10 @@ function zn(e, t) {
|
|
|
1604
1617
|
}
|
|
1605
1618
|
return t ? `'${e}'` : e;
|
|
1606
1619
|
}
|
|
1607
|
-
function
|
|
1620
|
+
function Hn(e) {
|
|
1608
1621
|
if (!e) return "";
|
|
1609
1622
|
try {
|
|
1610
|
-
return
|
|
1623
|
+
return $t(e) === 0 ? new Intl.DateTimeFormat("en-CA", {
|
|
1611
1624
|
year: "numeric",
|
|
1612
1625
|
month: "2-digit",
|
|
1613
1626
|
day: "2-digit"
|
|
@@ -1623,7 +1636,7 @@ function Bn(e) {
|
|
|
1623
1636
|
}
|
|
1624
1637
|
//#endregion
|
|
1625
1638
|
//#region src/web-api/v1/fetch-suggest.ts
|
|
1626
|
-
async function
|
|
1639
|
+
async function Un(e, t, n, r, i, a = g) {
|
|
1627
1640
|
let { app: o } = a.config, s = {
|
|
1628
1641
|
app: o || "",
|
|
1629
1642
|
suggestQuery: e,
|
|
@@ -1633,14 +1646,14 @@ async function Vn(e, t, n, r, i, a = h) {
|
|
|
1633
1646
|
showSource: i
|
|
1634
1647
|
};
|
|
1635
1648
|
try {
|
|
1636
|
-
return (await
|
|
1649
|
+
return (await F(a, "api/v1/search.suggest", s)).suggests;
|
|
1637
1650
|
} catch (e) {
|
|
1638
1651
|
throw console.error("Error fetching suggestions:", e), e;
|
|
1639
1652
|
}
|
|
1640
1653
|
}
|
|
1641
|
-
async function
|
|
1654
|
+
async function Wn(e, t, n, r, i = g) {
|
|
1642
1655
|
let { app: a } = i.config;
|
|
1643
|
-
return (await
|
|
1656
|
+
return (await F(i, "api/v1/suggestquery", {
|
|
1644
1657
|
app: a || "",
|
|
1645
1658
|
suggestQuery: e,
|
|
1646
1659
|
text: t,
|
|
@@ -1648,22 +1661,22 @@ async function Hn(e, t, n, r, i = h) {
|
|
|
1648
1661
|
kinds: r
|
|
1649
1662
|
})).suggests;
|
|
1650
1663
|
}
|
|
1651
|
-
async function
|
|
1664
|
+
async function Gn(e, t, n, r = g) {
|
|
1652
1665
|
if (!t) return Promise.resolve([]);
|
|
1653
|
-
let { app: i } = r.config, a = await
|
|
1666
|
+
let { app: i } = r.config, a = await F(r, "api/v1/suggestfield", {
|
|
1654
1667
|
app: i || "",
|
|
1655
1668
|
text: e,
|
|
1656
1669
|
fields: t,
|
|
1657
1670
|
query: n
|
|
1658
1671
|
});
|
|
1659
1672
|
return a.suggests.forEach((e) => {
|
|
1660
|
-
e.display =
|
|
1673
|
+
e.display = Vn(e.display);
|
|
1661
1674
|
}), a.suggests;
|
|
1662
1675
|
}
|
|
1663
1676
|
//#endregion
|
|
1664
1677
|
//#region src/web-api/v1/fetch-text-chunk.ts
|
|
1665
|
-
async function
|
|
1666
|
-
return
|
|
1678
|
+
async function Kn(e, t, n, r, i, a, o = g) {
|
|
1679
|
+
return F(o, "api/v1/doc.textchunks", {
|
|
1667
1680
|
id: e,
|
|
1668
1681
|
textChunks: t,
|
|
1669
1682
|
highlights: n,
|
|
@@ -1674,228 +1687,228 @@ async function Wn(e, t, n, r, i, a, o = h) {
|
|
|
1674
1687
|
}
|
|
1675
1688
|
//#endregion
|
|
1676
1689
|
//#region src/web-api/v1/fetch-user-settings.ts
|
|
1677
|
-
async function
|
|
1690
|
+
async function qn(e = g) {
|
|
1678
1691
|
let { app: t } = e.config;
|
|
1679
|
-
return
|
|
1692
|
+
return L(e, "api/v1/usersettings", new URLSearchParams({
|
|
1680
1693
|
app: t || "",
|
|
1681
1694
|
action: "load"
|
|
1682
1695
|
}));
|
|
1683
1696
|
}
|
|
1684
|
-
async function
|
|
1697
|
+
async function Jn(e, t, n = g) {
|
|
1685
1698
|
let r = {
|
|
1686
1699
|
action: "save",
|
|
1687
1700
|
userSettings: e,
|
|
1688
1701
|
$auditRecord: { auditEvents: [t] }
|
|
1689
1702
|
};
|
|
1690
|
-
return
|
|
1703
|
+
return q(r), F(n, "api/v1/usersettings", r);
|
|
1691
1704
|
}
|
|
1692
|
-
async function
|
|
1705
|
+
async function Yn(e, t, n = g) {
|
|
1693
1706
|
let r = {
|
|
1694
1707
|
action: "patch",
|
|
1695
1708
|
userSettings: e,
|
|
1696
1709
|
$auditRecord: t ? { auditEvents: [t] } : void 0
|
|
1697
1710
|
};
|
|
1698
|
-
return
|
|
1711
|
+
return q(r), F(n, "api/v1/usersettings", r);
|
|
1699
1712
|
}
|
|
1700
|
-
async function
|
|
1701
|
-
return
|
|
1713
|
+
async function Xn(e = g) {
|
|
1714
|
+
return Jn({}, { type: "UserSettings_Reset" }, e);
|
|
1702
1715
|
}
|
|
1703
1716
|
//#endregion
|
|
1704
1717
|
//#region src/web-api/v2/fetch-change-password.ts
|
|
1705
|
-
async function
|
|
1706
|
-
return
|
|
1718
|
+
async function Zn(e, t, n = g) {
|
|
1719
|
+
return F(n, "api/v2/security/password/change", {
|
|
1707
1720
|
newPassword: e,
|
|
1708
1721
|
currentPassword: t
|
|
1709
1722
|
});
|
|
1710
1723
|
}
|
|
1711
1724
|
//#endregion
|
|
1712
1725
|
//#region src/web-api/v2/fetch-document-upload-container.ts
|
|
1713
|
-
var
|
|
1714
|
-
function
|
|
1726
|
+
var X = "api/v2/document-upload/container";
|
|
1727
|
+
function Qn(e) {
|
|
1715
1728
|
let t = new URLSearchParams();
|
|
1716
1729
|
return e.page !== void 0 && t.set("page", String(e.page)), e.pageSize !== void 0 && t.set("pageSize", String(e.pageSize)), t;
|
|
1717
1730
|
}
|
|
1718
|
-
function
|
|
1719
|
-
return
|
|
1731
|
+
function $n(e = {}, t = g) {
|
|
1732
|
+
return L(t, X, Qn(e));
|
|
1720
1733
|
}
|
|
1721
|
-
function
|
|
1722
|
-
return
|
|
1734
|
+
function er(e, t = g) {
|
|
1735
|
+
return L(t, `${X}/${encodeURIComponent(e)}`);
|
|
1723
1736
|
}
|
|
1724
|
-
function
|
|
1725
|
-
return
|
|
1737
|
+
function tr(e, t = g) {
|
|
1738
|
+
return F(t, X, e);
|
|
1726
1739
|
}
|
|
1727
|
-
function
|
|
1728
|
-
return
|
|
1740
|
+
function nr(e, t, n = g) {
|
|
1741
|
+
return B(n, `${X}/${encodeURIComponent(e)}`, t);
|
|
1729
1742
|
}
|
|
1730
|
-
async function
|
|
1731
|
-
let n = (await
|
|
1743
|
+
async function rr(e, t = g) {
|
|
1744
|
+
let n = (await R(t, "api/v2/document-upload/containers", void 0, { body: { containerIds: e } }))?.failed ?? [], r = new Set(n.map((e) => e.containerId));
|
|
1732
1745
|
return {
|
|
1733
1746
|
succeeded: e.filter((e) => !r.has(e)),
|
|
1734
1747
|
failed: n
|
|
1735
1748
|
};
|
|
1736
1749
|
}
|
|
1737
|
-
function
|
|
1738
|
-
return
|
|
1750
|
+
function ir(e, t = {}, n = g) {
|
|
1751
|
+
return L(n, `${X}/${encodeURIComponent(e)}/documents`, Qn(t));
|
|
1739
1752
|
}
|
|
1740
|
-
function
|
|
1741
|
-
return
|
|
1753
|
+
function ar(e, t, n = g) {
|
|
1754
|
+
return R(n, `${X}/${encodeURIComponent(e)}/documents`, void 0, { body: { fileIds: t } });
|
|
1742
1755
|
}
|
|
1743
1756
|
//#endregion
|
|
1744
1757
|
//#region src/web-api/v2/fetch-forgot-password.ts
|
|
1745
|
-
async function
|
|
1746
|
-
return
|
|
1758
|
+
async function or(e, t = g) {
|
|
1759
|
+
return F(t, "api/v2/security/password/ask-reset-email", {
|
|
1747
1760
|
changePasswordRedirectUrl: `${window.location.origin}/login?mode=changepassword`,
|
|
1748
1761
|
userName: e
|
|
1749
1762
|
});
|
|
1750
1763
|
}
|
|
1751
1764
|
//#endregion
|
|
1752
1765
|
//#region src/web-api/v2/fetch-user-profile.ts
|
|
1753
|
-
async function
|
|
1754
|
-
return await
|
|
1766
|
+
async function sr(e, t = g) {
|
|
1767
|
+
return await L(t, `api/v2/user-profile/${e}`);
|
|
1755
1768
|
}
|
|
1756
|
-
async function
|
|
1757
|
-
return await
|
|
1769
|
+
async function cr(e, t = g) {
|
|
1770
|
+
return await F(t, "api/v2/user-profile", e);
|
|
1758
1771
|
}
|
|
1759
|
-
async function
|
|
1760
|
-
return await
|
|
1772
|
+
async function lr(e, t, n, r = g) {
|
|
1773
|
+
return await z(r, `api/v2/user-profile/${e.data?.id}/${t}/${n}`, e);
|
|
1761
1774
|
}
|
|
1762
|
-
async function
|
|
1763
|
-
return (await
|
|
1775
|
+
async function ur(e, t, n, r = g) {
|
|
1776
|
+
return (await R(r, `api/v2/user-profile/${e.data?.id}/${t}/${n}`)).success === !0;
|
|
1764
1777
|
}
|
|
1765
1778
|
//#endregion
|
|
1766
1779
|
//#region src/web-api/v2/fetch-version.ts
|
|
1767
|
-
async function
|
|
1768
|
-
return await
|
|
1780
|
+
async function dr(e = g) {
|
|
1781
|
+
return await L(e, "api/v2/version");
|
|
1769
1782
|
}
|
|
1770
1783
|
//#endregion
|
|
1771
1784
|
//#region src/client/create-api.ts
|
|
1772
|
-
var
|
|
1785
|
+
var Z = (e, t) => (...n) => {
|
|
1773
1786
|
let r = Array(Math.max(0, e.length - n.length)).fill(void 0);
|
|
1774
1787
|
return e(...n, ...r, t);
|
|
1775
1788
|
};
|
|
1776
|
-
function
|
|
1789
|
+
function fr(e) {
|
|
1777
1790
|
return {
|
|
1778
1791
|
app: {
|
|
1779
|
-
get:
|
|
1780
|
-
preLogin:
|
|
1792
|
+
get: Z(Et, e),
|
|
1793
|
+
preLogin: Z(Dt, e)
|
|
1781
1794
|
},
|
|
1782
1795
|
principal: {
|
|
1783
|
-
get:
|
|
1784
|
-
list:
|
|
1785
|
-
userid:
|
|
1786
|
-
userids:
|
|
1787
|
-
search:
|
|
1796
|
+
get: Z(On, e),
|
|
1797
|
+
list: Z(kn, e),
|
|
1798
|
+
userid: Z(An, e),
|
|
1799
|
+
userids: Z(jn, e),
|
|
1800
|
+
search: Z(Rn, e)
|
|
1788
1801
|
},
|
|
1789
1802
|
query: {
|
|
1790
|
-
search:
|
|
1791
|
-
bulk:
|
|
1792
|
-
intent:
|
|
1793
|
-
export:
|
|
1794
|
-
aggregate:
|
|
1795
|
-
sponsoredLinks:
|
|
1796
|
-
similarDocuments:
|
|
1803
|
+
search: Z(Pn, e),
|
|
1804
|
+
bulk: Z(Fn, e),
|
|
1805
|
+
intent: Z(Ln, e),
|
|
1806
|
+
export: Z(In, e),
|
|
1807
|
+
aggregate: Z(mn, e),
|
|
1808
|
+
sponsoredLinks: Z(Bn, e),
|
|
1809
|
+
similarDocuments: Z(zn, e)
|
|
1797
1810
|
},
|
|
1798
1811
|
suggest: {
|
|
1799
|
-
get:
|
|
1800
|
-
query:
|
|
1801
|
-
field:
|
|
1812
|
+
get: Z(Un, e),
|
|
1813
|
+
query: Z(Wn, e),
|
|
1814
|
+
field: Z(Gn, e)
|
|
1802
1815
|
},
|
|
1803
1816
|
preview: {
|
|
1804
|
-
get:
|
|
1805
|
-
textChunks:
|
|
1817
|
+
get: Z(En, e),
|
|
1818
|
+
textChunks: Z(Kn, e)
|
|
1806
1819
|
},
|
|
1807
1820
|
labels: {
|
|
1808
|
-
get:
|
|
1809
|
-
rights:
|
|
1810
|
-
add:
|
|
1811
|
-
remove:
|
|
1812
|
-
rename:
|
|
1813
|
-
delete:
|
|
1814
|
-
bulkAdd:
|
|
1815
|
-
bulkRemove:
|
|
1821
|
+
get: Z(vn, e),
|
|
1822
|
+
rights: Z(J.getUserRights, e),
|
|
1823
|
+
add: Z(J.add, e),
|
|
1824
|
+
remove: Z(J.remove, e),
|
|
1825
|
+
rename: Z(J.rename, e),
|
|
1826
|
+
delete: Z(J.delete, e),
|
|
1827
|
+
bulkAdd: Z(J.bulkAdd, e),
|
|
1828
|
+
bulkRemove: Z(J.bulkRemove, e)
|
|
1816
1829
|
},
|
|
1817
1830
|
dataset: {
|
|
1818
|
-
get:
|
|
1819
|
-
getMany:
|
|
1820
|
-
list:
|
|
1831
|
+
get: Z(hn, e),
|
|
1832
|
+
getMany: Z(gn, e),
|
|
1833
|
+
list: Z(_n, e)
|
|
1821
1834
|
},
|
|
1822
1835
|
userSettings: {
|
|
1823
|
-
get:
|
|
1824
|
-
save:
|
|
1825
|
-
patch:
|
|
1826
|
-
reset:
|
|
1836
|
+
get: Z(qn, e),
|
|
1837
|
+
save: Z(Jn, e),
|
|
1838
|
+
patch: Z(Yn, e),
|
|
1839
|
+
reset: Z(Xn, e)
|
|
1827
1840
|
},
|
|
1828
1841
|
userProfile: {
|
|
1829
|
-
get:
|
|
1830
|
-
create:
|
|
1831
|
-
patch:
|
|
1832
|
-
deleteProperty:
|
|
1842
|
+
get: Z(sr, e),
|
|
1843
|
+
create: Z(cr, e),
|
|
1844
|
+
patch: Z(lr, e),
|
|
1845
|
+
deleteProperty: Z(ur, e)
|
|
1833
1846
|
},
|
|
1834
1847
|
containers: {
|
|
1835
|
-
list:
|
|
1836
|
-
get:
|
|
1837
|
-
create:
|
|
1838
|
-
update:
|
|
1839
|
-
delete:
|
|
1840
|
-
listDocuments:
|
|
1841
|
-
deleteDocuments:
|
|
1848
|
+
list: Z($n, e),
|
|
1849
|
+
get: Z(er, e),
|
|
1850
|
+
create: Z(tr, e),
|
|
1851
|
+
update: Z(nr, e),
|
|
1852
|
+
delete: Z(rr, e),
|
|
1853
|
+
listDocuments: Z(ir, e),
|
|
1854
|
+
deleteDocuments: Z(ar, e)
|
|
1842
1855
|
},
|
|
1843
1856
|
password: {
|
|
1844
|
-
change:
|
|
1845
|
-
sendResetEmail:
|
|
1857
|
+
change: Z(Zn, e),
|
|
1858
|
+
sendResetEmail: Z(or, e)
|
|
1846
1859
|
},
|
|
1847
|
-
version:
|
|
1860
|
+
version: Z(dr, e)
|
|
1848
1861
|
};
|
|
1849
1862
|
}
|
|
1850
1863
|
//#endregion
|
|
1851
1864
|
//#region src/client/create-atomic-client.ts
|
|
1852
|
-
function
|
|
1865
|
+
function pr(e) {
|
|
1853
1866
|
return {
|
|
1854
1867
|
config: e.config,
|
|
1855
1868
|
storagePrefix: e.storagePrefix,
|
|
1856
|
-
configure: (t) =>
|
|
1857
|
-
initializeConfig: () =>
|
|
1869
|
+
configure: (t) => b(e, t),
|
|
1870
|
+
initializeConfig: () => Ot(e),
|
|
1858
1871
|
auth: {
|
|
1859
|
-
login: (t) =>
|
|
1860
|
-
logout: () =>
|
|
1861
|
-
isAuthenticated: () =>
|
|
1862
|
-
hasSession: () =>
|
|
1863
|
-
isRedirectPending: () =>
|
|
1864
|
-
clearSession: () =>
|
|
1865
|
-
getToken: () =>
|
|
1866
|
-
setToken: (t) =>
|
|
1872
|
+
login: (t) => lt(e, t),
|
|
1873
|
+
logout: () => ht(e),
|
|
1874
|
+
isAuthenticated: () => xt(e),
|
|
1875
|
+
hasSession: () => Ue(e),
|
|
1876
|
+
isRedirectPending: () => yt(e),
|
|
1877
|
+
clearSession: () => _t(e),
|
|
1878
|
+
getToken: () => T(e),
|
|
1879
|
+
setToken: (t) => A(e, t),
|
|
1867
1880
|
on: (t, n) => e.events.on(t, n)
|
|
1868
1881
|
},
|
|
1869
1882
|
http: {
|
|
1870
|
-
get: (t, n, r) =>
|
|
1871
|
-
post: (t, n, r) =>
|
|
1872
|
-
put: (t, n, r) =>
|
|
1873
|
-
patch: (t, n, r) =>
|
|
1874
|
-
del: (t, n, r) =>
|
|
1883
|
+
get: (t, n, r) => L(e, t, n, r),
|
|
1884
|
+
post: (t, n, r) => F(e, t, n, r),
|
|
1885
|
+
put: (t, n, r) => B(e, t, n, r),
|
|
1886
|
+
patch: (t, n, r) => z(e, t, n, r),
|
|
1887
|
+
del: (t, n, r) => R(e, t, n, r)
|
|
1875
1888
|
},
|
|
1876
|
-
api:
|
|
1889
|
+
api: fr(e),
|
|
1877
1890
|
context: e
|
|
1878
1891
|
};
|
|
1879
1892
|
}
|
|
1880
|
-
function
|
|
1881
|
-
let { httpAdapter: t, storagePrefix: n, ...r } = e, i =
|
|
1893
|
+
function mr(e) {
|
|
1894
|
+
let { httpAdapter: t, storagePrefix: n, ...r } = e, i = pe({
|
|
1882
1895
|
config: {},
|
|
1883
1896
|
storagePrefix: n,
|
|
1884
1897
|
httpAdapter: t
|
|
1885
1898
|
});
|
|
1886
|
-
return
|
|
1899
|
+
return b(i, r), pr(i);
|
|
1887
1900
|
}
|
|
1888
|
-
var
|
|
1889
|
-
function
|
|
1890
|
-
return
|
|
1901
|
+
var hr = pr(g);
|
|
1902
|
+
function gr() {
|
|
1903
|
+
return hr;
|
|
1891
1904
|
}
|
|
1892
1905
|
//#endregion
|
|
1893
1906
|
//#region src/utils/aggregations.ts
|
|
1894
|
-
var
|
|
1895
|
-
function
|
|
1907
|
+
var _r = /.*:\(?([><=\d\-.AND ]+)\)?/;
|
|
1908
|
+
function vr(e, t) {
|
|
1896
1909
|
return !e?.items || e?.items?.length === 0 ? [] : e.items.reduce((n, r) => {
|
|
1897
1910
|
if (!r.value || r.value === "") return n;
|
|
1898
|
-
let i =
|
|
1911
|
+
let i = yr(r, e.column);
|
|
1899
1912
|
return n.push({
|
|
1900
1913
|
operator: i.operator,
|
|
1901
1914
|
value: i.value,
|
|
@@ -1906,8 +1919,8 @@ function gr(e, t) {
|
|
|
1906
1919
|
}), n;
|
|
1907
1920
|
}, []);
|
|
1908
1921
|
}
|
|
1909
|
-
function
|
|
1910
|
-
let n = t, r = e.value.match(
|
|
1922
|
+
function yr(e, t) {
|
|
1923
|
+
let n = t, r = e.value.match(_r);
|
|
1911
1924
|
if (r?.[1]) {
|
|
1912
1925
|
let t = (r?.[1].split(" AND ")).map((t) => ({
|
|
1913
1926
|
field: n,
|
|
@@ -1935,26 +1948,26 @@ function _r(e, t) {
|
|
|
1935
1948
|
display: e.display
|
|
1936
1949
|
};
|
|
1937
1950
|
}
|
|
1938
|
-
function
|
|
1951
|
+
function br(e, t, n) {
|
|
1939
1952
|
return e.valuesAreExpressions ? t.display === n.display : t.value === n.value;
|
|
1940
1953
|
}
|
|
1941
|
-
function
|
|
1942
|
-
return e.items &&= e.items.map((e) =>
|
|
1954
|
+
function xr(e) {
|
|
1955
|
+
return e.items &&= e.items.map((e) => xr(e)), e.items?.some((e) => e.$selected || e.$opened) && (e.$opened = !0), e;
|
|
1943
1956
|
}
|
|
1944
|
-
function
|
|
1957
|
+
function Sr(e, t) {
|
|
1945
1958
|
let n = [];
|
|
1946
1959
|
if (e.length > 0) {
|
|
1947
1960
|
let r = /* @__PURE__ */ new Map(), i = t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&").normalize("NFD").replace(/[\u0300-\u036f]/g, ""), a = RegExp(`\\b${i}`, "i");
|
|
1948
1961
|
e.forEach((e) => {
|
|
1949
1962
|
if (e.display.length > 1) {
|
|
1950
1963
|
let i = e.display.normalize("NFD").replace(/[\u0300-\u036f]/g, ""), o = a.exec(i);
|
|
1951
|
-
|
|
1964
|
+
Cr(n, r, "/", e.display, +(e.frequency || 0), 1, (o?.index || 0) + t.length);
|
|
1952
1965
|
}
|
|
1953
1966
|
});
|
|
1954
1967
|
}
|
|
1955
1968
|
return n;
|
|
1956
1969
|
}
|
|
1957
|
-
function
|
|
1970
|
+
function Cr(e, t, n, r, i, a, o) {
|
|
1958
1971
|
let s = r.indexOf("/", n.length), c = r.substring(0, s + 1), l = t.get(c);
|
|
1959
1972
|
if (!l) {
|
|
1960
1973
|
let u = c.replace(/^\/|\/$/g, "");
|
|
@@ -1968,11 +1981,11 @@ function xr(e, t, n, r, i, a, o) {
|
|
|
1968
1981
|
$path: u
|
|
1969
1982
|
}, t.set(c, l), e.push(l);
|
|
1970
1983
|
}
|
|
1971
|
-
c.length < r.length && (l.hasChildren = !0,
|
|
1984
|
+
c.length < r.length && (l.hasChildren = !0, Cr(l.items, t, c, r, i, a + 1, o));
|
|
1972
1985
|
}
|
|
1973
1986
|
//#endregion
|
|
1974
1987
|
//#region src/utils/bisect.ts
|
|
1975
|
-
function
|
|
1988
|
+
function wr(e, t) {
|
|
1976
1989
|
return e.reduce((e, n) => (t(n) ? e.true.push(n) : e.false.push(n), e), {
|
|
1977
1990
|
true: [],
|
|
1978
1991
|
false: []
|
|
@@ -1980,34 +1993,34 @@ function Sr(e, t) {
|
|
|
1980
1993
|
}
|
|
1981
1994
|
//#endregion
|
|
1982
1995
|
//#region src/utils/concepts.ts
|
|
1983
|
-
var
|
|
1984
|
-
function
|
|
1996
|
+
var Tr = /(([+-])?\(([^)]+)\))|(([+-])?\[([^\]]+)\])|(([+-])?"([^"]+)")|(([+-])?\/([^/]+)\/)|(([+-])?(\S+))/g, Er = 2, Dr = 3, Or = 5, kr = 6, Ar = 8, jr = 9, Mr = 11, Nr = 12, Pr = 14, Fr = 15;
|
|
1997
|
+
function Q(e) {
|
|
1985
1998
|
if (!e) return [];
|
|
1986
|
-
let t = [], n = e.matchAll(
|
|
1987
|
-
for (let e of n) e[
|
|
1999
|
+
let t = [], n = e.matchAll(Tr);
|
|
2000
|
+
for (let e of n) e[Dr] ? t.push({
|
|
1988
2001
|
type: "group",
|
|
1989
|
-
value: e[Tr],
|
|
1990
|
-
op: e[wr]
|
|
1991
|
-
}) : e[Dr] ? t.push({
|
|
1992
|
-
type: "adjacent",
|
|
1993
2002
|
value: e[Dr],
|
|
1994
2003
|
op: e[Er]
|
|
1995
2004
|
}) : e[kr] ? t.push({
|
|
1996
|
-
type: "
|
|
2005
|
+
type: "adjacent",
|
|
1997
2006
|
value: e[kr],
|
|
1998
2007
|
op: e[Or]
|
|
1999
2008
|
}) : e[jr] ? t.push({
|
|
2000
|
-
type: "
|
|
2009
|
+
type: "exact",
|
|
2001
2010
|
value: e[jr],
|
|
2002
2011
|
op: e[Ar]
|
|
2003
|
-
}) : e[Nr]
|
|
2004
|
-
type: "
|
|
2012
|
+
}) : e[Nr] ? t.push({
|
|
2013
|
+
type: "regex",
|
|
2005
2014
|
value: e[Nr],
|
|
2006
2015
|
op: e[Mr]
|
|
2016
|
+
}) : e[Fr] && t.push({
|
|
2017
|
+
type: "token",
|
|
2018
|
+
value: e[Fr],
|
|
2019
|
+
op: e[Pr]
|
|
2007
2020
|
});
|
|
2008
2021
|
return t;
|
|
2009
2022
|
}
|
|
2010
|
-
function
|
|
2023
|
+
function Ir(e) {
|
|
2011
2024
|
return e.map((e) => {
|
|
2012
2025
|
let t = e.op || "";
|
|
2013
2026
|
switch (e.type) {
|
|
@@ -2020,32 +2033,32 @@ function Z(e) {
|
|
|
2020
2033
|
}
|
|
2021
2034
|
}).join(" ");
|
|
2022
2035
|
}
|
|
2023
|
-
function
|
|
2024
|
-
let r =
|
|
2036
|
+
function Lr(e, t, n) {
|
|
2037
|
+
let r = Q(e);
|
|
2025
2038
|
for (let e of t) r.push({
|
|
2026
2039
|
type: "adjacent",
|
|
2027
2040
|
value: e,
|
|
2028
2041
|
op: n
|
|
2029
2042
|
});
|
|
2030
|
-
return
|
|
2043
|
+
return Ir(r);
|
|
2031
2044
|
}
|
|
2032
|
-
function
|
|
2033
|
-
let n =
|
|
2034
|
-
return r === -1 ? t : (n.splice(r, 1),
|
|
2045
|
+
function Rr(e, t) {
|
|
2046
|
+
let n = Q(t), r = n.findIndex((t) => t.value === e);
|
|
2047
|
+
return r === -1 ? t : (n.splice(r, 1), Ir(n));
|
|
2035
2048
|
}
|
|
2036
|
-
function
|
|
2037
|
-
return
|
|
2049
|
+
function zr(e) {
|
|
2050
|
+
return Ir(Q(e).filter((e) => e.type !== "adjacent"));
|
|
2038
2051
|
}
|
|
2039
|
-
function
|
|
2040
|
-
return
|
|
2052
|
+
function Br(e) {
|
|
2053
|
+
return Q(e).filter((e) => e.type === "adjacent").map((e) => e.value);
|
|
2041
2054
|
}
|
|
2042
2055
|
//#endregion
|
|
2043
2056
|
//#region src/utils/date.ts
|
|
2044
|
-
function
|
|
2045
|
-
let r = new Intl.RelativeTimeFormat(e, { numeric: "auto" }), { offset: i, unit: a, isFuture: o } =
|
|
2057
|
+
function Vr(e, t, n) {
|
|
2058
|
+
let r = new Intl.RelativeTimeFormat(e, { numeric: "auto" }), { offset: i, unit: a, isFuture: o } = Hr(t, n);
|
|
2046
2059
|
return r.format(i * (o ? 1 : -1), a);
|
|
2047
2060
|
}
|
|
2048
|
-
function
|
|
2061
|
+
function Hr(e, t) {
|
|
2049
2062
|
let n = new Date(e), r = t ? new Date(t) : /* @__PURE__ */ new Date(), i = Math.abs(r.getTime() - n.getTime());
|
|
2050
2063
|
return {
|
|
2051
2064
|
offset: Math.floor(i / (1e3 * 60 * 60 * 24)),
|
|
@@ -2055,13 +2068,13 @@ function zr(e, t) {
|
|
|
2055
2068
|
}
|
|
2056
2069
|
//#endregion
|
|
2057
2070
|
//#region src/utils/is-not-input-event.ts
|
|
2058
|
-
function
|
|
2071
|
+
function Ur(e) {
|
|
2059
2072
|
let t = e.target;
|
|
2060
2073
|
return t && t.nodeName !== "INPUT" && t.nodeName !== "TEXTAREA";
|
|
2061
2074
|
}
|
|
2062
2075
|
//#endregion
|
|
2063
2076
|
//#region src/utils/notification.ts
|
|
2064
|
-
function
|
|
2077
|
+
function Wr(e) {
|
|
2065
2078
|
let t = new CustomEvent("notification", {
|
|
2066
2079
|
bubbles: !0,
|
|
2067
2080
|
cancelable: !1,
|
|
@@ -2069,30 +2082,30 @@ function Q(e) {
|
|
|
2069
2082
|
});
|
|
2070
2083
|
dispatchEvent(t);
|
|
2071
2084
|
}
|
|
2072
|
-
var
|
|
2085
|
+
var Gr = {
|
|
2073
2086
|
success: (e, t) => {
|
|
2074
|
-
|
|
2087
|
+
Wr({
|
|
2075
2088
|
type: "success",
|
|
2076
2089
|
message: e,
|
|
2077
2090
|
options: t
|
|
2078
2091
|
});
|
|
2079
2092
|
},
|
|
2080
2093
|
info: (e, t) => {
|
|
2081
|
-
|
|
2094
|
+
Wr({
|
|
2082
2095
|
type: "info",
|
|
2083
2096
|
message: e,
|
|
2084
2097
|
options: t
|
|
2085
2098
|
});
|
|
2086
2099
|
},
|
|
2087
2100
|
warning: (e, t) => {
|
|
2088
|
-
|
|
2101
|
+
Wr({
|
|
2089
2102
|
type: "warning",
|
|
2090
2103
|
message: e,
|
|
2091
2104
|
options: t
|
|
2092
2105
|
});
|
|
2093
2106
|
},
|
|
2094
2107
|
error: (e, t) => {
|
|
2095
|
-
|
|
2108
|
+
Wr({
|
|
2096
2109
|
type: "error",
|
|
2097
2110
|
message: e,
|
|
2098
2111
|
options: t
|
|
@@ -2101,13 +2114,13 @@ var Vr = {
|
|
|
2101
2114
|
};
|
|
2102
2115
|
//#endregion
|
|
2103
2116
|
//#region src/utils/query-params.ts
|
|
2104
|
-
function
|
|
2117
|
+
function Kr(e) {
|
|
2105
2118
|
if (e === void 0) return;
|
|
2106
2119
|
let { q: t, f: n, p: r, s: i, t: a, n: o, b: s } = $(e), [c] = e.split("?");
|
|
2107
2120
|
return {
|
|
2108
2121
|
path: c,
|
|
2109
2122
|
text: t,
|
|
2110
|
-
filters: n ?
|
|
2123
|
+
filters: n ? Yr(n) : void 0,
|
|
2111
2124
|
page: r ? parseInt(r, 10) : void 0,
|
|
2112
2125
|
sort: i,
|
|
2113
2126
|
tab: a,
|
|
@@ -2115,17 +2128,17 @@ function Hr(e) {
|
|
|
2115
2128
|
basket: s
|
|
2116
2129
|
};
|
|
2117
2130
|
}
|
|
2118
|
-
function
|
|
2131
|
+
function qr(e) {
|
|
2119
2132
|
if (!e) return "";
|
|
2120
2133
|
let { text: t, filters: n, page: r, sort: i, tab: a, name: o, basket: s } = e, c = {};
|
|
2121
2134
|
return t && (c.q = t), n && (c.f = JSON.stringify(n)), r && (c.p = r.toString()), i && (c.s = i), a && (c.t = a), o && (c.n = o), s && (c.b = s), new URLSearchParams(c).toString() || "";
|
|
2122
2135
|
}
|
|
2123
|
-
function
|
|
2136
|
+
function Jr(e) {
|
|
2124
2137
|
if (e === void 0) return [];
|
|
2125
2138
|
let { f: t } = $(e);
|
|
2126
|
-
return
|
|
2139
|
+
return Yr(t);
|
|
2127
2140
|
}
|
|
2128
|
-
function
|
|
2141
|
+
function Yr(e) {
|
|
2129
2142
|
let t = decodeURIComponent(e);
|
|
2130
2143
|
try {
|
|
2131
2144
|
return JSON.parse(t ?? "[]");
|
|
@@ -2139,41 +2152,41 @@ function $(e) {
|
|
|
2139
2152
|
let n = new URLSearchParams(t);
|
|
2140
2153
|
return Object.fromEntries(n);
|
|
2141
2154
|
}
|
|
2142
|
-
function
|
|
2155
|
+
function Xr(e) {
|
|
2143
2156
|
let { q: t = "" } = $(e);
|
|
2144
2157
|
return t;
|
|
2145
2158
|
}
|
|
2146
|
-
function
|
|
2159
|
+
function Zr(e) {
|
|
2147
2160
|
let { id: t } = $(e);
|
|
2148
2161
|
return decodeURIComponent(t);
|
|
2149
2162
|
}
|
|
2150
|
-
function
|
|
2163
|
+
function Qr(e) {
|
|
2151
2164
|
let { p: t = "0" } = $(e);
|
|
2152
2165
|
return parseInt(t, 10);
|
|
2153
2166
|
}
|
|
2154
|
-
function
|
|
2167
|
+
function $r(e) {
|
|
2155
2168
|
let { t } = $(e);
|
|
2156
2169
|
return t;
|
|
2157
2170
|
}
|
|
2158
2171
|
//#endregion
|
|
2159
2172
|
//#region src/utils/syslang.ts
|
|
2160
|
-
function
|
|
2173
|
+
function ei(e, t) {
|
|
2161
2174
|
if (!e) return e;
|
|
2162
2175
|
let n = 0, r = e.length, i = 0;
|
|
2163
2176
|
if (e[i] === "[") {
|
|
2164
2177
|
for (; i < r && /[0-9]/.test(e[i]);) i++;
|
|
2165
2178
|
e[i] === "]" && (n = i + 1);
|
|
2166
2179
|
}
|
|
2167
|
-
let a =
|
|
2180
|
+
let a = ti(e, n, !1);
|
|
2168
2181
|
if (!a) return e;
|
|
2169
2182
|
let o = t.charCodeAt(0), s = t.charCodeAt(1), c = a;
|
|
2170
2183
|
for (; c;) if (o === c.lang1 && s === c.lang2) {
|
|
2171
|
-
let t =
|
|
2184
|
+
let t = ti(e, c.end + 4, !0);
|
|
2172
2185
|
return e.substring(t.start, t.end);
|
|
2173
|
-
} else c =
|
|
2186
|
+
} else c = ti(e, c.end + 4, !1);
|
|
2174
2187
|
return e.substring(a.start, a.end) || e;
|
|
2175
2188
|
}
|
|
2176
|
-
function
|
|
2189
|
+
function ti(e, t, n) {
|
|
2177
2190
|
for (let n = t, r = e.length - 3; n < r; n++) if (e[n] === "[" && e[n + 3] === "]") return {
|
|
2178
2191
|
start: t,
|
|
2179
2192
|
end: n,
|
|
@@ -2189,7 +2202,7 @@ function Zr(e, t, n) {
|
|
|
2189
2202
|
}
|
|
2190
2203
|
//#endregion
|
|
2191
2204
|
//#region src/utils/utilities.ts
|
|
2192
|
-
function
|
|
2205
|
+
function ni(e, t) {
|
|
2193
2206
|
let { useLocale: n, useLocaleAsPrefix: r, indexFile: i, path: a, folder: o } = t, s = n ? `${e}/` : null, c = r ? `${e}.${i}` : i ?? "";
|
|
2194
2207
|
return [
|
|
2195
2208
|
a,
|
|
@@ -2198,4 +2211,4 @@ function Qr(e, t) {
|
|
|
2198
2211
|
].filter((e) => e !== void 0).join("/");
|
|
2199
2212
|
}
|
|
2200
2213
|
//#endregion
|
|
2201
|
-
export {
|
|
2214
|
+
export { Bn as $, r as $n, Et as $t, gr as A, M as An, Qt as At, er as B, be as Bn, W as Bt, _r as C, Re as Cn, ln as Ct, Sr as D, je as Dn, Jt as Dt, yr as E, Me as En, en as Et, lr as F, k as Fn, Gt as Ft, Xn as G, m as Gn, H as Gt, $n as H, h as Hn, It as Ht, or as I, O as In, Kt as It, Jn as J, ne as Jn, Nt as Jt, qn as K, ie as Kn, V as Kt, tr as L, Se as Ln, G as Lt, cr as M, j as Mn, Zt as Mt, ur as N, we as Nn, nn as Nt, vr as O, F as On, Yt as Ot, sr as P, Ce as Pn, qt as Pt, Wn as Q, te as Qn, kt as Qt, ar as R, E as Rn, Wt as Rt, wr as S, ze as Sn, cn as St, xr as T, I as Tn, $t as Tt, nr as U, ue as Un, Ft as Ut, ir as V, de as Vn, Lt as Vt, Zn as W, ae as Wn, U as Wt, Un as X, p as Xn, jt as Xt, Kn as Y, re as Yn, Mt as Yt, Gn as Z, ee as Zn, At as Zt, Br as _, Ke as _n, _n as _t, Zr as a, z as an, n as ar, Fn as at, zr as b, Be as bn, pn as bt, $r as c, St as cn, On as ct, $ as d, gt as dn, jn as dt, Dt as en, d as er, zn as et, Gr as f, mt as fn, En as ft, Lr as g, Je as gn, hn as gt, Vr as h, Ye as hn, J as ht, Jr as i, wt as in, c as ir, Y as it, dr as j, Te as jn, K as jt, mr as k, De as kn, Xt as kt, Xr as l, bt as ln, kn as lt, Hr as m, at as mn, vn as mt, ei as n, Tt as nn, l as nr, Ln as nt, Qr as o, Ct as on, Pn as ot, Ur as p, ut as pn, Dn as pt, Yn as q, f as qn, Pt as qt, Yr as r, B as rn, s as rr, In as rt, Kr as s, R as sn, Mn as st, ni as t, Ot as tn, o as tr, Rn as tt, qr as u, vt as un, An as ut, Q as v, Ge as vn, gn as vt, br as w, Ie as wn, tn as wt, Ir as x, L as xn, q as xt, Rr as y, He as yn, mn as yt, rr as z, xe as zn, Vt as zt };
|