@magic-xpa/angular 4.1300.0-dev4130.117 → 4.1300.0-dev4130.120

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.
@@ -12,7 +12,7 @@ import { InteractiveCommandType, HtmlProperties, OverlayType, Styles, GuiConstan
12
12
  import { MagicBridge, getGuiEventObj, CookieService, Environment, LastFocusedManager } from '@magic-xpa/engine';
13
13
  import { MagicProperties, Logger, StrUtil, StorageAttribute, PICInterface, MsgInterface, BindingLevel, StorageAttributeType, MgControlType } from '@magic-xpa/utils';
14
14
  import { filter, map, debounceTime, take } from 'rxjs/operators';
15
- import { Subject, EMPTY, fromEvent } from 'rxjs';
15
+ import { Subject, EMPTY, fromEvent, Observable } from 'rxjs';
16
16
  import { __decorate, __metadata } from 'tslib';
17
17
  import * as i2$1 from '@angular/cdk/drag-drop';
18
18
  import { DragDropModule, CdkDragHandle, CdkDrag } from '@angular/cdk/drag-drop';
@@ -23,6 +23,7 @@ import { maskitoTimeOptionsGenerator } from '@maskito/kit';
23
23
  import * as i2$2 from '@angular/cdk/platform';
24
24
  import { MaskitoModule } from '@maskito/angular';
25
25
  import { NativeDateAdapter, MAT_DATE_LOCALE, DateAdapter, MAT_DATE_FORMATS } from '@angular/material/core';
26
+ import { io } from 'socket.io-client';
26
27
 
27
28
  /**
28
29
  * @ignore
@@ -6883,6 +6884,109 @@ const magicProviders = [
6883
6884
  TableMagicService
6884
6885
  ];
6885
6886
 
6887
+ class SubscriberService {
6888
+ static instance;
6889
+ socket;
6890
+ constructor() {
6891
+ // Connect to the Socket.IO server with subscriber role
6892
+ this.socket = io('http://localhost:3000', {
6893
+ query: {
6894
+ role: 'subscriber',
6895
+ token: 'abc123' // Default token for testing; replace with actual authentication
6896
+ }
6897
+ });
6898
+ // Handle connection
6899
+ this.socket.on('connect', () => {
6900
+ console.log('Connected to server as subscriber:', this.socket.id);
6901
+ });
6902
+ // Handle disconnection
6903
+ this.socket.on('disconnect', () => {
6904
+ console.log('Disconnected from server');
6905
+ });
6906
+ // Handle subscription confirmation
6907
+ this.socket.on('subscribed', (data) => {
6908
+ console.log('Subscribed to topic:', data.topic, data.message);
6909
+ });
6910
+ // Handle unsubscription confirmation
6911
+ this.socket.on('unsubscribed', (data) => {
6912
+ console.log('Unsubscribed from topic:', data.topic, data.message);
6913
+ });
6914
+ // Handle errors
6915
+ this.socket.on('error', (error) => {
6916
+ console.error('Socket error:', error.message);
6917
+ });
6918
+ this.socket.on('message', (error) => {
6919
+ console.error('Message from xpa:', error.message);
6920
+ });
6921
+ }
6922
+ /**
6923
+ * Subscribe to a specific topic
6924
+ * @param topic The topic to subscribe to
6925
+ */
6926
+ subscribe(topic) {
6927
+ this.socket.emit('subscribe', topic);
6928
+ }
6929
+ /**
6930
+ * Unsubscribe from a specific topic
6931
+ * @param topic The topic to unsubscribe from
6932
+ */
6933
+ unsubscribe(topic) {
6934
+ this.socket.emit('unsubscribe', topic);
6935
+ }
6936
+ /**
6937
+ * Get an Observable for incoming messages
6938
+ * @returns Observable that emits message data
6939
+ */
6940
+ onMessage() {
6941
+ return new Observable(observer => {
6942
+ this.socket.on('message', (data) => {
6943
+ observer.next(data);
6944
+ });
6945
+ });
6946
+ }
6947
+ /**
6948
+ * Get current subscriptions (for debugging)
6949
+ */
6950
+ getSubscriptions() {
6951
+ this.socket.emit('getSubscriptions');
6952
+ }
6953
+ /**
6954
+ * Listen for subscriptions data
6955
+ * @returns Observable that emits subscriptions list
6956
+ */
6957
+ onSubscriptionsData() {
6958
+ return new Observable(observer => {
6959
+ this.socket.on('subscriptionsData', (data) => {
6960
+ observer.next(data);
6961
+ });
6962
+ });
6963
+ }
6964
+ /**
6965
+ * Get the singleton instance of SubscriberService
6966
+ * @returns {SubscriberService} The singleton instance
6967
+ */
6968
+ static getInstance() {
6969
+ if (!SubscriberService.instance) {
6970
+ SubscriberService.instance = new SubscriberService();
6971
+ }
6972
+ return SubscriberService.instance;
6973
+ }
6974
+ /**
6975
+ * Disconnect from the server
6976
+ */
6977
+ disconnect() {
6978
+ this.socket.disconnect();
6979
+ }
6980
+ /** @nocollapse */ static ɵfac = function SubscriberService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || SubscriberService)(); };
6981
+ /** @nocollapse */ static ɵprov = /** @pureOrBreakMyCode */ i0.ɵɵdefineInjectable({ token: SubscriberService, factory: SubscriberService.ɵfac, providedIn: 'root' });
6982
+ }
6983
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(SubscriberService, [{
6984
+ type: Injectable,
6985
+ args: [{
6986
+ providedIn: 'root'
6987
+ }]
6988
+ }], () => [], null); })();
6989
+
6886
6990
  /**
6887
6991
  * @ignore
6888
6992
  */
