@mindline/sync 1.0.99 → 1.0.100
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/.vs/VSWorkspaceState.json +1 -2
- package/.vs/slnx.sqlite +0 -0
- package/.vs/sync/CopilotIndices/17.14.260.54502/CodeChunks.db +0 -0
- package/.vs/sync/CopilotIndices/17.14.260.54502/SemanticSymbols.db +0 -0
- package/.vs/sync/FileContentIndex/329bf12b-91d2-45df-a54a-8517aa352455.vsidx +0 -0
- package/.vs/sync/FileContentIndex/3e5ba5f3-8912-41a5-b84c-70b0058c1769.vsidx +0 -0
- package/.vs/sync/FileContentIndex/b4b73e68-525d-401c-95be-e93f3675ea76.vsidx +0 -0
- package/.vs/sync/FileContentIndex/d40775c5-40b9-4274-bf7c-d627a3d5e7c8.vsidx +0 -0
- package/.vs/sync/v17/.wsuo +0 -0
- package/.vs/sync/v17/DocumentLayout.backup.json +20 -71
- package/.vs/sync/v17/DocumentLayout.json +28 -59
- package/dist/src/index.d.ts +4 -1
- package/dist/sync.es.js +788 -756
- package/dist/sync.es.js.map +1 -1
- package/dist/sync.umd.js +23 -23
- package/dist/sync.umd.js.map +1 -1
- package/package.json +2 -1
- package/src/index.d.ts +5 -3
- package/src/index.ts +64 -7
- package/.vs/sync/FileContentIndex/3f844564-c214-4f94-a0ae-1560b50e152c.vsidx +0 -0
- package/.vs/sync/FileContentIndex/45c8c5a2-a7a0-4025-b787-3053b90d28fc.vsidx +0 -0
- package/.vs/sync/FileContentIndex/ca40703e-4694-45d5-9233-86b471772c65.vsidx +0 -0
- package/.vs/sync/FileContentIndex/e1515f5f-1990-4d24-a71a-49811665cbe1.vsidx +0 -0
- /package/.vs/sync/FileContentIndex/{b9c9b1f1-a6bb-4dbc-8e91-4e9ecf1382d5.vsidx → 1075558f-bf92-43ad-a8c4-360c99ce1e38.vsidx} +0 -0
package/dist/sync.es.js
CHANGED
|
@@ -2,10 +2,10 @@ var Ae = Object.defineProperty;
|
|
|
2
2
|
var ge = (a) => {
|
|
3
3
|
throw TypeError(a);
|
|
4
4
|
};
|
|
5
|
-
var $e = (a,
|
|
6
|
-
var l = (a,
|
|
7
|
-
var j = (a,
|
|
8
|
-
var
|
|
5
|
+
var $e = (a, e, r) => e in a ? Ae(a, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : a[e] = r;
|
|
6
|
+
var l = (a, e, r) => $e(a, typeof e != "symbol" ? e + "" : e, r), ke = (a, e, r) => e.has(a) || ge("Cannot " + r);
|
|
7
|
+
var j = (a, e, r) => e.has(a) ? ge("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(a) : e.set(a, r);
|
|
8
|
+
var G = (a, e, r) => (ke(a, e, "access private method"), r);
|
|
9
9
|
import * as H from "@microsoft/signalr";
|
|
10
10
|
import { deserializeArray as W } from "class-transformer";
|
|
11
11
|
const De = [
|
|
@@ -20,7 +20,7 @@ const De = [
|
|
|
20
20
|
session: "Sign In",
|
|
21
21
|
sel: !0
|
|
22
22
|
}
|
|
23
|
-
],
|
|
23
|
+
], ve = [
|
|
24
24
|
{
|
|
25
25
|
tid: "1",
|
|
26
26
|
name: "",
|
|
@@ -30,7 +30,7 @@ const De = [
|
|
|
30
30
|
sel: !0,
|
|
31
31
|
graphSP: ""
|
|
32
32
|
}
|
|
33
|
-
],
|
|
33
|
+
], Re = [], Pe = [
|
|
34
34
|
{
|
|
35
35
|
id: "1",
|
|
36
36
|
name: "",
|
|
@@ -43,7 +43,7 @@ const De = [
|
|
|
43
43
|
associatedConfigs: [],
|
|
44
44
|
sel: !0
|
|
45
45
|
}
|
|
46
|
-
],
|
|
46
|
+
], Ee = [
|
|
47
47
|
{
|
|
48
48
|
Run: "3",
|
|
49
49
|
Start: "2023-09-17T12:00:00.000-07:00",
|
|
@@ -65,7 +65,7 @@ const De = [
|
|
|
65
65
|
Read: "2023-09-17T12:00:15.500-07:00",
|
|
66
66
|
Write: "2023-09-17T12:01:30.000-07:00"
|
|
67
67
|
}
|
|
68
|
-
],
|
|
68
|
+
], Ge = [
|
|
69
69
|
{
|
|
70
70
|
type: "mg",
|
|
71
71
|
resource: "Tenant Root Group",
|
|
@@ -140,14 +140,14 @@ const De = [
|
|
|
140
140
|
resources: []
|
|
141
141
|
}
|
|
142
142
|
], O = "workspaceIDs";
|
|
143
|
-
function
|
|
144
|
-
return a +
|
|
143
|
+
function Tt(a, e) {
|
|
144
|
+
return a + e;
|
|
145
145
|
}
|
|
146
|
-
function
|
|
146
|
+
function St() {
|
|
147
147
|
return "hello NPM";
|
|
148
148
|
}
|
|
149
149
|
function F() {
|
|
150
|
-
return "1.0.
|
|
150
|
+
return "1.0.100";
|
|
151
151
|
}
|
|
152
152
|
class y {
|
|
153
153
|
constructor() {
|
|
@@ -163,67 +163,70 @@ class U {
|
|
|
163
163
|
}
|
|
164
164
|
// azure graph REST API endpoints
|
|
165
165
|
l(U, "azureElevateAccess", "https://management.azure.com/providers/Microsoft.Authorization/elevateAccess?api-version=2016-07-01"), l(U, "azureListRootAssignments", "https://management.azure.com/providers/Microsoft.Authorization/roleAssignments?api-version=2022-04-01&$filter=principalId+eq+");
|
|
166
|
-
const
|
|
166
|
+
const A = class A {
|
|
167
167
|
// config API endpoints
|
|
168
168
|
static adminEndpoint() {
|
|
169
|
-
return `https://${
|
|
169
|
+
return `https://${A.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/admin`;
|
|
170
170
|
}
|
|
171
171
|
static adminIncompleteEndpoint() {
|
|
172
|
-
return `https://${
|
|
172
|
+
return `https://${A.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/incomplete-admin`;
|
|
173
173
|
}
|
|
174
174
|
static adminsEndpoint() {
|
|
175
|
-
return `https://${
|
|
175
|
+
return `https://${A.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/admins`;
|
|
176
|
+
}
|
|
177
|
+
static auditEventsEndpoint() {
|
|
178
|
+
return `https://${A.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/audit-events`;
|
|
176
179
|
}
|
|
177
180
|
static configConsentEndpoint() {
|
|
178
|
-
return `https://${
|
|
181
|
+
return `https://${A.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/configuration/consent`;
|
|
179
182
|
}
|
|
180
183
|
static configEnabledEndpoint() {
|
|
181
|
-
return `https://${
|
|
184
|
+
return `https://${A.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/configuration/status`;
|
|
182
185
|
}
|
|
183
186
|
static configEndpoint() {
|
|
184
|
-
return `https://${
|
|
187
|
+
return `https://${A.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/configuration`;
|
|
185
188
|
}
|
|
186
189
|
static configsEndpoint() {
|
|
187
|
-
return `https://${
|
|
190
|
+
return `https://${A.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/configurations`;
|
|
188
191
|
}
|
|
189
192
|
static initEndpoint() {
|
|
190
|
-
return `https://${
|
|
193
|
+
return `https://${A.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/configuration/init`;
|
|
191
194
|
}
|
|
192
195
|
static readerStartSyncEndpoint() {
|
|
193
|
-
return `https://${
|
|
196
|
+
return `https://${A.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/startSync`;
|
|
194
197
|
}
|
|
195
198
|
static tenantEndpoint() {
|
|
196
|
-
return `https://${
|
|
199
|
+
return `https://${A.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/tenant`;
|
|
197
200
|
}
|
|
198
201
|
static tenantsEndpoint() {
|
|
199
|
-
return `https://${
|
|
202
|
+
return `https://${A.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/tenants`;
|
|
200
203
|
}
|
|
201
204
|
static workspaceEndpoint() {
|
|
202
|
-
return `https://${
|
|
205
|
+
return `https://${A.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/workspace`;
|
|
203
206
|
}
|
|
204
207
|
static workspacesEndpoint() {
|
|
205
|
-
return `https://${
|
|
208
|
+
return `https://${A.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/workspaces`;
|
|
206
209
|
}
|
|
207
210
|
// SignalR endpoint
|
|
208
211
|
static signalREndpoint() {
|
|
209
|
-
return `https://${
|
|
212
|
+
return `https://${A.environmentTag}-signalrdispatcher-westus.azurewebsites.net/statsHub`;
|
|
210
213
|
}
|
|
211
214
|
};
|
|
212
|
-
l(
|
|
213
|
-
let T =
|
|
215
|
+
l(A, "environmentTag", "dev");
|
|
216
|
+
let T = A;
|
|
214
217
|
class p {
|
|
215
218
|
}
|
|
216
219
|
// graph API predicates
|
|
217
220
|
l(p, "graphGroupsPredicate", "v1.0/groups"), l(p, "graphMailPredicate", "v1.0/me/messages"), l(p, "graphMePredicate", "v1.0/me"), l(p, "graphOauth2PermissionGrantsPredicate", "v1.0/oauth2PermissionGrants"), l(p, "graphServicePrincipalsPredicate", "v1.0/servicePrincipals"), l(p, "graphUsersPredicate", "v1.0/users"), l(p, "graphTenantByDomainPredicate", "beta/tenantRelationships/findTenantInformationByDomainName"), l(p, "graphTenantByIdPredicate", "beta/tenantRelationships/findTenantInformationByTenantId"), // authority values are based on the well-known OIDC auth endpoints
|
|
218
221
|
l(p, "authorityWW", "https://login.microsoftonline.com/"), l(p, "authorityWWRegex", /^(https:\/\/login\.microsoftonline\.com\/)([\dA-Fa-f]{8}-[\dA-Fa-f]{4}-[\dA-Fa-f]{4}-[\dA-Fa-f]{4}-[\dA-Fa-f]{12})\/oauth2\/authorize$/), l(p, "authorityUS", "https://login.microsoftonline.us/"), l(p, "authorityUSRegex", /^(https:\/\/login\.microsoftonline\.us\/)([\dA-Fa-f]{8}-[\dA-Fa-f]{4}-[\dA-Fa-f]{4}-[\dA-Fa-f]{4}-[\dA-Fa-f]{12})\/oauth2\/authorize$/), l(p, "authorityCN", "https://login.partner.microsoftonline.cn/"), l(p, "authorityCNRegex", /^(https:\/\/login\.partner\.microsoftonline\.cn\/)([\dA-Fa-f]{8}-[\dA-Fa-f]{4}-[\dA-Fa-f]{4}-[\dA-Fa-f]{4}-[\dA-Fa-f]{12})\/oauth2\/authorize$/);
|
|
219
|
-
class
|
|
222
|
+
class bt {
|
|
220
223
|
constructor() {
|
|
221
224
|
l(this, "id", "");
|
|
222
225
|
l(this, "displayName", "");
|
|
223
226
|
l(this, "description", "");
|
|
224
227
|
}
|
|
225
228
|
}
|
|
226
|
-
class
|
|
229
|
+
class It {
|
|
227
230
|
constructor() {
|
|
228
231
|
l(this, "group", "");
|
|
229
232
|
l(this, "value", "");
|
|
@@ -231,11 +234,11 @@ class bt {
|
|
|
231
234
|
l(this, "removable", !1);
|
|
232
235
|
l(this, "expanded", "");
|
|
233
236
|
}
|
|
234
|
-
static compareByValue(
|
|
235
|
-
return
|
|
237
|
+
static compareByValue(e, r) {
|
|
238
|
+
return e.value.localeCompare(r.value);
|
|
236
239
|
}
|
|
237
|
-
static compareByGroup(
|
|
238
|
-
return
|
|
240
|
+
static compareByGroup(e, r) {
|
|
241
|
+
return e.group.localeCompare(r.group);
|
|
239
242
|
}
|
|
240
243
|
}
|
|
241
244
|
class X {
|
|
@@ -289,14 +292,14 @@ class L {
|
|
|
289
292
|
this.tid = "", this.name = "", this.domain = "", this.tenantType = "aad", this.authority = "", this.workspaceIDs = "", this.sel = !1, this.graphSP = "", this.lookupfield = "Domain";
|
|
290
293
|
}
|
|
291
294
|
}
|
|
292
|
-
function Oe(a,
|
|
295
|
+
function Oe(a, e) {
|
|
293
296
|
switch (a) {
|
|
294
297
|
case p.authorityWW:
|
|
295
|
-
return
|
|
298
|
+
return e === 1 ? "85d35da2-4118-4b03-aa05-605cedd7f2f8" : "63100afe-506e-4bb2-8ff7-d8d5ab373129";
|
|
296
299
|
case p.authorityUS:
|
|
297
|
-
return
|
|
300
|
+
return e === 1 ? "b08630c7-e227-4215-9746-afc9286fb864" : "17aa5d5a-f09f-4cec-87a6-28596f9fa513";
|
|
298
301
|
case p.authorityCN:
|
|
299
|
-
return
|
|
302
|
+
return e === 1 ? "7db7293b-add9-4a3f-8562-1a20bfe27d5e" : "debd015b-1154-4111-a4cb-fc220a537697";
|
|
300
303
|
default:
|
|
301
304
|
debugger;
|
|
302
305
|
return "";
|
|
@@ -377,21 +380,21 @@ function x() {
|
|
|
377
380
|
let a;
|
|
378
381
|
try {
|
|
379
382
|
a = window.localStorage;
|
|
380
|
-
const
|
|
381
|
-
return a.setItem(
|
|
382
|
-
} catch (
|
|
383
|
-
return
|
|
384
|
-
(
|
|
385
|
-
|
|
383
|
+
const e = "__storage_test__";
|
|
384
|
+
return a.setItem(e, e), a.removeItem(e), !0;
|
|
385
|
+
} catch (e) {
|
|
386
|
+
return e instanceof DOMException && // everything except Firefox
|
|
387
|
+
(e.code === 22 || // Firefox
|
|
388
|
+
e.code === 1014 || // test name field too, because code might not be present
|
|
386
389
|
// everything except Firefox
|
|
387
|
-
|
|
388
|
-
|
|
390
|
+
e.name === "QuotaExceededError" || // Firefox
|
|
391
|
+
e.name === "NS_ERROR_DOM_QUOTA_REACHED") && // acknowledge QuotaExceededError only if there's something already stored
|
|
389
392
|
a && a.length !== 0;
|
|
390
393
|
}
|
|
391
394
|
}
|
|
392
395
|
var q, ye;
|
|
393
|
-
class
|
|
394
|
-
constructor(
|
|
396
|
+
class At {
|
|
397
|
+
constructor(e = !1) {
|
|
395
398
|
j(this, q);
|
|
396
399
|
l(this, "version", F());
|
|
397
400
|
l(this, "tab", 0);
|
|
@@ -401,56 +404,56 @@ class It {
|
|
|
401
404
|
l(this, "ws", []);
|
|
402
405
|
l(this, "configlevelconsent_configid", "");
|
|
403
406
|
l(this, "configlevelconsent_access", 3);
|
|
404
|
-
this.init(
|
|
407
|
+
this.init(e);
|
|
405
408
|
}
|
|
406
409
|
// get initial data from localStorage or file
|
|
407
|
-
init(
|
|
408
|
-
if (console.log(`Calling InitInfo::init(bClearLocalStorage: ${
|
|
410
|
+
init(e) {
|
|
411
|
+
if (console.log(`Calling InitInfo::init(bClearLocalStorage: ${e ? "true" : "false"})`), x()) {
|
|
409
412
|
let o = localStorage.getItem("InitInfo");
|
|
410
413
|
if (o != null && typeof o == "string" && o !== "") {
|
|
411
414
|
let i = JSON.parse(o);
|
|
412
415
|
if (i.us.length !== 0)
|
|
413
|
-
if (
|
|
416
|
+
if (e)
|
|
414
417
|
localStorage.removeItem("InitInfo");
|
|
415
418
|
else {
|
|
416
|
-
|
|
419
|
+
G(this, q, ye).call(this, i);
|
|
417
420
|
return;
|
|
418
421
|
}
|
|
419
422
|
}
|
|
420
423
|
}
|
|
421
424
|
this.tab = 0, this.version = F(), this.configlevelconsent_configid = "", this.configlevelconsent_access = 3;
|
|
422
|
-
var
|
|
425
|
+
var r = JSON.stringify(De), s = JSON.stringify(ve), t = JSON.stringify(Re), n = JSON.stringify(Pe);
|
|
423
426
|
try {
|
|
424
|
-
this.us = W(X,
|
|
427
|
+
this.us = W(X, r), this.ts = W(L, s), this.cs = W(Y, t), this.ws = W(ee, n), this.tagWithWorkspaces();
|
|
425
428
|
} catch {
|
|
426
429
|
debugger;
|
|
427
430
|
}
|
|
428
431
|
}
|
|
429
432
|
save() {
|
|
430
|
-
let
|
|
431
|
-
localStorage.setItem("InitInfo",
|
|
433
|
+
let e = JSON.stringify(this);
|
|
434
|
+
localStorage.setItem("InitInfo", e);
|
|
432
435
|
}
|
|
433
436
|
tagWithWorkspaces() {
|
|
434
|
-
this.us.map((
|
|
435
|
-
for (let
|
|
436
|
-
for (let
|
|
437
|
-
let
|
|
438
|
-
if (
|
|
439
|
-
|
|
437
|
+
this.us.map((e) => e.workspaceIDs = ""), this.ts.map((e) => e.workspaceIDs = ""), this.cs.map((e) => e.workspaceIDs = "");
|
|
438
|
+
for (let e of this.ws) {
|
|
439
|
+
for (let r of e.associatedUsers) {
|
|
440
|
+
let s = this.us.find((t) => t.oid === r);
|
|
441
|
+
if (s !== void 0)
|
|
442
|
+
s[O] += e.id, s[O] += " ";
|
|
440
443
|
else
|
|
441
444
|
debugger;
|
|
442
445
|
}
|
|
443
|
-
for (let
|
|
444
|
-
let
|
|
445
|
-
if (
|
|
446
|
-
|
|
446
|
+
for (let r of e.associatedTenants) {
|
|
447
|
+
let s = this.ts.find((t) => t.tid === r);
|
|
448
|
+
if (s !== void 0)
|
|
449
|
+
s[O] += e.id, s[O] += " ";
|
|
447
450
|
else
|
|
448
451
|
debugger;
|
|
449
452
|
}
|
|
450
|
-
for (let
|
|
451
|
-
let
|
|
452
|
-
if (
|
|
453
|
-
|
|
453
|
+
for (let r of e.associatedConfigs) {
|
|
454
|
+
let s = this.cs.find((t) => t.id === r);
|
|
455
|
+
if (s !== void 0)
|
|
456
|
+
s[O] += e.id, s[O] += " ";
|
|
454
457
|
else
|
|
455
458
|
debugger;
|
|
456
459
|
}
|
|
@@ -458,19 +461,19 @@ class It {
|
|
|
458
461
|
return !0;
|
|
459
462
|
}
|
|
460
463
|
}
|
|
461
|
-
q = new WeakSet(), ye = function(
|
|
462
|
-
this.tab =
|
|
463
|
-
let
|
|
464
|
-
return
|
|
465
|
-
}), typeof
|
|
466
|
-
let
|
|
467
|
-
return
|
|
468
|
-
}), typeof
|
|
469
|
-
let
|
|
470
|
-
return
|
|
471
|
-
}), typeof
|
|
472
|
-
let
|
|
473
|
-
return
|
|
464
|
+
q = new WeakSet(), ye = function(e) {
|
|
465
|
+
this.tab = e.tab, this.version = F(), this.configlevelconsent_configid = e.configlevelconsent_configid, this.configlevelconsent_access = e.configlevelconsent_access, typeof e.us > "u" ? this.us = new Array() : this.us = e.us.map((r) => {
|
|
466
|
+
let s = new X();
|
|
467
|
+
return s.oid = r.oid, s.name = r.name, s.mail = r.mail, s.authority = r.authority, s.tid = r.tid, s.companyName = r.companyName, s.companyDomain = r.companyDomain, s.workspaceIDs = r.workspaceIDs, s.session = r.session, s.spacode = r.spacode, s.graphAccessToken = r.graphAccessToken, s.mindlineAccessToken = r.mindlineAccessToken, s.azureAccessToken = r.azureAccessToken, s.loginHint = r.loginHint, s.scopes = r.scopes, s.authTS = new Date(r.authTS), s.sel = r.sel, s.loggingIn = r.loggingIn, s;
|
|
468
|
+
}), typeof e.ts > "u" ? this.ts = new Array() : this.ts = e.ts.map((r) => {
|
|
469
|
+
let s = new L();
|
|
470
|
+
return s.tid = r.tid, s.name = r.name, s.domain = r.domain, s.tenantType = r.tenantType, s.authority = r.authority, s.workspaceIDs = r.workspaceIDs, s.sel = r.sel, s.lookupfield = r.lookupfield, s;
|
|
471
|
+
}), typeof e.cs > "u" ? this.cs = new Array() : this.cs = e.cs.map((r) => {
|
|
472
|
+
let s = new Y();
|
|
473
|
+
return s.id = r.id, s.workspaceId = r.workspaceId, s.name = r.name, s.description = r.description, s.tenants = r.tenants, s.isEnabled = r.isEnabled, s.workspaceIDs = r.workspaceIDs, s.sel = r.sel, s;
|
|
474
|
+
}), typeof e.ws > "u" ? this.ws = new Array() : this.ws = e.ws.map((r) => {
|
|
475
|
+
let s = new ee();
|
|
476
|
+
return s.id = r.id, s.name = r.name, s.ownerid = r.ownerid, s.associatedUsers = r.associatedUsers, s.associatedTenants = r.associatedTenants, s.associatedConfigs = r.associatedConfigs, s.sel = r.sel, s;
|
|
474
477
|
});
|
|
475
478
|
};
|
|
476
479
|
const Be = [
|
|
@@ -526,63 +529,63 @@ const Be = [
|
|
|
526
529
|
]
|
|
527
530
|
}
|
|
528
531
|
];
|
|
529
|
-
var
|
|
530
|
-
class
|
|
531
|
-
constructor(
|
|
532
|
-
j(this,
|
|
532
|
+
var P, te, se, re;
|
|
533
|
+
class $t {
|
|
534
|
+
constructor(e) {
|
|
535
|
+
j(this, P);
|
|
533
536
|
l(this, "tasks");
|
|
534
|
-
this.tasks = [new Q()], this.init(
|
|
537
|
+
this.tasks = [new Q()], this.init(e);
|
|
535
538
|
}
|
|
536
539
|
// get initial data from localStorage or file
|
|
537
|
-
init(
|
|
538
|
-
if (console.log(`Calling TaskArray::init(bClearLocalStorage: ${
|
|
539
|
-
let
|
|
540
|
-
if (
|
|
541
|
-
let
|
|
542
|
-
if (this.tasks =
|
|
540
|
+
init(e) {
|
|
541
|
+
if (console.log(`Calling TaskArray::init(bClearLocalStorage: ${e ? "true" : "false"})`), this.tasks.length = 0, e && x() && localStorage.removeItem("Tasks"), x()) {
|
|
542
|
+
let r = localStorage.getItem("Tasks");
|
|
543
|
+
if (r != null && typeof r == "string" && r !== "") {
|
|
544
|
+
let t = JSON.parse(r);
|
|
545
|
+
if (this.tasks = G(this, P, se).call(this, t.tasks), this.tasks.length !== 0) return;
|
|
543
546
|
}
|
|
544
547
|
}
|
|
545
|
-
this.tasks =
|
|
548
|
+
this.tasks = G(this, P, se).call(this, Be);
|
|
546
549
|
}
|
|
547
550
|
// set start time for a task
|
|
548
|
-
setTaskStart(
|
|
549
|
-
let
|
|
550
|
-
if (
|
|
551
|
-
|
|
551
|
+
setTaskStart(e, r) {
|
|
552
|
+
let s = G(this, P, te).call(this, e);
|
|
553
|
+
if (s != null && s != null)
|
|
554
|
+
s.setStart(r), s.status = "in progress", G(this, P, re).call(this);
|
|
552
555
|
else
|
|
553
556
|
debugger;
|
|
554
557
|
}
|
|
555
558
|
// set end time for a task
|
|
556
|
-
setTaskEnd(
|
|
557
|
-
let
|
|
558
|
-
if (
|
|
559
|
-
|
|
559
|
+
setTaskEnd(e, r, s) {
|
|
560
|
+
let t = G(this, P, te).call(this, e);
|
|
561
|
+
if (t != null && t != null)
|
|
562
|
+
t.setEnd(r), t.status = s, G(this, P, re).call(this);
|
|
560
563
|
else
|
|
561
564
|
debugger;
|
|
562
565
|
}
|
|
563
566
|
}
|
|
564
|
-
|
|
567
|
+
P = new WeakSet(), //
|
|
565
568
|
// private
|
|
566
569
|
//
|
|
567
|
-
te = function(
|
|
568
|
-
let
|
|
569
|
-
if (
|
|
570
|
-
for (
|
|
571
|
-
if (
|
|
570
|
+
te = function(e) {
|
|
571
|
+
let r = this.tasks.find((s) => s.task == e);
|
|
572
|
+
if (r == null || r == null) {
|
|
573
|
+
for (r of this.tasks)
|
|
574
|
+
if (r.subtasks != null && r.subtasks != null && (r = r.subtasks.find((s) => s.task == e), r != null && r != null))
|
|
572
575
|
break;
|
|
573
576
|
}
|
|
574
|
-
return
|
|
575
|
-
}, se = function(
|
|
576
|
-
return
|
|
577
|
-
let
|
|
578
|
-
return
|
|
577
|
+
return r;
|
|
578
|
+
}, se = function(e) {
|
|
579
|
+
return e.map((r) => {
|
|
580
|
+
let s = new Q();
|
|
581
|
+
return s.id = r.id, s.task = r.task, s.setStart(new Date(r.start)), s.setEnd(new Date(r.end)), s.expected = r.expected, s.status = r.status, s.expanded = r.expanded, typeof r.subtasks < "u" && r.subtasks != null && (s.subtasks = r.subtasks.map((t) => {
|
|
579
582
|
let n = new Q();
|
|
580
|
-
return n.id =
|
|
581
|
-
})),
|
|
583
|
+
return n.id = t.id, n.task = t.task, n.setStart(new Date(t.start)), n.setEnd(new Date(t.end)), n.expected = t.expected, n.status = t.status, n.expanded = t.expanded, n;
|
|
584
|
+
})), s;
|
|
582
585
|
});
|
|
583
586
|
}, re = function() {
|
|
584
|
-
let
|
|
585
|
-
x() && localStorage.setItem("Tasks",
|
|
587
|
+
let e = JSON.stringify(this);
|
|
588
|
+
x() && localStorage.setItem("Tasks", e);
|
|
586
589
|
};
|
|
587
590
|
class Q {
|
|
588
591
|
constructor() {
|
|
@@ -598,19 +601,19 @@ class Q {
|
|
|
598
601
|
l(this, "expanded", !1);
|
|
599
602
|
l(this, "subtasks", []);
|
|
600
603
|
}
|
|
601
|
-
setEnd(
|
|
602
|
-
this.end =
|
|
603
|
-
let
|
|
604
|
-
|
|
605
|
-
let
|
|
606
|
-
|
|
604
|
+
setEnd(e) {
|
|
605
|
+
this.end = e, this.endDisplay = `${this.end.getMinutes().toString().padStart(2, "0")}:${this.end.getSeconds().toString().padStart(2, "0")}`;
|
|
606
|
+
let r = 0, s = this.end.getSeconds() - this.start.getSeconds();
|
|
607
|
+
s < 0 && (s += 60, r = -1);
|
|
608
|
+
let t = this.end.getMinutes() - this.start.getMinutes() + r;
|
|
609
|
+
t < 0 && (t += 60), this.elapsedDisplay = `${t.toString().padStart(2, "0")}:${s.toString().padStart(2, "0")}`;
|
|
607
610
|
}
|
|
608
|
-
setStart(
|
|
609
|
-
this.start =
|
|
611
|
+
setStart(e) {
|
|
612
|
+
this.start = e, this.startDisplay = `${this.start.getMinutes().toString().padStart(2, "0")}:${this.start.getSeconds().toString().padStart(2, "0")}`;
|
|
610
613
|
}
|
|
611
614
|
}
|
|
612
615
|
class B {
|
|
613
|
-
constructor(
|
|
616
|
+
constructor(e) {
|
|
614
617
|
l(this, "Run", 0);
|
|
615
618
|
l(this, "Start", /* @__PURE__ */ new Date());
|
|
616
619
|
l(this, "startDisplay", "");
|
|
@@ -622,108 +625,108 @@ class B {
|
|
|
622
625
|
l(this, "writeDisplay");
|
|
623
626
|
l(this, "Duration");
|
|
624
627
|
l(this, "durationDisplay");
|
|
625
|
-
this.Run =
|
|
628
|
+
this.Run = e, this.start(""), this.POST = /* @__PURE__ */ new Date(), this.postDisplay = "", this.Read = /* @__PURE__ */ new Date(), this.readDisplay = "", this.Write = /* @__PURE__ */ new Date(), this.writeDisplay = "", this.Duration = /* @__PURE__ */ new Date(), this.durationDisplay = "";
|
|
626
629
|
}
|
|
627
|
-
start(
|
|
628
|
-
|
|
630
|
+
start(e) {
|
|
631
|
+
e == "" ? this.Start = /* @__PURE__ */ new Date() : this.Start = new Date(e), this.startDisplay = `${this.Start.getMinutes().toString().padStart(2, "0")}:${this.Start.getSeconds().toString().padStart(2, "0")}`;
|
|
629
632
|
}
|
|
630
|
-
post(
|
|
631
|
-
|
|
633
|
+
post(e) {
|
|
634
|
+
e == "" ? this.POST = /* @__PURE__ */ new Date() : this.POST = new Date(e), this.postDisplay = `${this.POST.getMinutes().toString().padStart(2, "0")}:${this.POST.getSeconds().toString().padStart(2, "0")}`;
|
|
632
635
|
}
|
|
633
|
-
read(
|
|
634
|
-
|
|
636
|
+
read(e) {
|
|
637
|
+
e == "" ? this.Read = /* @__PURE__ */ new Date() : this.Read = new Date(e), this.readDisplay = `${this.Read.getMinutes().toString().padStart(2, "0")}:${this.Read.getSeconds().toString().padStart(2, "0")}`;
|
|
635
638
|
}
|
|
636
|
-
write(
|
|
637
|
-
|
|
639
|
+
write(e) {
|
|
640
|
+
e == "" ? this.Write = /* @__PURE__ */ new Date() : this.Write = new Date(e), this.writeDisplay = `${this.Write.getMinutes().toString().padStart(2, "0")}:${this.Write.getSeconds().toString().padStart(2, "0")}`, this.Duration = new Date(this.Write.getTime() - this.Start.getTime()), this.durationDisplay = `${this.Duration.getMinutes().toString().padStart(2, "0")}:${this.Duration.getSeconds().toString().padStart(2, "0")}`;
|
|
638
641
|
}
|
|
639
642
|
}
|
|
640
643
|
var z, ne;
|
|
641
644
|
class Ue {
|
|
642
|
-
constructor(
|
|
645
|
+
constructor(e) {
|
|
643
646
|
j(this, z);
|
|
644
647
|
l(this, "milestones", []);
|
|
645
|
-
this.init(
|
|
648
|
+
this.init(e);
|
|
646
649
|
}
|
|
647
|
-
init(
|
|
650
|
+
init(e) {
|
|
648
651
|
if (x()) {
|
|
649
|
-
let
|
|
650
|
-
if (
|
|
651
|
-
let
|
|
652
|
-
if (
|
|
653
|
-
if (
|
|
652
|
+
let r = localStorage.getItem("syncmilestones");
|
|
653
|
+
if (r != null && typeof r == "string" && r !== "") {
|
|
654
|
+
let t = JSON.parse(r);
|
|
655
|
+
if (t.length !== 0)
|
|
656
|
+
if (e)
|
|
654
657
|
localStorage.removeItem("syncmilestones");
|
|
655
658
|
else {
|
|
656
|
-
|
|
659
|
+
G(this, z, ne).call(this, t);
|
|
657
660
|
return;
|
|
658
661
|
}
|
|
659
662
|
}
|
|
660
663
|
}
|
|
661
|
-
|
|
664
|
+
G(this, z, ne).call(this, Ee);
|
|
662
665
|
}
|
|
663
666
|
save() {
|
|
664
|
-
let
|
|
665
|
-
x() && localStorage.setItem("syncmilestones",
|
|
667
|
+
let e = JSON.stringify(this.milestones);
|
|
668
|
+
x() && localStorage.setItem("syncmilestones", e);
|
|
666
669
|
}
|
|
667
670
|
// milestone tracking during a sync
|
|
668
|
-
start(
|
|
671
|
+
start(e) {
|
|
669
672
|
if (this.milestones == null || this.milestones.length < 1) {
|
|
670
673
|
debugger;
|
|
671
674
|
return;
|
|
672
675
|
}
|
|
673
|
-
let
|
|
674
|
-
this.milestones.unshift(
|
|
675
|
-
let n = new B(
|
|
676
|
-
return n.Start =
|
|
677
|
-
}),
|
|
676
|
+
let r = Number(this.milestones[0].Run), s = new B(r + 1);
|
|
677
|
+
this.milestones.unshift(s), this.milestones = this.milestones.map((t) => {
|
|
678
|
+
let n = new B(t.Run);
|
|
679
|
+
return n.Start = t.Start, n.startDisplay = t.startDisplay, n.POST = t.POST, n.postDisplay = t.postDisplay, n.Read = t.Read, n.readDisplay = t.readDisplay, n.Write = t.Write, n.writeDisplay = t.writeDisplay, n.Duration = t.Duration, n.durationDisplay = t.durationDisplay, n;
|
|
680
|
+
}), e(this.milestones), console.log(`Start milestone: ${this.milestones[0].Run}:${this.milestones[0].Start}`);
|
|
678
681
|
}
|
|
679
|
-
unstart(
|
|
682
|
+
unstart(e) {
|
|
680
683
|
if (this.milestones == null || this.milestones.length < 1) {
|
|
681
684
|
debugger;
|
|
682
685
|
return;
|
|
683
686
|
}
|
|
684
|
-
let
|
|
685
|
-
this.milestones = this.milestones.map((
|
|
686
|
-
let
|
|
687
|
-
return
|
|
688
|
-
}),
|
|
687
|
+
let r = this.milestones.shift();
|
|
688
|
+
this.milestones = this.milestones.map((s) => {
|
|
689
|
+
let t = new B(s.Run);
|
|
690
|
+
return t.Start = s.Start, t.startDisplay = s.startDisplay, t.POST = s.POST, t.postDisplay = s.postDisplay, t.Read = s.Read, t.readDisplay = s.readDisplay, t.Write = s.Write, t.writeDisplay = s.writeDisplay, t.Duration = s.Duration, t.durationDisplay = s.durationDisplay, t;
|
|
691
|
+
}), e(this.milestones), console.log(`Unstart removed first milestone: ${r.Run}:${r.Start}`);
|
|
689
692
|
}
|
|
690
|
-
post(
|
|
693
|
+
post(e) {
|
|
691
694
|
if (this.milestones == null || this.milestones.length < 1) {
|
|
692
695
|
debugger;
|
|
693
696
|
return;
|
|
694
697
|
}
|
|
695
|
-
this.milestones[0].post(""),
|
|
698
|
+
this.milestones[0].post(""), e(this.milestones), console.log(`POST milestone: ${this.milestones[0].Run}:${this.milestones[0].POST}`);
|
|
696
699
|
}
|
|
697
|
-
read(
|
|
700
|
+
read(e) {
|
|
698
701
|
if (this.milestones == null || this.milestones.length < 1) {
|
|
699
702
|
debugger;
|
|
700
703
|
return;
|
|
701
704
|
}
|
|
702
|
-
this.milestones[0].read(""),
|
|
705
|
+
this.milestones[0].read(""), e(this.milestones), console.log(`Read milestone: ${this.milestones[0].Run}:${this.milestones[0].Read}`);
|
|
703
706
|
}
|
|
704
|
-
write(
|
|
707
|
+
write(e) {
|
|
705
708
|
if (this.milestones == null || this.milestones.length < 1) {
|
|
706
709
|
debugger;
|
|
707
710
|
return;
|
|
708
711
|
}
|
|
709
712
|
for (this.milestones[0].write(""); this.milestones.length > 10; ) {
|
|
710
|
-
let
|
|
711
|
-
console.log(`Removed milestone #${
|
|
713
|
+
let r = this.milestones.pop();
|
|
714
|
+
console.log(`Removed milestone #${r.Run}: ${r.Start}`);
|
|
712
715
|
}
|
|
713
|
-
this.save(), this.milestones = this.milestones.map((
|
|
714
|
-
let
|
|
715
|
-
return
|
|
716
|
-
}),
|
|
716
|
+
this.save(), this.milestones = this.milestones.map((r) => {
|
|
717
|
+
let s = new B(r.Run);
|
|
718
|
+
return s.Start = r.Start, s.startDisplay = r.startDisplay, s.POST = r.POST, s.postDisplay = r.postDisplay, s.Read = r.Read, s.readDisplay = r.readDisplay, s.Write = r.Write, s.writeDisplay = r.writeDisplay, s.Duration = r.Duration, s.durationDisplay = r.durationDisplay, s;
|
|
719
|
+
}), e(this.milestones);
|
|
717
720
|
}
|
|
718
721
|
}
|
|
719
|
-
z = new WeakSet(), ne = function(
|
|
720
|
-
|
|
721
|
-
let
|
|
722
|
-
return
|
|
722
|
+
z = new WeakSet(), ne = function(e) {
|
|
723
|
+
e == null ? this.milestones = new Array() : this.milestones = e.map((r) => {
|
|
724
|
+
let s = new B(Number(r.Run));
|
|
725
|
+
return s.start(r.Start), s.post(r.POST), s.read(r.Read), s.write(r.Write), s;
|
|
723
726
|
});
|
|
724
727
|
};
|
|
725
|
-
class
|
|
726
|
-
constructor(
|
|
728
|
+
class kt {
|
|
729
|
+
constructor(e, r, s) {
|
|
727
730
|
l(this, "tenantNodes");
|
|
728
731
|
l(this, "pb_startTS");
|
|
729
732
|
l(this, "pb_progress");
|
|
@@ -733,36 +736,36 @@ class $t {
|
|
|
733
736
|
l(this, "pb_total");
|
|
734
737
|
l(this, "pb_timer");
|
|
735
738
|
l(this, "milestoneArray");
|
|
736
|
-
this.tenantNodes = new Array(), this.init(
|
|
739
|
+
this.tenantNodes = new Array(), this.init(e, r, s), this.pb_startTS = 0, this.pb_progress = 0, this.pb_increment = 0, this.pb_timer = null, this.pb_idle = 0, this.pb_idleMax = 0, this.pb_total = 0, this.milestoneArray = new Ue(!1);
|
|
737
740
|
}
|
|
738
741
|
// populate tenantNodes based on config tenants
|
|
739
|
-
init(
|
|
742
|
+
init(e, r, s) {
|
|
740
743
|
console.log(
|
|
741
|
-
`Calling BatchArray::init(config: "${
|
|
742
|
-
),
|
|
743
|
-
if (
|
|
744
|
-
let n =
|
|
745
|
-
(o) => o.tid ===
|
|
744
|
+
`Calling BatchArray::init(config: "${e ? e.name : "null"}", bClearLocalStorage: ${s ? "true" : "false"})`
|
|
745
|
+
), s && x() && (localStorage.removeItem(e.name), this.milestoneArray.init(s)), e != null && e.tenants != null && r != null && (this.tenantNodes.length = 0, e.tenants.map((t) => {
|
|
746
|
+
if (t.configurationTenantType === "source" || t.configurationTenantType === "sourcetarget") {
|
|
747
|
+
let n = r.ts.find(
|
|
748
|
+
(o) => o.tid === t.tid
|
|
746
749
|
);
|
|
747
750
|
if (n != null) {
|
|
748
751
|
let o = new me(
|
|
749
|
-
|
|
752
|
+
t.tid,
|
|
750
753
|
n.name,
|
|
751
|
-
|
|
754
|
+
t.batchId
|
|
752
755
|
);
|
|
753
756
|
this.tenantNodes.push(o);
|
|
754
757
|
} else {
|
|
755
758
|
console.log(
|
|
756
|
-
`Error: no tenant found for config source tenant ${
|
|
759
|
+
`Error: no tenant found for config source tenant ${e.name}`
|
|
757
760
|
);
|
|
758
761
|
debugger;
|
|
759
762
|
return;
|
|
760
763
|
}
|
|
761
764
|
}
|
|
762
|
-
}), this.tenantNodes.map((
|
|
763
|
-
|
|
764
|
-
if ((n.configurationTenantType === "target" || n.configurationTenantType === "sourcetarget") && n.tid !==
|
|
765
|
-
let o =
|
|
765
|
+
}), this.tenantNodes.map((t) => {
|
|
766
|
+
e.tenants.map((n) => {
|
|
767
|
+
if ((n.configurationTenantType === "target" || n.configurationTenantType === "sourcetarget") && n.tid !== t.tid) {
|
|
768
|
+
let o = r.ts.find(
|
|
766
769
|
(d) => d.tid === n.tid
|
|
767
770
|
);
|
|
768
771
|
if (o != null) {
|
|
@@ -771,10 +774,10 @@ class $t {
|
|
|
771
774
|
o.name,
|
|
772
775
|
n.batchId
|
|
773
776
|
);
|
|
774
|
-
|
|
777
|
+
t.targets.push(d), t.expanded = !0;
|
|
775
778
|
} else {
|
|
776
779
|
console.log(
|
|
777
|
-
`Error: no tenant found for config target tenant ${
|
|
780
|
+
`Error: no tenant found for config target tenant ${e.name}`
|
|
778
781
|
);
|
|
779
782
|
debugger;
|
|
780
783
|
return;
|
|
@@ -783,23 +786,23 @@ class $t {
|
|
|
783
786
|
});
|
|
784
787
|
}));
|
|
785
788
|
}
|
|
786
|
-
initializeProgressBar(
|
|
789
|
+
initializeProgressBar(e, r, s, t) {
|
|
787
790
|
this.pb_startTS = Date.now(), this.pb_progress = 0, this.pb_increment = 0.25, this.pb_idle = 0, this.pb_idleMax = 0, this.pb_total = 0, this.pb_timer = setInterval(() => {
|
|
788
|
-
this.milestoneArray.milestones[0].Write != null ? (clearInterval(this.pb_timer), this.pb_timer = null, this.pb_progress = 100,
|
|
789
|
-
}, 1e3), this.milestoneArray.start(
|
|
791
|
+
this.milestoneArray.milestones[0].Write != null ? (clearInterval(this.pb_timer), this.pb_timer = null, this.pb_progress = 100, e(this.pb_progress), s(`Complete. [max idle: ${this.pb_idleMax}]`)) : (this.pb_total = this.pb_total + 1, this.pb_idle = this.pb_idle + 1, this.pb_idleMax = Math.max(this.pb_idle, this.pb_idleMax), s(`${this.pb_total} seconds elapsed. Last update ${this.pb_idle} seconds ago. [max idle: ${this.pb_idleMax}/60]`), this.pb_idle >= 60 && this.milestoneArray.milestones[0].Write == null && r(`sync continuing, but no update for ${this.pb_idle} seconds`), this.pb_progress < 100 && (this.pb_progress = Math.min(100, this.pb_progress + this.pb_increment), e(this.pb_progress)));
|
|
792
|
+
}, 1e3), this.milestoneArray.start(t);
|
|
790
793
|
}
|
|
791
|
-
uninitializeProgressBar(
|
|
792
|
-
this.pb_startTS = 0, this.pb_progress = 0,
|
|
794
|
+
uninitializeProgressBar(e, r, s, t) {
|
|
795
|
+
this.pb_startTS = 0, this.pb_progress = 0, e(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, s(`No updates seen for ${this.pb_idle} seconds. [max idle: ${this.pb_idleMax}]`), this.milestoneArray.unstart(t);
|
|
793
796
|
}
|
|
794
|
-
initializeSignalR(
|
|
795
|
-
this.milestoneArray.post(c), u("started sync, waiting for updates..."), this.init(
|
|
797
|
+
initializeSignalR(e, r, s, t, n, o, d, i, c, u, f) {
|
|
798
|
+
this.milestoneArray.post(c), u("started sync, waiting for updates..."), this.init(e, r, !1);
|
|
796
799
|
let b = (I) => {
|
|
797
800
|
console.log(I);
|
|
798
|
-
let
|
|
801
|
+
let v = JSON.parse(I);
|
|
799
802
|
this.pb_idle = 0;
|
|
800
|
-
let D =
|
|
803
|
+
let D = s.find((g) => g.BatchId == v.TargetID);
|
|
801
804
|
if (D == null) {
|
|
802
|
-
console.log(`Batch ${
|
|
805
|
+
console.log(`Batch ${v.TargetID} not found in batchIdArray.`);
|
|
803
806
|
debugger;
|
|
804
807
|
return;
|
|
805
808
|
}
|
|
@@ -810,9 +813,9 @@ class $t {
|
|
|
810
813
|
return;
|
|
811
814
|
}
|
|
812
815
|
h.batchId = D.BatchId;
|
|
813
|
-
let
|
|
816
|
+
let k = v.Stats, m = Object.keys(k), R = Object.values(k), oe = !1, ie = !1;
|
|
814
817
|
for (let g = 0; g < m.length; g++) {
|
|
815
|
-
let
|
|
818
|
+
let E = m[g].endsWith("TotalCount"), M = m[g].endsWith("CurrentCount"), _ = m[g].endsWith("DeferredCount"), V = m[g].endsWith("RescheduledCount");
|
|
816
819
|
if (m[g].startsWith("Reader")) {
|
|
817
820
|
let N = /Reader\/TID:(.+)\/TotalCount/;
|
|
818
821
|
if (M && (N = /Reader\/TID:(.+)\/CurrentCount/), _ && (N = /Reader\/TID:(.+)\/DeferredCount/), V && (N = /Reader\/TID:(.+)\/RescheduledCount/), m[g].match(N) == null) {
|
|
@@ -820,7 +823,7 @@ class $t {
|
|
|
820
823
|
debugger;
|
|
821
824
|
return;
|
|
822
825
|
}
|
|
823
|
-
|
|
826
|
+
E ? (oe = Number(R[g]) == 0, h.total = Math.max(Number(R[g]), h.total), console.log(`----- ${h.name} TID: ${h.tid} batchId: ${h.batchId}`), console.log(`----- ${h.name} Total To Read: ${h.total}`)) : (ie = Number(R[g]) == 0, h.read = Math.max(Number(R[g]), h.read), console.log(`----- ${h.name} Currently Read: ${h.read}`));
|
|
824
827
|
}
|
|
825
828
|
if (h.nothingtosync = oe && ie, m[g].startsWith("Writer")) {
|
|
826
829
|
let N = /Writer\/TID:(.+)\/TotalCount/;
|
|
@@ -837,12 +840,12 @@ class $t {
|
|
|
837
840
|
debugger;
|
|
838
841
|
return;
|
|
839
842
|
}
|
|
840
|
-
if (w.batchId = D.BatchId,
|
|
841
|
-
w.total = Math.max(Number(
|
|
843
|
+
if (w.batchId = D.BatchId, E)
|
|
844
|
+
w.total = Math.max(Number(R[g]), w.total), console.log(`----- ${w.name} TID: ${w.tid} batchId: ${w.batchId}`), console.log(`----- ${w.name} Total To Write: ${w.total}`);
|
|
842
845
|
else if (M)
|
|
843
|
-
w.written = Math.max(Number(
|
|
846
|
+
w.written = Math.max(Number(R[g]), w.written), console.log(`----- ${w.name} Total Written: ${w.written}`);
|
|
844
847
|
else if (_ || V)
|
|
845
|
-
w.deferred = Math.max(Number(
|
|
848
|
+
w.deferred = Math.max(Number(R[g]), w.deferred), console.log(`----- ${w.name} Total Deferred: ${w.deferred}`);
|
|
846
849
|
else {
|
|
847
850
|
console.log("unknown writer type");
|
|
848
851
|
debugger;
|
|
@@ -854,46 +857,46 @@ class $t {
|
|
|
854
857
|
h.update(h.total, h.read, h.written, h.deferred);
|
|
855
858
|
let le = !0, ce = !0, de = !1, ue = !0, K = 0, pe = 0, fe = 0, he = 0;
|
|
856
859
|
if (this.tenantNodes.map((g) => {
|
|
857
|
-
g.targets.map((
|
|
858
|
-
ce && (ce =
|
|
860
|
+
g.targets.map((E) => {
|
|
861
|
+
ce && (ce = E.status == "complete" || E.status == "failed"), de || (de = E.total > 0 || E.status != "not started"), fe += Math.max(E.total, g.total), he += E.written;
|
|
859
862
|
}), ue && (ue = g.nothingtosync), le && (le = g.status == "complete" || g.status == "failed"), K += g.total, pe += g.read;
|
|
860
863
|
}), n(K), o(pe), d(Math.max(fe, K)), i(he), ue)
|
|
861
864
|
this.milestoneArray.write(c), u("nothing to sync"), console.log('Setting config sync result: "nothing to sync"');
|
|
862
865
|
else {
|
|
863
866
|
if (le && this.milestoneArray.milestones[0].Read == null) {
|
|
864
|
-
this.milestoneArray.read(c), u("reading complete"), console.log('Setting config sync result: "reading complete"'), e
|
|
867
|
+
this.milestoneArray.read(c), u("reading complete"), console.log('Setting config sync result: "reading complete"'), t(e.workspaceId);
|
|
865
868
|
let _ = (Date.now() - this.pb_startTS) / 1e3 / 8.5;
|
|
866
869
|
this.pb_increment = _, console.log(`Setting increment: ${this.pb_increment}% per second`);
|
|
867
870
|
}
|
|
868
871
|
ce ? (this.milestoneArray.write(c), u("sync complete"), console.log('Setting config sync result: "complete"')) : de ? (u("writing in progress"), console.log('Setting config sync result: "writing in progress"')) : this.milestoneArray.milestones[0].Read == null && (u("reading in progress"), console.log('Setting config sync result: "reading in progress"'));
|
|
869
872
|
}
|
|
870
873
|
};
|
|
871
|
-
|
|
872
|
-
const
|
|
873
|
-
let D = new URL(
|
|
874
|
+
s.map((I) => {
|
|
875
|
+
const v = T.signalREndpoint();
|
|
876
|
+
let D = new URL(v);
|
|
874
877
|
D.searchParams.append("statsId", I.BatchId), console.log(`Creating SignalR Hub for TID: ${I.SourceId} ${D.href}`);
|
|
875
878
|
const h = new H.HubConnectionBuilder().withUrl(D.href).withAutomaticReconnect().configureLogging(H.LogLevel.Information).build();
|
|
876
|
-
h.on("newMessage", b), h.onreconnecting((
|
|
877
|
-
console.assert(h.state === H.HubConnectionState.Reconnecting), console.log(`Connection lost due to error "${
|
|
878
|
-
}), h.onreconnected((
|
|
879
|
-
console.assert(h.state === H.HubConnectionState.Connected), console.log(`Connection reestablished. Connected with connectionId "${
|
|
879
|
+
h.on("newMessage", b), h.onreconnecting((k) => {
|
|
880
|
+
console.assert(h.state === H.HubConnectionState.Reconnecting), console.log(`Connection lost due to error "${k}". Reconnecting.`);
|
|
881
|
+
}), h.onreconnected((k) => {
|
|
882
|
+
console.assert(h.state === H.HubConnectionState.Connected), console.log(`Connection reestablished. Connected with connectionId "${k}".`);
|
|
880
883
|
}), h.onclose(async () => {
|
|
881
884
|
console.log("Connection closing. Attempting restart."), await h.start();
|
|
882
885
|
}), h.start().catch(console.error);
|
|
883
886
|
});
|
|
884
887
|
}
|
|
885
888
|
// start a sync cycle
|
|
886
|
-
async startSync(
|
|
887
|
-
let
|
|
889
|
+
async startSync(e, r, s) {
|
|
890
|
+
let t = new y();
|
|
888
891
|
if (this.tenantNodes == null || this.tenantNodes.length == 0) {
|
|
889
892
|
debugger;
|
|
890
|
-
return
|
|
893
|
+
return t.result = !1, t.error = "startSync: invalid parameters", t.status = 500, t;
|
|
891
894
|
}
|
|
892
|
-
return
|
|
895
|
+
return t = await mt(e, r, s), t;
|
|
893
896
|
}
|
|
894
897
|
}
|
|
895
898
|
class me {
|
|
896
|
-
constructor(
|
|
899
|
+
constructor(e, r, s) {
|
|
897
900
|
l(this, "expanded");
|
|
898
901
|
l(this, "status", "");
|
|
899
902
|
l(this, "name");
|
|
@@ -905,88 +908,88 @@ class me {
|
|
|
905
908
|
l(this, "deferred", 0);
|
|
906
909
|
l(this, "nothingtosync");
|
|
907
910
|
l(this, "targets");
|
|
908
|
-
this.expanded = !1, this.name =
|
|
911
|
+
this.expanded = !1, this.name = r, this.tid = e, this.batchId = s, this.nothingtosync = !1, this.targets = new Array(), this.update(0, 0, 0, 0);
|
|
909
912
|
}
|
|
910
|
-
update(
|
|
911
|
-
this.total =
|
|
913
|
+
update(e, r, s, t) {
|
|
914
|
+
this.total = e, this.read = r, this.written = s, this.deferred = t, this.read === 0 && this.written === 0 && (this.status = "not started"), this.read > 0 ? this.read < this.total ? this.status = "in progress" : this.read === this.total && (this.status = "complete") : this.written > 0 && (this.written + this.deferred < this.total ? this.status = "in progress" : this.written === this.total ? this.status = "complete" : this.written + this.deferred >= this.total && (this.status = "failed"));
|
|
912
915
|
}
|
|
913
916
|
}
|
|
914
917
|
class we {
|
|
915
|
-
constructor(
|
|
918
|
+
constructor(e, r) {
|
|
916
919
|
l(this, "resourceNodes");
|
|
917
|
-
this.resourceNodes = new Array(),
|
|
920
|
+
this.resourceNodes = new Array(), e && this.init(r);
|
|
918
921
|
}
|
|
919
922
|
// get resource data from localStorage or file
|
|
920
|
-
init(
|
|
921
|
-
if (console.log(`Calling ResourceArray::init(bClearLocalStorage: ${
|
|
922
|
-
let
|
|
923
|
-
if (
|
|
924
|
-
if (
|
|
923
|
+
init(e) {
|
|
924
|
+
if (console.log(`Calling ResourceArray::init(bClearLocalStorage: ${e ? "true" : "false"})`), x()) {
|
|
925
|
+
let s = localStorage.getItem("ResourceArray");
|
|
926
|
+
if (s != null && typeof s == "string" && s !== "")
|
|
927
|
+
if (e)
|
|
925
928
|
localStorage.removeItem("ResourceArray");
|
|
926
929
|
else {
|
|
927
|
-
let n = JSON.parse(
|
|
930
|
+
let n = JSON.parse(s);
|
|
928
931
|
this.resourceNodes = n.resourceNodes;
|
|
929
932
|
return;
|
|
930
933
|
}
|
|
931
934
|
}
|
|
932
|
-
var
|
|
935
|
+
var r = JSON.stringify(Ge);
|
|
933
936
|
try {
|
|
934
|
-
this.resourceNodes = W(Le,
|
|
937
|
+
this.resourceNodes = W(Le, r);
|
|
935
938
|
} catch {
|
|
936
939
|
debugger;
|
|
937
940
|
}
|
|
938
941
|
}
|
|
939
942
|
// read
|
|
940
|
-
async read(
|
|
941
|
-
let
|
|
942
|
-
return
|
|
943
|
+
async read(e, r) {
|
|
944
|
+
let s = new we(!1, !1);
|
|
945
|
+
return s.resourceNodes = await Xe(e, r), s;
|
|
943
946
|
}
|
|
944
947
|
// save resource data to localstorage
|
|
945
948
|
save() {
|
|
946
949
|
if (x()) {
|
|
947
|
-
let
|
|
948
|
-
localStorage.setItem("ResourceArray",
|
|
950
|
+
let e = JSON.stringify(this);
|
|
951
|
+
localStorage.setItem("ResourceArray", e);
|
|
949
952
|
}
|
|
950
953
|
}
|
|
951
954
|
}
|
|
952
955
|
class Le {
|
|
953
|
-
constructor(
|
|
956
|
+
constructor(e, r, s) {
|
|
954
957
|
l(this, "type");
|
|
955
958
|
l(this, "resource");
|
|
956
959
|
l(this, "cost");
|
|
957
960
|
l(this, "expanded");
|
|
958
961
|
l(this, "resources");
|
|
959
|
-
this.type =
|
|
962
|
+
this.type = e, this.resource = r, this.cost = s, this.expanded = !1, this.resources = new Array();
|
|
960
963
|
}
|
|
961
964
|
}
|
|
962
|
-
class
|
|
963
|
-
constructor(
|
|
965
|
+
class Dt {
|
|
966
|
+
constructor(e) {
|
|
964
967
|
l(this, "actorNodes");
|
|
965
|
-
this.actorNodes = new Array(), this.init(
|
|
968
|
+
this.actorNodes = new Array(), this.init(e);
|
|
966
969
|
}
|
|
967
970
|
// get initial data from localStorage or file
|
|
968
|
-
init(
|
|
969
|
-
if (console.log(`Calling ResourceArray::init(bClearLocalStorage: ${
|
|
970
|
-
let
|
|
971
|
-
if (
|
|
972
|
-
if (
|
|
971
|
+
init(e) {
|
|
972
|
+
if (console.log(`Calling ResourceArray::init(bClearLocalStorage: ${e ? "true" : "false"})`), x()) {
|
|
973
|
+
let s = localStorage.getItem("RBACActors");
|
|
974
|
+
if (s != null && typeof s == "string" && s !== "")
|
|
975
|
+
if (e)
|
|
973
976
|
localStorage.removeItem("RBACActors");
|
|
974
977
|
else {
|
|
975
|
-
let n = JSON.parse(
|
|
978
|
+
let n = JSON.parse(s);
|
|
976
979
|
this.actorNodes = n.actorNodes;
|
|
977
980
|
return;
|
|
978
981
|
}
|
|
979
982
|
}
|
|
980
|
-
var
|
|
983
|
+
var r = JSON.stringify(xe);
|
|
981
984
|
try {
|
|
982
|
-
this.actorNodes = W(ze,
|
|
985
|
+
this.actorNodes = W(ze, r);
|
|
983
986
|
} catch {
|
|
984
987
|
debugger;
|
|
985
988
|
}
|
|
986
989
|
}
|
|
987
990
|
}
|
|
988
991
|
class ze {
|
|
989
|
-
constructor(
|
|
992
|
+
constructor(e, r, s, t, n, o) {
|
|
990
993
|
l(this, "type");
|
|
991
994
|
l(this, "actor");
|
|
992
995
|
l(this, "resource");
|
|
@@ -994,68 +997,68 @@ class ze {
|
|
|
994
997
|
l(this, "updatedby");
|
|
995
998
|
l(this, "updatedon");
|
|
996
999
|
l(this, "actors");
|
|
997
|
-
this.type =
|
|
1000
|
+
this.type = e, this.actor = r, this.resource = s, this.role = t, this.updatedby = n, this.updatedon = o, this.actors = new Array();
|
|
998
1001
|
}
|
|
999
1002
|
}
|
|
1000
1003
|
function Me(a) {
|
|
1001
1004
|
return "Group.Read.All User.Read.All openid profile offline_access User.Read Contacts.Read CrossTenantInformation.ReadBasic.All";
|
|
1002
1005
|
}
|
|
1003
|
-
async function J(a,
|
|
1004
|
-
const
|
|
1005
|
-
|
|
1006
|
-
const
|
|
1007
|
-
if (
|
|
1006
|
+
async function J(a, e) {
|
|
1007
|
+
const r = new Headers();
|
|
1008
|
+
r.append("Content-Type", "application/json"), r.append("accept", "*/*");
|
|
1009
|
+
const s = Me();
|
|
1010
|
+
if (e.graphAccessToken == null || e.graphAccessToken === "")
|
|
1008
1011
|
try {
|
|
1009
|
-
let
|
|
1010
|
-
code:
|
|
1012
|
+
let t = await a.acquireTokenByCode({
|
|
1013
|
+
code: e.spacode
|
|
1011
1014
|
});
|
|
1012
|
-
|
|
1013
|
-
} catch (
|
|
1014
|
-
console.log("Front end token failure: " +
|
|
1015
|
+
e.graphAccessToken = t.accessToken, console.log("Front end token acquired by code: " + e.graphAccessToken.slice(0, 20));
|
|
1016
|
+
} catch (t) {
|
|
1017
|
+
console.log("Front end token failure: " + t);
|
|
1015
1018
|
}
|
|
1016
1019
|
else
|
|
1017
1020
|
try {
|
|
1018
|
-
let
|
|
1019
|
-
for (let i = 0; i <
|
|
1020
|
-
|
|
1021
|
+
let t = a.getAllAccounts(), n = e.oid + "." + e.tid, o = null;
|
|
1022
|
+
for (let i = 0; i < t.length; i++)
|
|
1023
|
+
t[i].homeAccountId == n && (o = t[i]);
|
|
1021
1024
|
let d = await a.acquireTokenSilent({
|
|
1022
|
-
scopes: [
|
|
1025
|
+
scopes: [s],
|
|
1023
1026
|
account: o
|
|
1024
1027
|
});
|
|
1025
|
-
|
|
1026
|
-
} catch (
|
|
1028
|
+
e.graphAccessToken = d.accessToken, console.log("Front end token graph acquired silently: " + e.graphAccessToken.slice(0, 20));
|
|
1029
|
+
} catch (t) {
|
|
1027
1030
|
try {
|
|
1028
|
-
console.log("Front end graph token silent acquisition failure: " +
|
|
1029
|
-
let n = a.getAllAccounts(), o =
|
|
1031
|
+
console.log("Front end graph token silent acquisition failure: " + t);
|
|
1032
|
+
let n = a.getAllAccounts(), o = e.oid + "." + e.tid, d = null;
|
|
1030
1033
|
for (let i = 0; i < n.length; i++)
|
|
1031
1034
|
n[i].homeAccountId == o && (d = n[i]);
|
|
1032
1035
|
a.acquireTokenRedirect({
|
|
1033
|
-
scopes: [
|
|
1036
|
+
scopes: [s],
|
|
1034
1037
|
account: d
|
|
1035
1038
|
});
|
|
1036
1039
|
} catch (n) {
|
|
1037
1040
|
console.log("Front end graph token redirect acquisition failure: " + n);
|
|
1038
1041
|
}
|
|
1039
1042
|
}
|
|
1040
|
-
return
|
|
1043
|
+
return r.append("Authorization", `Bearer ${e.graphAccessToken}`), r;
|
|
1041
1044
|
}
|
|
1042
|
-
async function
|
|
1043
|
-
if (
|
|
1045
|
+
async function vt(a, e, r) {
|
|
1046
|
+
if (e == null || e.spacode == "")
|
|
1044
1047
|
return { groups: [], error: "500: invalid user passed to groupsGet" };
|
|
1045
|
-
let
|
|
1048
|
+
let t = { method: "GET", headers: await J(a, e) };
|
|
1046
1049
|
try {
|
|
1047
|
-
let n = C(
|
|
1048
|
-
n += `/?$filter=startsWith(displayName, '${
|
|
1049
|
-
let d = await (await fetch(n,
|
|
1050
|
+
let n = C(e.authority) + p.graphGroupsPredicate;
|
|
1051
|
+
n += `/?$filter=startsWith(displayName, '${r}')`;
|
|
1052
|
+
let d = await (await fetch(n, t)).json();
|
|
1050
1053
|
return typeof d.error < "u" ? { groups: [], error: `${d.error.code}: ${d.error.message}` } : { groups: d.value, error: "" };
|
|
1051
1054
|
} catch (n) {
|
|
1052
1055
|
return console.log(n), { groups: [], error: `Exception: ${n}` };
|
|
1053
1056
|
}
|
|
1054
1057
|
}
|
|
1055
|
-
async function je(a,
|
|
1058
|
+
async function je(a, e, r, s) {
|
|
1056
1059
|
try {
|
|
1057
|
-
let
|
|
1058
|
-
n.searchParams.append("$filter", `resourceId eq '${
|
|
1060
|
+
let t = C(e.authority) + p.graphOauth2PermissionGrantsPredicate, n = new URL(t);
|
|
1061
|
+
n.searchParams.append("$filter", `resourceId eq '${r}' and consentType eq 'Principal' and principalId eq '${s}'`);
|
|
1059
1062
|
let d = await (await fetch(n.href, a)).json();
|
|
1060
1063
|
if (typeof d.error < "u")
|
|
1061
1064
|
return { grants: null, id: null, error: `${d.error.code}: ${d.error.message}` };
|
|
@@ -1064,106 +1067,106 @@ async function je(a, t, s, r) {
|
|
|
1064
1067
|
return { grants: null, id: null, error: "oauth2PermissionGrantsGet: more than one matching delegated consent grant." };
|
|
1065
1068
|
}
|
|
1066
1069
|
return { grants: d.value[0].scope, id: d.value[0].id, error: "" };
|
|
1067
|
-
} catch (
|
|
1068
|
-
return console.log(
|
|
1070
|
+
} catch (t) {
|
|
1071
|
+
return console.log(t), { grants: null, id: null, error: `Exception: ${t}` };
|
|
1069
1072
|
}
|
|
1070
1073
|
}
|
|
1071
|
-
async function He(a,
|
|
1072
|
-
if (
|
|
1074
|
+
async function He(a, e, r, s) {
|
|
1075
|
+
if (e == null || e.spacode == "")
|
|
1073
1076
|
return !1;
|
|
1074
1077
|
try {
|
|
1075
|
-
let
|
|
1076
|
-
|
|
1077
|
-
let n = `{ "scope": "${
|
|
1078
|
+
let t = C(e.authority);
|
|
1079
|
+
t += p.graphOauth2PermissionGrantsPredicate + `/${r}`;
|
|
1080
|
+
let n = `{ "scope": "${s}" }`, d = { method: "PATCH", headers: await J(a, e), body: n }, i = await fetch(t, d), c = await i.json();
|
|
1078
1081
|
if (i.status == 204 && i.statusText == "No Content")
|
|
1079
1082
|
return !0;
|
|
1080
1083
|
debugger;
|
|
1081
1084
|
return console.log(`oauth2PermissionGrantsSet: PATCH failed ${c.error.code}: ${c.error.message}`), !1;
|
|
1082
|
-
} catch (
|
|
1085
|
+
} catch (t) {
|
|
1083
1086
|
debugger;
|
|
1084
|
-
return console.log(
|
|
1087
|
+
return console.log(t), !1;
|
|
1085
1088
|
}
|
|
1086
1089
|
}
|
|
1087
|
-
function Rt(a,
|
|
1088
|
-
let
|
|
1089
|
-
|
|
1090
|
-
let
|
|
1091
|
-
|
|
1090
|
+
function Rt(a, e) {
|
|
1091
|
+
let r = We(a.authority);
|
|
1092
|
+
r += a.tid, r += "/adminconsent";
|
|
1093
|
+
let s = new URL(r), t = Oe(a.authority, e);
|
|
1094
|
+
s.searchParams.append("client_id", t), s.searchParams.append("redirect_uri", window.location.origin), s.searchParams.append("domain_hint", a.companyDomain), s.searchParams.append("login_hint", a.mail), window.location.assign(s.href);
|
|
1092
1095
|
}
|
|
1093
|
-
async function qe(a,
|
|
1096
|
+
async function qe(a, e, r) {
|
|
1094
1097
|
try {
|
|
1095
|
-
let
|
|
1096
|
-
|
|
1097
|
-
let
|
|
1098
|
-
|
|
1099
|
-
let o = await (await fetch(
|
|
1098
|
+
let s = C(e.authority);
|
|
1099
|
+
s += p.graphServicePrincipalsPredicate, s += `(appId='${r}')`;
|
|
1100
|
+
let t = new URL(s);
|
|
1101
|
+
t.searchParams.append("$select", "id,appId,displayName");
|
|
1102
|
+
let o = await (await fetch(t.href, a)).json();
|
|
1100
1103
|
return typeof o.error < "u" ? { spid: "", error: `${o.error.code}: ${o.error.message}` } : { spid: o.id, error: "" };
|
|
1101
|
-
} catch (
|
|
1102
|
-
return console.log(
|
|
1104
|
+
} catch (s) {
|
|
1105
|
+
return console.log(s), { spid: "", error: `Exception: ${s}` };
|
|
1103
1106
|
}
|
|
1104
1107
|
}
|
|
1105
|
-
async function Pt(a,
|
|
1108
|
+
async function Pt(a, e) {
|
|
1106
1109
|
if (a.authority == "") {
|
|
1107
|
-
let
|
|
1108
|
-
if (
|
|
1109
|
-
a.authority =
|
|
1110
|
+
let t = new L();
|
|
1111
|
+
if (t.domain = a.tid, await Te(t, !1))
|
|
1112
|
+
a.authority = t.authority;
|
|
1110
1113
|
else {
|
|
1111
1114
|
debugger;
|
|
1112
1115
|
return !1;
|
|
1113
1116
|
}
|
|
1114
1117
|
}
|
|
1115
|
-
let
|
|
1118
|
+
let r = window.location.href;
|
|
1116
1119
|
switch (a.authority) {
|
|
1117
1120
|
case p.authorityWW:
|
|
1118
|
-
|
|
1121
|
+
r += "MicrosoftIdentity/Account/SignIn";
|
|
1119
1122
|
break;
|
|
1120
1123
|
case p.authorityUS:
|
|
1121
|
-
|
|
1124
|
+
r += "USGov/SignIn";
|
|
1122
1125
|
break;
|
|
1123
1126
|
case p.authorityCN:
|
|
1124
|
-
|
|
1127
|
+
r += "China/SignIn";
|
|
1125
1128
|
break;
|
|
1126
1129
|
default:
|
|
1127
1130
|
return !1;
|
|
1128
1131
|
}
|
|
1129
|
-
let
|
|
1130
|
-
if (
|
|
1131
|
-
|
|
1132
|
-
const
|
|
1132
|
+
let s = new URL(r);
|
|
1133
|
+
if (s.searchParams.append("redirectUri", window.location.origin), a.oid !== "1") {
|
|
1134
|
+
s.searchParams.append("loginHint", a.mail);
|
|
1135
|
+
const t = /@([a-zA-Z0-9.-]+\.[a-zA-Z]{2,})$/, n = a.mail.match(t);
|
|
1133
1136
|
let o = n ? n[1] : "organizations";
|
|
1134
|
-
|
|
1137
|
+
s.searchParams.append("domainHint", o);
|
|
1135
1138
|
} else
|
|
1136
|
-
|
|
1137
|
-
return
|
|
1139
|
+
s.searchParams.append("domainHint", "organizations");
|
|
1140
|
+
return e.setTaskStart("initialization", /* @__PURE__ */ new Date()), e.setTaskStart("authenticate user", /* @__PURE__ */ new Date()), window.location.assign(s.href), !0;
|
|
1138
1141
|
}
|
|
1139
|
-
function
|
|
1142
|
+
function Et(a, e) {
|
|
1140
1143
|
debugger;
|
|
1141
1144
|
if (a.oid == "1") return;
|
|
1142
|
-
let
|
|
1145
|
+
let r = window.location.href;
|
|
1143
1146
|
switch (a.authority) {
|
|
1144
1147
|
case p.authorityWW:
|
|
1145
|
-
|
|
1148
|
+
r += "MicrosoftIdentity/Account/Challenge";
|
|
1146
1149
|
break;
|
|
1147
1150
|
case p.authorityUS:
|
|
1148
|
-
|
|
1151
|
+
r += "USGov/Challenge";
|
|
1149
1152
|
break;
|
|
1150
1153
|
case p.authorityCN:
|
|
1151
|
-
|
|
1154
|
+
r += "China/Challenge";
|
|
1152
1155
|
break;
|
|
1153
1156
|
default:
|
|
1154
1157
|
return;
|
|
1155
1158
|
}
|
|
1156
|
-
let
|
|
1157
|
-
|
|
1159
|
+
let s = new URL(r);
|
|
1160
|
+
s.searchParams.append("redirectUri", window.location.origin), s.searchParams.append("scope", e), s.searchParams.append("domainHint", "organizations"), s.searchParams.append("loginHint", a.mail), window.location.assign(s.href);
|
|
1158
1161
|
}
|
|
1159
1162
|
async function Gt(a) {
|
|
1160
1163
|
if (a.oid == "1") return !1;
|
|
1161
|
-
let
|
|
1162
|
-
|
|
1163
|
-
let
|
|
1164
|
-
|
|
1165
|
-
let
|
|
1166
|
-
if (
|
|
1164
|
+
let e = window.location.href;
|
|
1165
|
+
e += "user";
|
|
1166
|
+
let r = new URL(e);
|
|
1167
|
+
r.searchParams.append("oid", a.oid), r.searchParams.append("tid", a.tid), r.searchParams.append("loginHint", a.loginHint), r.searchParams.append("verb", "LOGOUT");
|
|
1168
|
+
let s = { method: "PATCH" }, t = await fetch(r.href, s);
|
|
1169
|
+
if (t.status == 200 && t.statusText == "OK")
|
|
1167
1170
|
console.log(`Successfully set admin ${a.mail} logout_hint`);
|
|
1168
1171
|
else
|
|
1169
1172
|
return console.log(`Failed to set admin ${a.mail} logout_hint`), !1;
|
|
@@ -1181,26 +1184,26 @@ async function Gt(a) {
|
|
|
1181
1184
|
default:
|
|
1182
1185
|
return !1;
|
|
1183
1186
|
}
|
|
1184
|
-
return
|
|
1187
|
+
return r = new URL(n), r.searchParams.append("redirectUri", window.location.origin), window.location.assign(r.href), !0;
|
|
1185
1188
|
}
|
|
1186
|
-
async function
|
|
1187
|
-
if (
|
|
1188
|
-
if (
|
|
1189
|
+
async function xt(a, e, r, s) {
|
|
1190
|
+
if (s) debugger;
|
|
1191
|
+
if (e.name != null && e.name !== "") return !1;
|
|
1189
1192
|
if (a.graphAccessToken != null && a.graphAccessToken === "") {
|
|
1190
1193
|
console.log(`tenantRelationshipsGetByDomain called with invalid logged in user: ${a.name}`);
|
|
1191
1194
|
try {
|
|
1192
|
-
let i = await
|
|
1195
|
+
let i = await r.acquireTokenByCode({ code: a.spacode, scopes: ["user.read", "contacts.read", "CrossTenantInformation.ReadBasic.All"] });
|
|
1193
1196
|
a.graphAccessToken = i.accessToken, console.log("tenantRelationshipsGetByDomain: Front end token acquired: " + a.graphAccessToken.slice(0, 20));
|
|
1194
1197
|
} catch (i) {
|
|
1195
1198
|
return console.log("tenantRelationshipsGetByDomain: Front end token failure: " + i), !1;
|
|
1196
1199
|
}
|
|
1197
1200
|
}
|
|
1198
|
-
const
|
|
1199
|
-
|
|
1200
|
-
let o = { method: "GET", headers:
|
|
1201
|
+
const t = new Headers(), n = `Bearer ${a.graphAccessToken}`;
|
|
1202
|
+
t.append("Authorization", n);
|
|
1203
|
+
let o = { method: "GET", headers: t };
|
|
1201
1204
|
try {
|
|
1202
|
-
var d = C(
|
|
1203
|
-
d += "(domainName='", d +=
|
|
1205
|
+
var d = C(e.authority) + p.graphTenantByDomainPredicate;
|
|
1206
|
+
d += "(domainName='", d += e.domain, d += "')", console.log("tenantRelationshipsGetByDomain: Attempting GET from /findTenantInformationByDomainName:", d);
|
|
1204
1207
|
let i = await fetch(d, o);
|
|
1205
1208
|
if (i.status == 200) {
|
|
1206
1209
|
let c = await i.json();
|
|
@@ -1209,7 +1212,7 @@ async function Et(a, t, s, r) {
|
|
|
1209
1212
|
debugger;
|
|
1210
1213
|
return console.log("tenantRelationshipsGetByDomain: Failed GET from /findTenantInformationByDomainName: ", c.error.message), !1;
|
|
1211
1214
|
} else if (c.displayName != null && c.displayName !== "")
|
|
1212
|
-
return
|
|
1215
|
+
return e.tid = c.tenantId, e.name = c.displayName, console.log("tenantRelationshipsGetByDomain: Successful GET from /findTenantInformationByDomainName: ", c.displayName), !0;
|
|
1213
1216
|
} else
|
|
1214
1217
|
console.log("tenantRelationshipsGetByDomain: Failed to GET from /findTenantInformationByDomainName: ", d);
|
|
1215
1218
|
}
|
|
@@ -1218,11 +1221,11 @@ async function Et(a, t, s, r) {
|
|
|
1218
1221
|
}
|
|
1219
1222
|
return !1;
|
|
1220
1223
|
}
|
|
1221
|
-
async function Je(a,
|
|
1222
|
-
if (console.log("**** tenantRelationshipsGetById"),
|
|
1224
|
+
async function Je(a, e, r, s, t) {
|
|
1225
|
+
if (console.log("**** tenantRelationshipsGetById"), t) debugger;
|
|
1223
1226
|
if (a.graphAccessToken === "")
|
|
1224
1227
|
try {
|
|
1225
|
-
let c = await
|
|
1228
|
+
let c = await s.acquireTokenByCode({ code: a.spacode, scopes: ["user.read", "contacts.read", "CrossTenantInformation.ReadBasic.All"] });
|
|
1226
1229
|
a.graphAccessToken = c.accessToken, console.log("tenantRelationshipsGetById: Front end token acquired: " + a.graphAccessToken.slice(0, 20));
|
|
1227
1230
|
} catch (c) {
|
|
1228
1231
|
return console.log("tenantRelationshipsGetById: Front end token failure: " + c), !1;
|
|
@@ -1232,11 +1235,11 @@ async function Je(a, t, s, r, e) {
|
|
|
1232
1235
|
let d = { method: "GET", headers: n };
|
|
1233
1236
|
try {
|
|
1234
1237
|
var i = C(a.authority) + p.graphTenantByIdPredicate;
|
|
1235
|
-
i += "(tenantId='", i +=
|
|
1238
|
+
i += "(tenantId='", i += e.tid, i += "')", console.log("tenantRelationshipsGetById: Attempting GET from /findTenantInformationByTenantId:", i);
|
|
1236
1239
|
let u = await (await fetch(i, d)).json();
|
|
1237
1240
|
if (u && typeof u.displayName !== void 0 && u.displayName !== "") {
|
|
1238
|
-
if (
|
|
1239
|
-
|
|
1241
|
+
if (e !== void 0)
|
|
1242
|
+
e.name = u.displayName, e.domain = u.defaultDomainName;
|
|
1240
1243
|
else {
|
|
1241
1244
|
console.log("tenantRelationshipsGetById: missing associated tenant for logged in user.");
|
|
1242
1245
|
debugger;
|
|
@@ -1249,18 +1252,18 @@ async function Je(a, t, s, r, e) {
|
|
|
1249
1252
|
}
|
|
1250
1253
|
return !1;
|
|
1251
1254
|
}
|
|
1252
|
-
async function Te(a,
|
|
1253
|
-
if (
|
|
1254
|
-
let
|
|
1255
|
+
async function Te(a, e) {
|
|
1256
|
+
if (e) debugger;
|
|
1257
|
+
let r = [p.authorityWW, p.authorityUS, p.authorityCN], s = [p.authorityWWRegex, p.authorityUSRegex, p.authorityCNRegex], t = null;
|
|
1255
1258
|
try {
|
|
1256
1259
|
for (let i = 0; i < 3; i++) {
|
|
1257
|
-
var n =
|
|
1258
|
-
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),
|
|
1259
|
-
let c = await
|
|
1260
|
+
var n = r[i];
|
|
1261
|
+
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), t = await fetch(n), t.status == 200) {
|
|
1262
|
+
let c = await t.json();
|
|
1260
1263
|
if (c) {
|
|
1261
1264
|
var o = c.authorization_endpoint;
|
|
1262
1265
|
for (let u = 0; u < 3; u++) {
|
|
1263
|
-
var d = o.match(
|
|
1266
|
+
var d = o.match(s[u]);
|
|
1264
1267
|
if (d != null)
|
|
1265
1268
|
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;
|
|
1266
1269
|
}
|
|
@@ -1272,24 +1275,24 @@ async function Te(a, t) {
|
|
|
1272
1275
|
} catch (i) {
|
|
1273
1276
|
console.log("Failed to GET from openid well-known endpoint: ", i);
|
|
1274
1277
|
}
|
|
1275
|
-
return (a.tid == "" || a.authority == "") && console.log(`GET from openid well-known endpoint failed to find tenant: ${
|
|
1278
|
+
return (a.tid == "" || a.authority == "") && console.log(`GET from openid well-known endpoint failed to find tenant: ${t ? t.statusText : "unknown"}`), !1;
|
|
1276
1279
|
}
|
|
1277
|
-
async function Ke(a,
|
|
1278
|
-
if (
|
|
1280
|
+
async function Ke(a, e, r) {
|
|
1281
|
+
if (e == null || e.spacode == "" || r == null) {
|
|
1279
1282
|
debugger;
|
|
1280
1283
|
return { scopes: null, id: null, error: "500: invalid parameter(s) passed to getUserDelegatedScopes" };
|
|
1281
1284
|
}
|
|
1282
|
-
let
|
|
1285
|
+
let t = { method: "GET", headers: await J(a, e) };
|
|
1283
1286
|
try {
|
|
1284
|
-
if (
|
|
1285
|
-
let { spid: i, error: c } = await qe(
|
|
1287
|
+
if (r.graphSP == "") {
|
|
1288
|
+
let { spid: i, error: c } = await qe(t, e, "00000003-0000-0000-c000-000000000000");
|
|
1286
1289
|
if (c != "") {
|
|
1287
1290
|
debugger;
|
|
1288
1291
|
return { scopes: null, id: null, error: `${c}` };
|
|
1289
1292
|
}
|
|
1290
|
-
|
|
1293
|
+
r.graphSP = i;
|
|
1291
1294
|
}
|
|
1292
|
-
let { grants: n, id: o, error: d } = await je(
|
|
1295
|
+
let { grants: n, id: o, error: d } = await je(t, e, r.graphSP, e.oid);
|
|
1293
1296
|
if (d != "") {
|
|
1294
1297
|
debugger;
|
|
1295
1298
|
return { scopes: null, id: null, error: `${d}` };
|
|
@@ -1300,83 +1303,83 @@ async function Ke(a, t, s) {
|
|
|
1300
1303
|
return console.log(n), { scopes: null, id: null, error: `Exception: ${n}` };
|
|
1301
1304
|
}
|
|
1302
1305
|
}
|
|
1303
|
-
async function
|
|
1304
|
-
if (
|
|
1306
|
+
async function Nt(a, e, r, s) {
|
|
1307
|
+
if (e == null || e.spacode == "" || r == null) {
|
|
1305
1308
|
debugger;
|
|
1306
1309
|
return !1;
|
|
1307
1310
|
}
|
|
1308
|
-
let { scopes:
|
|
1311
|
+
let { scopes: t, id: n, error: o } = await Ke(a, e, r);
|
|
1309
1312
|
if (o != "") {
|
|
1310
1313
|
debugger;
|
|
1311
|
-
return console.log(`userDelegatedScopesRemove: cannot find userDelegatedScopes for ${
|
|
1314
|
+
return console.log(`userDelegatedScopesRemove: cannot find userDelegatedScopes for ${e.mail}: ${o}`), !1;
|
|
1312
1315
|
}
|
|
1313
|
-
|
|
1314
|
-
let d = await He(a,
|
|
1316
|
+
t = t.replace(s, "");
|
|
1317
|
+
let d = await He(a, e, n, t);
|
|
1315
1318
|
if (!d) {
|
|
1316
1319
|
debugger;
|
|
1317
|
-
return console.log(`userDelegatedScopesRemove: cannot set oauth2PermissionGrants for ${
|
|
1320
|
+
return console.log(`userDelegatedScopesRemove: cannot set oauth2PermissionGrants for ${e.mail}: ${o}`), !1;
|
|
1318
1321
|
}
|
|
1319
|
-
return
|
|
1322
|
+
return e.scopes = t.split(" "), d;
|
|
1320
1323
|
}
|
|
1321
|
-
async function
|
|
1322
|
-
if (
|
|
1324
|
+
async function Ct(a, e) {
|
|
1325
|
+
if (e == null || e.spacode == "")
|
|
1323
1326
|
return { users: [], error: "500: invalid user passed to usersGet" };
|
|
1324
1327
|
try {
|
|
1325
|
-
let
|
|
1326
|
-
|
|
1327
|
-
let o = await (await fetch(
|
|
1328
|
+
let s = { method: "GET", headers: await J(a, e) }, t = C(e.authority);
|
|
1329
|
+
t += p.graphUsersPredicate;
|
|
1330
|
+
let o = await (await fetch(t, s)).json();
|
|
1328
1331
|
if (typeof o.error < "u")
|
|
1329
1332
|
return { users: [], error: `${o.error.code}: ${o.error.message}` };
|
|
1330
1333
|
let d = new Array();
|
|
1331
1334
|
for (let i of o.value)
|
|
1332
1335
|
d.push(i.mail);
|
|
1333
1336
|
return { users: d, error: "" };
|
|
1334
|
-
} catch (
|
|
1335
|
-
return console.log(
|
|
1337
|
+
} catch (r) {
|
|
1338
|
+
return console.log(r), { users: [], error: `Exception: ${r}` };
|
|
1336
1339
|
}
|
|
1337
1340
|
}
|
|
1338
|
-
async function
|
|
1341
|
+
async function Ot(a, e, r) {
|
|
1342
|
+
return rt(a, e, r);
|
|
1343
|
+
}
|
|
1344
|
+
async function Wt(a, e, r, s, t, n, o, d) {
|
|
1339
1345
|
let i = new y();
|
|
1340
|
-
if (
|
|
1341
|
-
if (i = await
|
|
1342
|
-
|
|
1346
|
+
if (r.id === "1") {
|
|
1347
|
+
if (i = await lt(a, e, r, n.id, d), i.result) {
|
|
1348
|
+
s && s(r.id);
|
|
1343
1349
|
const c = {};
|
|
1344
|
-
Object.defineProperty(c,
|
|
1350
|
+
Object.defineProperty(c, r.id, { value: !0, writable: !0, enumerable: !0 }), t(c);
|
|
1345
1351
|
let u = n.associatedConfigs.findIndex((f) => f == "1");
|
|
1346
|
-
u !== -1 && (n.associatedConfigs.splice(u, 1), n.associatedConfigs.push(
|
|
1352
|
+
u !== -1 && (n.associatedConfigs.splice(u, 1), n.associatedConfigs.push(r.id));
|
|
1347
1353
|
}
|
|
1348
1354
|
} else
|
|
1349
|
-
i = await
|
|
1355
|
+
i = await ct(a, e, r, d);
|
|
1350
1356
|
return o.save(), i;
|
|
1351
1357
|
}
|
|
1352
|
-
async function
|
|
1358
|
+
async function Ft(a, e, r, s, t) {
|
|
1353
1359
|
let n = new y();
|
|
1354
|
-
return n = await
|
|
1355
|
-
}
|
|
1356
|
-
async function Wt(a, t, s, r, e) {
|
|
1357
|
-
return at(a, t, s, r);
|
|
1360
|
+
return n = await it(a, e, r, s, t), n;
|
|
1358
1361
|
}
|
|
1359
|
-
async function
|
|
1360
|
-
return
|
|
1362
|
+
async function _t(a, e, r, s, t) {
|
|
1363
|
+
return nt(a, e, r, s, t);
|
|
1361
1364
|
}
|
|
1362
|
-
async function
|
|
1363
|
-
return
|
|
1365
|
+
async function Bt(a, e, r, s, t) {
|
|
1366
|
+
return at(a, e, r, s, t);
|
|
1364
1367
|
}
|
|
1365
|
-
async function
|
|
1368
|
+
async function Ut(a, e, r, s, t) {
|
|
1366
1369
|
let n = new y();
|
|
1367
|
-
if (
|
|
1370
|
+
if (t) debugger;
|
|
1368
1371
|
try {
|
|
1369
|
-
let o =
|
|
1372
|
+
let o = s.ws.find((d) => d.id === r);
|
|
1370
1373
|
if (o != null) {
|
|
1371
1374
|
o.associatedConfigs.length = 0;
|
|
1372
|
-
let d = await be(a,
|
|
1375
|
+
let d = await be(a, e, o.id, t);
|
|
1373
1376
|
if (!d.result) return d;
|
|
1374
1377
|
let i = "";
|
|
1375
1378
|
for (let c of o.associatedConfigs) {
|
|
1376
|
-
let u =
|
|
1379
|
+
let u = s.cs.find((f) => f.id === c);
|
|
1377
1380
|
u != null && u.sel && (i = u.id);
|
|
1378
1381
|
}
|
|
1379
|
-
Se(o,
|
|
1382
|
+
Se(o, s, d.array, i), s.tagWithWorkspaces();
|
|
1380
1383
|
}
|
|
1381
1384
|
return n;
|
|
1382
1385
|
} catch (o) {
|
|
@@ -1384,132 +1387,135 @@ async function Bt(a, t, s, r, e) {
|
|
|
1384
1387
|
}
|
|
1385
1388
|
return n.result = !1, n.status = 500, n;
|
|
1386
1389
|
}
|
|
1387
|
-
async function
|
|
1390
|
+
async function Lt(a, e, r, s, t) {
|
|
1391
|
+
return ot(a, e, r, s);
|
|
1392
|
+
}
|
|
1393
|
+
async function zt(a, e, r, s, t) {
|
|
1388
1394
|
console.log(">>>>>> initGet");
|
|
1389
1395
|
let n = new y();
|
|
1390
|
-
if (
|
|
1396
|
+
if (t)
|
|
1391
1397
|
debugger;
|
|
1392
1398
|
let o = new L();
|
|
1393
|
-
return o.tid =
|
|
1399
|
+
return o.tid = e.tid, o.domain = e.tid, await Te(o, t) ? (e.authority = o.authority, s.setTaskStart("GET tenant details", /* @__PURE__ */ new Date()), n.result = await Je(e, o, r, a, t), s.setTaskEnd("GET tenant details", /* @__PURE__ */ new Date(), "complete"), n.result && (e.companyName = o.name, e.companyDomain = o.domain, s.setTaskStart("POST config init", /* @__PURE__ */ new Date()), n = await dt(a, e, t), s.setTaskEnd("POST config init", /* @__PURE__ */ new Date(), n.result ? "complete" : "failed")), n.result && (s.setTaskStart("GET workspaces", /* @__PURE__ */ new Date()), n = await Qe(a, e, r, t), s.setTaskEnd("GET workspaces", /* @__PURE__ */ new Date(), n.result ? "complete" : "failed")), console.log("initGet complete. Version: " + F()), n) : (n.error = `Failed to retrieve authority for user "${e.mail}" TID ${e.tid}.`, n.result = !1, n);
|
|
1394
1400
|
}
|
|
1395
|
-
async function
|
|
1396
|
-
return
|
|
1401
|
+
async function Mt(a, e, r, s) {
|
|
1402
|
+
return ft(a, e, r, s);
|
|
1397
1403
|
}
|
|
1398
|
-
async function
|
|
1399
|
-
return
|
|
1404
|
+
async function jt(a, e, r, s, t) {
|
|
1405
|
+
return ut(a, e, r, s);
|
|
1400
1406
|
}
|
|
1401
|
-
async function
|
|
1402
|
-
return st(a,
|
|
1407
|
+
async function Ht(a, e, r, s) {
|
|
1408
|
+
return st(a, e, r, s);
|
|
1403
1409
|
}
|
|
1404
|
-
async function
|
|
1405
|
-
return et(a,
|
|
1410
|
+
async function qt(a, e, r, s) {
|
|
1411
|
+
return et(a, e, r, s);
|
|
1406
1412
|
}
|
|
1407
|
-
async function
|
|
1408
|
-
return await
|
|
1413
|
+
async function Jt(a, e, r, s) {
|
|
1414
|
+
return await ht(a, e, r, s);
|
|
1409
1415
|
}
|
|
1410
|
-
function Ve(a,
|
|
1411
|
-
|
|
1412
|
-
let n = null, o =
|
|
1416
|
+
function Ve(a, e, r, s) {
|
|
1417
|
+
r.map((t) => {
|
|
1418
|
+
let n = null, o = e.us.findIndex((c) => c.oid === t.userId || c.oid === t.email);
|
|
1413
1419
|
if (o === -1) {
|
|
1414
|
-
let c =
|
|
1420
|
+
let c = e.us.findIndex((u) => u.oid === "1");
|
|
1415
1421
|
if (c !== -1) {
|
|
1416
|
-
n =
|
|
1422
|
+
n = e.us.at(c);
|
|
1417
1423
|
let u = a.associatedUsers.findIndex((f) => f == "1");
|
|
1418
|
-
u !== -1 && (a.associatedUsers.splice(u, 1), a.associatedUsers.push(
|
|
1424
|
+
u !== -1 && (a.associatedUsers.splice(u, 1), a.associatedUsers.push(t.userId));
|
|
1419
1425
|
} else
|
|
1420
|
-
n = new X(),
|
|
1426
|
+
n = new X(), e.us.push(n);
|
|
1421
1427
|
} else
|
|
1422
|
-
n =
|
|
1423
|
-
n.sel =
|
|
1424
|
-
let d =
|
|
1428
|
+
n = e.us.at(o);
|
|
1429
|
+
n.sel = s === t.userId, n.oid = t.userId ? t.userId : t.email, n.name = t.firstName ?? n.name, n.mail = t.email, n.tid = t.tenantId;
|
|
1430
|
+
let d = e.ts.find((c) => c.tid === n.tid);
|
|
1425
1431
|
d != null && (n.authority = d.authority, n.companyName = d.name, n.companyDomain = d.domain), a.associatedUsers.findIndex((c) => c === n.oid) == -1 && a.associatedUsers.push(n.oid);
|
|
1426
|
-
}),
|
|
1432
|
+
}), e.save();
|
|
1427
1433
|
}
|
|
1428
|
-
function Ze(a,
|
|
1429
|
-
|
|
1430
|
-
let n = null, o =
|
|
1434
|
+
function Ze(a, e, r, s) {
|
|
1435
|
+
r.map((t) => {
|
|
1436
|
+
let n = null, o = e.ts.findIndex((u) => u.tid === t.tenantId);
|
|
1431
1437
|
if (o === -1) {
|
|
1432
|
-
let u =
|
|
1438
|
+
let u = e.ts.findIndex((f) => f.tid === "1");
|
|
1433
1439
|
if (u !== -1) {
|
|
1434
|
-
n =
|
|
1440
|
+
n = e.ts.at(u);
|
|
1435
1441
|
let f = a.associatedTenants.findIndex((b) => b == "1");
|
|
1436
|
-
f !== -1 && (a.associatedTenants.splice(f, 1), a.associatedTenants.push(
|
|
1442
|
+
f !== -1 && (a.associatedTenants.splice(f, 1), a.associatedTenants.push(t.tenantId));
|
|
1437
1443
|
} else
|
|
1438
|
-
n = new L(),
|
|
1444
|
+
n = new L(), e.ts.push(n);
|
|
1439
1445
|
} else
|
|
1440
|
-
n =
|
|
1441
|
-
n.sel =
|
|
1442
|
-
const d = /^(https:\/\/login.microsoftonline.(?:us|com)\/)organizations\/v2.0$/, i =
|
|
1443
|
-
n.authority = i ? i[1] :
|
|
1444
|
-
}),
|
|
1445
|
-
}
|
|
1446
|
-
function Se(a,
|
|
1447
|
-
|
|
1448
|
-
let n = null, o =
|
|
1446
|
+
n = e.ts.at(o);
|
|
1447
|
+
n.sel = s === t.tenantId, n.tid = t.tenantId, n.name = t.name, n.domain = t.domain, n.tenantType = t.type.toLowerCase();
|
|
1448
|
+
const d = /^(https:\/\/login.microsoftonline.(?:us|com)\/)organizations\/v2.0$/, i = t.authority.match(d);
|
|
1449
|
+
n.authority = i ? i[1] : t.authority, a.associatedTenants.findIndex((u) => u === t.tenantId) == -1 && a.associatedTenants.push(t.tenantId);
|
|
1450
|
+
}), e.save();
|
|
1451
|
+
}
|
|
1452
|
+
function Se(a, e, r, s) {
|
|
1453
|
+
r.map((t) => {
|
|
1454
|
+
let n = null, o = e.cs.findIndex((i) => i.id === t.id);
|
|
1449
1455
|
if (o === -1) {
|
|
1450
|
-
let i =
|
|
1456
|
+
let i = e.cs.findIndex((c) => c.id === "1");
|
|
1451
1457
|
if (i !== -1) {
|
|
1452
|
-
n =
|
|
1458
|
+
n = e.cs.at(i);
|
|
1453
1459
|
let c = a.associatedConfigs.findIndex((u) => u == "1");
|
|
1454
|
-
c !== -1 && (a.associatedConfigs.splice(c, 1), a.associatedConfigs.push(
|
|
1460
|
+
c !== -1 && (a.associatedConfigs.splice(c, 1), a.associatedConfigs.push(t.id));
|
|
1455
1461
|
} else
|
|
1456
|
-
n = new Y(),
|
|
1462
|
+
n = new Y(), e.cs.push(n);
|
|
1457
1463
|
} else
|
|
1458
|
-
n =
|
|
1459
|
-
n.sel =
|
|
1464
|
+
n = e.cs.at(o);
|
|
1465
|
+
n.sel = s === t.id, n.id = t.id, n.workspaceId = t.workspaceId, n.name = t.name, n.description = t.description, n.isEnabled = t.isEnabled, n.tenants.length = 0, t.tenants.map((i) => {
|
|
1460
1466
|
let c = new _e();
|
|
1461
1467
|
c.tid = i.tenantId, c.sourceGroupId = i.sourceGroupId ?? "", c.sourceGroupName = i.sourceGroupName ?? "", c.targetGroupId = i.targetGroupId ?? "", c.targetGroupName = i.targetGroupName ?? "", c.configurationTenantType = i.configurationTenantType.toLowerCase(), c.deltaToken = i.deltaToken ?? "", c.configId = n.id, c.batchId = i.batchId ?? "", c.isReadPermissionConsented = i.isReadPermissionConsented, c.isWritePermissionConsented = i.isWritePermissionConsented, n.tenants.push(c);
|
|
1462
|
-
}), a.associatedConfigs.findIndex((i) => i ===
|
|
1463
|
-
}),
|
|
1468
|
+
}), a.associatedConfigs.findIndex((i) => i === t.id) == -1 && a.associatedConfigs.push(t.id);
|
|
1469
|
+
}), e.save();
|
|
1464
1470
|
}
|
|
1465
|
-
async function Qe(a,
|
|
1466
|
-
let
|
|
1467
|
-
if (
|
|
1471
|
+
async function Qe(a, e, r, s) {
|
|
1472
|
+
let t = new y();
|
|
1473
|
+
if (s) debugger;
|
|
1468
1474
|
try {
|
|
1469
|
-
if (
|
|
1470
|
-
for (let n of
|
|
1471
|
-
let o = null, d =
|
|
1475
|
+
if (t = await gt(a, e, s), t.result) {
|
|
1476
|
+
for (let n of t.array) {
|
|
1477
|
+
let o = null, d = r.ws.findIndex((k) => k.id === n.id);
|
|
1472
1478
|
if (d === -1) {
|
|
1473
|
-
let
|
|
1474
|
-
|
|
1479
|
+
let k = r.ws.findIndex((m) => m.id === "1");
|
|
1480
|
+
k !== -1 ? o = r.ws.at(k) : (o = new ee(), r.ws.push(o));
|
|
1475
1481
|
} else
|
|
1476
|
-
o =
|
|
1482
|
+
o = r.ws.at(d);
|
|
1477
1483
|
let i = "";
|
|
1478
|
-
for (let
|
|
1479
|
-
let m =
|
|
1484
|
+
for (let k of o.associatedUsers) {
|
|
1485
|
+
let m = r.us.find((R) => R.oid === k);
|
|
1480
1486
|
m != null && m.sel && (i = m.oid);
|
|
1481
1487
|
}
|
|
1482
1488
|
let c = "";
|
|
1483
|
-
for (let
|
|
1484
|
-
let m =
|
|
1489
|
+
for (let k of o.associatedTenants) {
|
|
1490
|
+
let m = r.ts.find((R) => R.tid === k);
|
|
1485
1491
|
m != null && m.sel && (c = m.tid);
|
|
1486
1492
|
}
|
|
1487
1493
|
let u = "";
|
|
1488
|
-
for (let
|
|
1489
|
-
let m =
|
|
1494
|
+
for (let k of o.associatedConfigs) {
|
|
1495
|
+
let m = r.cs.find((R) => R.id === k);
|
|
1490
1496
|
m != null && m.sel && (u = m.id);
|
|
1491
1497
|
}
|
|
1492
1498
|
o.associatedUsers.length = 0, o.associatedTenants.length = 0, o.associatedConfigs.length = 0, o.id = n.id, o.name = n.name, o.ownerid = n.workspaceOwnerUserId;
|
|
1493
|
-
let f = tt(a,
|
|
1494
|
-
if (!
|
|
1499
|
+
let f = tt(a, e, o.id, s), b = pt(a, e, o.id, s), I = be(a, e, o.id, s), [v, D, h] = await Promise.all([f, b, I]);
|
|
1500
|
+
if (!v.result) return v;
|
|
1495
1501
|
if (!D.result) return D;
|
|
1496
1502
|
if (!h.result) return h;
|
|
1497
|
-
Ze(o,
|
|
1503
|
+
Ze(o, r, D.array, c), Ve(o, r, v.array, i), Se(o, r, h.array, u), r.tagWithWorkspaces();
|
|
1498
1504
|
}
|
|
1499
|
-
return
|
|
1505
|
+
return t;
|
|
1500
1506
|
}
|
|
1501
1507
|
} catch (n) {
|
|
1502
|
-
console.log(n.message),
|
|
1508
|
+
console.log(n.message), t.error = n.message;
|
|
1503
1509
|
}
|
|
1504
|
-
return
|
|
1510
|
+
return t.result = !1, t.status = 500, t;
|
|
1505
1511
|
}
|
|
1506
|
-
async function
|
|
1507
|
-
let
|
|
1512
|
+
async function Kt(a, e) {
|
|
1513
|
+
let r = "", s = F();
|
|
1508
1514
|
try {
|
|
1509
|
-
let
|
|
1510
|
-
for (let i = 0; i <
|
|
1511
|
-
|
|
1512
|
-
|
|
1515
|
+
let t = a.getAllAccounts(), n = e.oid + "." + e.tid, o = null;
|
|
1516
|
+
for (let i = 0; i < t.length; i++)
|
|
1517
|
+
t[i].homeAccountId == n && (o = t[i]);
|
|
1518
|
+
r = (await a.acquireTokenSilent({
|
|
1513
1519
|
scopes: [
|
|
1514
1520
|
"https://analysis.windows.net/powerbi/api/App.Read.All",
|
|
1515
1521
|
"https://analysis.windows.net/powerbi/api/Dataset.ReadWrite.All",
|
|
@@ -1517,47 +1523,47 @@ async function qt(a, t) {
|
|
|
1517
1523
|
"https://analysis.windows.net/powerbi/api/Workspace.ReadWrite.All"
|
|
1518
1524
|
],
|
|
1519
1525
|
account: o
|
|
1520
|
-
})).accessToken, console.log("PowerBI token acquired silently: " +
|
|
1526
|
+
})).accessToken, console.log("PowerBI token acquired silently: " + r.slice(0, 20));
|
|
1521
1527
|
} catch {
|
|
1522
1528
|
console.log("PowerBI token failed to be acquired silently");
|
|
1523
1529
|
}
|
|
1524
|
-
return console.log(
|
|
1530
|
+
return console.log(s), r;
|
|
1525
1531
|
}
|
|
1526
|
-
async function ae(a,
|
|
1527
|
-
const
|
|
1528
|
-
if (
|
|
1532
|
+
async function ae(a, e) {
|
|
1533
|
+
const r = new Headers();
|
|
1534
|
+
if (r.append("Content-Type", "application/json"), r.append("accept", "*/*"), e.azureAccessToken == null || e.azureAccessToken === "")
|
|
1529
1535
|
try {
|
|
1530
|
-
let
|
|
1531
|
-
for (let d = 0; d <
|
|
1532
|
-
|
|
1536
|
+
let s = a.getAllAccounts(), t = e.oid + "." + e.tid, n = null;
|
|
1537
|
+
for (let d = 0; d < s.length; d++)
|
|
1538
|
+
s[d].homeAccountId == t && (n = s[d]);
|
|
1533
1539
|
let o = await a.acquireTokenSilent({
|
|
1534
1540
|
scopes: ["https://management.azure.com/user_impersonation"],
|
|
1535
1541
|
account: n
|
|
1536
1542
|
});
|
|
1537
|
-
|
|
1538
|
-
} catch (
|
|
1543
|
+
e.azureAccessToken = o.accessToken, console.log("Front end token acquired silently: " + e.azureAccessToken.slice(0, 20));
|
|
1544
|
+
} catch (s) {
|
|
1539
1545
|
try {
|
|
1540
|
-
console.log("Front end token silent acquisition failure: " +
|
|
1541
|
-
let
|
|
1542
|
-
for (let d = 0; d <
|
|
1543
|
-
|
|
1546
|
+
console.log("Front end token silent acquisition failure: " + s);
|
|
1547
|
+
let t = a.getAllAccounts(), n = e.oid + "." + e.tid, o = null;
|
|
1548
|
+
for (let d = 0; d < t.length; d++)
|
|
1549
|
+
t[d].homeAccountId == n && (o = t[d]);
|
|
1544
1550
|
a.acquireTokenRedirect({
|
|
1545
1551
|
scopes: ["https://management.azure.com/user_impersonation"],
|
|
1546
1552
|
account: o
|
|
1547
1553
|
});
|
|
1548
|
-
} catch (
|
|
1549
|
-
console.log("Front end token popup acquisition failure: " +
|
|
1554
|
+
} catch (t) {
|
|
1555
|
+
console.log("Front end token popup acquisition failure: " + t);
|
|
1550
1556
|
}
|
|
1551
1557
|
}
|
|
1552
|
-
return
|
|
1558
|
+
return r.append("Authorization", `Bearer ${e.azureAccessToken}`), r;
|
|
1553
1559
|
}
|
|
1554
|
-
async function
|
|
1555
|
-
if (
|
|
1560
|
+
async function Vt(a, e) {
|
|
1561
|
+
if (e == null || e.spacode == "")
|
|
1556
1562
|
return !1;
|
|
1557
1563
|
try {
|
|
1558
|
-
let
|
|
1559
|
-
|
|
1560
|
-
let n = await fetch(
|
|
1564
|
+
let s = { method: "GET", headers: await ae(a, e) }, t = U.azureListRootAssignments;
|
|
1565
|
+
t += "'", t += e.oid, t += "'";
|
|
1566
|
+
let n = await fetch(t, s);
|
|
1561
1567
|
if (n.status == 200) {
|
|
1562
1568
|
let o = await n.json();
|
|
1563
1569
|
o = o;
|
|
@@ -1565,161 +1571,185 @@ async function Jt(a, t) {
|
|
|
1565
1571
|
console.log("Successful call to Azure Resource Graph list root assignments");
|
|
1566
1572
|
} else
|
|
1567
1573
|
return console.log(await S(n)), !1;
|
|
1568
|
-
} catch (
|
|
1569
|
-
return console.log(
|
|
1574
|
+
} catch (r) {
|
|
1575
|
+
return console.log(r), !1;
|
|
1570
1576
|
}
|
|
1571
1577
|
return !0;
|
|
1572
1578
|
}
|
|
1573
|
-
async function
|
|
1574
|
-
if (
|
|
1579
|
+
async function Zt(a, e) {
|
|
1580
|
+
if (e == null || e.spacode == "")
|
|
1575
1581
|
return !1;
|
|
1576
1582
|
try {
|
|
1577
|
-
let
|
|
1583
|
+
let s = { method: "POST", headers: await ae(a, e) }, t = U.azureElevateAccess, n = await fetch(t, s);
|
|
1578
1584
|
if (n.status == 200)
|
|
1579
1585
|
console.log("Successful call to Azure Resource Graph list root assignments");
|
|
1580
1586
|
else
|
|
1581
1587
|
return console.log(await S(n)), !1;
|
|
1582
|
-
} catch (
|
|
1583
|
-
return console.log(
|
|
1588
|
+
} catch (r) {
|
|
1589
|
+
return console.log(r), !1;
|
|
1584
1590
|
}
|
|
1585
1591
|
return !0;
|
|
1586
1592
|
}
|
|
1587
|
-
async function Xe(a,
|
|
1588
|
-
let
|
|
1589
|
-
if (
|
|
1590
|
-
return
|
|
1593
|
+
async function Xe(a, e) {
|
|
1594
|
+
let r = new Array();
|
|
1595
|
+
if (e == null || e.spacode == "")
|
|
1596
|
+
return r;
|
|
1591
1597
|
try {
|
|
1592
|
-
let
|
|
1593
|
-
n += "'", n +=
|
|
1594
|
-
let o = await fetch(n,
|
|
1598
|
+
let t = { method: "GET", headers: await ae(a, e) }, n = U.azureListRootAssignments;
|
|
1599
|
+
n += "'", n += e.oid, n += "'";
|
|
1600
|
+
let o = await fetch(n, t);
|
|
1595
1601
|
if (o.status == 200) {
|
|
1596
1602
|
let d = await o.json();
|
|
1597
1603
|
d = d;
|
|
1598
1604
|
debugger;
|
|
1599
1605
|
console.log("Successful call to Azure Resource Graph list root assignments");
|
|
1600
1606
|
} else
|
|
1601
|
-
return console.log(await S(o)),
|
|
1602
|
-
} catch (
|
|
1603
|
-
return console.log(
|
|
1607
|
+
return console.log(await S(o)), r;
|
|
1608
|
+
} catch (s) {
|
|
1609
|
+
return console.log(s), r;
|
|
1604
1610
|
}
|
|
1605
|
-
return
|
|
1611
|
+
return r;
|
|
1606
1612
|
}
|
|
1607
1613
|
function Ye(a) {
|
|
1608
|
-
let
|
|
1609
|
-
return
|
|
1614
|
+
let e = "8d95d21c-c378-4bb0-9f52-88c30d271e7a", r = a.authority.toLowerCase();
|
|
1615
|
+
return r.startsWith("https://login.microsoftonline.com/") ? e = "8d95d21c-c378-4bb0-9f52-88c30d271e7a" : r.startsWith("https://login.microsoftonline.us/") ? e = "48da942e-ea3d-49e4-a054-81649012f8f2" : r.startsWith("https://login.partner.microsoftonline.cn/") && (e = "c91d32e4-dcc5-4d77-826a-16e93ffce666"), `api://${e}/Config.Write`;
|
|
1610
1616
|
}
|
|
1611
|
-
async function
|
|
1612
|
-
const
|
|
1613
|
-
|
|
1614
|
-
const
|
|
1617
|
+
async function $(a, e) {
|
|
1618
|
+
const r = new Headers();
|
|
1619
|
+
r.append("Content-Type", "application/json"), r.append("accept", "*/*");
|
|
1620
|
+
const s = Ye(e);
|
|
1615
1621
|
try {
|
|
1616
|
-
let
|
|
1617
|
-
for (let i = 0; i <
|
|
1618
|
-
|
|
1622
|
+
let t = a.getAllAccounts(), n = e.oid + "." + e.tid, o = null;
|
|
1623
|
+
for (let i = 0; i < t.length; i++)
|
|
1624
|
+
t[i].homeAccountId == n && (o = t[i]);
|
|
1619
1625
|
let d = await a.acquireTokenSilent({
|
|
1620
|
-
scopes: [
|
|
1626
|
+
scopes: [s],
|
|
1621
1627
|
account: o
|
|
1622
1628
|
});
|
|
1623
|
-
|
|
1624
|
-
} catch (
|
|
1629
|
+
e.mindlineAccessToken = d.accessToken, console.log("Front end mindline token acquired silently: " + e.mindlineAccessToken.slice(0, 20));
|
|
1630
|
+
} catch (t) {
|
|
1625
1631
|
try {
|
|
1626
|
-
console.log("Front end mindline token silent acquisition failure, triggering redirect: " +
|
|
1627
|
-
let n = a.getAllAccounts(), o =
|
|
1632
|
+
console.log("Front end mindline token silent acquisition failure, triggering redirect: " + t);
|
|
1633
|
+
let n = a.getAllAccounts(), o = e.oid + "." + e.tid, d = null;
|
|
1628
1634
|
for (let i = 0; i < n.length; i++)
|
|
1629
1635
|
n[i].homeAccountId == o && (d = n[i]);
|
|
1630
1636
|
a.acquireTokenRedirect({
|
|
1631
|
-
scopes: [
|
|
1637
|
+
scopes: [s],
|
|
1632
1638
|
account: d
|
|
1633
1639
|
});
|
|
1634
1640
|
} catch (n) {
|
|
1635
1641
|
console.log("Front end mindline token redirect acquisition failure: " + n);
|
|
1636
1642
|
}
|
|
1637
1643
|
}
|
|
1638
|
-
return
|
|
1644
|
+
return r.append("Authorization", `Bearer ${e.mindlineAccessToken}`), r;
|
|
1639
1645
|
}
|
|
1640
1646
|
async function S(a) {
|
|
1641
|
-
let
|
|
1642
|
-
if (a.status === 401 && (
|
|
1643
|
-
return
|
|
1644
|
-
let
|
|
1645
|
-
if (
|
|
1646
|
-
|
|
1647
|
-
else if (
|
|
1648
|
-
|
|
1649
|
-
(n, o) => n + o + ": " +
|
|
1647
|
+
let e = "";
|
|
1648
|
+
if (a.status === 401 && (e = a.statusText, e != ""))
|
|
1649
|
+
return e;
|
|
1650
|
+
let r = await a.json();
|
|
1651
|
+
if (r.error !== void 0)
|
|
1652
|
+
e = `Error: ${r.error} Message: ${r.message}`;
|
|
1653
|
+
else if (r.errors !== void 0)
|
|
1654
|
+
e = Object.keys(r.errors).reduce(
|
|
1655
|
+
(n, o) => n + o + ": " + r.errors[o] + " ",
|
|
1650
1656
|
""
|
|
1651
1657
|
);
|
|
1652
|
-
else if (
|
|
1653
|
-
|
|
1658
|
+
else if (r.title !== void 0)
|
|
1659
|
+
e = r.title;
|
|
1654
1660
|
else
|
|
1655
1661
|
debugger;
|
|
1656
|
-
return
|
|
1662
|
+
return e;
|
|
1657
1663
|
}
|
|
1658
|
-
async function et(a,
|
|
1659
|
-
let
|
|
1660
|
-
if (
|
|
1661
|
-
return
|
|
1664
|
+
async function et(a, e, r, s) {
|
|
1665
|
+
let t = new y();
|
|
1666
|
+
if (r.oid == "" && r.mail == "" || s == "")
|
|
1667
|
+
return t.result = !1, t.error = "adminDelete: invalid parameters", t.status = 500, t;
|
|
1662
1668
|
let n = null;
|
|
1663
|
-
n = new URL(T.adminEndpoint()), n.searchParams.append("workspaceId",
|
|
1664
|
-
let d = { method: "DELETE", headers: await
|
|
1669
|
+
n = new URL(T.adminEndpoint()), n.searchParams.append("workspaceId", s), n.searchParams.append("email", r.mail);
|
|
1670
|
+
let d = { method: "DELETE", headers: await $(a, e) };
|
|
1665
1671
|
try {
|
|
1666
1672
|
console.log("Attempting DELETE from /admin: " + n.href);
|
|
1667
1673
|
let i = await fetch(n.href, d);
|
|
1668
|
-
return i.status === 200 && i.statusText === "OK" ? (console.log(`Successful DELETE from /admin: ${n.href}`),
|
|
1674
|
+
return i.status === 200 && i.statusText === "OK" ? (console.log(`Successful DELETE from /admin: ${n.href}`), t) : (t.error = await S(i), console.log(`Failed DELETE from /admin: ${n.href}`), console.log(t.error), t.status = 500, t.result = !1, t);
|
|
1669
1675
|
} catch (i) {
|
|
1670
|
-
|
|
1676
|
+
t.error = i.message, t.status = 500, t.result = !1, console.log(i.message);
|
|
1671
1677
|
}
|
|
1672
|
-
return
|
|
1678
|
+
return t;
|
|
1673
1679
|
}
|
|
1674
|
-
async function tt(a,
|
|
1675
|
-
let
|
|
1676
|
-
if (
|
|
1677
|
-
return
|
|
1680
|
+
async function tt(a, e, r, s) {
|
|
1681
|
+
let t = new y();
|
|
1682
|
+
if (r === "")
|
|
1683
|
+
return t.result = !1, t.status = 500, t.error = "adminsGet: no workspace provided", t;
|
|
1678
1684
|
let n = T.adminsEndpoint(), o = new URL(n);
|
|
1679
|
-
o.searchParams.append("workspaceId",
|
|
1680
|
-
let i = { method: "GET", headers: await
|
|
1685
|
+
o.searchParams.append("workspaceId", r);
|
|
1686
|
+
let i = { method: "GET", headers: await $(a, e) };
|
|
1681
1687
|
try {
|
|
1682
|
-
if (
|
|
1688
|
+
if (s) debugger;
|
|
1683
1689
|
console.log("Attempting GET from /admins: " + o.href);
|
|
1684
1690
|
let c = await fetch(o.href, i);
|
|
1685
1691
|
if (c.status === 200 && c.statusText === "OK") {
|
|
1686
1692
|
let u = await c.json();
|
|
1687
|
-
return u != null ? (
|
|
1693
|
+
return u != null ? (t.array = u, console.log(`Successful GET from /admins: ${t.array.reduce((b, I) => b + I.email + " ", "")}`), t) : (t.error = "Failed GET from /admins: failed to JSON-parse response", console.log(t.error), t.status = 500, t.result = !1, t);
|
|
1688
1694
|
} else
|
|
1689
|
-
return console.log(`Failed GET from /admins: ${o.href}`),
|
|
1695
|
+
return console.log(`Failed GET from /admins: ${o.href}`), t.error = await S(c), t.status = 500, t.result = !1, console.log(t.error), t;
|
|
1690
1696
|
} catch (c) {
|
|
1691
|
-
|
|
1697
|
+
t.error = c.message, t.status = 500, t.result = !1, console.log(c.message);
|
|
1692
1698
|
}
|
|
1693
|
-
return
|
|
1699
|
+
return t;
|
|
1694
1700
|
}
|
|
1695
|
-
async function st(a,
|
|
1696
|
-
let
|
|
1697
|
-
if (
|
|
1698
|
-
return
|
|
1701
|
+
async function st(a, e, r, s) {
|
|
1702
|
+
let t = new y();
|
|
1703
|
+
if (r.mail == "" || r.authority == "" || r.tid === "")
|
|
1704
|
+
return t.result = !1, t.error = "adminPost: invalid argument", t.status = 500, t;
|
|
1699
1705
|
let n = T.adminEndpoint();
|
|
1700
|
-
const o = await
|
|
1706
|
+
const o = await $(a, e);
|
|
1701
1707
|
let d = `
|
|
1702
|
-
{"email": "${
|
|
1703
|
-
"tenantId": "${
|
|
1704
|
-
"workspaceId": "${
|
|
1708
|
+
{"email": "${r.mail}",
|
|
1709
|
+
"tenantId": "${r.tid}",
|
|
1710
|
+
"workspaceId": "${s}"
|
|
1705
1711
|
}`, i = { method: "POST", headers: o, body: d };
|
|
1706
1712
|
try {
|
|
1707
1713
|
console.log("Attempting POST to /admin: " + n);
|
|
1708
1714
|
let c = await fetch(n, i);
|
|
1709
|
-
return c.status === 200 && c.statusText === "OK" ? (console.log(`Successful POST to /admin: ${d}`),
|
|
1715
|
+
return c.status === 200 && c.statusText === "OK" ? (console.log(`Successful POST to /admin: ${d}`), t) : (t.error = await S(c), console.log(`Failed POST to /admin: ${d}`), console.log(t.error), t.status = 500, t.result = !1, t);
|
|
1710
1716
|
} catch (c) {
|
|
1711
|
-
|
|
1717
|
+
t.error = c.message, t.status = 500, t.result = !1, console.log(c.message);
|
|
1712
1718
|
}
|
|
1713
|
-
return
|
|
1719
|
+
return t;
|
|
1720
|
+
}
|
|
1721
|
+
async function rt(a, e, r) {
|
|
1722
|
+
let s = new y();
|
|
1723
|
+
if (e.mail == null || e.mail == "")
|
|
1724
|
+
return s.result = !1, s.status = 500, s.error = "auditEventsGet: no user provided", s;
|
|
1725
|
+
let t = T.auditEventsEndpoint(), n = new URL(t), d = { method: "GET", headers: await $(a, e) };
|
|
1726
|
+
try {
|
|
1727
|
+
if (r) debugger;
|
|
1728
|
+
console.log("Attempting GET from /audit-events endpoint: " + n.href);
|
|
1729
|
+
let i = await fetch(n.href, d);
|
|
1730
|
+
if (i.status === 200 && i.statusText === "OK") {
|
|
1731
|
+
let c = await i.json();
|
|
1732
|
+
if (Array.isArray(c.data)) {
|
|
1733
|
+
let u = c.data;
|
|
1734
|
+
if (u != null)
|
|
1735
|
+
return s.array = u, console.log(`Successful GET from /audit-events: ${s.array.reduce((b, I) => b + I.initiatedByUser + " ", "")}`), s;
|
|
1736
|
+
}
|
|
1737
|
+
return s.error = "Failed GET from /audit-events: failed to JSON-parse response", console.log(s.error), s.status = 500, s.result = !1, s;
|
|
1738
|
+
} else
|
|
1739
|
+
return console.log(`Failed GET from /audit-events: ${n.href}`), s.error = await S(i), s.status = 500, s.result = !1, console.log(s.error), s;
|
|
1740
|
+
} catch (i) {
|
|
1741
|
+
s.error = i.message, s.status = 500, s.result = !1, console.log(i.message);
|
|
1742
|
+
}
|
|
1743
|
+
return s;
|
|
1714
1744
|
}
|
|
1715
|
-
async function
|
|
1745
|
+
async function nt(a, e, r, s, t) {
|
|
1716
1746
|
let n = new y(), o = T.configConsentEndpoint(), d = new URL(o);
|
|
1717
|
-
d.searchParams.append("configurationId",
|
|
1718
|
-
const i = await
|
|
1747
|
+
d.searchParams.append("configurationId", r);
|
|
1748
|
+
const i = await $(a, e);
|
|
1719
1749
|
let c = `
|
|
1720
1750
|
{
|
|
1721
|
-
"tenantId": "${
|
|
1722
|
-
"isReadPermissionConsented": ${
|
|
1751
|
+
"tenantId": "${s}",
|
|
1752
|
+
"isReadPermissionConsented": ${t ? "true" : "false"}
|
|
1723
1753
|
}`, u = { method: "PUT", headers: i, body: c };
|
|
1724
1754
|
try {
|
|
1725
1755
|
console.log("Attempting PUT read consent to /configuration/consent: " + d.href);
|
|
@@ -1730,14 +1760,14 @@ async function rt(a, t, s, r, e) {
|
|
|
1730
1760
|
}
|
|
1731
1761
|
return n;
|
|
1732
1762
|
}
|
|
1733
|
-
async function
|
|
1763
|
+
async function at(a, e, r, s, t) {
|
|
1734
1764
|
let n = new y(), o = T.configConsentEndpoint(), d = new URL(o);
|
|
1735
|
-
d.searchParams.append("configurationId",
|
|
1736
|
-
const i = await
|
|
1765
|
+
d.searchParams.append("configurationId", r);
|
|
1766
|
+
const i = await $(a, e);
|
|
1737
1767
|
let c = `
|
|
1738
1768
|
{
|
|
1739
|
-
"tenantId": "${
|
|
1740
|
-
"isWritePermissionConsented": ${
|
|
1769
|
+
"tenantId": "${s}",
|
|
1770
|
+
"isWritePermissionConsented": ${t ? "true" : "false"}
|
|
1741
1771
|
}`, u = { method: "PUT", headers: i, body: c };
|
|
1742
1772
|
try {
|
|
1743
1773
|
console.log("Attempting PUT read consent to /configuration/consent: " + d.href);
|
|
@@ -1748,13 +1778,13 @@ async function nt(a, t, s, r, e) {
|
|
|
1748
1778
|
}
|
|
1749
1779
|
return n;
|
|
1750
1780
|
}
|
|
1751
|
-
async function
|
|
1781
|
+
async function ot(a, e, r, s, t) {
|
|
1752
1782
|
let n = new y();
|
|
1753
|
-
if (
|
|
1783
|
+
if (r.id === "" || s == "")
|
|
1754
1784
|
return n.result = !1, n.error = "configPost: invalid config ID", n.status = 500, n;
|
|
1755
1785
|
let o = null;
|
|
1756
|
-
o = new URL(T.configEndpoint()), o.searchParams.append("configurationId",
|
|
1757
|
-
let i = { method: "DELETE", headers: await
|
|
1786
|
+
o = new URL(T.configEndpoint()), o.searchParams.append("configurationId", r.id);
|
|
1787
|
+
let i = { method: "DELETE", headers: await $(a, e) };
|
|
1758
1788
|
try {
|
|
1759
1789
|
console.log("Attempting DELETE from /config: " + o.href);
|
|
1760
1790
|
let c = await fetch(o.href, i);
|
|
@@ -1764,55 +1794,55 @@ async function at(a, t, s, r, e) {
|
|
|
1764
1794
|
}
|
|
1765
1795
|
return n;
|
|
1766
1796
|
}
|
|
1767
|
-
async function
|
|
1797
|
+
async function it(a, e, r, s, t) {
|
|
1768
1798
|
let n = new y();
|
|
1769
|
-
if (
|
|
1799
|
+
if (r === "")
|
|
1770
1800
|
return n.result = !1, n.error = "configPatch: invalid config ID", n.status = 500, n;
|
|
1771
1801
|
let o = T.configEnabledEndpoint(), d = new URL(o);
|
|
1772
|
-
d.searchParams.append("configurationId",
|
|
1773
|
-
let c = { method: "PATCH", headers: await
|
|
1802
|
+
d.searchParams.append("configurationId", r), d.searchParams.append("isEnabled", s.toString());
|
|
1803
|
+
let c = { method: "PATCH", headers: await $(a, e) };
|
|
1774
1804
|
try {
|
|
1775
|
-
if (
|
|
1805
|
+
if (t) debugger;
|
|
1776
1806
|
console.log("Attempting PATCH to /config: " + d.href);
|
|
1777
1807
|
let u = await fetch(d.href, c);
|
|
1778
|
-
return u.status === 200 && u.statusText === "OK" ? (console.log(`Successful PATCH to ${d.href}: ${
|
|
1808
|
+
return u.status === 200 && u.statusText === "OK" ? (console.log(`Successful PATCH to ${d.href}: ${s.toString()}`), n) : (n.error = await S(u), console.log(`Failed PATCH to ${d.href}: ${s.toString()}`), console.log(n.error), n.status = 500, n.result = !1, n);
|
|
1779
1809
|
} catch (u) {
|
|
1780
1810
|
n.error = u.message, n.status = 500, n.result = !1, console.log(u.message);
|
|
1781
1811
|
}
|
|
1782
1812
|
return n;
|
|
1783
1813
|
}
|
|
1784
|
-
async function
|
|
1814
|
+
async function lt(a, e, r, s, t) {
|
|
1785
1815
|
let n = new y();
|
|
1786
|
-
if (
|
|
1816
|
+
if (r.id === "")
|
|
1787
1817
|
return n.result = !1, n.error = "configPost: invalid config ID", n.status = 500, n;
|
|
1788
1818
|
let o = T.configEndpoint();
|
|
1789
|
-
const d = await
|
|
1819
|
+
const d = await $(a, e);
|
|
1790
1820
|
let i = `
|
|
1791
1821
|
{
|
|
1792
|
-
"workspaceId": "${
|
|
1793
|
-
"name": "${
|
|
1794
|
-
"description": "${
|
|
1795
|
-
"isEnabled": ${
|
|
1822
|
+
"workspaceId": "${s}",
|
|
1823
|
+
"name": "${r.name}",
|
|
1824
|
+
"description": "${r.description}",
|
|
1825
|
+
"isEnabled": ${r.isEnabled},
|
|
1796
1826
|
"tenants": [`;
|
|
1797
|
-
|
|
1798
|
-
let f = u.sourceGroupId != "" ? `"${u.sourceGroupId}"` : "null", b = u.sourceGroupName != "" ? `"${u.sourceGroupName}"` : "null", I = u.targetGroupId != "" ? `"${u.targetGroupId}"` : "null",
|
|
1827
|
+
r.tenants.map((u) => {
|
|
1828
|
+
let f = u.sourceGroupId != "" ? `"${u.sourceGroupId}"` : "null", b = u.sourceGroupName != "" ? `"${u.sourceGroupName}"` : "null", I = u.targetGroupId != "" ? `"${u.targetGroupId}"` : "null", v = u.targetGroupName != "" ? `"${u.targetGroupName}"` : "null";
|
|
1799
1829
|
i.slice(-1) === "}" && (i += ","), i += `{
|
|
1800
1830
|
"tenantId": "${u.tid}",
|
|
1801
1831
|
"sourceGroupId": ${f},
|
|
1802
1832
|
"sourceGroupName": ${b},
|
|
1803
1833
|
"targetGroupId": ${I},
|
|
1804
|
-
"targetGroupName": ${
|
|
1834
|
+
"targetGroupName": ${v},
|
|
1805
1835
|
"configurationTenantType": "${u.configurationTenantType}"
|
|
1806
1836
|
}`;
|
|
1807
1837
|
}), i += "]}";
|
|
1808
1838
|
let c = { method: "POST", headers: d, body: i };
|
|
1809
1839
|
try {
|
|
1810
|
-
if (
|
|
1840
|
+
if (t) debugger;
|
|
1811
1841
|
console.log("Attempting POST to /config: " + o);
|
|
1812
1842
|
let u = await fetch(o, c);
|
|
1813
1843
|
if (u.status === 200 && u.statusText === "OK") {
|
|
1814
1844
|
let f = await u.json();
|
|
1815
|
-
return
|
|
1845
|
+
return r.id = f, console.log(
|
|
1816
1846
|
`Successful ConfigID: ${f} from POST to /config: ${i}`
|
|
1817
1847
|
), n;
|
|
1818
1848
|
} else
|
|
@@ -1821,26 +1851,26 @@ async function it(a, t, s, r, e) {
|
|
|
1821
1851
|
return n.status = 500, n.result = !1, n.error = u.message, console.log(n.error), n;
|
|
1822
1852
|
}
|
|
1823
1853
|
}
|
|
1824
|
-
async function
|
|
1825
|
-
let
|
|
1826
|
-
if (
|
|
1827
|
-
return
|
|
1854
|
+
async function ct(a, e, r, s) {
|
|
1855
|
+
let t = new y();
|
|
1856
|
+
if (r.id === "")
|
|
1857
|
+
return t.result = !1, t.error = "configPost: invalid config ID", t.status = 500, t;
|
|
1828
1858
|
let n = T.configEndpoint(), o = new URL(n);
|
|
1829
|
-
o.searchParams.append("configurationId",
|
|
1830
|
-
const d = await
|
|
1859
|
+
o.searchParams.append("configurationId", r.id);
|
|
1860
|
+
const d = await $(a, e);
|
|
1831
1861
|
let i = `
|
|
1832
1862
|
{
|
|
1833
|
-
"name": "${
|
|
1834
|
-
"description": "${
|
|
1863
|
+
"name": "${r.name}",
|
|
1864
|
+
"description": "${r.description}",
|
|
1835
1865
|
"tenants": [`;
|
|
1836
|
-
|
|
1866
|
+
r.tenants.map((u) => {
|
|
1837
1867
|
i.slice(-1) === "}" && (i += ",");
|
|
1838
|
-
let b = u.sourceGroupId != "" ? `"${u.sourceGroupId}"` : "null", I = u.sourceGroupName != "" ? `"${u.sourceGroupName}"` : "null",
|
|
1868
|
+
let b = u.sourceGroupId != "" ? `"${u.sourceGroupId}"` : "null", I = u.sourceGroupName != "" ? `"${u.sourceGroupName}"` : "null", v = u.targetGroupId != "" ? `"${u.targetGroupId}"` : "null", D = u.targetGroupName != "" ? `"${u.targetGroupName}"` : "null";
|
|
1839
1869
|
i += `{
|
|
1840
1870
|
"tenantId": "${u.tid}",
|
|
1841
1871
|
"sourceGroupId": ${b},
|
|
1842
1872
|
"sourceGroupName": ${I},
|
|
1843
|
-
"targetGroupId": ${
|
|
1873
|
+
"targetGroupId": ${v},
|
|
1844
1874
|
"targetGroupName": ${D},
|
|
1845
1875
|
"configurationTenantType": "${u.configurationTenantType}",
|
|
1846
1876
|
"deltaToken": "${u.deltaToken}"
|
|
@@ -1848,69 +1878,69 @@ async function lt(a, t, s, r) {
|
|
|
1848
1878
|
}), i += "]}";
|
|
1849
1879
|
let c = { method: "PUT", headers: d, body: i };
|
|
1850
1880
|
try {
|
|
1851
|
-
if (
|
|
1881
|
+
if (s) debugger;
|
|
1852
1882
|
console.log("Attempting PUT to /config: " + o.href);
|
|
1853
1883
|
let u = await fetch(o.href, c);
|
|
1854
|
-
return u.status === 200 && u.statusText === "OK" ? (console.log(`Successful PUT to ${o.href}: ${i}`),
|
|
1884
|
+
return u.status === 200 && u.statusText === "OK" ? (console.log(`Successful PUT to ${o.href}: ${i}`), t) : (t.error = await S(u), console.log(`Failed PUT to ${o.href}: ${i}`), console.log(t.error), t.status = 500, t.result = !1, t);
|
|
1855
1885
|
} catch (u) {
|
|
1856
|
-
|
|
1886
|
+
t.error = u.message, t.status = 500, t.result = !1, console.log(u.message);
|
|
1857
1887
|
}
|
|
1858
|
-
return
|
|
1888
|
+
return t;
|
|
1859
1889
|
}
|
|
1860
|
-
async function be(a,
|
|
1861
|
-
let
|
|
1862
|
-
if (
|
|
1863
|
-
return
|
|
1890
|
+
async function be(a, e, r, s) {
|
|
1891
|
+
let t = new y();
|
|
1892
|
+
if (r === "")
|
|
1893
|
+
return t.result = !1, t.status = 500, t.error = "configsGet: no workspace provided", t;
|
|
1864
1894
|
let n = T.configsEndpoint(), o = new URL(n);
|
|
1865
|
-
o.searchParams.append("workspaceId",
|
|
1866
|
-
let i = { method: "GET", headers: await
|
|
1895
|
+
o.searchParams.append("workspaceId", r);
|
|
1896
|
+
let i = { method: "GET", headers: await $(a, e) };
|
|
1867
1897
|
try {
|
|
1868
|
-
if (
|
|
1898
|
+
if (s) debugger;
|
|
1869
1899
|
console.log("Attempting GET from /configurations: " + o.href);
|
|
1870
1900
|
let c = await fetch(o.href, i);
|
|
1871
1901
|
if (c.status === 200 && c.statusText === "OK") {
|
|
1872
1902
|
let u = await c.json();
|
|
1873
|
-
return u != null ? (
|
|
1903
|
+
return u != null ? (t.array = u, console.log(`Successful GET from /configurations: ${t.array.reduce((b, I) => b + I.name + " ", "")}`), t) : (t.error = "Failed GET from /configurations: failed to JSON-parse response", console.log(t.error), t.status = 500, t.result = !1, t);
|
|
1874
1904
|
} else
|
|
1875
|
-
return console.log(`Failed GET from /configurations: ${o.href}`),
|
|
1905
|
+
return console.log(`Failed GET from /configurations: ${o.href}`), t.error = await S(c), t.status = 500, t.result = !1, console.log(t.error), t;
|
|
1876
1906
|
} catch (c) {
|
|
1877
|
-
|
|
1907
|
+
t.error = c.message, t.status = 500, t.result = !1, console.log(c.message);
|
|
1878
1908
|
}
|
|
1879
|
-
return
|
|
1909
|
+
return t;
|
|
1880
1910
|
}
|
|
1881
|
-
async function
|
|
1882
|
-
let
|
|
1883
|
-
if (
|
|
1884
|
-
return
|
|
1885
|
-
let
|
|
1886
|
-
const n = await
|
|
1911
|
+
async function dt(a, e, r) {
|
|
1912
|
+
let s = new y();
|
|
1913
|
+
if (e.companyName === "" || e.companyDomain === "")
|
|
1914
|
+
return s.result = !1, s.error = "initPost: invalid company name or domain", s.status = 500, s;
|
|
1915
|
+
let t = T.initEndpoint();
|
|
1916
|
+
const n = await $(a, e);
|
|
1887
1917
|
let o = `
|
|
1888
1918
|
{
|
|
1889
1919
|
"tenantCreateModel": {
|
|
1890
|
-
"tenantId": "${
|
|
1891
|
-
"name": "${
|
|
1892
|
-
"domain": "${
|
|
1920
|
+
"tenantId": "${e.tid}",
|
|
1921
|
+
"name": "${e.companyName}",
|
|
1922
|
+
"domain": "${e.companyDomain}",
|
|
1893
1923
|
"type": "aad",
|
|
1894
|
-
"authority": "${
|
|
1924
|
+
"authority": "${e.authority}"
|
|
1895
1925
|
}
|
|
1896
1926
|
}`, d = { method: "POST", headers: n, body: o };
|
|
1897
1927
|
try {
|
|
1898
|
-
if (
|
|
1899
|
-
console.log("Attempting POST to /configuration/init: " +
|
|
1900
|
-
let i = await fetch(
|
|
1901
|
-
return i.status === 200 && i.statusText === "OK" ? (console.log(`Successful POST to /configuration/init: ${o}`),
|
|
1928
|
+
if (r) debugger;
|
|
1929
|
+
console.log("Attempting POST to /configuration/init: " + t);
|
|
1930
|
+
let i = await fetch(t, d);
|
|
1931
|
+
return i.status === 200 && i.statusText === "OK" ? (console.log(`Successful POST to /configuration/init: ${o}`), s) : (s.error = await S(i), s.status = 500, s.result = !1, console.log(`Failed POST to /configuration/init: ${o}`), console.log(s.error), s);
|
|
1902
1932
|
} catch (i) {
|
|
1903
|
-
|
|
1933
|
+
s.error = i.message, console.log(s.error);
|
|
1904
1934
|
}
|
|
1905
|
-
return
|
|
1935
|
+
return s.status = 500, s.result = !1, s;
|
|
1906
1936
|
}
|
|
1907
|
-
async function
|
|
1937
|
+
async function ut(a, e, r, s, t) {
|
|
1908
1938
|
let n = new y();
|
|
1909
|
-
if (
|
|
1939
|
+
if (r.tid === "" || s === "")
|
|
1910
1940
|
return n.result = !1, n.error = "tenantDelete: invalid tid, workspaceId", n.status = 500, n;
|
|
1911
1941
|
let o = new URL(T.tenantEndpoint());
|
|
1912
|
-
o.searchParams.append("tenantId",
|
|
1913
|
-
let i = { method: "DELETE", headers: await
|
|
1942
|
+
o.searchParams.append("tenantId", r.tid), o.searchParams.append("workspaceId", s);
|
|
1943
|
+
let i = { method: "DELETE", headers: await $(a, e) };
|
|
1914
1944
|
try {
|
|
1915
1945
|
console.log("Attempting DELETE from /tenant: " + o.href);
|
|
1916
1946
|
let c = await fetch(o.href, i);
|
|
@@ -1920,120 +1950,120 @@ async function dt(a, t, s, r, e) {
|
|
|
1920
1950
|
}
|
|
1921
1951
|
return n;
|
|
1922
1952
|
}
|
|
1923
|
-
async function
|
|
1924
|
-
let
|
|
1925
|
-
if (
|
|
1926
|
-
return
|
|
1953
|
+
async function pt(a, e, r, s) {
|
|
1954
|
+
let t = new y();
|
|
1955
|
+
if (r === "")
|
|
1956
|
+
return t.result = !1, t.status = 500, t.error = "tenantsGet: no workspace provided", t;
|
|
1927
1957
|
let n = T.tenantsEndpoint(), o = new URL(n);
|
|
1928
|
-
o.searchParams.append("workspaceId",
|
|
1929
|
-
let i = { method: "GET", headers: await
|
|
1958
|
+
o.searchParams.append("workspaceId", r);
|
|
1959
|
+
let i = { method: "GET", headers: await $(a, e) };
|
|
1930
1960
|
try {
|
|
1931
|
-
if (
|
|
1961
|
+
if (s) debugger;
|
|
1932
1962
|
console.log(`Attempting GET from /tenants: ${o.href}`);
|
|
1933
1963
|
let c = await fetch(o.href, i);
|
|
1934
1964
|
if (c.status === 200 && c.statusText === "OK") {
|
|
1935
1965
|
let u = await c.json();
|
|
1936
|
-
return u != null ? (
|
|
1966
|
+
return u != null ? (t.array = u, console.log(`Successful GET from /tenants: ${t.array.reduce((b, I) => b + I.domain + " ", "")}`), t) : (t.error = "Failed GET from /tenants: failed to JSON-parse response", console.log(t.error), t.status = 500, t.result = !1, t);
|
|
1937
1967
|
} else
|
|
1938
|
-
return console.log(`Failed GET from /tenants: ${o.href}`),
|
|
1968
|
+
return console.log(`Failed GET from /tenants: ${o.href}`), t.error = await S(c), t.status = 500, t.result = !1, console.log(t.error), t;
|
|
1939
1969
|
} catch (c) {
|
|
1940
|
-
|
|
1970
|
+
t.error = c.message, t.status = 500, t.result = !1, console.log(c.message);
|
|
1941
1971
|
}
|
|
1942
|
-
return
|
|
1972
|
+
return t;
|
|
1943
1973
|
}
|
|
1944
|
-
async function
|
|
1945
|
-
let
|
|
1946
|
-
if (
|
|
1947
|
-
return
|
|
1974
|
+
async function ft(a, e, r, s) {
|
|
1975
|
+
let t = new y();
|
|
1976
|
+
if (r.tid === "" || r.name === "" || r.domain === "")
|
|
1977
|
+
return t.result = !1, t.error = "tenantPost: invalid tid, name, domain", t.status = 500, t;
|
|
1948
1978
|
let n = T.tenantEndpoint(), o = new URL(n);
|
|
1949
|
-
o.searchParams.append("workspaceId",
|
|
1950
|
-
const d = await
|
|
1979
|
+
o.searchParams.append("workspaceId", s);
|
|
1980
|
+
const d = await $(a, e);
|
|
1951
1981
|
let i = `
|
|
1952
|
-
{"tenantId": "${
|
|
1953
|
-
"name": "${
|
|
1954
|
-
"domain": "${
|
|
1982
|
+
{"tenantId": "${r.tid}",
|
|
1983
|
+
"name": "${r.name}",
|
|
1984
|
+
"domain": "${r.domain}",
|
|
1955
1985
|
"type": 1,
|
|
1956
|
-
"authority": "${
|
|
1986
|
+
"authority": "${r.authority}"
|
|
1957
1987
|
}`, c = { method: "POST", headers: d, body: i };
|
|
1958
1988
|
try {
|
|
1959
1989
|
console.log(`Attempting POST to ${o.href}: ${i}`);
|
|
1960
1990
|
let u = await fetch(o.href, c);
|
|
1961
|
-
return u.status === 200 && u.statusText === "OK" ? (console.log(`Successful POST to ${o.href}: ${i}`),
|
|
1991
|
+
return u.status === 200 && u.statusText === "OK" ? (console.log(`Successful POST to ${o.href}: ${i}`), t) : (console.log(`Failed POST to ${o.href}: ${i}`), t.error = await S(u), console.log(t.error), t.status = 500, t.result = !1, t);
|
|
1962
1992
|
} catch (u) {
|
|
1963
|
-
|
|
1993
|
+
t.error = u.message, t.status = 500, t.result = !1, console.log(t.error);
|
|
1964
1994
|
}
|
|
1965
|
-
return
|
|
1995
|
+
return t;
|
|
1966
1996
|
}
|
|
1967
|
-
async function
|
|
1968
|
-
let
|
|
1969
|
-
if (
|
|
1970
|
-
return
|
|
1997
|
+
async function ht(a, e, r, s) {
|
|
1998
|
+
let t = new y();
|
|
1999
|
+
if (r == "" || s == "")
|
|
2000
|
+
return t.result = !1, t.error = "workspacePut: invalid workspace ID or name", t.status = 500, t;
|
|
1971
2001
|
let n = T.workspaceEndpoint(), o = new URL(n);
|
|
1972
|
-
o.searchParams.append("workspaceId",
|
|
1973
|
-
let i = { method: "PUT", headers: await
|
|
2002
|
+
o.searchParams.append("workspaceId", r), o.searchParams.append("workspaceName", s);
|
|
2003
|
+
let i = { method: "PUT", headers: await $(a, e) };
|
|
1974
2004
|
try {
|
|
1975
2005
|
console.log("Attempting PUT to /workspace: " + o.href);
|
|
1976
2006
|
let c = await fetch(o.href, i);
|
|
1977
|
-
return c.status === 200 && c.statusText === "OK" ? (console.log(`Successful PUT to ${o.href}`),
|
|
2007
|
+
return c.status === 200 && c.statusText === "OK" ? (console.log(`Successful PUT to ${o.href}`), t) : (t.error = await S(c), console.log(`Failed PUT to ${o.href}`), console.log(t.error), t.status = 500, t.result = !1, t);
|
|
1978
2008
|
} catch (c) {
|
|
1979
|
-
|
|
2009
|
+
t.error = c.message, t.status = 500, t.result = !1, console.log(c.message);
|
|
1980
2010
|
}
|
|
1981
|
-
return
|
|
2011
|
+
return t;
|
|
1982
2012
|
}
|
|
1983
|
-
async function
|
|
1984
|
-
let
|
|
1985
|
-
if (
|
|
1986
|
-
return
|
|
1987
|
-
let
|
|
2013
|
+
async function gt(a, e, r) {
|
|
2014
|
+
let s = new y();
|
|
2015
|
+
if (e.mail == null || e.mail == "")
|
|
2016
|
+
return s.result = !1, s.status = 500, s.error = "adminsGet: no workspace provided", s;
|
|
2017
|
+
let t = T.workspacesEndpoint(), n = new URL(t), d = { method: "GET", headers: await $(a, e) };
|
|
1988
2018
|
try {
|
|
1989
|
-
if (
|
|
2019
|
+
if (r) debugger;
|
|
1990
2020
|
console.log("Attempting GET from /workspaces endpoint: " + n.href);
|
|
1991
2021
|
let i = await fetch(n.href, d);
|
|
1992
2022
|
if (i.status === 200 && i.statusText === "OK") {
|
|
1993
2023
|
let c = await i.json();
|
|
1994
|
-
return c != null ? (
|
|
2024
|
+
return c != null ? (s.array = c, console.log(`Successful GET from /workspaces: ${s.array.reduce((f, b) => f + b.name + " ", "")}`), s) : (s.error = "Failed GET from /workspaces: failed to JSON-parse response", console.log(s.error), s.status = 500, s.result = !1, s);
|
|
1995
2025
|
} else
|
|
1996
|
-
return console.log(`Failed GET from /workspaces: ${n.href}`),
|
|
2026
|
+
return console.log(`Failed GET from /workspaces: ${n.href}`), s.error = await S(i), s.status = 500, s.result = !1, console.log(s.error), s;
|
|
1997
2027
|
} catch (i) {
|
|
1998
|
-
|
|
2028
|
+
s.error = i.message, s.status = 500, s.result = !1, console.log(i.message);
|
|
1999
2029
|
}
|
|
2000
|
-
return
|
|
2030
|
+
return s;
|
|
2001
2031
|
}
|
|
2002
|
-
async function
|
|
2003
|
-
let
|
|
2004
|
-
if (a == null ||
|
|
2005
|
-
return
|
|
2006
|
-
let
|
|
2007
|
-
n.searchParams.append("configurationId",
|
|
2008
|
-
let d = { method: "POST", headers: await
|
|
2032
|
+
async function mt(a, e, r) {
|
|
2033
|
+
let s = new y();
|
|
2034
|
+
if (a == null || e == null)
|
|
2035
|
+
return s.result = !1, s.error = "readerPost: invalid parameters", s.status = 500, s;
|
|
2036
|
+
let t = T.readerStartSyncEndpoint(), n = new URL(t);
|
|
2037
|
+
n.searchParams.append("configurationId", r.id);
|
|
2038
|
+
let d = { method: "POST", headers: await $(a, e) };
|
|
2009
2039
|
try {
|
|
2010
2040
|
console.log("Attempting POST to /startSync: " + n.href);
|
|
2011
2041
|
let i = await fetch(n.href, d);
|
|
2012
2042
|
if (i.status === 200 && i.statusText === "OK") {
|
|
2013
|
-
console.log(`Successful POST to /startSync: ${
|
|
2043
|
+
console.log(`Successful POST to /startSync: ${t}`);
|
|
2014
2044
|
let c = await i.json();
|
|
2015
|
-
return c.PayloadStr != "" ?
|
|
2045
|
+
return c.PayloadStr != "" ? s.array = JSON.parse(c.PayloadStr) : (s.result = !1, s.error = "readerPost: blank payload returned, sync may be disabled on back end", s.status = 500), s;
|
|
2016
2046
|
} else
|
|
2017
|
-
return
|
|
2047
|
+
return s.error = await S(i), console.log(`Failed POST to /startSync: ${t}`), console.log(s.error), s.status = 500, s.result = !1, s;
|
|
2018
2048
|
} catch (i) {
|
|
2019
|
-
|
|
2049
|
+
s.error = i.message, s.status = 500, s.result = !1, console.log(i.message);
|
|
2020
2050
|
}
|
|
2021
|
-
return
|
|
2051
|
+
return s;
|
|
2022
2052
|
}
|
|
2023
2053
|
export {
|
|
2024
2054
|
y as APIResult,
|
|
2025
|
-
|
|
2055
|
+
Dt as ActorArray,
|
|
2026
2056
|
ze as ActorNode,
|
|
2027
|
-
|
|
2057
|
+
kt as BatchArray,
|
|
2028
2058
|
Y as Config,
|
|
2029
|
-
|
|
2030
|
-
|
|
2059
|
+
bt as Group,
|
|
2060
|
+
At as InitInfo,
|
|
2031
2061
|
B as Milestone,
|
|
2032
2062
|
Ue as MilestoneArray,
|
|
2033
2063
|
we as ResourceArray,
|
|
2034
2064
|
Le as ResourceNode,
|
|
2035
2065
|
Q as Task,
|
|
2036
|
-
|
|
2066
|
+
$t as TaskArray,
|
|
2037
2067
|
L as Tenant,
|
|
2038
2068
|
_e as TenantConfigInfo,
|
|
2039
2069
|
Fe as TenantConfigType,
|
|
@@ -2041,60 +2071,62 @@ export {
|
|
|
2041
2071
|
Ce as TenantPermissionType,
|
|
2042
2072
|
Ne as TenantType,
|
|
2043
2073
|
X as User,
|
|
2044
|
-
|
|
2074
|
+
It as UserScope,
|
|
2045
2075
|
ee as Workspace,
|
|
2046
2076
|
et as adminDelete,
|
|
2047
2077
|
st as adminPost,
|
|
2048
2078
|
tt as adminsGet,
|
|
2079
|
+
rt as auditEventsGet,
|
|
2080
|
+
Ot as auditEventsRetrieve,
|
|
2049
2081
|
U as azureConfig,
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2082
|
+
Vt as canListRootAssignments,
|
|
2083
|
+
_t as configConsentForRead,
|
|
2084
|
+
Bt as configConsentForWrite,
|
|
2085
|
+
nt as configConsentReadPut,
|
|
2086
|
+
at as configConsentWritePut,
|
|
2087
|
+
ot as configDelete,
|
|
2088
|
+
Wt as configEdit,
|
|
2089
|
+
Ft as configEnable,
|
|
2090
|
+
it as configPatch,
|
|
2091
|
+
lt as configPost,
|
|
2092
|
+
ct as configPut,
|
|
2093
|
+
Lt as configRemove,
|
|
2062
2094
|
be as configsGet,
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2095
|
+
Ut as configsRefresh,
|
|
2096
|
+
Zt as elevateGlobalAdminToUserAccessAdmin,
|
|
2097
|
+
Kt as getPowerBIAccessToken,
|
|
2066
2098
|
F as getSyncVersion,
|
|
2067
2099
|
p as graphConfig,
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2100
|
+
vt as groupsGet,
|
|
2101
|
+
St as helloNpm,
|
|
2102
|
+
zt as initGet,
|
|
2103
|
+
dt as initPost,
|
|
2072
2104
|
T as mindlineConfig,
|
|
2073
2105
|
je as oauth2PermissionGrantsGet,
|
|
2074
2106
|
He as oauth2PermissionGrantsSet,
|
|
2075
2107
|
S as processErrors,
|
|
2076
|
-
|
|
2108
|
+
mt as readerPost,
|
|
2077
2109
|
Rt as requestAdminConsent,
|
|
2078
2110
|
qe as servicePrincipalGet,
|
|
2079
2111
|
Pt as signIn,
|
|
2080
|
-
|
|
2112
|
+
Et as signInIncrementally,
|
|
2081
2113
|
Gt as signOut,
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2114
|
+
Tt as sum,
|
|
2115
|
+
Mt as tenantAdd,
|
|
2116
|
+
ut as tenantDelete,
|
|
2117
|
+
ft as tenantPost,
|
|
2118
|
+
xt as tenantRelationshipsGetByDomain,
|
|
2087
2119
|
Je as tenantRelationshipsGetById,
|
|
2088
|
-
|
|
2120
|
+
jt as tenantRemove,
|
|
2089
2121
|
Te as tenantUnauthenticatedLookup,
|
|
2090
|
-
|
|
2091
|
-
|
|
2122
|
+
pt as tenantsGet,
|
|
2123
|
+
Ht as userAdd,
|
|
2092
2124
|
Ke as userDelegatedScopesGet,
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2125
|
+
Nt as userDelegatedScopesRemove,
|
|
2126
|
+
qt as userRemove,
|
|
2127
|
+
Ct as usersGet,
|
|
2128
|
+
Jt as workspaceEdit,
|
|
2129
|
+
ht as workspacePut,
|
|
2130
|
+
gt as workspacesGet
|
|
2099
2131
|
};
|
|
2100
2132
|
//# sourceMappingURL=sync.es.js.map
|