@magic-xpa/engine 4.1300.0-dev4130.30 → 4.1300.0-dev4130.301

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.
package/package.json CHANGED
@@ -1,13 +1,15 @@
1
1
  {
2
2
  "name": "@magic-xpa/engine",
3
- "version": "4.1300.0-dev4130.30",
3
+ "version": "4.1300.0-dev4130.301",
4
4
  "description": "magic engine package",
5
5
  "license": "SEE LICENSE IN EULA.pdf",
6
6
  "dependencies": {
7
- "@magic-xpa/mscorelib": "4.1300.0-dev4130.30",
8
- "@magic-xpa/utils": "4.1300.0-dev4130.30",
9
- "@magic-xpa/gui": "4.1300.0-dev4130.30",
10
- "@angular/common": "^21.1.3",
7
+ "@magic-xpa/mscorelib": "4.1300.0-dev4130.301",
8
+ "@magic-xpa/utils": "4.1300.0-dev4130.301",
9
+ "@magic-xpa/gui": "4.1300.0-dev4130.301",
10
+ "@angular/common": "^22.1.1",
11
+ "socket.io": "^4.8.3",
12
+ "socket.io-client": "^4.8.3",
11
13
  "tslib": "^2.3.0"
12
14
  },
13
15
  "module": "fesm2022/magic-xpa-engine.mjs",
@@ -22,6 +24,7 @@
22
24
  }
23
25
  },
24
26
  "sideEffects": false,
27
+ "type": "module",
25
28
  "scripts": {
26
29
  "prepublishOnly": "node --eval \"console.error('ERROR: Trying to publish a package that has been compiled in full compilation mode. This is not allowed.\\nPlease delete and rebuild the package with partial compilation mode, before attempting to publish.\\n')\" && exit 1"
27
30
  }