@@ -6968,5 +7072,5 @@ class ModalFormDefinition {
6968
7072
  * Generated bundle index. Do not edit.
6969
7073
  */
6970
7074
 
6971
- export { AccessorMagicService, BaseMagicAlertComponent, BaseMagicConfirmComponent, BaseMagicOverlayContainer, CHECKBOX_VALUE_ACCESSOR, COLOR_FILE_NAME, CheckboxMagicDirective, CheckboxNoFormControlMagicDirective, ComboboxMagicDirective, CommandsCollectorMagicService, ComponentListMagicService, ConfirmationComponentsMagicProvider, Constants, ControlMetadata, ControlsMetadata, DATE_VALUE_ACCESSOR, DateMagicPipe, DateValueAccessor, EngineMagicService, ErrorMagicComponent, ExitMagicService, GuiInteractiveExecutor, HtmlClasses, InputNoFormControlMagicDirective, MAGIC_BG_COLOR, MAGIC_DEFAULT_VALUE_ACCESSOR, MAGIC_FG_COLOR, MG_FORMATS, MagicAlertComponent, MagicCheckboxControlValueAccessor, MagicColorService, MagicConfirmationBoxComponent, MagicDefaultValueAccessor, MagicDirective, MagicFocusDirective, MagicLazyLoaderService, MagicModule, MagicOverlayContainer, MagicOverlayContainerWrapper, MagicServices, MagicShellComponent, MagicViewContainerRef, MgDateAdapter, MgDateFormatter, MgformatMagicDirective, ModalFormDefinition, NoControlMagicDirective, NonMagicControlDirective, OverlayContainerMagicProvider, OverlayWindowService, RangeValidatorMagicDirective, Records, RouteCommand, RouterCommandsMagicService, RouterContainerMagicComponent, RowMagicDirective, StylesMapManager, SubformMagicComponent, SubformMagicService, TableMagicService, TaskBaseMagicComponent, TaskMagicService, Time24MagicPipe, TimeMagicPipe, TitleMagicService, basicMagicProviders, confirmationBox, magicProviders, matDateProviders, utils };
7075
+ export { AccessorMagicService, BaseMagicAlertComponent, BaseMagicConfirmComponent, BaseMagicOverlayContainer, CHECKBOX_VALUE_ACCESSOR, COLOR_FILE_NAME, CheckboxMagicDirective, CheckboxNoFormControlMagicDirective, ComboboxMagicDirective, CommandsCollectorMagicService, ComponentListMagicService, ConfirmationComponentsMagicProvider, Constants, ControlMetadata, ControlsMetadata, DATE_VALUE_ACCESSOR, DateMagicPipe, DateValueAccessor, EngineMagicService, ErrorMagicComponent, ExitMagicService, GuiInteractiveExecutor, HtmlClasses, InputNoFormControlMagicDirective, MAGIC_BG_COLOR, MAGIC_DEFAULT_VALUE_ACCESSOR, MAGIC_FG_COLOR, MG_FORMATS, MagicAlertComponent, MagicCheckboxControlValueAccessor, MagicColorService, MagicConfirmationBoxComponent, MagicDefaultValueAccessor, MagicDirective, MagicFocusDirective, MagicLazyLoaderService, MagicModule, MagicOverlayContainer, MagicOverlayContainerWrapper, MagicServices, MagicShellComponent, MagicViewContainerRef, MgDateAdapter, MgDateFormatter, MgformatMagicDirective, ModalFormDefinition, NoControlMagicDirective, NonMagicControlDirective, OverlayContainerMagicProvider, OverlayWindowService, RangeValidatorMagicDirective, Records, RouteCommand, RouterCommandsMagicService, RouterContainerMagicComponent, RowMagicDirective, StylesMapManager, SubformMagicComponent, SubformMagicService, SubscriberService, TableMagicService, TaskBaseMagicComponent, TaskMagicService, Time24MagicPipe, TimeMagicPipe, TitleMagicService, basicMagicProviders, confirmationBox, magicProviders, matDateProviders, utils };
6972
7076
  //# sourceMappingURL=magic-xpa-angular.mjs.map