@osovitny/anatoly 3.17.73 → 3.17.75

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.
@@ -6,7 +6,7 @@ import { NavigationEnd, NavigationStart, NavigationCancel, NavigationError, Rout
6
6
  import * as i1$1 from '@angular/common/http';
7
7
  import { HttpResponse, HttpClientModule, HttpClient, HTTP_INTERCEPTORS } from '@angular/common/http';
8
8
  import { map, tap, mergeMap } from 'rxjs/operators';
9
- import { BehaviorSubject, Subject, filter, takeUntil, map as map$1, catchError, of, timer, merge, fromEvent, forkJoin } from 'rxjs';
9
+ import { BehaviorSubject, Subject, filter, takeUntil, map as map$1, catchError, of, merge, forkJoin, timer, fromEvent } from 'rxjs';
10
10
  import * as i4 from '@azure/msal-angular';
11
11
  import { MSAL_GUARD_CONFIG, MsalGuard, MsalInterceptor, MSAL_INTERCEPTOR_CONFIG, MSAL_INSTANCE, MsalService, MsalBroadcastService, MsalModule } from '@azure/msal-angular';
12
12
  import { BrowserUtils, EventType, InteractionStatus, InteractionType, InteractionRequiredAuthError, PromptValue, PublicClientApplication, LogLevel } from '@azure/msal-browser';
@@ -597,27 +597,6 @@ class BaseGoService {
597
597
  type: Injectable
598
598
  }], () => [{ type: i1.ActivatedRoute }, { type: i1.Router }], null); })();
599
599
 
600
- /*
601
- <file>
602
- Project:
603
- @osovitny/anatoly
604
-
605
- Authors:
606
- Vadim Osovitny vadim@osovitny.com
607
- Anatoly Osovitny anatoly@osovitny.com
608
-
609
- Created:
610
- 26 Jun 2020
611
-
612
- Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
613
- </file>
614
- */
615
- function throwIfAlreadyLoaded(parentModule, moduleName) {
616
- if (parentModule) {
617
- throw new Error(`${moduleName} has already been loaded. Import ${moduleName} modules in the AppModule only.`);
618
- }
619
- }
620
-
621
600
  /*
622
601
  <file>
623
602
  Project:
@@ -1148,6 +1127,12 @@ class AppContextService extends ApiServiceBase {
1148
1127
  this.current = context;
1149
1128
  }
1150
1129
  }
1130
+ loadRequiredJsonFiles() {
1131
+ return null;
1132
+ }
1133
+ loadRequiredItems() {
1134
+ return null;
1135
+ }
1151
1136
  updateCurrent(success = null) {
1152
1137
  this.getCurrentPrivate(success, false);
1153
1138
  }
@@ -1715,7 +1700,7 @@ class AuthenticationGuard extends MsalGuard {
1715
1700
 
1716
1701
  Created:
1717
1702
  26 Jun 2020
1718
-
1703
+
1719
1704
  Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
1720
1705
  </file>
1721
1706
  */
@@ -1759,12 +1744,12 @@ class LoadingService extends BehaviorSubject {
1759
1744
  this.counter = 0;
1760
1745
  }
1761
1746
  static { this.ɵfac = function LoadingService_Factory(t) { return new (t || LoadingService)(); }; }
1762
- static { this.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: LoadingService, factory: LoadingService.ɵfac, providedIn: "root" }); }
1747
+ static { this.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: LoadingService, factory: LoadingService.ɵfac, providedIn: 'root' }); }
1763
1748
  }
1764
1749
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(LoadingService, [{
1765
1750
  type: Injectable,
1766
1751
  args: [{
1767
- providedIn: "root",
1752
+ providedIn: 'root'
1768
1753
  }]
1769
1754
  }], () => [], null); })();
1770
1755
 
