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