@softheon/armature 21.14.0 → 21.15.0
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.
|
@@ -13,7 +13,7 @@ import * as i2$1 from '@ngx-translate/core';
|
|
|
13
13
|
import { TranslateModule, TranslateService } from '@ngx-translate/core';
|
|
14
14
|
import * as i2 from '@ngbracket/ngx-layout/flex';
|
|
15
15
|
import * as i3 from '@ngbracket/ngx-layout/extended';
|
|
16
|
-
import { BehaviorSubject, of, Subscription, filter as filter$1, lastValueFrom, throwError, tap, ReplaySubject } from 'rxjs';
|
|
16
|
+
import { BehaviorSubject, of, Subscription, filter as filter$1, lastValueFrom, throwError, tap, ReplaySubject, Subject } from 'rxjs';
|
|
17
17
|
import * as i1$2 from 'angular-oauth2-oidc';
|
|
18
18
|
import { AuthConfig } from 'angular-oauth2-oidc';
|
|
19
19
|
import { STEPPER_GLOBAL_OPTIONS } from '@angular/cdk/stepper';
|
|
@@ -11722,11 +11722,210 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImpor
|
|
|
11722
11722
|
type: Input
|
|
11723
11723
|
}] } });
|
|
11724
11724
|
|
|
11725
|
+
class MfeEventBusData {
|
|
11726
|
+
get globalId() {
|
|
11727
|
+
return this.uuid;
|
|
11728
|
+
}
|
|
11729
|
+
constructor() {
|
|
11730
|
+
this.uuid = newGuid();
|
|
11731
|
+
this.eventScope = undefined;
|
|
11732
|
+
this.eventData = undefined;
|
|
11733
|
+
}
|
|
11734
|
+
}
|
|
11735
|
+
|
|
11736
|
+
/**
|
|
11737
|
+
* Event bus service for communication between MFEs (Micro Frontends).
|
|
11738
|
+
*
|
|
11739
|
+
* This service manages event queues for each registered MFE and provides:
|
|
11740
|
+
* - Publishing events to MFE-specific queues
|
|
11741
|
+
* - Retrieving unretrieved events for a given consumer
|
|
11742
|
+
* - Automatic management of event consumption per consumer
|
|
11743
|
+
*
|
|
11744
|
+
* Events are tracked by a unique globalId to ensure each event is only
|
|
11745
|
+
* retrieved once per consumer unless explicitly republished.
|
|
11746
|
+
*
|
|
11747
|
+
* @example
|
|
11748
|
+
* // Publish an event
|
|
11749
|
+
* eventBus.publishEvent('entity-mfe', { globalId: '123', eventScope: 'test', data: {} });
|
|
11750
|
+
*
|
|
11751
|
+
* // Subscribe to events
|
|
11752
|
+
* eventBus.getLatestEvents('entity-mfe', 'my-consumer').subscribe(events => {
|
|
11753
|
+
* console.log('Received events:', events);
|
|
11754
|
+
* });
|
|
11755
|
+
*/
|
|
11756
|
+
class MfeDataEventBus {
|
|
11757
|
+
constructor() {
|
|
11758
|
+
/** HTTP client for fetching the manifest configuration */
|
|
11759
|
+
this.http = inject(HttpClient);
|
|
11760
|
+
/** Map of MFE names to their event queues */
|
|
11761
|
+
this.eventQueues = new Map();
|
|
11762
|
+
/** Map of consumer keys (mfeName-consumer) to sets of retrieved event IDs */
|
|
11763
|
+
this.retrievedEventIds = new Map();
|
|
11764
|
+
/** Subscription container for cleanup on destroy */
|
|
11765
|
+
this.subscription = new Subscription();
|
|
11766
|
+
this.loadMfManifest();
|
|
11767
|
+
}
|
|
11768
|
+
/** Cleanup subscriptions when the service is destroyed */
|
|
11769
|
+
ngOnDestroy() {
|
|
11770
|
+
this.subscription.unsubscribe();
|
|
11771
|
+
}
|
|
11772
|
+
/**
|
|
11773
|
+
* Publishes an event to a specific MFE's event queue.
|
|
11774
|
+
*
|
|
11775
|
+
* If there is a pending request for this MFE, the event will be immediately
|
|
11776
|
+
* delivered to the waiting consumer. Otherwise, the event is stored in the queue.
|
|
11777
|
+
*
|
|
11778
|
+
* @param mfeName - The name of the target MFE
|
|
11779
|
+
* @param data - The event data to publish
|
|
11780
|
+
*
|
|
11781
|
+
* @example
|
|
11782
|
+
* eventBus.publishEvent('entity-mfe', {
|
|
11783
|
+
* globalId: 'evt-001',
|
|
11784
|
+
* eventScope: 'entity-update',
|
|
11785
|
+
* payload: { entityId: 123 }
|
|
11786
|
+
* });
|
|
11787
|
+
*/
|
|
11788
|
+
publishEvent(mfeName, data) {
|
|
11789
|
+
let queue = this.eventQueues.get(mfeName);
|
|
11790
|
+
if (queue == null) {
|
|
11791
|
+
queue = { events: [], pendingRequest: null };
|
|
11792
|
+
this.eventQueues.set(mfeName, queue);
|
|
11793
|
+
}
|
|
11794
|
+
// Add the event to the queue
|
|
11795
|
+
queue.events.push(data);
|
|
11796
|
+
// If there's a pending request, immediately deliver the event
|
|
11797
|
+
if (queue.pendingRequest) {
|
|
11798
|
+
const events = this.getAllUnretrievedEvents(mfeName, queue.pendingRequest.consumer, queue.pendingRequest.retrievedIds);
|
|
11799
|
+
queue.pendingRequest.subject.next(events);
|
|
11800
|
+
queue.pendingRequest.subject.complete();
|
|
11801
|
+
queue.pendingRequest = null;
|
|
11802
|
+
}
|
|
11803
|
+
}
|
|
11804
|
+
/**
|
|
11805
|
+
* Retrieves all unretrieved events from the queue that have not been seen
|
|
11806
|
+
* by the pending request yet.
|
|
11807
|
+
*
|
|
11808
|
+
* @param mfeName - The name of the MFE
|
|
11809
|
+
* @param consumer - The consumer identifier
|
|
11810
|
+
* @param retrievedIds - Set of already retrieved event IDs for this request
|
|
11811
|
+
* @returns Array of unretrieved events
|
|
11812
|
+
*/
|
|
11813
|
+
getAllUnretrievedEvents(mfeName, consumer, retrievedIds) {
|
|
11814
|
+
const queue = this.eventQueues.get(mfeName);
|
|
11815
|
+
if (!queue) {
|
|
11816
|
+
return [];
|
|
11817
|
+
}
|
|
11818
|
+
const events = [];
|
|
11819
|
+
for (const event of queue.events) {
|
|
11820
|
+
// Only include events not yet retrieved by this consumer
|
|
11821
|
+
if (!retrievedIds.has(event.globalId)) {
|
|
11822
|
+
retrievedIds.add(event.globalId);
|
|
11823
|
+
if (event.eventScope === consumer) {
|
|
11824
|
+
events.push(event);
|
|
11825
|
+
}
|
|
11826
|
+
}
|
|
11827
|
+
}
|
|
11828
|
+
return events;
|
|
11829
|
+
}
|
|
11830
|
+
/**
|
|
11831
|
+
* Gets events for a specific MFE that have not been retrieved yet.
|
|
11832
|
+
*
|
|
11833
|
+
* If there are existing unretrieved events, they are returned immediately.
|
|
11834
|
+
* If the queue is empty, a pending request is set up to wait for new events.
|
|
11835
|
+
*
|
|
11836
|
+
* When using pending requests, events are batched and emitted all at once
|
|
11837
|
+
* when publishEvent is called, ensuring the subscriber receives the final
|
|
11838
|
+
* complete list of events.
|
|
11839
|
+
*
|
|
11840
|
+
* @param mfeName - The name of the MFE to get events from
|
|
11841
|
+
* @param consumer - A unique identifier for the consumer (e.g., component name)
|
|
11842
|
+
* @returns A Subject that will emit an array of unretrieved events and then complete
|
|
11843
|
+
*
|
|
11844
|
+
* @example
|
|
11845
|
+
* // In a component
|
|
11846
|
+
* eventBus.getLatestEvents('entity-mfe', 'my-component').subscribe(events => {
|
|
11847
|
+
* // events contains all events not previously retrieved
|
|
11848
|
+
* events.forEach(event => this.processEvent(event));
|
|
11849
|
+
* });
|
|
11850
|
+
*
|
|
11851
|
+
* // When entity updates occur
|
|
11852
|
+
* eventBus.publishEvent('entity-mfe', { globalId: '1', eventScope: 'update', data: {} });
|
|
11853
|
+
* eventBus.publishEvent('entity-mfe', { globalId: '2', eventScope: 'update', data: {} });
|
|
11854
|
+
*
|
|
11855
|
+
* // The subscriber will receive both events in a single array
|
|
11856
|
+
*/
|
|
11857
|
+
getLatestEvents(mfeName, consumer) {
|
|
11858
|
+
// Create or get the key for tracking retrieved events per consumer
|
|
11859
|
+
const key = `${mfeName}-${consumer}`;
|
|
11860
|
+
if (!this.retrievedEventIds.has(key)) {
|
|
11861
|
+
this.retrievedEventIds.set(key, new Set());
|
|
11862
|
+
}
|
|
11863
|
+
const retrievedIds = this.retrievedEventIds.get(key);
|
|
11864
|
+
const subject = new Subject();
|
|
11865
|
+
// Ensure the queue exists for this MFE
|
|
11866
|
+
let queue = this.eventQueues.get(mfeName);
|
|
11867
|
+
if (queue == null) {
|
|
11868
|
+
queue = { events: [], pendingRequest: null };
|
|
11869
|
+
this.eventQueues.set(mfeName, queue);
|
|
11870
|
+
}
|
|
11871
|
+
// Check for existing unretrieved events
|
|
11872
|
+
const existingEvents = this.getAllUnretrievedEvents(mfeName, consumer, retrievedIds);
|
|
11873
|
+
if (existingEvents.length > 0) {
|
|
11874
|
+
// Emit immediately if there are existing events
|
|
11875
|
+
setTimeout(() => {
|
|
11876
|
+
subject.next(existingEvents);
|
|
11877
|
+
subject.complete();
|
|
11878
|
+
});
|
|
11879
|
+
}
|
|
11880
|
+
else {
|
|
11881
|
+
// No events yet - set up a pending request to wait for new events
|
|
11882
|
+
queue.pendingRequest = { consumer, subject, retrievedIds: new Set() };
|
|
11883
|
+
}
|
|
11884
|
+
return subject;
|
|
11885
|
+
}
|
|
11886
|
+
/**
|
|
11887
|
+
* Loads the MFE manifest configuration from the server.
|
|
11888
|
+
*
|
|
11889
|
+
* The manifest is expected to be a Map where keys are MFE names.
|
|
11890
|
+
* Each MFE in the manifest gets its own event queue initialized.
|
|
11891
|
+
*/
|
|
11892
|
+
loadMfManifest() {
|
|
11893
|
+
this.subscription.add(this.http.get('./assets/configurations/mf.manifest.json').subscribe({
|
|
11894
|
+
next: manifest => {
|
|
11895
|
+
this.parseManifest(manifest);
|
|
11896
|
+
},
|
|
11897
|
+
error: error => {
|
|
11898
|
+
console.error('Failed to load mf.manifest.json:', error);
|
|
11899
|
+
},
|
|
11900
|
+
}));
|
|
11901
|
+
}
|
|
11902
|
+
/**
|
|
11903
|
+
* Parses the manifest and initializes event queues for each MFE.
|
|
11904
|
+
*
|
|
11905
|
+
* @param manifest - A map of MFE names from the manifest configuration
|
|
11906
|
+
*/
|
|
11907
|
+
parseManifest(manifest) {
|
|
11908
|
+
Object.keys(manifest).forEach(key => {
|
|
11909
|
+
if (!this.eventQueues.has(key)) {
|
|
11910
|
+
this.eventQueues.set(key, { events: [], pendingRequest: null });
|
|
11911
|
+
}
|
|
11912
|
+
});
|
|
11913
|
+
}
|
|
11914
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MfeDataEventBus, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
11915
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MfeDataEventBus, providedIn: 'root' }); }
|
|
11916
|
+
}
|
|
11917
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MfeDataEventBus, decorators: [{
|
|
11918
|
+
type: Injectable,
|
|
11919
|
+
args: [{
|
|
11920
|
+
providedIn: 'root',
|
|
11921
|
+
}]
|
|
11922
|
+
}], ctorParameters: () => [] });
|
|
11923
|
+
|
|
11725
11924
|
/** Public API Surface of armature */
|
|
11726
11925
|
|
|
11727
11926
|
/**
|
|
11728
11927
|
* Generated bundle index. Do not edit.
|
|
11729
11928
|
*/
|
|
11730
11929
|
|
|
11731
|
-
export { ALERT_BANNER_CONFIG, AbstractSamlEntryService, AbstractSamlService, AbstractStartupService, AccessTokenClaims, AlertBannerComponent, AlertBannerModule, AlertBannerService, AlertService, AlphaNumericDirective, AppTemplateComponent, ApplicationUserModel, ArRoleNavService, ArmError, ArmatureFooterComponent, ArmatureFooterModule, ArmatureHeaderComponent, ArmatureHeaderModule, ArmatureModule, ArmatureNavigationComponent, ArmatureResizePanelsModule, Attribute, AuthorizationService, B2bNavComponent, BannerService, BannerType, BaseComponentModule, BaseConfigService, CacheExpirationType, ComponentSavePrintComponent, ComponentSavePrintService, Configuration, ConfirmAddressData, CoverageDetail, CssOverride, CssOverrideDirective, CustomAuthConfigService, DISABLE_ACCESS_FOR_NO_PAGES_ROLE, DISTRIBUTED_CACHE_BASE_PATH, DataStoreConfig, DateInputFilterDirective, DecodedAccessToken, DefaultConfigService, DialogResult, DistributedCacheModule, ENTITY_SESSION_STORAGE_PREFIX, ENTITY_SS_CONFIG_PREFIX, EntityBaseComponent, EntityHelperService, EntityInjectWrapperComponent, FAQ, FAQConfig, FEDERATED_MODULE_ID, FaqComponent, FaqModule, FeedbackToolComponent, FeedbackToolModule, FooterConfig, FormsModule, HYBRID_SAML_OAUTH_CONFIG, HeaderAuthSettings, HybridSamlOAuthConfig, HybridSamlOauthService, InputTrimDirective, LINE_OF_COVERAGE, LettersCharactersDirective, LettersOnlyDirective, MarketSelectionConfig, MarketSelectionService, MfeModule, MobileHeaderMenuComponent, ModalData, NavigationModule, NumbersOnlyDirective, Oauth2RoleService, OauthModule, PhoneFormatPipe, PolicyPerson, RBAC_CONFIG, RbacActionDirective, RbacConfig, RbacModule, RedirectSamlComponent, RedirectSamlRequest, RedirectSessionConfigs, ResizePanelsComponent, RoleAccess, RoleNavService, RoutePath, RumConfig, RumModule, RumService, SESSION_CONFIG, SOF_BLANK_LANGUAGE_OVERRIDE, SOF_DATE_PIPE_FORMATS, STATUS, SamlModule, SamlService, SelectedMarketContext, ServerCacheService, SessionConfig, SessionService, SharedErrorService, SiteMapComponent, SiteMapDirection, SnackbarService, SofAddressComponent, SofAlertComponent, SofArComponentSavePrintModule, SofBadgeComponent, SofBannerComponent, SofBlankPipe, SofBottomSheetComponent, SofBreadcrumbsHierarchyComponent, SofBreadcrumbsHistoryComponent, SofButtonToggleGroupComponent, SofCalloutComponent, SofChartSkeletonLoaderComponent, SofChipComponent, SofCompareAddressPipe, SofConfirmAddressComponent, SofConfirmAddressCountyChangeComponent, SofContextComponent, SofDatePipe, SofDropdownButtonComponent, SofErrorCommonComponent, SofHandleComponent, SofHeaderComponent, SofImageCheckboxComponent, SofInputStepperComponent, SofModalComponent, SofNavPanelComponent, SofPipeModule, SofProgressBarComponent, SofRadioCardComponent, SofSegmentedControlComponent, SofSelectComponent, SofSimpleAlertComponent, SofSkeletonLoaderComponent, SofSnackbarComponent, SofSsnPipe, SofStarRatingComponent, SofSubNavigationComponent, SofSvgLoaderComponent, SofTabsComponent, SofToastComponent, SofUtilityButtonComponent, SoftheonErrorHandlerService, SsoGatewayEntryService, SsoGatewayModel, States, TextOverflowEllipsisTooltipDirective, ThemeModule, ThemeService, ToastService, TypedSession, USER_ENTITY_SERVICE_CONFIG, UserEntityService, UserEntityServiceConfig, ValidationKeys, WINDOW, httpVerb, initializerFactory, keyPathPrefix, languageStorageKey, newGuid, pascalToCamel, preSignInRouteStorageKey, removeMenuRole, routeToPreLoginRoute, sessionBasePathFactory, userInitialsPipe };
|
|
11930
|
+
export { ALERT_BANNER_CONFIG, AbstractSamlEntryService, AbstractSamlService, AbstractStartupService, AccessTokenClaims, AlertBannerComponent, AlertBannerModule, AlertBannerService, AlertService, AlphaNumericDirective, AppTemplateComponent, ApplicationUserModel, ArRoleNavService, ArmError, ArmatureFooterComponent, ArmatureFooterModule, ArmatureHeaderComponent, ArmatureHeaderModule, ArmatureModule, ArmatureNavigationComponent, ArmatureResizePanelsModule, Attribute, AuthorizationService, B2bNavComponent, BannerService, BannerType, BaseComponentModule, BaseConfigService, CacheExpirationType, ComponentSavePrintComponent, ComponentSavePrintService, Configuration, ConfirmAddressData, CoverageDetail, CssOverride, CssOverrideDirective, CustomAuthConfigService, DISABLE_ACCESS_FOR_NO_PAGES_ROLE, DISTRIBUTED_CACHE_BASE_PATH, DataStoreConfig, DateInputFilterDirective, DecodedAccessToken, DefaultConfigService, DialogResult, DistributedCacheModule, ENTITY_SESSION_STORAGE_PREFIX, ENTITY_SS_CONFIG_PREFIX, EntityBaseComponent, EntityHelperService, EntityInjectWrapperComponent, FAQ, FAQConfig, FEDERATED_MODULE_ID, FaqComponent, FaqModule, FeedbackToolComponent, FeedbackToolModule, FooterConfig, FormsModule, HYBRID_SAML_OAUTH_CONFIG, HeaderAuthSettings, HybridSamlOAuthConfig, HybridSamlOauthService, InputTrimDirective, LINE_OF_COVERAGE, LettersCharactersDirective, LettersOnlyDirective, MarketSelectionConfig, MarketSelectionService, MfeDataEventBus, MfeEventBusData, MfeModule, MobileHeaderMenuComponent, ModalData, NavigationModule, NumbersOnlyDirective, Oauth2RoleService, OauthModule, PhoneFormatPipe, PolicyPerson, RBAC_CONFIG, RbacActionDirective, RbacConfig, RbacModule, RedirectSamlComponent, RedirectSamlRequest, RedirectSessionConfigs, ResizePanelsComponent, RoleAccess, RoleNavService, RoutePath, RumConfig, RumModule, RumService, SESSION_CONFIG, SOF_BLANK_LANGUAGE_OVERRIDE, SOF_DATE_PIPE_FORMATS, STATUS, SamlModule, SamlService, SelectedMarketContext, ServerCacheService, SessionConfig, SessionService, SharedErrorService, SiteMapComponent, SiteMapDirection, SnackbarService, SofAddressComponent, SofAlertComponent, SofArComponentSavePrintModule, SofBadgeComponent, SofBannerComponent, SofBlankPipe, SofBottomSheetComponent, SofBreadcrumbsHierarchyComponent, SofBreadcrumbsHistoryComponent, SofButtonToggleGroupComponent, SofCalloutComponent, SofChartSkeletonLoaderComponent, SofChipComponent, SofCompareAddressPipe, SofConfirmAddressComponent, SofConfirmAddressCountyChangeComponent, SofContextComponent, SofDatePipe, SofDropdownButtonComponent, SofErrorCommonComponent, SofHandleComponent, SofHeaderComponent, SofImageCheckboxComponent, SofInputStepperComponent, SofModalComponent, SofNavPanelComponent, SofPipeModule, SofProgressBarComponent, SofRadioCardComponent, SofSegmentedControlComponent, SofSelectComponent, SofSimpleAlertComponent, SofSkeletonLoaderComponent, SofSnackbarComponent, SofSsnPipe, SofStarRatingComponent, SofSubNavigationComponent, SofSvgLoaderComponent, SofTabsComponent, SofToastComponent, SofUtilityButtonComponent, SoftheonErrorHandlerService, SsoGatewayEntryService, SsoGatewayModel, States, TextOverflowEllipsisTooltipDirective, ThemeModule, ThemeService, ToastService, TypedSession, USER_ENTITY_SERVICE_CONFIG, UserEntityService, UserEntityServiceConfig, ValidationKeys, WINDOW, httpVerb, initializerFactory, keyPathPrefix, languageStorageKey, newGuid, pascalToCamel, preSignInRouteStorageKey, removeMenuRole, routeToPreLoginRoute, sessionBasePathFactory, userInitialsPipe };
|
|
11732
11931
|
//# sourceMappingURL=softheon-armature.mjs.map
|