@@ -4,6 +4,7 @@ import { StorageAttribute, XmlParser, CallOperationMode, MgControlType, TableBeh
4
4
  import { Subject } from 'rxjs/internal/Subject';
5
5
  import { HttpClient, HttpHeaders, HttpResponse } from '@angular/common/http';
6
6
  import { Subject as Subject$1 } from 'rxjs';
7
+ import { Socket } from 'socket.io-client';
7
8
 
8
9
  declare enum EventSubType {
9
10
  Normal = 0,
@@ -2733,6 +2734,8 @@ declare class ConstInterface {
2733
2734
  static MG_ATTR_SPECIAL_REUSE_TABLE_EDITOR: string;
2734
2735
  static MG_TAG_LAST_ROUTE: string;
2735
2736
  static RC_TOKEN_CACHED_FILE: string;
2737
+ static MG_TAG_PUBSUB_SERVER_URI: string;
2738
+ static WC_TOKEN_PUBSUB_SUBSCRIBE: string;
2736
2739
  }
2737
2740
 
2738
2741
  declare let CurrentClientVersion: string;
@@ -3512,6 +3515,7 @@ declare class Environment implements IEnvironment {
3512
3515
  private _dropUserFormats;
3513
3516
  private _webclientReinitSession;
3514
3517
  private _specialValNewPolicy;
3518
+ private _pubsubServerURI;
3515
3519
  static Instance: Environment;
3516
3520
  get Language(): string;
3517
3521
  IgnoreReplaceDecimalSeparator: boolean;
@@ -3578,6 +3582,7 @@ declare class Environment implements IEnvironment {
3578
3582
  GetDropUserFormats(): string;
3579
3583
  GetSpecialValNewPolicy(): boolean;
3580
3584
  GetSpecialCancelOnCreate(): boolean;
3585
+ GetPubSubServerURI(): string;
3581
3586
  }
3582
3587
  declare class EnvironmentDetails {
3583
3588
  private _createInModifyMode;
@@ -3733,6 +3738,7 @@ declare class EventsManager implements IEventsManager {
3733
3738
  AddRouteEvent(task: ITask, code: number, routerpath: string, routerOutletName: string, routeParams: List<any>): void;
3734
3739
  AddRouterClosedEvent(task: Task): void;
3735
3740
  AddLastSavedRouteEvent(srcTask: Task, args: ArgumentsList): void;
3741
+ AddTopicPublishedEvent(task: ITask, topic: string, message: string): void;
3736
3742
  AddExternalValueEvent(ctrl: MgControl, value: any, refreshDisplay: boolean): void;
3737
3743
  addGuiTriggeredEventWithCtrlAndCodeAndLine(ctrl: MgControlBase, code: number, line: number): void;
3738
3744
  addGuiTriggeredEventWithCtrlAndLineAndCodeAndIsProductClick(ctrl: MgControlBase, code: number, line: number, isProduceClick: boolean): void;
@@ -3939,6 +3945,70 @@ declare class ExpressionEvaluator extends GuiExpressionEvaluator {
3939
3945
  private eval_op_time_brk;
3940
3946
  private eval_op_addDateTime;
3941
3947
  private eval_op_difdt;
3948
+ /**
3949
+ * Safely extracts date/time parts from a JS Date using Intl.DateTimeFormat.
3950
+ *
3951
+ * WHY: Native JS Date has known pitfalls — century year bug (year < 100 mapped to 1900+year),
3952
+ * silent leap year rollovers, DST gaps, and 0-based months. Intl.DateTimeFormat avoids all
3953
+ * of these by using the browser's IANA timezone database internally.
3954
+ *
3955
+ * Used by both eval_op_localToUTC and eval_op_utcToLocal as a single safe extraction point.
3956
+ *
3957
+ * @param date - A valid JS Date object
3958
+ * @param timeZone - IANA timezone string (e.g. 'Asia/Kolkata', 'UTC').
3959
+ * Defaults to browser's local timezone — correct for any user, any country.
3960
+ * @returns Parsed parts (month is 1-based) or null if date is invalid
3961
+ */
3962
+ private convertDateTimeParts;
3963
+ /**
3964
+ * Validates that a time value (in total seconds) is within a valid day range
3965
+ */
3966
+ private isValidTimeSec;
3967
+ /**
3968
+ * Splits total seconds since midnight into hours, minutes, seconds.
3969
+ * e.g. 3661 → { hours: 1, minutes: 1, seconds: 1 }
3970
+ */
3971
+ private splitTimeSec;
3972
+ /**
3973
+ * Writes a time (seconds) and date (Magic numeric) into their respective output fields.
3974
+ */
3975
+ private writeDateTimeToFields;
3976
+ /**
3977
+ * Converts local date/time to UTC and writes the result into output fields.
3978
+ *
3979
+ * Edge cases handled:
3980
+ * - Century years — setFullYear() avoids JS year < 100 bug
3981
+ * - Leap years — round-trip validation catches silent date rollovers
3982
+ * - DST gaps — Intl.DateTimeFormat resolves correctly per IANA tz rules
3983
+ * - DST ambiguity — Intl uses first occurrence consistently
3984
+ * - Cross-midnight — JS Date handles automatically
3985
+ * - Out-of-range — time < 0 or > 86399 explicitly rejected
3986
+ *
3987
+ * @param resVal - Output: Boolean result (true = success)
3988
+ * @param localTimeVal - Input: Local time as total seconds since midnight (Magic numeric)
3989
+ * @param localDateVal - Input: Local date as Magic numeric
3990
+ * @param utcTimeVar - Input: Field index for the UTC time output field
3991
+ * @param utcDateVar - Input: Field index for the UTC date output field
3992
+ */
3993
+ private eval_op_localToUTC;
3994
+ /**
3995
+ * Converts UTC date/time to local and writes the result into output fields.
3996
+ *
3997
+ * Edge cases handled:
3998
+ * - Century years — Date.UTC() does not have the year < 100 bug
3999
+ * - Leap years — round-trip validation catches silent date rollovers
4000
+ * - DST gaps — Intl.DateTimeFormat resolves to correct local time automatically
4001
+ * - DST ambiguity — Intl uses first occurrence consistently
4002
+ * - Cross-midnight — JS Date handles automatically
4003
+ * - Out-of-range — time < 0 or > 86399 explicitly rejected
4004
+ *
4005
+ * @param resVal - Output: Boolean result (true = success)
4006
+ * @param utcTimeVal - Input: UTC time as total seconds since midnight (Magic numeric)
4007
+ * @param utcDateVal - Input: UTC date as Magic numeric
4008
+ * @param localTimeVar - Input: Field index for the local time output field
4009
+ * @param localDateVar - Input: Field index for the local date output field
4010
+ */
4011
+ private eval_op_utcToLocal;
3942
4012
  private eval_op_ndow;
3943
4013
  private eval_op_nmonth;
3944
4014
  mul_add(num: NUM_TYPE, mul: number, add: number): NUM_TYPE;
@@ -4040,9 +4110,13 @@ declare class ExpressionEvaluator extends GuiExpressionEvaluator {
4040
4110
  eval_op_get_cookie(cookieName: string, resVal: ExpVal): void;
4041
4111
  eval_op_delete_cookie(cookieName: string, resVal: ExpVal): void;
4042
4112
  eval_op_route_get(resVal: ExpVal): void;
4113
+ eval_op_route_param_count_get(resVal: ExpVal): void;
4114
+ eval_op_route_param_get(val1: ExpVal, resVal: ExpVal): void;
4043
4115
  private params2arguments;
4044
4116
  private eval_op_Hash;
4045
4117
  private toWordArray;
4118
+ private eval_op_Subscribe;
4119
+ private eval_op_UnSubscribe;
4046
4120
  }
4047
4121
  declare class NullValueException extends Exception {
4048
4122
  private _attr;
@@ -4273,6 +4347,8 @@ declare class RemoteCommandsProcessor extends CommandsProcessorBase {
4273
4347
  PrepareRequest(serializeTasks: boolean): Promise<string>;
4274
4348
  ProcessResponse(response: string, currMgdID: number, openingTaskDetails: OpeningTaskDetails, res: IResultValue): Promise<void>;
4275
4349
  ProcessRecovery(): Promise<void>;
4350
+ GetSubscriptionTokenFromServer(topics: string[]): Promise<string>;
4351
+ SubscribeTopics(topics: Set<string>, socket: Socket): Promise<void>;
4276
4352
  }
4277
4353
 
4278
4354
  declare class RemoteControlItemsRefreshCommand extends RemoteDataViewCommandBase {
@@ -4625,10 +4701,43 @@ declare class Scrambler {
4625
4701
  static UnScramble(inVal: string, beginOffSet: number, endOffSet: number): string;
4626
4702
  }
4627
4703
 
4704
+ declare class SubscriberClient {
4705
+ private static instance;
4706
+ private socket;
4707
+ private subscribedTopics;
4708
+ static SubscribeTopics_Event: (topics: Set<string>, socket: Socket) => Promise<void>;
4709
+ private constructor();
4710
+ /**
4711
+ * Get the singleton instance of SubscriberClient
4712
+ */
4713
+ static getInstance(task: TaskBase): SubscriberClient;
4714
+ /**
4715
+ * Subscribe to multiple topics at once
4716
+ * @param topics Array of topics to subscribe to
4717
+ */
4718
+ subscribe(topics: string[], token: string): void;
4719
+ /**
4720
+ * Unsubscribe from multiple topics at once
4721
+ * @param topics Array of topics to unsubscribe from
4722
+ */
4723
+ unsubscribe(topics: string[]): void;
4724
+ /**
4725
+ * Unsubscribe from all topics
4726
+ * TODO: To be called when client explicitly disconnects from the server. Alternately, if middleware receives a disconnect request, it can also unsubscribe from all topics from its own side.
4727
+ */
4728
+ unsubscribeFromAll(): void;
4729
+ /**
4730
+ * Disconnect from the server
4731
+ * TODO: To be called when client explicitly disconnects from the server.
4732
+ */
4733
+ disconnect(): void;
4734
+ static SubscribeTopics(topics: Set<string>, socket: Socket): Promise<void>;
4735
+ }
4736
+
4628
4737
  declare class UniqueIDUtils {
4629
4738
  private static id;
4630
4739
  static GetUniqueMachineID(): string;
4631
4740
  }
4632
4741
 
4633
- export { AbortCommand, AccessHelper, ActionManager, AddLocateCommand, AddRangeCommand, AddSortCommand, AddUserLocateDataViewCommand, AddUserLocateRemoteDataViewCommand, AddUserRangeDataviewCommand, AddUserRangeRemoteDataViewCommand, AddUserSortDataViewCommand, AddUserSortRemoteDataViewCommand, Argument, ArgumentsList, Boundary, BrowserEscEventCommand, CachedFileQueryCommand, ClearEventsOnStopExecution, ClientManager, ClientOriginatedCommand, ClientOriginatedCommandSerializer, ClientOriginatedCommandTaskTag, ClientRefreshCommand, ClientTargetedCommandBase, ClientTargetedCommandType, ColumnSortEventCommand, CommandFactory, CommandSerializationHelper, CommandsProcessorBase, CommandsProcessorBase_SendingInstruction, CommandsProcessorBase_SessionStage, CommandsProcessorManager, CommandsTable, CompMainPrgTable, ComputeEventCommand, ConstInterface, ConstUtils, ContextTerminationEventCommand, ContextTimeoutResetCommand, ControlItemsRefreshCommand, CookieService, CreatedFormVector, CurrentClientVersion, DataSourceIdKey, DataView, DataViewBase, DataViewCommandBase, DataViewCommandType, DataViewOutputCommand, DataviewCommand, DataviewHeaderBase, DataviewHeaderFactory, DataviewHeaders, DataviewHeadersSaxHandler, DataviewManager, DataviewManagerBase, DcValuesReference, DummyDataViewCommand, DvCache, EnhancedVerifyCommand, EnvParamsTable, Environment, EnvironmentDetails, EvaluateCommand, Event, EventCommand, EventHandler, EventHandlerPosition, EventSubType, EventsAllowedType, EventsManager, ExecOperCommand, ExecutionStack, ExecutionStackEntry, ExpDesc, ExpStrTracker, ExpTable, Expression, ExpressionDict, ExpressionEvaluator, ExpressionLocalJpn, Expression_ReturnValue, FetchDataControlValuesEventCommand, Field, FieldBase, FieldsTable as FieldsTableExt, FlowMonitorInterface, FlowMonitorQueue, FormsTable, GUIManager, GlobalCommandsManager, GlobalParams, GlobalParamsQueryCommand, GuiEventsProcessor, HandlersTable, HeapSort, HttpClientAsync, HttpClientBase, HttpClientEvents, HttpClientSync, HttpManager, HttpUtility, IClientTargetedCommand, IndexChangeEventCommand, IniputForceWriteCommand, InteractiveCommunicationsFailureHandler, Key, LanguageData, LastFocusedManager, MGData, MGDataCollection, MagicBridge, MgControl, MgForm, MgPriorityBlockingQueue, MgPriorityQueue, MirrorExpVal, MirrorPrmMap, MirrorString, NonReversibleExitEventCommand, NullValueException, OpenURLCommand, OpeningTaskDetails, Operation, OperationTable, ParamParseResult, PrmMap, QueryCommand, RCTimer, Recompute, RecomputeCommand, RecomputeTable, Recompute_RcmpBy, Record, RecordOutOfDataViewException, RecordOutOfDataViewException_ExceptionType, RecordsTable, RefreshEventCommand, RefreshScreenEventCommand, RemoteCommandsProcessor, RemoteControlItemsRefreshCommand, RemoteDataViewCommandBase, RemoteDataViewCommandFactory, RemoteDataViewCommandUpdateNonModifiable, RemoteDataviewHeader, RemoteDataviewManager, RemoteTaskService, RequestMethod, ResetLocateCommand, ResetRangeCommand, ResetSortCommand, ResetUserLocateRemoteDataviewCommand, ResetUserRangeRemoteDataviewCommand, ResetUserSortRemoteDataviewCommand, ResultCommand, ResultValue, RetVals, ReturnResult, ReturnResultBase, RollbackEventCommand, RollbackEventCommand_RollbackType, RunTimeEvent, RunTimeEventBase, SET_DISPLAYLINE_BY_DV, Scrambler, SelectProgramCommand, ServerConfig, ServerError, SetTransactionStateDataviewCommand, SetTransactionStateRemoteDataViewCommand, Sort, SortCollection, SubformOpenEventCommand, SubformRefreshEventCommand, TableCache, TableCacheManager, Task, TaskBase, TaskServiceBase, TaskTransactionManager, Task_Direction, Task_Flow, Task_SubformExecModeEnum, TasksTable, Transaction, TransactionCommand, UniqueIDUtils, UnloadCommand, UserDetails, UserEventsTable, UserRange, VerifyCommand, WriteMessageToServerLogCommand, XMLBasedCommandBuilder, XMLBasedDcValuesBuilder, YesNoExp, getGuiEventObj };
4742
+ export { AbortCommand, AccessHelper, ActionManager, AddLocateCommand, AddRangeCommand, AddSortCommand, AddUserLocateDataViewCommand, AddUserLocateRemoteDataViewCommand, AddUserRangeDataviewCommand, AddUserRangeRemoteDataViewCommand, AddUserSortDataViewCommand, AddUserSortRemoteDataViewCommand, Argument, ArgumentsList, Boundary, BrowserEscEventCommand, CachedFileQueryCommand, ClearEventsOnStopExecution, ClientManager, ClientOriginatedCommand, ClientOriginatedCommandSerializer, ClientOriginatedCommandTaskTag, ClientRefreshCommand, ClientTargetedCommandBase, ClientTargetedCommandType, ColumnSortEventCommand, CommandFactory, CommandSerializationHelper, CommandsProcessorBase, CommandsProcessorBase_SendingInstruction, CommandsProcessorBase_SessionStage, CommandsProcessorManager, CommandsTable, CompMainPrgTable, ComputeEventCommand, ConstInterface, ConstUtils, ContextTerminationEventCommand, ContextTimeoutResetCommand, ControlItemsRefreshCommand, CookieService, CreatedFormVector, CurrentClientVersion, DataSourceIdKey, DataView, DataViewBase, DataViewCommandBase, DataViewCommandType, DataViewOutputCommand, DataviewCommand, DataviewHeaderBase, DataviewHeaderFactory, DataviewHeaders, DataviewHeadersSaxHandler, DataviewManager, DataviewManagerBase, DcValuesReference, DummyDataViewCommand, DvCache, EnhancedVerifyCommand, EnvParamsTable, Environment, EnvironmentDetails, EvaluateCommand, Event, EventCommand, EventHandler, EventHandlerPosition, EventSubType, EventsAllowedType, EventsManager, ExecOperCommand, ExecutionStack, ExecutionStackEntry, ExpDesc, ExpStrTracker, ExpTable, Expression, ExpressionDict, ExpressionEvaluator, ExpressionLocalJpn, Expression_ReturnValue, FetchDataControlValuesEventCommand, Field, FieldBase, FieldsTable as FieldsTableExt, FlowMonitorInterface, FlowMonitorQueue, FormsTable, GUIManager, GlobalCommandsManager, GlobalParams, GlobalParamsQueryCommand, GuiEventsProcessor, HandlersTable, HeapSort, HttpClientAsync, HttpClientBase, HttpClientEvents, HttpClientSync, HttpManager, HttpUtility, IClientTargetedCommand, IndexChangeEventCommand, IniputForceWriteCommand, InteractiveCommunicationsFailureHandler, Key, LanguageData, LastFocusedManager, MGData, MGDataCollection, MagicBridge, MgControl, MgForm, MgPriorityBlockingQueue, MgPriorityQueue, MirrorExpVal, MirrorPrmMap, MirrorString, NonReversibleExitEventCommand, NullValueException, OpenURLCommand, OpeningTaskDetails, Operation, OperationTable, ParamParseResult, PrmMap, QueryCommand, RCTimer, Recompute, RecomputeCommand, RecomputeTable, Recompute_RcmpBy, Record, RecordOutOfDataViewException, RecordOutOfDataViewException_ExceptionType, RecordsTable, RefreshEventCommand, RefreshScreenEventCommand, RemoteCommandsProcessor, RemoteControlItemsRefreshCommand, RemoteDataViewCommandBase, RemoteDataViewCommandFactory, RemoteDataViewCommandUpdateNonModifiable, RemoteDataviewHeader, RemoteDataviewManager, RemoteTaskService, RequestMethod, ResetLocateCommand, ResetRangeCommand, ResetSortCommand, ResetUserLocateRemoteDataviewCommand, ResetUserRangeRemoteDataviewCommand, ResetUserSortRemoteDataviewCommand, ResultCommand, ResultValue, RetVals, ReturnResult, ReturnResultBase, RollbackEventCommand, RollbackEventCommand_RollbackType, RunTimeEvent, RunTimeEventBase, SET_DISPLAYLINE_BY_DV, Scrambler, SelectProgramCommand, ServerConfig, ServerError, SetTransactionStateDataviewCommand, SetTransactionStateRemoteDataViewCommand, Sort, SortCollection, SubformOpenEventCommand, SubformRefreshEventCommand, SubscriberClient, TableCache, TableCacheManager, Task, TaskBase, TaskServiceBase, TaskTransactionManager, Task_Direction, Task_Flow, Task_SubformExecModeEnum, TasksTable, Transaction, TransactionCommand, UniqueIDUtils, UnloadCommand, UserDetails, UserEventsTable, UserRange, VerifyCommand, WriteMessageToServerLogCommand, XMLBasedCommandBuilder, XMLBasedDcValuesBuilder, YesNoExp, getGuiEventObj };
4634
4743
  export type { IClientCommand, IClientToServerCommandInfo, ICommandTaskTag, ICommandsTable, ICommunicationsFailureHandler, IConnectionStateManager, IDataSourceViewDefinition, IDataviewHeader, IEventsManager, IGuiEvent, ILanguageData, IMGDataCollection, IMirrorXML, IRecordsTable, IResultValue, IServerConfig, MgBlockingQueue };