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