@mindline/sync 1.0.107 → 1.0.108
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/src/index.d.ts +2 -2
- package/dist/sync.es.js +417 -411
- package/dist/sync.es.js.map +1 -1
- package/dist/sync.umd.js +23 -19
- package/dist/sync.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/index.d.ts +14 -14
- package/src/index.ts +17 -6
package/dist/sync.es.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
var
|
|
2
|
-
var Ie = (
|
|
3
|
-
throw TypeError(
|
|
1
|
+
var Pe = Object.defineProperty;
|
|
2
|
+
var Ie = (a) => {
|
|
3
|
+
throw TypeError(a);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var c = (
|
|
7
|
-
var J = (
|
|
8
|
-
var O = (
|
|
5
|
+
var ve = (a, s, r) => s in a ? Pe(a, s, { enumerable: !0, configurable: !0, writable: !0, value: r }) : a[s] = r;
|
|
6
|
+
var c = (a, s, r) => ve(a, typeof s != "symbol" ? s + "" : s, r), Re = (a, s, r) => s.has(a) || Ie("Cannot " + r);
|
|
7
|
+
var J = (a, s, r) => s.has(a) ? Ie("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(a) : s.set(a, r);
|
|
8
|
+
var O = (a, s, r) => (Re(a, s, "access private method"), r);
|
|
9
9
|
import * as V from "@microsoft/signalr";
|
|
10
10
|
import { deserializeArray as U } from "class-transformer";
|
|
11
11
|
const Ge = [
|
|
@@ -140,14 +140,14 @@ const Ge = [
|
|
|
140
140
|
resources: []
|
|
141
141
|
}
|
|
142
142
|
], B = "workspaceIDs";
|
|
143
|
-
function Gt(
|
|
144
|
-
return
|
|
143
|
+
function Gt(a, s) {
|
|
144
|
+
return a + s;
|
|
145
145
|
}
|
|
146
146
|
function xt() {
|
|
147
147
|
return "hello NPM";
|
|
148
148
|
}
|
|
149
149
|
function _() {
|
|
150
|
-
return "1.0.
|
|
150
|
+
return "1.0.108";
|
|
151
151
|
}
|
|
152
152
|
class m {
|
|
153
153
|
constructor() {
|
|
@@ -283,7 +283,7 @@ class re {
|
|
|
283
283
|
this.oid = "", this.name = "", this.mail = "", this.authority = "", this.tid = "", this.companyName = "", this.companyDomain = "", this.workspaceIDs = "", this.session = "Sign In", this.spacode = "", this.graphAccessToken = "", this.mindlineAccessToken = "", this.azureAccessToken = "", this.loginHint = "", this.scopes = new Array(), this.authTS = /* @__PURE__ */ new Date(0), this.sel = !1, this.loggingIn = !1;
|
|
284
284
|
}
|
|
285
285
|
}
|
|
286
|
-
var Be = /* @__PURE__ */ ((
|
|
286
|
+
var Be = /* @__PURE__ */ ((a) => (a[a.invalid = 0] = "invalid", a[a.aad = 1] = "aad", a[a.ad = 2] = "ad", a[a.googleworkspace = 3] = "googleworkspace", a))(Be || {}), Ue = /* @__PURE__ */ ((a) => (a[a.read = 1] = "read", a[a.write = 2] = "write", a[a.notassigned = 3] = "notassigned", a))(Ue || {});
|
|
287
287
|
class H {
|
|
288
288
|
// are we validating by TID or by domain? "Domain" | "Tenant ID"
|
|
289
289
|
constructor() {
|
|
@@ -301,8 +301,8 @@ class H {
|
|
|
301
301
|
this.tid = "", this.name = "", this.domain = "", this.tenantType = "aad", this.authority = "", this.workspaceIDs = "", this.sel = !1, this.graphSP = "", this.lookupfield = "Domain";
|
|
302
302
|
}
|
|
303
303
|
}
|
|
304
|
-
function _e(
|
|
305
|
-
switch (
|
|
304
|
+
function _e(a, s) {
|
|
305
|
+
switch (a) {
|
|
306
306
|
case p.authorityWW:
|
|
307
307
|
return s === 1 ? "85d35da2-4118-4b03-aa05-605cedd7f2f8" : "63100afe-506e-4bb2-8ff7-d8d5ab373129";
|
|
308
308
|
case p.authorityUS:
|
|
@@ -314,8 +314,8 @@ function _e(n, s) {
|
|
|
314
314
|
return "";
|
|
315
315
|
}
|
|
316
316
|
}
|
|
317
|
-
function F(
|
|
318
|
-
switch (
|
|
317
|
+
function F(a) {
|
|
318
|
+
switch (a) {
|
|
319
319
|
case p.authorityWW:
|
|
320
320
|
return "https://graph.microsoft.com/";
|
|
321
321
|
case p.authorityUS:
|
|
@@ -327,8 +327,8 @@ function F(n) {
|
|
|
327
327
|
return "";
|
|
328
328
|
}
|
|
329
329
|
}
|
|
330
|
-
function Le(
|
|
331
|
-
switch (
|
|
330
|
+
function Le(a) {
|
|
331
|
+
switch (a) {
|
|
332
332
|
case p.authorityWW:
|
|
333
333
|
return "https://login.microsoftonline.com/";
|
|
334
334
|
case p.authorityUS:
|
|
@@ -340,7 +340,7 @@ function Le(n) {
|
|
|
340
340
|
return "";
|
|
341
341
|
}
|
|
342
342
|
}
|
|
343
|
-
var ze = /* @__PURE__ */ ((
|
|
343
|
+
var ze = /* @__PURE__ */ ((a) => (a[a.source = 1] = "source", a[a.target = 2] = "target", a[a.sourcetarget = 3] = "sourcetarget", a))(ze || {});
|
|
344
344
|
class Me {
|
|
345
345
|
constructor() {
|
|
346
346
|
c(this, "tid");
|
|
@@ -358,7 +358,7 @@ class Me {
|
|
|
358
358
|
this.tid = "", this.sourceGroupId = "", this.sourceGroupName = "", this.targetGroupId = "", this.targetGroupName = "", this.configurationTenantType = "source", this.deltaToken = "", this.usersWritten = 0, this.configId = "", this.batchId = "", this.isReadPermissionConsented = !1, this.isWritePermissionConsented = !1;
|
|
359
359
|
}
|
|
360
360
|
}
|
|
361
|
-
class
|
|
361
|
+
class ne {
|
|
362
362
|
// selection state
|
|
363
363
|
constructor() {
|
|
364
364
|
c(this, "id");
|
|
@@ -387,7 +387,7 @@ class Nt {
|
|
|
387
387
|
this.id = "", this.name = "", this.workspaceId = "", this.description = "", this.isEnabled = !1, this.isReadPermissionConsented = !1, this.email = "", this.tenantId = "", this.sel = !1;
|
|
388
388
|
}
|
|
389
389
|
}
|
|
390
|
-
class
|
|
390
|
+
class ae {
|
|
391
391
|
// selection state
|
|
392
392
|
constructor() {
|
|
393
393
|
c(this, "id");
|
|
@@ -401,11 +401,11 @@ class ne {
|
|
|
401
401
|
}
|
|
402
402
|
}
|
|
403
403
|
function N() {
|
|
404
|
-
let
|
|
404
|
+
let a;
|
|
405
405
|
try {
|
|
406
|
-
|
|
406
|
+
a = window.localStorage;
|
|
407
407
|
const s = "__storage_test__";
|
|
408
|
-
return
|
|
408
|
+
return a.setItem(s, s), a.removeItem(s), !0;
|
|
409
409
|
} catch (s) {
|
|
410
410
|
return s instanceof DOMException && // everything except Firefox
|
|
411
411
|
(s.code === 22 || // Firefox
|
|
@@ -413,7 +413,7 @@ function N() {
|
|
|
413
413
|
// everything except Firefox
|
|
414
414
|
s.name === "QuotaExceededError" || // Firefox
|
|
415
415
|
s.name === "NS_ERROR_DOM_QUOTA_REACHED") && // acknowledge QuotaExceededError only if there's something already stored
|
|
416
|
-
|
|
416
|
+
a && a.length !== 0;
|
|
417
417
|
}
|
|
418
418
|
}
|
|
419
419
|
var Z, Ae;
|
|
@@ -447,9 +447,9 @@ class Wt {
|
|
|
447
447
|
}
|
|
448
448
|
}
|
|
449
449
|
this.tab = 0, this.version = _(), this.configlevelconsent_configid = "", this.configlevelconsent_access = 3;
|
|
450
|
-
var r = JSON.stringify(Ge), t = JSON.stringify(xe), e = JSON.stringify(Ce),
|
|
450
|
+
var r = JSON.stringify(Ge), t = JSON.stringify(xe), e = JSON.stringify(Ce), n = JSON.stringify(Oe);
|
|
451
451
|
try {
|
|
452
|
-
this.us = U(re, r), this.ts = U(H, t), this.cs = U(
|
|
452
|
+
this.us = U(re, r), this.ts = U(H, t), this.cs = U(ne, e), this.ws = U(ae, n), this.tagWithWorkspaces();
|
|
453
453
|
} catch {
|
|
454
454
|
debugger;
|
|
455
455
|
}
|
|
@@ -494,10 +494,10 @@ Z = new WeakSet(), Ae = function(s) {
|
|
|
494
494
|
let t = new H();
|
|
495
495
|
return t.tid = r.tid, t.name = r.name, t.domain = r.domain, t.tenantType = r.tenantType, t.authority = r.authority, t.workspaceIDs = r.workspaceIDs, t.sel = r.sel, t.lookupfield = r.lookupfield, t;
|
|
496
496
|
}), typeof s.cs > "u" ? this.cs = new Array() : this.cs = s.cs.map((r) => {
|
|
497
|
-
let t = new
|
|
497
|
+
let t = new ne();
|
|
498
498
|
return t.id = r.id, t.workspaceId = r.workspaceId, t.name = r.name, t.description = r.description, t.tenants = r.tenants, t.isEnabled = r.isEnabled, t.workspaceIDs = r.workspaceIDs, t.sel = r.sel, t;
|
|
499
499
|
}), typeof s.ws > "u" ? this.ws = new Array() : this.ws = s.ws.map((r) => {
|
|
500
|
-
let t = new
|
|
500
|
+
let t = new ae();
|
|
501
501
|
return t.id = r.id, t.name = r.name, t.ownerid = r.ownerid, t.associatedUsers = r.associatedUsers, t.associatedTenants = r.associatedTenants, t.associatedConfigs = r.associatedConfigs, t.sel = r.sel, t;
|
|
502
502
|
});
|
|
503
503
|
};
|
|
@@ -604,8 +604,8 @@ oe = function(s) {
|
|
|
604
604
|
return s.map((r) => {
|
|
605
605
|
let t = new se();
|
|
606
606
|
return t.id = r.id, t.task = r.task, t.setStart(new Date(r.start)), t.setEnd(new Date(r.end)), t.expected = r.expected, t.status = r.status, t.expanded = r.expanded, typeof r.subtasks < "u" && r.subtasks != null && (t.subtasks = r.subtasks.map((e) => {
|
|
607
|
-
let
|
|
608
|
-
return
|
|
607
|
+
let n = new se();
|
|
608
|
+
return n.id = e.id, n.task = e.task, n.setStart(new Date(e.start)), n.setEnd(new Date(e.end)), n.expected = e.expected, n.status = e.status, n.expanded = e.expanded, n;
|
|
609
609
|
})), t;
|
|
610
610
|
});
|
|
611
611
|
}, le = function() {
|
|
@@ -700,8 +700,8 @@ class He {
|
|
|
700
700
|
}
|
|
701
701
|
let r = Number(this.milestones[0].Run), t = new M(r + 1);
|
|
702
702
|
this.milestones.unshift(t), this.milestones = this.milestones.map((e) => {
|
|
703
|
-
let
|
|
704
|
-
return
|
|
703
|
+
let n = new M(e.Run);
|
|
704
|
+
return n.Start = e.Start, n.startDisplay = e.startDisplay, n.POST = e.POST, n.postDisplay = e.postDisplay, n.Read = e.Read, n.readDisplay = e.readDisplay, n.Write = e.Write, n.writeDisplay = e.writeDisplay, n.Duration = e.Duration, n.durationDisplay = e.durationDisplay, n;
|
|
705
705
|
}), s(this.milestones), console.log(`Start milestone: ${this.milestones[0].Run}:${this.milestones[0].Start}`);
|
|
706
706
|
}
|
|
707
707
|
unstart(s) {
|
|
@@ -769,13 +769,13 @@ class Bt {
|
|
|
769
769
|
`Calling BatchArray::init(config: "${s ? s.name : "null"}", bClearLocalStorage: ${t ? "true" : "false"})`
|
|
770
770
|
), t && N() && (localStorage.removeItem(s.name), this.milestoneArray.init(t)), s != null && s.tenants != null && r != null && (this.tenantNodes.length = 0, s.tenants.map((e) => {
|
|
771
771
|
if (e.configurationTenantType === "source" || e.configurationTenantType === "sourcetarget") {
|
|
772
|
-
let
|
|
772
|
+
let n = r.ts.find(
|
|
773
773
|
(o) => o.tid === e.tid
|
|
774
774
|
);
|
|
775
|
-
if (
|
|
775
|
+
if (n != null) {
|
|
776
776
|
let o = new $e(
|
|
777
777
|
e.tid,
|
|
778
|
-
|
|
778
|
+
n.name,
|
|
779
779
|
e.batchId
|
|
780
780
|
);
|
|
781
781
|
this.tenantNodes.push(o);
|
|
@@ -788,16 +788,16 @@ class Bt {
|
|
|
788
788
|
}
|
|
789
789
|
}
|
|
790
790
|
}), this.tenantNodes.map((e) => {
|
|
791
|
-
s.tenants.map((
|
|
792
|
-
if ((
|
|
791
|
+
s.tenants.map((n) => {
|
|
792
|
+
if ((n.configurationTenantType === "target" || n.configurationTenantType === "sourcetarget") && n.tid !== e.tid) {
|
|
793
793
|
let o = r.ts.find(
|
|
794
|
-
(d) => d.tid ===
|
|
794
|
+
(d) => d.tid === n.tid
|
|
795
795
|
);
|
|
796
796
|
if (o != null) {
|
|
797
797
|
let d = new $e(
|
|
798
|
-
|
|
798
|
+
n.tid,
|
|
799
799
|
o.name,
|
|
800
|
-
|
|
800
|
+
n.batchId
|
|
801
801
|
);
|
|
802
802
|
e.targets.push(d), e.expanded = !0;
|
|
803
803
|
} else {
|
|
@@ -819,7 +819,7 @@ class Bt {
|
|
|
819
819
|
uninitializeProgressBar(s, r, t, e) {
|
|
820
820
|
this.pb_startTS = 0, this.pb_progress = 0, s(this.pb_progress), r("sync failed to execute"), this.pb_increment = 0, clearInterval(this.pb_timer), this.pb_timer = null, this.pb_idle = 0, this.pb_idleMax = 0, t(`No updates seen for ${this.pb_idle} seconds. [max idle: ${this.pb_idleMax}]`), this.milestoneArray.unstart(e);
|
|
821
821
|
}
|
|
822
|
-
initializeSignalR(s, r, t, e,
|
|
822
|
+
initializeSignalR(s, r, t, e, n, o, d, i, l, u, f, I, D, R) {
|
|
823
823
|
this.milestoneArray.post(f), I("started sync, waiting for updates..."), this.init(s, r, !1);
|
|
824
824
|
let W = (x) => (E) => {
|
|
825
825
|
console.log(E);
|
|
@@ -838,28 +838,28 @@ class Bt {
|
|
|
838
838
|
return;
|
|
839
839
|
}
|
|
840
840
|
h.batchId = $.BatchId;
|
|
841
|
-
let ue = A.Stats,
|
|
842
|
-
for (let g = 0; g <
|
|
843
|
-
let
|
|
841
|
+
let ue = A.Stats, v = Object.keys(ue), C = Object.values(ue), X = !1, fe = !1;
|
|
842
|
+
for (let g = 0; g < v.length; g++) {
|
|
843
|
+
let P = v[g].endsWith("TotalCount"), L = v[g].endsWith("CurrentCount"), z = v[g].endsWith("ExtCount"), K = v[g].endsWith("DeferredCount"), ee = v[g].endsWith("RescheduledCount");
|
|
844
844
|
if (z && (h.excluded = Math.max(Number(C[g]), h.excluded), h.targets.map((T) => {
|
|
845
845
|
T.excluded = h.excluded, T.update(T.total, T.read, T.excluded, T.written, T.deferred);
|
|
846
|
-
})),
|
|
846
|
+
})), P && (X = Number(C[g]) == 0, h.total = Math.max(Number(C[g]), h.total), h.targets.map((T) => {
|
|
847
847
|
T.total = h.total, T.update(T.total, T.read, T.excluded, T.written, T.deferred);
|
|
848
|
-
})),
|
|
848
|
+
})), v[g].startsWith("Reader")) {
|
|
849
849
|
let T = /Reader\/TID:(.+)\/TotalCount/;
|
|
850
|
-
if (L && (T = /Reader\/TID:(.+)\/CurrentCount/), z && (T = /Reader\/TID:(.+)\/ExtCount/), K && (T = /Reader\/TID:(.+)\/DeferredCount/), ee && (T = /Reader\/TID:(.+)\/RescheduledCount/),
|
|
851
|
-
console.log(`tid not found in ${
|
|
850
|
+
if (L && (T = /Reader\/TID:(.+)\/CurrentCount/), z && (T = /Reader\/TID:(.+)\/ExtCount/), K && (T = /Reader\/TID:(.+)\/DeferredCount/), ee && (T = /Reader\/TID:(.+)\/RescheduledCount/), v[g].match(T) == null) {
|
|
851
|
+
console.log(`tid not found in ${v[g]}.`);
|
|
852
852
|
debugger;
|
|
853
853
|
return;
|
|
854
854
|
}
|
|
855
|
-
|
|
855
|
+
P ? (X = Number(C[g]) == 0, h.total = Math.max(Number(C[g]), h.total), console.log(`----- ${h.name} TID: ${h.tid} batchId: ${h.batchId}`), console.log(`----- ${h.name} Total To Read: ${h.total}`)) : (fe = Number(C[g]) == 0, L ? (h.read = Math.max(Number(C[g]), h.read), console.log(`----- ${h.name} Currently Read: ${h.read}`)) : K && (h.deferred = Math.max(Number(C[g]), h.deferred), console.log(`----- ${h.name} Deferred: ${h.deferred}`)));
|
|
856
856
|
}
|
|
857
|
-
if (h.nothingtosync = X && fe,
|
|
857
|
+
if (h.nothingtosync = X && fe, v[g].startsWith("Writer")) {
|
|
858
858
|
let T = /Reader\/TID:(.+)\/TotalCount/;
|
|
859
859
|
L && (T = /Writer\/TID:(.+)\/CurrentCount/), z && (T = /Writer\/TID:(.+)\/ExtCount/), K && (T = /Writer\/TID:(.+)\/DeferredCount/), ee && (T = /Writer\/TID:(.+)\/RescheduledCount/);
|
|
860
|
-
let te =
|
|
860
|
+
let te = v[g].match(T);
|
|
861
861
|
if (te == null) {
|
|
862
|
-
console.log(`tid not found in ${
|
|
862
|
+
console.log(`tid not found in ${v[g]}.`);
|
|
863
863
|
debugger;
|
|
864
864
|
return;
|
|
865
865
|
}
|
|
@@ -869,8 +869,8 @@ class Bt {
|
|
|
869
869
|
debugger;
|
|
870
870
|
return;
|
|
871
871
|
}
|
|
872
|
-
if (S.total = Math.max(Number(h.total), S.total), S.total = Math.max(Number(h.total), S.total), S.batchId = $.BatchId,
|
|
873
|
-
S.total = Math.max(Number(
|
|
872
|
+
if (S.total = Math.max(Number(h.total), S.total), S.total = Math.max(Number(h.total), S.total), S.batchId = $.BatchId, P)
|
|
873
|
+
S.total = Math.max(Number(P), S.total), console.log(`----- ${S.name} TID: ${S.tid} batchId: ${S.batchId}`), console.log(`----- ${S.name} Total To Write: ${S.total}`);
|
|
874
874
|
else if (L)
|
|
875
875
|
S.written = Math.max(Number(C[g]), S.written), console.log(`----- ${S.name} Total Written: ${S.written}`);
|
|
876
876
|
else if (K || ee)
|
|
@@ -886,10 +886,10 @@ class Bt {
|
|
|
886
886
|
h.update(h.total, h.read, h.excluded, h.written, h.deferred);
|
|
887
887
|
let pe = !0, he = !0, ge = !1, me = !0, Y = 0, ye = 0, we = 0, Te = 0, Se = 0, be = 0;
|
|
888
888
|
if (this.tenantNodes.map((g) => {
|
|
889
|
-
g.targets.map((
|
|
890
|
-
he && (he =
|
|
889
|
+
g.targets.map((P) => {
|
|
890
|
+
he && (he = P.status == "complete" || P.status == "failed"), ge || (ge = P.total > 0 || P.status != "not started"), Te += Math.max(P.total, g.total), Se += P.written, be += P.excluded;
|
|
891
891
|
}), me && (me = g.nothingtosync), pe && (pe = g.status == "complete" || g.status == "failed"), Y += g.total, ye += g.read, we += g.excluded;
|
|
892
|
-
}),
|
|
892
|
+
}), n(Y), d(ye), o(we), i(Math.max(Te, Y)), u(Se), l(be), me)
|
|
893
893
|
this.milestoneArray.write(f), x.stop(), I("nothing to sync"), console.log('Setting config sync result: "nothing to sync"');
|
|
894
894
|
else {
|
|
895
895
|
if (pe) {
|
|
@@ -921,7 +921,7 @@ class Bt {
|
|
|
921
921
|
debugger;
|
|
922
922
|
return e.result = !1, e.error = "startSync: invalid parameters", e.status = 500, e;
|
|
923
923
|
}
|
|
924
|
-
return e = await
|
|
924
|
+
return e = await Pt(s, r, t), e;
|
|
925
925
|
}
|
|
926
926
|
}
|
|
927
927
|
class $e {
|
|
@@ -940,8 +940,8 @@ class $e {
|
|
|
940
940
|
c(this, "targets");
|
|
941
941
|
this.expanded = !1, this.name = r, this.tid = s, this.batchId = t, this.nothingtosync = !1, this.targets = new Array(), this.update(0, 0, 0, 0, 0);
|
|
942
942
|
}
|
|
943
|
-
update(s, r, t, e,
|
|
944
|
-
this.total = s, this.read = r, this.excluded = t, this.written = e, this.deferred =
|
|
943
|
+
update(s, r, t, e, n) {
|
|
944
|
+
this.total = s, this.read = r, this.excluded = t, this.written = e, this.deferred = n, this.read === 0 && this.written === 0 && (this.status = "not started"), this.read > 0 ? this.read + this.excluded < this.total ? this.status = "in progress" : this.read + this.excluded === this.total && (this.status = "complete") : this.written > 0 && (this.written + this.deferred + this.excluded < this.total ? this.status = "in progress" : this.written + this.deferred + this.excluded === this.total ? this.status = "complete" : this.written + this.deferred + this.excluded >= this.total && (this.status = "failed"));
|
|
945
945
|
}
|
|
946
946
|
}
|
|
947
947
|
class ke {
|
|
@@ -957,8 +957,8 @@ class ke {
|
|
|
957
957
|
if (s)
|
|
958
958
|
localStorage.removeItem("ResourceArray");
|
|
959
959
|
else {
|
|
960
|
-
let
|
|
961
|
-
this.resourceNodes =
|
|
960
|
+
let n = JSON.parse(t);
|
|
961
|
+
this.resourceNodes = n.resourceNodes;
|
|
962
962
|
return;
|
|
963
963
|
}
|
|
964
964
|
}
|
|
@@ -972,7 +972,7 @@ class ke {
|
|
|
972
972
|
// read
|
|
973
973
|
async read(s, r) {
|
|
974
974
|
let t = new ke(!1, !1);
|
|
975
|
-
return t.resourceNodes = await
|
|
975
|
+
return t.resourceNodes = await nt(s, r), t;
|
|
976
976
|
}
|
|
977
977
|
// save resource data to localstorage
|
|
978
978
|
save() {
|
|
@@ -1005,8 +1005,8 @@ class Ut {
|
|
|
1005
1005
|
if (s)
|
|
1006
1006
|
localStorage.removeItem("RBACActors");
|
|
1007
1007
|
else {
|
|
1008
|
-
let
|
|
1009
|
-
this.actorNodes =
|
|
1008
|
+
let n = JSON.parse(t);
|
|
1009
|
+
this.actorNodes = n.actorNodes;
|
|
1010
1010
|
return;
|
|
1011
1011
|
}
|
|
1012
1012
|
}
|
|
@@ -1019,7 +1019,7 @@ class Ut {
|
|
|
1019
1019
|
}
|
|
1020
1020
|
}
|
|
1021
1021
|
class Ke {
|
|
1022
|
-
constructor(s, r, t, e,
|
|
1022
|
+
constructor(s, r, t, e, n, o) {
|
|
1023
1023
|
c(this, "type");
|
|
1024
1024
|
c(this, "actor");
|
|
1025
1025
|
c(this, "resource");
|
|
@@ -1027,19 +1027,19 @@ class Ke {
|
|
|
1027
1027
|
c(this, "updatedby");
|
|
1028
1028
|
c(this, "updatedon");
|
|
1029
1029
|
c(this, "actors");
|
|
1030
|
-
this.type = s, this.actor = r, this.resource = t, this.role = e, this.updatedby =
|
|
1030
|
+
this.type = s, this.actor = r, this.resource = t, this.role = e, this.updatedby = n, this.updatedon = o, this.actors = new Array();
|
|
1031
1031
|
}
|
|
1032
1032
|
}
|
|
1033
|
-
function Je(
|
|
1033
|
+
function Je(a) {
|
|
1034
1034
|
return "Group.Read.All User.Read.All openid profile offline_access User.Read Contacts.Read CrossTenantInformation.ReadBasic.All";
|
|
1035
1035
|
}
|
|
1036
|
-
async function Q(
|
|
1036
|
+
async function Q(a, s) {
|
|
1037
1037
|
const r = new Headers();
|
|
1038
1038
|
r.append("Content-Type", "application/json"), r.append("accept", "*/*");
|
|
1039
1039
|
const t = Je();
|
|
1040
1040
|
if (s.graphAccessToken == null || s.graphAccessToken === "")
|
|
1041
1041
|
try {
|
|
1042
|
-
let e = await
|
|
1042
|
+
let e = await a.acquireTokenByCode({
|
|
1043
1043
|
code: s.spacode
|
|
1044
1044
|
});
|
|
1045
1045
|
s.graphAccessToken = e.accessToken, console.log("Front end token acquired by code: " + s.graphAccessToken.slice(0, 20));
|
|
@@ -1048,10 +1048,10 @@ async function Q(n, s) {
|
|
|
1048
1048
|
}
|
|
1049
1049
|
else
|
|
1050
1050
|
try {
|
|
1051
|
-
let e =
|
|
1051
|
+
let e = a.getAllAccounts(), n = s.oid + "." + s.tid, o = null;
|
|
1052
1052
|
for (let i = 0; i < e.length; i++)
|
|
1053
|
-
e[i].homeAccountId ==
|
|
1054
|
-
let d = await
|
|
1053
|
+
e[i].homeAccountId == n && (o = e[i]);
|
|
1054
|
+
let d = await a.acquireTokenSilent({
|
|
1055
1055
|
scopes: [t],
|
|
1056
1056
|
account: o
|
|
1057
1057
|
});
|
|
@@ -1059,37 +1059,37 @@ async function Q(n, s) {
|
|
|
1059
1059
|
} catch (e) {
|
|
1060
1060
|
try {
|
|
1061
1061
|
console.log("Front end graph token silent acquisition failure: " + e);
|
|
1062
|
-
let
|
|
1063
|
-
for (let i = 0; i <
|
|
1064
|
-
|
|
1065
|
-
|
|
1062
|
+
let n = a.getAllAccounts(), o = s.oid + "." + s.tid, d = null;
|
|
1063
|
+
for (let i = 0; i < n.length; i++)
|
|
1064
|
+
n[i].homeAccountId == o && (d = n[i]);
|
|
1065
|
+
a.acquireTokenRedirect({
|
|
1066
1066
|
scopes: [t],
|
|
1067
1067
|
account: d
|
|
1068
1068
|
});
|
|
1069
|
-
} catch (
|
|
1070
|
-
console.log("Front end graph token redirect acquisition failure: " +
|
|
1069
|
+
} catch (n) {
|
|
1070
|
+
console.log("Front end graph token redirect acquisition failure: " + n);
|
|
1071
1071
|
}
|
|
1072
1072
|
}
|
|
1073
1073
|
return r.append("Authorization", `Bearer ${s.graphAccessToken}`), r;
|
|
1074
1074
|
}
|
|
1075
|
-
async function _t(
|
|
1075
|
+
async function _t(a, s, r) {
|
|
1076
1076
|
if (s == null || s.spacode == "")
|
|
1077
1077
|
return { groups: [], error: "500: invalid user passed to groupsGet" };
|
|
1078
|
-
let e = { method: "GET", headers: await Q(
|
|
1078
|
+
let e = { method: "GET", headers: await Q(a, s) };
|
|
1079
1079
|
try {
|
|
1080
|
-
let
|
|
1081
|
-
|
|
1082
|
-
let d = await (await fetch(
|
|
1080
|
+
let n = F(s.authority) + p.graphGroupsPredicate;
|
|
1081
|
+
n += `/?$filter=startsWith(displayName, '${r}')`;
|
|
1082
|
+
let d = await (await fetch(n, e)).json();
|
|
1083
1083
|
return typeof d.error < "u" ? { groups: [], error: `${d.error.code}: ${d.error.message}` } : { groups: d.value, error: "" };
|
|
1084
|
-
} catch (
|
|
1085
|
-
return console.log(
|
|
1084
|
+
} catch (n) {
|
|
1085
|
+
return console.log(n), { groups: [], error: `Exception: ${n}` };
|
|
1086
1086
|
}
|
|
1087
1087
|
}
|
|
1088
|
-
async function Ve(
|
|
1088
|
+
async function Ve(a, s, r, t) {
|
|
1089
1089
|
try {
|
|
1090
|
-
let e = F(s.authority) + p.graphOauth2PermissionGrantsPredicate,
|
|
1091
|
-
|
|
1092
|
-
let d = await (await fetch(
|
|
1090
|
+
let e = F(s.authority) + p.graphOauth2PermissionGrantsPredicate, n = new URL(e);
|
|
1091
|
+
n.searchParams.append("$filter", `resourceId eq '${r}' and consentType eq 'Principal' and principalId eq '${t}'`);
|
|
1092
|
+
let d = await (await fetch(n.href, a)).json();
|
|
1093
1093
|
if (typeof d.error < "u")
|
|
1094
1094
|
return { grants: null, id: null, error: `${d.error.code}: ${d.error.message}` };
|
|
1095
1095
|
if (d.value.length != 1) {
|
|
@@ -1101,13 +1101,13 @@ async function Ve(n, s, r, t) {
|
|
|
1101
1101
|
return console.log(e), { grants: null, id: null, error: `Exception: ${e}` };
|
|
1102
1102
|
}
|
|
1103
1103
|
}
|
|
1104
|
-
async function Ze(
|
|
1104
|
+
async function Ze(a, s, r, t) {
|
|
1105
1105
|
if (s == null || s.spacode == "")
|
|
1106
1106
|
return !1;
|
|
1107
1107
|
try {
|
|
1108
1108
|
let e = F(s.authority);
|
|
1109
1109
|
e += p.graphOauth2PermissionGrantsPredicate + `/${r}`;
|
|
1110
|
-
let
|
|
1110
|
+
let n = `{ "scope": "${t}" }`, d = { method: "PATCH", headers: await Q(a, s), body: n }, i = await fetch(e, d), l = await i.json();
|
|
1111
1111
|
if (i.status == 204 && i.statusText == "No Content")
|
|
1112
1112
|
return !0;
|
|
1113
1113
|
debugger;
|
|
@@ -1117,36 +1117,36 @@ async function Ze(n, s, r, t) {
|
|
|
1117
1117
|
return console.log(e), !1;
|
|
1118
1118
|
}
|
|
1119
1119
|
}
|
|
1120
|
-
function Lt(
|
|
1121
|
-
let r = Le(
|
|
1122
|
-
r +=
|
|
1123
|
-
let t = new URL(r), e = _e(
|
|
1124
|
-
t.searchParams.append("client_id", e), t.searchParams.append("redirect_uri", window.location.origin), t.searchParams.append("domain_hint",
|
|
1120
|
+
function Lt(a, s) {
|
|
1121
|
+
let r = Le(a.authority);
|
|
1122
|
+
r += a.tid, r += "/adminconsent";
|
|
1123
|
+
let t = new URL(r), e = _e(a.authority, s);
|
|
1124
|
+
t.searchParams.append("client_id", e), t.searchParams.append("redirect_uri", window.location.origin), t.searchParams.append("domain_hint", a.companyDomain), t.searchParams.append("login_hint", a.mail), window.location.assign(t.href);
|
|
1125
1125
|
}
|
|
1126
|
-
async function Qe(
|
|
1126
|
+
async function Qe(a, s, r) {
|
|
1127
1127
|
try {
|
|
1128
1128
|
let t = F(s.authority);
|
|
1129
1129
|
t += p.graphServicePrincipalsPredicate, t += `(appId='${r}')`;
|
|
1130
1130
|
let e = new URL(t);
|
|
1131
1131
|
e.searchParams.append("$select", "id,appId,displayName");
|
|
1132
|
-
let o = await (await fetch(e.href,
|
|
1132
|
+
let o = await (await fetch(e.href, a)).json();
|
|
1133
1133
|
return typeof o.error < "u" ? { spid: "", error: `${o.error.code}: ${o.error.message}` } : { spid: o.id, error: "" };
|
|
1134
1134
|
} catch (t) {
|
|
1135
1135
|
return console.log(t), { spid: "", error: `Exception: ${t}` };
|
|
1136
1136
|
}
|
|
1137
1137
|
}
|
|
1138
|
-
async function zt(
|
|
1139
|
-
if (
|
|
1138
|
+
async function zt(a, s) {
|
|
1139
|
+
if (a.authority == "") {
|
|
1140
1140
|
let e = new H();
|
|
1141
|
-
if (e.domain =
|
|
1142
|
-
|
|
1141
|
+
if (e.domain = a.tid, await Ee(e, !1))
|
|
1142
|
+
a.authority = e.authority;
|
|
1143
1143
|
else {
|
|
1144
1144
|
debugger;
|
|
1145
1145
|
return !1;
|
|
1146
1146
|
}
|
|
1147
1147
|
}
|
|
1148
1148
|
let r = window.location.href;
|
|
1149
|
-
switch (
|
|
1149
|
+
switch (a.authority) {
|
|
1150
1150
|
case p.authorityWW:
|
|
1151
1151
|
r += "MicrosoftIdentity/Account/SignIn";
|
|
1152
1152
|
break;
|
|
@@ -1160,20 +1160,20 @@ async function zt(n, s) {
|
|
|
1160
1160
|
return !1;
|
|
1161
1161
|
}
|
|
1162
1162
|
let t = new URL(r);
|
|
1163
|
-
if (t.searchParams.append("redirectUri", window.location.origin),
|
|
1164
|
-
t.searchParams.append("loginHint",
|
|
1165
|
-
const e = /@([a-zA-Z0-9.-]+\.[a-zA-Z]{2,})$/,
|
|
1166
|
-
let o =
|
|
1163
|
+
if (t.searchParams.append("redirectUri", window.location.origin), a.oid !== "1") {
|
|
1164
|
+
t.searchParams.append("loginHint", a.mail);
|
|
1165
|
+
const e = /@([a-zA-Z0-9.-]+\.[a-zA-Z]{2,})$/, n = a.mail.match(e);
|
|
1166
|
+
let o = n ? n[1] : "organizations";
|
|
1167
1167
|
t.searchParams.append("domainHint", o);
|
|
1168
1168
|
} else
|
|
1169
1169
|
t.searchParams.append("domainHint", "organizations");
|
|
1170
1170
|
return s.setTaskStart("initialization", /* @__PURE__ */ new Date()), s.setTaskStart("authenticate user", /* @__PURE__ */ new Date()), window.location.assign(t.href), !0;
|
|
1171
1171
|
}
|
|
1172
|
-
function Mt(
|
|
1172
|
+
function Mt(a, s) {
|
|
1173
1173
|
debugger;
|
|
1174
|
-
if (
|
|
1174
|
+
if (a.oid == "1") return;
|
|
1175
1175
|
let r = window.location.href;
|
|
1176
|
-
switch (
|
|
1176
|
+
switch (a.authority) {
|
|
1177
1177
|
case p.authorityWW:
|
|
1178
1178
|
r += "MicrosoftIdentity/Account/Challenge";
|
|
1179
1179
|
break;
|
|
@@ -1187,49 +1187,49 @@ function Mt(n, s) {
|
|
|
1187
1187
|
return;
|
|
1188
1188
|
}
|
|
1189
1189
|
let t = new URL(r);
|
|
1190
|
-
t.searchParams.append("redirectUri", window.location.origin), t.searchParams.append("scope", s), t.searchParams.append("domainHint", "organizations"), t.searchParams.append("loginHint",
|
|
1190
|
+
t.searchParams.append("redirectUri", window.location.origin), t.searchParams.append("scope", s), t.searchParams.append("domainHint", "organizations"), t.searchParams.append("loginHint", a.mail), window.location.assign(t.href);
|
|
1191
1191
|
}
|
|
1192
|
-
async function jt(
|
|
1193
|
-
if (
|
|
1192
|
+
async function jt(a) {
|
|
1193
|
+
if (a.oid == "1") return !1;
|
|
1194
1194
|
let s = window.location.href;
|
|
1195
1195
|
s += "user";
|
|
1196
1196
|
let r = new URL(s);
|
|
1197
|
-
r.searchParams.append("oid",
|
|
1197
|
+
r.searchParams.append("oid", a.oid), r.searchParams.append("tid", a.tid), r.searchParams.append("loginHint", a.loginHint), r.searchParams.append("verb", "LOGOUT");
|
|
1198
1198
|
let t = { method: "PATCH" }, e = await fetch(r.href, t);
|
|
1199
1199
|
if (e.status == 200 && e.statusText == "OK")
|
|
1200
|
-
console.log(`Successfully set admin ${
|
|
1200
|
+
console.log(`Successfully set admin ${a.mail} logout_hint`);
|
|
1201
1201
|
else
|
|
1202
|
-
return console.log(`Failed to set admin ${
|
|
1203
|
-
let
|
|
1204
|
-
switch (
|
|
1202
|
+
return console.log(`Failed to set admin ${a.mail} logout_hint`), !1;
|
|
1203
|
+
let n = window.location.href;
|
|
1204
|
+
switch (a.authority) {
|
|
1205
1205
|
case p.authorityWW:
|
|
1206
|
-
|
|
1206
|
+
n += "MicrosoftIdentity/Account/SignOut";
|
|
1207
1207
|
break;
|
|
1208
1208
|
case p.authorityUS:
|
|
1209
|
-
|
|
1209
|
+
n += "USGov/SignOut";
|
|
1210
1210
|
break;
|
|
1211
1211
|
case p.authorityCN:
|
|
1212
|
-
|
|
1212
|
+
n += "China/SignOut";
|
|
1213
1213
|
break;
|
|
1214
1214
|
default:
|
|
1215
1215
|
return !1;
|
|
1216
1216
|
}
|
|
1217
|
-
return r = new URL(
|
|
1217
|
+
return r = new URL(n), r.searchParams.append("redirectUri", window.location.origin), window.location.assign(r.href), !0;
|
|
1218
1218
|
}
|
|
1219
|
-
async function Ht(
|
|
1219
|
+
async function Ht(a, s, r, t) {
|
|
1220
1220
|
if (t) debugger;
|
|
1221
1221
|
if (s.name != null && s.name !== "") return !1;
|
|
1222
|
-
if (
|
|
1223
|
-
console.log(`tenantRelationshipsGetByDomain called with invalid logged in user: ${
|
|
1222
|
+
if (a.graphAccessToken != null && a.graphAccessToken === "") {
|
|
1223
|
+
console.log(`tenantRelationshipsGetByDomain called with invalid logged in user: ${a.name}`);
|
|
1224
1224
|
try {
|
|
1225
|
-
let i = await r.acquireTokenByCode({ code:
|
|
1226
|
-
|
|
1225
|
+
let i = await r.acquireTokenByCode({ code: a.spacode, scopes: ["user.read", "contacts.read", "CrossTenantInformation.ReadBasic.All"] });
|
|
1226
|
+
a.graphAccessToken = i.accessToken, console.log("tenantRelationshipsGetByDomain: Front end token acquired: " + a.graphAccessToken.slice(0, 20));
|
|
1227
1227
|
} catch (i) {
|
|
1228
1228
|
return console.log("tenantRelationshipsGetByDomain: Front end token failure: " + i), !1;
|
|
1229
1229
|
}
|
|
1230
1230
|
}
|
|
1231
|
-
const e = new Headers(),
|
|
1232
|
-
e.append("Authorization",
|
|
1231
|
+
const e = new Headers(), n = `Bearer ${a.graphAccessToken}`;
|
|
1232
|
+
e.append("Authorization", n);
|
|
1233
1233
|
let o = { method: "GET", headers: e };
|
|
1234
1234
|
try {
|
|
1235
1235
|
var d = F(s.authority) + p.graphTenantByDomainPredicate;
|
|
@@ -1251,20 +1251,20 @@ async function Ht(n, s, r, t) {
|
|
|
1251
1251
|
}
|
|
1252
1252
|
return !1;
|
|
1253
1253
|
}
|
|
1254
|
-
async function Xe(
|
|
1254
|
+
async function Xe(a, s, r, t, e) {
|
|
1255
1255
|
if (console.log("**** tenantRelationshipsGetById"), e) debugger;
|
|
1256
|
-
if (
|
|
1256
|
+
if (a.graphAccessToken === "")
|
|
1257
1257
|
try {
|
|
1258
|
-
let l = await t.acquireTokenByCode({ code:
|
|
1259
|
-
|
|
1258
|
+
let l = await t.acquireTokenByCode({ code: a.spacode, scopes: ["user.read", "contacts.read", "CrossTenantInformation.ReadBasic.All"] });
|
|
1259
|
+
a.graphAccessToken = l.accessToken, console.log("tenantRelationshipsGetById: Front end token acquired: " + a.graphAccessToken.slice(0, 20));
|
|
1260
1260
|
} catch (l) {
|
|
1261
1261
|
return console.log("tenantRelationshipsGetById: Front end token failure: " + l), !1;
|
|
1262
1262
|
}
|
|
1263
|
-
const
|
|
1264
|
-
|
|
1265
|
-
let d = { method: "GET", headers:
|
|
1263
|
+
const n = new Headers(), o = `Bearer ${a.graphAccessToken}`;
|
|
1264
|
+
n.append("Authorization", o);
|
|
1265
|
+
let d = { method: "GET", headers: n };
|
|
1266
1266
|
try {
|
|
1267
|
-
var i = F(
|
|
1267
|
+
var i = F(a.authority) + p.graphTenantByIdPredicate;
|
|
1268
1268
|
i += "(tenantId='", i += s.tid, i += "')", console.log("tenantRelationshipsGetById: Attempting GET from /findTenantInformationByTenantId:", i);
|
|
1269
1269
|
let u = await (await fetch(i, d)).json();
|
|
1270
1270
|
if (u && typeof u.displayName !== void 0 && u.displayName !== "") {
|
|
@@ -1282,37 +1282,37 @@ async function Xe(n, s, r, t, e) {
|
|
|
1282
1282
|
}
|
|
1283
1283
|
return !1;
|
|
1284
1284
|
}
|
|
1285
|
-
async function Ee(
|
|
1285
|
+
async function Ee(a, s) {
|
|
1286
1286
|
if (s) debugger;
|
|
1287
1287
|
let r = [p.authorityWW, p.authorityUS, p.authorityCN], t = [p.authorityWWRegex, p.authorityUSRegex, p.authorityCNRegex], e = null;
|
|
1288
1288
|
try {
|
|
1289
1289
|
for (let i = 0; i < 3; i++) {
|
|
1290
|
-
var
|
|
1291
|
-
if (
|
|
1290
|
+
var n = r[i];
|
|
1291
|
+
if (a.lookupfield == "Domain" ? n += a.domain : a.lookupfield == "Tenant ID" && (n += a.tid), n += "/.well-known/openid-configuration", console.log("Attempting GET from openid well-known endpoint: ", n), e = await fetch(n), e.status == 200) {
|
|
1292
1292
|
let l = await e.json();
|
|
1293
1293
|
if (l) {
|
|
1294
1294
|
var o = l.authorization_endpoint;
|
|
1295
1295
|
for (let u = 0; u < 3; u++) {
|
|
1296
1296
|
var d = o.match(t[u]);
|
|
1297
1297
|
if (d != null)
|
|
1298
|
-
return
|
|
1298
|
+
return a.tid = d[2], a.authority = d[1], console.log(`Successful GET from openid well-known endpoint: tid: ${a.tid} authority: ${a.authority}`), !0;
|
|
1299
1299
|
}
|
|
1300
1300
|
} else
|
|
1301
|
-
console.log(`Failed JSON parse of openid well-known endpoint response ${
|
|
1301
|
+
console.log(`Failed JSON parse of openid well-known endpoint response ${n}.`);
|
|
1302
1302
|
} else
|
|
1303
|
-
console.log(`Failed GET from ${
|
|
1303
|
+
console.log(`Failed GET from ${n}.`);
|
|
1304
1304
|
}
|
|
1305
1305
|
} catch (i) {
|
|
1306
1306
|
console.log("Failed to GET from openid well-known endpoint: ", i);
|
|
1307
1307
|
}
|
|
1308
|
-
return (
|
|
1308
|
+
return (a.tid == "" || a.authority == "") && console.log(`GET from openid well-known endpoint failed to find tenant: ${e ? e.statusText : "unknown"}`), !1;
|
|
1309
1309
|
}
|
|
1310
|
-
async function Ye(
|
|
1310
|
+
async function Ye(a, s, r) {
|
|
1311
1311
|
if (s == null || s.spacode == "" || r == null) {
|
|
1312
1312
|
debugger;
|
|
1313
1313
|
return { scopes: null, id: null, error: "500: invalid parameter(s) passed to getUserDelegatedScopes" };
|
|
1314
1314
|
}
|
|
1315
|
-
let e = { method: "GET", headers: await Q(
|
|
1315
|
+
let e = { method: "GET", headers: await Q(a, s) };
|
|
1316
1316
|
try {
|
|
1317
1317
|
if (r.graphSP == "") {
|
|
1318
1318
|
let { spid: i, error: l } = await Qe(e, s, "00000003-0000-0000-c000-000000000000");
|
|
@@ -1322,40 +1322,40 @@ async function Ye(n, s, r) {
|
|
|
1322
1322
|
}
|
|
1323
1323
|
r.graphSP = i;
|
|
1324
1324
|
}
|
|
1325
|
-
let { grants:
|
|
1325
|
+
let { grants: n, id: o, error: d } = await Ve(e, s, r.graphSP, s.oid);
|
|
1326
1326
|
if (d != "") {
|
|
1327
1327
|
debugger;
|
|
1328
1328
|
return { scopes: null, id: null, error: `${d}` };
|
|
1329
1329
|
}
|
|
1330
|
-
return { scopes:
|
|
1331
|
-
} catch (
|
|
1330
|
+
return { scopes: n, id: o, error: "" };
|
|
1331
|
+
} catch (n) {
|
|
1332
1332
|
debugger;
|
|
1333
|
-
return console.log(
|
|
1333
|
+
return console.log(n), { scopes: null, id: null, error: `Exception: ${n}` };
|
|
1334
1334
|
}
|
|
1335
1335
|
}
|
|
1336
|
-
async function qt(
|
|
1336
|
+
async function qt(a, s, r, t) {
|
|
1337
1337
|
if (s == null || s.spacode == "" || r == null) {
|
|
1338
1338
|
debugger;
|
|
1339
1339
|
return !1;
|
|
1340
1340
|
}
|
|
1341
|
-
let { scopes: e, id:
|
|
1341
|
+
let { scopes: e, id: n, error: o } = await Ye(a, s, r);
|
|
1342
1342
|
if (o != "") {
|
|
1343
1343
|
debugger;
|
|
1344
1344
|
return console.log(`userDelegatedScopesRemove: cannot find userDelegatedScopes for ${s.mail}: ${o}`), !1;
|
|
1345
1345
|
}
|
|
1346
1346
|
e = e.replace(t, "");
|
|
1347
|
-
let d = await Ze(
|
|
1347
|
+
let d = await Ze(a, s, n, e);
|
|
1348
1348
|
if (!d) {
|
|
1349
1349
|
debugger;
|
|
1350
1350
|
return console.log(`userDelegatedScopesRemove: cannot set oauth2PermissionGrants for ${s.mail}: ${o}`), !1;
|
|
1351
1351
|
}
|
|
1352
1352
|
return s.scopes = e.split(" "), d;
|
|
1353
1353
|
}
|
|
1354
|
-
async function Kt(
|
|
1354
|
+
async function Kt(a, s) {
|
|
1355
1355
|
if (s == null || s.spacode == "")
|
|
1356
1356
|
return { users: [], error: "500: invalid user passed to usersGet" };
|
|
1357
1357
|
try {
|
|
1358
|
-
let t = { method: "GET", headers: await Q(
|
|
1358
|
+
let t = { method: "GET", headers: await Q(a, s) }, e = F(s.authority);
|
|
1359
1359
|
e += p.graphUsersPredicate;
|
|
1360
1360
|
let o = await (await fetch(e, t)).json();
|
|
1361
1361
|
if (typeof o.error < "u")
|
|
@@ -1368,53 +1368,55 @@ async function Kt(n, s) {
|
|
|
1368
1368
|
return console.log(r), { users: [], error: `Exception: ${r}` };
|
|
1369
1369
|
}
|
|
1370
1370
|
}
|
|
1371
|
-
async function Jt(
|
|
1372
|
-
return ct(
|
|
1371
|
+
async function Jt(a, s, r, t) {
|
|
1372
|
+
return ct(a, s, r, t);
|
|
1373
1373
|
}
|
|
1374
|
-
async function Vt(
|
|
1375
|
-
return dt(
|
|
1374
|
+
async function Vt(a, s, r, t) {
|
|
1375
|
+
return dt(a, s, r, t);
|
|
1376
1376
|
}
|
|
1377
|
-
async function Zt(
|
|
1378
|
-
return ut(
|
|
1377
|
+
async function Zt(a, s, r, t, e) {
|
|
1378
|
+
return ut(a, s, r, t, e);
|
|
1379
1379
|
}
|
|
1380
|
-
async function Qt(
|
|
1381
|
-
return ft(
|
|
1380
|
+
async function Qt(a, s, r, t) {
|
|
1381
|
+
return ft(a, s, r, t);
|
|
1382
1382
|
}
|
|
1383
|
-
async function Xt(
|
|
1384
|
-
return pt(
|
|
1383
|
+
async function Xt(a, s, r) {
|
|
1384
|
+
return pt(a, s, r);
|
|
1385
1385
|
}
|
|
1386
|
-
async function Yt(
|
|
1386
|
+
async function Yt(a, s, r, t, e, n, o, d) {
|
|
1387
1387
|
let i = new m();
|
|
1388
1388
|
if (r.id === "1") {
|
|
1389
|
-
if (i = await Tt(
|
|
1390
|
-
|
|
1389
|
+
if (i = await Tt(a, s, r, n.id, d), i.result) {
|
|
1390
|
+
r.tenants.forEach((f) => {
|
|
1391
|
+
(f.configId === "1" || f.configId === "") && (f.configId = r.id);
|
|
1392
|
+
}), t && t(r.id);
|
|
1391
1393
|
const l = {};
|
|
1392
1394
|
Object.defineProperty(l, r.id, { value: !0, writable: !0, enumerable: !0 }), e(l);
|
|
1393
|
-
let u =
|
|
1394
|
-
u !== -1 && (
|
|
1395
|
+
let u = n.associatedConfigs.findIndex((f) => f == "1");
|
|
1396
|
+
u !== -1 && (n.associatedConfigs.splice(u, 1), n.associatedConfigs.push(r.id));
|
|
1395
1397
|
}
|
|
1396
1398
|
} else
|
|
1397
|
-
i = await St(
|
|
1399
|
+
i = await St(a, s, r, d);
|
|
1398
1400
|
return o.save(), i;
|
|
1399
1401
|
}
|
|
1400
|
-
async function es(
|
|
1401
|
-
let
|
|
1402
|
-
return
|
|
1402
|
+
async function es(a, s, r, t, e) {
|
|
1403
|
+
let n = new m();
|
|
1404
|
+
return n = await wt(a, s, r, t, e), n;
|
|
1403
1405
|
}
|
|
1404
|
-
async function ts(
|
|
1405
|
-
return ht(
|
|
1406
|
+
async function ts(a, s, r, t, e) {
|
|
1407
|
+
return ht(a, s, r, t, e);
|
|
1406
1408
|
}
|
|
1407
|
-
async function ss(
|
|
1408
|
-
return gt(
|
|
1409
|
+
async function ss(a, s, r, t, e) {
|
|
1410
|
+
return gt(a, s, r, t, e);
|
|
1409
1411
|
}
|
|
1410
|
-
async function rs(
|
|
1412
|
+
async function rs(a, s, r, t, e, n) {
|
|
1411
1413
|
let o = new m();
|
|
1412
1414
|
if (e) debugger;
|
|
1413
1415
|
try {
|
|
1414
1416
|
let d = t.ws.find((i) => i.id === r);
|
|
1415
1417
|
if (d != null) {
|
|
1416
1418
|
d.associatedConfigs.length = 0;
|
|
1417
|
-
let i = await mt(
|
|
1419
|
+
let i = await mt(a, s, n, d.id, e);
|
|
1418
1420
|
return i.result && (t.tagWithWorkspaces(), localStorage.setItem("BatchIdArray", "{}")), i;
|
|
1419
1421
|
} else
|
|
1420
1422
|
return o.result = !1, o.error = "Workspace not found.", o.status = 404, o;
|
|
@@ -1422,97 +1424,97 @@ async function rs(n, s, r, t, e, a) {
|
|
|
1422
1424
|
return console.log(d.message), o.error = d.message, o.result = !1, o.status = 500, o;
|
|
1423
1425
|
}
|
|
1424
1426
|
}
|
|
1425
|
-
async function
|
|
1426
|
-
return yt(
|
|
1427
|
+
async function ns(a, s, r, t, e) {
|
|
1428
|
+
return yt(a, s, r, t);
|
|
1427
1429
|
}
|
|
1428
|
-
async function
|
|
1430
|
+
async function as(a, s, r, t, e) {
|
|
1429
1431
|
console.log(">>>>>> initGet");
|
|
1430
|
-
let
|
|
1432
|
+
let n = new m();
|
|
1431
1433
|
if (e)
|
|
1432
1434
|
debugger;
|
|
1433
1435
|
let o = new H();
|
|
1434
|
-
return o.tid = s.tid, o.domain = s.tid, await Ee(o, e) ? (s.authority = o.authority, t.setTaskStart("GET tenant details", /* @__PURE__ */ new Date()),
|
|
1436
|
+
return o.tid = s.tid, o.domain = s.tid, await Ee(o, e) ? (s.authority = o.authority, t.setTaskStart("GET tenant details", /* @__PURE__ */ new Date()), n.result = await Xe(s, o, r, a, e), t.setTaskEnd("GET tenant details", /* @__PURE__ */ new Date(), "complete"), n.result && (s.companyName = o.name, s.companyDomain = o.domain, t.setTaskStart("POST config init", /* @__PURE__ */ new Date()), n = await It(a, s, e), t.setTaskEnd("POST config init", /* @__PURE__ */ new Date(), n.result ? "complete" : "failed")), n.result && (t.setTaskStart("GET workspaces", /* @__PURE__ */ new Date()), n = await rt(a, s, r, e), t.setTaskEnd("GET workspaces", /* @__PURE__ */ new Date(), n.result ? "complete" : "failed")), console.log("initGet complete. Version: " + _()), n) : (n.error = `Failed to retrieve authority for user "${s.mail}" TID ${s.tid}.`, n.result = !1, n);
|
|
1435
1437
|
}
|
|
1436
|
-
async function os(
|
|
1437
|
-
return kt(
|
|
1438
|
+
async function os(a, s, r, t) {
|
|
1439
|
+
return kt(a, s, r, t);
|
|
1438
1440
|
}
|
|
1439
|
-
async function is(
|
|
1440
|
-
return $t(
|
|
1441
|
+
async function is(a, s, r, t, e) {
|
|
1442
|
+
return $t(a, s, r, t);
|
|
1441
1443
|
}
|
|
1442
|
-
async function ls(
|
|
1443
|
-
return lt(
|
|
1444
|
+
async function ls(a, s, r, t) {
|
|
1445
|
+
return lt(a, s, r, t);
|
|
1444
1446
|
}
|
|
1445
|
-
async function cs(
|
|
1446
|
-
return ot(
|
|
1447
|
+
async function cs(a, s, r, t) {
|
|
1448
|
+
return ot(a, s, r, t);
|
|
1447
1449
|
}
|
|
1448
|
-
async function ds(
|
|
1449
|
-
return await Et(
|
|
1450
|
+
async function ds(a, s, r, t) {
|
|
1451
|
+
return await Et(a, s, r, t);
|
|
1450
1452
|
}
|
|
1451
|
-
function et(
|
|
1453
|
+
function et(a, s, r, t) {
|
|
1452
1454
|
r.map((e) => {
|
|
1453
|
-
let
|
|
1455
|
+
let n = null, o = s.us.findIndex((l) => l.oid === e.userId || l.oid === e.email);
|
|
1454
1456
|
if (o === -1) {
|
|
1455
1457
|
let l = s.us.findIndex((u) => u.oid === "1");
|
|
1456
1458
|
if (l !== -1) {
|
|
1457
|
-
|
|
1458
|
-
let u =
|
|
1459
|
-
u !== -1 && (
|
|
1459
|
+
n = s.us.at(l);
|
|
1460
|
+
let u = a.associatedUsers.findIndex((f) => f == "1");
|
|
1461
|
+
u !== -1 && (a.associatedUsers.splice(u, 1), a.associatedUsers.push(e.userId));
|
|
1460
1462
|
} else
|
|
1461
|
-
|
|
1463
|
+
n = new re(), s.us.push(n);
|
|
1462
1464
|
} else
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
let d = s.ts.find((l) => l.tid ===
|
|
1466
|
-
d != null && (
|
|
1465
|
+
n = s.us.at(o);
|
|
1466
|
+
n.sel = t === e.userId, n.oid = e.userId ? e.userId : e.email, n.name = e.firstName ?? n.name, n.mail = e.email, n.tid = e.tenantId;
|
|
1467
|
+
let d = s.ts.find((l) => l.tid === n.tid);
|
|
1468
|
+
d != null && (n.authority = d.authority, n.companyName = d.name, n.companyDomain = d.domain), a.associatedUsers.findIndex((l) => l === n.oid) == -1 && a.associatedUsers.push(n.oid);
|
|
1467
1469
|
}), s.save();
|
|
1468
1470
|
}
|
|
1469
|
-
function tt(
|
|
1471
|
+
function tt(a, s, r, t) {
|
|
1470
1472
|
r.map((e) => {
|
|
1471
|
-
let
|
|
1473
|
+
let n = null, o = s.ts.findIndex((u) => u.tid === e.tenantId);
|
|
1472
1474
|
if (o === -1) {
|
|
1473
1475
|
let u = s.ts.findIndex((f) => f.tid === "1");
|
|
1474
1476
|
if (u !== -1) {
|
|
1475
|
-
|
|
1476
|
-
let f =
|
|
1477
|
-
f !== -1 && (
|
|
1477
|
+
n = s.ts.at(u);
|
|
1478
|
+
let f = a.associatedTenants.findIndex((I) => I == "1");
|
|
1479
|
+
f !== -1 && (a.associatedTenants.splice(f, 1), a.associatedTenants.push(e.tenantId));
|
|
1478
1480
|
} else
|
|
1479
|
-
|
|
1481
|
+
n = new H(), s.ts.push(n);
|
|
1480
1482
|
} else
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
+
n = s.ts.at(o);
|
|
1484
|
+
n.sel = t === e.tenantId, n.tid = e.tenantId, n.name = e.name, n.domain = e.domain, n.tenantType = e.type.toLowerCase();
|
|
1483
1485
|
const d = /^(https:\/\/login.microsoftonline.(?:us|com)\/)organizations\/v2.0$/, i = e.authority.match(d);
|
|
1484
|
-
|
|
1486
|
+
n.authority = i ? i[1] : e.authority, a.associatedTenants.findIndex((u) => u === e.tenantId) == -1 && a.associatedTenants.push(e.tenantId);
|
|
1485
1487
|
}), s.save();
|
|
1486
1488
|
}
|
|
1487
|
-
function st(
|
|
1489
|
+
function st(a, s, r, t) {
|
|
1488
1490
|
r.map((e) => {
|
|
1489
|
-
let
|
|
1491
|
+
let n = null, o = s.cs.findIndex((i) => i.id === e.id);
|
|
1490
1492
|
if (o === -1) {
|
|
1491
1493
|
let i = s.cs.findIndex((l) => l.id === "1");
|
|
1492
1494
|
if (i !== -1) {
|
|
1493
|
-
|
|
1494
|
-
let l =
|
|
1495
|
-
l !== -1 && (
|
|
1495
|
+
n = s.cs.at(i);
|
|
1496
|
+
let l = a.associatedConfigs.findIndex((u) => u == "1");
|
|
1497
|
+
l !== -1 && (a.associatedConfigs.splice(l, 1), a.associatedConfigs.push(e.id));
|
|
1496
1498
|
} else
|
|
1497
|
-
|
|
1499
|
+
n = new ne(), s.cs.push(n);
|
|
1498
1500
|
} else
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
+
n = s.cs.at(o);
|
|
1502
|
+
n.sel = t === e.id, n.id = e.id, n.workspaceId = e.workspaceId, n.name = e.name, n.description = e.description, n.isEnabled = e.isEnabled, n.tenants.length = 0, e.tenants.map((i) => {
|
|
1501
1503
|
let l = new Me();
|
|
1502
|
-
l.tid = i.tenantId, l.sourceGroupId = i.sourceGroupId ?? "", l.sourceGroupName = i.sourceGroupName ?? "", l.targetGroupId = i.targetGroupId ?? "", l.targetGroupName = i.targetGroupName ?? "", l.configurationTenantType = i.configurationTenantType.toLowerCase(), l.deltaToken = i.deltaToken ?? "", l.configId =
|
|
1503
|
-
}),
|
|
1504
|
+
l.tid = i.tenantId, l.sourceGroupId = i.sourceGroupId ?? "", l.sourceGroupName = i.sourceGroupName ?? "", l.targetGroupId = i.targetGroupId ?? "", l.targetGroupName = i.targetGroupName ?? "", l.configurationTenantType = i.configurationTenantType.toLowerCase(), l.deltaToken = i.deltaToken ?? "", l.configId = n.id, l.batchId = i.batchId ?? "", l.isReadPermissionConsented = i.isReadPermissionConsented, l.isWritePermissionConsented = i.isWritePermissionConsented, n.tenants.push(l);
|
|
1505
|
+
}), a.associatedConfigs.findIndex((i) => i === e.id) == -1 && a.associatedConfigs.push(e.id);
|
|
1504
1506
|
}), console.log("--------------ii-----------", s), s.save();
|
|
1505
1507
|
}
|
|
1506
|
-
async function rt(
|
|
1508
|
+
async function rt(a, s, r, t) {
|
|
1507
1509
|
let e = new m();
|
|
1508
1510
|
if (t) debugger;
|
|
1509
1511
|
try {
|
|
1510
|
-
if (e = await Dt(
|
|
1511
|
-
for (let
|
|
1512
|
-
let o = null, d = r.ws.findIndex((E) => E.id ===
|
|
1512
|
+
if (e = await Dt(a, s, t), e.result) {
|
|
1513
|
+
for (let n of e.array) {
|
|
1514
|
+
let o = null, d = r.ws.findIndex((E) => E.id === n.id);
|
|
1513
1515
|
if (d === -1) {
|
|
1514
1516
|
let E = r.ws.findIndex((A) => A.id === "1");
|
|
1515
|
-
E !== -1 ? o = r.ws.at(E) : (o = new
|
|
1517
|
+
E !== -1 ? o = r.ws.at(E) : (o = new ae(), r.ws.push(o));
|
|
1516
1518
|
} else
|
|
1517
1519
|
o = r.ws.at(d);
|
|
1518
1520
|
let i = "";
|
|
@@ -1530,8 +1532,8 @@ async function rt(n, s, r, t) {
|
|
|
1530
1532
|
let A = r.cs.find(($) => $.id === E);
|
|
1531
1533
|
A != null && A.sel && (u = A.id);
|
|
1532
1534
|
}
|
|
1533
|
-
o.associatedUsers.length = 0, o.associatedTenants.length = 0, o.associatedConfigs.length = 0, o.id =
|
|
1534
|
-
let f = it(
|
|
1535
|
+
o.associatedUsers.length = 0, o.associatedTenants.length = 0, o.associatedConfigs.length = 0, o.id = n.id, o.name = n.name, o.ownerid = n.workspaceOwnerUserId;
|
|
1536
|
+
let f = it(a, s, o.id, t), I = At(a, s, o.id, t), D = bt(a, s, o.id, t), [R, W, x] = await Promise.all([f, I, D]);
|
|
1535
1537
|
if (!R.result) return R;
|
|
1536
1538
|
if (!W.result) return W;
|
|
1537
1539
|
if (!x.result) return x;
|
|
@@ -1539,18 +1541,18 @@ async function rt(n, s, r, t) {
|
|
|
1539
1541
|
}
|
|
1540
1542
|
return e;
|
|
1541
1543
|
}
|
|
1542
|
-
} catch (
|
|
1543
|
-
console.log(
|
|
1544
|
+
} catch (n) {
|
|
1545
|
+
console.log(n.message), e.error = n.message;
|
|
1544
1546
|
}
|
|
1545
1547
|
return e.result = !1, e.status = 500, e;
|
|
1546
1548
|
}
|
|
1547
|
-
async function us(
|
|
1549
|
+
async function us(a, s) {
|
|
1548
1550
|
let r = "", t = _();
|
|
1549
1551
|
try {
|
|
1550
|
-
let e =
|
|
1552
|
+
let e = a.getAllAccounts(), n = s.oid + "." + s.tid, o = null;
|
|
1551
1553
|
for (let i = 0; i < e.length; i++)
|
|
1552
|
-
e[i].homeAccountId ==
|
|
1553
|
-
r = (await
|
|
1554
|
+
e[i].homeAccountId == n && (o = e[i]);
|
|
1555
|
+
r = (await a.acquireTokenSilent({
|
|
1554
1556
|
scopes: [
|
|
1555
1557
|
"https://analysis.windows.net/powerbi/api/App.Read.All",
|
|
1556
1558
|
"https://analysis.windows.net/powerbi/api/Dataset.ReadWrite.All",
|
|
@@ -1564,25 +1566,25 @@ async function us(n, s) {
|
|
|
1564
1566
|
}
|
|
1565
1567
|
return console.log(t), r;
|
|
1566
1568
|
}
|
|
1567
|
-
async function de(
|
|
1569
|
+
async function de(a, s) {
|
|
1568
1570
|
const r = new Headers();
|
|
1569
1571
|
if (r.append("Content-Type", "application/json"), r.append("accept", "*/*"), s.azureAccessToken == null || s.azureAccessToken === "")
|
|
1570
1572
|
try {
|
|
1571
|
-
let t =
|
|
1573
|
+
let t = a.getAllAccounts(), e = s.oid + "." + s.tid, n = null;
|
|
1572
1574
|
for (let d = 0; d < t.length; d++)
|
|
1573
|
-
t[d].homeAccountId == e && (
|
|
1574
|
-
let o = await
|
|
1575
|
+
t[d].homeAccountId == e && (n = t[d]);
|
|
1576
|
+
let o = await a.acquireTokenSilent({
|
|
1575
1577
|
scopes: ["https://management.azure.com/user_impersonation"],
|
|
1576
|
-
account:
|
|
1578
|
+
account: n
|
|
1577
1579
|
});
|
|
1578
1580
|
s.azureAccessToken = o.accessToken, console.log("Front end token acquired silently: " + s.azureAccessToken.slice(0, 20));
|
|
1579
1581
|
} catch (t) {
|
|
1580
1582
|
try {
|
|
1581
1583
|
console.log("Front end token silent acquisition failure: " + t);
|
|
1582
|
-
let e =
|
|
1584
|
+
let e = a.getAllAccounts(), n = s.oid + "." + s.tid, o = null;
|
|
1583
1585
|
for (let d = 0; d < e.length; d++)
|
|
1584
|
-
e[d].homeAccountId ==
|
|
1585
|
-
|
|
1586
|
+
e[d].homeAccountId == n && (o = e[d]);
|
|
1587
|
+
a.acquireTokenRedirect({
|
|
1586
1588
|
scopes: ["https://management.azure.com/user_impersonation"],
|
|
1587
1589
|
account: o
|
|
1588
1590
|
});
|
|
@@ -1592,47 +1594,47 @@ async function de(n, s) {
|
|
|
1592
1594
|
}
|
|
1593
1595
|
return r.append("Authorization", `Bearer ${s.azureAccessToken}`), r;
|
|
1594
1596
|
}
|
|
1595
|
-
async function fs(
|
|
1597
|
+
async function fs(a, s) {
|
|
1596
1598
|
if (s == null || s.spacode == "")
|
|
1597
1599
|
return !1;
|
|
1598
1600
|
try {
|
|
1599
|
-
let t = { method: "GET", headers: await de(
|
|
1601
|
+
let t = { method: "GET", headers: await de(a, s) }, e = j.azureListRootAssignments;
|
|
1600
1602
|
e += "'", e += s.oid, e += "'";
|
|
1601
|
-
let
|
|
1602
|
-
if (
|
|
1603
|
-
let o = await
|
|
1603
|
+
let n = await fetch(e, t);
|
|
1604
|
+
if (n.status == 200) {
|
|
1605
|
+
let o = await n.json();
|
|
1604
1606
|
o = o;
|
|
1605
1607
|
debugger;
|
|
1606
1608
|
console.log("Successful call to Azure Resource Graph list root assignments");
|
|
1607
1609
|
} else
|
|
1608
|
-
return console.log(await y(
|
|
1610
|
+
return console.log(await y(n)), !1;
|
|
1609
1611
|
} catch (r) {
|
|
1610
1612
|
return console.log(r), !1;
|
|
1611
1613
|
}
|
|
1612
1614
|
return !0;
|
|
1613
1615
|
}
|
|
1614
|
-
async function ps(
|
|
1616
|
+
async function ps(a, s) {
|
|
1615
1617
|
if (s == null || s.spacode == "")
|
|
1616
1618
|
return !1;
|
|
1617
1619
|
try {
|
|
1618
|
-
let t = { method: "POST", headers: await de(
|
|
1619
|
-
if (
|
|
1620
|
+
let t = { method: "POST", headers: await de(a, s) }, e = j.azureElevateAccess, n = await fetch(e, t);
|
|
1621
|
+
if (n.status == 200)
|
|
1620
1622
|
console.log("Successful call to Azure Resource Graph list root assignments");
|
|
1621
1623
|
else
|
|
1622
|
-
return console.log(await y(
|
|
1624
|
+
return console.log(await y(n)), !1;
|
|
1623
1625
|
} catch (r) {
|
|
1624
1626
|
return console.log(r), !1;
|
|
1625
1627
|
}
|
|
1626
1628
|
return !0;
|
|
1627
1629
|
}
|
|
1628
|
-
async function
|
|
1630
|
+
async function nt(a, s) {
|
|
1629
1631
|
let r = new Array();
|
|
1630
1632
|
if (s == null || s.spacode == "")
|
|
1631
1633
|
return r;
|
|
1632
1634
|
try {
|
|
1633
|
-
let e = { method: "GET", headers: await de(
|
|
1634
|
-
|
|
1635
|
-
let o = await fetch(
|
|
1635
|
+
let e = { method: "GET", headers: await de(a, s) }, n = j.azureListRootAssignments;
|
|
1636
|
+
n += "'", n += s.oid, n += "'";
|
|
1637
|
+
let o = await fetch(n, e);
|
|
1636
1638
|
if (o.status == 200) {
|
|
1637
1639
|
let d = await o.json();
|
|
1638
1640
|
d = d;
|
|
@@ -1645,19 +1647,19 @@ async function at(n, s) {
|
|
|
1645
1647
|
}
|
|
1646
1648
|
return r;
|
|
1647
1649
|
}
|
|
1648
|
-
function
|
|
1649
|
-
let s = "8d95d21c-c378-4bb0-9f52-88c30d271e7a", r =
|
|
1650
|
+
function at(a) {
|
|
1651
|
+
let s = "8d95d21c-c378-4bb0-9f52-88c30d271e7a", r = a.authority.toLowerCase();
|
|
1650
1652
|
return r.startsWith("https://login.microsoftonline.com/") ? s = "8d95d21c-c378-4bb0-9f52-88c30d271e7a" : r.startsWith("https://login.microsoftonline.us/") ? s = "48da942e-ea3d-49e4-a054-81649012f8f2" : r.startsWith("https://login.partner.microsoftonline.cn/") && (s = "c91d32e4-dcc5-4d77-826a-16e93ffce666"), `api://${s}/Config.Write`;
|
|
1651
1653
|
}
|
|
1652
|
-
async function b(
|
|
1654
|
+
async function b(a, s) {
|
|
1653
1655
|
const r = new Headers();
|
|
1654
1656
|
r.append("Content-Type", "application/json"), r.append("accept", "*/*");
|
|
1655
|
-
const t =
|
|
1657
|
+
const t = at(s);
|
|
1656
1658
|
try {
|
|
1657
|
-
let e =
|
|
1659
|
+
let e = a.getAllAccounts(), n = s.oid + "." + s.tid, o = null;
|
|
1658
1660
|
for (let i = 0; i < e.length; i++)
|
|
1659
|
-
e[i].homeAccountId ==
|
|
1660
|
-
let d = await
|
|
1661
|
+
e[i].homeAccountId == n && (o = e[i]);
|
|
1662
|
+
let d = await a.acquireTokenSilent({
|
|
1661
1663
|
scopes: [t],
|
|
1662
1664
|
account: o
|
|
1663
1665
|
});
|
|
@@ -1665,29 +1667,29 @@ async function b(n, s) {
|
|
|
1665
1667
|
} catch (e) {
|
|
1666
1668
|
try {
|
|
1667
1669
|
console.log("Front end mindline token silent acquisition failure, triggering redirect: " + e);
|
|
1668
|
-
let
|
|
1669
|
-
for (let i = 0; i <
|
|
1670
|
-
|
|
1671
|
-
|
|
1670
|
+
let n = a.getAllAccounts(), o = s.oid + "." + s.tid, d = null;
|
|
1671
|
+
for (let i = 0; i < n.length; i++)
|
|
1672
|
+
n[i].homeAccountId == o && (d = n[i]);
|
|
1673
|
+
a.acquireTokenRedirect({
|
|
1672
1674
|
scopes: [t],
|
|
1673
1675
|
account: d
|
|
1674
1676
|
});
|
|
1675
|
-
} catch (
|
|
1676
|
-
console.log("Front end mindline token redirect acquisition failure: " +
|
|
1677
|
+
} catch (n) {
|
|
1678
|
+
console.log("Front end mindline token redirect acquisition failure: " + n);
|
|
1677
1679
|
}
|
|
1678
1680
|
}
|
|
1679
1681
|
return r.append("Authorization", `Bearer ${s.mindlineAccessToken}`), r;
|
|
1680
1682
|
}
|
|
1681
|
-
async function y(
|
|
1683
|
+
async function y(a) {
|
|
1682
1684
|
let s = "";
|
|
1683
|
-
if (
|
|
1685
|
+
if (a.status === 401 && (s = a.statusText, s != ""))
|
|
1684
1686
|
return s;
|
|
1685
|
-
let r = await
|
|
1687
|
+
let r = await a.json();
|
|
1686
1688
|
if (r.error !== void 0)
|
|
1687
1689
|
s = `Error: ${r.error} Message: ${r.message}`;
|
|
1688
1690
|
else if (r.errors !== void 0)
|
|
1689
1691
|
s = Object.keys(r.errors).reduce(
|
|
1690
|
-
(
|
|
1692
|
+
(n, o) => n + o + ": " + r.errors[o] + " ",
|
|
1691
1693
|
""
|
|
1692
1694
|
);
|
|
1693
1695
|
else if (r.title !== void 0)
|
|
@@ -1696,29 +1698,29 @@ async function y(n) {
|
|
|
1696
1698
|
debugger;
|
|
1697
1699
|
return s;
|
|
1698
1700
|
}
|
|
1699
|
-
async function ot(
|
|
1701
|
+
async function ot(a, s, r, t) {
|
|
1700
1702
|
let e = new m();
|
|
1701
1703
|
if (r.oid == "" && r.mail == "" || t == "")
|
|
1702
1704
|
return e.result = !1, e.error = "adminDelete: invalid parameters", e.status = 500, e;
|
|
1703
|
-
let
|
|
1704
|
-
|
|
1705
|
-
let d = { method: "DELETE", headers: await b(
|
|
1705
|
+
let n = null;
|
|
1706
|
+
n = new URL(w.adminEndpoint()), n.searchParams.append("workspaceId", t), n.searchParams.append("email", r.mail);
|
|
1707
|
+
let d = { method: "DELETE", headers: await b(a, s) };
|
|
1706
1708
|
try {
|
|
1707
|
-
console.log("Attempting DELETE from /admin: " +
|
|
1708
|
-
let i = await fetch(
|
|
1709
|
-
return i.status === 200 && i.statusText === "OK" ? (console.log(`Successful DELETE from /admin: ${
|
|
1709
|
+
console.log("Attempting DELETE from /admin: " + n.href);
|
|
1710
|
+
let i = await fetch(n.href, d);
|
|
1711
|
+
return i.status === 200 && i.statusText === "OK" ? (console.log(`Successful DELETE from /admin: ${n.href}`), e) : (e.error = await y(i), console.log(`Failed DELETE from /admin: ${n.href}`), console.log(e.error), e.status = 500, e.result = !1, e);
|
|
1710
1712
|
} catch (i) {
|
|
1711
1713
|
e.error = i.message, e.status = 500, e.result = !1, console.log(i.message);
|
|
1712
1714
|
}
|
|
1713
1715
|
return e;
|
|
1714
1716
|
}
|
|
1715
|
-
async function it(
|
|
1717
|
+
async function it(a, s, r, t) {
|
|
1716
1718
|
let e = new m();
|
|
1717
1719
|
if (r === "")
|
|
1718
1720
|
return e.result = !1, e.status = 500, e.error = "adminsGet: no workspace provided", e;
|
|
1719
|
-
let
|
|
1721
|
+
let n = w.adminsEndpoint(), o = new URL(n);
|
|
1720
1722
|
o.searchParams.append("workspaceId", r);
|
|
1721
|
-
let i = { method: "GET", headers: await b(
|
|
1723
|
+
let i = { method: "GET", headers: await b(a, s) };
|
|
1722
1724
|
try {
|
|
1723
1725
|
if (t) debugger;
|
|
1724
1726
|
console.log("Attempting GET from /admins: " + o.href);
|
|
@@ -1733,33 +1735,33 @@ async function it(n, s, r, t) {
|
|
|
1733
1735
|
}
|
|
1734
1736
|
return e;
|
|
1735
1737
|
}
|
|
1736
|
-
async function lt(
|
|
1738
|
+
async function lt(a, s, r, t) {
|
|
1737
1739
|
let e = new m();
|
|
1738
1740
|
if (r.mail == "" || r.authority == "" || r.tid === "")
|
|
1739
1741
|
return e.result = !1, e.error = "adminPost: invalid argument", e.status = 500, e;
|
|
1740
|
-
let
|
|
1741
|
-
const o = await b(
|
|
1742
|
+
let n = w.adminEndpoint();
|
|
1743
|
+
const o = await b(a, s);
|
|
1742
1744
|
let d = `
|
|
1743
1745
|
{"email": "${r.mail}",
|
|
1744
1746
|
"tenantId": "${r.tid}",
|
|
1745
1747
|
"workspaceId": "${t}"
|
|
1746
1748
|
}`, i = { method: "POST", headers: o, body: d };
|
|
1747
1749
|
try {
|
|
1748
|
-
console.log("Attempting POST to /admin: " +
|
|
1749
|
-
let l = await fetch(
|
|
1750
|
+
console.log("Attempting POST to /admin: " + n);
|
|
1751
|
+
let l = await fetch(n, i);
|
|
1750
1752
|
return l.status === 200 && l.statusText === "OK" ? (console.log(`Successful POST to /admin: ${d}`), e) : (e.error = await y(l), console.log(`Failed POST to /admin: ${d}`), console.log(e.error), e.status = 500, e.result = !1, e);
|
|
1751
1753
|
} catch (l) {
|
|
1752
1754
|
e.error = l.message, e.status = 500, e.result = !1, console.log(l.message);
|
|
1753
1755
|
}
|
|
1754
1756
|
return e;
|
|
1755
1757
|
}
|
|
1756
|
-
async function ct(
|
|
1757
|
-
|
|
1758
|
+
async function ct(a, s, r, t) {
|
|
1759
|
+
a = a, s = s, t = t;
|
|
1758
1760
|
let e = new m();
|
|
1759
1761
|
if (r.id === "")
|
|
1760
1762
|
return e.result = !1, e.error = "auditConfigPost: invalid config ID", e.status = 500, e;
|
|
1761
|
-
let
|
|
1762
|
-
const o = await b(
|
|
1763
|
+
let n = w.auditConfigEndpoint();
|
|
1764
|
+
const o = await b(a, s);
|
|
1763
1765
|
let d = `
|
|
1764
1766
|
{
|
|
1765
1767
|
"workspaceId": "${r.workspaceId}",
|
|
@@ -1771,8 +1773,8 @@ async function ct(n, s, r, t) {
|
|
|
1771
1773
|
}`, i = { method: "POST", headers: o, body: d };
|
|
1772
1774
|
try {
|
|
1773
1775
|
if (t) debugger;
|
|
1774
|
-
console.log("Attempting POST to /audit-configuration: " +
|
|
1775
|
-
let l = await fetch(
|
|
1776
|
+
console.log("Attempting POST to /audit-configuration: " + n);
|
|
1777
|
+
let l = await fetch(n, i);
|
|
1776
1778
|
if (l.status === 200 && l.statusText === "OK") {
|
|
1777
1779
|
let u = await l.json();
|
|
1778
1780
|
return r.id = u, console.log(
|
|
@@ -1785,14 +1787,14 @@ async function ct(n, s, r, t) {
|
|
|
1785
1787
|
}
|
|
1786
1788
|
return e;
|
|
1787
1789
|
}
|
|
1788
|
-
async function dt(
|
|
1789
|
-
|
|
1790
|
+
async function dt(a, s, r, t) {
|
|
1791
|
+
a = a, s = s, t = t;
|
|
1790
1792
|
let e = new m();
|
|
1791
1793
|
if (s.mail == null || s.mail == "")
|
|
1792
1794
|
return e.result = !1, e.status = 500, e.error = "auditConfigGet: no user provided", e;
|
|
1793
1795
|
if (!r || r.trim() === "")
|
|
1794
1796
|
return e.result = !1, e.error = "auditConfigGet: configurationId is required", e.status = 500, e;
|
|
1795
|
-
let
|
|
1797
|
+
let n = w.auditConfigEndpoint(), o = new URL(`${n}/${r}`), i = { method: "GET", headers: await b(a, s) };
|
|
1796
1798
|
try {
|
|
1797
1799
|
if (t) debugger;
|
|
1798
1800
|
console.log("Attempting GET to /audit-configuration: " + o.href);
|
|
@@ -1807,13 +1809,13 @@ async function dt(n, s, r, t) {
|
|
|
1807
1809
|
}
|
|
1808
1810
|
return e;
|
|
1809
1811
|
}
|
|
1810
|
-
async function ut(
|
|
1811
|
-
let
|
|
1812
|
+
async function ut(a, s, r, t, e) {
|
|
1813
|
+
let n = new m();
|
|
1812
1814
|
if (!r || r.trim() === "")
|
|
1813
|
-
return
|
|
1815
|
+
return n.result = !1, n.error = "auditConfigPut: invalid configuration ID", n.status = 500, n;
|
|
1814
1816
|
let o = w.auditConfigEndpoint(), d = new URL(o);
|
|
1815
1817
|
d.searchParams.append("configurationId", r);
|
|
1816
|
-
const i = await b(
|
|
1818
|
+
const i = await b(a, s);
|
|
1817
1819
|
let l = `
|
|
1818
1820
|
{
|
|
1819
1821
|
"name": "${t.name}",
|
|
@@ -1826,21 +1828,21 @@ async function ut(n, s, r, t, e) {
|
|
|
1826
1828
|
if (e) debugger;
|
|
1827
1829
|
console.log("Attempting PUT to /audit-configuration: " + d.href);
|
|
1828
1830
|
const f = await fetch(d.href, u);
|
|
1829
|
-
f.status === 200 && f.statusText === "OK" ? (
|
|
1831
|
+
f.status === 200 && f.statusText === "OK" ? (n.result = !0, console.log(`Successful PUT to ${d.href}: ${l}`)) : (n.error = await y(f), console.error(`Failed PUT to ${d.href}: ${l}`), n.status = f.status, n.result = !1);
|
|
1830
1832
|
} catch (f) {
|
|
1831
|
-
|
|
1833
|
+
n.error = f.message, n.status = 500, n.result = !1, console.error("Error during auditConfigPut:", f.message);
|
|
1832
1834
|
}
|
|
1833
|
-
return
|
|
1835
|
+
return n;
|
|
1834
1836
|
}
|
|
1835
|
-
async function ft(
|
|
1837
|
+
async function ft(a, s, r, t) {
|
|
1836
1838
|
let e = new m();
|
|
1837
1839
|
if (!s.mail)
|
|
1838
1840
|
return e.result = !1, e.status = 500, e.error = "auditConfigDelete: no user provided", e;
|
|
1839
1841
|
if (!r || r.trim() === "")
|
|
1840
1842
|
return e.result = !1, e.status = 500, e.error = "auditConfigDelete: configurationId is required", e;
|
|
1841
|
-
let
|
|
1843
|
+
let n = w.auditConfigEndpoint(), o = new URL(n);
|
|
1842
1844
|
o.searchParams.append("configurationId", r);
|
|
1843
|
-
const i = { method: "DELETE", headers: await b(
|
|
1845
|
+
const i = { method: "DELETE", headers: await b(a, s) };
|
|
1844
1846
|
try {
|
|
1845
1847
|
if (t) debugger;
|
|
1846
1848
|
console.log(`Attempting DELETE to /audit-configuration: ${o.href}`);
|
|
@@ -1851,15 +1853,15 @@ async function ft(n, s, r, t) {
|
|
|
1851
1853
|
}
|
|
1852
1854
|
return e;
|
|
1853
1855
|
}
|
|
1854
|
-
async function pt(
|
|
1856
|
+
async function pt(a, s, r) {
|
|
1855
1857
|
let t = new m();
|
|
1856
1858
|
if (s.mail == null || s.mail == "")
|
|
1857
1859
|
return t.result = !1, t.status = 500, t.error = "auditEventsGet: no user provided", t;
|
|
1858
|
-
let e = w.auditEventsEndpoint(),
|
|
1860
|
+
let e = w.auditEventsEndpoint(), n = new URL(e), d = { method: "GET", headers: await b(a, s) };
|
|
1859
1861
|
try {
|
|
1860
1862
|
if (r) debugger;
|
|
1861
|
-
console.log("Attempting GET from /audit-events endpoint: " +
|
|
1862
|
-
let i = await fetch(
|
|
1863
|
+
console.log("Attempting GET from /audit-events endpoint: " + n.href);
|
|
1864
|
+
let i = await fetch(n.href, d);
|
|
1863
1865
|
if (i.status === 200 && i.statusText === "OK") {
|
|
1864
1866
|
let l = await i.json();
|
|
1865
1867
|
if (Array.isArray(l.data)) {
|
|
@@ -1869,16 +1871,16 @@ async function pt(n, s, r) {
|
|
|
1869
1871
|
}
|
|
1870
1872
|
return t.error = "Failed GET from /audit-events: failed to JSON-parse response", console.log(t.error), t.status = 500, t.result = !1, t;
|
|
1871
1873
|
} else
|
|
1872
|
-
return console.log(`Failed GET from /audit-events: ${
|
|
1874
|
+
return console.log(`Failed GET from /audit-events: ${n.href}`), t.error = await y(i), t.status = 500, t.result = !1, console.log(t.error), t;
|
|
1873
1875
|
} catch (i) {
|
|
1874
1876
|
t.error = i.message, t.status = 500, t.result = !1, console.log(i.message);
|
|
1875
1877
|
}
|
|
1876
1878
|
return t;
|
|
1877
1879
|
}
|
|
1878
|
-
async function ht(
|
|
1879
|
-
let
|
|
1880
|
+
async function ht(a, s, r, t, e) {
|
|
1881
|
+
let n = new m(), o = w.configConsentEndpoint(), d = new URL(o);
|
|
1880
1882
|
d.searchParams.append("configurationId", r);
|
|
1881
|
-
const i = await b(
|
|
1883
|
+
const i = await b(a, s);
|
|
1882
1884
|
let l = `
|
|
1883
1885
|
{
|
|
1884
1886
|
"tenantId": "${t}",
|
|
@@ -1887,16 +1889,16 @@ async function ht(n, s, r, t, e) {
|
|
|
1887
1889
|
try {
|
|
1888
1890
|
console.log("Attempting PUT read consent to /configuration/consent: " + d.href);
|
|
1889
1891
|
let f = await fetch(d.href, u);
|
|
1890
|
-
return f.status === 200 && f.statusText === "OK" ? (console.log(`Successful PUT to ${d.href}`),
|
|
1892
|
+
return f.status === 200 && f.statusText === "OK" ? (console.log(`Successful PUT to ${d.href}`), n) : (n.error = await y(f), console.log(`Failed PUT to ${d.href}`), console.log(n.error), n.status = 500, n.result = !1, n);
|
|
1891
1893
|
} catch (f) {
|
|
1892
|
-
|
|
1894
|
+
n.error = f.message, n.status = 500, n.result = !1, console.log(f.message);
|
|
1893
1895
|
}
|
|
1894
|
-
return
|
|
1896
|
+
return n;
|
|
1895
1897
|
}
|
|
1896
|
-
async function gt(
|
|
1897
|
-
let
|
|
1898
|
+
async function gt(a, s, r, t, e) {
|
|
1899
|
+
let n = new m(), o = w.configConsentEndpoint(), d = new URL(o);
|
|
1898
1900
|
d.searchParams.append("configurationId", r);
|
|
1899
|
-
const i = await b(
|
|
1901
|
+
const i = await b(a, s);
|
|
1900
1902
|
let l = `
|
|
1901
1903
|
{
|
|
1902
1904
|
"tenantId": "${t}",
|
|
@@ -1905,19 +1907,19 @@ async function gt(n, s, r, t, e) {
|
|
|
1905
1907
|
try {
|
|
1906
1908
|
console.log("Attempting PUT read consent to /configuration/consent: " + d.href);
|
|
1907
1909
|
let f = await fetch(d.href, u);
|
|
1908
|
-
return f.status === 200 && f.statusText === "OK" ? (console.log(`Successful PUT to ${d.href}`),
|
|
1910
|
+
return f.status === 200 && f.statusText === "OK" ? (console.log(`Successful PUT to ${d.href}`), n) : (n.error = await y(f), console.log(`Failed PUT to ${d.href}`), console.log(n.error), n.status = 500, n.result = !1, n);
|
|
1909
1911
|
} catch (f) {
|
|
1910
|
-
|
|
1912
|
+
n.error = f.message, n.status = 500, n.result = !1, console.log(f.message);
|
|
1911
1913
|
}
|
|
1912
|
-
return
|
|
1914
|
+
return n;
|
|
1913
1915
|
}
|
|
1914
|
-
async function mt(
|
|
1915
|
-
let
|
|
1916
|
+
async function mt(a, s, r, t, e) {
|
|
1917
|
+
let n = new m();
|
|
1916
1918
|
if (r.id === "" || t == "")
|
|
1917
|
-
return
|
|
1919
|
+
return n.result = !1, n.error = "configGet: invalid config ID", n.status = 500, n;
|
|
1918
1920
|
let o = null;
|
|
1919
1921
|
o = new URL(w.configEndpoint());
|
|
1920
|
-
let i = { method: "GET", headers: await b(
|
|
1922
|
+
let i = { method: "GET", headers: await b(a, s) };
|
|
1921
1923
|
try {
|
|
1922
1924
|
console.log("Attempting GET from /config: " + o.href);
|
|
1923
1925
|
let l = await fetch(`${o.href}/${r.id}`, i);
|
|
@@ -1925,55 +1927,55 @@ async function mt(n, s, r, t, e) {
|
|
|
1925
1927
|
console.log("Successful GET from /config");
|
|
1926
1928
|
let u = await l.json();
|
|
1927
1929
|
return {
|
|
1928
|
-
...
|
|
1930
|
+
...n,
|
|
1929
1931
|
array: [u]
|
|
1930
1932
|
};
|
|
1931
1933
|
} else
|
|
1932
|
-
return
|
|
1934
|
+
return n.error = await y(l), console.log(`Failed GET from ${o.href}`), console.log(n.error), n.status = 500, n.result = !1, n;
|
|
1933
1935
|
} catch (l) {
|
|
1934
|
-
|
|
1936
|
+
n.error = l.message, n.status = 500, n.result = !1, console.log(l.message);
|
|
1935
1937
|
}
|
|
1936
|
-
return
|
|
1938
|
+
return n;
|
|
1937
1939
|
}
|
|
1938
|
-
async function yt(
|
|
1939
|
-
let
|
|
1940
|
+
async function yt(a, s, r, t, e) {
|
|
1941
|
+
let n = new m();
|
|
1940
1942
|
if (r.id === "" || t == "")
|
|
1941
|
-
return
|
|
1943
|
+
return n.result = !1, n.error = "configPost: invalid config ID", n.status = 500, n;
|
|
1942
1944
|
let o = null;
|
|
1943
1945
|
o = new URL(w.configEndpoint()), o.searchParams.append("configurationId", r.id);
|
|
1944
|
-
let i = { method: "DELETE", headers: await b(
|
|
1946
|
+
let i = { method: "DELETE", headers: await b(a, s) };
|
|
1945
1947
|
try {
|
|
1946
1948
|
console.log("Attempting DELETE from /config: " + o.href);
|
|
1947
1949
|
let l = await fetch(o.href, i);
|
|
1948
|
-
return l.status === 200 && l.statusText === "OK" ? (console.log("Successful DELETE from /config"),
|
|
1950
|
+
return l.status === 200 && l.statusText === "OK" ? (console.log("Successful DELETE from /config"), n) : (n.error = await y(l), console.log(`Failed DELETE from ${o.href}`), console.log(n.error), n.status = 500, n.result = !1, n);
|
|
1949
1951
|
} catch (l) {
|
|
1950
|
-
|
|
1952
|
+
n.error = l.message, n.status = 500, n.result = !1, console.log(l.message);
|
|
1951
1953
|
}
|
|
1952
|
-
return
|
|
1954
|
+
return n;
|
|
1953
1955
|
}
|
|
1954
|
-
async function wt(
|
|
1955
|
-
let
|
|
1956
|
+
async function wt(a, s, r, t, e) {
|
|
1957
|
+
let n = new m();
|
|
1956
1958
|
if (r === "")
|
|
1957
|
-
return
|
|
1959
|
+
return n.result = !1, n.error = "configPatch: invalid config ID", n.status = 500, n;
|
|
1958
1960
|
let o = w.configEnabledEndpoint(), d = new URL(o);
|
|
1959
1961
|
d.searchParams.append("configurationId", r), d.searchParams.append("isEnabled", t.toString());
|
|
1960
|
-
let l = { method: "PATCH", headers: await b(
|
|
1962
|
+
let l = { method: "PATCH", headers: await b(a, s) };
|
|
1961
1963
|
try {
|
|
1962
1964
|
if (e) debugger;
|
|
1963
1965
|
console.log("Attempting PATCH to /config: " + d.href);
|
|
1964
1966
|
let u = await fetch(d.href, l);
|
|
1965
|
-
return u.status === 200 && u.statusText === "OK" ? (console.log(`Successful PATCH to ${d.href}: ${t.toString()}`),
|
|
1967
|
+
return u.status === 200 && u.statusText === "OK" ? (console.log(`Successful PATCH to ${d.href}: ${t.toString()}`), n) : (n.error = await y(u), console.log(`Failed PATCH to ${d.href}: ${t.toString()}`), console.log(n.error), n.status = 500, n.result = !1, n);
|
|
1966
1968
|
} catch (u) {
|
|
1967
|
-
|
|
1969
|
+
n.error = u.message, n.status = 500, n.result = !1, console.log(u.message);
|
|
1968
1970
|
}
|
|
1969
|
-
return
|
|
1971
|
+
return n;
|
|
1970
1972
|
}
|
|
1971
|
-
async function Tt(
|
|
1972
|
-
let
|
|
1973
|
+
async function Tt(a, s, r, t, e) {
|
|
1974
|
+
let n = new m();
|
|
1973
1975
|
if (r.id === "")
|
|
1974
|
-
return
|
|
1976
|
+
return n.result = !1, n.error = "configPost: invalid config ID", n.status = 500, n;
|
|
1975
1977
|
let o = w.configEndpoint();
|
|
1976
|
-
const d = await b(
|
|
1978
|
+
const d = await b(a, s);
|
|
1977
1979
|
let i = `
|
|
1978
1980
|
{
|
|
1979
1981
|
"workspaceId": "${t}",
|
|
@@ -1989,7 +1991,9 @@ async function Tt(n, s, r, t, e) {
|
|
|
1989
1991
|
"sourceGroupName": ${I},
|
|
1990
1992
|
"targetGroupId": ${D},
|
|
1991
1993
|
"targetGroupName": ${R},
|
|
1992
|
-
"configurationTenantType": "${u.configurationTenantType}"
|
|
1994
|
+
"configurationTenantType": "${u.configurationTenantType}",
|
|
1995
|
+
"isReadPermissionConsented": ${u.isReadPermissionConsented},
|
|
1996
|
+
"isWritePermissionConsented": ${u.isWritePermissionConsented}
|
|
1993
1997
|
}`;
|
|
1994
1998
|
}), i += "]}";
|
|
1995
1999
|
let l = { method: "POST", headers: d, body: i };
|
|
@@ -1999,22 +2003,22 @@ async function Tt(n, s, r, t, e) {
|
|
|
1999
2003
|
let u = await fetch(o, l);
|
|
2000
2004
|
if (u.status === 200 && u.statusText === "OK") {
|
|
2001
2005
|
let f = await u.json();
|
|
2002
|
-
return r.id = f, console.log(
|
|
2003
|
-
`Successful ConfigID: ${
|
|
2004
|
-
),
|
|
2006
|
+
return r.id = typeof f == "object" && f !== null && f.id ? f.id : f, console.log(
|
|
2007
|
+
`Successful ConfigID: ${r.id} from POST to /config: ${i}`
|
|
2008
|
+
), n;
|
|
2005
2009
|
} else
|
|
2006
|
-
return
|
|
2010
|
+
return n.error = await y(u), console.log(`Failed PUT to /config: ${i}`), console.log(n.error), n.status = 500, n.result = !1, n;
|
|
2007
2011
|
} catch (u) {
|
|
2008
|
-
return
|
|
2012
|
+
return n.status = 500, n.result = !1, n.error = u.message, console.log(n.error), n;
|
|
2009
2013
|
}
|
|
2010
2014
|
}
|
|
2011
|
-
async function St(
|
|
2015
|
+
async function St(a, s, r, t) {
|
|
2012
2016
|
let e = new m();
|
|
2013
2017
|
if (r.id === "")
|
|
2014
2018
|
return e.result = !1, e.error = "configPost: invalid config ID", e.status = 500, e;
|
|
2015
|
-
let
|
|
2019
|
+
let n = w.configEndpoint(), o = new URL(n);
|
|
2016
2020
|
o.searchParams.append("configurationId", r.id);
|
|
2017
|
-
const d = await b(
|
|
2021
|
+
const d = await b(a, s);
|
|
2018
2022
|
let i = `
|
|
2019
2023
|
{
|
|
2020
2024
|
"name": "${r.name}",
|
|
@@ -2030,7 +2034,9 @@ async function St(n, s, r, t) {
|
|
|
2030
2034
|
"targetGroupId": ${R},
|
|
2031
2035
|
"targetGroupName": ${W},
|
|
2032
2036
|
"configurationTenantType": "${u.configurationTenantType}",
|
|
2033
|
-
"deltaToken": "${u.deltaToken}"
|
|
2037
|
+
"deltaToken": "${u.deltaToken}",
|
|
2038
|
+
"isReadPermissionConsented": ${u.isReadPermissionConsented},
|
|
2039
|
+
"isWritePermissionConsented": ${u.isWritePermissionConsented}
|
|
2034
2040
|
}`;
|
|
2035
2041
|
}), i += "]}";
|
|
2036
2042
|
let l = { method: "PUT", headers: d, body: i };
|
|
@@ -2052,13 +2058,13 @@ async function St(n, s, r, t) {
|
|
|
2052
2058
|
}
|
|
2053
2059
|
return e;
|
|
2054
2060
|
}
|
|
2055
|
-
async function bt(
|
|
2061
|
+
async function bt(a, s, r, t) {
|
|
2056
2062
|
let e = new m();
|
|
2057
2063
|
if (r === "")
|
|
2058
2064
|
return e.result = !1, e.status = 500, e.error = "configsGet: no workspace provided", e;
|
|
2059
|
-
let
|
|
2065
|
+
let n = w.configsEndpoint(), o = new URL(n);
|
|
2060
2066
|
o.searchParams.append("workspaceId", r);
|
|
2061
|
-
let i = { method: "GET", headers: await b(
|
|
2067
|
+
let i = { method: "GET", headers: await b(a, s) };
|
|
2062
2068
|
try {
|
|
2063
2069
|
if (t) debugger;
|
|
2064
2070
|
console.log("Attempting GET from /configurations: " + o.href);
|
|
@@ -2073,13 +2079,13 @@ async function bt(n, s, r, t) {
|
|
|
2073
2079
|
}
|
|
2074
2080
|
return e;
|
|
2075
2081
|
}
|
|
2076
|
-
async function hs(
|
|
2082
|
+
async function hs(a, s, r, t) {
|
|
2077
2083
|
let e = new m();
|
|
2078
2084
|
if (!r)
|
|
2079
2085
|
return e.result = !1, e.status = 500, e.error = "workspaceConfigsGet: no workspace provided", e;
|
|
2080
|
-
let
|
|
2086
|
+
let n = w.workspaceConfigsEndpoint(), o = new URL(n);
|
|
2081
2087
|
o.searchParams.append("workspaceId", r);
|
|
2082
|
-
let i = { method: "GET", headers: await b(
|
|
2088
|
+
let i = { method: "GET", headers: await b(a, s) };
|
|
2083
2089
|
try {
|
|
2084
2090
|
if (t) debugger;
|
|
2085
2091
|
console.log("Attempting GET from /workspaceConfigs: " + o.href);
|
|
@@ -2104,12 +2110,12 @@ async function hs(n, s, r, t) {
|
|
|
2104
2110
|
}
|
|
2105
2111
|
return e;
|
|
2106
2112
|
}
|
|
2107
|
-
async function It(
|
|
2113
|
+
async function It(a, s, r) {
|
|
2108
2114
|
let t = new m();
|
|
2109
2115
|
if (s.companyName === "" || s.companyDomain === "")
|
|
2110
2116
|
return t.result = !1, t.error = "initPost: invalid company name or domain", t.status = 500, t;
|
|
2111
2117
|
let e = w.initEndpoint();
|
|
2112
|
-
const
|
|
2118
|
+
const n = await b(a, s);
|
|
2113
2119
|
let o = `
|
|
2114
2120
|
{
|
|
2115
2121
|
"tenantCreateModel": {
|
|
@@ -2119,7 +2125,7 @@ async function It(n, s, r) {
|
|
|
2119
2125
|
"type": "aad",
|
|
2120
2126
|
"authority": "${s.authority}"
|
|
2121
2127
|
}
|
|
2122
|
-
}`, d = { method: "POST", headers:
|
|
2128
|
+
}`, d = { method: "POST", headers: n, body: o };
|
|
2123
2129
|
try {
|
|
2124
2130
|
if (r) debugger;
|
|
2125
2131
|
console.log("Attempting POST to /configuration/init: " + e);
|
|
@@ -2130,29 +2136,29 @@ async function It(n, s, r) {
|
|
|
2130
2136
|
}
|
|
2131
2137
|
return t.status = 500, t.result = !1, t;
|
|
2132
2138
|
}
|
|
2133
|
-
async function $t(
|
|
2134
|
-
let
|
|
2139
|
+
async function $t(a, s, r, t, e) {
|
|
2140
|
+
let n = new m();
|
|
2135
2141
|
if (r.tid === "" || t === "")
|
|
2136
|
-
return
|
|
2142
|
+
return n.result = !1, n.error = "tenantDelete: invalid tid, workspaceId", n.status = 500, n;
|
|
2137
2143
|
let o = new URL(w.tenantEndpoint());
|
|
2138
2144
|
o.searchParams.append("tenantId", r.tid), o.searchParams.append("workspaceId", t);
|
|
2139
|
-
let i = { method: "DELETE", headers: await b(
|
|
2145
|
+
let i = { method: "DELETE", headers: await b(a, s) };
|
|
2140
2146
|
try {
|
|
2141
2147
|
console.log("Attempting DELETE from /tenant: " + o.href);
|
|
2142
2148
|
let l = await fetch(o.href, i);
|
|
2143
|
-
return l.status === 200 && l.statusText === "OK" ? (console.log(`Successful DELETE from /tenant: ${o.href}`),
|
|
2149
|
+
return l.status === 200 && l.statusText === "OK" ? (console.log(`Successful DELETE from /tenant: ${o.href}`), n) : (console.log(`Failed DELETE from /tenant: ${o.href}`), n.error = await y(l), console.log(n.error), n.status = 500, n.result = !1, n);
|
|
2144
2150
|
} catch (l) {
|
|
2145
|
-
|
|
2151
|
+
n.error = l.message, n.status = 500, n.result = !1, console.log(n.error);
|
|
2146
2152
|
}
|
|
2147
|
-
return
|
|
2153
|
+
return n;
|
|
2148
2154
|
}
|
|
2149
|
-
async function At(
|
|
2155
|
+
async function At(a, s, r, t) {
|
|
2150
2156
|
let e = new m();
|
|
2151
2157
|
if (r === "")
|
|
2152
2158
|
return e.result = !1, e.status = 500, e.error = "tenantsGet: no workspace provided", e;
|
|
2153
|
-
let
|
|
2159
|
+
let n = w.tenantsEndpoint(), o = new URL(n);
|
|
2154
2160
|
o.searchParams.append("workspaceId", r);
|
|
2155
|
-
let i = { method: "GET", headers: await b(
|
|
2161
|
+
let i = { method: "GET", headers: await b(a, s) };
|
|
2156
2162
|
try {
|
|
2157
2163
|
if (t) debugger;
|
|
2158
2164
|
console.log(`Attempting GET from /tenants: ${o.href}`);
|
|
@@ -2167,13 +2173,13 @@ async function At(n, s, r, t) {
|
|
|
2167
2173
|
}
|
|
2168
2174
|
return e;
|
|
2169
2175
|
}
|
|
2170
|
-
async function kt(
|
|
2176
|
+
async function kt(a, s, r, t) {
|
|
2171
2177
|
let e = new m();
|
|
2172
2178
|
if (r.tid === "" || r.name === "" || r.domain === "")
|
|
2173
2179
|
return e.result = !1, e.error = "tenantPost: invalid tid, name, domain", e.status = 500, e;
|
|
2174
|
-
let
|
|
2180
|
+
let n = w.tenantEndpoint(), o = new URL(n);
|
|
2175
2181
|
o.searchParams.append("workspaceId", t);
|
|
2176
|
-
const d = await b(
|
|
2182
|
+
const d = await b(a, s);
|
|
2177
2183
|
let i = `
|
|
2178
2184
|
{"tenantId": "${r.tid}",
|
|
2179
2185
|
"name": "${r.name}",
|
|
@@ -2190,13 +2196,13 @@ async function kt(n, s, r, t) {
|
|
|
2190
2196
|
}
|
|
2191
2197
|
return e;
|
|
2192
2198
|
}
|
|
2193
|
-
async function Et(
|
|
2199
|
+
async function Et(a, s, r, t) {
|
|
2194
2200
|
let e = new m();
|
|
2195
2201
|
if (r == "" || t == "")
|
|
2196
2202
|
return e.result = !1, e.error = "workspacePut: invalid workspace ID or name", e.status = 500, e;
|
|
2197
|
-
let
|
|
2203
|
+
let n = w.workspaceEndpoint(), o = new URL(n);
|
|
2198
2204
|
o.searchParams.append("workspaceId", r), o.searchParams.append("workspaceName", t);
|
|
2199
|
-
let i = { method: "PUT", headers: await b(
|
|
2205
|
+
let i = { method: "PUT", headers: await b(a, s) };
|
|
2200
2206
|
try {
|
|
2201
2207
|
console.log("Attempting PUT to /workspace: " + o.href);
|
|
2202
2208
|
let l = await fetch(o.href, i);
|
|
@@ -2206,35 +2212,35 @@ async function Et(n, s, r, t) {
|
|
|
2206
2212
|
}
|
|
2207
2213
|
return e;
|
|
2208
2214
|
}
|
|
2209
|
-
async function Dt(
|
|
2215
|
+
async function Dt(a, s, r) {
|
|
2210
2216
|
let t = new m();
|
|
2211
2217
|
if (s.mail == null || s.mail == "")
|
|
2212
2218
|
return t.result = !1, t.status = 500, t.error = "adminsGet: no workspace provided", t;
|
|
2213
|
-
let e = w.workspacesEndpoint(),
|
|
2219
|
+
let e = w.workspacesEndpoint(), n = new URL(e), d = { method: "GET", headers: await b(a, s) };
|
|
2214
2220
|
try {
|
|
2215
2221
|
if (r) debugger;
|
|
2216
|
-
console.log("Attempting GET from /workspaces endpoint: " +
|
|
2217
|
-
let i = await fetch(
|
|
2222
|
+
console.log("Attempting GET from /workspaces endpoint: " + n.href);
|
|
2223
|
+
let i = await fetch(n.href, d);
|
|
2218
2224
|
if (i.status === 200 && i.statusText === "OK") {
|
|
2219
2225
|
let l = await i.json();
|
|
2220
2226
|
return l != null ? (t.array = l, console.log(`Successful GET from /workspaces: ${t.array.reduce((f, I) => f + I.name + " ", "")}`), t) : (t.error = "Failed GET from /workspaces: failed to JSON-parse response", console.log(t.error), t.status = 500, t.result = !1, t);
|
|
2221
2227
|
} else
|
|
2222
|
-
return console.log(`Failed GET from /workspaces: ${
|
|
2228
|
+
return console.log(`Failed GET from /workspaces: ${n.href}`), t.error = await y(i), t.status = 500, t.result = !1, console.log(t.error), t;
|
|
2223
2229
|
} catch (i) {
|
|
2224
2230
|
t.error = i.message, t.status = 500, t.result = !1, console.log(i.message);
|
|
2225
2231
|
}
|
|
2226
2232
|
return t;
|
|
2227
2233
|
}
|
|
2228
|
-
async function
|
|
2234
|
+
async function Pt(a, s, r) {
|
|
2229
2235
|
let t = new m();
|
|
2230
|
-
if (
|
|
2236
|
+
if (a == null || s == null)
|
|
2231
2237
|
return t.result = !1, t.error = "readerPost: invalid parameters", t.status = 500, t;
|
|
2232
|
-
let e = w.readerStartSyncEndpoint(),
|
|
2233
|
-
|
|
2234
|
-
let d = { method: "POST", headers: await b(
|
|
2238
|
+
let e = w.readerStartSyncEndpoint(), n = new URL(e);
|
|
2239
|
+
n.searchParams.append("configurationId", r.id);
|
|
2240
|
+
let d = { method: "POST", headers: await b(a, s) };
|
|
2235
2241
|
try {
|
|
2236
|
-
console.log("Attempting POST to /startSync: " +
|
|
2237
|
-
let i = await fetch(
|
|
2242
|
+
console.log("Attempting POST to /startSync: " + n.href);
|
|
2243
|
+
let i = await fetch(n.href, d);
|
|
2238
2244
|
if (i.status === 200 && i.statusText === "OK") {
|
|
2239
2245
|
console.log(`Successful POST to /startSync: ${e}`);
|
|
2240
2246
|
let l = await i.json();
|
|
@@ -2246,14 +2252,14 @@ async function vt(n, s, r) {
|
|
|
2246
2252
|
}
|
|
2247
2253
|
return t;
|
|
2248
2254
|
}
|
|
2249
|
-
async function gs(
|
|
2255
|
+
async function gs(a, s, r) {
|
|
2250
2256
|
let t = new m();
|
|
2251
|
-
if (
|
|
2257
|
+
if (a == null || s == null)
|
|
2252
2258
|
return t.result = !1, t.error = "readerPost: invalid parameters", t.status = 500, t;
|
|
2253
|
-
let e = w.statsEndpoint(),
|
|
2259
|
+
let e = w.statsEndpoint(), n = new URL(`${e}/${r}`), d = { method: "GET", headers: await b(a, s) };
|
|
2254
2260
|
try {
|
|
2255
|
-
console.log("Attempting GET to /stats: " +
|
|
2256
|
-
let i = await fetch(
|
|
2261
|
+
console.log("Attempting GET to /stats: " + n.href);
|
|
2262
|
+
let i = await fetch(n.href, d);
|
|
2257
2263
|
if (i.status === 200 && i.statusText === "OK") {
|
|
2258
2264
|
console.log(`Successful GET to /stats: ${e}`);
|
|
2259
2265
|
let l = await i.json();
|
|
@@ -2276,7 +2282,7 @@ export {
|
|
|
2276
2282
|
He as MilestoneArray,
|
|
2277
2283
|
ke as ResourceArray,
|
|
2278
2284
|
qe as ResourceNode,
|
|
2279
|
-
|
|
2285
|
+
ne as SyncConfig,
|
|
2280
2286
|
se as Task,
|
|
2281
2287
|
Ft as TaskArray,
|
|
2282
2288
|
H as Tenant,
|
|
@@ -2287,7 +2293,7 @@ export {
|
|
|
2287
2293
|
Be as TenantType,
|
|
2288
2294
|
re as User,
|
|
2289
2295
|
Ot as UserScope,
|
|
2290
|
-
|
|
2296
|
+
ae as Workspace,
|
|
2291
2297
|
ot as adminDelete,
|
|
2292
2298
|
lt as adminPost,
|
|
2293
2299
|
it as adminsGet,
|
|
@@ -2314,7 +2320,7 @@ export {
|
|
|
2314
2320
|
wt as configPatch,
|
|
2315
2321
|
Tt as configPost,
|
|
2316
2322
|
St as configPut,
|
|
2317
|
-
|
|
2323
|
+
ns as configRemove,
|
|
2318
2324
|
bt as configsGet,
|
|
2319
2325
|
rs as configsRefresh,
|
|
2320
2326
|
ps as elevateGlobalAdminToUserAccessAdmin,
|
|
@@ -2323,13 +2329,13 @@ export {
|
|
|
2323
2329
|
p as graphConfig,
|
|
2324
2330
|
_t as groupsGet,
|
|
2325
2331
|
xt as helloNpm,
|
|
2326
|
-
|
|
2332
|
+
as as initGet,
|
|
2327
2333
|
It as initPost,
|
|
2328
2334
|
w as mindlineConfig,
|
|
2329
2335
|
Ve as oauth2PermissionGrantsGet,
|
|
2330
2336
|
Ze as oauth2PermissionGrantsSet,
|
|
2331
2337
|
y as processErrors,
|
|
2332
|
-
|
|
2338
|
+
Pt as readerPost,
|
|
2333
2339
|
gs as readerStats,
|
|
2334
2340
|
Lt as requestAdminConsent,
|
|
2335
2341
|
Qe as servicePrincipalGet,
|