@@ -1960,23 +1945,13 @@ class AnatolyHttpInterceptor {
1960
1945
 
1961
1946
  Created:
1962
1947
  26 Jun 2020
1963
-
1948
+
1964
1949
  Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
1965
1950
  </file>
1966
1951
  */
1967
- class Subs {
1968
- constructor() {
1969
- this.subs = [];
1970
- }
1971
- add(...subscriptions) {
1972
- this.subs = this.subs.concat(subscriptions);
1973
- }
1974
- set sink(subscription) {
1975
- this.subs.push(subscription);
1976
- }
1977
- unsubscribe() {
1978
- this.subs.forEach((sub) => sub && sub.unsubscribe());
1979
- this.subs = [];
1952
+ function throwIfAlreadyLoaded(parentModule, moduleName) {
1953
+ if (parentModule) {
1954
+ throw new Error(`${moduleName} has already been loaded. Import ${moduleName} modules in the AppModule only.`);
1980
1955
  }
1981
1956
  }
1982
1957
 
@@ -2079,6 +2054,151 @@ is = {
2079
2054
  };
2080
2055
  */
2081
2056
 
2057
+ class StarterService extends ApiServiceBase {
2058
+ constructor(http, appContext, logger) {
2059
+ super(http);
2060
+ this.http = http;
2061
+ this.appContext = appContext;
2062
+ this.logger = logger;
2063
+ }
2064
+ applicationStarting() {
2065
+ let context = this.appContext.current;
2066
+ if (!is.objectNullOrEmpty(context)) {
2067
+ //Logging
2068
+ this.logger.info('StarterService.applicationStarting: got AppContext from Session Storage');
2069
+ this.appContext.init(context);
2070
+ return of(context);
2071
+ }
2072
+ //Logging
2073
+ this.logger.info('StarterService.applicationStarting: there is no AppContext in Session Storage');
2074
+ //Logging
2075
+ let stopwatch = new Stopwatch("StarterService.applicationStarting: getting AppContext");
2076
+ stopwatch.start();
2077
+ this.baseUrl = `${ApiUrl}/appContext`;
2078
+ return this.get('applicationStarting').pipe(map(data => {
2079
+ //Logging
2080
+ stopwatch.stop();
2081
+ stopwatch.printElapsedAsMilliseconds();
2082
+ this.appContext.init(data.context);
2083
+ }));
2084
+ }
2085
+ ensureApplicationStarted() {
2086
+ //1. Application Starting
2087
+ let applicationStarting$ = this.applicationStarting();
2088
+ //2. Load json files
2089
+ let jsonFiles$ = this.appContext.loadRequiredJsonFiles();
2090
+ //3. Load required items, like settings
2091
+ let requiredItems$ = this.appContext.loadRequiredItems();
2092
+ //Tasks to execute
2093
+ let parallelTasks = [];
2094
+ let tasks$ = null;
2095
+ if (jsonFiles$)
2096
+ parallelTasks.push(jsonFiles$);
2097
+ if (requiredItems$)
2098
+ parallelTasks.push(requiredItems$);
2099
+ /*
2100
+ VadimOS:
2101
+ concat is NOT wokring here, no idea why. Just executing first task
2102
+ let tasks$ = concat(applicationStarting$, parallelTasks$);
2103
+
2104
+ https://github.com/ReactiveX/rxjs/issues/2427
2105
+ https://github.com/ReactiveX/rxjs/issues/2188
2106
+ */
2107
+ if (parallelTasks.length > 0) {
2108
+ let parallelTasks$ = merge(...parallelTasks);
2109
+ tasks$ = forkJoin([applicationStarting$, parallelTasks$]);
2110
+ }
2111
+ else {
2112
+ tasks$ = applicationStarting$;
2113
+ }
2114
+ //Logging
2115
+ let stopwatch = new Stopwatch("StarterService.ensureApplicationStarted");
2116
+ stopwatch.start();
2117
+ return tasks$.pipe(map(() => {
2118
+ //Logging
2119
+ stopwatch.stop();
2120
+ stopwatch.printElapsedAsMilliseconds();
2121
+ }));
2122
+ }
2123
+ static { this.ɵfac = function StarterService_Factory(t) { return new (t || StarterService)(i0.ɵɵinject(i1$1.HttpClient), i0.ɵɵinject(AppContextService), i0.ɵɵinject(LoggingService)); }; }
2124
+ static { this.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: StarterService, factory: StarterService.ɵfac }); }
2125
+ }
2126
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(StarterService, [{
2127
+ type: Injectable
2128
+ }], () => [{ type: i1$1.HttpClient }, { type: AppContextService }, { type: LoggingService }], null); })();
2129
+
2130
+ /*
2131
+ <file>
2132
+ Project:
2133
+ @osovitny/anatoly
2134
+
2135
+ Authors:
2136
+ Vadim Osovitny vadim@osovitny.com
2137
+ Anatoly Osovitny anatoly@osovitny.com
2138
+
2139
+ Created:
2140
+ 15 Nov 2023
2141
+
2142
+ Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
2143
+ </file>
2144
+ */
2145
+ //Node
2146
+ class StarterGuard {
2147
+ constructor(starter) {
2148
+ this.starter = starter;
2149
+ }
2150
+ ensureApplicationStarted() {
2151
+ return this.starter.ensureApplicationStarted().pipe(mergeMap(() => {
2152
+ return of(true);
2153
+ }));
2154
+ }
2155
+ canActivate(next, state) {
2156
+ return this.ensureApplicationStarted();
2157
+ }
2158
+ canActivateChild(route, state) {
2159
+ if (route.component) {
2160
+ return this.ensureApplicationStarted();
2161
+ }
2162
+ return of(true);
2163
+ }
2164
+ static { this.ɵfac = function StarterGuard_Factory(t) { return new (t || StarterGuard)(i0.ɵɵinject(StarterService)); }; }
2165
+ static { this.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: StarterGuard, factory: StarterGuard.ɵfac }); }
2166
+ }
2167
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(StarterGuard, [{
2168
+ type: Injectable
2169
+ }], () => [{ type: StarterService }], null); })();
2170
+
2171
+ /*
2172
+ <file>
2173
+ Project:
2174
+ @osovitny/anatoly
2175
+
2176
+ Authors:
2177
+ Vadim Osovitny vadim@osovitny.com
2178
+ Anatoly Osovitny anatoly@osovitny.com
2179
+
2180
+ Created:
2181
+ 26 Jun 2020
2182
+
2183
+ Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
2184
+ </file>
2185
+ */
2186
+ class Subs {
2187
+ constructor() {
2188
+ this.subs = [];
2189
+ }
2190
+ add(...subscriptions) {
2191
+ this.subs = this.subs.concat(subscriptions);
2192
+ }
2193
+ set sink(subscription) {
2194
+ this.subs.push(subscription);
2195
+ }
2196
+ unsubscribe() {
2197
+ this.subs.forEach((sub) => sub && sub.unsubscribe());
2198
+ this.subs = [];
2199
+ }
2200
+ }
2201
+
2082
2202
  /*
2083
2203
  <file>
2084
2204
  Project:
@@ -2929,89 +3049,6 @@ class IdleService {
2929
3049
  }]
2930
3050
  }], null, null); })();
2931
3051
 
2932
- /*
2933
- <file>
2934
- Project:
2935
- @osovitny/anatoly
2936
-
2937
- Authors:
2938
- Vadim Osovitny vadim@osovitny.com
2939
- Anatoly Osovitny anatoly@osovitny.com
2940
-
2941
- Created:
2942
- 15 Nov 2023
2943
-
2944
- Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
2945
- </file>
2946
- */
2947
- class StarterServiceBase extends ApiServiceBase {
2948
- constructor(http, appContext, logger) {
2949
- super(http);
2950
- this.http = http;
2951
- this.appContext = appContext;
2952
- this.logger = logger;
2953
- }
2954
- applicationStarting() {
2955
- let context = this.appContext.current;
2956
- if (!is.objectNullOrEmpty(context)) {
2957
- //Logging
2958
- this.logger.info('StarterService.applicationStarting: got AppContext from Session Storage');
2959
- this.appContext.init(context);
2960
- return of(context);
2961
- }
2962
- //Logging
2963
- this.logger.info('StarterService.applicationStarting: there is no AppContext in Session Storage');
2964
- //Logging
2965
- let stopwatch = new Stopwatch("StarterService.applicationStarting: getting AppContext");
2966
- stopwatch.start();
2967
- this.baseUrl = `${ApiUrl}/appContext`;
2968
- return this.get('applicationStarting').pipe(map(data => {
2969
- //Logging
2970
- stopwatch.stop();
2971
- stopwatch.printElapsedAsMilliseconds();
2972
- this.appContext.init(data.context);
2973
- }));
2974
- }
2975
- ensureApplicationStarted() {
2976
- //1. Application Starting
2977
- let applicationStarting$ = this.applicationStarting();
2978
- //2. Load json files
2979
- let jsonFiles$ = this.appContext.loadRequiredJsonFiles();
2980
- //3. Load required items, like settings
2981
- let requiredItems$ = this.appContext.loadRequiredItems();
2982
- //Tasks to execute
2983
- let parallelTasks = [];
2984
- let tasks$ = null;
2985
- if (jsonFiles$)
2986
- parallelTasks.push(jsonFiles$);
2987
- if (requiredItems$)
2988
- parallelTasks.push(requiredItems$);
2989
- /*
2990
- VadimOS:
2991
- concat is NOT wokring here, no idea why. Just executing first task
2992
- let tasks$ = concat(applicationStarting$, parallelTasks$);
2993
-
2994
- https://github.com/ReactiveX/rxjs/issues/2427
2995
- https://github.com/ReactiveX/rxjs/issues/2188
2996
- */
2997
- if (parallelTasks.length > 0) {
2998
- let parallelTasks$ = merge(...parallelTasks);
2999
- tasks$ = forkJoin([applicationStarting$, parallelTasks$]);
3000
- }
3001
- else {
3002
- tasks$ = applicationStarting$;
3003
- }
3004
- //Logging
3005
- let stopwatch = new Stopwatch("StarterService.ensureApplicationStarted");
3006
- stopwatch.start();
3007
- return tasks$.pipe(map(() => {
3008
- //Logging
3009
- stopwatch.stop();
3010
- stopwatch.printElapsedAsMilliseconds();
3011
- }));
3012
- }
3013
- }
3014
-
3015
3052
  /*
3016
3053
  <file>
3017
3054
  Project:
@@ -7539,9 +7576,13 @@ class AnatolyCoreModule {
7539
7576
  static { this.ɵfac = function AnatolyCoreModule_Factory(t) { return new (t || AnatolyCoreModule)(i0.ɵɵinject(i0.Injector), i0.ɵɵinject(AnatolyCoreModule, 12)); }; }
7540
7577
  static { this.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: AnatolyCoreModule }); }
7541
7578
  static { this.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ providers: [
7579
+ //Guards
7580
+ StarterGuard,
7581
+ //Services
7542
7582
  DigitalMarketingService,
7543
7583
  GoogleAnalyticsService,
7544
7584
  LoadingService,
7585
+ StarterService,
7545
7586
  LocalStorageService,
7546
7587
  SessionStorageService,
7547
7588
  LoggingService,
@@ -7570,9 +7611,13 @@ class AnatolyCoreModule {
7570
7611
  LocalizationModule
7571
7612
  ],
7572
7613
  providers: [
7614
+ //Guards
7615
+ StarterGuard,
7616
+ //Services
7573
7617
  DigitalMarketingService,
7574
7618
  GoogleAnalyticsService,
7575
7619
  LoadingService,
7620
+ StarterService,
7576
7621
  LocalStorageService,
7577
7622
  SessionStorageService,
7578
7623
  LoggingService,
@@ -8404,5 +8449,5 @@ class AnatolyModule {
8404
8449
  * Generated bundle index. Do not edit.
8405
8450
  */
