@osovitny/anatoly 3.19.4 → 3.19.6
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.
|
@@ -1303,7 +1303,6 @@ class DateConvert {
|
|
|
1303
1303
|
Copyright (c) 2016-2025 Osovitny Inc. All rights reserved.
|
|
1304
1304
|
</file>
|
|
1305
1305
|
*/
|
|
1306
|
-
//var beautify_html = require('js-beautify').html;
|
|
1307
1306
|
class XmlFormatter {
|
|
1308
1307
|
static toPrettyXML(s, options) {
|
|
1309
1308
|
if (!options) {
|
|
@@ -2004,21 +2003,26 @@ class AuthService extends ApiServiceBase {
|
|
|
2004
2003
|
}));
|
|
2005
2004
|
}
|
|
2006
2005
|
//2. if isUserAuthenticated
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
return response
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2006
|
+
try {
|
|
2007
|
+
let activeAccount = this.getActiveAccount();
|
|
2008
|
+
if (activeAccount) {
|
|
2009
|
+
let silentRequest = {
|
|
2010
|
+
scopes: MSALUtils.getApiScopes(),
|
|
2011
|
+
account: activeAccount
|
|
2012
|
+
};
|
|
2013
|
+
return this.msalService.acquireTokenSilent(silentRequest).pipe(map$1(response => {
|
|
2014
|
+
return response.accessToken;
|
|
2015
|
+
}), catchError(error => {
|
|
2016
|
+
console.log("Silent token acquisition fails.");
|
|
2017
|
+
if (error instanceof InteractionRequiredAuthError) {
|
|
2018
|
+
return this.acquireToken();
|
|
2019
|
+
}
|
|
2020
|
+
return of(null);
|
|
2021
|
+
}));
|
|
2022
|
+
}
|
|
2023
|
+
}
|
|
2024
|
+
catch (error) {
|
|
2025
|
+
console.error("An error occurred: ", error);
|
|
2022
2026
|
}
|
|
2023
2027
|
return of(null);
|
|
2024
2028
|
}
|
|
@@ -2476,8 +2480,8 @@ class AnatolyHttpInterceptor {
|
|
|
2476
2480
|
}
|
|
2477
2481
|
},
|
|
2478
2482
|
error: (err) => {
|
|
2479
|
-
this.onRequestEnd(loadingRequired);
|
|
2480
2483
|
this.logger.error(err);
|
|
2484
|
+
this.onRequestEnd(loadingRequired);
|
|
2481
2485
|
}
|
|
2482
2486
|
}));
|
|
2483
2487
|
}
|
|
@@ -2551,17 +2555,23 @@ class AnatolyHttpInterceptor {
|
|
|
2551
2555
|
req = req.clone({ url: newUrl });
|
|
2552
2556
|
req = req.clone({ headers: req.headers.set('Accept', 'application/json') });
|
|
2553
2557
|
req = req.clone({ headers: req.headers.set('Accept', 'application/text') });
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2558
|
+
try {
|
|
2559
|
+
this.onRequestStart(loadingRequired);
|
|
2560
|
+
if (authorizationTokenRequired) {
|
|
2561
|
+
return this.authService.getAccessToken().pipe(mergeMap((token) => {
|
|
2562
|
+
if (token) {
|
|
2563
|
+
req = req.clone({ headers: req.headers.set('Authorization', 'Bearer ' + token) });
|
|
2564
|
+
}
|
|
2565
|
+
return this.handleHttpRequest(req, next, loadingRequired);
|
|
2566
|
+
}));
|
|
2567
|
+
}
|
|
2568
|
+
else {
|
|
2560
2569
|
return this.handleHttpRequest(req, next, loadingRequired);
|
|
2561
|
-
}
|
|
2570
|
+
}
|
|
2562
2571
|
}
|
|
2563
|
-
|
|
2564
|
-
|
|
2572
|
+
catch (err) {
|
|
2573
|
+
this.logger.error("An error occurred: " + err);
|
|
2574
|
+
this.onRequestEnd(loadingRequired);
|
|
2565
2575
|
}
|
|
2566
2576
|
}
|
|
2567
2577
|
//Events
|