@mindline/sync 1.0.110 → 1.0.112

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/sync.es.js CHANGED
@@ -1,12 +1,12 @@
1
- var Ne = Object.defineProperty;
2
- var Pe = (n) => {
1
+ var Ue = Object.defineProperty;
2
+ var be = (n) => {
3
3
  throw TypeError(n);
4
4
  };
5
- var Be = (n, s, r) => s in n ? Ne(n, s, { enumerable: !0, configurable: !0, writable: !0, value: r }) : n[s] = r;
6
- var u = (n, s, r) => Be(n, typeof s != "symbol" ? s + "" : s, r), We = (n, s, r) => s.has(n) || Pe("Cannot " + r);
7
- var J = (n, s, r) => s.has(n) ? Pe("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(n) : s.set(n, r);
8
- var x = (n, s, r) => (We(n, s, "access private method"), r);
9
- import { deserializeArray as U } from "class-transformer";
5
+ var We = (n, r, s) => r in n ? Ue(n, r, { enumerable: !0, configurable: !0, writable: !0, value: s }) : n[r] = s;
6
+ var u = (n, r, s) => We(n, typeof r != "symbol" ? r + "" : r, s), Be = (n, r, s) => r.has(n) || be("Cannot " + s);
7
+ var V = (n, r, s) => r.has(n) ? be("Cannot add the same private member more than once") : r instanceof WeakSet ? r.add(n) : r.set(n, s);
8
+ var C = (n, r, s) => (Be(n, r, "access private method"), s);
9
+ import { deserializeArray as B } from "class-transformer";
10
10
  const Fe = [
11
11
  {
12
12
  oid: "1",
@@ -19,7 +19,7 @@ const Fe = [
19
19
  session: "Sign In",
20
20
  sel: !0
21
21
  }
22
- ], Ue = [
22
+ ], _e = [
23
23
  {
24
24
  tid: "1",
25
25
  name: "",
@@ -42,7 +42,7 @@ const Fe = [
42
42
  associatedConfigs: [],
43
43
  sel: !0
44
44
  }
45
- ], _e = [
45
+ ], je = [
46
46
  {
47
47
  Run: "3",
48
48
  Start: "2023-09-17T12:00:00.000-07:00",
@@ -119,7 +119,7 @@ const Fe = [
119
119
  }
120
120
  ]
121
121
  }
122
- ], je = [
122
+ ], He = [
123
123
  {
124
124
  type: "user",
125
125
  actor: "arvind@mindline.site",
@@ -138,15 +138,161 @@ const Fe = [
138
138
  updatedon: "2023-09-06T15:36:45.7760714Z",
139
139
  resources: []
140
140
  }
141
- ], F = "workspaceIDs";
142
- function Ut(n, s) {
143
- return n + s;
141
+ ];
142
+ async function Ke(n) {
143
+ try {
144
+ if (!n)
145
+ return { groups: [], error: "400: Search string is required" };
146
+ const r = `/api/graphapi/groups?search=${encodeURIComponent(n)}`, s = await fetch(r, {
147
+ method: "GET",
148
+ headers: {
149
+ "Content-Type": "application/json"
150
+ }
151
+ });
152
+ if (!s.ok)
153
+ return { groups: [], error: `${s.status}: Failed to retrieve groups` };
154
+ const t = await s.json();
155
+ return !t.success || !t.data ? { groups: [], error: t.error || "Unknown error" } : { groups: t.data.groups.map((a) => ({
156
+ id: a.id,
157
+ displayName: a.displayName,
158
+ description: a.description || ""
159
+ })), error: "" };
160
+ } catch (r) {
161
+ return console.error("Error in groupsGet:", r), { groups: [], error: `Exception: ${r.message}` };
162
+ }
163
+ }
164
+ async function ve(n, r) {
165
+ try {
166
+ if (!n || !r)
167
+ return { grants: null, id: null, error: "400: Service Principal ID and Principal ID are required" };
168
+ const s = `/api/graphapi/oauth2-permission-grants?spid=${encodeURIComponent(n)}&oid=${encodeURIComponent(r)}`, t = await fetch(s, {
169
+ method: "GET",
170
+ headers: {
171
+ "Content-Type": "application/json"
172
+ }
173
+ });
174
+ if (!t.ok)
175
+ return { grants: null, id: null, error: `${t.status}: Failed to retrieve permission grants` };
176
+ const e = await t.json();
177
+ return !e.success || !e.data ? { grants: null, id: null, error: e.error || "Unknown error" } : {
178
+ grants: e.data.grants,
179
+ id: e.data.id,
180
+ error: ""
181
+ };
182
+ } catch (s) {
183
+ return console.error("Error in oauth2PermissionGrantsGet:", s), { grants: null, id: null, error: `Exception: ${s.message}` };
184
+ }
185
+ }
186
+ async function De(n, r) {
187
+ try {
188
+ if (!n || !r)
189
+ return console.error("oauth2PermissionGrantsSet: ID and scopes are required"), !1;
190
+ const s = `/api/graphapi/oauth2-permission-grants/${encodeURIComponent(n)}`, t = await fetch(s, {
191
+ method: "PATCH",
192
+ headers: {
193
+ "Content-Type": "application/json"
194
+ },
195
+ body: JSON.stringify({ scopes: r })
196
+ });
197
+ if (!t.ok)
198
+ return console.error(`oauth2PermissionGrantsSet: PATCH failed with status ${t.status}`), !1;
199
+ const e = await t.json();
200
+ return !e.success || !e.data ? (console.error(`oauth2PermissionGrantsSet: ${e.error}`), !1) : e.data;
201
+ } catch (s) {
202
+ return console.error("Error in oauth2PermissionGrantsSet:", s), !1;
203
+ }
204
+ }
205
+ async function ke(n) {
206
+ try {
207
+ if (!n)
208
+ return { spid: "", error: "400: Application ID is required" };
209
+ const r = `/api/graphapi/service-principals?appId=${encodeURIComponent(n)}`, s = await fetch(r, {
210
+ method: "GET",
211
+ headers: {
212
+ "Content-Type": "application/json"
213
+ }
214
+ });
215
+ if (!s.ok)
216
+ return { spid: "", error: `${s.status}: Failed to retrieve service principal` };
217
+ const t = await s.json();
218
+ return !t.success || !t.data ? { spid: "", error: t.error || "Unknown error" } : { spid: t.data.servicePrincipalId, error: "" };
219
+ } catch (r) {
220
+ return console.error("Error in servicePrincipalGet:", r), { spid: "", error: `Exception: ${r.message}` };
221
+ }
222
+ }
223
+ async function qe(n) {
224
+ try {
225
+ const r = n ? `/api/graphapi/users?search=${encodeURIComponent(n)}` : "/api/graphapi/users", s = await fetch(r, {
226
+ method: "GET",
227
+ headers: {
228
+ "Content-Type": "application/json"
229
+ }
230
+ });
231
+ if (!s.ok)
232
+ return { users: [], error: `${s.status}: Failed to retrieve users` };
233
+ const t = await s.json();
234
+ return !t.success || !t.data ? { users: [], error: t.error || "Unknown error" } : { users: t.data.users.map((a) => a.mail || a.userPrincipalName || a.displayName), error: "" };
235
+ } catch (r) {
236
+ return console.error("Error in usersGet:", r), { users: [], error: `Exception: ${r.message}` };
237
+ }
238
+ }
239
+ async function Je() {
240
+ try {
241
+ const r = await fetch("/api/azuremanagement/can-list-root-assignments", {
242
+ method: "GET",
243
+ headers: {
244
+ "Content-Type": "application/json"
245
+ }
246
+ });
247
+ if (!r.ok)
248
+ return console.error(`canListRootAssignments: Request failed with status ${r.status}`), !1;
249
+ const s = await r.json();
250
+ return !s.success || !s.data ? (console.error(`canListRootAssignments: ${s.error}`), !1) : s.data.canList;
251
+ } catch (n) {
252
+ return console.error("Error in canListRootAssignments:", n), !1;
253
+ }
254
+ }
255
+ async function Ve() {
256
+ try {
257
+ const r = await fetch("/api/azuremanagement/elevate-access", {
258
+ method: "POST",
259
+ headers: {
260
+ "Content-Type": "application/json"
261
+ }
262
+ });
263
+ if (!r.ok)
264
+ return console.error(`elevateGlobalAdminToUserAccessAdmin: Request failed with status ${r.status}`), !1;
265
+ const s = await r.json();
266
+ return !s.success || !s.data ? (console.error(`elevateGlobalAdminToUserAccessAdmin: ${s.error}`), !1) : s.data.success;
267
+ } catch (n) {
268
+ return console.error("Error in elevateGlobalAdminToUserAccessAdmin:", n), !1;
269
+ }
270
+ }
271
+ async function Ze() {
272
+ try {
273
+ const r = await fetch("/api/azuremanagement/resources", {
274
+ method: "GET",
275
+ headers: {
276
+ "Content-Type": "application/json"
277
+ }
278
+ });
279
+ if (!r.ok)
280
+ return console.error(`readResources: Request failed with status ${r.status}`), [];
281
+ const s = await r.json();
282
+ return !s.success || !s.data ? (console.error(`readResources: ${s.error}`), []) : s.data.resources;
283
+ } catch (n) {
284
+ return console.error("Error in readResources:", n), [];
285
+ }
286
+ }
287
+ const W = "workspaceIDs";
288
+ function _t(n, r) {
289
+ return n + r;
144
290
  }
145
291
  function Lt() {
146
292
  return "hello NPM";
147
293
  }
148
- function L() {
149
- return "1.0.110";
294
+ function F() {
295
+ return "1.0.112";
150
296
  }
151
297
  class m {
152
298
  constructor() {
@@ -155,73 +301,73 @@ class m {
155
301
  u(this, "error");
156
302
  u(this, "version");
157
303
  u(this, "array");
158
- this.result = !0, this.status = 200, this.error = "", this.version = L(), this.array = null;
304
+ this.result = !0, this.status = 200, this.error = "", this.version = F(), this.array = null;
159
305
  }
160
306
  }
161
- class M {
307
+ class Ee {
162
308
  }
163
309
  // azure graph REST API endpoints
164
- u(M, "azureElevateAccess", "https://management.azure.com/providers/Microsoft.Authorization/elevateAccess?api-version=2016-07-01"), u(M, "azureListRootAssignments", "https://management.azure.com/providers/Microsoft.Authorization/roleAssignments?api-version=2022-04-01&$filter=principalId+eq+");
165
- const $ = class $ {
310
+ u(Ee, "azureElevateAccess", "https://management.azure.com/providers/Microsoft.Authorization/elevateAccess?api-version=2016-07-01"), u(Ee, "azureListRootAssignments", "https://management.azure.com/providers/Microsoft.Authorization/roleAssignments?api-version=2022-04-01&$filter=principalId+eq+");
311
+ const b = class b {
166
312
  // config API endpoints
167
313
  static adminEndpoint() {
168
- return `https://${$.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/admin`;
314
+ return `https://${b.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/admin`;
169
315
  }
170
316
  static adminIncompleteEndpoint() {
171
- return `https://${$.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/incomplete-admin`;
317
+ return `https://${b.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/incomplete-admin`;
172
318
  }
173
319
  static adminsEndpoint() {
174
- return `https://${$.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/admins`;
320
+ return `https://${b.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/admins`;
175
321
  }
176
322
  static auditConfigEndpoint() {
177
- return `https://${$.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/audit-configuration`;
323
+ return `https://${b.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/audit-configuration`;
178
324
  }
179
325
  static auditEventsEndpoint() {
180
- return `https://${$.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/audit-events`;
326
+ return `https://${b.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/audit-events`;
181
327
  }
182
328
  static configConsentEndpoint() {
183
- return `https://${$.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/configuration/consent`;
329
+ return `https://${b.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/configuration/consent`;
184
330
  }
185
331
  static configEnabledEndpoint() {
186
- return `https://${$.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/configuration/status`;
332
+ return `https://${b.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/configuration/status`;
187
333
  }
188
334
  static configEndpoint() {
189
- return `https://${$.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/configuration`;
335
+ return `https://${b.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/configuration`;
190
336
  }
191
337
  static configsEndpoint() {
192
- return `https://${$.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/configurations`;
338
+ return `https://${b.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/configurations`;
193
339
  }
194
340
  static initEndpoint() {
195
- return `https://${$.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/configuration/init`;
341
+ return `https://${b.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/configuration/init`;
196
342
  }
197
343
  static readerStartSyncEndpoint() {
198
- return `https://${$.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/startSync`;
344
+ return `https://${b.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/startSync`;
199
345
  }
200
346
  static tenantEndpoint() {
201
- return `https://${$.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/tenant`;
347
+ return `https://${b.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/tenant`;
202
348
  }
203
349
  static tenantsEndpoint() {
204
- return `https://${$.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/tenants`;
350
+ return `https://${b.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/tenants`;
205
351
  }
206
352
  static workspaceEndpoint() {
207
- return `https://${$.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/workspace`;
353
+ return `https://${b.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/workspace`;
208
354
  }
209
355
  static workspacesEndpoint() {
210
- return `https://${$.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/workspaces`;
356
+ return `https://${b.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/workspaces`;
211
357
  }
212
358
  static workspaceConfigsEndpoint() {
213
- return `https://${$.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/workspace-configurations`;
359
+ return `https://${b.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/workspace-configurations`;
214
360
  }
215
361
  // SignalR endpoint
216
362
  static signalREndpoint() {
217
- return `https://${$.environmentTag}-signalrdispatcher-westus.azurewebsites.net/statsHub`;
363
+ return `https://${b.environmentTag}-signalrdispatcher-westus.azurewebsites.net/statsHub`;
218
364
  }
219
365
  static statsEndpoint() {
220
- return `https://${$.environmentTag}-signalrdispatcher-westus.azurewebsites.net/api/stats`;
366
+ return `https://${b.environmentTag}-signalrdispatcher-westus.azurewebsites.net/api/stats`;
221
367
  }
222
368
  };
223
- u($, "environmentTag", "dev");
224
- let S = $;
369
+ u(b, "environmentTag", "dev");
370
+ let T = b;
225
371
  class h {
226
372
  }
227
373
  // graph API predicates
@@ -234,7 +380,7 @@ class zt {
234
380
  u(this, "description", "");
235
381
  }
236
382
  }
237
- class _t {
383
+ class jt {
238
384
  constructor() {
239
385
  u(this, "group", "");
240
386
  u(this, "value", "");
@@ -242,14 +388,14 @@ class _t {
242
388
  u(this, "removable", !1);
243
389
  u(this, "expanded", "");
244
390
  }
245
- static compareByValue(s, r) {
246
- return s.value.localeCompare(r.value);
391
+ static compareByValue(r, s) {
392
+ return r.value.localeCompare(s.value);
247
393
  }
248
- static compareByGroup(s, r) {
249
- return s.group.localeCompare(r.group);
394
+ static compareByGroup(r, s) {
395
+ return r.group.localeCompare(s.group);
250
396
  }
251
397
  }
252
- class fe {
398
+ class ie {
253
399
  // set when the user is logging in to support spinner visibility
254
400
  constructor() {
255
401
  u(this, "oid");
@@ -282,7 +428,7 @@ class fe {
282
428
  this.oid = "", this.name = "", this.mail = "", this.authority = "", this.tid = "", this.companyName = "", this.companyDomain = "", this.workspaceIDs = "", this.session = "Sign In", this.spacode = "", this.graphAccessToken = "", this.mindlineAccessToken = "", this.azureAccessToken = "", this.loginHint = "", this.scopes = new Array(), this.authTS = /* @__PURE__ */ new Date(0), this.sel = !1, this.loggingIn = !1;
283
429
  }
284
430
  }
285
- var He = /* @__PURE__ */ ((n) => (n[n.invalid = 0] = "invalid", n[n.aad = 1] = "aad", n[n.ad = 2] = "ad", n[n.googleworkspace = 3] = "googleworkspace", n))(He || {}), qe = /* @__PURE__ */ ((n) => (n[n.read = 1] = "read", n[n.write = 2] = "write", n[n.notassigned = 3] = "notassigned", n))(qe || {});
431
+ var Qe = /* @__PURE__ */ ((n) => (n[n.invalid = 0] = "invalid", n[n.aad = 1] = "aad", n[n.ad = 2] = "ad", n[n.googleworkspace = 3] = "googleworkspace", n))(Qe || {}), Xe = /* @__PURE__ */ ((n) => (n[n.read = 1] = "read", n[n.write = 2] = "write", n[n.notassigned = 3] = "notassigned", n))(Xe || {});
286
432
  class j {
287
433
  // are we validating by TID or by domain? "Domain" | "Tenant ID"
288
434
  constructor() {
@@ -300,20 +446,20 @@ class j {
300
446
  this.tid = "", this.name = "", this.domain = "", this.tenantType = "aad", this.authority = "", this.workspaceIDs = "", this.sel = !1, this.graphSP = "", this.lookupfield = "Domain";
301
447
  }
302
448
  }
303
- function Qe(n, s) {
449
+ function Ye(n, r) {
304
450
  switch (n) {
305
451
  case h.authorityWW:
306
- return s === 1 ? "85d35da2-4118-4b03-aa05-605cedd7f2f8" : "63100afe-506e-4bb2-8ff7-d8d5ab373129";
452
+ return r === 1 ? "85d35da2-4118-4b03-aa05-605cedd7f2f8" : "63100afe-506e-4bb2-8ff7-d8d5ab373129";
307
453
  case h.authorityUS:
308
- return s === 1 ? "b08630c7-e227-4215-9746-afc9286fb864" : "17aa5d5a-f09f-4cec-87a6-28596f9fa513";
454
+ return r === 1 ? "b08630c7-e227-4215-9746-afc9286fb864" : "17aa5d5a-f09f-4cec-87a6-28596f9fa513";
309
455
  case h.authorityCN:
310
- return s === 1 ? "7db7293b-add9-4a3f-8562-1a20bfe27d5e" : "debd015b-1154-4111-a4cb-fc220a537697";
456
+ return r === 1 ? "7db7293b-add9-4a3f-8562-1a20bfe27d5e" : "debd015b-1154-4111-a4cb-fc220a537697";
311
457
  default:
312
458
  debugger;
313
459
  return "";
314
460
  }
315
461
  }
316
- function W(n) {
462
+ function Pe(n) {
317
463
  switch (n) {
318
464
  case h.authorityWW:
319
465
  return "https://graph.microsoft.com/";
@@ -326,7 +472,7 @@ function W(n) {
326
472
  return "";
327
473
  }
328
474
  }
329
- function Ke(n) {
475
+ function et(n) {
330
476
  switch (n) {
331
477
  case h.authorityWW:
332
478
  return "https://login.microsoftonline.com/";
@@ -339,8 +485,8 @@ function Ke(n) {
339
485
  return "";
340
486
  }
341
487
  }
342
- var Je = /* @__PURE__ */ ((n) => (n[n.source = 1] = "source", n[n.target = 2] = "target", n[n.sourcetarget = 3] = "sourcetarget", n))(Je || {});
343
- class Ve {
488
+ var tt = /* @__PURE__ */ ((n) => (n[n.source = 1] = "source", n[n.target = 2] = "target", n[n.sourcetarget = 3] = "sourcetarget", n))(tt || {});
489
+ class st {
344
490
  constructor() {
345
491
  u(this, "tid");
346
492
  u(this, "sourceGroupId");
@@ -357,7 +503,7 @@ class Ve {
357
503
  this.tid = "", this.sourceGroupId = "", this.sourceGroupName = "", this.targetGroupId = "", this.targetGroupName = "", this.configurationTenantType = "source", this.deltaToken = "", this.usersWritten = 0, this.configId = "", this.batchId = "", this.isReadPermissionConsented = !1, this.isWritePermissionConsented = !1;
358
504
  }
359
505
  }
360
- class pe {
506
+ class le {
361
507
  // selection state
362
508
  constructor() {
363
509
  u(this, "id");
@@ -386,7 +532,7 @@ class Mt {
386
532
  this.id = "", this.name = "", this.workspaceId = "", this.description = "", this.isEnabled = !1, this.isReadPermissionConsented = !1, this.email = "", this.tenantId = "", this.sel = !1;
387
533
  }
388
534
  }
389
- class he {
535
+ class ue {
390
536
  // selection state
391
537
  constructor() {
392
538
  u(this, "id");
@@ -399,27 +545,27 @@ class he {
399
545
  this.id = "", this.name = "", this.ownerid = "", this.associatedUsers = new Array(), this.associatedTenants = new Array(), this.associatedConfigs = new Array(), this.sel = !1;
400
546
  }
401
547
  }
402
- function R() {
548
+ function P() {
403
549
  let n;
404
550
  try {
405
551
  n = window.localStorage;
406
- const s = "__storage_test__";
407
- return n.setItem(s, s), n.removeItem(s), !0;
408
- } catch (s) {
409
- return s instanceof DOMException && // everything except Firefox
410
- (s.code === 22 || // Firefox
411
- s.code === 1014 || // test name field too, because code might not be present
552
+ const r = "__storage_test__";
553
+ return n.setItem(r, r), n.removeItem(r), !0;
554
+ } catch (r) {
555
+ return r instanceof DOMException && // everything except Firefox
556
+ (r.code === 22 || // Firefox
557
+ r.code === 1014 || // test name field too, because code might not be present
412
558
  // everything except Firefox
413
- s.name === "QuotaExceededError" || // Firefox
414
- s.name === "NS_ERROR_DOM_QUOTA_REACHED") && // acknowledge QuotaExceededError only if there's something already stored
559
+ r.name === "QuotaExceededError" || // Firefox
560
+ r.name === "NS_ERROR_DOM_QUOTA_REACHED") && // acknowledge QuotaExceededError only if there's something already stored
415
561
  n && n.length !== 0;
416
562
  }
417
563
  }
418
- var V, Ge;
419
- class jt {
420
- constructor(s = !1) {
421
- J(this, V);
422
- u(this, "version", L());
564
+ var Z, Re;
565
+ class Ht {
566
+ constructor(r = !1) {
567
+ V(this, Z);
568
+ u(this, "version", F());
423
569
  u(this, "tab", 0);
424
570
  u(this, "us", []);
425
571
  u(this, "ts", []);
@@ -428,56 +574,56 @@ class jt {
428
574
  u(this, "ws", []);
429
575
  u(this, "configlevelconsent_configid", "");
430
576
  u(this, "configlevelconsent_access", 3);
431
- this.init(s);
577
+ this.init(r);
432
578
  }
433
579
  // get initial data from localStorage or file
434
- init(s) {
435
- if (console.log(`Calling InitInfo::init(bClearLocalStorage: ${s ? "true" : "false"})`), R()) {
580
+ init(r) {
581
+ if (console.log(`Calling InitInfo::init(bClearLocalStorage: ${r ? "true" : "false"})`), P()) {
436
582
  let o = localStorage.getItem("InitInfo");
437
583
  if (o != null && typeof o == "string" && o !== "") {
438
584
  let i = JSON.parse(o);
439
585
  if (i.us.length !== 0)
440
- if (s)
586
+ if (r)
441
587
  localStorage.removeItem("InitInfo");
442
588
  else {
443
- x(this, V, Ge).call(this, i);
589
+ C(this, Z, Re).call(this, i);
444
590
  return;
445
591
  }
446
592
  }
447
593
  }
448
- this.tab = 0, this.version = L(), this.configlevelconsent_configid = "", this.configlevelconsent_access = 3;
449
- var r = JSON.stringify(Fe), t = JSON.stringify(Ue), e = JSON.stringify(Le), a = JSON.stringify(ze);
594
+ this.tab = 0, this.version = F(), this.configlevelconsent_configid = "", this.configlevelconsent_access = 3;
595
+ var s = JSON.stringify(Fe), t = JSON.stringify(_e), e = JSON.stringify(Le), a = JSON.stringify(ze);
450
596
  try {
451
- this.us = U(fe, r), this.ts = U(j, t), this.cs = U(pe, e), this.ws = U(he, a), this.tagWithWorkspaces();
597
+ this.us = B(ie, s), this.ts = B(j, t), this.cs = B(le, e), this.ws = B(ue, a), this.tagWithWorkspaces();
452
598
  } catch {
453
599
  debugger;
454
600
  }
455
601
  }
456
602
  save() {
457
- let s = JSON.stringify(this);
458
- localStorage.setItem("InitInfo", s);
603
+ let r = JSON.stringify(this);
604
+ localStorage.setItem("InitInfo", r);
459
605
  }
460
606
  tagWithWorkspaces() {
461
- this.us.map((s) => s.workspaceIDs = ""), this.ts.map((s) => s.workspaceIDs = ""), this.cs.map((s) => s.workspaceIDs = "");
462
- for (let s of this.ws) {
463
- for (let r of s.associatedUsers) {
464
- let t = this.us.find((e) => e.oid === r);
607
+ this.us.map((r) => r.workspaceIDs = ""), this.ts.map((r) => r.workspaceIDs = ""), this.cs.map((r) => r.workspaceIDs = "");
608
+ for (let r of this.ws) {
609
+ for (let s of r.associatedUsers) {
610
+ let t = this.us.find((e) => e.oid === s);
465
611
  if (t !== void 0)
466
- t[F] += s.id, t[F] += " ";
612
+ t[W] += r.id, t[W] += " ";
467
613
  else
468
614
  debugger;
469
615
  }
470
- for (let r of s.associatedTenants) {
471
- let t = this.ts.find((e) => e.tid === r);
616
+ for (let s of r.associatedTenants) {
617
+ let t = this.ts.find((e) => e.tid === s);
472
618
  if (t !== void 0)
473
- t[F] += s.id, t[F] += " ";
619
+ t[W] += r.id, t[W] += " ";
474
620
  else
475
621
  debugger;
476
622
  }
477
- for (let r of s.associatedConfigs) {
478
- let t = this.cs.find((e) => e.id === r);
623
+ for (let s of r.associatedConfigs) {
624
+ let t = this.cs.find((e) => e.id === s);
479
625
  if (t !== void 0)
480
- t[F] += s.id, t[F] += " ";
626
+ t[W] += r.id, t[W] += " ";
481
627
  else
482
628
  debugger;
483
629
  }
@@ -485,22 +631,22 @@ class jt {
485
631
  return !0;
486
632
  }
487
633
  }
488
- V = new WeakSet(), Ge = function(s) {
489
- this.tab = s.tab, this.version = L(), this.configlevelconsent_configid = s.configlevelconsent_configid, this.configlevelconsent_access = s.configlevelconsent_access, typeof s.us > "u" ? this.us = new Array() : this.us = s.us.map((r) => {
490
- let t = new fe();
491
- return t.oid = r.oid, t.name = r.name, t.mail = r.mail, t.authority = r.authority, t.tid = r.tid, t.companyName = r.companyName, t.companyDomain = r.companyDomain, t.workspaceIDs = r.workspaceIDs, t.session = r.session, t.spacode = r.spacode, t.graphAccessToken = r.graphAccessToken, t.mindlineAccessToken = r.mindlineAccessToken, t.azureAccessToken = r.azureAccessToken, t.loginHint = r.loginHint, t.scopes = r.scopes, t.authTS = new Date(r.authTS), t.sel = r.sel, t.loggingIn = r.loggingIn, t;
492
- }), typeof s.ts > "u" ? this.ts = new Array() : this.ts = s.ts.map((r) => {
634
+ Z = new WeakSet(), Re = function(r) {
635
+ this.tab = r.tab, this.version = F(), this.configlevelconsent_configid = r.configlevelconsent_configid, this.configlevelconsent_access = r.configlevelconsent_access, typeof r.us > "u" ? this.us = new Array() : this.us = r.us.map((s) => {
636
+ let t = new ie();
637
+ return t.oid = s.oid, t.name = s.name, t.mail = s.mail, t.authority = s.authority, t.tid = s.tid, t.companyName = s.companyName, t.companyDomain = s.companyDomain, t.workspaceIDs = s.workspaceIDs, t.session = s.session, t.spacode = s.spacode, t.graphAccessToken = s.graphAccessToken, t.mindlineAccessToken = s.mindlineAccessToken, t.azureAccessToken = s.azureAccessToken, t.loginHint = s.loginHint, t.scopes = s.scopes, t.authTS = new Date(s.authTS), t.sel = s.sel, t.loggingIn = s.loggingIn, t;
638
+ }), typeof r.ts > "u" ? this.ts = new Array() : this.ts = r.ts.map((s) => {
493
639
  let t = new j();
494
- return t.tid = r.tid, t.name = r.name, t.domain = r.domain, t.tenantType = r.tenantType, t.authority = r.authority, t.workspaceIDs = r.workspaceIDs, t.sel = r.sel, t.lookupfield = r.lookupfield, t;
495
- }), typeof s.cs > "u" ? this.cs = new Array() : this.cs = s.cs.map((r) => {
496
- let t = new pe();
497
- return t.id = r.id, t.workspaceId = r.workspaceId, t.name = r.name, t.description = r.description, t.tenants = r.tenants, t.isEnabled = r.isEnabled, t.workspaceIDs = r.workspaceIDs, t.sel = r.sel, t;
498
- }), typeof s.ws > "u" ? this.ws = new Array() : this.ws = s.ws.map((r) => {
499
- let t = new he();
500
- return t.id = r.id, t.name = r.name, t.ownerid = r.ownerid, t.associatedUsers = r.associatedUsers, t.associatedTenants = r.associatedTenants, t.associatedConfigs = r.associatedConfigs, t.sel = r.sel, t;
640
+ return t.tid = s.tid, t.name = s.name, t.domain = s.domain, t.tenantType = s.tenantType, t.authority = s.authority, t.workspaceIDs = s.workspaceIDs, t.sel = s.sel, t.lookupfield = s.lookupfield, t;
641
+ }), typeof r.cs > "u" ? this.cs = new Array() : this.cs = r.cs.map((s) => {
642
+ let t = new le();
643
+ return t.id = s.id, t.workspaceId = s.workspaceId, t.name = s.name, t.description = s.description, t.tenants = s.tenants, t.isEnabled = s.isEnabled, t.workspaceIDs = s.workspaceIDs, t.sel = s.sel, t;
644
+ }), typeof r.ws > "u" ? this.ws = new Array() : this.ws = r.ws.map((s) => {
645
+ let t = new ue();
646
+ return t.id = s.id, t.name = s.name, t.ownerid = s.ownerid, t.associatedUsers = s.associatedUsers, t.associatedTenants = s.associatedTenants, t.associatedConfigs = s.associatedConfigs, t.sel = s.sel, t;
501
647
  });
502
648
  };
503
- const Ze = [
649
+ const rt = [
504
650
  {
505
651
  id: 1,
506
652
  task: "initialization",
@@ -553,37 +699,37 @@ const Ze = [
553
699
  ]
554
700
  }
555
701
  ];
556
- var G, ge, me, ye;
557
- class Ht {
558
- constructor(s) {
559
- J(this, G);
702
+ var G, ce, de, pe;
703
+ class Kt {
704
+ constructor(r) {
705
+ V(this, G);
560
706
  u(this, "tasks");
561
- this.tasks = [new ce()], this.init(s);
707
+ this.tasks = [new oe()], this.init(r);
562
708
  }
563
709
  // get initial data from localStorage or file
564
- init(s) {
565
- if (console.log(`Calling TaskArray::init(bClearLocalStorage: ${s ? "true" : "false"})`), this.tasks.length = 0, s && R() && localStorage.removeItem("Tasks"), R()) {
566
- let r = localStorage.getItem("Tasks");
567
- if (r != null && typeof r == "string" && r !== "") {
568
- let e = JSON.parse(r);
569
- if (this.tasks = x(this, G, me).call(this, e.tasks), this.tasks.length !== 0) return;
710
+ init(r) {
711
+ if (console.log(`Calling TaskArray::init(bClearLocalStorage: ${r ? "true" : "false"})`), this.tasks.length = 0, r && P() && localStorage.removeItem("Tasks"), P()) {
712
+ let s = localStorage.getItem("Tasks");
713
+ if (s != null && typeof s == "string" && s !== "") {
714
+ let e = JSON.parse(s);
715
+ if (this.tasks = C(this, G, de).call(this, e.tasks), this.tasks.length !== 0) return;
570
716
  }
571
717
  }
572
- this.tasks = x(this, G, me).call(this, Ze);
718
+ this.tasks = C(this, G, de).call(this, rt);
573
719
  }
574
720
  // set start time for a task
575
- setTaskStart(s, r) {
576
- let t = x(this, G, ge).call(this, s);
721
+ setTaskStart(r, s) {
722
+ let t = C(this, G, ce).call(this, r);
577
723
  if (t != null && t != null)
578
- t.setStart(r), t.status = "in progress", x(this, G, ye).call(this);
724
+ t.setStart(s), t.status = "in progress", C(this, G, pe).call(this);
579
725
  else
580
726
  debugger;
581
727
  }
582
728
  // set end time for a task
583
- setTaskEnd(s, r, t) {
584
- let e = x(this, G, ge).call(this, s);
729
+ setTaskEnd(r, s, t) {
730
+ let e = C(this, G, ce).call(this, r);
585
731
  if (e != null && e != null)
586
- e.setEnd(r), e.status = t, x(this, G, ye).call(this);
732
+ e.setEnd(s), e.status = t, C(this, G, pe).call(this);
587
733
  else
588
734
  debugger;
589
735
  }
@@ -591,27 +737,27 @@ class Ht {
591
737
  G = new WeakSet(), //
592
738
  // private
593
739
  //
594
- ge = function(s) {
595
- let r = this.tasks.find((t) => t.task == s);
596
- if (r == null || r == null) {
597
- for (r of this.tasks)
598
- if (r.subtasks != null && r.subtasks != null && (r = r.subtasks.find((t) => t.task == s), r != null && r != null))
740
+ ce = function(r) {
741
+ let s = this.tasks.find((t) => t.task == r);
742
+ if (s == null || s == null) {
743
+ for (s of this.tasks)
744
+ if (s.subtasks != null && s.subtasks != null && (s = s.subtasks.find((t) => t.task == r), s != null && s != null))
599
745
  break;
600
746
  }
601
- return r;
602
- }, me = function(s) {
603
- return s.map((r) => {
604
- let t = new ce();
605
- return t.id = r.id, t.task = r.task, t.setStart(new Date(r.start)), t.setEnd(new Date(r.end)), t.expected = r.expected, t.status = r.status, t.expanded = r.expanded, typeof r.subtasks < "u" && r.subtasks != null && (t.subtasks = r.subtasks.map((e) => {
606
- let a = new ce();
747
+ return s;
748
+ }, de = function(r) {
749
+ return r.map((s) => {
750
+ let t = new oe();
751
+ return t.id = s.id, t.task = s.task, t.setStart(new Date(s.start)), t.setEnd(new Date(s.end)), t.expected = s.expected, t.status = s.status, t.expanded = s.expanded, typeof s.subtasks < "u" && s.subtasks != null && (t.subtasks = s.subtasks.map((e) => {
752
+ let a = new oe();
607
753
  return a.id = e.id, a.task = e.task, a.setStart(new Date(e.start)), a.setEnd(new Date(e.end)), a.expected = e.expected, a.status = e.status, a.expanded = e.expanded, a;
608
754
  })), t;
609
755
  });
610
- }, ye = function() {
611
- let s = JSON.stringify(this);
612
- R() && localStorage.setItem("Tasks", s);
756
+ }, pe = function() {
757
+ let r = JSON.stringify(this);
758
+ P() && localStorage.setItem("Tasks", r);
613
759
  };
614
- class ce {
760
+ class oe {
615
761
  constructor() {
616
762
  u(this, "id", 0);
617
763
  u(this, "task", "");
@@ -625,19 +771,19 @@ class ce {
625
771
  u(this, "expanded", !1);
626
772
  u(this, "subtasks", []);
627
773
  }
628
- setEnd(s) {
629
- this.end = s, this.endDisplay = `${this.end.getMinutes().toString().padStart(2, "0")}:${this.end.getSeconds().toString().padStart(2, "0")}`;
630
- let r = 0, t = this.end.getSeconds() - this.start.getSeconds();
631
- t < 0 && (t += 60, r = -1);
632
- let e = this.end.getMinutes() - this.start.getMinutes() + r;
774
+ setEnd(r) {
775
+ this.end = r, this.endDisplay = `${this.end.getMinutes().toString().padStart(2, "0")}:${this.end.getSeconds().toString().padStart(2, "0")}`;
776
+ let s = 0, t = this.end.getSeconds() - this.start.getSeconds();
777
+ t < 0 && (t += 60, s = -1);
778
+ let e = this.end.getMinutes() - this.start.getMinutes() + s;
633
779
  e < 0 && (e += 60), this.elapsedDisplay = `${e.toString().padStart(2, "0")}:${t.toString().padStart(2, "0")}`;
634
780
  }
635
- setStart(s) {
636
- this.start = s, this.startDisplay = `${this.start.getMinutes().toString().padStart(2, "0")}:${this.start.getSeconds().toString().padStart(2, "0")}`;
781
+ setStart(r) {
782
+ this.start = r, this.startDisplay = `${this.start.getMinutes().toString().padStart(2, "0")}:${this.start.getSeconds().toString().padStart(2, "0")}`;
637
783
  }
638
784
  }
639
- class _ {
640
- constructor(s) {
785
+ class z {
786
+ constructor(r) {
641
787
  u(this, "Run", 0);
642
788
  u(this, "Start", /* @__PURE__ */ new Date());
643
789
  u(this, "startDisplay", "");
@@ -649,108 +795,108 @@ class _ {
649
795
  u(this, "writeDisplay");
650
796
  u(this, "Duration");
651
797
  u(this, "durationDisplay");
652
- this.Run = s, 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 = "";
798
+ this.Run = r, 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 = "";
653
799
  }
654
- start(s) {
655
- s == "" ? this.Start = /* @__PURE__ */ new Date() : this.Start = new Date(s), this.startDisplay = `${this.Start.getMinutes().toString().padStart(2, "0")}:${this.Start.getSeconds().toString().padStart(2, "0")}`;
800
+ start(r) {
801
+ r == "" ? this.Start = /* @__PURE__ */ new Date() : this.Start = new Date(r), this.startDisplay = `${this.Start.getMinutes().toString().padStart(2, "0")}:${this.Start.getSeconds().toString().padStart(2, "0")}`;
656
802
  }
657
- post(s) {
658
- s == "" ? this.POST = /* @__PURE__ */ new Date() : this.POST = new Date(s), this.postDisplay = `${this.POST.getMinutes().toString().padStart(2, "0")}:${this.POST.getSeconds().toString().padStart(2, "0")}`;
803
+ post(r) {
804
+ r == "" ? this.POST = /* @__PURE__ */ new Date() : this.POST = new Date(r), this.postDisplay = `${this.POST.getMinutes().toString().padStart(2, "0")}:${this.POST.getSeconds().toString().padStart(2, "0")}`;
659
805
  }
660
- read(s) {
661
- s == "" ? this.Read = /* @__PURE__ */ new Date() : this.Read = new Date(s), this.readDisplay = `${this.Read.getMinutes().toString().padStart(2, "0")}:${this.Read.getSeconds().toString().padStart(2, "0")}`;
806
+ read(r) {
807
+ r == "" ? this.Read = /* @__PURE__ */ new Date() : this.Read = new Date(r), this.readDisplay = `${this.Read.getMinutes().toString().padStart(2, "0")}:${this.Read.getSeconds().toString().padStart(2, "0")}`;
662
808
  }
663
- write(s) {
664
- s == "" ? this.Write = /* @__PURE__ */ new Date() : this.Write = new Date(s), 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")}`;
809
+ write(r) {
810
+ r == "" ? this.Write = /* @__PURE__ */ new Date() : this.Write = new Date(r), 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")}`;
665
811
  }
666
812
  }
667
- var H, we;
668
- class Xe {
669
- constructor(s) {
670
- J(this, H);
813
+ var M, fe;
814
+ class at {
815
+ constructor(r) {
816
+ V(this, M);
671
817
  u(this, "milestones", []);
672
- this.init(s);
818
+ this.init(r);
673
819
  }
674
- init(s) {
675
- if (R()) {
676
- let r = localStorage.getItem("syncmilestones");
677
- if (r != null && typeof r == "string" && r !== "") {
678
- let e = JSON.parse(r);
820
+ init(r) {
821
+ if (P()) {
822
+ let s = localStorage.getItem("syncmilestones");
823
+ if (s != null && typeof s == "string" && s !== "") {
824
+ let e = JSON.parse(s);
679
825
  if (e.length !== 0)
680
- if (s)
826
+ if (r)
681
827
  localStorage.removeItem("syncmilestones");
682
828
  else {
683
- x(this, H, we).call(this, e);
829
+ C(this, M, fe).call(this, e);
684
830
  return;
685
831
  }
686
832
  }
687
833
  }
688
- x(this, H, we).call(this, _e);
834
+ C(this, M, fe).call(this, je);
689
835
  }
690
836
  save() {
691
- let s = JSON.stringify(this.milestones);
692
- R() && localStorage.setItem("syncmilestones", s);
837
+ let r = JSON.stringify(this.milestones);
838
+ P() && localStorage.setItem("syncmilestones", r);
693
839
  }
694
840
  // milestone tracking during a sync
695
- start(s) {
841
+ start(r) {
696
842
  if (this.milestones == null || this.milestones.length < 1) {
697
843
  debugger;
698
844
  return;
699
845
  }
700
- let r = Number(this.milestones[0].Run), t = new _(r + 1);
846
+ let s = Number(this.milestones[0].Run), t = new z(s + 1);
701
847
  this.milestones.unshift(t), this.milestones = this.milestones.map((e) => {
702
- let a = new _(e.Run);
848
+ let a = new z(e.Run);
703
849
  return a.Start = e.Start, a.startDisplay = e.startDisplay, a.POST = e.POST, a.postDisplay = e.postDisplay, a.Read = e.Read, a.readDisplay = e.readDisplay, a.Write = e.Write, a.writeDisplay = e.writeDisplay, a.Duration = e.Duration, a.durationDisplay = e.durationDisplay, a;
704
- }), s(this.milestones), console.log(`Start milestone: ${this.milestones[0].Run}:${this.milestones[0].Start}`);
850
+ }), r(this.milestones), console.log(`Start milestone: ${this.milestones[0].Run}:${this.milestones[0].Start}`);
705
851
  }
706
- unstart(s) {
852
+ unstart(r) {
707
853
  if (this.milestones == null || this.milestones.length < 1) {
708
854
  debugger;
709
855
  return;
710
856
  }
711
- let r = this.milestones.shift();
857
+ let s = this.milestones.shift();
712
858
  this.milestones = this.milestones.map((t) => {
713
- let e = new _(t.Run);
859
+ let e = new z(t.Run);
714
860
  return e.Start = t.Start, e.startDisplay = t.startDisplay, e.POST = t.POST, e.postDisplay = t.postDisplay, e.Read = t.Read, e.readDisplay = t.readDisplay, e.Write = t.Write, e.writeDisplay = t.writeDisplay, e.Duration = t.Duration, e.durationDisplay = t.durationDisplay, e;
715
- }), s(this.milestones), console.log(`Unstart removed first milestone: ${r.Run}:${r.Start}`);
861
+ }), r(this.milestones), console.log(`Unstart removed first milestone: ${s.Run}:${s.Start}`);
716
862
  }
717
- post(s) {
863
+ post(r) {
718
864
  if (this.milestones == null || this.milestones.length < 1) {
719
865
  debugger;
720
866
  return;
721
867
  }
722
- this.milestones[0].post(""), s(this.milestones), console.log(`POST milestone: ${this.milestones[0].Run}:${this.milestones[0].POST}`);
868
+ this.milestones[0].post(""), r(this.milestones), console.log(`POST milestone: ${this.milestones[0].Run}:${this.milestones[0].POST}`);
723
869
  }
724
- read(s) {
870
+ read(r) {
725
871
  if (this.milestones == null || this.milestones.length < 1) {
726
872
  debugger;
727
873
  return;
728
874
  }
729
- this.milestones[0].read(""), s(this.milestones), console.log(`Read milestone: ${this.milestones[0].Run}:${this.milestones[0].Read}`);
875
+ this.milestones[0].read(""), r(this.milestones), console.log(`Read milestone: ${this.milestones[0].Run}:${this.milestones[0].Read}`);
730
876
  }
731
- write(s) {
877
+ write(r) {
732
878
  if (this.milestones == null || this.milestones.length < 1) {
733
879
  debugger;
734
880
  return;
735
881
  }
736
882
  for (this.milestones[0].write(""); this.milestones.length > 10; ) {
737
- let r = this.milestones.pop();
738
- console.log(`Removed milestone #${r.Run}: ${r.Start}`);
883
+ let s = this.milestones.pop();
884
+ console.log(`Removed milestone #${s.Run}: ${s.Start}`);
739
885
  }
740
- this.save(), this.milestones = this.milestones.map((r) => {
741
- let t = new _(r.Run);
742
- return t.Start = r.Start, t.startDisplay = r.startDisplay, t.POST = r.POST, t.postDisplay = r.postDisplay, t.Read = r.Read, t.readDisplay = r.readDisplay, t.Write = r.Write, t.writeDisplay = r.writeDisplay, t.Duration = r.Duration, t.durationDisplay = r.durationDisplay, t;
743
- }), s(this.milestones);
886
+ this.save(), this.milestones = this.milestones.map((s) => {
887
+ let t = new z(s.Run);
888
+ 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;
889
+ }), r(this.milestones);
744
890
  }
745
891
  }
746
- H = new WeakSet(), we = function(s) {
747
- s == null ? this.milestones = new Array() : this.milestones = s.map((r) => {
748
- let t = new _(Number(r.Run));
749
- return t.start(r.Start), t.post(r.POST), t.read(r.Read), t.write(r.Write), t;
892
+ M = new WeakSet(), fe = function(r) {
893
+ r == null ? this.milestones = new Array() : this.milestones = r.map((s) => {
894
+ let t = new z(Number(s.Run));
895
+ return t.start(s.Start), t.post(s.POST), t.read(s.Read), t.write(s.Write), t;
750
896
  });
751
897
  };
752
898
  class qt {
753
- constructor(s, r, t) {
899
+ constructor(r, s, t) {
754
900
  u(this, "tenantNodes");
755
901
  u(this, "pb_startTS");
756
902
  u(this, "pb_progress");
@@ -764,34 +910,27 @@ class qt {
764
910
  u(this, "pollInstance", null);
765
911
  u(this, "pollAuthorizedUser", null);
766
912
  u(this, "pollBatchIdArray", []);
767
- // Last known backend queues (strongest completion signal)
768
- u(this, "lastQueues", {
769
- main: null,
770
- writer: null,
771
- deferred: null
772
- });
773
- u(this, "hasQueueInfo", !1);
774
913
  // Store UI callbacks so we can update the UI from poll/completion events.
775
914
  u(this, "setIdleText", null);
776
915
  // Handler used by polling: we reuse the same stats-processing logic.
777
916
  u(this, "statsHydrationHandler", null);
778
917
  u(this, "milestoneArray");
779
- this.tenantNodes = new Array(), this.init(s, r, t), this.pb_startTS = 0, this.pb_progress = 0, this.pb_timer = null, this.pb_idle = 0, this.pb_total = 0, this.milestoneArray = new Xe(!1);
918
+ this.tenantNodes = new Array(), this.init(r, s, t), this.pb_startTS = 0, this.pb_progress = 0, this.pb_timer = null, this.pb_idle = 0, this.pb_total = 0, this.milestoneArray = new at(!1);
780
919
  }
781
920
  clearStoredBatchIds() {
782
- R() && (localStorage.setItem("BatchIdArray", "[]"), localStorage.removeItem("BatchIdArrayProgress"));
921
+ P() && (localStorage.setItem("BatchIdArray", "[]"), localStorage.removeItem("BatchIdArrayProgress"));
783
922
  }
784
923
  // populate tenantNodes based on config tenants
785
- init(s, r, t) {
924
+ init(r, s, t) {
786
925
  console.log(
787
- `Calling BatchArray::init(config: "${s ? s.name : "null"}", bClearLocalStorage: ${t ? "true" : "false"})`
788
- ), t && R() && (localStorage.removeItem(s.name), this.milestoneArray.init(t)), s != null && s.tenants != null && r != null && (this.tenantNodes.length = 0, s.tenants.map((e) => {
926
+ `Calling BatchArray::init(config: "${r ? r.name : "null"}", bClearLocalStorage: ${t ? "true" : "false"})`
927
+ ), t && P() && (localStorage.removeItem(r.name), this.milestoneArray.init(t)), r != null && r.tenants != null && s != null && (this.tenantNodes.length = 0, r.tenants.map((e) => {
789
928
  if (e.configurationTenantType === "source" || e.configurationTenantType === "sourcetarget") {
790
- let a = r.ts.find(
929
+ let a = s.ts.find(
791
930
  (o) => o.tid === e.tid
792
931
  );
793
932
  if (a != null) {
794
- let o = new Re(
933
+ let o = new Ae(
795
934
  e.tid,
796
935
  a.name,
797
936
  e.batchId
@@ -799,28 +938,28 @@ class qt {
799
938
  this.tenantNodes.push(o);
800
939
  } else {
801
940
  console.log(
802
- `Error: no tenant found for config source tenant ${s.name}`
941
+ `Error: no tenant found for config source tenant ${r.name}`
803
942
  );
804
943
  debugger;
805
944
  return;
806
945
  }
807
946
  }
808
947
  }), this.tenantNodes.map((e) => {
809
- s.tenants.map((a) => {
948
+ r.tenants.map((a) => {
810
949
  if ((a.configurationTenantType === "target" || a.configurationTenantType === "sourcetarget") && a.tid !== e.tid) {
811
- let o = r.ts.find(
812
- (d) => d.tid === a.tid
950
+ let o = s.ts.find(
951
+ (c) => c.tid === a.tid
813
952
  );
814
953
  if (o != null) {
815
- let d = new Re(
954
+ let c = new Ae(
816
955
  a.tid,
817
956
  o.name,
818
957
  a.batchId
819
958
  );
820
- e.targets.push(d), e.expanded = !0;
959
+ e.targets.push(c), e.expanded = !0;
821
960
  } else {
822
961
  console.log(
823
- `Error: no tenant found for config target tenant ${s.name}`
962
+ `Error: no tenant found for config target tenant ${r.name}`
824
963
  );
825
964
  debugger;
826
965
  return;
@@ -829,13 +968,9 @@ class qt {
829
968
  });
830
969
  }));
831
970
  }
832
- initializeProgressBar(s, r, t, e) {
833
- this.setIdleText = t, this.hasQueueInfo = !1, this.lastQueues = { main: null, writer: null, deferred: null }, this.pb_startTS = Date.now(), this.pb_progress = 0, this.pb_idle = 0, this.pb_total = 0, s(this.pb_progress), t("Starting sync..."), this.pb_timer = setInterval(() => {
834
- console.log("this.tenantNodes", this.tenantNodes);
835
- let a = this.tenantNodes.every(
836
- (i) => i.nothingtosync || i.targets.every((l) => l.status === "complete" || l.status === "failed")
837
- );
838
- this.hasQueueInfo && this.lastQueues.main === 0 && this.lastQueues.writer === 0 && this.lastQueues.deferred === 0 || !this.hasQueueInfo && a ? (clearInterval(this.pb_timer), this.pb_timer = null, this.pb_progress = 100, s(this.pb_progress), t("Complete."), this.stopPolling(), this.clearStoredBatchIds()) : (this.pb_total = this.pb_total + 1, this.pb_idle = this.pb_idle + 1, t(`${this.pb_total} seconds elapsed. Last update ${this.pb_idle} seconds ago.`));
971
+ initializeProgressBar(r, s, t, e) {
972
+ this.setIdleText = t, this.pb_startTS = Date.now(), this.pb_progress = 0, this.pb_idle = 0, this.pb_total = 0, r(this.pb_progress), t("Starting sync..."), this.pb_timer = setInterval(() => {
973
+ console.log("this.tenantNodes", this.tenantNodes), this.pb_total = this.pb_total + 1, this.pb_idle = this.pb_idle + 1, t(`${this.pb_total} seconds elapsed. Last update ${this.pb_idle} seconds ago.`);
839
974
  }, 1e3), this.milestoneArray.start(e);
840
975
  }
841
976
  stopPolling() {
@@ -843,17 +978,17 @@ class qt {
843
978
  }
844
979
  async pollStatsOnce() {
845
980
  if (this.pb_timer != null && !(this.pollInstance == null || this.pollAuthorizedUser == null) && this.statsHydrationHandler && !(!this.pollBatchIdArray || this.pollBatchIdArray.length === 0))
846
- for (const s of this.pollBatchIdArray) {
847
- const r = s == null ? void 0 : s.BatchId;
848
- if (!r) continue;
849
- const t = await Bt(this.pollInstance, this.pollAuthorizedUser, r);
981
+ for (const r of this.pollBatchIdArray) {
982
+ const s = r == null ? void 0 : r.BatchId;
983
+ if (!s) continue;
984
+ const t = await Wt(this.pollInstance, this.pollAuthorizedUser, s);
850
985
  if (!t.result || !t.array || !t.array[0]) continue;
851
- const e = t.array[0], a = e.lastUpdated, o = this.pollLastUpdatedByBatchId[r];
852
- this.pollLastUpdatedByBatchId[r] = a ?? "", !(!a || a === o) && this.statsHydrationHandler(r, e.stats);
986
+ const e = t.array[0], a = e.lastUpdated, o = this.pollLastUpdatedByBatchId[s];
987
+ this.pollLastUpdatedByBatchId[s] = a ?? "", !(!a || a === o) && this.statsHydrationHandler(s, e.stats);
853
988
  }
854
989
  }
855
- uninitializeProgressBar(s, r, t, e) {
856
- this.pb_startTS = 0, this.pb_progress = 0, s(this.pb_progress), r("sync failed to execute"), clearInterval(this.pb_timer), this.pb_timer = null, this.pb_idle = 0, t(`No updates seen for ${this.pb_idle} seconds.`), this.milestoneArray.unstart(e);
990
+ uninitializeProgressBar(r, s, t, e) {
991
+ this.pb_startTS = 0, this.pb_progress = 0, r(this.pb_progress), s("sync failed to execute"), clearInterval(this.pb_timer), this.pb_timer = null, this.pb_idle = 0, t(`No updates seen for ${this.pb_idle} seconds.`), this.milestoneArray.unstart(e);
857
992
  }
858
993
  /**
859
994
  * Calculates the sync progress percentage (0-99%) based on completed read and write operations.
@@ -874,117 +1009,117 @@ class qt {
874
1009
  * @param deferred - Number of users deferred (postponed) during writing
875
1010
  * @returns Progress percentage from 0 to 99
876
1011
  */
877
- calculateProgress(s, r, t, e, a) {
878
- if (s <= 0)
1012
+ calculateProgress(r, s, t, e, a) {
1013
+ if (r <= 0)
879
1014
  return 0;
880
- const o = Math.min(s, r + e), d = Math.min(s, t + e + a), i = o + d;
881
- return Math.min(99, Math.round(i / (s * 2) * 100));
1015
+ const o = Math.min(r, s + e), c = Math.min(r, t + e + a), i = o + c;
1016
+ return Math.min(99, Math.round(i / (r * 2) * 100));
882
1017
  }
883
- updateProgressFromTotals(s, r, t, e, a, o) {
884
- const d = this.calculateProgress(s, r, t, e, a);
885
- this.pb_progress = Math.max(this.pb_progress, d), o(this.pb_progress), R() && localStorage.setItem("BatchIdArrayProgress", String(this.pb_progress));
1018
+ updateProgressFromTotals(r, s, t, e, a, o) {
1019
+ const c = this.calculateProgress(r, s, t, e, a);
1020
+ this.pb_progress = Math.max(this.pb_progress, c), o(this.pb_progress), P() && localStorage.setItem("BatchIdArrayProgress", String(this.pb_progress));
886
1021
  }
887
- initializeSignalR(s, r, t, e, a, o, d, i, l, c, f, b, A, C, N, B, v) {
888
- this.hasQueueInfo = !1, this.lastQueues = { main: null, writer: null, deferred: null }, this.milestoneArray.post(f), b("started sync, waiting for updates..."), this.init(s, r, !1);
889
- let k = (O, Se) => {
890
- var De, ve;
1022
+ initializeSignalR(r, s, t, e, a, o, c, i, l, d, p, $, E, x, N, U, D) {
1023
+ this.milestoneArray.post(p), $("started sync, waiting for updates..."), this.init(r, s, !1);
1024
+ let A = (O, he) => {
1025
+ var Ie, $e;
891
1026
  this.pb_idle = 0;
892
- let z = t.find((p) => p.BatchId == O);
893
- if (z == null) {
1027
+ let _ = t.find((f) => f.BatchId == O);
1028
+ if (_ == null) {
894
1029
  console.log(`Batch ${O} not found in batchIdArray.`);
895
1030
  debugger;
896
1031
  return;
897
1032
  }
898
- let g = this.tenantNodes.find((p) => p.tid === z.SourceId);
1033
+ let g = this.tenantNodes.find((f) => f.tid === _.SourceId);
899
1034
  if (g == null) {
900
- console.log(`Tenant ${z.SourceId} not found in BatchArray.`);
1035
+ console.log(`Tenant ${_.SourceId} not found in BatchArray.`);
901
1036
  debugger;
902
1037
  return;
903
1038
  }
904
- g.batchId = z.BatchId;
905
- let E = Object.keys(Se), P = Object.values(Se), X = !1, Ie = !1, Y = null, ee = null, te = null;
906
- for (let p = 0; p < E.length; p++) {
907
- let D = E[p].endsWith("TotalCount"), Q = E[p].endsWith("CurrentCount"), le = E[p].endsWith("ExtCount"), K = E[p].endsWith("DeferredCount"), ue = E[p].endsWith("RescheduledCount");
908
- if (le && (g.excluded = Math.max(Number(P[p]), g.excluded), g.targets.map((w) => {
909
- w.excluded = g.excluded, w.update(w.total, w.read, w.excluded, w.written, w.deferred);
910
- })), D && (X = Number(P[p]) == 0, g.total = Math.max(Number(P[p]), g.total), g.targets.map((w) => {
911
- w.total = g.total, w.update(w.total, w.read, w.excluded, w.written, w.deferred);
912
- })), E[p].startsWith("Reader")) {
913
- let w = /Reader\/TID:(.+)\/TotalCount/;
914
- if (Q && (w = /Reader\/TID:(.+)\/CurrentCount/), le && (w = /Reader\/TID:(.+)\/ExtCount/), K && (w = /Reader\/TID:(.+)\/DeferredCount/), ue && (w = /Reader\/TID:(.+)\/RescheduledCount/), E[p].match(w) == null) {
915
- console.log(`tid not found in ${E[p]}.`);
1039
+ g.batchId = _.BatchId;
1040
+ let k = Object.keys(he), R = Object.values(he), Q = !1, ge = !1;
1041
+ for (let f = 0; f < k.length; f++) {
1042
+ let v = k[f].endsWith("TotalCount"), q = k[f].endsWith("CurrentCount"), re = k[f].endsWith("ExtCount"), J = k[f].endsWith("DeferredCount"), ae = k[f].endsWith("RescheduledCount");
1043
+ if (re && (g.excluded = Math.max(Number(R[f]), g.excluded), g.targets.map((y) => {
1044
+ y.excluded = g.excluded, y.update(y.total, y.read, y.excluded, y.written, y.deferred);
1045
+ })), v && (Q = Number(R[f]) == 0, g.total = Math.max(Number(R[f]), g.total), g.targets.map((y) => {
1046
+ y.total = g.total, y.update(y.total, y.read, y.excluded, y.written, y.deferred);
1047
+ })), k[f].startsWith("Reader")) {
1048
+ let y = /Reader\/TID:(.+)\/TotalCount/;
1049
+ if (q && (y = /Reader\/TID:(.+)\/CurrentCount/), re && (y = /Reader\/TID:(.+)\/ExtCount/), J && (y = /Reader\/TID:(.+)\/DeferredCount/), ae && (y = /Reader\/TID:(.+)\/RescheduledCount/), k[f].match(y) == null) {
1050
+ console.log(`tid not found in ${k[f]}.`);
916
1051
  debugger;
917
1052
  return;
918
1053
  }
919
- D ? (X = Number(P[p]) == 0, g.total = Math.max(Number(P[p]), g.total), console.log(`----- ${g.name} TID: ${g.tid} batchId: ${g.batchId}`), console.log(`----- ${g.name} Total To Read: ${g.total}`)) : (Ie = Number(P[p]) == 0, Q ? (g.read = Math.max(Number(P[p]), g.read), console.log(`----- ${g.name} Currently Read: ${g.read}`)) : K && (g.deferred = Math.max(Number(P[p]), g.deferred), console.log(`----- ${g.name} Deferred: ${g.deferred}`)));
1054
+ v ? (Q = Number(R[f]) == 0, g.total = Math.max(Number(R[f]), g.total), console.log(`----- ${g.name} TID: ${g.tid} batchId: ${g.batchId}`), console.log(`----- ${g.name} Total To Read: ${g.total}`)) : (ge = Number(R[f]) == 0, q ? (g.read = Math.max(Number(R[f]), g.read), console.log(`----- ${g.name} Currently Read: ${g.read}`)) : J && (g.deferred = Math.max(Number(R[f]), g.deferred), console.log(`----- ${g.name} Deferred: ${g.deferred}`)));
920
1055
  }
921
- if (g.nothingtosync = X && Ie, E[p] === "TotalInMainQueue" && (Y = Number(P[p])), E[p] === "TotalInWriterQueue" && (ee = Number(P[p])), E[p] === "TotalInDeferredQueue" && (te = Number(P[p])), E[p].startsWith("Writer")) {
922
- let w = /Writer\/TID:(.+)\/TotalCount/;
923
- Q && (w = /Writer\/TID:(.+)\/CurrentCount/), le && (w = /Writer\/TID:(.+)\/ExtCount/), K && (w = /Writer\/TID:(.+)\/DeferredCount/), ue && (w = /Writer\/TID:(.+)\/RescheduledCount/);
924
- let de = E[p].match(w);
925
- if (de == null) {
926
- console.log(`tid not found in ${E[p]}.`);
1056
+ if (g.nothingtosync = Q && ge, k[f].startsWith("Writer")) {
1057
+ let y = /Writer\/TID:(.+)\/TotalCount/;
1058
+ q && (y = /Writer\/TID:(.+)\/CurrentCount/), re && (y = /Writer\/TID:(.+)\/ExtCount/), J && (y = /Writer\/TID:(.+)\/DeferredCount/), ae && (y = /Writer\/TID:(.+)\/RescheduledCount/);
1059
+ let ne = k[f].match(y);
1060
+ if (ne == null) {
1061
+ console.log(`tid not found in ${k[f]}.`);
927
1062
  debugger;
928
1063
  return;
929
1064
  }
930
- let T = g.targets.find((Oe) => Oe.tid === de[1]);
931
- if (T == null) {
1065
+ let w = g.targets.find((Ne) => Ne.tid === ne[1]);
1066
+ if (w == null) {
932
1067
  console.log(`Writer ${g.name} not found under Reader ${g.name}.`);
933
1068
  debugger;
934
1069
  return;
935
1070
  }
936
- if (T.total = Math.max(Number(g.total), T.total), T.total = Math.max(Number(g.total), T.total), T.batchId = z.BatchId, D)
937
- T.total = Math.max(Number(P[p]), T.total), console.log(`----- ${T.name} TID: ${T.tid} batchId: ${T.batchId}`), console.log(`----- ${T.name} Total To Write: ${T.total}`);
938
- else if (Q)
939
- T.written = Math.max(Number(P[p]), T.written), console.log(`----- ${T.name} Total Written: ${T.written}`);
940
- else if (K || ue)
941
- T.deferred = Math.max(Number(P[p]), T.deferred), console.log(`----- ${T.name} Total Deferred: ${T.deferred}`);
1071
+ if (w.total = Math.max(Number(g.total), w.total), w.total = Math.max(Number(g.total), w.total), w.batchId = _.BatchId, v)
1072
+ w.total = Math.max(Number(R[f]), w.total), console.log(`----- ${w.name} TID: ${w.tid} batchId: ${w.batchId}`), console.log(`----- ${w.name} Total To Write: ${w.total}`);
1073
+ else if (q)
1074
+ w.written = Math.max(Number(R[f]), w.written), console.log(`----- ${w.name} Total Written: ${w.written}`);
1075
+ else if (J || ae)
1076
+ w.deferred = Math.max(Number(R[f]), w.deferred), console.log(`----- ${w.name} Total Deferred: ${w.deferred}`);
942
1077
  else {
943
1078
  console.log("unknown writer type");
944
1079
  debugger;
945
1080
  return;
946
1081
  }
947
- T.update(T.total, T.read, T.excluded, T.written, T.deferred);
1082
+ w.update(w.total, w.read, w.excluded, w.written, w.deferred);
948
1083
  }
949
1084
  }
950
1085
  g.update(g.total, g.read, g.excluded, g.written, g.deferred);
951
- let be = !0, se = !0, $e = !1, Ae = !0, q = 0, re = 0, ae = 0, ne = 0, oe = 0, ie = 0, ke = 0;
952
- this.tenantNodes.map((p) => {
953
- p.targets.map((D) => {
954
- se && (se = D.status == "complete" || D.status == "failed"), $e || ($e = D.total > 0 || D.status != "not started"), ne += Math.max(D.total, p.total), oe += D.written, ie += D.excluded, ke += D.deferred;
955
- }), Ae && (Ae = p.nothingtosync), be && (be = p.total > 0 && p.read + p.excluded >= p.total), q += p.total, re += p.read, ae += p.excluded;
956
- }), Y != null && (this.lastQueues.main = Y), ee != null && (this.lastQueues.writer = ee), te != null && (this.lastQueues.deferred = te), this.hasQueueInfo = this.lastQueues.main != null && this.lastQueues.writer != null && this.lastQueues.deferred != null;
957
- const Ee = this.hasQueueInfo && this.lastQueues.main === 0 && this.lastQueues.writer === 0 && this.lastQueues.deferred === 0;
958
- Ee && (se = !0, this.tenantNodes.forEach((p) => {
959
- p.targets.forEach((D) => {
960
- D.status !== "failed" && (D.status = "complete");
961
- }), p.status !== "failed" && (p.status = "complete");
962
- })), a(q), d(re), o(ae), i(Math.max(ne, q)), c(oe), l(ie), this.updateProgressFromTotals(
963
- Math.max(q, ne),
964
- re,
965
- oe,
966
- Math.max(ae, ie),
1086
+ let me = !0, X = !0, ye = !1, we = !0, L = 0, Y = 0, H = 0, ee = 0, K = 0, te = 0, se = 0;
1087
+ this.tenantNodes.map((f) => {
1088
+ f.targets.map((v) => {
1089
+ X && (X = v.status == "complete" || v.status == "failed"), ye || (ye = v.total > 0 || v.status != "not started"), ee += Math.max(v.total, f.total), K += v.written, te += v.excluded, se += v.deferred;
1090
+ }), we && (we = f.nothingtosync), me && (me = f.total > 0 && f.read + f.excluded >= f.total), L += f.total, Y += f.read, H += f.excluded;
1091
+ });
1092
+ const Te = L - H, Oe = K + se, Se = Te > 0 && Te === Oe;
1093
+ Se && (X = !0, this.tenantNodes.forEach((f) => {
1094
+ f.targets.forEach((v) => {
1095
+ v.status !== "failed" && (v.status = "complete");
1096
+ }), f.status !== "failed" && (f.status = "complete");
1097
+ })), a(L), c(Y), o(H), i(Math.max(ee, L)), d(K), l(te), this.updateProgressFromTotals(
1098
+ Math.max(L, ee),
1099
+ Y,
1100
+ K,
1101
+ Math.max(H, te),
967
1102
  // Deferred users count as completed for write.
968
- ke,
969
- A
970
- ), Ae ? (this.milestoneArray.write(f), this.stopPolling(), b("nothing to sync"), this.pb_timer && (clearInterval(this.pb_timer), this.pb_timer = null), this.pb_progress = 100, A(this.pb_progress), (De = this.setIdleText) == null || De.call(this, "Complete (nothing to sync)."), this.clearStoredBatchIds(), console.log('Setting config sync result: "nothing to sync"')) : (be && (this.milestoneArray.read(f), b("reading complete"), console.log('Setting config sync result: "reading complete"'), e(s.workspaceId)), se && (Ee || !this.hasQueueInfo) ? (this.milestoneArray.write(f), this.stopPolling(), b("sync complete"), this.pb_timer && (clearInterval(this.pb_timer), this.pb_timer = null), this.pb_progress = 100, A(this.pb_progress), (ve = this.setIdleText) == null || ve.call(this, "Complete."), this.clearStoredBatchIds(), console.log('Setting config sync result: "complete"')) : $e ? (b("writing in progress"), console.log('Setting config sync result: "writing in progress"')) : this.milestoneArray.milestones[0].Read == null && (b("reading in progress"), console.log('Setting config sync result: "reading in progress"')));
1103
+ se,
1104
+ E
1105
+ ), we ? (this.milestoneArray.write(p), this.stopPolling(), $("nothing to sync"), this.pb_timer && (clearInterval(this.pb_timer), this.pb_timer = null), this.pb_progress = 100, E(this.pb_progress), (Ie = this.setIdleText) == null || Ie.call(this, "Complete (nothing to sync)."), this.clearStoredBatchIds(), console.log('Setting config sync result: "nothing to sync"')) : (me && (this.milestoneArray.read(p), $("reading complete"), console.log('Setting config sync result: "reading complete"'), e(r.workspaceId)), X && Se ? (this.milestoneArray.write(p), this.stopPolling(), $("sync complete"), this.pb_timer && (clearInterval(this.pb_timer), this.pb_timer = null), this.pb_progress = 100, E(this.pb_progress), ($e = this.setIdleText) == null || $e.call(this, "Complete."), this.clearStoredBatchIds(), console.log('Setting config sync result: "complete"')) : ye ? ($("writing in progress"), console.log('Setting config sync result: "writing in progress"')) : this.milestoneArray.milestones[0].Read == null && ($("reading in progress"), console.log('Setting config sync result: "reading in progress"')));
971
1106
  };
972
- this.statsHydrationHandler = k, B && v && (this.pollInstance = B, this.pollAuthorizedUser = v, this.pollBatchIdArray = t, this.stopPolling(), this.pollInstance = B, this.pollAuthorizedUser = v, this.pollBatchIdArray = t, this.pollStatsOnce(), this.pollTimer = setInterval(() => {
1107
+ this.statsHydrationHandler = A, U && D && (this.pollInstance = U, this.pollAuthorizedUser = D, this.pollBatchIdArray = t, this.stopPolling(), this.pollInstance = U, this.pollAuthorizedUser = D, this.pollBatchIdArray = t, this.pollStatsOnce(), this.pollTimer = setInterval(() => {
973
1108
  this.pollStatsOnce();
974
1109
  }, this.pollIntervalSeconds * 1e3));
975
1110
  }
976
1111
  // start a sync cycle
977
- async startSync(s, r, t) {
1112
+ async startSync(r, s, t) {
978
1113
  let e = new m();
979
1114
  if (this.tenantNodes == null || this.tenantNodes.length == 0) {
980
1115
  debugger;
981
1116
  return e.result = !1, e.error = "startSync: invalid parameters", e.status = 500, e;
982
1117
  }
983
- return e = await Nt(s, r, t), e;
1118
+ return e = await Ut(r, s, t), e;
984
1119
  }
985
1120
  }
986
- class Re {
987
- constructor(s, r, t) {
1121
+ class Ae {
1122
+ constructor(r, s, t) {
988
1123
  u(this, "expanded");
989
1124
  u(this, "status", "");
990
1125
  u(this, "name");
@@ -997,32 +1132,32 @@ class Re {
997
1132
  u(this, "deferred", 0);
998
1133
  u(this, "nothingtosync");
999
1134
  u(this, "targets");
1000
- this.expanded = !1, this.name = r, this.tid = s, this.batchId = t, this.nothingtosync = !1, this.targets = new Array(), this.update(0, 0, 0, 0, 0);
1135
+ this.expanded = !1, this.name = s, this.tid = r, this.batchId = t, this.nothingtosync = !1, this.targets = new Array(), this.update(0, 0, 0, 0, 0);
1001
1136
  }
1002
- update(s, r, t, e, a) {
1003
- if (this.total = s, this.read = r, this.excluded = t, this.written = e, this.deferred = a, this.read === 0 && this.written === 0 && (this.status = "not started"), this.read > 0) {
1137
+ update(r, s, t, e, a) {
1138
+ if (this.total = r, this.read = s, this.excluded = t, this.written = e, this.deferred = a, this.read === 0 && this.written === 0 && (this.status = "not started"), this.read > 0) {
1004
1139
  if (this.read + this.excluded < this.total)
1005
1140
  this.status = "in progress";
1006
1141
  else if (this.read + this.excluded === this.total)
1007
1142
  if (this.targets != null && this.targets.length > 0) {
1008
- const o = this.targets.every((d) => d.status === "complete" || d.status === "failed");
1143
+ const o = this.targets.every((c) => c.status === "complete" || c.status === "failed");
1009
1144
  this.status = o ? "complete" : "in progress";
1010
1145
  } else
1011
1146
  this.status = "complete";
1012
1147
  } else this.written > 0 && (this.written + this.deferred + this.excluded < this.total ? this.status = "in progress" : this.written + this.deferred + this.excluded === this.total ? this.status = "complete" : this.written + this.deferred + this.excluded >= this.total && (this.status = "failed"));
1013
1148
  }
1014
1149
  }
1015
- class xe {
1016
- constructor(s, r) {
1150
+ class Ge {
1151
+ constructor(r, s) {
1017
1152
  u(this, "resourceNodes");
1018
- this.resourceNodes = new Array(), s && this.init(r);
1153
+ this.resourceNodes = new Array(), r && this.init(s);
1019
1154
  }
1020
1155
  // get resource data from localStorage or file
1021
- init(s) {
1022
- if (console.log(`Calling ResourceArray::init(bClearLocalStorage: ${s ? "true" : "false"})`), R()) {
1156
+ init(r) {
1157
+ if (console.log(`Calling ResourceArray::init(bClearLocalStorage: ${r ? "true" : "false"})`), P()) {
1023
1158
  let t = localStorage.getItem("ResourceArray");
1024
1159
  if (t != null && typeof t == "string" && t !== "")
1025
- if (s)
1160
+ if (r)
1026
1161
  localStorage.removeItem("ResourceArray");
1027
1162
  else {
1028
1163
  let a = JSON.parse(t);
@@ -1030,47 +1165,47 @@ class xe {
1030
1165
  return;
1031
1166
  }
1032
1167
  }
1033
- var r = JSON.stringify(Me);
1168
+ var s = JSON.stringify(Me);
1034
1169
  try {
1035
- this.resourceNodes = U(Ye, r);
1170
+ this.resourceNodes = B(Ce, s);
1036
1171
  } catch {
1037
1172
  debugger;
1038
1173
  }
1039
1174
  }
1040
1175
  // read
1041
- async read(s, r) {
1042
- let t = new xe(!1, !1);
1043
- return t.resourceNodes = await ct(s, r), t;
1176
+ async read(r, s) {
1177
+ let t = new Ge(!1, !1);
1178
+ return t.resourceNodes = await pt(), t;
1044
1179
  }
1045
1180
  // save resource data to localstorage
1046
1181
  save() {
1047
- if (R()) {
1048
- let s = JSON.stringify(this);
1049
- localStorage.setItem("ResourceArray", s);
1182
+ if (P()) {
1183
+ let r = JSON.stringify(this);
1184
+ localStorage.setItem("ResourceArray", r);
1050
1185
  }
1051
1186
  }
1052
1187
  }
1053
- class Ye {
1054
- constructor(s, r, t) {
1188
+ class Ce {
1189
+ constructor(r, s, t) {
1055
1190
  u(this, "type");
1056
1191
  u(this, "resource");
1057
1192
  u(this, "cost");
1058
1193
  u(this, "expanded");
1059
1194
  u(this, "resources");
1060
- this.type = s, this.resource = r, this.cost = t, this.expanded = !1, this.resources = new Array();
1195
+ this.type = r, this.resource = s, this.cost = t, this.expanded = !1, this.resources = new Array();
1061
1196
  }
1062
1197
  }
1063
- class Qt {
1064
- constructor(s) {
1198
+ class Jt {
1199
+ constructor(r) {
1065
1200
  u(this, "actorNodes");
1066
- this.actorNodes = new Array(), this.init(s);
1201
+ this.actorNodes = new Array(), this.init(r);
1067
1202
  }
1068
1203
  // get initial data from localStorage or file
1069
- init(s) {
1070
- if (console.log(`Calling ResourceArray::init(bClearLocalStorage: ${s ? "true" : "false"})`), R()) {
1204
+ init(r) {
1205
+ if (console.log(`Calling ResourceArray::init(bClearLocalStorage: ${r ? "true" : "false"})`), P()) {
1071
1206
  let t = localStorage.getItem("RBACActors");
1072
1207
  if (t != null && typeof t == "string" && t !== "")
1073
- if (s)
1208
+ if (r)
1074
1209
  localStorage.removeItem("RBACActors");
1075
1210
  else {
1076
1211
  let a = JSON.parse(t);
@@ -1078,16 +1213,16 @@ class Qt {
1078
1213
  return;
1079
1214
  }
1080
1215
  }
1081
- var r = JSON.stringify(je);
1216
+ var s = JSON.stringify(He);
1082
1217
  try {
1083
- this.actorNodes = U(et, r);
1218
+ this.actorNodes = B(nt, s);
1084
1219
  } catch {
1085
1220
  debugger;
1086
1221
  }
1087
1222
  }
1088
1223
  }
1089
- class et {
1090
- constructor(s, r, t, e, a, o) {
1224
+ class nt {
1225
+ constructor(r, s, t, e, a, o) {
1091
1226
  u(this, "type");
1092
1227
  u(this, "actor");
1093
1228
  u(this, "resource");
@@ -1095,139 +1230,52 @@ class et {
1095
1230
  u(this, "updatedby");
1096
1231
  u(this, "updatedon");
1097
1232
  u(this, "actors");
1098
- this.type = s, this.actor = r, this.resource = t, this.role = e, this.updatedby = a, this.updatedon = o, this.actors = new Array();
1233
+ this.type = r, this.actor = s, this.resource = t, this.role = e, this.updatedby = a, this.updatedon = o, this.actors = new Array();
1099
1234
  }
1100
1235
  }
1101
- function tt(n) {
1102
- return "Group.Read.All User.Read.All openid profile offline_access User.Read Contacts.Read CrossTenantInformation.ReadBasic.All";
1236
+ async function Vt(n, r, s) {
1237
+ return await Ke(s);
1103
1238
  }
1104
- async function Z(n, s) {
1105
- const r = new Headers();
1106
- r.append("Content-Type", "application/json"), r.append("accept", "*/*");
1107
- const t = tt();
1108
- if (s.graphAccessToken == null || s.graphAccessToken === "")
1109
- try {
1110
- let e = await n.acquireTokenByCode({
1111
- code: s.spacode
1112
- });
1113
- s.graphAccessToken = e.accessToken, console.log("Front end token acquired by code: " + s.graphAccessToken.slice(0, 20));
1114
- } catch (e) {
1115
- console.log("Front end token failure: " + e);
1116
- }
1117
- else
1118
- try {
1119
- let e = n.getAllAccounts(), a = s.oid + "." + s.tid, o = null;
1120
- for (let i = 0; i < e.length; i++)
1121
- e[i].homeAccountId == a && (o = e[i]);
1122
- let d = await n.acquireTokenSilent({
1123
- scopes: [t],
1124
- account: o
1125
- });
1126
- s.graphAccessToken = d.accessToken, console.log("Front end token graph acquired silently: " + s.graphAccessToken.slice(0, 20));
1127
- } catch (e) {
1128
- try {
1129
- console.log("Front end graph token silent acquisition failure: " + e);
1130
- let a = n.getAllAccounts(), o = s.oid + "." + s.tid, d = null;
1131
- for (let i = 0; i < a.length; i++)
1132
- a[i].homeAccountId == o && (d = a[i]);
1133
- n.acquireTokenRedirect({
1134
- scopes: [t],
1135
- account: d
1136
- });
1137
- } catch (a) {
1138
- console.log("Front end graph token redirect acquisition failure: " + a);
1139
- }
1140
- }
1141
- return r.append("Authorization", `Bearer ${s.graphAccessToken}`), r;
1239
+ async function Zt(n, r, s, t) {
1240
+ return await ve(s, t);
1142
1241
  }
1143
- async function Kt(n, s, r) {
1144
- if (s == null || s.spacode == "")
1145
- return { groups: [], error: "500: invalid user passed to groupsGet" };
1146
- let e = { method: "GET", headers: await Z(n, s) };
1147
- try {
1148
- let a = W(s.authority) + h.graphGroupsPredicate;
1149
- a += `/?$filter=startsWith(displayName, '${r}')`;
1150
- let d = await (await fetch(a, e)).json();
1151
- return typeof d.error < "u" ? { groups: [], error: `${d.error.code}: ${d.error.message}` } : { groups: d.value, error: "" };
1152
- } catch (a) {
1153
- return console.log(a), { groups: [], error: `Exception: ${a}` };
1154
- }
1242
+ async function Qt(n, r, s, t) {
1243
+ return await De(s, t);
1155
1244
  }
1156
- async function st(n, s, r, t) {
1157
- try {
1158
- let e = W(s.authority) + h.graphOauth2PermissionGrantsPredicate, a = new URL(e);
1159
- a.searchParams.append("$filter", `resourceId eq '${r}' and consentType eq 'Principal' and principalId eq '${t}'`);
1160
- let d = await (await fetch(a.href, n)).json();
1161
- if (typeof d.error < "u")
1162
- return { grants: null, id: null, error: `${d.error.code}: ${d.error.message}` };
1163
- if (d.value.length != 1) {
1164
- debugger;
1165
- return { grants: null, id: null, error: "oauth2PermissionGrantsGet: more than one matching delegated consent grant." };
1166
- }
1167
- return { grants: d.value[0].scope, id: d.value[0].id, error: "" };
1168
- } catch (e) {
1169
- return console.log(e), { grants: null, id: null, error: `Exception: ${e}` };
1170
- }
1171
- }
1172
- async function rt(n, s, r, t) {
1173
- if (s == null || s.spacode == "")
1174
- return !1;
1175
- try {
1176
- let e = W(s.authority);
1177
- e += h.graphOauth2PermissionGrantsPredicate + `/${r}`;
1178
- let a = `{ "scope": "${t}" }`, d = { method: "PATCH", headers: await Z(n, s), body: a }, i = await fetch(e, d), l = await i.json();
1179
- if (i.status == 204 && i.statusText == "No Content")
1180
- return !0;
1181
- debugger;
1182
- return console.log(`oauth2PermissionGrantsSet: PATCH failed ${l.error.code}: ${l.error.message}`), !1;
1183
- } catch (e) {
1184
- debugger;
1185
- return console.log(e), !1;
1186
- }
1187
- }
1188
- function Jt(n, s) {
1189
- let r = Ke(n.authority);
1190
- r += n.tid, r += "/adminconsent";
1191
- let t = new URL(r), e = Qe(n.authority, s);
1245
+ function Xt(n, r) {
1246
+ let s = et(n.authority);
1247
+ s += n.tid, s += "/adminconsent";
1248
+ let t = new URL(s), e = Ye(n.authority, r);
1192
1249
  t.searchParams.append("client_id", e), t.searchParams.append("redirect_uri", window.location.origin), t.searchParams.append("domain_hint", n.companyDomain), t.searchParams.append("login_hint", n.mail), window.location.assign(t.href);
1193
1250
  }
1194
- async function at(n, s, r) {
1195
- try {
1196
- let t = W(s.authority);
1197
- t += h.graphServicePrincipalsPredicate, t += `(appId='${r}')`;
1198
- let e = new URL(t);
1199
- e.searchParams.append("$select", "id,appId,displayName");
1200
- let o = await (await fetch(e.href, n)).json();
1201
- return typeof o.error < "u" ? { spid: "", error: `${o.error.code}: ${o.error.message}` } : { spid: o.id, error: "" };
1202
- } catch (t) {
1203
- return console.log(t), { spid: "", error: `Exception: ${t}` };
1204
- }
1251
+ async function Yt(n, r, s) {
1252
+ return await ke(s);
1205
1253
  }
1206
- async function Vt(n, s) {
1254
+ async function es(n, r) {
1207
1255
  if (n.authority == "") {
1208
1256
  let e = new j();
1209
- if (e.domain = n.tid, await Ce(e, !1))
1257
+ if (e.domain = n.tid, await xe(e, !1))
1210
1258
  n.authority = e.authority;
1211
1259
  else {
1212
1260
  debugger;
1213
1261
  return !1;
1214
1262
  }
1215
1263
  }
1216
- let r = window.location.href;
1264
+ let s = window.location.href;
1217
1265
  switch (n.authority) {
1218
1266
  case h.authorityWW:
1219
- r += "MicrosoftIdentity/Account/SignIn";
1267
+ s += "MicrosoftIdentity/Account/SignIn";
1220
1268
  break;
1221
1269
  case h.authorityUS:
1222
- r += "USGov/SignIn";
1270
+ s += "USGov/SignIn";
1223
1271
  break;
1224
1272
  case h.authorityCN:
1225
- r += "China/SignIn";
1273
+ s += "China/SignIn";
1226
1274
  break;
1227
1275
  default:
1228
1276
  return !1;
1229
1277
  }
1230
- let t = new URL(r);
1278
+ let t = new URL(s);
1231
1279
  if (t.searchParams.append("redirectUri", window.location.origin), n.oid !== "1") {
1232
1280
  t.searchParams.append("loginHint", n.mail);
1233
1281
  const e = /@([a-zA-Z0-9.-]+\.[a-zA-Z]{2,})$/, a = n.mail.match(e);
@@ -1235,35 +1283,35 @@ async function Vt(n, s) {
1235
1283
  t.searchParams.append("domainHint", o);
1236
1284
  } else
1237
1285
  t.searchParams.append("domainHint", "organizations");
1238
- return s.setTaskStart("initialization", /* @__PURE__ */ new Date()), s.setTaskStart("authenticate user", /* @__PURE__ */ new Date()), window.location.assign(t.href), !0;
1286
+ return r.setTaskStart("initialization", /* @__PURE__ */ new Date()), r.setTaskStart("authenticate user", /* @__PURE__ */ new Date()), window.location.assign(t.href), !0;
1239
1287
  }
1240
- function Zt(n, s) {
1288
+ function ts(n, r) {
1241
1289
  debugger;
1242
1290
  if (n.oid == "1") return;
1243
- let r = window.location.href;
1291
+ let s = window.location.href;
1244
1292
  switch (n.authority) {
1245
1293
  case h.authorityWW:
1246
- r += "MicrosoftIdentity/Account/Challenge";
1294
+ s += "MicrosoftIdentity/Account/Challenge";
1247
1295
  break;
1248
1296
  case h.authorityUS:
1249
- r += "USGov/Challenge";
1297
+ s += "USGov/Challenge";
1250
1298
  break;
1251
1299
  case h.authorityCN:
1252
- r += "China/Challenge";
1300
+ s += "China/Challenge";
1253
1301
  break;
1254
1302
  default:
1255
1303
  return;
1256
1304
  }
1257
- let t = new URL(r);
1258
- t.searchParams.append("redirectUri", window.location.origin), t.searchParams.append("scope", s), t.searchParams.append("domainHint", "organizations"), t.searchParams.append("loginHint", n.mail), window.location.assign(t.href);
1305
+ let t = new URL(s);
1306
+ t.searchParams.append("redirectUri", window.location.origin), t.searchParams.append("scope", r), t.searchParams.append("domainHint", "organizations"), t.searchParams.append("loginHint", n.mail), window.location.assign(t.href);
1259
1307
  }
1260
- async function Xt(n) {
1308
+ async function ss(n) {
1261
1309
  if (n.oid == "1") return !1;
1262
- let s = window.location.href;
1263
- s += "user";
1264
- let r = new URL(s);
1265
- r.searchParams.append("oid", n.oid), r.searchParams.append("tid", n.tid), r.searchParams.append("loginHint", n.loginHint), r.searchParams.append("verb", "LOGOUT");
1266
- let t = { method: "PATCH" }, e = await fetch(r.href, t);
1310
+ let r = window.location.href;
1311
+ r += "user";
1312
+ let s = new URL(r);
1313
+ s.searchParams.append("oid", n.oid), s.searchParams.append("tid", n.tid), s.searchParams.append("loginHint", n.loginHint), s.searchParams.append("verb", "LOGOUT");
1314
+ let t = { method: "PATCH" }, e = await fetch(s.href, t);
1267
1315
  if (e.status == 200 && e.statusText == "OK")
1268
1316
  console.log(`Successfully set admin ${n.mail} logout_hint`);
1269
1317
  else
@@ -1282,15 +1330,15 @@ async function Xt(n) {
1282
1330
  default:
1283
1331
  return !1;
1284
1332
  }
1285
- return r = new URL(a), r.searchParams.append("redirectUri", window.location.origin), window.location.assign(r.href), !0;
1333
+ return s = new URL(a), s.searchParams.append("redirectUri", window.location.origin), window.location.assign(s.href), !0;
1286
1334
  }
1287
- async function Yt(n, s, r, t) {
1335
+ async function rs(n, r, s, t) {
1288
1336
  if (t) debugger;
1289
- if (s.name != null && s.name !== "") return !1;
1337
+ if (r.name != null && r.name !== "") return !1;
1290
1338
  if (n.graphAccessToken != null && n.graphAccessToken === "") {
1291
1339
  console.log(`tenantRelationshipsGetByDomain called with invalid logged in user: ${n.name}`);
1292
1340
  try {
1293
- let i = await r.acquireTokenByCode({ code: n.spacode, scopes: ["user.read", "contacts.read", "CrossTenantInformation.ReadBasic.All"] });
1341
+ let i = await s.acquireTokenByCode({ code: n.spacode, scopes: ["user.read", "contacts.read", "CrossTenantInformation.ReadBasic.All"] });
1294
1342
  n.graphAccessToken = i.accessToken, console.log("tenantRelationshipsGetByDomain: Front end token acquired: " + n.graphAccessToken.slice(0, 20));
1295
1343
  } catch (i) {
1296
1344
  return console.log("tenantRelationshipsGetByDomain: Front end token failure: " + i), !1;
@@ -1300,9 +1348,9 @@ async function Yt(n, s, r, t) {
1300
1348
  e.append("Authorization", a);
1301
1349
  let o = { method: "GET", headers: e };
1302
1350
  try {
1303
- var d = W(s.authority) + h.graphTenantByDomainPredicate;
1304
- d += "(domainName='", d += s.domain, d += "')", console.log("tenantRelationshipsGetByDomain: Attempting GET from /findTenantInformationByDomainName:", d);
1305
- let i = await fetch(d, o);
1351
+ var c = Pe(r.authority) + h.graphTenantByDomainPredicate;
1352
+ c += "(domainName='", c += r.domain, c += "')", console.log("tenantRelationshipsGetByDomain: Attempting GET from /findTenantInformationByDomainName:", c);
1353
+ let i = await fetch(c, o);
1306
1354
  if (i.status == 200) {
1307
1355
  let l = await i.json();
1308
1356
  if (l) {
@@ -1310,16 +1358,16 @@ async function Yt(n, s, r, t) {
1310
1358
  debugger;
1311
1359
  return console.log("tenantRelationshipsGetByDomain: Failed GET from /findTenantInformationByDomainName: ", l.error.message), !1;
1312
1360
  } else if (l.displayName != null && l.displayName !== "")
1313
- return s.tid = l.tenantId, s.name = l.displayName, console.log("tenantRelationshipsGetByDomain: Successful GET from /findTenantInformationByDomainName: ", l.displayName), !0;
1361
+ return r.tid = l.tenantId, r.name = l.displayName, console.log("tenantRelationshipsGetByDomain: Successful GET from /findTenantInformationByDomainName: ", l.displayName), !0;
1314
1362
  } else
1315
- console.log("tenantRelationshipsGetByDomain: Failed to GET from /findTenantInformationByDomainName: ", d);
1363
+ console.log("tenantRelationshipsGetByDomain: Failed to GET from /findTenantInformationByDomainName: ", c);
1316
1364
  }
1317
1365
  } catch (i) {
1318
1366
  return console.log("Failed to GET from /findTenantInformationByDomainName: ", i), !1;
1319
1367
  }
1320
1368
  return !1;
1321
1369
  }
1322
- async function nt(n, s, r, t, e) {
1370
+ async function ot(n, r, s, t, e) {
1323
1371
  if (console.log("**** tenantRelationshipsGetById"), e) debugger;
1324
1372
  if (n.graphAccessToken === "")
1325
1373
  try {
@@ -1330,19 +1378,19 @@ async function nt(n, s, r, t, e) {
1330
1378
  }
1331
1379
  const a = new Headers(), o = `Bearer ${n.graphAccessToken}`;
1332
1380
  a.append("Authorization", o);
1333
- let d = { method: "GET", headers: a };
1381
+ let c = { method: "GET", headers: a };
1334
1382
  try {
1335
- var i = W(n.authority) + h.graphTenantByIdPredicate;
1336
- i += "(tenantId='", i += s.tid, i += "')", console.log("tenantRelationshipsGetById: Attempting GET from /findTenantInformationByTenantId:", i);
1337
- let c = await (await fetch(i, d)).json();
1338
- if (c && typeof c.displayName !== void 0 && c.displayName !== "") {
1339
- if (s !== void 0)
1340
- s.name = c.displayName, s.domain = c.defaultDomainName;
1383
+ var i = Pe(n.authority) + h.graphTenantByIdPredicate;
1384
+ i += "(tenantId='", i += r.tid, i += "')", console.log("tenantRelationshipsGetById: Attempting GET from /findTenantInformationByTenantId:", i);
1385
+ let d = await (await fetch(i, c)).json();
1386
+ if (d && typeof d.displayName !== void 0 && d.displayName !== "") {
1387
+ if (r !== void 0)
1388
+ r.name = d.displayName, r.domain = d.defaultDomainName;
1341
1389
  else {
1342
1390
  console.log("tenantRelationshipsGetById: missing associated tenant for logged in user.");
1343
1391
  debugger;
1344
1392
  }
1345
- return console.log("tenantRelationshipsGetById: Successful GET from /findTenantInformationByTenantId: ", c.displayName), !0;
1393
+ return console.log("tenantRelationshipsGetById: Successful GET from /findTenantInformationByTenantId: ", d.displayName), !0;
1346
1394
  } else
1347
1395
  console.log("tenantRelationshipsGetById: Failed to GET from /findTenantInformationByTenantId: ", i);
1348
1396
  } catch (l) {
@@ -1350,20 +1398,20 @@ async function nt(n, s, r, t, e) {
1350
1398
  }
1351
1399
  return !1;
1352
1400
  }
1353
- async function Ce(n, s) {
1354
- if (s) debugger;
1355
- let r = [h.authorityWW, h.authorityUS, h.authorityCN], t = [h.authorityWWRegex, h.authorityUSRegex, h.authorityCNRegex], e = null;
1401
+ async function xe(n, r) {
1402
+ if (r) debugger;
1403
+ let s = [h.authorityWW, h.authorityUS, h.authorityCN], t = [h.authorityWWRegex, h.authorityUSRegex, h.authorityCNRegex], e = null;
1356
1404
  try {
1357
1405
  for (let i = 0; i < 3; i++) {
1358
- var a = r[i];
1406
+ var a = s[i];
1359
1407
  if (n.lookupfield == "Domain" ? a += n.domain : n.lookupfield == "Tenant ID" && (a += n.tid), a += "/.well-known/openid-configuration", console.log("Attempting GET from openid well-known endpoint: ", a), e = await fetch(a), e.status == 200) {
1360
1408
  let l = await e.json();
1361
1409
  if (l) {
1362
1410
  var o = l.authorization_endpoint;
1363
- for (let c = 0; c < 3; c++) {
1364
- var d = o.match(t[c]);
1365
- if (d != null)
1366
- return n.tid = d[2], n.authority = d[1], console.log(`Successful GET from openid well-known endpoint: tid: ${n.tid} authority: ${n.authority}`), !0;
1411
+ for (let d = 0; d < 3; d++) {
1412
+ var c = o.match(t[d]);
1413
+ if (c != null)
1414
+ return n.tid = c[2], n.authority = c[1], console.log(`Successful GET from openid well-known endpoint: tid: ${n.tid} authority: ${n.authority}`), !0;
1367
1415
  }
1368
1416
  } else
1369
1417
  console.log(`Failed JSON parse of openid well-known endpoint response ${a}.`);
@@ -1375,237 +1423,205 @@ async function Ce(n, s) {
1375
1423
  }
1376
1424
  return (n.tid == "" || n.authority == "") && console.log(`GET from openid well-known endpoint failed to find tenant: ${e ? e.statusText : "unknown"}`), !1;
1377
1425
  }
1378
- async function ot(n, s, r) {
1379
- if (s == null || s.spacode == "" || r == null) {
1380
- debugger;
1426
+ async function it(n, r, s) {
1427
+ if (r == null || s == null)
1381
1428
  return { scopes: null, id: null, error: "500: invalid parameter(s) passed to getUserDelegatedScopes" };
1382
- }
1383
- let e = { method: "GET", headers: await Z(n, s) };
1384
1429
  try {
1385
- if (r.graphSP == "") {
1386
- let { spid: i, error: l } = await at(e, s, "00000003-0000-0000-c000-000000000000");
1387
- if (l != "") {
1388
- debugger;
1389
- return { scopes: null, id: null, error: `${l}` };
1390
- }
1391
- r.graphSP = i;
1430
+ if (s.graphSP == "") {
1431
+ let { spid: o, error: c } = await ke("00000003-0000-0000-c000-000000000000");
1432
+ if (c != "")
1433
+ return { scopes: null, id: null, error: `${c}` };
1434
+ s.graphSP = o;
1392
1435
  }
1393
- let { grants: a, id: o, error: d } = await st(e, s, r.graphSP, s.oid);
1394
- if (d != "") {
1395
- debugger;
1396
- return { scopes: null, id: null, error: `${d}` };
1397
- }
1398
- return { scopes: a, id: o, error: "" };
1399
- } catch (a) {
1400
- debugger;
1401
- return console.log(a), { scopes: null, id: null, error: `Exception: ${a}` };
1436
+ let { grants: t, id: e, error: a } = await ve(s.graphSP, r.oid);
1437
+ return a != "" ? { scopes: null, id: null, error: `${a}` } : { scopes: t, id: e, error: "" };
1438
+ } catch (t) {
1439
+ return console.log(t), { scopes: null, id: null, error: `Exception: ${t}` };
1402
1440
  }
1403
1441
  }
1404
- async function es(n, s, r, t) {
1405
- if (s == null || s.spacode == "" || r == null) {
1406
- debugger;
1442
+ async function as(n, r, s, t) {
1443
+ if (r == null || s == null)
1407
1444
  return !1;
1408
- }
1409
- let { scopes: e, id: a, error: o } = await ot(n, s, r);
1410
- if (o != "") {
1411
- debugger;
1412
- return console.log(`userDelegatedScopesRemove: cannot find userDelegatedScopes for ${s.mail}: ${o}`), !1;
1413
- }
1445
+ let { scopes: e, id: a, error: o } = await it(n, r, s);
1446
+ if (o != "")
1447
+ return console.log(`userDelegatedScopesRemove: cannot find userDelegatedScopes for ${r.mail}: ${o}`), !1;
1414
1448
  e = e.replace(t, "");
1415
- let d = await rt(n, s, a, e);
1416
- if (!d) {
1417
- debugger;
1418
- return console.log(`userDelegatedScopesRemove: cannot set oauth2PermissionGrants for ${s.mail}: ${o}`), !1;
1419
- }
1420
- return s.scopes = e.split(" "), d;
1449
+ let c = await De(a, e);
1450
+ return c ? (r.scopes = e.split(" "), c) : (console.log(`userDelegatedScopesRemove: cannot set oauth2PermissionGrants for ${r.mail}`), !1);
1421
1451
  }
1422
- async function ts(n, s) {
1423
- if (s == null || s.spacode == "")
1424
- return { users: [], error: "500: invalid user passed to usersGet" };
1425
- try {
1426
- let t = { method: "GET", headers: await Z(n, s) }, e = W(s.authority);
1427
- e += h.graphUsersPredicate;
1428
- let o = await (await fetch(e, t)).json();
1429
- if (typeof o.error < "u")
1430
- return { users: [], error: `${o.error.code}: ${o.error.message}` };
1431
- let d = new Array();
1432
- for (let i of o.value)
1433
- d.push(i.mail);
1434
- return { users: d, error: "" };
1435
- } catch (r) {
1436
- return console.log(r), { users: [], error: `Exception: ${r}` };
1437
- }
1452
+ async function ns(n, r, s) {
1453
+ return await qe(s);
1438
1454
  }
1439
- async function ss(n, s, r, t) {
1440
- return mt(n, s, r, t);
1455
+ async function os(n, r, s, t) {
1456
+ return yt(n, r, s, t);
1441
1457
  }
1442
- async function rs(n, s, r, t) {
1443
- return yt(n, s, r, t);
1458
+ async function is(n, r, s, t) {
1459
+ return wt(n, r, s, t);
1444
1460
  }
1445
- async function as(n, s, r, t, e) {
1446
- return wt(n, s, r, t, e);
1461
+ async function ls(n, r, s, t, e) {
1462
+ return Tt(n, r, s, t, e);
1447
1463
  }
1448
- async function ns(n, s, r, t) {
1449
- return Tt(n, s, r, t);
1464
+ async function us(n, r, s, t) {
1465
+ return St(n, r, s, t);
1450
1466
  }
1451
- async function os(n, s, r) {
1452
- return St(n, s, r);
1467
+ async function cs(n, r, s) {
1468
+ return It(n, r, s);
1453
1469
  }
1454
- async function is(n, s, r, t, e, a, o, d) {
1470
+ async function ds(n, r, s, t, e, a, o, c) {
1455
1471
  let i = new m();
1456
- if (r.id === "1") {
1457
- if (i = await Et(n, s, r, a.id, d), i.result) {
1458
- r.tenants.forEach((f) => {
1459
- (f.configId === "1" || f.configId === "") && (f.configId = r.id);
1460
- }), t && t(r.id);
1472
+ if (s.id === "1") {
1473
+ if (i = await Dt(n, r, s, a.id, c), i.result) {
1474
+ s.tenants.forEach((p) => {
1475
+ (p.configId === "1" || p.configId === "") && (p.configId = s.id);
1476
+ }), t && t(s.id);
1461
1477
  const l = {};
1462
- Object.defineProperty(l, r.id, { value: !0, writable: !0, enumerable: !0 }), e(l);
1463
- let c = a.associatedConfigs.findIndex((f) => f == "1");
1464
- c !== -1 && (a.associatedConfigs.splice(c, 1), a.associatedConfigs.push(r.id));
1478
+ Object.defineProperty(l, s.id, { value: !0, writable: !0, enumerable: !0 }), e(l);
1479
+ let d = a.associatedConfigs.findIndex((p) => p == "1");
1480
+ d !== -1 && (a.associatedConfigs.splice(d, 1), a.associatedConfigs.push(s.id));
1465
1481
  }
1466
1482
  } else
1467
- i = await Dt(n, s, r, d);
1483
+ i = await kt(n, r, s, c);
1468
1484
  return o.save(), i;
1469
1485
  }
1470
- async function ls(n, s, r, t, e) {
1486
+ async function ps(n, r, s, t, e) {
1471
1487
  let a = new m();
1472
- return a = await kt(n, s, r, t, e), a;
1488
+ return a = await vt(n, r, s, t, e), a;
1473
1489
  }
1474
- async function us(n, s, r, t, e) {
1475
- return It(n, s, r, t, e);
1490
+ async function fs(n, r, s, t, e) {
1491
+ return $t(n, r, s, t, e);
1476
1492
  }
1477
- async function ds(n, s, r, t, e) {
1478
- return bt(n, s, r, t, e);
1493
+ async function hs(n, r, s, t, e) {
1494
+ return bt(n, r, s, t, e);
1479
1495
  }
1480
- async function cs(n, s, r, t, e, a) {
1496
+ async function gs(n, r, s, t, e, a) {
1481
1497
  let o = new m();
1482
1498
  if (e) debugger;
1483
1499
  try {
1484
- let d = t.ws.find((i) => i.id === r);
1485
- if (d != null) {
1486
- d.associatedConfigs.length = 0;
1487
- let i = await $t(n, s, a, d.id, e);
1500
+ let c = t.ws.find((i) => i.id === s);
1501
+ if (c != null) {
1502
+ c.associatedConfigs.length = 0;
1503
+ let i = await Et(n, r, a, c.id, e);
1488
1504
  return i.result && t.tagWithWorkspaces(), i;
1489
1505
  } else
1490
1506
  return o.result = !1, o.error = "Workspace not found.", o.status = 404, o;
1491
- } catch (d) {
1492
- return console.log(d.message), o.error = d.message, o.result = !1, o.status = 500, o;
1507
+ } catch (c) {
1508
+ return console.log(c.message), o.error = c.message, o.result = !1, o.status = 500, o;
1493
1509
  }
1494
1510
  }
1495
- async function fs(n, s, r, t, e) {
1496
- return At(n, s, r, t);
1511
+ async function ms(n, r, s, t, e) {
1512
+ return At(n, r, s, t);
1497
1513
  }
1498
- async function ps(n, s, r, t, e) {
1514
+ async function ys(n, r, s, t, e) {
1499
1515
  console.log(">>>>>> initGet");
1500
1516
  let a = new m();
1501
1517
  if (e)
1502
1518
  debugger;
1503
1519
  let o = new j();
1504
- return o.tid = s.tid, o.domain = s.tid, await Ce(o, e) ? (s.authority = o.authority, t.setTaskStart("GET tenant details", /* @__PURE__ */ new Date()), a.result = await nt(s, o, r, n, e), t.setTaskEnd("GET tenant details", /* @__PURE__ */ new Date(), "complete"), a.result && (s.companyName = o.name, s.companyDomain = o.domain, t.setTaskStart("POST config init", /* @__PURE__ */ new Date()), a = await Pt(n, s, e), t.setTaskEnd("POST config init", /* @__PURE__ */ new Date(), a.result ? "complete" : "failed")), a.result && (t.setTaskStart("GET workspaces", /* @__PURE__ */ new Date()), a = await dt(n, s, r, e), t.setTaskEnd("GET workspaces", /* @__PURE__ */ new Date(), a.result ? "complete" : "failed")), console.log("initGet complete. Version: " + L()), a) : (a.error = `Failed to retrieve authority for user "${s.mail}" TID ${s.tid}.`, a.result = !1, a);
1520
+ return o.tid = r.tid, o.domain = r.tid, await xe(o, e) ? (r.authority = o.authority, t.setTaskStart("GET tenant details", /* @__PURE__ */ new Date()), a.result = await ot(r, o, s, n, e), t.setTaskEnd("GET tenant details", /* @__PURE__ */ new Date(), "complete"), a.result && (r.companyName = o.name, r.companyDomain = o.domain, t.setTaskStart("POST config init", /* @__PURE__ */ new Date()), a = await Rt(n, r, e), t.setTaskEnd("POST config init", /* @__PURE__ */ new Date(), a.result ? "complete" : "failed")), a.result && (t.setTaskStart("GET workspaces", /* @__PURE__ */ new Date()), a = await dt(n, r, s, e), t.setTaskEnd("GET workspaces", /* @__PURE__ */ new Date(), a.result ? "complete" : "failed")), console.log("initGet complete. Version: " + F()), a) : (a.error = `Failed to retrieve authority for user "${r.mail}" TID ${r.tid}.`, a.result = !1, a);
1505
1521
  }
1506
- async function hs(n, s, r, t) {
1507
- return xt(n, s, r, t);
1522
+ async function ws(n, r, s, t) {
1523
+ return xt(n, r, s, t);
1508
1524
  }
1509
- async function gs(n, s, r, t, e) {
1510
- return Rt(n, s, r, t);
1525
+ async function Ts(n, r, s, t, e) {
1526
+ return Gt(n, r, s, t);
1511
1527
  }
1512
- async function ms(n, s, r, t) {
1513
- return gt(n, s, r, t);
1528
+ async function Ss(n, r, s, t) {
1529
+ return mt(n, r, s, t);
1514
1530
  }
1515
- async function ys(n, s, r, t) {
1516
- return pt(n, s, r, t);
1531
+ async function Is(n, r, s, t) {
1532
+ return ht(n, r, s, t);
1517
1533
  }
1518
- async function ws(n, s, r, t) {
1519
- return await Ct(n, s, r, t);
1534
+ async function $s(n, r, s, t) {
1535
+ return await Ot(n, r, s, t);
1520
1536
  }
1521
- function it(n, s, r, t) {
1522
- r.map((e) => {
1523
- let a = null, o = s.us.findIndex((l) => l.oid === e.userId || l.oid === e.email);
1537
+ function lt(n, r, s, t) {
1538
+ s.map((e) => {
1539
+ let a = null, o = r.us.findIndex((l) => l.oid === e.userId || l.oid === e.email);
1524
1540
  if (o === -1) {
1525
- let l = s.us.findIndex((c) => c.oid === "1");
1541
+ let l = r.us.findIndex((d) => d.oid === "1");
1526
1542
  if (l !== -1) {
1527
- a = s.us.at(l);
1528
- let c = n.associatedUsers.findIndex((f) => f == "1");
1529
- c !== -1 && (n.associatedUsers.splice(c, 1), n.associatedUsers.push(e.userId));
1543
+ a = r.us.at(l);
1544
+ let d = n.associatedUsers.findIndex((p) => p == "1");
1545
+ d !== -1 && (n.associatedUsers.splice(d, 1), n.associatedUsers.push(e.userId));
1530
1546
  } else
1531
- a = new fe(), s.us.push(a);
1547
+ a = new ie(), r.us.push(a);
1532
1548
  } else
1533
- a = s.us.at(o);
1549
+ a = r.us.at(o);
1534
1550
  a.sel = t === e.userId, a.oid = e.userId ? e.userId : e.email, a.name = e.firstName ?? a.name, a.mail = e.email, a.tid = e.tenantId;
1535
- let d = s.ts.find((l) => l.tid === a.tid);
1536
- d != null && (a.authority = d.authority, a.companyName = d.name, a.companyDomain = d.domain), n.associatedUsers.findIndex((l) => l === a.oid) == -1 && n.associatedUsers.push(a.oid);
1537
- }), s.save();
1551
+ let c = r.ts.find((l) => l.tid === a.tid);
1552
+ c != null && (a.authority = c.authority, a.companyName = c.name, a.companyDomain = c.domain), n.associatedUsers.findIndex((l) => l === a.oid) == -1 && n.associatedUsers.push(a.oid);
1553
+ }), r.save();
1538
1554
  }
1539
- function lt(n, s, r, t) {
1540
- r.map((e) => {
1541
- let a = null, o = s.ts.findIndex((c) => c.tid === e.tenantId);
1555
+ function ut(n, r, s, t) {
1556
+ s.map((e) => {
1557
+ let a = null, o = r.ts.findIndex((d) => d.tid === e.tenantId);
1542
1558
  if (o === -1) {
1543
- let c = s.ts.findIndex((f) => f.tid === "1");
1544
- if (c !== -1) {
1545
- a = s.ts.at(c);
1546
- let f = n.associatedTenants.findIndex((b) => b == "1");
1547
- f !== -1 && (n.associatedTenants.splice(f, 1), n.associatedTenants.push(e.tenantId));
1559
+ let d = r.ts.findIndex((p) => p.tid === "1");
1560
+ if (d !== -1) {
1561
+ a = r.ts.at(d);
1562
+ let p = n.associatedTenants.findIndex(($) => $ == "1");
1563
+ p !== -1 && (n.associatedTenants.splice(p, 1), n.associatedTenants.push(e.tenantId));
1548
1564
  } else
1549
- a = new j(), s.ts.push(a);
1565
+ a = new j(), r.ts.push(a);
1550
1566
  } else
1551
- a = s.ts.at(o);
1567
+ a = r.ts.at(o);
1552
1568
  a.sel = t === e.tenantId, a.tid = e.tenantId, a.name = e.name, a.domain = e.domain, a.tenantType = e.type.toLowerCase();
1553
- const d = /^(https:\/\/login.microsoftonline.(?:us|com)\/)organizations\/v2.0$/, i = e.authority.match(d);
1554
- a.authority = i ? i[1] : e.authority, n.associatedTenants.findIndex((c) => c === e.tenantId) == -1 && n.associatedTenants.push(e.tenantId);
1555
- }), s.save();
1569
+ const c = /^(https:\/\/login.microsoftonline.(?:us|com)\/)organizations\/v2.0$/, i = e.authority.match(c);
1570
+ a.authority = i ? i[1] : e.authority, n.associatedTenants.findIndex((d) => d === e.tenantId) == -1 && n.associatedTenants.push(e.tenantId);
1571
+ }), r.save();
1556
1572
  }
1557
- function ut(n, s, r, t) {
1558
- r.map((e) => {
1559
- let a = null, o = s.cs.findIndex((i) => i.id === e.id);
1573
+ function ct(n, r, s, t) {
1574
+ s.map((e) => {
1575
+ let a = null, o = r.cs.findIndex((i) => i.id === e.id);
1560
1576
  if (o === -1) {
1561
- let i = s.cs.findIndex((l) => l.id === "1");
1577
+ let i = r.cs.findIndex((l) => l.id === "1");
1562
1578
  if (i !== -1) {
1563
- a = s.cs.at(i);
1564
- let l = n.associatedConfigs.findIndex((c) => c == "1");
1579
+ a = r.cs.at(i);
1580
+ let l = n.associatedConfigs.findIndex((d) => d == "1");
1565
1581
  l !== -1 && (n.associatedConfigs.splice(l, 1), n.associatedConfigs.push(e.id));
1566
1582
  } else
1567
- a = new pe(), s.cs.push(a);
1583
+ a = new le(), r.cs.push(a);
1568
1584
  } else
1569
- a = s.cs.at(o);
1585
+ a = r.cs.at(o);
1570
1586
  a.sel = t === e.id, a.id = e.id, a.workspaceId = e.workspaceId, a.name = e.name, a.description = e.description, a.isEnabled = e.isEnabled, a.tenants.length = 0, e.tenants.map((i) => {
1571
- let l = new Ve();
1587
+ let l = new st();
1572
1588
  l.tid = i.tenantId, l.sourceGroupId = i.sourceGroupId ?? "", l.sourceGroupName = i.sourceGroupName ?? "", l.targetGroupId = i.targetGroupId ?? "", l.targetGroupName = i.targetGroupName ?? "", l.configurationTenantType = i.configurationTenantType.toLowerCase(), l.deltaToken = i.deltaToken ?? "", l.configId = a.id, l.batchId = i.batchId ?? "", l.isReadPermissionConsented = i.isReadPermissionConsented, l.isWritePermissionConsented = i.isWritePermissionConsented, a.tenants.push(l);
1573
1589
  }), n.associatedConfigs.findIndex((i) => i === e.id) == -1 && n.associatedConfigs.push(e.id);
1574
- }), console.log("--------------ii-----------", s), s.save();
1590
+ }), console.log("--------------ii-----------", r), r.save();
1575
1591
  }
1576
- async function dt(n, s, r, t) {
1592
+ async function dt(n, r, s, t) {
1577
1593
  let e = new m();
1578
1594
  if (t) debugger;
1579
1595
  try {
1580
- if (e = await Ot(n, s, t), e.result) {
1596
+ if (e = await Nt(n, r, t), e.result) {
1581
1597
  for (let a of e.array) {
1582
- let o = null, d = r.ws.findIndex((v) => v.id === a.id);
1583
- if (d === -1) {
1584
- let v = r.ws.findIndex((k) => k.id === "1");
1585
- v !== -1 ? o = r.ws.at(v) : (o = new he(), r.ws.push(o));
1598
+ let o = null, c = s.ws.findIndex((D) => D.id === a.id);
1599
+ if (c === -1) {
1600
+ let D = s.ws.findIndex((A) => A.id === "1");
1601
+ D !== -1 ? o = s.ws.at(D) : (o = new ue(), s.ws.push(o));
1586
1602
  } else
1587
- o = r.ws.at(d);
1603
+ o = s.ws.at(c);
1588
1604
  let i = "";
1589
- for (let v of o.associatedUsers) {
1590
- let k = r.us.find((O) => O.oid === v);
1591
- k != null && k.sel && (i = k.oid);
1605
+ for (let D of o.associatedUsers) {
1606
+ let A = s.us.find((O) => O.oid === D);
1607
+ A != null && A.sel && (i = A.oid);
1592
1608
  }
1593
1609
  let l = "";
1594
- for (let v of o.associatedTenants) {
1595
- let k = r.ts.find((O) => O.tid === v);
1596
- k != null && k.sel && (l = k.tid);
1610
+ for (let D of o.associatedTenants) {
1611
+ let A = s.ts.find((O) => O.tid === D);
1612
+ A != null && A.sel && (l = A.tid);
1597
1613
  }
1598
- let c = "";
1599
- for (let v of o.associatedConfigs) {
1600
- let k = r.cs.find((O) => O.id === v);
1601
- k != null && k.sel && (c = k.id);
1614
+ let d = "";
1615
+ for (let D of o.associatedConfigs) {
1616
+ let A = s.cs.find((O) => O.id === D);
1617
+ A != null && A.sel && (d = A.id);
1602
1618
  }
1603
1619
  o.associatedUsers.length = 0, o.associatedTenants.length = 0, o.associatedConfigs.length = 0, o.id = a.id, o.name = a.name, o.ownerid = a.workspaceOwnerUserId;
1604
- let f = ht(n, s, o.id, t), b = Gt(n, s, o.id, t), A = vt(n, s, o.id, t), [C, N, B] = await Promise.all([f, b, A]);
1605
- if (!C.result) return C;
1620
+ let p = gt(n, r, o.id, t), $ = Ct(n, r, o.id, t), E = Pt(n, r, o.id, t), [x, N, U] = await Promise.all([p, $, E]);
1621
+ if (!x.result) return x;
1606
1622
  if (!N.result) return N;
1607
- if (!B.result) return B;
1608
- lt(o, r, N.array, l), it(o, r, C.array, i), ut(o, r, B.array, c), r.tagWithWorkspaces();
1623
+ if (!U.result) return U;
1624
+ ut(o, s, N.array, l), lt(o, s, x.array, i), ct(o, s, U.array, d), s.tagWithWorkspaces();
1609
1625
  }
1610
1626
  return e;
1611
1627
  }
@@ -1614,13 +1630,13 @@ async function dt(n, s, r, t) {
1614
1630
  }
1615
1631
  return e.result = !1, e.status = 500, e;
1616
1632
  }
1617
- async function Ts(n, s) {
1618
- let r = "", t = L();
1633
+ async function bs(n, r) {
1634
+ let s = "", t = F();
1619
1635
  try {
1620
- let e = n.getAllAccounts(), a = s.oid + "." + s.tid, o = null;
1636
+ let e = n.getAllAccounts(), a = r.oid + "." + r.tid, o = null;
1621
1637
  for (let i = 0; i < e.length; i++)
1622
1638
  e[i].homeAccountId == a && (o = e[i]);
1623
- r = (await n.acquireTokenSilent({
1639
+ s = (await n.acquireTokenSilent({
1624
1640
  scopes: [
1625
1641
  "https://analysis.windows.net/powerbi/api/App.Read.All",
1626
1642
  "https://analysis.windows.net/powerbi/api/Dataset.ReadWrite.All",
@@ -1628,262 +1644,194 @@ async function Ts(n, s) {
1628
1644
  "https://analysis.windows.net/powerbi/api/Workspace.ReadWrite.All"
1629
1645
  ],
1630
1646
  account: o
1631
- })).accessToken, console.log("PowerBI token acquired silently: " + r.slice(0, 20));
1647
+ })).accessToken, console.log("PowerBI token acquired silently: " + s.slice(0, 20));
1632
1648
  } catch {
1633
1649
  console.log("PowerBI token failed to be acquired silently");
1634
1650
  }
1635
- return console.log(t), r;
1651
+ return console.log(t), s;
1636
1652
  }
1637
- async function Te(n, s) {
1638
- const r = new Headers();
1639
- if (r.append("Content-Type", "application/json"), r.append("accept", "*/*"), s.azureAccessToken == null || s.azureAccessToken === "")
1640
- try {
1641
- let t = n.getAllAccounts(), e = s.oid + "." + s.tid, a = null;
1642
- for (let d = 0; d < t.length; d++)
1643
- t[d].homeAccountId == e && (a = t[d]);
1644
- let o = await n.acquireTokenSilent({
1645
- scopes: ["https://management.azure.com/user_impersonation"],
1646
- account: a
1647
- });
1648
- s.azureAccessToken = o.accessToken, console.log("Front end token acquired silently: " + s.azureAccessToken.slice(0, 20));
1649
- } catch (t) {
1650
- try {
1651
- console.log("Front end token silent acquisition failure: " + t);
1652
- let e = n.getAllAccounts(), a = s.oid + "." + s.tid, o = null;
1653
- for (let d = 0; d < e.length; d++)
1654
- e[d].homeAccountId == a && (o = e[d]);
1655
- n.acquireTokenRedirect({
1656
- scopes: ["https://management.azure.com/user_impersonation"],
1657
- account: o
1658
- });
1659
- } catch (e) {
1660
- console.log("Front end token popup acquisition failure: " + e);
1661
- }
1662
- }
1663
- return r.append("Authorization", `Bearer ${s.azureAccessToken}`), r;
1653
+ async function Es(n, r) {
1654
+ return await Je();
1664
1655
  }
1665
- async function Ss(n, s) {
1666
- if (s == null || s.spacode == "")
1667
- return !1;
1668
- try {
1669
- let t = { method: "GET", headers: await Te(n, s) }, e = M.azureListRootAssignments;
1670
- e += "'", e += s.oid, e += "'";
1671
- let a = await fetch(e, t);
1672
- if (a.status == 200) {
1673
- let o = await a.json();
1674
- o = o;
1675
- debugger;
1676
- console.log("Successful call to Azure Resource Graph list root assignments");
1677
- } else
1678
- return console.log(await y(a)), !1;
1679
- } catch (r) {
1680
- return console.log(r), !1;
1681
- }
1682
- return !0;
1656
+ async function As(n, r) {
1657
+ return await Ve();
1683
1658
  }
1684
- async function Is(n, s) {
1685
- if (s == null || s.spacode == "")
1686
- return !1;
1659
+ async function pt(n, r) {
1687
1660
  try {
1688
- let t = { method: "POST", headers: await Te(n, s) }, e = M.azureElevateAccess, a = await fetch(e, t);
1689
- if (a.status == 200)
1690
- console.log("Successful call to Azure Resource Graph list root assignments");
1691
- else
1692
- return console.log(await y(a)), !1;
1693
- } catch (r) {
1694
- return console.log(r), !1;
1695
- }
1696
- return !0;
1697
- }
1698
- async function ct(n, s) {
1699
- let r = new Array();
1700
- if (s == null || s.spacode == "")
1701
- return r;
1702
- try {
1703
- let e = { method: "GET", headers: await Te(n, s) }, a = M.azureListRootAssignments;
1704
- a += "'", a += s.oid, a += "'";
1705
- let o = await fetch(a, e);
1706
- if (o.status == 200) {
1707
- let d = await o.json();
1708
- d = d;
1709
- debugger;
1710
- console.log("Successful call to Azure Resource Graph list root assignments");
1711
- } else
1712
- return console.log(await y(o)), r;
1713
- } catch (t) {
1714
- return console.log(t), r;
1661
+ return (await Ze()).map((e) => new Ce(e.type, e.name, 0));
1662
+ } catch (s) {
1663
+ return console.error("Error in readResources:", s), [];
1715
1664
  }
1716
- return r;
1717
1665
  }
1718
1666
  function ft(n) {
1719
- let s = "8d95d21c-c378-4bb0-9f52-88c30d271e7a", r = n.authority.toLowerCase();
1720
- return r.startsWith("https://login.microsoftonline.com/") ? s = "8d95d21c-c378-4bb0-9f52-88c30d271e7a" : r.startsWith("https://login.microsoftonline.us/") ? s = "48da942e-ea3d-49e4-a054-81649012f8f2" : r.startsWith("https://login.partner.microsoftonline.cn/") && (s = "c91d32e4-dcc5-4d77-826a-16e93ffce666"), `api://${s}/Config.Write`;
1667
+ let r = "8d95d21c-c378-4bb0-9f52-88c30d271e7a", s = n.authority.toLowerCase();
1668
+ return s.startsWith("https://login.microsoftonline.com/") ? r = "8d95d21c-c378-4bb0-9f52-88c30d271e7a" : s.startsWith("https://login.microsoftonline.us/") ? r = "48da942e-ea3d-49e4-a054-81649012f8f2" : s.startsWith("https://login.partner.microsoftonline.cn/") && (r = "c91d32e4-dcc5-4d77-826a-16e93ffce666"), `api://${r}/Config.Write`;
1721
1669
  }
1722
- async function I(n, s) {
1723
- const r = new Headers();
1724
- r.append("Content-Type", "application/json"), r.append("accept", "*/*");
1725
- const t = ft(s);
1670
+ async function I(n, r) {
1671
+ const s = new Headers();
1672
+ s.append("Content-Type", "application/json"), s.append("accept", "*/*");
1673
+ const t = ft(r);
1726
1674
  try {
1727
- let e = n.getAllAccounts(), a = s.oid + "." + s.tid, o = null;
1675
+ let e = n.getAllAccounts(), a = r.oid + "." + r.tid, o = null;
1728
1676
  for (let i = 0; i < e.length; i++)
1729
1677
  e[i].homeAccountId == a && (o = e[i]);
1730
- let d = await n.acquireTokenSilent({
1678
+ let c = await n.acquireTokenSilent({
1731
1679
  scopes: [t],
1732
1680
  account: o
1733
1681
  });
1734
- s.mindlineAccessToken = d.accessToken, console.log("Front end mindline token acquired silently: " + s.mindlineAccessToken.slice(0, 20));
1682
+ r.mindlineAccessToken = c.accessToken, console.log("Front end mindline token acquired silently: " + r.mindlineAccessToken.slice(0, 20));
1735
1683
  } catch (e) {
1736
1684
  try {
1737
1685
  console.log("Front end mindline token silent acquisition failure, triggering redirect: " + e);
1738
- let a = n.getAllAccounts(), o = s.oid + "." + s.tid, d = null;
1686
+ let a = n.getAllAccounts(), o = r.oid + "." + r.tid, c = null;
1739
1687
  for (let i = 0; i < a.length; i++)
1740
- a[i].homeAccountId == o && (d = a[i]);
1688
+ a[i].homeAccountId == o && (c = a[i]);
1741
1689
  n.acquireTokenRedirect({
1742
1690
  scopes: [t],
1743
- account: d
1691
+ account: c
1744
1692
  });
1745
1693
  } catch (a) {
1746
1694
  console.log("Front end mindline token redirect acquisition failure: " + a);
1747
1695
  }
1748
1696
  }
1749
- return r.append("Authorization", `Bearer ${s.mindlineAccessToken}`), r;
1750
- }
1751
- async function y(n) {
1752
- let s = "";
1753
- if (n.status === 401 && (s = n.statusText, s != ""))
1754
- return s;
1755
- let r = await n.json();
1756
- if (r.error !== void 0)
1757
- s = `Error: ${r.error} Message: ${r.message}`;
1758
- else if (r.errors !== void 0)
1759
- s = Object.keys(r.errors).reduce(
1760
- (a, o) => a + o + ": " + r.errors[o] + " ",
1697
+ return s.append("Authorization", `Bearer ${r.mindlineAccessToken}`), s;
1698
+ }
1699
+ async function S(n) {
1700
+ let r = "";
1701
+ if (n.status === 401 && (r = n.statusText, r != ""))
1702
+ return r;
1703
+ let s = await n.json();
1704
+ if (s.error !== void 0)
1705
+ r = `Error: ${s.error} Message: ${s.message}`;
1706
+ else if (s.errors !== void 0)
1707
+ r = Object.keys(s.errors).reduce(
1708
+ (a, o) => a + o + ": " + s.errors[o] + " ",
1761
1709
  ""
1762
1710
  );
1763
- else if (r.title !== void 0)
1764
- s = r.title;
1711
+ else if (s.title !== void 0)
1712
+ r = s.title;
1765
1713
  else
1766
1714
  debugger;
1767
- return s;
1715
+ return r;
1768
1716
  }
1769
- async function pt(n, s, r, t) {
1717
+ async function ht(n, r, s, t) {
1770
1718
  let e = new m();
1771
- if (r.oid == "" && r.mail == "" || t == "")
1719
+ if (s.oid == "" && s.mail == "" || t == "")
1772
1720
  return e.result = !1, e.error = "adminDelete: invalid parameters", e.status = 500, e;
1773
1721
  let a = null;
1774
- a = new URL(S.adminEndpoint()), a.searchParams.append("workspaceId", t), a.searchParams.append("email", r.mail);
1775
- let d = { method: "DELETE", headers: await I(n, s) };
1722
+ a = new URL(T.adminEndpoint()), a.searchParams.append("workspaceId", t), a.searchParams.append("email", s.mail);
1723
+ let c = { method: "DELETE", headers: await I(n, r) };
1776
1724
  try {
1777
1725
  console.log("Attempting DELETE from /admin: " + a.href);
1778
- let i = await fetch(a.href, d);
1779
- return i.status === 200 && i.statusText === "OK" ? (console.log(`Successful DELETE from /admin: ${a.href}`), e) : (e.error = await y(i), console.log(`Failed DELETE from /admin: ${a.href}`), console.log(e.error), e.status = 500, e.result = !1, e);
1726
+ let i = await fetch(a.href, c);
1727
+ return i.status === 200 && i.statusText === "OK" ? (console.log(`Successful DELETE from /admin: ${a.href}`), e) : (e.error = await S(i), console.log(`Failed DELETE from /admin: ${a.href}`), console.log(e.error), e.status = 500, e.result = !1, e);
1780
1728
  } catch (i) {
1781
1729
  e.error = i.message, e.status = 500, e.result = !1, console.log(i.message);
1782
1730
  }
1783
1731
  return e;
1784
1732
  }
1785
- async function ht(n, s, r, t) {
1733
+ async function gt(n, r, s, t) {
1786
1734
  let e = new m();
1787
- if (r === "")
1735
+ if (s === "")
1788
1736
  return e.result = !1, e.status = 500, e.error = "adminsGet: no workspace provided", e;
1789
- let a = S.adminsEndpoint(), o = new URL(a);
1790
- o.searchParams.append("workspaceId", r);
1791
- let i = { method: "GET", headers: await I(n, s) };
1737
+ let a = T.adminsEndpoint(), o = new URL(a);
1738
+ o.searchParams.append("workspaceId", s);
1739
+ let i = { method: "GET", headers: await I(n, r) };
1792
1740
  try {
1793
1741
  if (t) debugger;
1794
1742
  console.log("Attempting GET from /admins: " + o.href);
1795
1743
  let l = await fetch(o.href, i);
1796
1744
  if (l.status === 200 && l.statusText === "OK") {
1797
- let c = await l.json();
1798
- return c != null ? (e.array = c, console.log(`Successful GET from /admins: ${e.array.reduce((b, A) => b + A.email + " ", "")}`), e) : (e.error = "Failed GET from /admins: failed to JSON-parse response", console.log(e.error), e.status = 500, e.result = !1, e);
1745
+ let d = await l.json();
1746
+ return d != null ? (e.array = d, console.log(`Successful GET from /admins: ${e.array.reduce(($, E) => $ + E.email + " ", "")}`), e) : (e.error = "Failed GET from /admins: failed to JSON-parse response", console.log(e.error), e.status = 500, e.result = !1, e);
1799
1747
  } else
1800
- return console.log(`Failed GET from /admins: ${o.href}`), e.error = await y(l), e.status = 500, e.result = !1, console.log(e.error), e;
1748
+ return console.log(`Failed GET from /admins: ${o.href}`), e.error = await S(l), e.status = 500, e.result = !1, console.log(e.error), e;
1801
1749
  } catch (l) {
1802
1750
  e.error = l.message, e.status = 500, e.result = !1, console.log(l.message);
1803
1751
  }
1804
1752
  return e;
1805
1753
  }
1806
- async function gt(n, s, r, t) {
1754
+ async function mt(n, r, s, t) {
1807
1755
  let e = new m();
1808
- if (r.mail == "" || r.authority == "" || r.tid === "")
1756
+ if (s.mail == "" || s.authority == "" || s.tid === "")
1809
1757
  return e.result = !1, e.error = "adminPost: invalid argument", e.status = 500, e;
1810
- let a = S.adminEndpoint();
1811
- const o = await I(n, s);
1812
- let d = `
1813
- {"email": "${r.mail}",
1814
- "tenantId": "${r.tid}",
1758
+ let a = T.adminEndpoint();
1759
+ const o = await I(n, r);
1760
+ let c = `
1761
+ {"email": "${s.mail}",
1762
+ "tenantId": "${s.tid}",
1815
1763
  "workspaceId": "${t}"
1816
- }`, i = { method: "POST", headers: o, body: d };
1764
+ }`, i = { method: "POST", headers: o, body: c };
1817
1765
  try {
1818
1766
  console.log("Attempting POST to /admin: " + a);
1819
1767
  let l = await fetch(a, i);
1820
- return l.status === 200 && l.statusText === "OK" ? (console.log(`Successful POST to /admin: ${d}`), e) : (e.error = await y(l), console.log(`Failed POST to /admin: ${d}`), console.log(e.error), e.status = 500, e.result = !1, e);
1768
+ return l.status === 200 && l.statusText === "OK" ? (console.log(`Successful POST to /admin: ${c}`), e) : (e.error = await S(l), console.log(`Failed POST to /admin: ${c}`), console.log(e.error), e.status = 500, e.result = !1, e);
1821
1769
  } catch (l) {
1822
1770
  e.error = l.message, e.status = 500, e.result = !1, console.log(l.message);
1823
1771
  }
1824
1772
  return e;
1825
1773
  }
1826
- async function mt(n, s, r, t) {
1827
- n = n, s = s, t = t;
1774
+ async function yt(n, r, s, t) {
1775
+ n = n, r = r, t = t;
1828
1776
  let e = new m();
1829
- if (r.id === "")
1777
+ if (s.id === "")
1830
1778
  return e.result = !1, e.error = "auditConfigPost: invalid config ID", e.status = 500, e;
1831
- let a = S.auditConfigEndpoint();
1832
- const o = await I(n, s);
1833
- let d = `
1779
+ let a = T.auditConfigEndpoint();
1780
+ const o = await I(n, r);
1781
+ let c = `
1834
1782
  {
1835
- "workspaceId": "${r.workspaceId}",
1836
- "name": "${r.name}",
1837
- "description": "${r.description}",
1838
- "isEnabled": ${r.isEnabled},
1839
- "email": "${r.email}",
1840
- "tenantId": "${r.tenantId}"
1841
- }`, i = { method: "POST", headers: o, body: d };
1783
+ "workspaceId": "${s.workspaceId}",
1784
+ "name": "${s.name}",
1785
+ "description": "${s.description}",
1786
+ "isEnabled": ${s.isEnabled},
1787
+ "email": "${s.email}",
1788
+ "tenantId": "${s.tenantId}"
1789
+ }`, i = { method: "POST", headers: o, body: c };
1842
1790
  try {
1843
1791
  if (t) debugger;
1844
1792
  console.log("Attempting POST to /audit-configuration: " + a);
1845
1793
  let l = await fetch(a, i);
1846
1794
  if (l.status === 200 && l.statusText === "OK") {
1847
- let c = await l.json();
1848
- return r.id = c, console.log(
1849
- `Successful AuditConfigID: ${c} from POST to /audit-configuration: ${d}`
1795
+ let d = await l.json();
1796
+ return s.id = d, console.log(
1797
+ `Successful AuditConfigID: ${d} from POST to /audit-configuration: ${c}`
1850
1798
  ), e;
1851
1799
  } else
1852
- return e.error = await y(l), console.log(`Failed POST to /audit-configuration: ${d}`), console.log(e.error), e.status = 500, e.result = !1, e;
1800
+ return e.error = await S(l), console.log(`Failed POST to /audit-configuration: ${c}`), console.log(e.error), e.status = 500, e.result = !1, e;
1853
1801
  } catch (l) {
1854
1802
  return e.status = 500, e.result = !1, e.error = l.message, console.log(e.error), e;
1855
1803
  }
1856
1804
  return e;
1857
1805
  }
1858
- async function yt(n, s, r, t) {
1859
- n = n, s = s, t = t;
1806
+ async function wt(n, r, s, t) {
1807
+ n = n, r = r, t = t;
1860
1808
  let e = new m();
1861
- if (s.mail == null || s.mail == "")
1809
+ if (r.mail == null || r.mail == "")
1862
1810
  return e.result = !1, e.status = 500, e.error = "auditConfigGet: no user provided", e;
1863
- if (!r || r.trim() === "")
1811
+ if (!s || s.trim() === "")
1864
1812
  return e.result = !1, e.error = "auditConfigGet: configurationId is required", e.status = 500, e;
1865
- let a = S.auditConfigEndpoint(), o = new URL(`${a}/${r}`), i = { method: "GET", headers: await I(n, s) };
1813
+ let a = T.auditConfigEndpoint(), o = new URL(`${a}/${s}`), i = { method: "GET", headers: await I(n, r) };
1866
1814
  try {
1867
1815
  if (t) debugger;
1868
1816
  console.log("Attempting GET to /audit-configuration: " + o.href);
1869
1817
  const l = await fetch(o.href, i);
1870
1818
  if (l.status === 200 && l.statusText === "OK") {
1871
- let c = await l.json();
1872
- e.result = !0, e.status = l.status, console.log("Successful GET from /audit-configuration:", c);
1819
+ let d = await l.json();
1820
+ e.result = !0, e.status = l.status, console.log("Successful GET from /audit-configuration:", d);
1873
1821
  } else
1874
- e.error = await y(l), console.log("Failed GET from /audit-configuration: " + o.href), console.log(e.error), e.status = l.status, e.result = !1;
1822
+ e.error = await S(l), console.log("Failed GET from /audit-configuration: " + o.href), console.log(e.error), e.status = l.status, e.result = !1;
1875
1823
  } catch (l) {
1876
1824
  e.status = 500, e.result = !1, e.error = l.message, console.log("Error during auditConfigGet:", l.message);
1877
1825
  }
1878
1826
  return e;
1879
1827
  }
1880
- async function wt(n, s, r, t, e) {
1828
+ async function Tt(n, r, s, t, e) {
1881
1829
  let a = new m();
1882
- if (!r || r.trim() === "")
1830
+ if (!s || s.trim() === "")
1883
1831
  return a.result = !1, a.error = "auditConfigPut: invalid configuration ID", a.status = 500, a;
1884
- let o = S.auditConfigEndpoint(), d = new URL(o);
1885
- d.searchParams.append("configurationId", r);
1886
- const i = await I(n, s);
1832
+ let o = T.auditConfigEndpoint(), c = new URL(o);
1833
+ c.searchParams.append("configurationId", s);
1834
+ const i = await I(n, r);
1887
1835
  let l = `
1888
1836
  {
1889
1837
  "name": "${t.name}",
@@ -1891,448 +1839,448 @@ async function wt(n, s, r, t, e) {
1891
1839
  "isEnabled": ${t.isEnabled},
1892
1840
  "isReadPermissionConsented": ${t.isReadPermissionConsented},
1893
1841
  "email": "${t.email}"
1894
- }`, c = { method: "PUT", headers: i, body: l };
1842
+ }`, d = { method: "PUT", headers: i, body: l };
1895
1843
  try {
1896
1844
  if (e) debugger;
1897
- console.log("Attempting PUT to /audit-configuration: " + d.href);
1898
- const f = await fetch(d.href, c);
1899
- f.status === 200 && f.statusText === "OK" ? (a.result = !0, console.log(`Successful PUT to ${d.href}: ${l}`)) : (a.error = await y(f), console.error(`Failed PUT to ${d.href}: ${l}`), a.status = f.status, a.result = !1);
1900
- } catch (f) {
1901
- a.error = f.message, a.status = 500, a.result = !1, console.error("Error during auditConfigPut:", f.message);
1845
+ console.log("Attempting PUT to /audit-configuration: " + c.href);
1846
+ const p = await fetch(c.href, d);
1847
+ p.status === 200 && p.statusText === "OK" ? (a.result = !0, console.log(`Successful PUT to ${c.href}: ${l}`)) : (a.error = await S(p), console.error(`Failed PUT to ${c.href}: ${l}`), a.status = p.status, a.result = !1);
1848
+ } catch (p) {
1849
+ a.error = p.message, a.status = 500, a.result = !1, console.error("Error during auditConfigPut:", p.message);
1902
1850
  }
1903
1851
  return a;
1904
1852
  }
1905
- async function Tt(n, s, r, t) {
1853
+ async function St(n, r, s, t) {
1906
1854
  let e = new m();
1907
- if (!s.mail)
1855
+ if (!r.mail)
1908
1856
  return e.result = !1, e.status = 500, e.error = "auditConfigDelete: no user provided", e;
1909
- if (!r || r.trim() === "")
1857
+ if (!s || s.trim() === "")
1910
1858
  return e.result = !1, e.status = 500, e.error = "auditConfigDelete: configurationId is required", e;
1911
- let a = S.auditConfigEndpoint(), o = new URL(a);
1912
- o.searchParams.append("configurationId", r);
1913
- const i = { method: "DELETE", headers: await I(n, s) };
1859
+ let a = T.auditConfigEndpoint(), o = new URL(a);
1860
+ o.searchParams.append("configurationId", s);
1861
+ const i = { method: "DELETE", headers: await I(n, r) };
1914
1862
  try {
1915
1863
  if (t) debugger;
1916
1864
  console.log(`Attempting DELETE to /audit-configuration: ${o.href}`);
1917
1865
  const l = await fetch(o.href, i);
1918
- l.ok ? (e.result = !0, console.log(`Successful DELETE for configurationId ${r}`)) : (e.error = await y(l), e.status = l.status, e.result = !1, console.error(`Failed DELETE for configurationId ${r}`));
1866
+ l.ok ? (e.result = !0, console.log(`Successful DELETE for configurationId ${s}`)) : (e.error = await S(l), e.status = l.status, e.result = !1, console.error(`Failed DELETE for configurationId ${s}`));
1919
1867
  } catch (l) {
1920
1868
  e.status = 500, e.result = !1, e.error = l.message, console.error("Error during auditConfigDelete:", l.message);
1921
1869
  }
1922
1870
  return e;
1923
1871
  }
1924
- async function St(n, s, r) {
1872
+ async function It(n, r, s) {
1925
1873
  let t = new m();
1926
- if (s.mail == null || s.mail == "")
1874
+ if (r.mail == null || r.mail == "")
1927
1875
  return t.result = !1, t.status = 500, t.error = "auditEventsGet: no user provided", t;
1928
- let e = S.auditEventsEndpoint(), a = new URL(e), d = { method: "GET", headers: await I(n, s) };
1876
+ let e = T.auditEventsEndpoint(), a = new URL(e), c = { method: "GET", headers: await I(n, r) };
1929
1877
  try {
1930
- if (r) debugger;
1878
+ if (s) debugger;
1931
1879
  console.log("Attempting GET from /audit-events endpoint: " + a.href);
1932
- let i = await fetch(a.href, d);
1880
+ let i = await fetch(a.href, c);
1933
1881
  if (i.status === 200 && i.statusText === "OK") {
1934
1882
  let l = await i.json();
1935
1883
  if (Array.isArray(l.data)) {
1936
- let c = l.data;
1937
- if (c != null)
1938
- return t.array = c, console.log(`Successful GET from /audit-events: ${t.array.reduce((b, A) => b + A.initiatedByUser + " ", "")}`), t;
1884
+ let d = l.data;
1885
+ if (d != null)
1886
+ return t.array = d, console.log(`Successful GET from /audit-events: ${t.array.reduce(($, E) => $ + E.initiatedByUser + " ", "")}`), t;
1939
1887
  }
1940
1888
  return t.error = "Failed GET from /audit-events: failed to JSON-parse response", console.log(t.error), t.status = 500, t.result = !1, t;
1941
1889
  } else
1942
- return console.log(`Failed GET from /audit-events: ${a.href}`), t.error = await y(i), t.status = 500, t.result = !1, console.log(t.error), t;
1890
+ return console.log(`Failed GET from /audit-events: ${a.href}`), t.error = await S(i), t.status = 500, t.result = !1, console.log(t.error), t;
1943
1891
  } catch (i) {
1944
1892
  t.error = i.message, t.status = 500, t.result = !1, console.log(i.message);
1945
1893
  }
1946
1894
  return t;
1947
1895
  }
1948
- async function It(n, s, r, t, e) {
1949
- let a = new m(), o = S.configConsentEndpoint(), d = new URL(o);
1950
- d.searchParams.append("configurationId", r);
1951
- const i = await I(n, s);
1896
+ async function $t(n, r, s, t, e) {
1897
+ let a = new m(), o = T.configConsentEndpoint(), c = new URL(o);
1898
+ c.searchParams.append("configurationId", s);
1899
+ const i = await I(n, r);
1952
1900
  let l = `
1953
1901
  {
1954
1902
  "tenantId": "${t}",
1955
1903
  "isReadPermissionConsented": ${e ? "true" : "false"}
1956
- }`, c = { method: "PUT", headers: i, body: l };
1904
+ }`, d = { method: "PUT", headers: i, body: l };
1957
1905
  try {
1958
- console.log("Attempting PUT read consent to /configuration/consent: " + d.href);
1959
- let f = await fetch(d.href, c);
1960
- return f.status === 200 && f.statusText === "OK" ? (console.log(`Successful PUT to ${d.href}`), a) : (a.error = await y(f), console.log(`Failed PUT to ${d.href}`), console.log(a.error), a.status = 500, a.result = !1, a);
1961
- } catch (f) {
1962
- a.error = f.message, a.status = 500, a.result = !1, console.log(f.message);
1906
+ console.log("Attempting PUT read consent to /configuration/consent: " + c.href);
1907
+ let p = await fetch(c.href, d);
1908
+ return p.status === 200 && p.statusText === "OK" ? (console.log(`Successful PUT to ${c.href}`), a) : (a.error = await S(p), console.log(`Failed PUT to ${c.href}`), console.log(a.error), a.status = 500, a.result = !1, a);
1909
+ } catch (p) {
1910
+ a.error = p.message, a.status = 500, a.result = !1, console.log(p.message);
1963
1911
  }
1964
1912
  return a;
1965
1913
  }
1966
- async function bt(n, s, r, t, e) {
1967
- let a = new m(), o = S.configConsentEndpoint(), d = new URL(o);
1968
- d.searchParams.append("configurationId", r);
1969
- const i = await I(n, s);
1914
+ async function bt(n, r, s, t, e) {
1915
+ let a = new m(), o = T.configConsentEndpoint(), c = new URL(o);
1916
+ c.searchParams.append("configurationId", s);
1917
+ const i = await I(n, r);
1970
1918
  let l = `
1971
1919
  {
1972
1920
  "tenantId": "${t}",
1973
1921
  "isWritePermissionConsented": ${e ? "true" : "false"}
1974
- }`, c = { method: "PUT", headers: i, body: l };
1922
+ }`, d = { method: "PUT", headers: i, body: l };
1975
1923
  try {
1976
- console.log("Attempting PUT read consent to /configuration/consent: " + d.href);
1977
- let f = await fetch(d.href, c);
1978
- return f.status === 200 && f.statusText === "OK" ? (console.log(`Successful PUT to ${d.href}`), a) : (a.error = await y(f), console.log(`Failed PUT to ${d.href}`), console.log(a.error), a.status = 500, a.result = !1, a);
1979
- } catch (f) {
1980
- a.error = f.message, a.status = 500, a.result = !1, console.log(f.message);
1924
+ console.log("Attempting PUT read consent to /configuration/consent: " + c.href);
1925
+ let p = await fetch(c.href, d);
1926
+ return p.status === 200 && p.statusText === "OK" ? (console.log(`Successful PUT to ${c.href}`), a) : (a.error = await S(p), console.log(`Failed PUT to ${c.href}`), console.log(a.error), a.status = 500, a.result = !1, a);
1927
+ } catch (p) {
1928
+ a.error = p.message, a.status = 500, a.result = !1, console.log(p.message);
1981
1929
  }
1982
1930
  return a;
1983
1931
  }
1984
- async function $t(n, s, r, t, e) {
1932
+ async function Et(n, r, s, t, e) {
1985
1933
  let a = new m();
1986
- if (r.id === "" || t == "")
1934
+ if (s.id === "" || t == "")
1987
1935
  return a.result = !1, a.error = "configGet: invalid config ID", a.status = 500, a;
1988
1936
  let o = null;
1989
- o = new URL(S.configEndpoint());
1990
- let i = { method: "GET", headers: await I(n, s) };
1937
+ o = new URL(T.configEndpoint());
1938
+ let i = { method: "GET", headers: await I(n, r) };
1991
1939
  try {
1992
1940
  console.log("Attempting GET from /config: " + o.href);
1993
- let l = await fetch(`${o.href}/${r.id}`, i);
1941
+ let l = await fetch(`${o.href}/${s.id}`, i);
1994
1942
  if (l.status === 200 && l.statusText === "OK") {
1995
1943
  console.log("Successful GET from /config");
1996
- let c = await l.json();
1944
+ let d = await l.json();
1997
1945
  return {
1998
1946
  ...a,
1999
- array: [c]
1947
+ array: [d]
2000
1948
  };
2001
1949
  } else
2002
- return a.error = await y(l), console.log(`Failed GET from ${o.href}`), console.log(a.error), a.status = 500, a.result = !1, a;
1950
+ return a.error = await S(l), console.log(`Failed GET from ${o.href}`), console.log(a.error), a.status = 500, a.result = !1, a;
2003
1951
  } catch (l) {
2004
1952
  a.error = l.message, a.status = 500, a.result = !1, console.log(l.message);
2005
1953
  }
2006
1954
  return a;
2007
1955
  }
2008
- async function At(n, s, r, t, e) {
1956
+ async function At(n, r, s, t, e) {
2009
1957
  let a = new m();
2010
- if (r.id === "" || t == "")
1958
+ if (s.id === "" || t == "")
2011
1959
  return a.result = !1, a.error = "configPost: invalid config ID", a.status = 500, a;
2012
1960
  let o = null;
2013
- o = new URL(S.configEndpoint()), o.searchParams.append("configurationId", r.id);
2014
- let i = { method: "DELETE", headers: await I(n, s) };
1961
+ o = new URL(T.configEndpoint()), o.searchParams.append("configurationId", s.id);
1962
+ let i = { method: "DELETE", headers: await I(n, r) };
2015
1963
  try {
2016
1964
  console.log("Attempting DELETE from /config: " + o.href);
2017
1965
  let l = await fetch(o.href, i);
2018
- return l.status === 200 && l.statusText === "OK" ? (console.log("Successful DELETE from /config"), a) : (a.error = await y(l), console.log(`Failed DELETE from ${o.href}`), console.log(a.error), a.status = 500, a.result = !1, a);
1966
+ return l.status === 200 && l.statusText === "OK" ? (console.log("Successful DELETE from /config"), a) : (a.error = await S(l), console.log(`Failed DELETE from ${o.href}`), console.log(a.error), a.status = 500, a.result = !1, a);
2019
1967
  } catch (l) {
2020
1968
  a.error = l.message, a.status = 500, a.result = !1, console.log(l.message);
2021
1969
  }
2022
1970
  return a;
2023
1971
  }
2024
- async function kt(n, s, r, t, e) {
1972
+ async function vt(n, r, s, t, e) {
2025
1973
  let a = new m();
2026
- if (r === "")
1974
+ if (s === "")
2027
1975
  return a.result = !1, a.error = "configPatch: invalid config ID", a.status = 500, a;
2028
- let o = S.configEnabledEndpoint(), d = new URL(o);
2029
- d.searchParams.append("configurationId", r), d.searchParams.append("isEnabled", t.toString());
2030
- let l = { method: "PATCH", headers: await I(n, s) };
1976
+ let o = T.configEnabledEndpoint(), c = new URL(o);
1977
+ c.searchParams.append("configurationId", s), c.searchParams.append("isEnabled", t.toString());
1978
+ let l = { method: "PATCH", headers: await I(n, r) };
2031
1979
  try {
2032
1980
  if (e) debugger;
2033
- console.log("Attempting PATCH to /config: " + d.href);
2034
- let c = await fetch(d.href, l);
2035
- return c.status === 200 && c.statusText === "OK" ? (console.log(`Successful PATCH to ${d.href}: ${t.toString()}`), a) : (a.error = await y(c), console.log(`Failed PATCH to ${d.href}: ${t.toString()}`), console.log(a.error), a.status = 500, a.result = !1, a);
2036
- } catch (c) {
2037
- a.error = c.message, a.status = 500, a.result = !1, console.log(c.message);
1981
+ console.log("Attempting PATCH to /config: " + c.href);
1982
+ let d = await fetch(c.href, l);
1983
+ return d.status === 200 && d.statusText === "OK" ? (console.log(`Successful PATCH to ${c.href}: ${t.toString()}`), a) : (a.error = await S(d), console.log(`Failed PATCH to ${c.href}: ${t.toString()}`), console.log(a.error), a.status = 500, a.result = !1, a);
1984
+ } catch (d) {
1985
+ a.error = d.message, a.status = 500, a.result = !1, console.log(d.message);
2038
1986
  }
2039
1987
  return a;
2040
1988
  }
2041
- async function Et(n, s, r, t, e) {
1989
+ async function Dt(n, r, s, t, e) {
2042
1990
  let a = new m();
2043
- if (r.id === "")
1991
+ if (s.id === "")
2044
1992
  return a.result = !1, a.error = "configPost: invalid config ID", a.status = 500, a;
2045
- let o = S.configEndpoint();
2046
- const d = await I(n, s);
1993
+ let o = T.configEndpoint();
1994
+ const c = await I(n, r);
2047
1995
  let i = `
2048
1996
  {
2049
1997
  "workspaceId": "${t}",
2050
- "name": "${r.name}",
2051
- "description": "${r.description}",
2052
- "isEnabled": ${r.isEnabled},
1998
+ "name": "${s.name}",
1999
+ "description": "${s.description}",
2000
+ "isEnabled": ${s.isEnabled},
2053
2001
  "tenants": [`;
2054
- r.tenants.map((c) => {
2055
- let f = c.sourceGroupId != "" ? `"${c.sourceGroupId}"` : "null", b = c.sourceGroupName != "" ? `"${c.sourceGroupName}"` : "null", A = c.targetGroupId != "" ? `"${c.targetGroupId}"` : "null", C = c.targetGroupName != "" ? `"${c.targetGroupName}"` : "null";
2002
+ s.tenants.map((d) => {
2003
+ let p = d.sourceGroupId != "" ? `"${d.sourceGroupId}"` : "null", $ = d.sourceGroupName != "" ? `"${d.sourceGroupName}"` : "null", E = d.targetGroupId != "" ? `"${d.targetGroupId}"` : "null", x = d.targetGroupName != "" ? `"${d.targetGroupName}"` : "null";
2056
2004
  i.slice(-1) === "}" && (i += ","), i += `{
2057
- "tenantId": "${c.tid}",
2058
- "sourceGroupId": ${f},
2059
- "sourceGroupName": ${b},
2060
- "targetGroupId": ${A},
2061
- "targetGroupName": ${C},
2062
- "configurationTenantType": "${c.configurationTenantType}",
2063
- "isReadPermissionConsented": ${c.isReadPermissionConsented},
2064
- "isWritePermissionConsented": ${c.isWritePermissionConsented}
2005
+ "tenantId": "${d.tid}",
2006
+ "sourceGroupId": ${p},
2007
+ "sourceGroupName": ${$},
2008
+ "targetGroupId": ${E},
2009
+ "targetGroupName": ${x},
2010
+ "configurationTenantType": "${d.configurationTenantType}",
2011
+ "isReadPermissionConsented": ${d.isReadPermissionConsented},
2012
+ "isWritePermissionConsented": ${d.isWritePermissionConsented}
2065
2013
  }`;
2066
2014
  }), i += "]}";
2067
- let l = { method: "POST", headers: d, body: i };
2015
+ let l = { method: "POST", headers: c, body: i };
2068
2016
  try {
2069
2017
  if (e) debugger;
2070
2018
  console.log("Attempting POST to /config: " + o);
2071
- let c = await fetch(o, l);
2072
- if (c.status === 200 && c.statusText === "OK") {
2073
- let f = await c.json();
2074
- return r.id = typeof f == "object" && f !== null && f.id ? f.id : f, console.log(
2075
- `Successful ConfigID: ${r.id} from POST to /config: ${i}`
2019
+ let d = await fetch(o, l);
2020
+ if (d.status === 200 && d.statusText === "OK") {
2021
+ let p = await d.json();
2022
+ return s.id = typeof p == "object" && p !== null && p.id ? p.id : p, console.log(
2023
+ `Successful ConfigID: ${s.id} from POST to /config: ${i}`
2076
2024
  ), a;
2077
2025
  } else
2078
- return a.error = await y(c), console.log(`Failed PUT to /config: ${i}`), console.log(a.error), a.status = 500, a.result = !1, a;
2079
- } catch (c) {
2080
- return a.status = 500, a.result = !1, a.error = c.message, console.log(a.error), a;
2026
+ return a.error = await S(d), console.log(`Failed PUT to /config: ${i}`), console.log(a.error), a.status = 500, a.result = !1, a;
2027
+ } catch (d) {
2028
+ return a.status = 500, a.result = !1, a.error = d.message, console.log(a.error), a;
2081
2029
  }
2082
2030
  }
2083
- async function Dt(n, s, r, t) {
2031
+ async function kt(n, r, s, t) {
2084
2032
  let e = new m();
2085
- if (r.id === "")
2033
+ if (s.id === "")
2086
2034
  return e.result = !1, e.error = "configPost: invalid config ID", e.status = 500, e;
2087
- let a = S.configEndpoint(), o = new URL(a);
2088
- o.searchParams.append("configurationId", r.id);
2089
- const d = await I(n, s);
2035
+ let a = T.configEndpoint(), o = new URL(a);
2036
+ o.searchParams.append("configurationId", s.id);
2037
+ const c = await I(n, r);
2090
2038
  let i = `
2091
2039
  {
2092
- "name": "${r.name}",
2093
- "description": "${r.description}",
2040
+ "name": "${s.name}",
2041
+ "description": "${s.description}",
2094
2042
  "tenants": [`;
2095
- r.tenants.map((c) => {
2043
+ s.tenants.map((d) => {
2096
2044
  i.slice(-1) === "}" && (i += ",");
2097
- let b = c.sourceGroupId != "" ? `"${c.sourceGroupId}"` : "null", A = c.sourceGroupName != "" ? `"${c.sourceGroupName}"` : "null", C = c.targetGroupId != "" ? `"${c.targetGroupId}"` : "null", N = c.targetGroupName != "" ? `"${c.targetGroupName}"` : "null";
2045
+ let $ = d.sourceGroupId != "" ? `"${d.sourceGroupId}"` : "null", E = d.sourceGroupName != "" ? `"${d.sourceGroupName}"` : "null", x = d.targetGroupId != "" ? `"${d.targetGroupId}"` : "null", N = d.targetGroupName != "" ? `"${d.targetGroupName}"` : "null";
2098
2046
  i += `{
2099
- "tenantId": "${c.tid}",
2100
- "sourceGroupId": ${b},
2101
- "sourceGroupName": ${A},
2102
- "targetGroupId": ${C},
2047
+ "tenantId": "${d.tid}",
2048
+ "sourceGroupId": ${$},
2049
+ "sourceGroupName": ${E},
2050
+ "targetGroupId": ${x},
2103
2051
  "targetGroupName": ${N},
2104
- "configurationTenantType": "${c.configurationTenantType}",
2105
- "deltaToken": "${c.deltaToken}",
2106
- "isReadPermissionConsented": ${c.isReadPermissionConsented},
2107
- "isWritePermissionConsented": ${c.isWritePermissionConsented}
2052
+ "configurationTenantType": "${d.configurationTenantType}",
2053
+ "deltaToken": "${d.deltaToken}",
2054
+ "isReadPermissionConsented": ${d.isReadPermissionConsented},
2055
+ "isWritePermissionConsented": ${d.isWritePermissionConsented}
2108
2056
  }`;
2109
2057
  }), i += "]}";
2110
- let l = { method: "PUT", headers: d, body: i };
2058
+ let l = { method: "PUT", headers: c, body: i };
2111
2059
  try {
2112
2060
  if (t) debugger;
2113
2061
  console.log("Attempting PUT to /config: " + o.href);
2114
- let c = await fetch(o.href, l);
2115
- if (c.status === 200 && c.statusText === "OK") {
2062
+ let d = await fetch(o.href, l);
2063
+ if (d.status === 200 && d.statusText === "OK") {
2116
2064
  console.log(`Successful PUT to ${o.href}: ${i}`);
2117
- let f = await c.json();
2065
+ let p = await d.json();
2118
2066
  return {
2119
2067
  ...e,
2120
- array: [f]
2068
+ array: [p]
2121
2069
  };
2122
2070
  } else
2123
- return e.error = await y(c), console.log(`Failed PUT to ${o.href}: ${i}`), console.log(e.error), e.status = 500, e.result = !1, e;
2124
- } catch (c) {
2125
- e.error = c.message, e.status = 500, e.result = !1, console.log(c.message);
2071
+ return e.error = await S(d), console.log(`Failed PUT to ${o.href}: ${i}`), console.log(e.error), e.status = 500, e.result = !1, e;
2072
+ } catch (d) {
2073
+ e.error = d.message, e.status = 500, e.result = !1, console.log(d.message);
2126
2074
  }
2127
2075
  return e;
2128
2076
  }
2129
- async function vt(n, s, r, t) {
2077
+ async function Pt(n, r, s, t) {
2130
2078
  let e = new m();
2131
- if (r === "")
2079
+ if (s === "")
2132
2080
  return e.result = !1, e.status = 500, e.error = "configsGet: no workspace provided", e;
2133
- let a = S.configsEndpoint(), o = new URL(a);
2134
- o.searchParams.append("workspaceId", r);
2135
- let i = { method: "GET", headers: await I(n, s) };
2081
+ let a = T.configsEndpoint(), o = new URL(a);
2082
+ o.searchParams.append("workspaceId", s);
2083
+ let i = { method: "GET", headers: await I(n, r) };
2136
2084
  try {
2137
2085
  if (t) debugger;
2138
2086
  console.log("Attempting GET from /configurations: " + o.href);
2139
2087
  let l = await fetch(o.href, i);
2140
2088
  if (l.status === 200 && l.statusText === "OK") {
2141
- let c = await l.json();
2142
- return c != null ? (e.array = c, console.log(`Successful GET from /configurations: ${e.array.reduce((b, A) => b + A.name + " ", "")}`), e) : (e.error = "Failed GET from /configurations: failed to JSON-parse response", console.log(e.error), e.status = 500, e.result = !1, e);
2089
+ let d = await l.json();
2090
+ return d != null ? (e.array = d, console.log(`Successful GET from /configurations: ${e.array.reduce(($, E) => $ + E.name + " ", "")}`), e) : (e.error = "Failed GET from /configurations: failed to JSON-parse response", console.log(e.error), e.status = 500, e.result = !1, e);
2143
2091
  } else
2144
- return console.log(`Failed GET from /configurations: ${o.href}`), e.error = await y(l), e.status = 500, e.result = !1, console.log(e.error), e;
2092
+ return console.log(`Failed GET from /configurations: ${o.href}`), e.error = await S(l), e.status = 500, e.result = !1, console.log(e.error), e;
2145
2093
  } catch (l) {
2146
2094
  e.error = l.message, e.status = 500, e.result = !1, console.log(l.message);
2147
2095
  }
2148
2096
  return e;
2149
2097
  }
2150
- async function bs(n, s, r, t) {
2098
+ async function vs(n, r, s, t) {
2151
2099
  let e = new m();
2152
- if (!r)
2100
+ if (!s)
2153
2101
  return e.result = !1, e.status = 500, e.error = "workspaceConfigsGet: no workspace provided", e;
2154
- let a = S.workspaceConfigsEndpoint(), o = new URL(a);
2155
- o.searchParams.append("workspaceId", r);
2156
- let i = { method: "GET", headers: await I(n, s) };
2102
+ let a = T.workspaceConfigsEndpoint(), o = new URL(a);
2103
+ o.searchParams.append("workspaceId", s);
2104
+ let i = { method: "GET", headers: await I(n, r) };
2157
2105
  try {
2158
2106
  if (t) debugger;
2159
2107
  console.log("Attempting GET from /workspaceConfigs: " + o.href);
2160
2108
  const l = await fetch(o.href, i);
2161
2109
  if (l.status === 200 && l.statusText === "OK") {
2162
- const c = await l.json();
2163
- if (c)
2164
- return e.array = c.map((f) => ({
2165
- id: f.id,
2166
- name: f.name,
2167
- description: f.description,
2168
- configurationType: f.configurationType,
2169
- isEnabled: f.isEnabled
2110
+ const d = await l.json();
2111
+ if (d)
2112
+ return e.array = d.map((p) => ({
2113
+ id: p.id,
2114
+ name: p.name,
2115
+ description: p.description,
2116
+ configurationType: p.configurationType,
2117
+ isEnabled: p.isEnabled
2170
2118
  })), console.log(
2171
2119
  `workspaceConfigsGet: found ${e.array.length} configs.`
2172
2120
  ), e;
2173
2121
  e.error = "workspaceConfigsGet: failed to parse returned configs", e.result = !1, e.status = 500;
2174
2122
  } else
2175
- e.error = await y(l), e.result = !1, e.status = l.status, console.log(e.error);
2123
+ e.error = await S(l), e.result = !1, e.status = l.status, console.log(e.error);
2176
2124
  } catch (l) {
2177
2125
  e.error = l.message, e.result = !1, e.status = 500;
2178
2126
  }
2179
2127
  return e;
2180
2128
  }
2181
- async function Pt(n, s, r) {
2129
+ async function Rt(n, r, s) {
2182
2130
  let t = new m();
2183
- if (s.companyName === "" || s.companyDomain === "")
2131
+ if (r.companyName === "" || r.companyDomain === "")
2184
2132
  return t.result = !1, t.error = "initPost: invalid company name or domain", t.status = 500, t;
2185
- let e = S.initEndpoint();
2186
- const a = await I(n, s);
2133
+ let e = T.initEndpoint();
2134
+ const a = await I(n, r);
2187
2135
  let o = `
2188
2136
  {
2189
2137
  "tenantCreateModel": {
2190
- "tenantId": "${s.tid}",
2191
- "name": "${s.companyName}",
2192
- "domain": "${s.companyDomain}",
2138
+ "tenantId": "${r.tid}",
2139
+ "name": "${r.companyName}",
2140
+ "domain": "${r.companyDomain}",
2193
2141
  "type": "aad",
2194
- "authority": "${s.authority}"
2142
+ "authority": "${r.authority}"
2195
2143
  }
2196
- }`, d = { method: "POST", headers: a, body: o };
2144
+ }`, c = { method: "POST", headers: a, body: o };
2197
2145
  try {
2198
- if (r) debugger;
2146
+ if (s) debugger;
2199
2147
  console.log("Attempting POST to /configuration/init: " + e);
2200
- let i = await fetch(e, d);
2201
- return i.status === 200 && i.statusText === "OK" ? (console.log(`Successful POST to /configuration/init: ${o}`), t) : (t.error = await y(i), t.status = 500, t.result = !1, console.log(`Failed POST to /configuration/init: ${o}`), console.log(t.error), t);
2148
+ let i = await fetch(e, c);
2149
+ return i.status === 200 && i.statusText === "OK" ? (console.log(`Successful POST to /configuration/init: ${o}`), t) : (t.error = await S(i), t.status = 500, t.result = !1, console.log(`Failed POST to /configuration/init: ${o}`), console.log(t.error), t);
2202
2150
  } catch (i) {
2203
2151
  t.error = i.message, console.log(t.error);
2204
2152
  }
2205
2153
  return t.status = 500, t.result = !1, t;
2206
2154
  }
2207
- async function Rt(n, s, r, t, e) {
2155
+ async function Gt(n, r, s, t, e) {
2208
2156
  let a = new m();
2209
- if (r.tid === "" || t === "")
2157
+ if (s.tid === "" || t === "")
2210
2158
  return a.result = !1, a.error = "tenantDelete: invalid tid, workspaceId", a.status = 500, a;
2211
- let o = new URL(S.tenantEndpoint());
2212
- o.searchParams.append("tenantId", r.tid), o.searchParams.append("workspaceId", t);
2213
- let i = { method: "DELETE", headers: await I(n, s) };
2159
+ let o = new URL(T.tenantEndpoint());
2160
+ o.searchParams.append("tenantId", s.tid), o.searchParams.append("workspaceId", t);
2161
+ let i = { method: "DELETE", headers: await I(n, r) };
2214
2162
  try {
2215
2163
  console.log("Attempting DELETE from /tenant: " + o.href);
2216
2164
  let l = await fetch(o.href, i);
2217
- return l.status === 200 && l.statusText === "OK" ? (console.log(`Successful DELETE from /tenant: ${o.href}`), a) : (console.log(`Failed DELETE from /tenant: ${o.href}`), a.error = await y(l), console.log(a.error), a.status = 500, a.result = !1, a);
2165
+ return l.status === 200 && l.statusText === "OK" ? (console.log(`Successful DELETE from /tenant: ${o.href}`), a) : (console.log(`Failed DELETE from /tenant: ${o.href}`), a.error = await S(l), console.log(a.error), a.status = 500, a.result = !1, a);
2218
2166
  } catch (l) {
2219
2167
  a.error = l.message, a.status = 500, a.result = !1, console.log(a.error);
2220
2168
  }
2221
2169
  return a;
2222
2170
  }
2223
- async function Gt(n, s, r, t) {
2171
+ async function Ct(n, r, s, t) {
2224
2172
  let e = new m();
2225
- if (r === "")
2173
+ if (s === "")
2226
2174
  return e.result = !1, e.status = 500, e.error = "tenantsGet: no workspace provided", e;
2227
- let a = S.tenantsEndpoint(), o = new URL(a);
2228
- o.searchParams.append("workspaceId", r);
2229
- let i = { method: "GET", headers: await I(n, s) };
2175
+ let a = T.tenantsEndpoint(), o = new URL(a);
2176
+ o.searchParams.append("workspaceId", s);
2177
+ let i = { method: "GET", headers: await I(n, r) };
2230
2178
  try {
2231
2179
  if (t) debugger;
2232
2180
  console.log(`Attempting GET from /tenants: ${o.href}`);
2233
2181
  let l = await fetch(o.href, i);
2234
2182
  if (l.status === 200 && l.statusText === "OK") {
2235
- let c = await l.json();
2236
- return c != null ? (e.array = c, console.log(`Successful GET from /tenants: ${e.array.reduce((b, A) => b + A.domain + " ", "")}`), e) : (e.error = "Failed GET from /tenants: failed to JSON-parse response", console.log(e.error), e.status = 500, e.result = !1, e);
2183
+ let d = await l.json();
2184
+ return d != null ? (e.array = d, console.log(`Successful GET from /tenants: ${e.array.reduce(($, E) => $ + E.domain + " ", "")}`), e) : (e.error = "Failed GET from /tenants: failed to JSON-parse response", console.log(e.error), e.status = 500, e.result = !1, e);
2237
2185
  } else
2238
- return console.log(`Failed GET from /tenants: ${o.href}`), e.error = await y(l), e.status = 500, e.result = !1, console.log(e.error), e;
2186
+ return console.log(`Failed GET from /tenants: ${o.href}`), e.error = await S(l), e.status = 500, e.result = !1, console.log(e.error), e;
2239
2187
  } catch (l) {
2240
2188
  e.error = l.message, e.status = 500, e.result = !1, console.log(l.message);
2241
2189
  }
2242
2190
  return e;
2243
2191
  }
2244
- async function xt(n, s, r, t) {
2192
+ async function xt(n, r, s, t) {
2245
2193
  let e = new m();
2246
- if (r.tid === "" || r.name === "" || r.domain === "")
2194
+ if (s.tid === "" || s.name === "" || s.domain === "")
2247
2195
  return e.result = !1, e.error = "tenantPost: invalid tid, name, domain", e.status = 500, e;
2248
- let a = S.tenantEndpoint(), o = new URL(a);
2196
+ let a = T.tenantEndpoint(), o = new URL(a);
2249
2197
  o.searchParams.append("workspaceId", t);
2250
- const d = await I(n, s);
2198
+ const c = await I(n, r);
2251
2199
  let i = `
2252
- {"tenantId": "${r.tid}",
2253
- "name": "${r.name}",
2254
- "domain": "${r.domain}",
2200
+ {"tenantId": "${s.tid}",
2201
+ "name": "${s.name}",
2202
+ "domain": "${s.domain}",
2255
2203
  "type": 1,
2256
- "authority": "${r.authority}"
2257
- }`, l = { method: "POST", headers: d, body: i };
2204
+ "authority": "${s.authority}"
2205
+ }`, l = { method: "POST", headers: c, body: i };
2258
2206
  try {
2259
2207
  console.log(`Attempting POST to ${o.href}: ${i}`);
2260
- let c = await fetch(o.href, l);
2261
- return c.status === 200 && c.statusText === "OK" ? (console.log(`Successful POST to ${o.href}: ${i}`), e) : (console.log(`Failed POST to ${o.href}: ${i}`), e.error = await y(c), console.log(e.error), e.status = 500, e.result = !1, e);
2262
- } catch (c) {
2263
- e.error = c.message, e.status = 500, e.result = !1, console.log(e.error);
2208
+ let d = await fetch(o.href, l);
2209
+ return d.status === 200 && d.statusText === "OK" ? (console.log(`Successful POST to ${o.href}: ${i}`), e) : (console.log(`Failed POST to ${o.href}: ${i}`), e.error = await S(d), console.log(e.error), e.status = 500, e.result = !1, e);
2210
+ } catch (d) {
2211
+ e.error = d.message, e.status = 500, e.result = !1, console.log(e.error);
2264
2212
  }
2265
2213
  return e;
2266
2214
  }
2267
- async function Ct(n, s, r, t) {
2215
+ async function Ot(n, r, s, t) {
2268
2216
  let e = new m();
2269
- if (r == "" || t == "")
2217
+ if (s == "" || t == "")
2270
2218
  return e.result = !1, e.error = "workspacePut: invalid workspace ID or name", e.status = 500, e;
2271
- let a = S.workspaceEndpoint(), o = new URL(a);
2272
- o.searchParams.append("workspaceId", r), o.searchParams.append("workspaceName", t);
2273
- let i = { method: "PUT", headers: await I(n, s) };
2219
+ let a = T.workspaceEndpoint(), o = new URL(a);
2220
+ o.searchParams.append("workspaceId", s), o.searchParams.append("workspaceName", t);
2221
+ let i = { method: "PUT", headers: await I(n, r) };
2274
2222
  try {
2275
2223
  console.log("Attempting PUT to /workspace: " + o.href);
2276
2224
  let l = await fetch(o.href, i);
2277
- return l.status === 200 && l.statusText === "OK" ? (console.log(`Successful PUT to ${o.href}`), e) : (e.error = await y(l), console.log(`Failed PUT to ${o.href}`), console.log(e.error), e.status = 500, e.result = !1, e);
2225
+ return l.status === 200 && l.statusText === "OK" ? (console.log(`Successful PUT to ${o.href}`), e) : (e.error = await S(l), console.log(`Failed PUT to ${o.href}`), console.log(e.error), e.status = 500, e.result = !1, e);
2278
2226
  } catch (l) {
2279
2227
  e.error = l.message, e.status = 500, e.result = !1, console.log(l.message);
2280
2228
  }
2281
2229
  return e;
2282
2230
  }
2283
- async function Ot(n, s, r) {
2231
+ async function Nt(n, r, s) {
2284
2232
  let t = new m();
2285
- if (s.mail == null || s.mail == "")
2233
+ if (r.mail == null || r.mail == "")
2286
2234
  return t.result = !1, t.status = 500, t.error = "adminsGet: no workspace provided", t;
2287
- let e = S.workspacesEndpoint(), a = new URL(e), d = { method: "GET", headers: await I(n, s) };
2235
+ let e = T.workspacesEndpoint(), a = new URL(e), c = { method: "GET", headers: await I(n, r) };
2288
2236
  try {
2289
- if (r) debugger;
2237
+ if (s) debugger;
2290
2238
  console.log("Attempting GET from /workspaces endpoint: " + a.href);
2291
- let i = await fetch(a.href, d);
2239
+ let i = await fetch(a.href, c);
2292
2240
  if (i.status === 200 && i.statusText === "OK") {
2293
2241
  let l = await i.json();
2294
- return l != null ? (t.array = l, console.log(`Successful GET from /workspaces: ${t.array.reduce((f, b) => f + b.name + " ", "")}`), t) : (t.error = "Failed GET from /workspaces: failed to JSON-parse response", console.log(t.error), t.status = 500, t.result = !1, t);
2242
+ return l != null ? (t.array = l, console.log(`Successful GET from /workspaces: ${t.array.reduce((p, $) => p + $.name + " ", "")}`), t) : (t.error = "Failed GET from /workspaces: failed to JSON-parse response", console.log(t.error), t.status = 500, t.result = !1, t);
2295
2243
  } else
2296
- return console.log(`Failed GET from /workspaces: ${a.href}`), t.error = await y(i), t.status = 500, t.result = !1, console.log(t.error), t;
2244
+ return console.log(`Failed GET from /workspaces: ${a.href}`), t.error = await S(i), t.status = 500, t.result = !1, console.log(t.error), t;
2297
2245
  } catch (i) {
2298
2246
  t.error = i.message, t.status = 500, t.result = !1, console.log(i.message);
2299
2247
  }
2300
2248
  return t;
2301
2249
  }
2302
- async function Nt(n, s, r) {
2250
+ async function Ut(n, r, s) {
2303
2251
  let t = new m();
2304
- if (n == null || s == null)
2252
+ if (n == null || r == null)
2305
2253
  return t.result = !1, t.error = "readerPost: invalid parameters", t.status = 500, t;
2306
- let e = S.readerStartSyncEndpoint(), a = new URL(e);
2307
- a.searchParams.append("configurationId", r.id);
2308
- let d = { method: "POST", headers: await I(n, s) };
2254
+ let e = T.readerStartSyncEndpoint(), a = new URL(e);
2255
+ a.searchParams.append("configurationId", s.id);
2256
+ let c = { method: "POST", headers: await I(n, r) };
2309
2257
  try {
2310
2258
  console.log("Attempting POST to /startSync: " + a.href);
2311
- let i = await fetch(a.href, d);
2259
+ let i = await fetch(a.href, c);
2312
2260
  if (i.status === 200 && i.statusText === "OK") {
2313
2261
  console.log(`Successful POST to /startSync: ${e}`);
2314
2262
  let l = await i.json();
2315
2263
  return l.PayloadStr != "" ? t.array = JSON.parse(l.PayloadStr) : (t.result = !1, t.error = "readerPost: blank payload returned, sync may be disabled on back end", t.status = 500), t;
2316
2264
  } else
2317
- return t.error = await y(i), console.log(`Failed POST to /startSync: ${e}`), console.log(t.error), t.status = 500, t.result = !1, t;
2265
+ return t.error = await S(i), console.log(`Failed POST to /startSync: ${e}`), console.log(t.error), t.status = 500, t.result = !1, t;
2318
2266
  } catch (i) {
2319
2267
  t.error = i.message, t.status = 500, t.result = !1, console.log(i.message);
2320
2268
  }
2321
2269
  return t;
2322
2270
  }
2323
- async function Bt(n, s, r) {
2271
+ async function Wt(n, r, s) {
2324
2272
  let t = new m();
2325
- if (n == null || s == null)
2273
+ if (n == null || r == null)
2326
2274
  return t.result = !1, t.error = "readerPost: invalid parameters", t.status = 500, t;
2327
- let e = S.statsEndpoint(), a = new URL(`${e}/${r}`), d = { method: "GET", headers: await I(n, s) };
2275
+ let e = T.statsEndpoint(), a = new URL(`${e}/${s}`), c = { method: "GET", headers: await I(n, r) };
2328
2276
  try {
2329
2277
  console.log("Attempting GET to /stats: " + a.href);
2330
- let i = await fetch(a.href, d);
2278
+ let i = await fetch(a.href, c);
2331
2279
  if (i.status === 200 && i.statusText === "OK") {
2332
2280
  console.log(`Successful GET to /stats: ${e}`);
2333
2281
  let l = await i.json();
2334
2282
  return t.array = [l], t;
2335
- } else return i.status === 204 ? (t.error = await y(i), console.log(`Failed GET to /stats: ${e}`), console.log(t.error), t.status = 204, t.result = !1, t) : (t.error = await y(i), console.log(`Failed GET to /stats: ${e}`), console.log(t.error), t.status = 500, t.result = !1, t);
2283
+ } else return i.status === 204 ? (t.error = await S(i), console.log(`Failed GET to /stats: ${e}`), console.log(t.error), t.status = 204, t.result = !1, t) : (t.error = await S(i), console.log(`Failed GET to /stats: ${e}`), console.log(t.error), t.status = 500, t.result = !1, t);
2336
2284
  } catch (i) {
2337
2285
  t.error = i.message, t.status = 500, t.result = !1, console.log(i.message);
2338
2286
  }
@@ -2340,93 +2288,93 @@ async function Bt(n, s, r) {
2340
2288
  }
2341
2289
  export {
2342
2290
  m as APIResult,
2343
- Qt as ActorArray,
2344
- et as ActorNode,
2291
+ Jt as ActorArray,
2292
+ nt as ActorNode,
2345
2293
  Mt as AuditConfig,
2346
2294
  qt as BatchArray,
2347
2295
  zt as Group,
2348
- jt as InitInfo,
2349
- _ as Milestone,
2350
- Xe as MilestoneArray,
2351
- xe as ResourceArray,
2352
- Ye as ResourceNode,
2353
- pe as SyncConfig,
2354
- ce as Task,
2355
- Ht as TaskArray,
2296
+ Ht as InitInfo,
2297
+ z as Milestone,
2298
+ at as MilestoneArray,
2299
+ Ge as ResourceArray,
2300
+ Ce as ResourceNode,
2301
+ le as SyncConfig,
2302
+ oe as Task,
2303
+ Kt as TaskArray,
2356
2304
  j as Tenant,
2357
- Ve as TenantConfigInfo,
2358
- Je as TenantConfigType,
2359
- Re as TenantNode,
2360
- qe as TenantPermissionType,
2361
- He as TenantType,
2362
- fe as User,
2363
- _t as UserScope,
2364
- he as Workspace,
2365
- pt as adminDelete,
2366
- gt as adminPost,
2367
- ht as adminsGet,
2368
- ss as auditConfigAdd,
2369
- Tt as auditConfigDelete,
2370
- as as auditConfigEdit,
2371
- yt as auditConfigGet,
2372
- mt as auditConfigPost,
2373
- wt as auditConfigPut,
2374
- ns as auditConfigRemove,
2375
- rs as auditConfigRetrieve,
2376
- St as auditEventsGet,
2377
- os as auditEventsRetrieve,
2378
- M as azureConfig,
2379
- Ss as canListRootAssignments,
2380
- us as configConsentForRead,
2381
- ds as configConsentForWrite,
2382
- It as configConsentReadPut,
2305
+ st as TenantConfigInfo,
2306
+ tt as TenantConfigType,
2307
+ Ae as TenantNode,
2308
+ Xe as TenantPermissionType,
2309
+ Qe as TenantType,
2310
+ ie as User,
2311
+ jt as UserScope,
2312
+ ue as Workspace,
2313
+ ht as adminDelete,
2314
+ mt as adminPost,
2315
+ gt as adminsGet,
2316
+ os as auditConfigAdd,
2317
+ St as auditConfigDelete,
2318
+ ls as auditConfigEdit,
2319
+ wt as auditConfigGet,
2320
+ yt as auditConfigPost,
2321
+ Tt as auditConfigPut,
2322
+ us as auditConfigRemove,
2323
+ is as auditConfigRetrieve,
2324
+ It as auditEventsGet,
2325
+ cs as auditEventsRetrieve,
2326
+ Ee as azureConfig,
2327
+ Es as canListRootAssignments,
2328
+ fs as configConsentForRead,
2329
+ hs as configConsentForWrite,
2330
+ $t as configConsentReadPut,
2383
2331
  bt as configConsentWritePut,
2384
2332
  At as configDelete,
2385
- is as configEdit,
2386
- ls as configEnable,
2387
- $t as configGet,
2388
- kt as configPatch,
2389
- Et as configPost,
2390
- Dt as configPut,
2391
- fs as configRemove,
2392
- vt as configsGet,
2393
- cs as configsRefresh,
2394
- Is as elevateGlobalAdminToUserAccessAdmin,
2395
- Ts as getPowerBIAccessToken,
2396
- L as getSyncVersion,
2333
+ ds as configEdit,
2334
+ ps as configEnable,
2335
+ Et as configGet,
2336
+ vt as configPatch,
2337
+ Dt as configPost,
2338
+ kt as configPut,
2339
+ ms as configRemove,
2340
+ Pt as configsGet,
2341
+ gs as configsRefresh,
2342
+ As as elevateGlobalAdminToUserAccessAdmin,
2343
+ bs as getPowerBIAccessToken,
2344
+ F as getSyncVersion,
2397
2345
  h as graphConfig,
2398
- Kt as groupsGet,
2346
+ Vt as groupsGet,
2399
2347
  Lt as helloNpm,
2400
- ps as initGet,
2401
- Pt as initPost,
2402
- S as mindlineConfig,
2403
- st as oauth2PermissionGrantsGet,
2404
- rt as oauth2PermissionGrantsSet,
2405
- y as processErrors,
2406
- Nt as readerPost,
2407
- Bt as readerStats,
2408
- Jt as requestAdminConsent,
2409
- at as servicePrincipalGet,
2410
- Vt as signIn,
2411
- Zt as signInIncrementally,
2412
- Xt as signOut,
2413
- Ut as sum,
2414
- hs as tenantAdd,
2415
- Rt as tenantDelete,
2348
+ ys as initGet,
2349
+ Rt as initPost,
2350
+ T as mindlineConfig,
2351
+ Zt as oauth2PermissionGrantsGet,
2352
+ Qt as oauth2PermissionGrantsSet,
2353
+ S as processErrors,
2354
+ Ut as readerPost,
2355
+ Wt as readerStats,
2356
+ Xt as requestAdminConsent,
2357
+ Yt as servicePrincipalGet,
2358
+ es as signIn,
2359
+ ts as signInIncrementally,
2360
+ ss as signOut,
2361
+ _t as sum,
2362
+ ws as tenantAdd,
2363
+ Gt as tenantDelete,
2416
2364
  xt as tenantPost,
2417
- Yt as tenantRelationshipsGetByDomain,
2418
- nt as tenantRelationshipsGetById,
2419
- gs as tenantRemove,
2420
- Ce as tenantUnauthenticatedLookup,
2421
- Gt as tenantsGet,
2422
- ms as userAdd,
2423
- ot as userDelegatedScopesGet,
2424
- es as userDelegatedScopesRemove,
2425
- ys as userRemove,
2426
- ts as usersGet,
2427
- bs as workspaceConfigsGet,
2428
- ws as workspaceEdit,
2429
- Ct as workspacePut,
2430
- Ot as workspacesGet
2365
+ rs as tenantRelationshipsGetByDomain,
2366
+ ot as tenantRelationshipsGetById,
2367
+ Ts as tenantRemove,
2368
+ xe as tenantUnauthenticatedLookup,
2369
+ Ct as tenantsGet,
2370
+ Ss as userAdd,
2371
+ it as userDelegatedScopesGet,
2372
+ as as userDelegatedScopesRemove,
2373
+ Is as userRemove,
2374
+ ns as usersGet,
2375
+ vs as workspaceConfigsGet,
2376
+ $s as workspaceEdit,
2377
+ Ot as workspacePut,
2378
+ Nt as workspacesGet
2431
2379
  };
2432
2380
  //# sourceMappingURL=sync.es.js.map