@sinequa/atomic 2.1.0 → 2.2.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/dist/atomic.cjs +1 -1
- package/dist/atomic.js +2 -2
- package/dist/spfx/index.cjs +1 -1
- package/dist/spfx/index.js +2 -2
- package/dist/{src-C3yJArxW.js → src-BCIlSfZp.js} +158 -121
- package/dist/src-Dg2926V9.cjs +1 -0
- package/dist/types/api-endpoints.d.ts +1 -1
- package/dist/types/api-endpoints.d.ts.map +1 -1
- package/dist/types/document-upload/container-document.d.ts +22 -0
- package/dist/types/document-upload/container-document.d.ts.map +1 -0
- package/dist/types/document-upload/container.d.ts +31 -0
- package/dist/types/document-upload/container.d.ts.map +1 -0
- package/dist/types/document-upload/index.d.ts +3 -0
- package/dist/types/document-upload/index.d.ts.map +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/security-principal/index.d.ts +2 -0
- package/dist/types/security-principal/index.d.ts.map +1 -0
- package/dist/types/security-principal/security-principal.d.ts +25 -0
- package/dist/types/security-principal/security-principal.d.ts.map +1 -0
- package/dist/web-api/index.d.ts +2 -0
- package/dist/web-api/index.d.ts.map +1 -1
- package/dist/web-api/v1/fetch-security-principal.d.ts +22 -0
- package/dist/web-api/v1/fetch-security-principal.d.ts.map +1 -0
- package/dist/web-api/v2/fetch-document-upload-container.d.ts +82 -0
- package/dist/web-api/v2/fetch-document-upload-container.d.ts.map +1 -0
- package/package.json +10 -7
- package/dist/src-CGNARSYI.cjs +0 -1
|
@@ -477,24 +477,24 @@ var E = class extends Error {
|
|
|
477
477
|
constructor(e, t) {
|
|
478
478
|
super(e), this.name = "ApiError", this.status = t;
|
|
479
479
|
}
|
|
480
|
-
},
|
|
480
|
+
}, Re = class extends E {
|
|
481
481
|
constructor(e = "Server error") {
|
|
482
482
|
super(e, 500), this.name = "ServerError";
|
|
483
483
|
}
|
|
484
|
-
},
|
|
484
|
+
}, ze = class extends E {
|
|
485
485
|
constructor(e = "Request timed out") {
|
|
486
486
|
super(e, 408), this.name = "TimeoutError";
|
|
487
487
|
}
|
|
488
|
-
},
|
|
488
|
+
}, D = class extends E {
|
|
489
489
|
constructor(e = "Unauthorized access") {
|
|
490
490
|
super(e, 401), this.name = "UnauthorizedError";
|
|
491
491
|
}
|
|
492
492
|
};
|
|
493
493
|
//#endregion
|
|
494
494
|
//#region src/web-api/helpers/handle-response.ts
|
|
495
|
-
async function
|
|
495
|
+
async function O(e, t = "json") {
|
|
496
496
|
let n = e.headers.get("sinequa-jwt-refresh");
|
|
497
|
-
if (n !== null &&
|
|
497
|
+
if (n !== null && Z(n), e.status >= 200 && e.status < 300) {
|
|
498
498
|
let n = e.headers.get("content-length");
|
|
499
499
|
if (e.status === 204 || n === "0") return;
|
|
500
500
|
switch (t) {
|
|
@@ -513,29 +513,29 @@ async function k(e, t = "json") {
|
|
|
513
513
|
throw y("Unauthorized access attempt with user override", {
|
|
514
514
|
endpoint: e.url ?? "",
|
|
515
515
|
error: t
|
|
516
|
-
}), new
|
|
516
|
+
}), new D(t.errorMessage ?? t.message ?? "Unauthorized... User override failed.");
|
|
517
517
|
}
|
|
518
|
-
return await
|
|
518
|
+
return await k(e, 401);
|
|
519
519
|
}
|
|
520
|
-
return e.status === 500 ? (b("Server error occurred", { endpoint: e.url ?? "" }), await
|
|
520
|
+
return e.status === 500 ? (b("Server error occurred", { endpoint: e.url ?? "" }), await k(e, 500)) : (y(`Unexpected response status: ${e.status}`, { endpoint: e.url ?? "" }), await k(e, e.status));
|
|
521
521
|
}
|
|
522
|
-
async function
|
|
522
|
+
async function k(e, t) {
|
|
523
523
|
try {
|
|
524
524
|
let { done: n, value: r } = await e.body?.getReader().read() || {
|
|
525
525
|
done: !0,
|
|
526
526
|
value: void 0
|
|
527
527
|
};
|
|
528
|
-
if (n || !r) throw t === 401 ? new
|
|
528
|
+
if (n || !r) throw t === 401 ? new D() : t === 500 ? new Re() : new E(`Request failed with status ${t}`, t);
|
|
529
529
|
let i = JSON.parse(new TextDecoder().decode(r));
|
|
530
530
|
throw Error(i.errorMessage || i.message || `Request failed with status ${t}`, { cause: {
|
|
531
531
|
errorCode: i.errorCode,
|
|
532
532
|
errorCodeTest: i.errorCodeTest
|
|
533
533
|
} });
|
|
534
534
|
} catch (e) {
|
|
535
|
-
throw e instanceof E ? e : t === 401 ? new
|
|
535
|
+
throw e instanceof E ? e : t === 401 ? new D(e.message) : t === 500 ? new Re(e.message) : new E(e.message ?? `Request failed with status ${t}`, t);
|
|
536
536
|
}
|
|
537
537
|
}
|
|
538
|
-
var
|
|
538
|
+
var A = new class {
|
|
539
539
|
client = null;
|
|
540
540
|
initialize(e) {
|
|
541
541
|
this.client = e;
|
|
@@ -548,17 +548,17 @@ var j = new class {
|
|
|
548
548
|
return this.client !== null;
|
|
549
549
|
}
|
|
550
550
|
}();
|
|
551
|
-
function
|
|
552
|
-
|
|
551
|
+
function Be(e) {
|
|
552
|
+
A.initialize(e);
|
|
553
553
|
}
|
|
554
554
|
//#endregion
|
|
555
555
|
//#region src/web-api/helpers/utils/resolve-no-auto-authentication.ts
|
|
556
|
-
function
|
|
556
|
+
function j() {
|
|
557
557
|
return r.authMode?.kind !== "sso";
|
|
558
558
|
}
|
|
559
559
|
//#endregion
|
|
560
560
|
//#region src/web-api/helpers/methods/del.ts
|
|
561
|
-
async function
|
|
561
|
+
async function M(e, t, n) {
|
|
562
562
|
let i = T(n?.headers), { app: a, backendUrl: o } = r, s = t ? `?${new URLSearchParams(t)}` : "", c = o ? `${o}/${e}${s}` : `${e}${s}`, l;
|
|
563
563
|
if (n?.body) {
|
|
564
564
|
i.has("Content-Type") || i.set("Content-Type", "application/json");
|
|
@@ -567,21 +567,21 @@ async function Be(e, t, n) {
|
|
|
567
567
|
...n.body,
|
|
568
568
|
locale: n.body.locale || navigator.language,
|
|
569
569
|
noUserOverride: !0,
|
|
570
|
-
noAutoAuthentication:
|
|
570
|
+
noAutoAuthentication: j()
|
|
571
571
|
};
|
|
572
572
|
l = JSON.stringify(e);
|
|
573
573
|
}
|
|
574
574
|
_(`Making DELETE request to: ${c}`);
|
|
575
575
|
try {
|
|
576
|
-
if (
|
|
577
|
-
let e =
|
|
578
|
-
return
|
|
576
|
+
if (A.isInitialized()) {
|
|
577
|
+
let e = A.getClient();
|
|
578
|
+
return O(await e.fetch(c, e.constructor.configurations.v1, {
|
|
579
579
|
method: "DELETE",
|
|
580
580
|
headers: i,
|
|
581
581
|
body: l
|
|
582
582
|
}), n?.responseType);
|
|
583
583
|
}
|
|
584
|
-
return
|
|
584
|
+
return O(await fetch(c, {
|
|
585
585
|
method: "DELETE",
|
|
586
586
|
credentials: "include",
|
|
587
587
|
headers: i,
|
|
@@ -599,14 +599,14 @@ async function N(e, t, n) {
|
|
|
599
599
|
let s = a ? `${a}/${e}${o}` : `${e}${o}`;
|
|
600
600
|
_(`Making GET request to: ${s}`);
|
|
601
601
|
try {
|
|
602
|
-
if (
|
|
603
|
-
let e =
|
|
604
|
-
return
|
|
602
|
+
if (A.isInitialized()) {
|
|
603
|
+
let e = A.getClient();
|
|
604
|
+
return O(await e.get(s, e.constructor.configurations.v1, {
|
|
605
605
|
headers: i,
|
|
606
606
|
signal: n?.signal
|
|
607
607
|
}), n?.responseType);
|
|
608
608
|
}
|
|
609
|
-
return
|
|
609
|
+
return O(await fetch(s, {
|
|
610
610
|
method: "GET",
|
|
611
611
|
credentials: "include",
|
|
612
612
|
headers: i,
|
|
@@ -627,19 +627,19 @@ async function Ve(e, t, n) {
|
|
|
627
627
|
...t,
|
|
628
628
|
locale: t.locale || navigator.language,
|
|
629
629
|
noUserOverride: !0,
|
|
630
|
-
noAutoAuthentication:
|
|
630
|
+
noAutoAuthentication: j()
|
|
631
631
|
}, c = o ? `${o}/${e}` : `${e}`;
|
|
632
632
|
_(`Making PATCH request to: ${c}`);
|
|
633
633
|
try {
|
|
634
|
-
if (
|
|
635
|
-
let e =
|
|
636
|
-
return
|
|
634
|
+
if (A.isInitialized()) {
|
|
635
|
+
let e = A.getClient();
|
|
636
|
+
return O(await e.fetch(c, e.constructor.configurations.v1, {
|
|
637
637
|
method: "PATCH",
|
|
638
638
|
headers: i,
|
|
639
639
|
body: JSON.stringify(s)
|
|
640
640
|
}), n?.responseType);
|
|
641
641
|
}
|
|
642
|
-
return
|
|
642
|
+
return O(await fetch(c, {
|
|
643
643
|
method: "PATCH",
|
|
644
644
|
headers: i,
|
|
645
645
|
credentials: "include",
|
|
@@ -659,21 +659,21 @@ async function P(e, t, n) {
|
|
|
659
659
|
...t,
|
|
660
660
|
locale: t.locale || navigator.language,
|
|
661
661
|
noUserOverride: !0,
|
|
662
|
-
noAutoAuthentication:
|
|
662
|
+
noAutoAuthentication: j()
|
|
663
663
|
};
|
|
664
664
|
e.startsWith("plugin") && (e = `api/v1/${e}`);
|
|
665
665
|
let c = o ? `${o}/${e}` : `${e}`;
|
|
666
666
|
_(`Making POST request to: ${c}`);
|
|
667
667
|
try {
|
|
668
|
-
if (
|
|
669
|
-
let e =
|
|
670
|
-
return
|
|
668
|
+
if (A.isInitialized()) {
|
|
669
|
+
let e = A.getClient();
|
|
670
|
+
return O(await e.post(c, e.constructor.configurations.v1, {
|
|
671
671
|
headers: i,
|
|
672
672
|
body: JSON.stringify(s),
|
|
673
673
|
signal: n?.signal
|
|
674
674
|
}), n?.responseType);
|
|
675
675
|
}
|
|
676
|
-
return
|
|
676
|
+
return O(await fetch(c, {
|
|
677
677
|
method: "POST",
|
|
678
678
|
headers: i,
|
|
679
679
|
credentials: "include",
|
|
@@ -694,19 +694,19 @@ async function He(e, t, n) {
|
|
|
694
694
|
...t,
|
|
695
695
|
locale: t.locale || navigator.language,
|
|
696
696
|
noUserOverride: !0,
|
|
697
|
-
noAutoAuthentication:
|
|
697
|
+
noAutoAuthentication: j()
|
|
698
698
|
}, c = `${o}/${e}`;
|
|
699
699
|
_(`Making PUT request to: ${c}`);
|
|
700
700
|
try {
|
|
701
|
-
if (
|
|
702
|
-
let e =
|
|
703
|
-
return
|
|
701
|
+
if (A.isInitialized()) {
|
|
702
|
+
let e = A.getClient();
|
|
703
|
+
return O(await e.fetch(c, e.constructor.configurations.v1, {
|
|
704
704
|
method: "PUT",
|
|
705
705
|
headers: i,
|
|
706
706
|
body: JSON.stringify(s)
|
|
707
707
|
}), n?.responseType);
|
|
708
708
|
}
|
|
709
|
-
return
|
|
709
|
+
return O(await fetch(c, {
|
|
710
710
|
method: "PUT",
|
|
711
711
|
headers: i,
|
|
712
712
|
credentials: "include",
|
|
@@ -721,7 +721,7 @@ async function He(e, t, n) {
|
|
|
721
721
|
function F(e) {
|
|
722
722
|
let t = new AbortController(), { signal: n } = t;
|
|
723
723
|
return e && setTimeout(() => {
|
|
724
|
-
n.aborted || t.abort(new
|
|
724
|
+
n.aborted || t.abort(new ze(`Request timed out after ${e}ms`));
|
|
725
725
|
}, e), {
|
|
726
726
|
controller: t,
|
|
727
727
|
signal: n
|
|
@@ -1113,7 +1113,7 @@ async function xt(e, t, n) {
|
|
|
1113
1113
|
$auditRecord: { auditEvents: [n] }
|
|
1114
1114
|
};
|
|
1115
1115
|
K(i);
|
|
1116
|
-
let { aggregations: a } = await
|
|
1116
|
+
let { aggregations: a } = await O(await P("api/v1/query", i)), o = a[0];
|
|
1117
1117
|
return o.$hasMore = o.items.length > 10, o.items = [...e.items, ...o.items], Promise.resolve(o);
|
|
1118
1118
|
}
|
|
1119
1119
|
//#endregion
|
|
@@ -1368,7 +1368,7 @@ async function zt(e, t) {
|
|
|
1368
1368
|
}
|
|
1369
1369
|
async function Bt(e) {
|
|
1370
1370
|
let t = new Headers();
|
|
1371
|
-
t.append("content-type", "text"),
|
|
1371
|
+
t.append("content-type", "text"), O(await fetch(e, {
|
|
1372
1372
|
method: "GET",
|
|
1373
1373
|
headers: t
|
|
1374
1374
|
}));
|
|
@@ -1378,12 +1378,12 @@ async function Bt(e) {
|
|
|
1378
1378
|
async function Vt() {
|
|
1379
1379
|
return N("api/v1/principal", new URLSearchParams({
|
|
1380
1380
|
action: "get",
|
|
1381
|
-
noAutoAuthentication: String(
|
|
1381
|
+
noAutoAuthentication: String(j())
|
|
1382
1382
|
}));
|
|
1383
1383
|
}
|
|
1384
1384
|
async function Ht(e) {
|
|
1385
1385
|
let t = {
|
|
1386
|
-
noAutoAuthentication: String(
|
|
1386
|
+
noAutoAuthentication: String(j()),
|
|
1387
1387
|
...e
|
|
1388
1388
|
}, n = new URLSearchParams();
|
|
1389
1389
|
return Object.entries(t).forEach(([e, t]) => {
|
|
@@ -1393,13 +1393,13 @@ async function Ht(e) {
|
|
|
1393
1393
|
async function Ut(e) {
|
|
1394
1394
|
return e ? N("api/v1/principal", new URLSearchParams({
|
|
1395
1395
|
action: "userid",
|
|
1396
|
-
noAutoAuthentication: String(
|
|
1396
|
+
noAutoAuthentication: String(j()),
|
|
1397
1397
|
userid: e
|
|
1398
1398
|
})) : Promise.reject(/* @__PURE__ */ Error("userid is required"));
|
|
1399
1399
|
}
|
|
1400
1400
|
async function Wt(e) {
|
|
1401
1401
|
return e.length === 0 ? Promise.reject(/* @__PURE__ */ Error("userids is required")) : N("api/v1/principal/userids", new URLSearchParams({
|
|
1402
|
-
noAutoAuthentication: String(
|
|
1402
|
+
noAutoAuthentication: String(j()),
|
|
1403
1403
|
userids: [...e].join(",")
|
|
1404
1404
|
}));
|
|
1405
1405
|
}
|
|
@@ -1492,8 +1492,13 @@ async function Xt(e) {
|
|
|
1492
1492
|
return (await P("api/v1/queryintent", { query: e }))?.intents;
|
|
1493
1493
|
}
|
|
1494
1494
|
//#endregion
|
|
1495
|
+
//#region src/web-api/v1/fetch-security-principal.ts
|
|
1496
|
+
function Zt(e, t) {
|
|
1497
|
+
return P("api/v1/security.principal", e, { signal: t });
|
|
1498
|
+
}
|
|
1499
|
+
//#endregion
|
|
1495
1500
|
//#region src/web-api/v1/fetch-similar-documents.ts
|
|
1496
|
-
async function
|
|
1501
|
+
async function Qt(e, t, n) {
|
|
1497
1502
|
return (await P("api/v1/similardocuments", {
|
|
1498
1503
|
sourceDocumentId: e,
|
|
1499
1504
|
query: { name: t }
|
|
@@ -1501,7 +1506,7 @@ async function Zt(e, t, n) {
|
|
|
1501
1506
|
}
|
|
1502
1507
|
//#endregion
|
|
1503
1508
|
//#region src/web-api/v1/fetch-sponsored-links.ts
|
|
1504
|
-
async function
|
|
1509
|
+
async function $t(e, t) {
|
|
1505
1510
|
return (await P("api/v1/query.links", {
|
|
1506
1511
|
webservice: e,
|
|
1507
1512
|
query: t
|
|
@@ -1512,9 +1517,9 @@ async function Qt(e, t) {
|
|
|
1512
1517
|
}
|
|
1513
1518
|
//#endregion
|
|
1514
1519
|
//#region src/utils/to-sql.ts
|
|
1515
|
-
function
|
|
1520
|
+
function en(e, t) {
|
|
1516
1521
|
if (typeof e == "number") return `${e}`;
|
|
1517
|
-
if (ot(e)) return t ? `'${
|
|
1522
|
+
if (ot(e)) return t ? `'${tn(e)}'` : tn(e);
|
|
1518
1523
|
if (typeof e == "boolean") return e ? "true" : "false";
|
|
1519
1524
|
if (e === null) return "null";
|
|
1520
1525
|
if (Array.isArray(e)) {
|
|
@@ -1525,7 +1530,7 @@ function $t(e, t) {
|
|
|
1525
1530
|
}
|
|
1526
1531
|
return t ? `'${e}'` : e;
|
|
1527
1532
|
}
|
|
1528
|
-
function
|
|
1533
|
+
function tn(e) {
|
|
1529
1534
|
if (!e) return "";
|
|
1530
1535
|
try {
|
|
1531
1536
|
return lt(e) === 0 ? new Intl.DateTimeFormat("en-CA", {
|
|
@@ -1544,7 +1549,7 @@ function en(e) {
|
|
|
1544
1549
|
}
|
|
1545
1550
|
//#endregion
|
|
1546
1551
|
//#region src/web-api/v1/fetch-suggest.ts
|
|
1547
|
-
async function
|
|
1552
|
+
async function nn(e, t, n, i, a) {
|
|
1548
1553
|
let { app: o } = r, s = {
|
|
1549
1554
|
app: o || "",
|
|
1550
1555
|
suggestQuery: e,
|
|
@@ -1559,7 +1564,7 @@ async function tn(e, t, n, i, a) {
|
|
|
1559
1564
|
throw console.error("Error fetching suggestions:", e), e;
|
|
1560
1565
|
}
|
|
1561
1566
|
}
|
|
1562
|
-
async function
|
|
1567
|
+
async function rn(e, t, n, i) {
|
|
1563
1568
|
let { app: a } = r;
|
|
1564
1569
|
return (await P("api/v1/suggestquery", {
|
|
1565
1570
|
app: a || "",
|
|
@@ -1569,7 +1574,7 @@ async function nn(e, t, n, i) {
|
|
|
1569
1574
|
kinds: i
|
|
1570
1575
|
})).suggests;
|
|
1571
1576
|
}
|
|
1572
|
-
async function
|
|
1577
|
+
async function an(e, t, n) {
|
|
1573
1578
|
if (!t) return Promise.resolve([]);
|
|
1574
1579
|
let { app: i } = r, a = await P("api/v1/suggestfield", {
|
|
1575
1580
|
app: i || "",
|
|
@@ -1578,12 +1583,12 @@ async function rn(e, t, n) {
|
|
|
1578
1583
|
query: n
|
|
1579
1584
|
});
|
|
1580
1585
|
return a.suggests.forEach((e) => {
|
|
1581
|
-
e.display =
|
|
1586
|
+
e.display = en(e.display);
|
|
1582
1587
|
}), a.suggests;
|
|
1583
1588
|
}
|
|
1584
1589
|
//#endregion
|
|
1585
1590
|
//#region src/web-api/v1/fetch-text-chunk.ts
|
|
1586
|
-
async function
|
|
1591
|
+
async function on(e, t, n, r, i, a) {
|
|
1587
1592
|
return P("api/v1/doc.textchunks", {
|
|
1588
1593
|
id: e,
|
|
1589
1594
|
textChunks: t,
|
|
@@ -1595,14 +1600,14 @@ async function an(e, t, n, r, i, a) {
|
|
|
1595
1600
|
}
|
|
1596
1601
|
//#endregion
|
|
1597
1602
|
//#region src/web-api/v1/fetch-user-settings.ts
|
|
1598
|
-
async function
|
|
1603
|
+
async function sn() {
|
|
1599
1604
|
let { app: e } = r;
|
|
1600
1605
|
return N("api/v1/usersettings", new URLSearchParams({
|
|
1601
1606
|
app: e || "",
|
|
1602
1607
|
action: "load"
|
|
1603
1608
|
}));
|
|
1604
1609
|
}
|
|
1605
|
-
async function
|
|
1610
|
+
async function cn(e, t) {
|
|
1606
1611
|
let n = {
|
|
1607
1612
|
action: "save",
|
|
1608
1613
|
userSettings: e,
|
|
@@ -1610,7 +1615,7 @@ async function sn(e, t) {
|
|
|
1610
1615
|
};
|
|
1611
1616
|
return K(n), P("api/v1/usersettings", n);
|
|
1612
1617
|
}
|
|
1613
|
-
async function
|
|
1618
|
+
async function ln(e, t) {
|
|
1614
1619
|
let n = {
|
|
1615
1620
|
action: "patch",
|
|
1616
1621
|
userSettings: e,
|
|
@@ -1618,20 +1623,52 @@ async function cn(e, t) {
|
|
|
1618
1623
|
};
|
|
1619
1624
|
return K(n), P("api/v1/usersettings", n);
|
|
1620
1625
|
}
|
|
1621
|
-
async function
|
|
1622
|
-
return
|
|
1626
|
+
async function un() {
|
|
1627
|
+
return cn({}, { type: "UserSettings_Reset" });
|
|
1623
1628
|
}
|
|
1624
1629
|
//#endregion
|
|
1625
1630
|
//#region src/web-api/v2/fetch-change-password.ts
|
|
1626
|
-
async function
|
|
1631
|
+
async function dn(e, t) {
|
|
1627
1632
|
return P("api/v2/security/password/change", {
|
|
1628
1633
|
newPassword: e,
|
|
1629
1634
|
currentPassword: t
|
|
1630
1635
|
});
|
|
1631
1636
|
}
|
|
1632
1637
|
//#endregion
|
|
1638
|
+
//#region src/web-api/v2/fetch-document-upload-container.ts
|
|
1639
|
+
var J = "api/v2/document-upload/container";
|
|
1640
|
+
function fn(e) {
|
|
1641
|
+
let t = new URLSearchParams();
|
|
1642
|
+
return e.page !== void 0 && t.set("page", String(e.page)), e.pageSize !== void 0 && t.set("pageSize", String(e.pageSize)), t;
|
|
1643
|
+
}
|
|
1644
|
+
function pn(e = {}) {
|
|
1645
|
+
return N(J, fn(e));
|
|
1646
|
+
}
|
|
1647
|
+
function mn(e) {
|
|
1648
|
+
return N(`${J}/${encodeURIComponent(e)}`);
|
|
1649
|
+
}
|
|
1650
|
+
function hn(e) {
|
|
1651
|
+
return P(J, e);
|
|
1652
|
+
}
|
|
1653
|
+
function gn(e, t) {
|
|
1654
|
+
return He(`${J}/${encodeURIComponent(e)}`, t);
|
|
1655
|
+
}
|
|
1656
|
+
async function _n(e) {
|
|
1657
|
+
let t = (await M("api/v2/document-upload/containers", void 0, { body: { containerIds: e } }))?.failed ?? [], n = new Set(t.map((e) => e.containerId));
|
|
1658
|
+
return {
|
|
1659
|
+
succeeded: e.filter((e) => !n.has(e)),
|
|
1660
|
+
failed: t
|
|
1661
|
+
};
|
|
1662
|
+
}
|
|
1663
|
+
function vn(e, t = {}) {
|
|
1664
|
+
return N(`${J}/${encodeURIComponent(e)}/documents`, fn(t));
|
|
1665
|
+
}
|
|
1666
|
+
function yn(e, t) {
|
|
1667
|
+
return M(`${J}/${encodeURIComponent(e)}/documents`, void 0, { body: { fileIds: t } });
|
|
1668
|
+
}
|
|
1669
|
+
//#endregion
|
|
1633
1670
|
//#region src/web-api/v2/fetch-forgot-password.ts
|
|
1634
|
-
async function
|
|
1671
|
+
async function bn(e) {
|
|
1635
1672
|
return P("api/v2/security/password/ask-reset-email", {
|
|
1636
1673
|
changePasswordRedirectUrl: `${window.location.origin}/login?mode=changepassword`,
|
|
1637
1674
|
userName: e
|
|
@@ -1639,30 +1676,30 @@ async function dn(e) {
|
|
|
1639
1676
|
}
|
|
1640
1677
|
//#endregion
|
|
1641
1678
|
//#region src/web-api/v2/fetch-user-profile.ts
|
|
1642
|
-
async function
|
|
1679
|
+
async function xn(e) {
|
|
1643
1680
|
return await N(`api/v2/user-profile/${e}`);
|
|
1644
1681
|
}
|
|
1645
|
-
async function
|
|
1682
|
+
async function Sn(e) {
|
|
1646
1683
|
return await P("api/v2/user-profile", e);
|
|
1647
1684
|
}
|
|
1648
|
-
async function
|
|
1685
|
+
async function Cn(e, t, n) {
|
|
1649
1686
|
return await Ve(`api/v2/user-profile/${e.data?.id}/${t}/${n}`, e);
|
|
1650
1687
|
}
|
|
1651
|
-
async function
|
|
1652
|
-
return (await
|
|
1688
|
+
async function wn(e, t, n) {
|
|
1689
|
+
return (await M(`api/v2/user-profile/${e.data?.id}/${t}/${n}`)).success === !0;
|
|
1653
1690
|
}
|
|
1654
1691
|
//#endregion
|
|
1655
1692
|
//#region src/web-api/v2/fetch-version.ts
|
|
1656
|
-
async function
|
|
1693
|
+
async function Tn() {
|
|
1657
1694
|
return await N("api/v2/version");
|
|
1658
1695
|
}
|
|
1659
1696
|
//#endregion
|
|
1660
1697
|
//#region src/authentication/constants.ts
|
|
1661
|
-
var
|
|
1698
|
+
var Y = 1e4, X = "sinequa-auth-redirect-attempt", En = async () => {
|
|
1662
1699
|
let { autoOAuthProvider: e } = r;
|
|
1663
1700
|
if (!e) throw Error("autoOAuthProvider is not configured in globalConfig");
|
|
1664
1701
|
if (typeof window > "u") try {
|
|
1665
|
-
let { signal: t } = F(
|
|
1702
|
+
let { signal: t } = F(Y);
|
|
1666
1703
|
return await P("security.oauth", {
|
|
1667
1704
|
action: "getcode",
|
|
1668
1705
|
provider: e,
|
|
@@ -1679,23 +1716,23 @@ var J = 1e4, Y = "sinequa-auth-redirect-attempt", _n = async () => {
|
|
|
1679
1716
|
originalUrl: window.location.href
|
|
1680
1717
|
};
|
|
1681
1718
|
try {
|
|
1682
|
-
let { signal: n } = F(
|
|
1719
|
+
let { signal: n } = F(Y), r = await P("api/v1/security.oauth", t, { signal: n });
|
|
1683
1720
|
if (r.redirectUrl) {
|
|
1684
1721
|
let t = new URL(r.redirectUrl, window.location.origin);
|
|
1685
1722
|
if (t.protocol === "https:" || t.protocol === "http:") {
|
|
1686
|
-
if (u("sinequa-auth-redirect-attempt")) throw f(
|
|
1687
|
-
d(
|
|
1723
|
+
if (u("sinequa-auth-redirect-attempt")) throw f(X), Error(`OAuth sign-in with provider "${e}" did not establish a session — its callback is likely not authorized for this application.`);
|
|
1724
|
+
d(X, "1"), window.location.href = t.href;
|
|
1688
1725
|
}
|
|
1689
1726
|
}
|
|
1690
1727
|
return r;
|
|
1691
1728
|
} catch (e) {
|
|
1692
1729
|
throw b("Failed to authenticate with OAuth", e), e;
|
|
1693
1730
|
}
|
|
1694
|
-
},
|
|
1731
|
+
}, Dn = async () => {
|
|
1695
1732
|
let { autoSAMLProvider: e } = r;
|
|
1696
1733
|
if (!e) throw Error("autoSAMLProvider is not configured in globalConfig");
|
|
1697
1734
|
if (typeof window > "u") try {
|
|
1698
|
-
let { signal: t } = F(
|
|
1735
|
+
let { signal: t } = F(Y);
|
|
1699
1736
|
return await P("security.saml", {
|
|
1700
1737
|
action: "getresponse",
|
|
1701
1738
|
provider: e,
|
|
@@ -1712,31 +1749,31 @@ var J = 1e4, Y = "sinequa-auth-redirect-attempt", _n = async () => {
|
|
|
1712
1749
|
originalUrl: window.location.href
|
|
1713
1750
|
};
|
|
1714
1751
|
try {
|
|
1715
|
-
let { signal: n } = F(
|
|
1752
|
+
let { signal: n } = F(Y), r = await P("api/v1/security.saml", t, { signal: n });
|
|
1716
1753
|
if (r.redirectUrl) {
|
|
1717
1754
|
let t = new URL(r.redirectUrl, window.location.origin);
|
|
1718
1755
|
if (t.protocol === "https:" || t.protocol === "http:") {
|
|
1719
|
-
if (u("sinequa-auth-redirect-attempt")) throw f(
|
|
1720
|
-
d(
|
|
1756
|
+
if (u("sinequa-auth-redirect-attempt")) throw f(X), Error(`SAML sign-in with provider "${e}" did not establish a session — its callback is likely not authorized for this application.`);
|
|
1757
|
+
d(X, "1"), window.location.href = t.href;
|
|
1721
1758
|
}
|
|
1722
1759
|
}
|
|
1723
1760
|
return r;
|
|
1724
1761
|
} catch (e) {
|
|
1725
1762
|
throw b("Failed to authenticate with SAML", e), e;
|
|
1726
1763
|
}
|
|
1727
|
-
},
|
|
1764
|
+
}, Z = (e) => d("sinequa-credentials", JSON.stringify({ data: { csrfToken: e } })), Q = async () => {
|
|
1728
1765
|
let e;
|
|
1729
1766
|
try {
|
|
1730
|
-
let { signal: t } = F(
|
|
1767
|
+
let { signal: t } = F(Y);
|
|
1731
1768
|
e = await N("api/v1/challenge?action=getCsrfToken&suppressErrors=true", void 0, { signal: t });
|
|
1732
1769
|
} catch (e) {
|
|
1733
1770
|
throw y("CSRF token fetch failed", e), e;
|
|
1734
1771
|
}
|
|
1735
|
-
return e?.csrfToken ? (
|
|
1772
|
+
return e?.csrfToken ? (Z(e.csrfToken), e.csrfToken) : null;
|
|
1736
1773
|
};
|
|
1737
1774
|
//#endregion
|
|
1738
1775
|
//#region src/authentication/tokens/get-jwt-token.ts
|
|
1739
|
-
async function
|
|
1776
|
+
async function On(e) {
|
|
1740
1777
|
if (e) {
|
|
1741
1778
|
let { username: t, password: n } = e, r = {
|
|
1742
1779
|
action: "get",
|
|
@@ -1747,8 +1784,8 @@ async function Q(e) {
|
|
|
1747
1784
|
noAutoAuthentication: !0
|
|
1748
1785
|
};
|
|
1749
1786
|
try {
|
|
1750
|
-
let { signal: e } = F(
|
|
1751
|
-
return t?.csrfToken ? (
|
|
1787
|
+
let { signal: e } = F(Y), t = await P("api/v1/security.webtoken", r, { signal: e });
|
|
1788
|
+
return t?.csrfToken ? (Z(t.csrfToken), t.csrfToken) : null;
|
|
1752
1789
|
} catch (e) {
|
|
1753
1790
|
throw b("Failed to get JWT", e), e;
|
|
1754
1791
|
}
|
|
@@ -1761,8 +1798,8 @@ async function Q(e) {
|
|
|
1761
1798
|
}, { bearerToken: t } = r;
|
|
1762
1799
|
if (!t) throw Error("Bearer token is required in globalConfig for credentialless JWT retrieval.");
|
|
1763
1800
|
try {
|
|
1764
|
-
let { signal: t } = F(
|
|
1765
|
-
return n?.csrfToken ? (
|
|
1801
|
+
let { signal: t } = F(Y), n = await P("api/v1/security.webtoken", e, { signal: t });
|
|
1802
|
+
return n?.csrfToken ? (Z(n.csrfToken), n.csrfToken) : null;
|
|
1766
1803
|
} catch (e) {
|
|
1767
1804
|
throw b("Failed to get JWT without credentials", e), e;
|
|
1768
1805
|
}
|
|
@@ -1779,15 +1816,15 @@ var $ = () => {
|
|
|
1779
1816
|
y("Failed to parse session storage credentials, falling back to local storage", e);
|
|
1780
1817
|
}
|
|
1781
1818
|
return s("csrfToken") || null;
|
|
1782
|
-
},
|
|
1783
|
-
c(
|
|
1784
|
-
},
|
|
1785
|
-
l(
|
|
1786
|
-
},
|
|
1787
|
-
e ? d(
|
|
1788
|
-
},
|
|
1819
|
+
}, kn = "sinequa-last-auth-mode", An = () => {
|
|
1820
|
+
c(kn, "credentials");
|
|
1821
|
+
}, jn = () => s(kn) === "credentials", Mn = () => {
|
|
1822
|
+
l(kn);
|
|
1823
|
+
}, Nn = "sinequa-authenticated", Pn = (e) => {
|
|
1824
|
+
e ? d(Nn, "true") : f(Nn);
|
|
1825
|
+
}, Fn = () => u(Nn) === "true", In = async () => {
|
|
1789
1826
|
try {
|
|
1790
|
-
let { signal: e } = F(
|
|
1827
|
+
let { signal: e } = F(Y);
|
|
1791
1828
|
return await N("api/v1/principal", new URLSearchParams({ action: "get" }), {
|
|
1792
1829
|
signal: e,
|
|
1793
1830
|
redirect: "manual"
|
|
@@ -1795,49 +1832,49 @@ var $ = () => {
|
|
|
1795
1832
|
} catch {
|
|
1796
1833
|
return !1;
|
|
1797
1834
|
}
|
|
1798
|
-
},
|
|
1835
|
+
}, Ln = () => jn() ? t.credentials() : t.sso(), Rn = async (n) => {
|
|
1799
1836
|
if (n) {
|
|
1800
1837
|
let { username: t, password: r } = n;
|
|
1801
|
-
return !t || !r ? (b("Credentials are required for authentication"), e(!1), !1) :
|
|
1838
|
+
return !t || !r ? (b("Credentials are required for authentication"), e(!1), !1) : zn({
|
|
1802
1839
|
username: t,
|
|
1803
1840
|
password: r
|
|
1804
1841
|
});
|
|
1805
1842
|
}
|
|
1806
1843
|
let a = r.authMode ?? t.unknown();
|
|
1807
1844
|
if (a.kind === "credentials") return e(!1), !1;
|
|
1808
|
-
if (a.kind === "bearer") return
|
|
1845
|
+
if (a.kind === "bearer") return Bn();
|
|
1809
1846
|
if ($()) {
|
|
1810
|
-
if (v("User already authenticated (existing token)"), i({ isRedirectUrl: !1 }), f(
|
|
1811
|
-
let e =
|
|
1847
|
+
if (v("User already authenticated (existing token)"), i({ isRedirectUrl: !1 }), f(X), a.kind === "unknown") {
|
|
1848
|
+
let e = Ln();
|
|
1812
1849
|
v(`Ambiguous auth mode resolved to "${e.kind}"`), i({ authMode: e });
|
|
1813
1850
|
}
|
|
1814
1851
|
return e(!0), !0;
|
|
1815
1852
|
}
|
|
1816
1853
|
try {
|
|
1817
|
-
if (v("Checking for an existing session via CSRF token retrieval"), await
|
|
1818
|
-
if (v("User already authenticated (existing session)"), f(
|
|
1819
|
-
let e =
|
|
1854
|
+
if (v("Checking for an existing session via CSRF token retrieval"), await Q()) {
|
|
1855
|
+
if (v("User already authenticated (existing session)"), f(X), a.kind === "unknown") {
|
|
1856
|
+
let e = Ln();
|
|
1820
1857
|
v(`Ambiguous auth mode resolved to "${e.kind}"`), i({ authMode: e });
|
|
1821
1858
|
}
|
|
1822
1859
|
return e(!0), !0;
|
|
1823
1860
|
}
|
|
1824
1861
|
} catch {}
|
|
1825
1862
|
switch (a.kind) {
|
|
1826
|
-
case "oauth": return v("Initiating OAuth authentication flow"), await
|
|
1827
|
-
case "saml": return v("Initiating SAML authentication flow"), await
|
|
1863
|
+
case "oauth": return v("Initiating OAuth authentication flow"), await En(), e(!1), !1;
|
|
1864
|
+
case "saml": return v("Initiating SAML authentication flow"), await Dn(), e(!1), !1;
|
|
1828
1865
|
case "sso": return e(!1), !1;
|
|
1829
|
-
default: return v("No provider declared — probing for server-side auto-authentication (OIDC)"), await
|
|
1866
|
+
default: return v("No provider declared — probing for server-side auto-authentication (OIDC)"), await In() ? (v("User auto-authenticated by the server (OIDC)"), f(X), i({ authMode: t.sso() }), await Q().catch(() => {}), Pn(!0), e(!0), !0) : (i({ authMode: t.credentials() }), e(!1), !1);
|
|
1830
1867
|
}
|
|
1831
1868
|
};
|
|
1832
|
-
async function
|
|
1833
|
-
v("Attempting authentication using credentials"), i({ authMode: t.credentials() }),
|
|
1869
|
+
async function zn(n) {
|
|
1870
|
+
v("Attempting authentication using credentials"), i({ authMode: t.credentials() }), An();
|
|
1834
1871
|
let { userOverrideActive: a, userOverride: o } = r;
|
|
1835
1872
|
i({
|
|
1836
1873
|
userOverrideActive: !1,
|
|
1837
1874
|
userOverride: void 0
|
|
1838
1875
|
});
|
|
1839
1876
|
try {
|
|
1840
|
-
await
|
|
1877
|
+
await On(n);
|
|
1841
1878
|
} catch (t) {
|
|
1842
1879
|
throw e(!1), t;
|
|
1843
1880
|
}
|
|
@@ -1846,9 +1883,9 @@ async function kn(n) {
|
|
|
1846
1883
|
userOverride: o
|
|
1847
1884
|
}), e(!0), !0;
|
|
1848
1885
|
}
|
|
1849
|
-
async function
|
|
1886
|
+
async function Bn() {
|
|
1850
1887
|
try {
|
|
1851
|
-
if (v("Attempting authentication using bearer token"), await
|
|
1888
|
+
if (v("Attempting authentication using bearer token"), await On()) return e(!0), !0;
|
|
1852
1889
|
} catch (t) {
|
|
1853
1890
|
throw b("Bearer authentication failed", t), e(!1), t;
|
|
1854
1891
|
}
|
|
@@ -1856,31 +1893,31 @@ async function An() {
|
|
|
1856
1893
|
}
|
|
1857
1894
|
//#endregion
|
|
1858
1895
|
//#region src/authentication/tokens/delete-web-token-cookie.ts
|
|
1859
|
-
var
|
|
1896
|
+
var Vn = async () => {
|
|
1860
1897
|
let e = new URLSearchParams({
|
|
1861
1898
|
action: "deleteWebTokenCookie",
|
|
1862
1899
|
noUserOverride: "true",
|
|
1863
1900
|
noAutoAuthentication: "true"
|
|
1864
|
-
}), { signal: t } = F(
|
|
1901
|
+
}), { signal: t } = F(Y);
|
|
1865
1902
|
return N("api/v1/challenge", e, { signal: t });
|
|
1866
1903
|
};
|
|
1867
1904
|
//#endregion
|
|
1868
1905
|
//#region src/authentication/session/logout.ts
|
|
1869
|
-
async function
|
|
1906
|
+
async function Hn() {
|
|
1870
1907
|
let { userOverrideActive: e } = r;
|
|
1871
|
-
if (
|
|
1872
|
-
let { methodresult: e, logoutUrl: t } = await
|
|
1908
|
+
if (Un(), Mn(), !e) try {
|
|
1909
|
+
let { methodresult: e, logoutUrl: t } = await Vn();
|
|
1873
1910
|
if (e === "ok") return t;
|
|
1874
1911
|
b("logout failed");
|
|
1875
1912
|
} catch (e) {
|
|
1876
1913
|
b("logout failed", e);
|
|
1877
1914
|
}
|
|
1878
1915
|
}
|
|
1879
|
-
function
|
|
1880
|
-
l("csrfToken"), f("sinequa-credentials"),
|
|
1916
|
+
function Un() {
|
|
1917
|
+
l("csrfToken"), f("sinequa-credentials"), Pn(!1), e(!1);
|
|
1881
1918
|
}
|
|
1882
1919
|
//#endregion
|
|
1883
1920
|
//#region src/authentication/session/user-authentication.ts
|
|
1884
|
-
var
|
|
1921
|
+
var Wn = () => !!$() || Fn();
|
|
1885
1922
|
//#endregion
|
|
1886
|
-
export {
|
|
1923
|
+
export { kt as $, Le as $t, cn as A, ne as An, z as At, q as B, P as Bt, vn as C, be as Cn, V as Ct, un as D, ee as Dn, Ye as Dt, dn as E, se as En, B as Et, $t as F, t as Fn, We as Ft, Ht as G, A as Gt, qt as H, N as Ht, Qt as I, n as In, Ue as It, zt as J, D as Jt, Ut as K, Be as Kt, Zt as L, e as Ln, I as Lt, nn as M, te as Mn, L as Mt, an as N, r as Nn, Ke as Nt, sn as O, re as On, Je as Ot, rn as P, i as Pn, Ge as Pt, Dt as Q, T as Qt, Xt as R, F as Rt, mn as S, p as Sn, rt as St, gn as T, m as Tn, $e as Tt, Gt as U, M as Ut, Jt as V, Ve as Vt, Vt as W, j as Wt, At as X, Re as Xt, Bt as Y, ze as Yt, Rt as Z, E as Zt, Cn as _, Te as _n, ct as _t, Rn as a, ke as an, St as at, yn as b, ye as bn, ft as bt, On as c, Ae as cn, K as ct, Dn as d, Ee as dn, dt, Ie as en, Ot as et, En as f, De as fn, lt as ft, xn as g, y as gn, ot as gt, wn as h, v as hn, at as ht, Vn as i, Pe as in, Tt as it, on as j, ae as jn, R as jt, ln as k, ie as kn, qe as kt, Q as l, C as ln, ht as lt, Sn as m, b as mn, it as mt, Un as n, je as nn, Ct as nt, In as o, Fe as on, xt as ot, Tn as p, _ as pn, ut as pt, Wt as q, O as qt, Hn as r, Ne as rn, wt as rt, $ as s, Me as sn, bt as st, Wn as t, S as tn, Et as tt, Z as u, Oe as un, gt as ut, bn as v, we as vn, U as vt, pn as w, xe as wn, H as wt, _n as x, Se as xn, nt as xt, hn as y, Ce as yn, st as yt, Yt as z, He as zt };
|