@osovitny/anatoly 3.21.36 → 3.21.38

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.
@@ -73,7 +73,7 @@ import { UploadsModule } from '@progress/kendo-angular-upload';
73
73
  </file>
74
74
  */
75
75
  const SessionStorageKeys = {
76
- appCoreSettings: 'appCoreSettings',
76
+ appSettings: 'appSettings',
77
77
  appMSALSettings: 'appMSALSettings'
78
78
  };
79
79
  const AppContextStorageKeys = {
@@ -106,7 +106,7 @@ const AppContextStorageKeys = {
106
106
  */
107
107
  //App
108
108
  function getAppCoreSettings() {
109
- const json = sessionStorage.getItem(SessionStorageKeys.appCoreSettings);
109
+ const json = sessionStorage.getItem(SessionStorageKeys.appSettings);
110
110
  return json ? JSON.parse(json) : null;
111
111
  }
112
112
  function resetAppCoreSettings() {
@@ -117,6 +117,67 @@ function resetAppCoreSettings() {
117
117
  IsProdMode = !IsDevMode;
118
118
  ClientApps = AppCoreSettings?.clientApps;
119
119
  }
120
+ function getAppSettingsById(id) {
121
+ let apps = ClientApps;
122
+ if (apps && id) {
123
+ for (let i = 0; i < apps.length; i++) {
124
+ let app = apps[i];
125
+ if (app.id == id) {
126
+ return app;
127
+ }
128
+ }
129
+ }
130
+ return null;
131
+ }
132
+ function getAppSettingsByName(name) {
133
+ let apps = ClientApps;
134
+ if (apps && name) {
135
+ for (let i = 0; i < apps.length; i++) {
136
+ let app = apps[i];
137
+ if (app.name == name) {
138
+ return app;
139
+ }
140
+ }
141
+ }
142
+ return null;
143
+ }
144
+ function getCurrentApp() {
145
+ let appSettings = getAppSettingsByName(AppName);
146
+ let appOne = getAppSettingsById(1);
147
+ if (!appSettings || !appOne) {
148
+ return null;
149
+ }
150
+ return {
151
+ id: appSettings.id,
152
+ root: appSettings.root,
153
+ one: appOne,
154
+ oneUrl: appOne?.baseUrl + appOne?.root
155
+ };
156
+ }
157
+ let AppCoreSettings;
158
+ let AppVersion;
159
+ let IsDevMode = true;
160
+ let IsProdMode = !IsDevMode;
161
+ let ClientApps;
162
+ const AppName = g_AppName;
163
+ const LibName = g_LibName;
164
+ const ApiUrl = g_ApiUrl;
165
+ resetAppCoreSettings();
166
+
167
+ /*
168
+ <file>
169
+ Project:
170
+ @osovitny/anatoly
171
+
172
+ Authors:
173
+ Vadim Osovitny vadim.osovitny@osovitny.com
174
+
175
+ Created:
176
+ 2 Jun 2026
177
+
178
+ Copyright (c) 2016-2025 Osovitny Inc. All rights reserved.
179
+ </file>
180
+ */
120
181
  var AssetGroupType;
121
182
  (function (AssetGroupType) {
122
183
  AssetGroupType[AssetGroupType["App"] = 1] = "App";
@@ -129,9 +190,9 @@ var AssetGroupType;
129
190
  Output pattern: {base}/{AppName}/assets/{assetGroup}/{assetType}/{file}
130
191
 
131
192
  assetGroup tokens:
132
- App {AppName} e.g. "am"
133
- Lib {LibName} e.g. "@nexl"
134
- External external/{libname}
193
+ App -> {AppName} e.g. "am"
194
+ Lib -> {LibName} e.g. "@nexl"
195
+ External -> external/{libname}
135
196
 
136
197
  assetType:
137
198
  jsons - JSON data files
@@ -139,14 +200,14 @@ var AssetGroupType;
139
200
  images - image files
140
201
 
141
202
  Examples (AppName = "am", LibName = "@nexl", CDN disabled):
142
- App /am/assets/am/jsons/countries.json?v=1
143
- Lib /am/assets/@nexl/l10n/en.json?v=1
144
- External /am/assets/external/anatoly/jsons/file.json?v=1
203
+ App -> /am/assets/am/jsons/countries.json?v=1
204
+ Lib -> /am/assets/@nexl/l10n/en.json?v=1
205
+ External-> /am/assets/external/anatoly/jsons/file.json?v=1
145
206
 
146
207
  Examples (CDN = "https://cdn.novaexpress.ai"):
147
- App https://cdn.novaexpress.ai/am/assets/am/jsons/countries.json
148
- Lib https://cdn.novaexpress.ai/am/assets/@nexl/l10n/en.json
149
- External https://cdn.novaexpress.ai/am/assets/external/anatoly/jsons/file.json
208
+ App -> https://cdn.novaexpress.ai/am/assets/am/jsons/countries.json
209
+ Lib -> https://cdn.novaexpress.ai/am/assets/@nexl/l10n/en.json
210
+ External-> https://cdn.novaexpress.ai/am/assets/external/anatoly/jsons/file.json
150
211
  */
151
212
  function formatAssetsUrl(assetGroupType, url) {
152
213
  const path = url.replace(/^\/+/, '');
@@ -167,12 +228,12 @@ function formatAssetsUrl(assetGroupType, url) {
167
228
  Output pattern: {base}/{AppName}/{url}
168
229
 
169
230
  Tokens in url are resolved before building the path:
170
- {AppName} AppName (e.g. "am")
171
- {LibName} LibName (e.g. "@nexl")
231
+ {AppName} -> AppName (e.g. "am")
232
+ {LibName} -> LibName (e.g. "@nexl")
172
233
 
173
234
  base:
174
- CDN disabled "" (relative URL, e.g. /am/assets/...)
175
- CDN enabled "https://cdn.novaexpress.ai"
235
+ CDN disabled -> "" (relative URL, e.g. /am/assets/...)
236
+ CDN enabled -> "https://cdn.novaexpress.ai"
176
237
 
177
238
  Absolute URLs (starting with "http") are returned as-is.
178
239
  */
@@ -201,15 +262,6 @@ function formatUrl(url) {
201
262
  }
202
263
  return fullUrl;
203
264
  }
204
- let AppCoreSettings;
205
- let AppVersion;
206
- let IsDevMode = true;
207
- let IsProdMode = !IsDevMode;
208
- let ClientApps;
209
- const AppName = g_AppName;
210
- const LibName = g_LibName;
211
- const ApiUrl = g_ApiUrl;
212
- resetAppCoreSettings();
213
265
 
214
266
  /*
215
267
  <file>
@@ -339,18 +391,17 @@ class LoggingService {
339
391
  ?? appCoreSettings?.logging?.default
340
392
  ?? appCoreSettings?.logging?.Default
341
393
  ?? appCoreSettings?.diagnostics?.logLevel
342
- ?? appCoreSettings?.logLevel
343
- ?? LoggingService.getMsalLogLevel();
344
- return LoggingService.toLogLevel(configuredValue);
345
- }
346
- static getMsalLogLevel() {
347
- try {
348
- const json = sessionStorage.getItem(SessionStorageKeys.appMSALSettings);
349
- return json ? JSON.parse(json)?.app?.system?.loggerOptions?.logLevel : null;
350
- }
351
- catch {
352
- return null;
394
+ ?? appCoreSettings?.logLevel;
395
+ if (configuredValue !== null && typeof configuredValue !== 'undefined') {
396
+ return LoggingService.toLogLevel(configuredValue);
353
397
  }
398
+ return LoggingService.isDevMode(appCoreSettings)
399
+ ? AnatolyLogLevel.Verbose
400
+ : AnatolyLogLevel.Off;
401
+ }
402
+ static isDevMode(appCoreSettings) {
403
+ const value = appCoreSettings?.isDevMode ?? appCoreSettings?.IsDevMode;
404
+ return value === true || `${value}`.toLowerCase() === 'true';
354
405
  }
355
406
  static toLogLevel(value) {
356
407
  if (value === null || typeof value === 'undefined') {
@@ -805,58 +856,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.15", ngImpo
805
856
  type: Injectable
806
857
  }], ctorParameters: () => [{ type: i1.HttpClient }, { type: LocalStorageService }, { type: SessionStorageService }] });
807
858
 
808
- /*
809
- <file>
810
- Project:
811
- @osovitny/anatoly
812
-
813
- Authors:
814
- Vadim Osovitny vadim.osovitny@osovitny.com
815
-
816
- Created:
817
- 1 Apr 2024
818
-
819
- Copyright (c) 2016-2025 Osovitny Inc. All rights reserved.
820
- </file>
821
- */
822
- function getAppSettingsById(id) {
823
- let apps = ClientApps;
824
- if (apps && id) {
825
- for (let i = 0; i < apps.length; i++) {
826
- let app = apps[i];
827
- if (app.id == id) {
828
- return app;
829
- }
830
- }
831
- }
832
- return null;
833
- }
834
- function getAppSettingsByName(name) {
835
- let apps = ClientApps;
836
- if (apps && name) {
837
- for (let i = 0; i < apps.length; i++) {
838
- let app = apps[i];
839
- if (app.name == name) {
840
- return app;
841
- }
842
- }
843
- }
844
- return null;
845
- }
846
- function getCurrentApp() {
847
- let appSettings = getAppSettingsByName(AppName);
848
- let appOne = getAppSettingsById(1);
849
- if (!appSettings || !appOne) {
850
- return null;
851
- }
852
- return {
853
- id: appSettings.id,
854
- root: appSettings.root,
855
- one: appOne,
856
- oneUrl: appOne?.baseUrl + appOne?.root
857
- };
858
- }
859
-
860
859
  /*
861
860
  <file>
862
861
  Project:
@@ -2688,7 +2687,6 @@ class AnatolyHttpInterceptor {
2688
2687
  }
2689
2688
  //4. getCurrentContext
2690
2689
  if (lowerCaseUrl.indexOf('getcurrentcontext') > -1) {
2691
- // Only checks MSAL's current active account. It does not start login or token acquisition by itself; it only decides whether this request should call getAccessToken() at all.
2692
2690
  authorizationTokenRequired = this.authService.isUserAuthenticated();
2693
2691
  }
2694
2692
  // Change Url if need it -------------------------------------------->
@@ -10110,10 +10108,10 @@ class AppService extends ApiServiceBase {
10110
10108
  stopwatch.stop();
10111
10109
  stopwatch.printElapsedAsMilliseconds();
10112
10110
  if (data) {
10113
- let appCoreSettings = JSON.stringify(data.core);
10111
+ let appSettings = JSON.stringify(data.app);
10114
10112
  let appMSALSettings = JSON.stringify(data.msal);
10115
- appCoreSettings = appCoreSettings.replace(/--APPNAME--/g, g_AppName);
10116
- sessionStorage.setItem(SessionStorageKeys.appCoreSettings, appCoreSettings);
10113
+ appSettings = appSettings.replace(/--APPNAME--/g, g_AppName);
10114
+ sessionStorage.setItem(SessionStorageKeys.appSettings, appSettings);
10117
10115
  sessionStorage.setItem(SessionStorageKeys.appMSALSettings, appMSALSettings);
10118
10116
  resetAppCoreSettings();
10119
10117
  resetMsalSettings();