8406
8451
 
8407
- export { AddressComponent, AdminGuard, Alerts, AnatolyCoreModule, AnatolyDataModule, AnatolyHttpInterceptor, AnatolyIAMModule, AnatolyIAMPagesModule, AnatolyModule, AnatolyPaymentsModule, AnatolyUIModule, ApiServiceBase, ApiUrl, AppContextService, AppCoreSettings, AppName, AppSettings, AppVersion, AuthService, AuthenticationGuard, BaseGoService, Browser, BuyAccessButtonComponent, CardBodyComponent, CardComponent, CardFooterComponent, CardHeaderComponent, CheckIconComponent, ClientApps, CompanyComponent, ComponentBase, ContactUsDialog, ContactUsForm, Convert, Copy2ClipboardComponent, CoreApiService, CountryDropdownlist, DOM, DataPagerComponent, DateConvert, DefaultEditorOptions, DialogBase, DigitalMarketingService, EditComponentBase, EditPageBase, EmailsApiService, EnumEditComponentBase, FileSizePipe, FormValidationSummaryComponent, FormsHtmlEditorComponent, GlobalErrorHandler, GoogleAnalyticsService, GridEditServiceBase, GridReadServiceBase, Guid, HoveringDirective, HtmlEditorComponent, HtmlEditorComponentBase, IdleService, InjectorInstance, IsDevMode, IsProdMode, ItemValidationSummaryComponent, L10NUrl, L10nUtils, ListBase, LoadingComponent, LoadingService, LocalStorageService, LocalizationInjectorInstance, LocalizationModule, LocalizationService, LocalizationSettingsModule, LocalizePipe, LoggingService, MSALUtils, NativeElementDirective, NodataComponent, NotificationService, PageBase, PageSpinnerComponent, PagedPageBase, PayPalComponent, PayPalScriptService, QSUtils, ReplaceTextPipe, SafeHtmlPipe, ScriptService, SessionStorageService, SignInButtonComponent, SignOutButtonComponent, SignUpButtonComponent, StarterServiceBase, Stopwatch, Subs, SubscribePlanButtonComponent, TimezoneDropdownlist, UrlSlugComponent, Utils, ValidationSummaryComponent, XmlFormatter, dateFormats, dateTimeFormats, getAppSettingsById, getAppSettingsByName, is, localizationInitializerFactory, throwIfAlreadyLoaded, timeFormats, translateLoaderFactory };
8452
+ export { AddressComponent, AdminGuard, Alerts, AnatolyCoreModule, AnatolyDataModule, AnatolyHttpInterceptor, AnatolyIAMModule, AnatolyIAMPagesModule, AnatolyModule, AnatolyPaymentsModule, AnatolyUIModule, ApiServiceBase, ApiUrl, AppContextService, AppCoreSettings, AppName, AppSettings, AppVersion, AuthService, AuthenticationGuard, BaseGoService, Browser, BuyAccessButtonComponent, CardBodyComponent, CardComponent, CardFooterComponent, CardHeaderComponent, CheckIconComponent, ClientApps, CompanyComponent, ComponentBase, ContactUsDialog, ContactUsForm, Convert, Copy2ClipboardComponent, CoreApiService, CountryDropdownlist, DOM, DataPagerComponent, DateConvert, DefaultEditorOptions, DialogBase, DigitalMarketingService, EditComponentBase, EditPageBase, EmailsApiService, EnumEditComponentBase, FileSizePipe, FormValidationSummaryComponent, FormsHtmlEditorComponent, GlobalErrorHandler, GoogleAnalyticsService, GridEditServiceBase, GridReadServiceBase, Guid, HoveringDirective, HtmlEditorComponent, HtmlEditorComponentBase, IdleService, InjectorInstance, IsDevMode, IsProdMode, ItemValidationSummaryComponent, L10NUrl, L10nUtils, ListBase, LoadingComponent, LoadingService, LocalStorageService, LocalizationInjectorInstance, LocalizationModule, LocalizationService, LocalizationSettingsModule, LocalizePipe, LoggingService, MSALUtils, NativeElementDirective, NodataComponent, NotificationService, PageBase, PageSpinnerComponent, PagedPageBase, PayPalComponent, PayPalScriptService, QSUtils, ReplaceTextPipe, SafeHtmlPipe, ScriptService, SessionStorageService, SignInButtonComponent, SignOutButtonComponent, SignUpButtonComponent, StarterGuard, StarterService, Stopwatch, Subs, SubscribePlanButtonComponent, TimezoneDropdownlist, UrlSlugComponent, Utils, ValidationSummaryComponent, XmlFormatter, dateFormats, dateTimeFormats, getAppSettingsById, getAppSettingsByName, is, localizationInitializerFactory, throwIfAlreadyLoaded, timeFormats, translateLoaderFactory };
8408
8453
  //# sourceMappingURL=osovitny-anatoly.mjs.map