@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/.vs/VSWorkspaceState.json +2 -3
- package/.vs/slnx.sqlite +0 -0
- package/.vs/sync.slnx/FileContentIndex/1ca8d456-29aa-416f-9787-e53a88d5d5ab.vsidx +0 -0
- package/.vs/sync.slnx/FileContentIndex/3741cf32-b4b7-4b99-9366-c24391f22a74.vsidx +0 -0
- package/.vs/sync.slnx/FileContentIndex/a8b9c3a0-52bd-4e8b-ad08-9046e741e403.vsidx +0 -0
- package/.vs/sync.slnx/FileContentIndex/{233f16f5-9502-4eee-892d-94508f320b43.vsidx → c8e19530-a150-45f1-a571-cd5fdea9925a.vsidx} +0 -0
- package/.vs/sync.slnx/FileContentIndex/ced1adfa-715d-4462-88ac-43cb0271386e.vsidx +0 -0
- package/.vs/sync.slnx/v18/.wsuo +0 -0
- package/.vs/sync.slnx/v18/DocumentLayout.backup.json +27 -12
- package/.vs/sync.slnx/v18/DocumentLayout.json +23 -8
- package/dist/src/api-client.d.ts +74 -0
- package/dist/src/index.d.ts +8 -10
- package/dist/sync.es.js +1021 -1073
- package/dist/sync.es.js.map +1 -1
- package/dist/sync.umd.js +50 -50
- package/dist/sync.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/api-client.ts +382 -0
- package/src/index.ts +52 -419
- package/.vs/sync.slnx/FileContentIndex/46af7fa0-1a65-4634-9faa-600623e92173.vsidx +0 -0
- package/.vs/sync.slnx/FileContentIndex/88b226f1-9afd-4cf3-bdb6-5db742bb7e8d.vsidx +0 -0
- package/.vs/sync.slnx/FileContentIndex/eb2f80ef-22e0-4cc0-a8fb-f7837f87af2d.vsidx +0 -0
- package/.vs/sync.slnx/FileContentIndex/f109c15d-d422-45e9-a5df-0b391ae0a643.vsidx +0 -0
package/dist/sync.es.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var Ue = Object.defineProperty;
|
|
2
|
+
var be = (n) => {
|
|
3
3
|
throw TypeError(n);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var u = (n,
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
import { deserializeArray as
|
|
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
|
-
],
|
|
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
|
-
],
|
|
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
|
-
],
|
|
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
|
-
]
|
|
142
|
-
function
|
|
143
|
-
|
|
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
|
|
149
|
-
return "1.0.
|
|
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 =
|
|
304
|
+
this.result = !0, this.status = 200, this.error = "", this.version = F(), this.array = null;
|
|
159
305
|
}
|
|
160
306
|
}
|
|
161
|
-
class
|
|
307
|
+
class Ee {
|
|
162
308
|
}
|
|
163
309
|
// azure graph REST API endpoints
|
|
164
|
-
u(
|
|
165
|
-
const
|
|
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://${
|
|
314
|
+
return `https://${b.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/admin`;
|
|
169
315
|
}
|
|
170
316
|
static adminIncompleteEndpoint() {
|
|
171
|
-
return `https://${
|
|
317
|
+
return `https://${b.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/incomplete-admin`;
|
|
172
318
|
}
|
|
173
319
|
static adminsEndpoint() {
|
|
174
|
-
return `https://${
|
|
320
|
+
return `https://${b.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/admins`;
|
|
175
321
|
}
|
|
176
322
|
static auditConfigEndpoint() {
|
|
177
|
-
return `https://${
|
|
323
|
+
return `https://${b.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/audit-configuration`;
|
|
178
324
|
}
|
|
179
325
|
static auditEventsEndpoint() {
|
|
180
|
-
return `https://${
|
|
326
|
+
return `https://${b.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/audit-events`;
|
|
181
327
|
}
|
|
182
328
|
static configConsentEndpoint() {
|
|
183
|
-
return `https://${
|
|
329
|
+
return `https://${b.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/configuration/consent`;
|
|
184
330
|
}
|
|
185
331
|
static configEnabledEndpoint() {
|
|
186
|
-
return `https://${
|
|
332
|
+
return `https://${b.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/configuration/status`;
|
|
187
333
|
}
|
|
188
334
|
static configEndpoint() {
|
|
189
|
-
return `https://${
|
|
335
|
+
return `https://${b.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/configuration`;
|
|
190
336
|
}
|
|
191
337
|
static configsEndpoint() {
|
|
192
|
-
return `https://${
|
|
338
|
+
return `https://${b.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/configurations`;
|
|
193
339
|
}
|
|
194
340
|
static initEndpoint() {
|
|
195
|
-
return `https://${
|
|
341
|
+
return `https://${b.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/configuration/init`;
|
|
196
342
|
}
|
|
197
343
|
static readerStartSyncEndpoint() {
|
|
198
|
-
return `https://${
|
|
344
|
+
return `https://${b.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/startSync`;
|
|
199
345
|
}
|
|
200
346
|
static tenantEndpoint() {
|
|
201
|
-
return `https://${
|
|
347
|
+
return `https://${b.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/tenant`;
|
|
202
348
|
}
|
|
203
349
|
static tenantsEndpoint() {
|
|
204
|
-
return `https://${
|
|
350
|
+
return `https://${b.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/tenants`;
|
|
205
351
|
}
|
|
206
352
|
static workspaceEndpoint() {
|
|
207
|
-
return `https://${
|
|
353
|
+
return `https://${b.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/workspace`;
|
|
208
354
|
}
|
|
209
355
|
static workspacesEndpoint() {
|
|
210
|
-
return `https://${
|
|
356
|
+
return `https://${b.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/workspaces`;
|
|
211
357
|
}
|
|
212
358
|
static workspaceConfigsEndpoint() {
|
|
213
|
-
return `https://${
|
|
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://${
|
|
363
|
+
return `https://${b.environmentTag}-signalrdispatcher-westus.azurewebsites.net/statsHub`;
|
|
218
364
|
}
|
|
219
365
|
static statsEndpoint() {
|
|
220
|
-
return `https://${
|
|
366
|
+
return `https://${b.environmentTag}-signalrdispatcher-westus.azurewebsites.net/api/stats`;
|
|
221
367
|
}
|
|
222
368
|
};
|
|
223
|
-
u(
|
|
224
|
-
let
|
|
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
|
|
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(
|
|
246
|
-
return
|
|
391
|
+
static compareByValue(r, s) {
|
|
392
|
+
return r.value.localeCompare(s.value);
|
|
247
393
|
}
|
|
248
|
-
static compareByGroup(
|
|
249
|
-
return
|
|
394
|
+
static compareByGroup(r, s) {
|
|
395
|
+
return r.group.localeCompare(s.group);
|
|
250
396
|
}
|
|
251
397
|
}
|
|
252
|
-
class
|
|
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
|
|
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
|
|
449
|
+
function Ye(n, r) {
|
|
304
450
|
switch (n) {
|
|
305
451
|
case h.authorityWW:
|
|
306
|
-
return
|
|
452
|
+
return r === 1 ? "85d35da2-4118-4b03-aa05-605cedd7f2f8" : "63100afe-506e-4bb2-8ff7-d8d5ab373129";
|
|
307
453
|
case h.authorityUS:
|
|
308
|
-
return
|
|
454
|
+
return r === 1 ? "b08630c7-e227-4215-9746-afc9286fb864" : "17aa5d5a-f09f-4cec-87a6-28596f9fa513";
|
|
309
455
|
case h.authorityCN:
|
|
310
|
-
return
|
|
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
|
|
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
|
|
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
|
|
343
|
-
class
|
|
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
|
|
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
|
|
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
|
|
548
|
+
function P() {
|
|
403
549
|
let n;
|
|
404
550
|
try {
|
|
405
551
|
n = window.localStorage;
|
|
406
|
-
const
|
|
407
|
-
return n.setItem(
|
|
408
|
-
} catch (
|
|
409
|
-
return
|
|
410
|
-
(
|
|
411
|
-
|
|
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
|
-
|
|
414
|
-
|
|
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
|
|
419
|
-
class
|
|
420
|
-
constructor(
|
|
421
|
-
|
|
422
|
-
u(this, "version",
|
|
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(
|
|
577
|
+
this.init(r);
|
|
432
578
|
}
|
|
433
579
|
// get initial data from localStorage or file
|
|
434
|
-
init(
|
|
435
|
-
if (console.log(`Calling InitInfo::init(bClearLocalStorage: ${
|
|
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 (
|
|
586
|
+
if (r)
|
|
441
587
|
localStorage.removeItem("InitInfo");
|
|
442
588
|
else {
|
|
443
|
-
|
|
589
|
+
C(this, Z, Re).call(this, i);
|
|
444
590
|
return;
|
|
445
591
|
}
|
|
446
592
|
}
|
|
447
593
|
}
|
|
448
|
-
this.tab = 0, this.version =
|
|
449
|
-
var
|
|
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 =
|
|
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
|
|
458
|
-
localStorage.setItem("InitInfo",
|
|
603
|
+
let r = JSON.stringify(this);
|
|
604
|
+
localStorage.setItem("InitInfo", r);
|
|
459
605
|
}
|
|
460
606
|
tagWithWorkspaces() {
|
|
461
|
-
this.us.map((
|
|
462
|
-
for (let
|
|
463
|
-
for (let
|
|
464
|
-
let t = this.us.find((e) => e.oid ===
|
|
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[
|
|
612
|
+
t[W] += r.id, t[W] += " ";
|
|
467
613
|
else
|
|
468
614
|
debugger;
|
|
469
615
|
}
|
|
470
|
-
for (let
|
|
471
|
-
let t = this.ts.find((e) => e.tid ===
|
|
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[
|
|
619
|
+
t[W] += r.id, t[W] += " ";
|
|
474
620
|
else
|
|
475
621
|
debugger;
|
|
476
622
|
}
|
|
477
|
-
for (let
|
|
478
|
-
let t = this.cs.find((e) => e.id ===
|
|
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[
|
|
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
|
-
|
|
489
|
-
this.tab =
|
|
490
|
-
let t = new
|
|
491
|
-
return t.oid =
|
|
492
|
-
}), typeof
|
|
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 =
|
|
495
|
-
}), typeof
|
|
496
|
-
let t = new
|
|
497
|
-
return t.id =
|
|
498
|
-
}), typeof
|
|
499
|
-
let t = new
|
|
500
|
-
return t.id =
|
|
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
|
|
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,
|
|
557
|
-
class
|
|
558
|
-
constructor(
|
|
559
|
-
|
|
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
|
|
707
|
+
this.tasks = [new oe()], this.init(r);
|
|
562
708
|
}
|
|
563
709
|
// get initial data from localStorage or file
|
|
564
|
-
init(
|
|
565
|
-
if (console.log(`Calling TaskArray::init(bClearLocalStorage: ${
|
|
566
|
-
let
|
|
567
|
-
if (
|
|
568
|
-
let e = JSON.parse(
|
|
569
|
-
if (this.tasks =
|
|
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 =
|
|
718
|
+
this.tasks = C(this, G, de).call(this, rt);
|
|
573
719
|
}
|
|
574
720
|
// set start time for a task
|
|
575
|
-
setTaskStart(
|
|
576
|
-
let t =
|
|
721
|
+
setTaskStart(r, s) {
|
|
722
|
+
let t = C(this, G, ce).call(this, r);
|
|
577
723
|
if (t != null && t != null)
|
|
578
|
-
t.setStart(
|
|
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(
|
|
584
|
-
let e =
|
|
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(
|
|
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
|
-
|
|
595
|
-
let
|
|
596
|
-
if (
|
|
597
|
-
for (
|
|
598
|
-
if (
|
|
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
|
|
602
|
-
},
|
|
603
|
-
return
|
|
604
|
-
let t = new
|
|
605
|
-
return t.id =
|
|
606
|
-
let a = new
|
|
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
|
-
},
|
|
611
|
-
let
|
|
612
|
-
|
|
756
|
+
}, pe = function() {
|
|
757
|
+
let r = JSON.stringify(this);
|
|
758
|
+
P() && localStorage.setItem("Tasks", r);
|
|
613
759
|
};
|
|
614
|
-
class
|
|
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(
|
|
629
|
-
this.end =
|
|
630
|
-
let
|
|
631
|
-
t < 0 && (t += 60,
|
|
632
|
-
let e = this.end.getMinutes() - this.start.getMinutes() +
|
|
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(
|
|
636
|
-
this.start =
|
|
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(
|
|
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 =
|
|
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(
|
|
655
|
-
|
|
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(
|
|
658
|
-
|
|
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(
|
|
661
|
-
|
|
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(
|
|
664
|
-
|
|
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
|
|
668
|
-
class
|
|
669
|
-
constructor(
|
|
670
|
-
|
|
813
|
+
var M, fe;
|
|
814
|
+
class at {
|
|
815
|
+
constructor(r) {
|
|
816
|
+
V(this, M);
|
|
671
817
|
u(this, "milestones", []);
|
|
672
|
-
this.init(
|
|
818
|
+
this.init(r);
|
|
673
819
|
}
|
|
674
|
-
init(
|
|
675
|
-
if (
|
|
676
|
-
let
|
|
677
|
-
if (
|
|
678
|
-
let e = JSON.parse(
|
|
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 (
|
|
826
|
+
if (r)
|
|
681
827
|
localStorage.removeItem("syncmilestones");
|
|
682
828
|
else {
|
|
683
|
-
|
|
829
|
+
C(this, M, fe).call(this, e);
|
|
684
830
|
return;
|
|
685
831
|
}
|
|
686
832
|
}
|
|
687
833
|
}
|
|
688
|
-
|
|
834
|
+
C(this, M, fe).call(this, je);
|
|
689
835
|
}
|
|
690
836
|
save() {
|
|
691
|
-
let
|
|
692
|
-
|
|
837
|
+
let r = JSON.stringify(this.milestones);
|
|
838
|
+
P() && localStorage.setItem("syncmilestones", r);
|
|
693
839
|
}
|
|
694
840
|
// milestone tracking during a sync
|
|
695
|
-
start(
|
|
841
|
+
start(r) {
|
|
696
842
|
if (this.milestones == null || this.milestones.length < 1) {
|
|
697
843
|
debugger;
|
|
698
844
|
return;
|
|
699
845
|
}
|
|
700
|
-
let
|
|
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
|
|
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
|
-
}),
|
|
850
|
+
}), r(this.milestones), console.log(`Start milestone: ${this.milestones[0].Run}:${this.milestones[0].Start}`);
|
|
705
851
|
}
|
|
706
|
-
unstart(
|
|
852
|
+
unstart(r) {
|
|
707
853
|
if (this.milestones == null || this.milestones.length < 1) {
|
|
708
854
|
debugger;
|
|
709
855
|
return;
|
|
710
856
|
}
|
|
711
|
-
let
|
|
857
|
+
let s = this.milestones.shift();
|
|
712
858
|
this.milestones = this.milestones.map((t) => {
|
|
713
|
-
let e = new
|
|
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
|
-
}),
|
|
861
|
+
}), r(this.milestones), console.log(`Unstart removed first milestone: ${s.Run}:${s.Start}`);
|
|
716
862
|
}
|
|
717
|
-
post(
|
|
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(""),
|
|
868
|
+
this.milestones[0].post(""), r(this.milestones), console.log(`POST milestone: ${this.milestones[0].Run}:${this.milestones[0].POST}`);
|
|
723
869
|
}
|
|
724
|
-
read(
|
|
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(""),
|
|
875
|
+
this.milestones[0].read(""), r(this.milestones), console.log(`Read milestone: ${this.milestones[0].Run}:${this.milestones[0].Read}`);
|
|
730
876
|
}
|
|
731
|
-
write(
|
|
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
|
|
738
|
-
console.log(`Removed milestone #${
|
|
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((
|
|
741
|
-
let t = new
|
|
742
|
-
return t.Start =
|
|
743
|
-
}),
|
|
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
|
-
|
|
747
|
-
|
|
748
|
-
let t = new
|
|
749
|
-
return t.start(
|
|
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(
|
|
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(
|
|
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
|
-
|
|
921
|
+
P() && (localStorage.setItem("BatchIdArray", "[]"), localStorage.removeItem("BatchIdArrayProgress"));
|
|
783
922
|
}
|
|
784
923
|
// populate tenantNodes based on config tenants
|
|
785
|
-
init(
|
|
924
|
+
init(r, s, t) {
|
|
786
925
|
console.log(
|
|
787
|
-
`Calling BatchArray::init(config: "${
|
|
788
|
-
), t &&
|
|
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 =
|
|
929
|
+
let a = s.ts.find(
|
|
791
930
|
(o) => o.tid === e.tid
|
|
792
931
|
);
|
|
793
932
|
if (a != null) {
|
|
794
|
-
let o = new
|
|
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 ${
|
|
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
|
-
|
|
948
|
+
r.tenants.map((a) => {
|
|
810
949
|
if ((a.configurationTenantType === "target" || a.configurationTenantType === "sourcetarget") && a.tid !== e.tid) {
|
|
811
|
-
let o =
|
|
812
|
-
(
|
|
950
|
+
let o = s.ts.find(
|
|
951
|
+
(c) => c.tid === a.tid
|
|
813
952
|
);
|
|
814
953
|
if (o != null) {
|
|
815
|
-
let
|
|
954
|
+
let c = new Ae(
|
|
816
955
|
a.tid,
|
|
817
956
|
o.name,
|
|
818
957
|
a.batchId
|
|
819
958
|
);
|
|
820
|
-
e.targets.push(
|
|
959
|
+
e.targets.push(c), e.expanded = !0;
|
|
821
960
|
} else {
|
|
822
961
|
console.log(
|
|
823
|
-
`Error: no tenant found for config target tenant ${
|
|
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(
|
|
833
|
-
this.setIdleText = t, this.
|
|
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
|
|
847
|
-
const
|
|
848
|
-
if (!
|
|
849
|
-
const t = await
|
|
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[
|
|
852
|
-
this.pollLastUpdatedByBatchId[
|
|
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(
|
|
856
|
-
this.pb_startTS = 0, this.pb_progress = 0,
|
|
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(
|
|
878
|
-
if (
|
|
1012
|
+
calculateProgress(r, s, t, e, a) {
|
|
1013
|
+
if (r <= 0)
|
|
879
1014
|
return 0;
|
|
880
|
-
const o = Math.min(
|
|
881
|
-
return Math.min(99, Math.round(i / (
|
|
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(
|
|
884
|
-
const
|
|
885
|
-
this.pb_progress = Math.max(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(
|
|
888
|
-
this.
|
|
889
|
-
let
|
|
890
|
-
var
|
|
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
|
|
893
|
-
if (
|
|
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((
|
|
1033
|
+
let g = this.tenantNodes.find((f) => f.tid === _.SourceId);
|
|
899
1034
|
if (g == null) {
|
|
900
|
-
console.log(`Tenant ${
|
|
1035
|
+
console.log(`Tenant ${_.SourceId} not found in BatchArray.`);
|
|
901
1036
|
debugger;
|
|
902
1037
|
return;
|
|
903
1038
|
}
|
|
904
|
-
g.batchId =
|
|
905
|
-
let
|
|
906
|
-
for (let
|
|
907
|
-
let
|
|
908
|
-
if (
|
|
909
|
-
|
|
910
|
-
})),
|
|
911
|
-
|
|
912
|
-
})),
|
|
913
|
-
let
|
|
914
|
-
if (
|
|
915
|
-
console.log(`tid not found in ${
|
|
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
|
-
|
|
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 =
|
|
922
|
-
let
|
|
923
|
-
|
|
924
|
-
let
|
|
925
|
-
if (
|
|
926
|
-
console.log(`tid not found in ${
|
|
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
|
|
931
|
-
if (
|
|
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 (
|
|
937
|
-
|
|
938
|
-
else if (
|
|
939
|
-
|
|
940
|
-
else if (
|
|
941
|
-
|
|
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
|
-
|
|
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
|
|
952
|
-
this.tenantNodes.map((
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
}),
|
|
956
|
-
})
|
|
957
|
-
const
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
}),
|
|
962
|
-
})), a(
|
|
963
|
-
Math.max(
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
Math.max(
|
|
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
|
-
|
|
969
|
-
|
|
970
|
-
),
|
|
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 =
|
|
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(
|
|
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
|
|
1118
|
+
return e = await Ut(r, s, t), e;
|
|
984
1119
|
}
|
|
985
1120
|
}
|
|
986
|
-
class
|
|
987
|
-
constructor(
|
|
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 =
|
|
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(
|
|
1003
|
-
if (this.total =
|
|
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((
|
|
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
|
|
1016
|
-
constructor(
|
|
1150
|
+
class Ge {
|
|
1151
|
+
constructor(r, s) {
|
|
1017
1152
|
u(this, "resourceNodes");
|
|
1018
|
-
this.resourceNodes = new Array(),
|
|
1153
|
+
this.resourceNodes = new Array(), r && this.init(s);
|
|
1019
1154
|
}
|
|
1020
1155
|
// get resource data from localStorage or file
|
|
1021
|
-
init(
|
|
1022
|
-
if (console.log(`Calling ResourceArray::init(bClearLocalStorage: ${
|
|
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 (
|
|
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
|
|
1168
|
+
var s = JSON.stringify(Me);
|
|
1034
1169
|
try {
|
|
1035
|
-
this.resourceNodes =
|
|
1170
|
+
this.resourceNodes = B(Ce, s);
|
|
1036
1171
|
} catch {
|
|
1037
1172
|
debugger;
|
|
1038
1173
|
}
|
|
1039
1174
|
}
|
|
1040
1175
|
// read
|
|
1041
|
-
async read(
|
|
1042
|
-
let t = new
|
|
1043
|
-
return t.resourceNodes = await
|
|
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 (
|
|
1048
|
-
let
|
|
1049
|
-
localStorage.setItem("ResourceArray",
|
|
1182
|
+
if (P()) {
|
|
1183
|
+
let r = JSON.stringify(this);
|
|
1184
|
+
localStorage.setItem("ResourceArray", r);
|
|
1050
1185
|
}
|
|
1051
1186
|
}
|
|
1052
1187
|
}
|
|
1053
|
-
class
|
|
1054
|
-
constructor(
|
|
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 =
|
|
1195
|
+
this.type = r, this.resource = s, this.cost = t, this.expanded = !1, this.resources = new Array();
|
|
1061
1196
|
}
|
|
1062
1197
|
}
|
|
1063
|
-
class
|
|
1064
|
-
constructor(
|
|
1198
|
+
class Jt {
|
|
1199
|
+
constructor(r) {
|
|
1065
1200
|
u(this, "actorNodes");
|
|
1066
|
-
this.actorNodes = new Array(), this.init(
|
|
1201
|
+
this.actorNodes = new Array(), this.init(r);
|
|
1067
1202
|
}
|
|
1068
1203
|
// get initial data from localStorage or file
|
|
1069
|
-
init(
|
|
1070
|
-
if (console.log(`Calling ResourceArray::init(bClearLocalStorage: ${
|
|
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 (
|
|
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
|
|
1216
|
+
var s = JSON.stringify(He);
|
|
1082
1217
|
try {
|
|
1083
|
-
this.actorNodes =
|
|
1218
|
+
this.actorNodes = B(nt, s);
|
|
1084
1219
|
} catch {
|
|
1085
1220
|
debugger;
|
|
1086
1221
|
}
|
|
1087
1222
|
}
|
|
1088
1223
|
}
|
|
1089
|
-
class
|
|
1090
|
-
constructor(
|
|
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 =
|
|
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
|
|
1102
|
-
return
|
|
1236
|
+
async function Vt(n, r, s) {
|
|
1237
|
+
return await Ke(s);
|
|
1103
1238
|
}
|
|
1104
|
-
async function
|
|
1105
|
-
|
|
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
|
|
1144
|
-
|
|
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
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
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
|
|
1195
|
-
|
|
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
|
|
1254
|
+
async function es(n, r) {
|
|
1207
1255
|
if (n.authority == "") {
|
|
1208
1256
|
let e = new j();
|
|
1209
|
-
if (e.domain = n.tid, await
|
|
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
|
|
1264
|
+
let s = window.location.href;
|
|
1217
1265
|
switch (n.authority) {
|
|
1218
1266
|
case h.authorityWW:
|
|
1219
|
-
|
|
1267
|
+
s += "MicrosoftIdentity/Account/SignIn";
|
|
1220
1268
|
break;
|
|
1221
1269
|
case h.authorityUS:
|
|
1222
|
-
|
|
1270
|
+
s += "USGov/SignIn";
|
|
1223
1271
|
break;
|
|
1224
1272
|
case h.authorityCN:
|
|
1225
|
-
|
|
1273
|
+
s += "China/SignIn";
|
|
1226
1274
|
break;
|
|
1227
1275
|
default:
|
|
1228
1276
|
return !1;
|
|
1229
1277
|
}
|
|
1230
|
-
let t = new URL(
|
|
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
|
|
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
|
|
1288
|
+
function ts(n, r) {
|
|
1241
1289
|
debugger;
|
|
1242
1290
|
if (n.oid == "1") return;
|
|
1243
|
-
let
|
|
1291
|
+
let s = window.location.href;
|
|
1244
1292
|
switch (n.authority) {
|
|
1245
1293
|
case h.authorityWW:
|
|
1246
|
-
|
|
1294
|
+
s += "MicrosoftIdentity/Account/Challenge";
|
|
1247
1295
|
break;
|
|
1248
1296
|
case h.authorityUS:
|
|
1249
|
-
|
|
1297
|
+
s += "USGov/Challenge";
|
|
1250
1298
|
break;
|
|
1251
1299
|
case h.authorityCN:
|
|
1252
|
-
|
|
1300
|
+
s += "China/Challenge";
|
|
1253
1301
|
break;
|
|
1254
1302
|
default:
|
|
1255
1303
|
return;
|
|
1256
1304
|
}
|
|
1257
|
-
let t = new URL(
|
|
1258
|
-
t.searchParams.append("redirectUri", window.location.origin), t.searchParams.append("scope",
|
|
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
|
|
1308
|
+
async function ss(n) {
|
|
1261
1309
|
if (n.oid == "1") return !1;
|
|
1262
|
-
let
|
|
1263
|
-
|
|
1264
|
-
let
|
|
1265
|
-
|
|
1266
|
-
let t = { method: "PATCH" }, e = await fetch(
|
|
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
|
|
1333
|
+
return s = new URL(a), s.searchParams.append("redirectUri", window.location.origin), window.location.assign(s.href), !0;
|
|
1286
1334
|
}
|
|
1287
|
-
async function
|
|
1335
|
+
async function rs(n, r, s, t) {
|
|
1288
1336
|
if (t) debugger;
|
|
1289
|
-
if (
|
|
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
|
|
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
|
|
1304
|
-
|
|
1305
|
-
let i = await fetch(
|
|
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
|
|
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: ",
|
|
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
|
|
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
|
|
1381
|
+
let c = { method: "GET", headers: a };
|
|
1334
1382
|
try {
|
|
1335
|
-
var i =
|
|
1336
|
-
i += "(tenantId='", i +=
|
|
1337
|
-
let
|
|
1338
|
-
if (
|
|
1339
|
-
if (
|
|
1340
|
-
|
|
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: ",
|
|
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
|
|
1354
|
-
if (
|
|
1355
|
-
let
|
|
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 =
|
|
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
|
|
1364
|
-
var
|
|
1365
|
-
if (
|
|
1366
|
-
return n.tid =
|
|
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
|
|
1379
|
-
if (
|
|
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 (
|
|
1386
|
-
let { spid:
|
|
1387
|
-
if (
|
|
1388
|
-
|
|
1389
|
-
|
|
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:
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
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
|
|
1405
|
-
if (
|
|
1406
|
-
debugger;
|
|
1442
|
+
async function as(n, r, s, t) {
|
|
1443
|
+
if (r == null || s == null)
|
|
1407
1444
|
return !1;
|
|
1408
|
-
}
|
|
1409
|
-
|
|
1410
|
-
|
|
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
|
|
1416
|
-
|
|
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
|
|
1423
|
-
|
|
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
|
|
1440
|
-
return
|
|
1455
|
+
async function os(n, r, s, t) {
|
|
1456
|
+
return yt(n, r, s, t);
|
|
1441
1457
|
}
|
|
1442
|
-
async function
|
|
1443
|
-
return
|
|
1458
|
+
async function is(n, r, s, t) {
|
|
1459
|
+
return wt(n, r, s, t);
|
|
1444
1460
|
}
|
|
1445
|
-
async function
|
|
1446
|
-
return
|
|
1461
|
+
async function ls(n, r, s, t, e) {
|
|
1462
|
+
return Tt(n, r, s, t, e);
|
|
1447
1463
|
}
|
|
1448
|
-
async function
|
|
1449
|
-
return
|
|
1464
|
+
async function us(n, r, s, t) {
|
|
1465
|
+
return St(n, r, s, t);
|
|
1450
1466
|
}
|
|
1451
|
-
async function
|
|
1452
|
-
return
|
|
1467
|
+
async function cs(n, r, s) {
|
|
1468
|
+
return It(n, r, s);
|
|
1453
1469
|
}
|
|
1454
|
-
async function
|
|
1470
|
+
async function ds(n, r, s, t, e, a, o, c) {
|
|
1455
1471
|
let i = new m();
|
|
1456
|
-
if (
|
|
1457
|
-
if (i = await
|
|
1458
|
-
|
|
1459
|
-
(
|
|
1460
|
-
}), t && t(
|
|
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,
|
|
1463
|
-
let
|
|
1464
|
-
|
|
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
|
|
1483
|
+
i = await kt(n, r, s, c);
|
|
1468
1484
|
return o.save(), i;
|
|
1469
1485
|
}
|
|
1470
|
-
async function
|
|
1486
|
+
async function ps(n, r, s, t, e) {
|
|
1471
1487
|
let a = new m();
|
|
1472
|
-
return a = await
|
|
1488
|
+
return a = await vt(n, r, s, t, e), a;
|
|
1473
1489
|
}
|
|
1474
|
-
async function
|
|
1475
|
-
return
|
|
1490
|
+
async function fs(n, r, s, t, e) {
|
|
1491
|
+
return $t(n, r, s, t, e);
|
|
1476
1492
|
}
|
|
1477
|
-
async function
|
|
1478
|
-
return bt(n,
|
|
1493
|
+
async function hs(n, r, s, t, e) {
|
|
1494
|
+
return bt(n, r, s, t, e);
|
|
1479
1495
|
}
|
|
1480
|
-
async function
|
|
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
|
|
1485
|
-
if (
|
|
1486
|
-
|
|
1487
|
-
let i = await
|
|
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 (
|
|
1492
|
-
return console.log(
|
|
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
|
|
1496
|
-
return At(n,
|
|
1511
|
+
async function ms(n, r, s, t, e) {
|
|
1512
|
+
return At(n, r, s, t);
|
|
1497
1513
|
}
|
|
1498
|
-
async function
|
|
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 =
|
|
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
|
|
1507
|
-
return xt(n,
|
|
1522
|
+
async function ws(n, r, s, t) {
|
|
1523
|
+
return xt(n, r, s, t);
|
|
1508
1524
|
}
|
|
1509
|
-
async function
|
|
1510
|
-
return
|
|
1525
|
+
async function Ts(n, r, s, t, e) {
|
|
1526
|
+
return Gt(n, r, s, t);
|
|
1511
1527
|
}
|
|
1512
|
-
async function
|
|
1513
|
-
return
|
|
1528
|
+
async function Ss(n, r, s, t) {
|
|
1529
|
+
return mt(n, r, s, t);
|
|
1514
1530
|
}
|
|
1515
|
-
async function
|
|
1516
|
-
return
|
|
1531
|
+
async function Is(n, r, s, t) {
|
|
1532
|
+
return ht(n, r, s, t);
|
|
1517
1533
|
}
|
|
1518
|
-
async function
|
|
1519
|
-
return await
|
|
1534
|
+
async function $s(n, r, s, t) {
|
|
1535
|
+
return await Ot(n, r, s, t);
|
|
1520
1536
|
}
|
|
1521
|
-
function
|
|
1522
|
-
|
|
1523
|
-
let a = null, o =
|
|
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 =
|
|
1541
|
+
let l = r.us.findIndex((d) => d.oid === "1");
|
|
1526
1542
|
if (l !== -1) {
|
|
1527
|
-
a =
|
|
1528
|
-
let
|
|
1529
|
-
|
|
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
|
|
1547
|
+
a = new ie(), r.us.push(a);
|
|
1532
1548
|
} else
|
|
1533
|
-
a =
|
|
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
|
|
1536
|
-
|
|
1537
|
-
}),
|
|
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
|
|
1540
|
-
|
|
1541
|
-
let a = null, o =
|
|
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
|
|
1544
|
-
if (
|
|
1545
|
-
a =
|
|
1546
|
-
let
|
|
1547
|
-
|
|
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(),
|
|
1565
|
+
a = new j(), r.ts.push(a);
|
|
1550
1566
|
} else
|
|
1551
|
-
a =
|
|
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
|
|
1554
|
-
a.authority = i ? i[1] : e.authority, n.associatedTenants.findIndex((
|
|
1555
|
-
}),
|
|
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
|
|
1558
|
-
|
|
1559
|
-
let a = null, o =
|
|
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 =
|
|
1577
|
+
let i = r.cs.findIndex((l) => l.id === "1");
|
|
1562
1578
|
if (i !== -1) {
|
|
1563
|
-
a =
|
|
1564
|
-
let l = n.associatedConfigs.findIndex((
|
|
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
|
|
1583
|
+
a = new le(), r.cs.push(a);
|
|
1568
1584
|
} else
|
|
1569
|
-
a =
|
|
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
|
|
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-----------",
|
|
1590
|
+
}), console.log("--------------ii-----------", r), r.save();
|
|
1575
1591
|
}
|
|
1576
|
-
async function dt(n,
|
|
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
|
|
1596
|
+
if (e = await Nt(n, r, t), e.result) {
|
|
1581
1597
|
for (let a of e.array) {
|
|
1582
|
-
let o = null,
|
|
1583
|
-
if (
|
|
1584
|
-
let
|
|
1585
|
-
|
|
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 =
|
|
1603
|
+
o = s.ws.at(c);
|
|
1588
1604
|
let i = "";
|
|
1589
|
-
for (let
|
|
1590
|
-
let
|
|
1591
|
-
|
|
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
|
|
1595
|
-
let
|
|
1596
|
-
|
|
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
|
|
1599
|
-
for (let
|
|
1600
|
-
let
|
|
1601
|
-
|
|
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
|
|
1605
|
-
if (!
|
|
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 (!
|
|
1608
|
-
|
|
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
|
|
1618
|
-
let
|
|
1633
|
+
async function bs(n, r) {
|
|
1634
|
+
let s = "", t = F();
|
|
1619
1635
|
try {
|
|
1620
|
-
let e = n.getAllAccounts(), a =
|
|
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
|
-
|
|
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: " +
|
|
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),
|
|
1651
|
+
return console.log(t), s;
|
|
1636
1652
|
}
|
|
1637
|
-
async function
|
|
1638
|
-
|
|
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
|
|
1666
|
-
|
|
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
|
|
1685
|
-
if (s == null || s.spacode == "")
|
|
1686
|
-
return !1;
|
|
1659
|
+
async function pt(n, r) {
|
|
1687
1660
|
try {
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
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
|
|
1720
|
-
return
|
|
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,
|
|
1723
|
-
const
|
|
1724
|
-
|
|
1725
|
-
const t = ft(
|
|
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 =
|
|
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
|
|
1678
|
+
let c = await n.acquireTokenSilent({
|
|
1731
1679
|
scopes: [t],
|
|
1732
1680
|
account: o
|
|
1733
1681
|
});
|
|
1734
|
-
|
|
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 =
|
|
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 && (
|
|
1688
|
+
a[i].homeAccountId == o && (c = a[i]);
|
|
1741
1689
|
n.acquireTokenRedirect({
|
|
1742
1690
|
scopes: [t],
|
|
1743
|
-
account:
|
|
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
|
|
1750
|
-
}
|
|
1751
|
-
async function
|
|
1752
|
-
let
|
|
1753
|
-
if (n.status === 401 && (
|
|
1754
|
-
return
|
|
1755
|
-
let
|
|
1756
|
-
if (
|
|
1757
|
-
|
|
1758
|
-
else if (
|
|
1759
|
-
|
|
1760
|
-
(a, o) => a + 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 (
|
|
1764
|
-
|
|
1711
|
+
else if (s.title !== void 0)
|
|
1712
|
+
r = s.title;
|
|
1765
1713
|
else
|
|
1766
1714
|
debugger;
|
|
1767
|
-
return
|
|
1715
|
+
return r;
|
|
1768
1716
|
}
|
|
1769
|
-
async function
|
|
1717
|
+
async function ht(n, r, s, t) {
|
|
1770
1718
|
let e = new m();
|
|
1771
|
-
if (
|
|
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(
|
|
1775
|
-
let
|
|
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,
|
|
1779
|
-
return i.status === 200 && i.statusText === "OK" ? (console.log(`Successful DELETE from /admin: ${a.href}`), e) : (e.error = await
|
|
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
|
|
1733
|
+
async function gt(n, r, s, t) {
|
|
1786
1734
|
let e = new m();
|
|
1787
|
-
if (
|
|
1735
|
+
if (s === "")
|
|
1788
1736
|
return e.result = !1, e.status = 500, e.error = "adminsGet: no workspace provided", e;
|
|
1789
|
-
let a =
|
|
1790
|
-
o.searchParams.append("workspaceId",
|
|
1791
|
-
let i = { method: "GET", headers: await I(n,
|
|
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
|
|
1798
|
-
return
|
|
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
|
|
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
|
|
1754
|
+
async function mt(n, r, s, t) {
|
|
1807
1755
|
let e = new m();
|
|
1808
|
-
if (
|
|
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 =
|
|
1811
|
-
const o = await I(n,
|
|
1812
|
-
let
|
|
1813
|
-
{"email": "${
|
|
1814
|
-
"tenantId": "${
|
|
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:
|
|
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: ${
|
|
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
|
|
1827
|
-
n = n,
|
|
1774
|
+
async function yt(n, r, s, t) {
|
|
1775
|
+
n = n, r = r, t = t;
|
|
1828
1776
|
let e = new m();
|
|
1829
|
-
if (
|
|
1777
|
+
if (s.id === "")
|
|
1830
1778
|
return e.result = !1, e.error = "auditConfigPost: invalid config ID", e.status = 500, e;
|
|
1831
|
-
let a =
|
|
1832
|
-
const o = await I(n,
|
|
1833
|
-
let
|
|
1779
|
+
let a = T.auditConfigEndpoint();
|
|
1780
|
+
const o = await I(n, r);
|
|
1781
|
+
let c = `
|
|
1834
1782
|
{
|
|
1835
|
-
"workspaceId": "${
|
|
1836
|
-
"name": "${
|
|
1837
|
-
"description": "${
|
|
1838
|
-
"isEnabled": ${
|
|
1839
|
-
"email": "${
|
|
1840
|
-
"tenantId": "${
|
|
1841
|
-
}`, i = { method: "POST", headers: o, body:
|
|
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
|
|
1848
|
-
return
|
|
1849
|
-
`Successful AuditConfigID: ${
|
|
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
|
|
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
|
|
1859
|
-
n = n,
|
|
1806
|
+
async function wt(n, r, s, t) {
|
|
1807
|
+
n = n, r = r, t = t;
|
|
1860
1808
|
let e = new m();
|
|
1861
|
-
if (
|
|
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 (!
|
|
1811
|
+
if (!s || s.trim() === "")
|
|
1864
1812
|
return e.result = !1, e.error = "auditConfigGet: configurationId is required", e.status = 500, e;
|
|
1865
|
-
let a =
|
|
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
|
|
1872
|
-
e.result = !0, e.status = l.status, console.log("Successful GET from /audit-configuration:",
|
|
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
|
|
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
|
|
1828
|
+
async function Tt(n, r, s, t, e) {
|
|
1881
1829
|
let a = new m();
|
|
1882
|
-
if (!
|
|
1830
|
+
if (!s || s.trim() === "")
|
|
1883
1831
|
return a.result = !1, a.error = "auditConfigPut: invalid configuration ID", a.status = 500, a;
|
|
1884
|
-
let o =
|
|
1885
|
-
|
|
1886
|
-
const i = await I(n,
|
|
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
|
-
}`,
|
|
1842
|
+
}`, d = { method: "PUT", headers: i, body: l };
|
|
1895
1843
|
try {
|
|
1896
1844
|
if (e) debugger;
|
|
1897
|
-
console.log("Attempting PUT to /audit-configuration: " +
|
|
1898
|
-
const
|
|
1899
|
-
|
|
1900
|
-
} catch (
|
|
1901
|
-
a.error =
|
|
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
|
|
1853
|
+
async function St(n, r, s, t) {
|
|
1906
1854
|
let e = new m();
|
|
1907
|
-
if (!
|
|
1855
|
+
if (!r.mail)
|
|
1908
1856
|
return e.result = !1, e.status = 500, e.error = "auditConfigDelete: no user provided", e;
|
|
1909
|
-
if (!
|
|
1857
|
+
if (!s || s.trim() === "")
|
|
1910
1858
|
return e.result = !1, e.status = 500, e.error = "auditConfigDelete: configurationId is required", e;
|
|
1911
|
-
let a =
|
|
1912
|
-
o.searchParams.append("configurationId",
|
|
1913
|
-
const i = { method: "DELETE", headers: await I(n,
|
|
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 ${
|
|
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
|
|
1872
|
+
async function It(n, r, s) {
|
|
1925
1873
|
let t = new m();
|
|
1926
|
-
if (
|
|
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 =
|
|
1876
|
+
let e = T.auditEventsEndpoint(), a = new URL(e), c = { method: "GET", headers: await I(n, r) };
|
|
1929
1877
|
try {
|
|
1930
|
-
if (
|
|
1878
|
+
if (s) debugger;
|
|
1931
1879
|
console.log("Attempting GET from /audit-events endpoint: " + a.href);
|
|
1932
|
-
let i = await fetch(a.href,
|
|
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
|
|
1937
|
-
if (
|
|
1938
|
-
return t.array =
|
|
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
|
|
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
|
|
1949
|
-
let a = new m(), o =
|
|
1950
|
-
|
|
1951
|
-
const i = await I(n,
|
|
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
|
-
}`,
|
|
1904
|
+
}`, d = { method: "PUT", headers: i, body: l };
|
|
1957
1905
|
try {
|
|
1958
|
-
console.log("Attempting PUT read consent to /configuration/consent: " +
|
|
1959
|
-
let
|
|
1960
|
-
return
|
|
1961
|
-
} catch (
|
|
1962
|
-
a.error =
|
|
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,
|
|
1967
|
-
let a = new m(), o =
|
|
1968
|
-
|
|
1969
|
-
const i = await I(n,
|
|
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
|
-
}`,
|
|
1922
|
+
}`, d = { method: "PUT", headers: i, body: l };
|
|
1975
1923
|
try {
|
|
1976
|
-
console.log("Attempting PUT read consent to /configuration/consent: " +
|
|
1977
|
-
let
|
|
1978
|
-
return
|
|
1979
|
-
} catch (
|
|
1980
|
-
a.error =
|
|
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
|
|
1932
|
+
async function Et(n, r, s, t, e) {
|
|
1985
1933
|
let a = new m();
|
|
1986
|
-
if (
|
|
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(
|
|
1990
|
-
let i = { method: "GET", headers: await I(n,
|
|
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}/${
|
|
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
|
|
1944
|
+
let d = await l.json();
|
|
1997
1945
|
return {
|
|
1998
1946
|
...a,
|
|
1999
|
-
array: [
|
|
1947
|
+
array: [d]
|
|
2000
1948
|
};
|
|
2001
1949
|
} else
|
|
2002
|
-
return a.error = await
|
|
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,
|
|
1956
|
+
async function At(n, r, s, t, e) {
|
|
2009
1957
|
let a = new m();
|
|
2010
|
-
if (
|
|
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(
|
|
2014
|
-
let i = { method: "DELETE", headers: await I(n,
|
|
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
|
|
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
|
|
1972
|
+
async function vt(n, r, s, t, e) {
|
|
2025
1973
|
let a = new m();
|
|
2026
|
-
if (
|
|
1974
|
+
if (s === "")
|
|
2027
1975
|
return a.result = !1, a.error = "configPatch: invalid config ID", a.status = 500, a;
|
|
2028
|
-
let o =
|
|
2029
|
-
|
|
2030
|
-
let l = { method: "PATCH", headers: await I(n,
|
|
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: " +
|
|
2034
|
-
let
|
|
2035
|
-
return
|
|
2036
|
-
} catch (
|
|
2037
|
-
a.error =
|
|
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
|
|
1989
|
+
async function Dt(n, r, s, t, e) {
|
|
2042
1990
|
let a = new m();
|
|
2043
|
-
if (
|
|
1991
|
+
if (s.id === "")
|
|
2044
1992
|
return a.result = !1, a.error = "configPost: invalid config ID", a.status = 500, a;
|
|
2045
|
-
let o =
|
|
2046
|
-
const
|
|
1993
|
+
let o = T.configEndpoint();
|
|
1994
|
+
const c = await I(n, r);
|
|
2047
1995
|
let i = `
|
|
2048
1996
|
{
|
|
2049
1997
|
"workspaceId": "${t}",
|
|
2050
|
-
"name": "${
|
|
2051
|
-
"description": "${
|
|
2052
|
-
"isEnabled": ${
|
|
1998
|
+
"name": "${s.name}",
|
|
1999
|
+
"description": "${s.description}",
|
|
2000
|
+
"isEnabled": ${s.isEnabled},
|
|
2053
2001
|
"tenants": [`;
|
|
2054
|
-
|
|
2055
|
-
let
|
|
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": "${
|
|
2058
|
-
"sourceGroupId": ${
|
|
2059
|
-
"sourceGroupName": ${
|
|
2060
|
-
"targetGroupId": ${
|
|
2061
|
-
"targetGroupName": ${
|
|
2062
|
-
"configurationTenantType": "${
|
|
2063
|
-
"isReadPermissionConsented": ${
|
|
2064
|
-
"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:
|
|
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
|
|
2072
|
-
if (
|
|
2073
|
-
let
|
|
2074
|
-
return
|
|
2075
|
-
`Successful ConfigID: ${
|
|
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
|
|
2079
|
-
} catch (
|
|
2080
|
-
return a.status = 500, a.result = !1, a.error =
|
|
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
|
|
2031
|
+
async function kt(n, r, s, t) {
|
|
2084
2032
|
let e = new m();
|
|
2085
|
-
if (
|
|
2033
|
+
if (s.id === "")
|
|
2086
2034
|
return e.result = !1, e.error = "configPost: invalid config ID", e.status = 500, e;
|
|
2087
|
-
let a =
|
|
2088
|
-
o.searchParams.append("configurationId",
|
|
2089
|
-
const
|
|
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": "${
|
|
2093
|
-
"description": "${
|
|
2040
|
+
"name": "${s.name}",
|
|
2041
|
+
"description": "${s.description}",
|
|
2094
2042
|
"tenants": [`;
|
|
2095
|
-
|
|
2043
|
+
s.tenants.map((d) => {
|
|
2096
2044
|
i.slice(-1) === "}" && (i += ",");
|
|
2097
|
-
let
|
|
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": "${
|
|
2100
|
-
"sourceGroupId": ${
|
|
2101
|
-
"sourceGroupName": ${
|
|
2102
|
-
"targetGroupId": ${
|
|
2047
|
+
"tenantId": "${d.tid}",
|
|
2048
|
+
"sourceGroupId": ${$},
|
|
2049
|
+
"sourceGroupName": ${E},
|
|
2050
|
+
"targetGroupId": ${x},
|
|
2103
2051
|
"targetGroupName": ${N},
|
|
2104
|
-
"configurationTenantType": "${
|
|
2105
|
-
"deltaToken": "${
|
|
2106
|
-
"isReadPermissionConsented": ${
|
|
2107
|
-
"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:
|
|
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
|
|
2115
|
-
if (
|
|
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
|
|
2065
|
+
let p = await d.json();
|
|
2118
2066
|
return {
|
|
2119
2067
|
...e,
|
|
2120
|
-
array: [
|
|
2068
|
+
array: [p]
|
|
2121
2069
|
};
|
|
2122
2070
|
} else
|
|
2123
|
-
return e.error = await
|
|
2124
|
-
} catch (
|
|
2125
|
-
e.error =
|
|
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
|
|
2077
|
+
async function Pt(n, r, s, t) {
|
|
2130
2078
|
let e = new m();
|
|
2131
|
-
if (
|
|
2079
|
+
if (s === "")
|
|
2132
2080
|
return e.result = !1, e.status = 500, e.error = "configsGet: no workspace provided", e;
|
|
2133
|
-
let a =
|
|
2134
|
-
o.searchParams.append("workspaceId",
|
|
2135
|
-
let i = { method: "GET", headers: await I(n,
|
|
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
|
|
2142
|
-
return
|
|
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
|
|
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
|
|
2098
|
+
async function vs(n, r, s, t) {
|
|
2151
2099
|
let e = new m();
|
|
2152
|
-
if (!
|
|
2100
|
+
if (!s)
|
|
2153
2101
|
return e.result = !1, e.status = 500, e.error = "workspaceConfigsGet: no workspace provided", e;
|
|
2154
|
-
let a =
|
|
2155
|
-
o.searchParams.append("workspaceId",
|
|
2156
|
-
let i = { method: "GET", headers: await I(n,
|
|
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
|
|
2163
|
-
if (
|
|
2164
|
-
return e.array =
|
|
2165
|
-
id:
|
|
2166
|
-
name:
|
|
2167
|
-
description:
|
|
2168
|
-
configurationType:
|
|
2169
|
-
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
|
|
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
|
|
2129
|
+
async function Rt(n, r, s) {
|
|
2182
2130
|
let t = new m();
|
|
2183
|
-
if (
|
|
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 =
|
|
2186
|
-
const a = await I(n,
|
|
2133
|
+
let e = T.initEndpoint();
|
|
2134
|
+
const a = await I(n, r);
|
|
2187
2135
|
let o = `
|
|
2188
2136
|
{
|
|
2189
2137
|
"tenantCreateModel": {
|
|
2190
|
-
"tenantId": "${
|
|
2191
|
-
"name": "${
|
|
2192
|
-
"domain": "${
|
|
2138
|
+
"tenantId": "${r.tid}",
|
|
2139
|
+
"name": "${r.companyName}",
|
|
2140
|
+
"domain": "${r.companyDomain}",
|
|
2193
2141
|
"type": "aad",
|
|
2194
|
-
"authority": "${
|
|
2142
|
+
"authority": "${r.authority}"
|
|
2195
2143
|
}
|
|
2196
|
-
}`,
|
|
2144
|
+
}`, c = { method: "POST", headers: a, body: o };
|
|
2197
2145
|
try {
|
|
2198
|
-
if (
|
|
2146
|
+
if (s) debugger;
|
|
2199
2147
|
console.log("Attempting POST to /configuration/init: " + e);
|
|
2200
|
-
let i = await fetch(e,
|
|
2201
|
-
return i.status === 200 && i.statusText === "OK" ? (console.log(`Successful POST to /configuration/init: ${o}`), t) : (t.error = await
|
|
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
|
|
2155
|
+
async function Gt(n, r, s, t, e) {
|
|
2208
2156
|
let a = new m();
|
|
2209
|
-
if (
|
|
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(
|
|
2212
|
-
o.searchParams.append("tenantId",
|
|
2213
|
-
let i = { method: "DELETE", headers: await I(n,
|
|
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
|
|
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
|
|
2171
|
+
async function Ct(n, r, s, t) {
|
|
2224
2172
|
let e = new m();
|
|
2225
|
-
if (
|
|
2173
|
+
if (s === "")
|
|
2226
2174
|
return e.result = !1, e.status = 500, e.error = "tenantsGet: no workspace provided", e;
|
|
2227
|
-
let a =
|
|
2228
|
-
o.searchParams.append("workspaceId",
|
|
2229
|
-
let i = { method: "GET", headers: await I(n,
|
|
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
|
|
2236
|
-
return
|
|
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
|
|
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,
|
|
2192
|
+
async function xt(n, r, s, t) {
|
|
2245
2193
|
let e = new m();
|
|
2246
|
-
if (
|
|
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 =
|
|
2196
|
+
let a = T.tenantEndpoint(), o = new URL(a);
|
|
2249
2197
|
o.searchParams.append("workspaceId", t);
|
|
2250
|
-
const
|
|
2198
|
+
const c = await I(n, r);
|
|
2251
2199
|
let i = `
|
|
2252
|
-
{"tenantId": "${
|
|
2253
|
-
"name": "${
|
|
2254
|
-
"domain": "${
|
|
2200
|
+
{"tenantId": "${s.tid}",
|
|
2201
|
+
"name": "${s.name}",
|
|
2202
|
+
"domain": "${s.domain}",
|
|
2255
2203
|
"type": 1,
|
|
2256
|
-
"authority": "${
|
|
2257
|
-
}`, l = { method: "POST", headers:
|
|
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
|
|
2261
|
-
return
|
|
2262
|
-
} catch (
|
|
2263
|
-
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
|
|
2215
|
+
async function Ot(n, r, s, t) {
|
|
2268
2216
|
let e = new m();
|
|
2269
|
-
if (
|
|
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 =
|
|
2272
|
-
o.searchParams.append("workspaceId",
|
|
2273
|
-
let i = { method: "PUT", headers: await I(n,
|
|
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
|
|
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
|
|
2231
|
+
async function Nt(n, r, s) {
|
|
2284
2232
|
let t = new m();
|
|
2285
|
-
if (
|
|
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 =
|
|
2235
|
+
let e = T.workspacesEndpoint(), a = new URL(e), c = { method: "GET", headers: await I(n, r) };
|
|
2288
2236
|
try {
|
|
2289
|
-
if (
|
|
2237
|
+
if (s) debugger;
|
|
2290
2238
|
console.log("Attempting GET from /workspaces endpoint: " + a.href);
|
|
2291
|
-
let i = await fetch(a.href,
|
|
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((
|
|
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
|
|
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
|
|
2250
|
+
async function Ut(n, r, s) {
|
|
2303
2251
|
let t = new m();
|
|
2304
|
-
if (n == 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 =
|
|
2307
|
-
a.searchParams.append("configurationId",
|
|
2308
|
-
let
|
|
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,
|
|
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
|
|
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
|
|
2271
|
+
async function Wt(n, r, s) {
|
|
2324
2272
|
let t = new m();
|
|
2325
|
-
if (n == 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 =
|
|
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,
|
|
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
|
|
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
|
-
|
|
2344
|
-
|
|
2291
|
+
Jt as ActorArray,
|
|
2292
|
+
nt as ActorNode,
|
|
2345
2293
|
Mt as AuditConfig,
|
|
2346
2294
|
qt as BatchArray,
|
|
2347
2295
|
zt as Group,
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
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
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
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
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
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
|
-
|
|
2346
|
+
Vt as groupsGet,
|
|
2399
2347
|
Lt as helloNpm,
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
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
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
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
|