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