@ms-atlas/datastudio 0.1.20
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.
Potentially problematic release.
This version of @ms-atlas/datastudio might be problematic. Click here for more details.
- package/ExternalLibraries/Monaco/vs/loader.js +2166 -0
- package/ExternalLibraries/URI.min.js +1901 -0
- package/ExternalLibraries/crossroads.min.js +453 -0
- package/ExternalLibraries/css.js +165 -0
- package/ExternalLibraries/d3.min.js +10857 -0
- package/ExternalLibraries/es6-promise.min.js +363 -0
- package/ExternalLibraries/hammer.js +2224 -0
- package/ExternalLibraries/hull.js +444 -0
- package/ExternalLibraries/i18n.min.js +115 -0
- package/ExternalLibraries/jquery-ui-timepicker-addon.min.css +76 -0
- package/ExternalLibraries/jquery-ui-timepicker-addon.min.js +1918 -0
- package/ExternalLibraries/jquery-ui.js +17201 -0
- package/ExternalLibraries/jquery-ui.min.css +1454 -0
- package/ExternalLibraries/jquery.history.js +2173 -0
- package/ExternalLibraries/jquery.min.js +5168 -0
- package/ExternalLibraries/jquery.mockjax.min.js +445 -0
- package/ExternalLibraries/jquery.modal.js +173 -0
- package/ExternalLibraries/jstree.js +10086 -0
- package/ExternalLibraries/jstree.style.css +1048 -0
- package/ExternalLibraries/jwt-decode.min.js +142 -0
- package/ExternalLibraries/knockout-latest.debug.js +7375 -0
- package/ExternalLibraries/knockout.mapping.min.js +534 -0
- package/ExternalLibraries/moment.js +3389 -0
- package/ExternalLibraries/q.js +1974 -0
- package/ExternalLibraries/require.js +2230 -0
- package/ExternalLibraries/signals.min.js +179 -0
- package/ExternalLibraries/text.js +445 -0
- package/ExternalLibraries/uuid.js +274 -0
- package/app-main.js +1 -0
- package/datastudio.application.mainpage.js +1502 -0
- package/datastudio.application.shared.js +626 -0
- package/datastudio.bootstrapper.js +517 -0
- package/fonts.css +14 -0
- package/nls/resx.js +1 -0
- package/nls/root/resx.js +22 -0
- package/package.json +22 -0
- package/scripts/application/sourceMapper.js +15 -0
- package/scripts/libs/adal/adal.js +720 -0
- package/stylesheets/main.css +8879 -0
|
@@ -0,0 +1,626 @@
|
|
|
1
|
+
var Microsoft;
|
|
2
|
+
!(function (t) {
|
|
3
|
+
var e;
|
|
4
|
+
!(function (t) {
|
|
5
|
+
var e;
|
|
6
|
+
!(function (t) {
|
|
7
|
+
var e = (function () {
|
|
8
|
+
function t(t, e, n, o, r, i) {
|
|
9
|
+
(this.instance = t),
|
|
10
|
+
(this.clientId = e),
|
|
11
|
+
(this.tenant = n),
|
|
12
|
+
(this.redirectUri = o),
|
|
13
|
+
(this.postLogoutRedirectUri = r),
|
|
14
|
+
(this.cacheLocation = i);
|
|
15
|
+
}
|
|
16
|
+
return t;
|
|
17
|
+
})();
|
|
18
|
+
t.AuthConfigImpl = e;
|
|
19
|
+
})((e = t.Application || (t.Application = {})));
|
|
20
|
+
})((e = t.DataStudio || (t.DataStudio = {})));
|
|
21
|
+
})(Microsoft || (Microsoft = {}));
|
|
22
|
+
var Microsoft;
|
|
23
|
+
!(function (t) {
|
|
24
|
+
var e;
|
|
25
|
+
!(function (t) {
|
|
26
|
+
var e;
|
|
27
|
+
!(function (t) {
|
|
28
|
+
!(function (t) {
|
|
29
|
+
(t[(t.DOGFOOD = 0)] = "DOGFOOD"),
|
|
30
|
+
(t[(t.CATFOOD = 1)] = "CATFOOD"),
|
|
31
|
+
(t[(t.PRODUCTION = 2)] = "PRODUCTION");
|
|
32
|
+
})(t.EnvironmentTypeImpl || (t.EnvironmentTypeImpl = {}));
|
|
33
|
+
var e = t.EnvironmentTypeImpl,
|
|
34
|
+
n = (function () {
|
|
35
|
+
function t() {}
|
|
36
|
+
return (
|
|
37
|
+
(t.Current = null),
|
|
38
|
+
(t.CurrentEndpoint = null),
|
|
39
|
+
(t.getAPIUrl = function (n, o) {
|
|
40
|
+
return (
|
|
41
|
+
null === t.CurrentEndpoint &&
|
|
42
|
+
(t.CurrentEndpoint = o
|
|
43
|
+
? t.getConstant(
|
|
44
|
+
"https://AtlasPlatformAPI.cloudapp.net",
|
|
45
|
+
((r = {}),
|
|
46
|
+
(r[e.DOGFOOD] =
|
|
47
|
+
"https://AtlasPlatformAPIInt.cloudapp.net"),
|
|
48
|
+
(r[e.CATFOOD] =
|
|
49
|
+
"https://AtlasPlatformAPITest.cloudapp.net"),
|
|
50
|
+
r)
|
|
51
|
+
)
|
|
52
|
+
: ""),
|
|
53
|
+
t.CurrentEndpoint + "/api/" + n
|
|
54
|
+
);
|
|
55
|
+
var r;
|
|
56
|
+
}),
|
|
57
|
+
(t.getConstant = function (e, n) {
|
|
58
|
+
return n[t.getCurrent()] || e;
|
|
59
|
+
}),
|
|
60
|
+
(t.getCurrent = function () {
|
|
61
|
+
return (
|
|
62
|
+
null === t.Current &&
|
|
63
|
+
((t.Current = e[MICROSOFT_DATASTUDIO_CURRENT_ENVIRONMENT]),
|
|
64
|
+
"undefined" == typeof t.Current &&
|
|
65
|
+
(t.Current = e.PRODUCTION)),
|
|
66
|
+
t.Current
|
|
67
|
+
);
|
|
68
|
+
}),
|
|
69
|
+
t
|
|
70
|
+
);
|
|
71
|
+
})();
|
|
72
|
+
t.EnvironmentImpl = n;
|
|
73
|
+
})((e = t.Application || (t.Application = {})));
|
|
74
|
+
})((e = t.DataStudio || (t.DataStudio = {})));
|
|
75
|
+
})(Microsoft || (Microsoft = {})),
|
|
76
|
+
(Microsoft.DataStudio.Application.Environment =
|
|
77
|
+
Microsoft.DataStudio.Application.EnvironmentImpl),
|
|
78
|
+
(Microsoft.DataStudio.Application.EnvironmentType =
|
|
79
|
+
Microsoft.DataStudio.Application.EnvironmentTypeImpl);
|
|
80
|
+
var Microsoft;
|
|
81
|
+
!(function (t) {
|
|
82
|
+
var e;
|
|
83
|
+
!(function (e) {
|
|
84
|
+
var n;
|
|
85
|
+
!(function (e) {
|
|
86
|
+
var n = t.DataStudio.Diagnostics.Logging,
|
|
87
|
+
o = (function () {
|
|
88
|
+
function t() {}
|
|
89
|
+
return (
|
|
90
|
+
(t.getLogger = function (e) {
|
|
91
|
+
return t.loggerFactory.getLogger(e);
|
|
92
|
+
}),
|
|
93
|
+
(t.loggerFactory = new n.LoggerFactory({
|
|
94
|
+
moduleName: "Application",
|
|
95
|
+
})),
|
|
96
|
+
t
|
|
97
|
+
);
|
|
98
|
+
})();
|
|
99
|
+
e.LoggerFactory = o;
|
|
100
|
+
})((n = e.Application || (e.Application = {})));
|
|
101
|
+
})((e = t.DataStudio || (t.DataStudio = {})));
|
|
102
|
+
})(Microsoft || (Microsoft = {}));
|
|
103
|
+
var Microsoft;
|
|
104
|
+
!(function (t) {
|
|
105
|
+
var e;
|
|
106
|
+
!(function (e) {
|
|
107
|
+
var n;
|
|
108
|
+
!(function (e) {
|
|
109
|
+
var n = (function () {
|
|
110
|
+
function e() {}
|
|
111
|
+
return (
|
|
112
|
+
(e.AZURE_RESOURCE_URL =
|
|
113
|
+
t.DataStudio.Application.Environment.getConstant(
|
|
114
|
+
"https://management.azure.com",
|
|
115
|
+
((n = {}),
|
|
116
|
+
(n[t.DataStudio.Application.EnvironmentType.DOGFOOD] =
|
|
117
|
+
"https://api-dogfood.resources.windows-int.net/"),
|
|
118
|
+
n)
|
|
119
|
+
)),
|
|
120
|
+
e
|
|
121
|
+
);
|
|
122
|
+
var n;
|
|
123
|
+
})();
|
|
124
|
+
e.ResourceConstantsImpl = n;
|
|
125
|
+
var o = (function () {
|
|
126
|
+
function e() {}
|
|
127
|
+
return (
|
|
128
|
+
(e.AUTH_INSTANCE_URL =
|
|
129
|
+
t.DataStudio.Application.Environment.getConstant(
|
|
130
|
+
"https://login.windows.net/",
|
|
131
|
+
((n = {}),
|
|
132
|
+
(n[t.DataStudio.Application.EnvironmentType.DOGFOOD] =
|
|
133
|
+
"https://login.windows-ppe.net/"),
|
|
134
|
+
n)
|
|
135
|
+
)),
|
|
136
|
+
(e.AUTH_CLIENTID = "16f9b8e9-d20b-45a1-ab9e-db2e8254508b"),
|
|
137
|
+
(e.AUTH_TENANT = "common"),
|
|
138
|
+
(e.AUTH_SIGNOUT_URL = ""),
|
|
139
|
+
(e.AUTH_STORAGE_MODE = "sessionStorage"),
|
|
140
|
+
(e.AUTH_RESOURCE_NAME = "https://management.core.windows.net/"),
|
|
141
|
+
(e.AUTH_SUCCESS_POSTLOGIN_PAGE = ""),
|
|
142
|
+
(e.AUTH_FAILURE_POSTLOGIN_PAGE = ""),
|
|
143
|
+
e
|
|
144
|
+
);
|
|
145
|
+
var n;
|
|
146
|
+
})();
|
|
147
|
+
e.AuthConstants = o;
|
|
148
|
+
})((n = e.Application || (e.Application = {})));
|
|
149
|
+
})((e = t.DataStudio || (t.DataStudio = {})));
|
|
150
|
+
})(Microsoft || (Microsoft = {})),
|
|
151
|
+
(Microsoft.DataStudio.Application.ResourceConstants =
|
|
152
|
+
Microsoft.DataStudio.Application.ResourceConstantsImpl);
|
|
153
|
+
var ShellContext = Microsoft.DataStudio.Application.ShellContext,
|
|
154
|
+
Router = Microsoft.DataStudio.Application.Router,
|
|
155
|
+
Logging = Microsoft.DataStudio.Diagnostics.Logging,
|
|
156
|
+
Microsoft;
|
|
157
|
+
!(function (t) {
|
|
158
|
+
var e;
|
|
159
|
+
!(function (e) {
|
|
160
|
+
var n;
|
|
161
|
+
!(function (n) {
|
|
162
|
+
var o = (function () {
|
|
163
|
+
function n() {
|
|
164
|
+
var t = this;
|
|
165
|
+
if (
|
|
166
|
+
((this.currentUser = null),
|
|
167
|
+
(this.accessTokenDeferred = Q.defer()),
|
|
168
|
+
(this.noauth = !1),
|
|
169
|
+
(this.getTokenId = 0),
|
|
170
|
+
(this.getTokenMap = {}),
|
|
171
|
+
(this.waitingToRenewToken = !1),
|
|
172
|
+
(this.login = function () {
|
|
173
|
+
t.noauth ||
|
|
174
|
+
(t.authLogger.logInfo("Login initiated"),
|
|
175
|
+
t.authContext.login());
|
|
176
|
+
}),
|
|
177
|
+
(this.logout = function () {
|
|
178
|
+
t.authLogger.logInfo("Logout initiated"), t.authContext.logOut();
|
|
179
|
+
}),
|
|
180
|
+
n._instance)
|
|
181
|
+
)
|
|
182
|
+
throw new Error(
|
|
183
|
+
"Error: Instantiation failed: USE [Microsoft.DataStudio.Managers.AuthenticationManager.instance] instead of new."
|
|
184
|
+
);
|
|
185
|
+
(n._instance = this),
|
|
186
|
+
(this.authLogger = e.Application.LoggerFactory.getLogger({
|
|
187
|
+
loggerName: "AuthenticationManager",
|
|
188
|
+
}));
|
|
189
|
+
}
|
|
190
|
+
return (
|
|
191
|
+
(n.prototype.processUserContext = function () {
|
|
192
|
+
var t = this;
|
|
193
|
+
if (!t.currentUser) {
|
|
194
|
+
(t.isAuthRelatedCallback = t.authContext.isCallback(
|
|
195
|
+
window.location.hash
|
|
196
|
+
)),
|
|
197
|
+
t.isAuthRelatedCallback && t.authContext.handleWindowCallback();
|
|
198
|
+
var n = t.authContext.getLoginError();
|
|
199
|
+
if (n) this.authLogger.logError("Login Error", { error: n });
|
|
200
|
+
else {
|
|
201
|
+
var o = t.authContext.getCachedUser();
|
|
202
|
+
null !== o &&
|
|
203
|
+
(t.currentUser = {
|
|
204
|
+
email: o.userName,
|
|
205
|
+
name: o.profile.given_name,
|
|
206
|
+
puid: e.AuthHelpers.extractPuid(
|
|
207
|
+
t.authContext._getItem(
|
|
208
|
+
t.authContext.CONSTANTS.STORAGE.IDTOKEN
|
|
209
|
+
)
|
|
210
|
+
),
|
|
211
|
+
token: null,
|
|
212
|
+
sessionId: t.authContext._getItem(
|
|
213
|
+
t.authContext.CONSTANTS.STORAGE.STATE_LOGIN
|
|
214
|
+
),
|
|
215
|
+
subscriptions: null,
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}),
|
|
220
|
+
Object.defineProperty(n, "instance", {
|
|
221
|
+
get: function () {
|
|
222
|
+
return n._instance;
|
|
223
|
+
},
|
|
224
|
+
enumerable: !0,
|
|
225
|
+
configurable: !0,
|
|
226
|
+
}),
|
|
227
|
+
(n.prototype.initializeAsync = function (e) {
|
|
228
|
+
var o = this;
|
|
229
|
+
if (-1 != window.location.href.indexOf("noauth=true")) {
|
|
230
|
+
if (
|
|
231
|
+
((this.noauth = !0),
|
|
232
|
+
(this.fakeSessionID = this.generateGUID()),
|
|
233
|
+
(localStorage[n.injectedAccessToken] = ""),
|
|
234
|
+
parent !== window)
|
|
235
|
+
) {
|
|
236
|
+
this.parentOrigin = document.referrer.substring(
|
|
237
|
+
0,
|
|
238
|
+
document.referrer.indexOf("/", 8)
|
|
239
|
+
);
|
|
240
|
+
var r = function (t) {
|
|
241
|
+
var e = t.data;
|
|
242
|
+
if ("getToken" === e.type) {
|
|
243
|
+
var n = e.id,
|
|
244
|
+
r = e.token;
|
|
245
|
+
o.getTokenMap[n](r), delete o.getTokenMap[n];
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
window.addEventListener("message", r, !1);
|
|
249
|
+
}
|
|
250
|
+
return Q(!0);
|
|
251
|
+
}
|
|
252
|
+
var i = this,
|
|
253
|
+
a = Q.defer();
|
|
254
|
+
i.defaultTenant = e;
|
|
255
|
+
var s = window.location.toString(),
|
|
256
|
+
u = new t.DataStudio.Application.AuthConfigImpl(
|
|
257
|
+
t.DataStudio.Application.AuthConstants.AUTH_INSTANCE_URL,
|
|
258
|
+
t.DataStudio.Application.AuthConstants.AUTH_CLIENTID,
|
|
259
|
+
t.DataStudio.Application.AuthConstants.AUTH_TENANT,
|
|
260
|
+
s,
|
|
261
|
+
s,
|
|
262
|
+
t.DataStudio.Application.AuthConstants.AUTH_STORAGE_MODE
|
|
263
|
+
);
|
|
264
|
+
i.authContext = new AuthenticationContext(u);
|
|
265
|
+
var c = i.getCurrentUser();
|
|
266
|
+
return c
|
|
267
|
+
? i.isAuthRelatedCallback ||
|
|
268
|
+
window.location.href === n.accessTokenRedirectUrl
|
|
269
|
+
? (a.reject(!0), a.promise)
|
|
270
|
+
: e
|
|
271
|
+
? Q(!0)
|
|
272
|
+
: i.getUserSubscriptions()
|
|
273
|
+
: (localStorage.removeItem(n.tenantsListStorageKey),
|
|
274
|
+
localStorage.removeItem(n.subscriptionsDictionaryStorageKey),
|
|
275
|
+
i.login(),
|
|
276
|
+
a.reject(!0),
|
|
277
|
+
a.promise);
|
|
278
|
+
}),
|
|
279
|
+
(n.prototype.getCurrentUser = function () {
|
|
280
|
+
return this.noauth
|
|
281
|
+
? {
|
|
282
|
+
email: "dummy@microsoft.com",
|
|
283
|
+
name: "TestApp",
|
|
284
|
+
puid: "23234123123",
|
|
285
|
+
sessionId: this.fakeSessionID || "sessionGuidDummyString",
|
|
286
|
+
subscriptions: [],
|
|
287
|
+
token: null,
|
|
288
|
+
}
|
|
289
|
+
: (this.processUserContext(), this.currentUser);
|
|
290
|
+
}),
|
|
291
|
+
(n.prototype.getAccessToken = function (t) {
|
|
292
|
+
var e = this;
|
|
293
|
+
if (this.noauth) {
|
|
294
|
+
var o = Q.defer();
|
|
295
|
+
if (null != this.parentOrigin) {
|
|
296
|
+
var r = ++this.getTokenId;
|
|
297
|
+
(this.getTokenMap[r] = function (t) {
|
|
298
|
+
o.resolve(t);
|
|
299
|
+
}),
|
|
300
|
+
parent.postMessage(
|
|
301
|
+
{ type: "getToken", id: r },
|
|
302
|
+
this.parentOrigin
|
|
303
|
+
);
|
|
304
|
+
} else {
|
|
305
|
+
var i = function () {
|
|
306
|
+
var t = localStorage[n.injectedAccessToken];
|
|
307
|
+
t && (o.resolve(t), clearInterval(a));
|
|
308
|
+
},
|
|
309
|
+
a = setInterval(i, 1e3);
|
|
310
|
+
i();
|
|
311
|
+
}
|
|
312
|
+
return o.promise;
|
|
313
|
+
}
|
|
314
|
+
var s = this;
|
|
315
|
+
return (
|
|
316
|
+
t && (t = t.toLowerCase()),
|
|
317
|
+
s.accessTokenDeferred.promise.isFulfilled() &&
|
|
318
|
+
(s.accessTokenDeferred = Q.defer()),
|
|
319
|
+
s.defaultTenant
|
|
320
|
+
? s.updateAccessTokenForTenant(s.defaultTenant)
|
|
321
|
+
: s.subscriptionToTenantMapDeferred.promise.then(function (n) {
|
|
322
|
+
var o = n[t] && n[t].tenantId ? n[t].tenantId : null;
|
|
323
|
+
if (t && !o) {
|
|
324
|
+
var r =
|
|
325
|
+
"No AD tenant is available for the subscription " +
|
|
326
|
+
t +
|
|
327
|
+
". If you recently acquired permissions for this subscription, then please logout and login again.";
|
|
328
|
+
e.authLogger.logError("Tenant missing for Subscription", {
|
|
329
|
+
errorDetails: r,
|
|
330
|
+
}),
|
|
331
|
+
s.accessTokenDeferred.reject(r);
|
|
332
|
+
} else t ? s.updateAccessTokenForTenant(o) : s.updateAccessTokenForTenant(null);
|
|
333
|
+
}),
|
|
334
|
+
s.accessTokenDeferred.promise
|
|
335
|
+
);
|
|
336
|
+
}),
|
|
337
|
+
(n.prototype.updateAccessTokenForTenant = function (e) {
|
|
338
|
+
var o = this,
|
|
339
|
+
r = this;
|
|
340
|
+
r.authContext.config.redirectUri = n.accessTokenRedirectUrl;
|
|
341
|
+
var i = r.authContext.getCachedToken(
|
|
342
|
+
t.DataStudio.Application.AuthConstants.AUTH_RESOURCE_NAME
|
|
343
|
+
),
|
|
344
|
+
a = i ? jwt.decode(i).tid : r.authContext.config.tenant;
|
|
345
|
+
e && a !== e
|
|
346
|
+
? ((r.waitingToRenewToken = !0),
|
|
347
|
+
(r.authContext.config.tenant = e),
|
|
348
|
+
r.authContext._renewToken(
|
|
349
|
+
t.DataStudio.Application.AuthConstants.AUTH_RESOURCE_NAME,
|
|
350
|
+
function (t, e) {
|
|
351
|
+
t
|
|
352
|
+
? (o.authLogger.logError("Renew Token Failed:", {
|
|
353
|
+
errorDetails: t,
|
|
354
|
+
}),
|
|
355
|
+
r.accessTokenDeferred.reject(t))
|
|
356
|
+
: r.accessTokenDeferred.resolve(e),
|
|
357
|
+
(r.waitingToRenewToken = !1);
|
|
358
|
+
}
|
|
359
|
+
))
|
|
360
|
+
: r.waitingToRenewToken ||
|
|
361
|
+
r.authContext.acquireToken(
|
|
362
|
+
t.DataStudio.Application.AuthConstants.AUTH_RESOURCE_NAME,
|
|
363
|
+
function (t, e) {
|
|
364
|
+
t
|
|
365
|
+
? (o.authLogger.logError("Aquire Token Failed:", {
|
|
366
|
+
errorDetails: t,
|
|
367
|
+
}),
|
|
368
|
+
r.accessTokenDeferred.reject(t))
|
|
369
|
+
: r.accessTokenDeferred.resolve(e);
|
|
370
|
+
}
|
|
371
|
+
);
|
|
372
|
+
}),
|
|
373
|
+
(n.prototype.getAccessTokenADC = function (t) {
|
|
374
|
+
var e = this,
|
|
375
|
+
n = this;
|
|
376
|
+
return (
|
|
377
|
+
n.accessTokenDeferred.promise.isFulfilled() &&
|
|
378
|
+
(n.accessTokenDeferred = Q.defer()),
|
|
379
|
+
n.subscriptionToTenantMapDeferred.promise.then(function (t) {
|
|
380
|
+
n.authContext.acquireToken(
|
|
381
|
+
"https://datacatalog.azure.com",
|
|
382
|
+
function (t, o) {
|
|
383
|
+
t
|
|
384
|
+
? (e.authLogger.logError("Aquire Token Failed:", {
|
|
385
|
+
errorDetails: t,
|
|
386
|
+
}),
|
|
387
|
+
n.accessTokenDeferred.reject(t))
|
|
388
|
+
: n.accessTokenDeferred.resolve(o);
|
|
389
|
+
}
|
|
390
|
+
);
|
|
391
|
+
}),
|
|
392
|
+
n.accessTokenDeferred.promise
|
|
393
|
+
);
|
|
394
|
+
}),
|
|
395
|
+
(n.prototype.getUserSubscriptions = function () {
|
|
396
|
+
var e = this,
|
|
397
|
+
o = this,
|
|
398
|
+
r = Q.defer();
|
|
399
|
+
(o.tenantListDeferred = Q.defer()),
|
|
400
|
+
(o.subscriptionToTenantMapDeferred = Q.defer()),
|
|
401
|
+
o.subscriptionToTenantMapDeferred.promise.then(function (t) {
|
|
402
|
+
(o.currentUser.subscriptions = Object.keys(t).map(function (e) {
|
|
403
|
+
return {
|
|
404
|
+
displayName: t[e].displayName,
|
|
405
|
+
subscriptionid: e,
|
|
406
|
+
access_token: null,
|
|
407
|
+
};
|
|
408
|
+
})),
|
|
409
|
+
r.resolve(null);
|
|
410
|
+
});
|
|
411
|
+
var i = localStorage.getItem(n.tenantsListStorageKey),
|
|
412
|
+
a = localStorage.getItem(n.subscriptionsDictionaryStorageKey),
|
|
413
|
+
s = !1;
|
|
414
|
+
if (i && a)
|
|
415
|
+
try {
|
|
416
|
+
o.tenantListDeferred.resolve(JSON.parse(i)),
|
|
417
|
+
o.subscriptionToTenantMapDeferred.resolve(JSON.parse(a)),
|
|
418
|
+
(s = !0);
|
|
419
|
+
} catch (u) {
|
|
420
|
+
(s = !1),
|
|
421
|
+
this.authLogger.logError("Tenant Mapping Failed:", {
|
|
422
|
+
error: u,
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
return (
|
|
426
|
+
s ||
|
|
427
|
+
o.authContext.acquireToken(
|
|
428
|
+
t.DataStudio.Application.AuthConstants.AUTH_RESOURCE_NAME,
|
|
429
|
+
function (t, r) {
|
|
430
|
+
return t
|
|
431
|
+
? void e.authLogger.logError("Aquire Token Failed:", {
|
|
432
|
+
errorDetails: t,
|
|
433
|
+
})
|
|
434
|
+
: void jQuery
|
|
435
|
+
.ajax({
|
|
436
|
+
url: n.azureResourceManagerUrl + "/tenants",
|
|
437
|
+
data: {
|
|
438
|
+
"api-version": n.azureResourceManagerApiVersion,
|
|
439
|
+
},
|
|
440
|
+
headers: { Authorization: "Bearer " + r },
|
|
441
|
+
})
|
|
442
|
+
.then(
|
|
443
|
+
function (t) {
|
|
444
|
+
o.tenantListDeferred.resolve(t.value);
|
|
445
|
+
var e = t.value,
|
|
446
|
+
r = e.map(function () {
|
|
447
|
+
return Q.defer();
|
|
448
|
+
}),
|
|
449
|
+
i = {};
|
|
450
|
+
e.forEach(function (t, e, n) {
|
|
451
|
+
0 === e
|
|
452
|
+
? o.getSubscriptionsForTenant(
|
|
453
|
+
t.tenantId,
|
|
454
|
+
i,
|
|
455
|
+
r[e]
|
|
456
|
+
)
|
|
457
|
+
: r[e - 1].promise.then(function () {
|
|
458
|
+
setTimeout(function () {
|
|
459
|
+
o.getSubscriptionsForTenant(
|
|
460
|
+
t.tenantId,
|
|
461
|
+
i,
|
|
462
|
+
r[e]
|
|
463
|
+
);
|
|
464
|
+
}, 500);
|
|
465
|
+
});
|
|
466
|
+
}),
|
|
467
|
+
Q.all(
|
|
468
|
+
r.map(function (t) {
|
|
469
|
+
return t.promise;
|
|
470
|
+
})
|
|
471
|
+
).then(function () {
|
|
472
|
+
o.subscriptionToTenantMapDeferred.resolve(i),
|
|
473
|
+
localStorage.setItem(
|
|
474
|
+
n.subscriptionsDictionaryStorageKey,
|
|
475
|
+
JSON.stringify(i)
|
|
476
|
+
),
|
|
477
|
+
localStorage.setItem(
|
|
478
|
+
n.tenantsListStorageKey,
|
|
479
|
+
JSON.stringify(e)
|
|
480
|
+
);
|
|
481
|
+
});
|
|
482
|
+
},
|
|
483
|
+
function (t) {
|
|
484
|
+
e.authLogger.logError(
|
|
485
|
+
"Failed to load list of tenants",
|
|
486
|
+
{ errorDetails: t }
|
|
487
|
+
);
|
|
488
|
+
}
|
|
489
|
+
);
|
|
490
|
+
}
|
|
491
|
+
),
|
|
492
|
+
r.promise
|
|
493
|
+
);
|
|
494
|
+
}),
|
|
495
|
+
(n.prototype.getSubscriptionsForTenant = function (e, o, r) {
|
|
496
|
+
var i = this,
|
|
497
|
+
a = this;
|
|
498
|
+
e && (e = e.toLowerCase()),
|
|
499
|
+
(a.authContext.config.tenant = e),
|
|
500
|
+
a.authContext._renewToken(
|
|
501
|
+
t.DataStudio.Application.AuthConstants.AUTH_RESOURCE_NAME,
|
|
502
|
+
function (t, a) {
|
|
503
|
+
t
|
|
504
|
+
? i.authLogger.logError(
|
|
505
|
+
"Failed to renew token to get subscription for tenant:",
|
|
506
|
+
{ tenantid: e, errorDetails: t }
|
|
507
|
+
)
|
|
508
|
+
: jQuery
|
|
509
|
+
.ajax({
|
|
510
|
+
url: n.azureResourceManagerUrl + "/subscriptions",
|
|
511
|
+
data: {
|
|
512
|
+
"api-version": n.azureResourceManagerApiVersion,
|
|
513
|
+
},
|
|
514
|
+
headers: { Authorization: "Bearer " + a },
|
|
515
|
+
})
|
|
516
|
+
.then(
|
|
517
|
+
function (t) {
|
|
518
|
+
t.value.forEach(function (t) {
|
|
519
|
+
"Enabled" === t.state &&
|
|
520
|
+
(o[t.subscriptionId] = {
|
|
521
|
+
tenantId: e,
|
|
522
|
+
displayName: t.displayName,
|
|
523
|
+
});
|
|
524
|
+
}),
|
|
525
|
+
r.resolve(null);
|
|
526
|
+
},
|
|
527
|
+
function (t) {
|
|
528
|
+
i.authLogger.logError(
|
|
529
|
+
"Could not get subscriptions for tenant:",
|
|
530
|
+
{ tenant: e }
|
|
531
|
+
),
|
|
532
|
+
r.reject(null);
|
|
533
|
+
}
|
|
534
|
+
);
|
|
535
|
+
}
|
|
536
|
+
);
|
|
537
|
+
}),
|
|
538
|
+
(n.prototype.generateGUID = function () {
|
|
539
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(
|
|
540
|
+
/[xy]/g,
|
|
541
|
+
function (t) {
|
|
542
|
+
var e = (16 * Math.random()) | 0,
|
|
543
|
+
n = "x" == t ? e : (3 & e) | 8;
|
|
544
|
+
return n.toString(16);
|
|
545
|
+
}
|
|
546
|
+
);
|
|
547
|
+
}),
|
|
548
|
+
(n._instance = new n()),
|
|
549
|
+
(n.tenantsListStorageKey = "tenantsList"),
|
|
550
|
+
(n.subscriptionsDictionaryStorageKey = "subscriptionsDictionary"),
|
|
551
|
+
(n.azureResourceManagerUrl =
|
|
552
|
+
t.DataStudio.Application.ResourceConstants.AZURE_RESOURCE_URL),
|
|
553
|
+
(n.azureResourceManagerApiVersion = "2015-11-01"),
|
|
554
|
+
(n.accessTokenRedirectUrl =
|
|
555
|
+
window.location.origin + "/accessToken.html"),
|
|
556
|
+
(n.injectedAccessToken = "injectedAccessToken"),
|
|
557
|
+
n
|
|
558
|
+
);
|
|
559
|
+
})();
|
|
560
|
+
n.AuthenticationManager = o;
|
|
561
|
+
})((n = e.Managers || (e.Managers = {})));
|
|
562
|
+
})((e = t.DataStudio || (t.DataStudio = {})));
|
|
563
|
+
})(Microsoft || (Microsoft = {}));
|
|
564
|
+
var Microsoft;
|
|
565
|
+
!(function (t) {
|
|
566
|
+
var e;
|
|
567
|
+
!(function (e) {
|
|
568
|
+
var n;
|
|
569
|
+
!(function (e) {
|
|
570
|
+
function n(t) {
|
|
571
|
+
var e = jwt.decode(t);
|
|
572
|
+
if (o.isDefined(e.puid)) {
|
|
573
|
+
if (!o.isString(e.puid))
|
|
574
|
+
return (
|
|
575
|
+
console.warn(
|
|
576
|
+
"Invalid PUID format: puid is present in the idToken, but it doesn't seem to be a string:",
|
|
577
|
+
e.puid
|
|
578
|
+
),
|
|
579
|
+
""
|
|
580
|
+
);
|
|
581
|
+
var n = e.puid,
|
|
582
|
+
r = /^[0-9A-Z]{16}$/;
|
|
583
|
+
return (
|
|
584
|
+
r.test(n) ||
|
|
585
|
+
console.warn(
|
|
586
|
+
"Invalid PUID format: puid as a string is present in the idToken, but it doesn't match our regex/understanding:",
|
|
587
|
+
n
|
|
588
|
+
),
|
|
589
|
+
n
|
|
590
|
+
);
|
|
591
|
+
}
|
|
592
|
+
if (o.isDefined(e.altsecid)) {
|
|
593
|
+
if (!o.isString(e.altsecid))
|
|
594
|
+
return (
|
|
595
|
+
console.warn(
|
|
596
|
+
"Invalid PUID format: altsecid is present in the idToken, but it doesn't seem to be a string:",
|
|
597
|
+
e.altsecid
|
|
598
|
+
),
|
|
599
|
+
""
|
|
600
|
+
);
|
|
601
|
+
var i = e.altsecid,
|
|
602
|
+
a = /^1:live\.com:[0-9A-Z]{16}$/;
|
|
603
|
+
if (!a.test(i))
|
|
604
|
+
return (
|
|
605
|
+
console.warn(
|
|
606
|
+
"Invalid PUID format: altsecid as a string is present in the idToken, but it doesn't match our regex/understanding:",
|
|
607
|
+
i
|
|
608
|
+
),
|
|
609
|
+
i
|
|
610
|
+
);
|
|
611
|
+
var s = i.split(":");
|
|
612
|
+
return s[2] + "@Live.com";
|
|
613
|
+
}
|
|
614
|
+
return (
|
|
615
|
+
console.warn(
|
|
616
|
+
"Invalid PUID format: Neither 'puid' nor 'altsecid' seems to be present in the idToken for this user, understand better?:",
|
|
617
|
+
e
|
|
618
|
+
),
|
|
619
|
+
""
|
|
620
|
+
);
|
|
621
|
+
}
|
|
622
|
+
var o = t.DataStudio.Diagnostics.TypeInfo;
|
|
623
|
+
e.extractPuid = n;
|
|
624
|
+
})((n = e.AuthHelpers || (e.AuthHelpers = {})));
|
|
625
|
+
})((e = t.DataStudio || (t.DataStudio = {})));
|
|
626
|
+
})(Microsoft || (Microsoft = {}));
|