@magic-xpa/engine 4.1300.0-dev4130.19 → 4.1300.0-dev4130.191
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/fesm2022/magic-xpa-engine.mjs +467 -3
- package/fesm2022/magic-xpa-engine.mjs.map +1 -1
- package/package.json +10 -8
- package/types/magic-xpa-engine.d.ts +4741 -0
- package/index.d.ts +0 -191
- package/src/AccessHelper.d.ts +0 -20
- package/src/ClientManager.d.ts +0 -37
- package/src/CommandsProcessorBase.d.ts +0 -24
- package/src/CommandsProcessorManager.d.ts +0 -7
- package/src/CommandsTable.d.ts +0 -22
- package/src/ConstInterface.d.ts +0 -523
- package/src/CurrentClientVersion.d.ts +0 -1
- package/src/FlowMonitorInterface.d.ts +0 -15
- package/src/GUIManager.d.ts +0 -17
- package/src/GlobalCommandsManager.d.ts +0 -17
- package/src/GuiEventsProcessor.d.ts +0 -24
- package/src/ICommandsTable.d.ts +0 -9
- package/src/ServerConfig.d.ts +0 -35
- package/src/bridge/IGuiEvent.d.ts +0 -19
- package/src/bridge/MagicBridge.d.ts +0 -18
- package/src/commands/ClientOriginatedCommandTaskTag.d.ts +0 -8
- package/src/commands/ClientToServer/AddUserLocateDataViewCommand.d.ts +0 -4
- package/src/commands/ClientToServer/AddUserRangeDataviewCommand.d.ts +0 -6
- package/src/commands/ClientToServer/AddUserSortDataViewCommand.d.ts +0 -6
- package/src/commands/ClientToServer/BrowserEscEventCommand.d.ts +0 -9
- package/src/commands/ClientToServer/CachedFileQueryCommand.d.ts +0 -9
- package/src/commands/ClientToServer/ClientOriginatedCommand.d.ts +0 -8
- package/src/commands/ClientToServer/ClientOriginatedCommandSerializer.d.ts +0 -6
- package/src/commands/ClientToServer/ColumnSortEventCommand.d.ts +0 -11
- package/src/commands/ClientToServer/CommandFactory.d.ts +0 -66
- package/src/commands/ClientToServer/CommandSerializationHelper.d.ts +0 -20
- package/src/commands/ClientToServer/ComputeEventCommand.d.ts +0 -9
- package/src/commands/ClientToServer/ContextTerminationEventCommand.d.ts +0 -8
- package/src/commands/ClientToServer/ContextTimeoutResetCommand.d.ts +0 -8
- package/src/commands/ClientToServer/ControlItemsRefreshCommand.d.ts +0 -7
- package/src/commands/ClientToServer/DataViewOutputCommand.d.ts +0 -9
- package/src/commands/ClientToServer/DataviewCommand.d.ts +0 -32
- package/src/commands/ClientToServer/EvaluateCommand.d.ts +0 -16
- package/src/commands/ClientToServer/EventCommand.d.ts +0 -16
- package/src/commands/ClientToServer/ExecOperCommand.d.ts +0 -24
- package/src/commands/ClientToServer/FetchDataControlValuesEventCommand.d.ts +0 -10
- package/src/commands/ClientToServer/GlobalParamsQueryCommand.d.ts +0 -5
- package/src/commands/ClientToServer/ICommandTaskTag.d.ts +0 -3
- package/src/commands/ClientToServer/IndexChangeEventCommand.d.ts +0 -9
- package/src/commands/ClientToServer/IniputForceWriteCommand.d.ts +0 -11
- package/src/commands/ClientToServer/NonReversibleExitEventCommand.d.ts +0 -9
- package/src/commands/ClientToServer/QueryCommand.d.ts +0 -8
- package/src/commands/ClientToServer/RecomputeCommand.d.ts +0 -12
- package/src/commands/ClientToServer/RefreshEventCommand.d.ts +0 -13
- package/src/commands/ClientToServer/RefreshScreenEventCommand.d.ts +0 -11
- package/src/commands/ClientToServer/RollbackEventCommand.d.ts +0 -15
- package/src/commands/ClientToServer/SelectProgramCommand.d.ts +0 -7
- package/src/commands/ClientToServer/SetTransactionStateDataviewCommand.d.ts +0 -5
- package/src/commands/ClientToServer/SubformOpenEventCommand.d.ts +0 -9
- package/src/commands/ClientToServer/SubformRefreshEventCommand.d.ts +0 -10
- package/src/commands/ClientToServer/TransactionCommand.d.ts +0 -14
- package/src/commands/ClientToServer/UnloadCommand.d.ts +0 -8
- package/src/commands/ClientToServer/WriteMessageToServerLogCommand.d.ts +0 -6
- package/src/commands/DataViewCommandBase.d.ts +0 -6
- package/src/commands/IClientCommand.d.ts +0 -2
- package/src/commands/IClientTargetedCommand.d.ts +0 -12
- package/src/commands/IClientToServerCommandInfo.d.ts +0 -4
- package/src/commands/ServerToClient/AbortCommand.d.ts +0 -11
- package/src/commands/ServerToClient/AddLocateCommand.d.ts +0 -6
- package/src/commands/ServerToClient/AddRangeCommand.d.ts +0 -10
- package/src/commands/ServerToClient/AddSortCommand.d.ts +0 -9
- package/src/commands/ServerToClient/ClientRefreshCommand.d.ts +0 -7
- package/src/commands/ServerToClient/ClientTargetedCommandBase.d.ts +0 -12
- package/src/commands/ServerToClient/EnhancedVerifyCommand.d.ts +0 -13
- package/src/commands/ServerToClient/OpenURLCommand.d.ts +0 -21
- package/src/commands/ServerToClient/ResetLocateCommand.d.ts +0 -6
- package/src/commands/ServerToClient/ResetRangeCommand.d.ts +0 -6
- package/src/commands/ServerToClient/ResetSortCommand.d.ts +0 -6
- package/src/commands/ServerToClient/ResultCommand.d.ts +0 -10
- package/src/commands/ServerToClient/VerifyCommand.d.ts +0 -17
- package/src/commands/ServerToClient/XMLBasedCommandBuilder.d.ts +0 -11
- package/src/communications/IConnectionStateManager.d.ts +0 -4
- package/src/communications/InteractiveCommunicationsFailureHandler.d.ts +0 -6
- package/src/data/DataSourceIdKey.d.ts +0 -2
- package/src/data/DataView.d.ts +0 -162
- package/src/data/DataViewBase.d.ts +0 -12
- package/src/data/DataviewManager.d.ts +0 -14
- package/src/data/DataviewManagerBase.d.ts +0 -11
- package/src/data/DvCache.d.ts +0 -15
- package/src/data/Field.d.ts +0 -103
- package/src/data/FieldBase.d.ts +0 -23
- package/src/data/FieldsTable.d.ts +0 -27
- package/src/data/IRecordsTable.d.ts +0 -7
- package/src/data/Key.d.ts +0 -15
- package/src/data/Record.d.ts +0 -157
- package/src/data/RecordOutOfDataViewException.d.ts +0 -10
- package/src/data/RecordsTable.d.ts +0 -38
- package/src/data/TaskTransactionManager.d.ts +0 -17
- package/src/data/XMLBasedDcValuesBuilder.d.ts +0 -11
- package/src/enums.d.ts +0 -21
- package/src/env/EnvVariablesTable.d.ts +0 -17
- package/src/env/Environment.d.ts +0 -118
- package/src/env/ILanguageData.d.ts +0 -3
- package/src/env/LanguageData.d.ts +0 -20
- package/src/env/MirrorString.d.ts +0 -15
- package/src/event/ActionManager.d.ts +0 -14
- package/src/event/Event.d.ts +0 -79
- package/src/event/EventHandler.d.ts +0 -71
- package/src/event/EventHandlerPosition.d.ts +0 -25
- package/src/event/EventsManager.d.ts +0 -209
- package/src/event/IEventsManager.d.ts +0 -77
- package/src/event/RunTimeEvent.d.ts +0 -126
- package/src/event/RunTimeEventBase.d.ts +0 -5
- package/src/event/UserEventsTable.d.ts +0 -11
- package/src/exp/ExpTable.d.ts +0 -11
- package/src/exp/Expression.d.ts +0 -37
- package/src/exp/ExpressionDict.d.ts +0 -12
- package/src/exp/ExpressionEvaluator.d.ts +0 -203
- package/src/exp/ExpressionLocalJpn.d.ts +0 -18
- package/src/exp/GlobalParamsTable.d.ts +0 -19
- package/src/exp/YesNoExp.d.ts +0 -9
- package/src/gui/CreatedFormVector.d.ts +0 -10
- package/src/gui/FormsTable.d.ts +0 -15
- package/src/gui/MgControl.d.ts +0 -60
- package/src/gui/MgForm.d.ts +0 -96
- package/src/http/HttpManager.d.ts +0 -26
- package/src/http/client/HttpClientAsync.d.ts +0 -16
- package/src/http/client/HttpClientBase.d.ts +0 -30
- package/src/http/client/HttpClientEvents.d.ts +0 -18
- package/src/http/client/HttpClientSync.d.ts +0 -17
- package/src/http/client/HttpUtility.d.ts +0 -10
- package/src/http/client/ICommunicationsFailureHandler.d.ts +0 -5
- package/src/remote/AddUserLocateRemoteDataViewCommand.d.ts +0 -8
- package/src/remote/AddUserRangeRemoteDataViewCommand.d.ts +0 -8
- package/src/remote/AddUserSortRemoteDataViewCommand.d.ts +0 -8
- package/src/remote/RemoteCommandsProcessor.d.ts +0 -58
- package/src/remote/RemoteControlItemsRefreshCommand.d.ts +0 -9
- package/src/remote/RemoteDataViewCommandBase.d.ts +0 -10
- package/src/remote/RemoteDataViewCommandFactory.d.ts +0 -6
- package/src/remote/RemoteDataViewCommandUpdateNonModifiable.d.ts +0 -8
- package/src/remote/RemoteDataviewManager.d.ts +0 -9
- package/src/remote/RemoteInitDataViewCommand.d.ts +0 -7
- package/src/remote/ResetUserLocateRemoteDataviewCommand.d.ts +0 -7
- package/src/remote/ResetUserRangeRemoteDataviewCommand.d.ts +0 -7
- package/src/remote/ResetUserSortRemoteDataviewCommand.d.ts +0 -7
- package/src/remote/ServerError.d.ts +0 -16
- package/src/remote/SetTransactionStateRemoteDataViewCommand.d.ts +0 -8
- package/src/rt/Argument.d.ts +0 -36
- package/src/rt/ArgumentsList.d.ts +0 -24
- package/src/rt/Boundary.d.ts +0 -27
- package/src/rt/CompMainPrgTable.d.ts +0 -10
- package/src/rt/DataviewHeaderBase.d.ts +0 -34
- package/src/rt/DataviewHeaderFactory.d.ts +0 -5
- package/src/rt/DataviewHeaders.d.ts +0 -12
- package/src/rt/DataviewHeadersSaxHandler.d.ts +0 -10
- package/src/rt/ExecutionStack.d.ts +0 -22
- package/src/rt/ExecutionStackEntry.d.ts +0 -7
- package/src/rt/HandlersTable.d.ts +0 -19
- package/src/rt/IDataSourceViewDefinition.d.ts +0 -6
- package/src/rt/IDataviewHeader.d.ts +0 -10
- package/src/rt/IResultValue.d.ts +0 -4
- package/src/rt/LastFocusedManager.d.ts +0 -23
- package/src/rt/Operation.d.ts +0 -99
- package/src/rt/OperationTable.d.ts +0 -15
- package/src/rt/Recompute.d.ts +0 -41
- package/src/rt/RecomputeTable.d.ts +0 -9
- package/src/rt/RemoteDataviewHeader.d.ts +0 -14
- package/src/rt/ResultValue.d.ts +0 -7
- package/src/rt/TableCache.d.ts +0 -29
- package/src/rt/TableCacheManager.d.ts +0 -10
- package/src/rt/Transaction.d.ts +0 -23
- package/src/security/UserDetails.d.ts +0 -16
- package/src/tasks/IMGDataCollection.d.ts +0 -26
- package/src/tasks/MGData.d.ts +0 -63
- package/src/tasks/MGDataCollection.d.ts +0 -42
- package/src/tasks/RCTimer.d.ts +0 -13
- package/src/tasks/RemoteTaskService.d.ts +0 -16
- package/src/tasks/Task.d.ts +0 -313
- package/src/tasks/TaskBase.d.ts +0 -123
- package/src/tasks/TaskServiceBase.d.ts +0 -16
- package/src/tasks/TasksTable.d.ts +0 -21
- package/src/tasks/sort/Sort.d.ts +0 -4
- package/src/tasks/sort/SortCollection.d.ts +0 -11
- package/src/util/ConstUtils.d.ts +0 -3
- package/src/util/FlowMonitorQueue.d.ts +0 -70
- package/src/util/HeapSort.d.ts +0 -6
- package/src/util/IMirrorXML.d.ts +0 -6
- package/src/util/IServerConfig.d.ts +0 -11
- package/src/util/MgBlockingQueue.d.ts +0 -5
- package/src/util/MgPriorityBlockingQueue.d.ts +0 -17
- package/src/util/MgPriorityQueue.d.ts +0 -13
- package/src/util/ParamParseResult.d.ts +0 -6
- package/src/util/PrmMap.d.ts +0 -28
- package/src/util/ReturnResult.d.ts +0 -18
- package/src/util/ReturnResultBase.d.ts +0 -11
- package/src/util/Scrambler.d.ts +0 -10
- package/src/util/UniqueIDUtils.d.ts +0 -4
- package/src/util/cookie.service.d.ts +0 -8
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { StringBuilder, Int32, NString, ApplicationException, NNumber, List, Debug, Char, RefParam, NumberStyles, HashUtils, DateTime, Dictionary, Stack, NChar, isNullOrUndefined, WebException, Thread, Encoding, Exception, isUndefined, Hashtable, NotImplementedException, Array_Enumerator, ISO_8859_1_Encoding, Int64 } from '@magic-xpa/mscorelib';
|
|
2
2
|
import { XMLConstants, StorageAttribute, ViewRefreshMode, InternalInterface, Logger, StorageAttributeCheck, StrUtil, SubformType, TableBehaviour, MgControlType, ScrollBarThumbType, ForceExit, XmlParser, Misc, Base64, Priority, SyncExecutionHelper, Queue, Constants, DateTimeUtils, Logger_LogLevels, Logger_MessageDirection, MsgInterface, RequestInfo, OSEnvironment, JSON_Utils, UtilDateJpn, UtilStrByteMode, PICInterface, WindowType, BrkScope, RaiseAt, CtrlButtonTypeGui } from '@magic-xpa/utils';
|
|
3
|
-
import { RecordUtils, GuiFieldBase, ExpVal, BlobType, FieldDef, GuiTaskBase, MgControlBase, PropInterface, GuiDataCollection, CommandType, Commands, HtmlProperties, ControlTable, Modifiers, KeyboardItem, TaskDefinitionIdTableSaxHandler, DisplayConvertor, VectorType, PIC, MgTimer, GuiConstants, RuntimeContextBase, UsernamePasswordCredentials, Styles, Manager, NUM_TYPE, GuiExpressionEvaluator, ExpressionInterface, DataModificationTypes, GuiDataViewBase, ObjectReferencesCollection, EMPTY_DCREF, ObjectReferenceBase, PropTable, FieldsTable as FieldsTable$1, DcValuesBuilderBase, MgFormBase, GuiEnvironment, TaskDefinitionId, Events, Helps, FocusManager, EventsProcessor, UIBridge } from '@magic-xpa/gui';
|
|
3
|
+
import { RecordUtils, GuiFieldBase, ExpVal, BlobType, FieldDef, GuiTaskBase, MgControlBase, PropInterface, GuiDataCollection, CommandType, Commands, HtmlProperties, ControlTable, Modifiers, KeyboardItem, TaskDefinitionIdTableSaxHandler, DisplayConvertor, VectorType, PIC, MgTimer, GuiConstants, RuntimeContextBase, UsernamePasswordCredentials, Styles, Manager, NUM_TYPE, GuiExpressionEvaluator, ExpressionInterface, DateBreakParams, DataModificationTypes, GuiDataViewBase, ObjectReferencesCollection, EMPTY_DCREF, ObjectReferenceBase, PropTable, FieldsTable as FieldsTable$1, DcValuesBuilderBase, MgFormBase, GuiEnvironment, TaskDefinitionId, Events, Helps, FocusManager, EventsProcessor, UIBridge } from '@magic-xpa/gui';
|
|
4
4
|
import { HttpHeaders, HttpErrorResponse } from '@angular/common/http';
|
|
5
5
|
import { timer, Subject } from 'rxjs';
|
|
6
|
+
import { io } from 'socket.io-client';
|
|
6
7
|
import * as CryptoJS from 'crypto-js';
|
|
7
8
|
|
|
8
9
|
///
|
|
@@ -606,6 +607,9 @@ class ConstInterface {
|
|
|
606
607
|
static MG_ATTR_SPECIAL_REUSE_TABLE_EDITOR = "SpecialReuseTableEditor";
|
|
607
608
|
static MG_TAG_LAST_ROUTE = "LastRoute";
|
|
608
609
|
static RC_TOKEN_CACHED_FILE = "CACHE=";
|
|
610
|
+
//For PuSub
|
|
611
|
+
static MG_TAG_PUBSUB_SERVER_URI = "PubSubServerURI";
|
|
612
|
+
static WC_TOKEN_PUBSUB_SUBSCRIBE = "PubsubToken=Y&";
|
|
609
613
|
}
|
|
610
614
|
|
|
611
615
|
/// <summary>
|
|
@@ -3453,6 +3457,9 @@ class Event {
|
|
|
3453
3457
|
case InternalInterface.MG_ACT_DUMP_ENVIRONMENT:
|
|
3454
3458
|
description = 'Dump Environment';
|
|
3455
3459
|
break;
|
|
3460
|
+
case InternalInterface.MG_ACT_PUBSUB_TOPIC_PUBLISHED:
|
|
3461
|
+
description = 'Topic Publish';
|
|
3462
|
+
break;
|
|
3456
3463
|
default:
|
|
3457
3464
|
description = '';
|
|
3458
3465
|
break;
|
|
@@ -7699,6 +7706,7 @@ class RemoteCommandsProcessor extends CommandsProcessorBase {
|
|
|
7699
7706
|
HttpClientEvents.CheckAndSetSessionCounter_Event = this.CheckAndSetSessionCounter.bind(this);
|
|
7700
7707
|
HttpClientEvents.ComputeAndLogRequestInfo_Event = this.ComputeAndLogRequestInfo.bind(this);
|
|
7701
7708
|
AccessHelper.eventsManager.SpinnerStopped.subscribe(clientBusyTime => this.ClientActivated());
|
|
7709
|
+
SubscriberClient.SubscribeTopics_Event = this.SubscribeTopics.bind(this);
|
|
7702
7710
|
}
|
|
7703
7711
|
/// <summary>
|
|
7704
7712
|
/// Log the current request information in console
|
|
@@ -7802,6 +7810,27 @@ class RemoteCommandsProcessor extends CommandsProcessorBase {
|
|
|
7802
7810
|
await AccessHelper.mgDataTable.processRecovery();
|
|
7803
7811
|
AccessHelper.eventsManager.popNewExecStacks();
|
|
7804
7812
|
}
|
|
7813
|
+
// <summary> Get the subscription token from server </summary>
|
|
7814
|
+
// <param name="topics">List of topics to be subscribed to.</param>
|
|
7815
|
+
// <returns> Return subscription token to authenticate xpa client </returns>
|
|
7816
|
+
async GetSubscriptionTokenFromServer(topics) {
|
|
7817
|
+
const sessionID = this.SessionId;
|
|
7818
|
+
let queryStr = `${ConstInterface.REQ_ARG_START}${ConstInterface.RC_INDICATION}${ConstInterface.RC_TOKEN_CTX_ID}${ClientManager.Instance.GetRuntimeCtxID()}`;
|
|
7819
|
+
if (!isNullOrUndefined(sessionID))
|
|
7820
|
+
queryStr += `${ConstInterface.REQ_ARG_SEPARATOR}${ConstInterface.RC_TOKEN_SESSION_ID}${sessionID}`;
|
|
7821
|
+
queryStr += `${ConstInterface.REQ_ARG_SEPARATOR}${ConstInterface.RC_TOKEN_SESSION_COUNT}${this.GetSessionCounter()}${ConstInterface.REQ_ARG_SEPARATOR}${ConstInterface.WC_TOKEN_PUBSUB_SUBSCRIBE}`;
|
|
7822
|
+
//queryStr += `${ConstInterface.REQ_ARG_SEPARATOR}${ConstInterface.RC_TOKEN_SESSION_COUNT}${this.GetSessionCounter()}${ConstInterface.REQ_ARG_SEPARATOR}${ConstInterface.RC_TOKEN_TARGET_FILE}`;
|
|
7823
|
+
const url = ServerConfig.Instance.getServerURL() + queryStr;
|
|
7824
|
+
//queryStr += `${ConstInterface.REQ_ARG_SEPARATOR}${ConstInterface.RC_TOKEN_SESSION_COUNT}${this.GetSessionCounter()}${ConstInterface.REQ_ARG_SEPARATOR}${ConstInterface.WC_TOKEN_PUBSUB_SUBSCRIBE}`;
|
|
7825
|
+
//const url = ServerConfig.Instance.getServerURL() + queryStr;
|
|
7826
|
+
let response = await this.GetContent(url, false, null, null);
|
|
7827
|
+
//let uInt8Array:Uint8Array = new Uint8Array(response);
|
|
7828
|
+
return this.ArrayBufferToString(response);
|
|
7829
|
+
}
|
|
7830
|
+
async SubscribeTopics(topics, socket) {
|
|
7831
|
+
const token = await RemoteCommandsProcessor.GetInstance().GetSubscriptionTokenFromServer(Array.from(topics));
|
|
7832
|
+
socket.emit('subscribe', Array.from(topics), token, ClientManager.Instance.GetRuntimeCtxID());
|
|
7833
|
+
}
|
|
7805
7834
|
}
|
|
7806
7835
|
/// <summary>helper class: details from the runtime-engine - environment values.
|
|
7807
7836
|
/// Handshake response: <Richclientresponse> <ContextID>...</ContextID> <Environment InputPassword="Y|N"
|
|
@@ -9751,6 +9780,14 @@ class ExpressionDict {
|
|
|
9751
9780
|
null,
|
|
9752
9781
|
null,
|
|
9753
9782
|
new ExpDesc('NO', 0, 2, 2, 'A', false), /* 716- Hash */
|
|
9783
|
+
null,
|
|
9784
|
+
null,
|
|
9785
|
+
new ExpDesc('U', 0, -1, -1, 'B', false), /* 719- Subscribe */
|
|
9786
|
+
new ExpDesc('U', 0, -1, -1, 'B', false), /* 720- Unsubscribe */
|
|
9787
|
+
null,
|
|
9788
|
+
null,
|
|
9789
|
+
new ExpDesc('B', 0, 4, 4, 'TDVV', false), /* 723- LocalToUTC */
|
|
9790
|
+
new ExpDesc('B', 0, 4, 4, 'TDVV', false), /* 724- UTCToLocal */
|
|
9754
9791
|
];
|
|
9755
9792
|
}
|
|
9756
9793
|
|
|
@@ -11255,6 +11292,7 @@ class Environment {
|
|
|
11255
11292
|
_dropUserFormats = null;
|
|
11256
11293
|
_webclientReinitSession = "N";
|
|
11257
11294
|
_specialValNewPolicy = false; //??
|
|
11295
|
+
_pubsubServerURI = null;
|
|
11258
11296
|
static Instance = new Environment();
|
|
11259
11297
|
get Language() {
|
|
11260
11298
|
return this._language;
|
|
@@ -11463,6 +11501,9 @@ class Environment {
|
|
|
11463
11501
|
case ConstInterface.MG_ATTR_SPECIAL_DOTNET_ALLOW_ZERO_DATE:
|
|
11464
11502
|
case ConstInterface.MG_ATTR_SPECIAL_REUSE_TABLE_EDITOR:
|
|
11465
11503
|
break;
|
|
11504
|
+
case ConstInterface.MG_TAG_PUBSUB_SERVER_URI:
|
|
11505
|
+
this._pubsubServerURI = valueStr;
|
|
11506
|
+
break;
|
|
11466
11507
|
default:
|
|
11467
11508
|
Logger.Instance.WriteExceptionToLogWithMsg("in Environment.fillData(): unknown attribute: " + attribute);
|
|
11468
11509
|
break;
|
|
@@ -11899,6 +11940,9 @@ class Environment {
|
|
|
11899
11940
|
GetSpecialCancelOnCreate() {
|
|
11900
11941
|
return this._specialCancelOnCreate;
|
|
11901
11942
|
}
|
|
11943
|
+
GetPubSubServerURI() {
|
|
11944
|
+
return this._pubsubServerURI;
|
|
11945
|
+
}
|
|
11902
11946
|
}
|
|
11903
11947
|
/// <summary>
|
|
11904
11948
|
/// This class holds details for single Environment (per Component)
|
|
@@ -13824,6 +13868,136 @@ class CookieService {
|
|
|
13824
13868
|
}
|
|
13825
13869
|
}
|
|
13826
13870
|
|
|
13871
|
+
class SubscriberClient {
|
|
13872
|
+
static instance;
|
|
13873
|
+
socket;
|
|
13874
|
+
subscribedTopics = new Set();
|
|
13875
|
+
static SubscribeTopics_Event = null;
|
|
13876
|
+
constructor(task) {
|
|
13877
|
+
// Connect to the Socket.IO server with subscriber role
|
|
13878
|
+
const serverUrl = EnvParamsTable.Instance.get(ConstInterface.MG_TAG_PUBSUB_SERVER_URI);
|
|
13879
|
+
const taskRef = task;
|
|
13880
|
+
this.socket = io(serverUrl, {
|
|
13881
|
+
query: {
|
|
13882
|
+
role: 'subscriber'
|
|
13883
|
+
//token: '' // TODO: TO be used, in case subscriber needs to be authenticated with separate token.
|
|
13884
|
+
}
|
|
13885
|
+
});
|
|
13886
|
+
// Handle connection
|
|
13887
|
+
this.socket.on('connect', async () => {
|
|
13888
|
+
Logger.Instance.WriteDevToLog("SubscriberClient connected to server : " + this.socket.id);
|
|
13889
|
+
// Case 2: Subscribe to topics that were subscribed with previous session between client and pubsub middleware.
|
|
13890
|
+
// (reconnected to middleware after a disconnection)
|
|
13891
|
+
if (this.subscribedTopics.size > 0) {
|
|
13892
|
+
await SubscriberClient.SubscribeTopics_Event(this.subscribedTopics, this.socket);
|
|
13893
|
+
}
|
|
13894
|
+
});
|
|
13895
|
+
// Handle disconnection
|
|
13896
|
+
this.socket.on('disconnect', (reason) => {
|
|
13897
|
+
let disconnectReason;
|
|
13898
|
+
switch (reason) {
|
|
13899
|
+
case "ping timeout":
|
|
13900
|
+
disconnectReason = "Connection lost due to timeout";
|
|
13901
|
+
break;
|
|
13902
|
+
case "transport close":
|
|
13903
|
+
disconnectReason = "Network connection closed";
|
|
13904
|
+
break;
|
|
13905
|
+
case "io server disconnect":
|
|
13906
|
+
disconnectReason = "Disconnected by server";
|
|
13907
|
+
break;
|
|
13908
|
+
default:
|
|
13909
|
+
disconnectReason = "Disconnected:";
|
|
13910
|
+
}
|
|
13911
|
+
Logger.Instance.WriteDevToLog("SubscriberClient disconnected from server : " + reason + " : " + disconnectReason);
|
|
13912
|
+
});
|
|
13913
|
+
// Handle reconnection
|
|
13914
|
+
this.socket.on("reconnect", (attemptNumber) => {
|
|
13915
|
+
Logger.Instance.WriteDevToLog("Reconnected after " + attemptNumber + "attempts");
|
|
13916
|
+
});
|
|
13917
|
+
// Handle reconnection attempts
|
|
13918
|
+
this.socket.on("reconnect_attempt", (attemptNumber) => {
|
|
13919
|
+
Logger.Instance.WriteDevToLog("Reconnect attempt: " + attemptNumber);
|
|
13920
|
+
});
|
|
13921
|
+
// Handle reconnection errors
|
|
13922
|
+
this.socket.on("connect_error", (err) => {
|
|
13923
|
+
Logger.Instance.WriteDevToLog("Connection error: " + err.name + " Message: " + err.message);
|
|
13924
|
+
});
|
|
13925
|
+
// Handle subscription confirmation
|
|
13926
|
+
this.socket.on('subscribed', (data) => {
|
|
13927
|
+
this.subscribedTopics.add(data.topic);
|
|
13928
|
+
Logger.Instance.WriteDevToLog("SubscriberClient subscribed to topic : " + data.topic + " : " + data.message);
|
|
13929
|
+
});
|
|
13930
|
+
// Handle unsubscription confirmation
|
|
13931
|
+
this.socket.on('unsubscribed', (data) => {
|
|
13932
|
+
this.subscribedTopics.delete(data.topic);
|
|
13933
|
+
Logger.Instance.WriteDevToLog("SubscriberClient unsubscribed from topic : " + data.topic + " : " + data.message);
|
|
13934
|
+
});
|
|
13935
|
+
// Handle errors
|
|
13936
|
+
this.socket.on('error', (error) => {
|
|
13937
|
+
Logger.Instance.WriteErrorToLog("SubscriberClient error : " + error.message);
|
|
13938
|
+
});
|
|
13939
|
+
// Handle incoming messages
|
|
13940
|
+
this.socket.on('message', (data) => {
|
|
13941
|
+
//this.messageSubject.next(data);
|
|
13942
|
+
Logger.Instance.WriteDevToLog("SubscriberClient received message from topic : " + data.topic + " : " + data.message);
|
|
13943
|
+
EventsManager.Instance.AddTopicPublishedEvent(taskRef, data.topic, data.message);
|
|
13944
|
+
});
|
|
13945
|
+
}
|
|
13946
|
+
/**
|
|
13947
|
+
* Get the singleton instance of SubscriberClient
|
|
13948
|
+
*/
|
|
13949
|
+
static getInstance(task) {
|
|
13950
|
+
if (!SubscriberClient.instance) {
|
|
13951
|
+
SubscriberClient.instance = new SubscriberClient(task);
|
|
13952
|
+
}
|
|
13953
|
+
return SubscriberClient.instance;
|
|
13954
|
+
}
|
|
13955
|
+
/**
|
|
13956
|
+
* Subscribe to multiple topics at once
|
|
13957
|
+
* @param topics Array of topics to subscribe to
|
|
13958
|
+
*/
|
|
13959
|
+
subscribe(topics, token) {
|
|
13960
|
+
let ctxID = ClientManager.Instance.GetRuntimeCtxID();
|
|
13961
|
+
this.socket.emit('subscribe', topics, token, ctxID);
|
|
13962
|
+
// topics.forEach(topic => {
|
|
13963
|
+
// if (!this.subscribedTopics.has(topic)) {
|
|
13964
|
+
//
|
|
13965
|
+
// let ctxID = ClientManager.Instance.GetRuntimeCtxID()
|
|
13966
|
+
// this.socket.emit('subscribe', topic, token, ctxID);
|
|
13967
|
+
// }
|
|
13968
|
+
// });
|
|
13969
|
+
}
|
|
13970
|
+
/**
|
|
13971
|
+
* Unsubscribe from multiple topics at once
|
|
13972
|
+
* @param topics Array of topics to unsubscribe from
|
|
13973
|
+
*/
|
|
13974
|
+
unsubscribe(topics) {
|
|
13975
|
+
topics.forEach(topic => {
|
|
13976
|
+
if (this.subscribedTopics.has(topic)) {
|
|
13977
|
+
this.socket.emit('unsubscribe', topic);
|
|
13978
|
+
}
|
|
13979
|
+
});
|
|
13980
|
+
}
|
|
13981
|
+
/**
|
|
13982
|
+
* Unsubscribe from all topics
|
|
13983
|
+
* 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.
|
|
13984
|
+
*/
|
|
13985
|
+
unsubscribeFromAll() {
|
|
13986
|
+
this.subscribedTopics.forEach(topic => this.socket.emit('unsubscribe', topic));
|
|
13987
|
+
}
|
|
13988
|
+
/**
|
|
13989
|
+
* Disconnect from the server
|
|
13990
|
+
* TODO: To be called when client explicitly disconnects from the server.
|
|
13991
|
+
*/
|
|
13992
|
+
disconnect() {
|
|
13993
|
+
this.socket.disconnect();
|
|
13994
|
+
}
|
|
13995
|
+
static async SubscribeTopics(topics, socket) {
|
|
13996
|
+
if (this.SubscribeTopics_Event !== null)
|
|
13997
|
+
this.SubscribeTopics_Event(topics, socket);
|
|
13998
|
+
}
|
|
13999
|
+
}
|
|
14000
|
+
|
|
13827
14001
|
class ExpressionEvaluator extends GuiExpressionEvaluator {
|
|
13828
14002
|
static ASTERISK_CHR = String.fromCharCode(1);
|
|
13829
14003
|
static QUESTION_CHR = String.fromCharCode(2);
|
|
@@ -15464,6 +15638,28 @@ class ExpressionEvaluator extends GuiExpressionEvaluator {
|
|
|
15464
15638
|
this.eval_op_Hash(val1, val2, resVal);
|
|
15465
15639
|
expStrTracker.resetNullResult();
|
|
15466
15640
|
break;
|
|
15641
|
+
case ExpressionInterface.EXP_OP_SUBSCRIBE:
|
|
15642
|
+
resVal.Attr = StorageAttribute.BOOLEAN;
|
|
15643
|
+
this.eval_op_Subscribe(valStack);
|
|
15644
|
+
break;
|
|
15645
|
+
case ExpressionInterface.EXP_OP_UNSUBSCRIBE:
|
|
15646
|
+
resVal.Attr = StorageAttribute.BOOLEAN;
|
|
15647
|
+
resVal.BoolVal = this.eval_op_UnSubscribe(valStack);
|
|
15648
|
+
break;
|
|
15649
|
+
case ExpressionInterface.EXP_OP_LOCALTOUTC:
|
|
15650
|
+
val4 = valStack.pop(); // UTC date output variable
|
|
15651
|
+
val3 = valStack.pop(); // UTC time output variable
|
|
15652
|
+
val2 = valStack.pop(); // local date
|
|
15653
|
+
val1 = valStack.pop(); // local time
|
|
15654
|
+
await this.eval_op_localToUTC(resVal, val1, val2, val3, val4);
|
|
15655
|
+
break;
|
|
15656
|
+
case ExpressionInterface.EXP_OP_UTCTOLOCAL:
|
|
15657
|
+
val4 = valStack.pop(); // local date output variable
|
|
15658
|
+
val3 = valStack.pop(); // local time output variable
|
|
15659
|
+
val2 = valStack.pop(); // UTC date
|
|
15660
|
+
val1 = valStack.pop(); // UTC time
|
|
15661
|
+
await this.eval_op_utcToLocal(resVal, val1, val2, val3, val4);
|
|
15662
|
+
break;
|
|
15467
15663
|
default:
|
|
15468
15664
|
return;
|
|
15469
15665
|
}
|
|
@@ -16378,6 +16574,217 @@ class ExpressionEvaluator extends GuiExpressionEvaluator {
|
|
|
16378
16574
|
resVal.Attr = StorageAttribute.BOOLEAN;
|
|
16379
16575
|
resVal.BoolVal = true;
|
|
16380
16576
|
}
|
|
16577
|
+
/**
|
|
16578
|
+
* Safely extracts date/time parts from a JS Date using Intl.DateTimeFormat.
|
|
16579
|
+
*
|
|
16580
|
+
* WHY: Native JS Date has known pitfalls — century year bug (year < 100 mapped to 1900+year),
|
|
16581
|
+
* silent leap year rollovers, DST gaps, and 0-based months. Intl.DateTimeFormat avoids all
|
|
16582
|
+
* of these by using the browser's IANA timezone database internally.
|
|
16583
|
+
*
|
|
16584
|
+
* Used by both eval_op_localToUTC and eval_op_utcToLocal as a single safe extraction point.
|
|
16585
|
+
*
|
|
16586
|
+
* @param date - A valid JS Date object
|
|
16587
|
+
* @param timeZone - IANA timezone string (e.g. 'Asia/Kolkata', 'UTC').
|
|
16588
|
+
* Defaults to browser's local timezone — correct for any user, any country.
|
|
16589
|
+
* @returns Parsed parts (month is 1-based) or null if date is invalid
|
|
16590
|
+
*/
|
|
16591
|
+
convertDateTimeParts(date, timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone) {
|
|
16592
|
+
if (!date || isNaN(date.getTime()))
|
|
16593
|
+
return null;
|
|
16594
|
+
// 'en-CA' locale formats date as YYYY-MM-DD — unambiguous and consistent across
|
|
16595
|
+
// all browsers. Other locales like en-US (MM/DD/YYYY) or en-GB (DD/MM/YYYY) can
|
|
16596
|
+
// behave differently across Chrome, Firefox and Safari. Nothing to do with Canada.
|
|
16597
|
+
const formatter = new Intl.DateTimeFormat('en-CA', {
|
|
16598
|
+
timeZone,
|
|
16599
|
+
year: 'numeric',
|
|
16600
|
+
month: '2-digit',
|
|
16601
|
+
day: '2-digit',
|
|
16602
|
+
hour: '2-digit',
|
|
16603
|
+
minute: '2-digit',
|
|
16604
|
+
second: '2-digit',
|
|
16605
|
+
hour12: false
|
|
16606
|
+
});
|
|
16607
|
+
const parts = formatter.formatToParts(date);
|
|
16608
|
+
const get = (type) => {
|
|
16609
|
+
const part = parts.find(p => p.type === type);
|
|
16610
|
+
if (!part)
|
|
16611
|
+
throw new Error(`Missing date part: ${type}`);
|
|
16612
|
+
return parseInt(part.value, 10);
|
|
16613
|
+
};
|
|
16614
|
+
try {
|
|
16615
|
+
const hour = get('hour');
|
|
16616
|
+
return {
|
|
16617
|
+
year: get('year'),
|
|
16618
|
+
month: get('month'), // 1-based because Intl returns display month (1–12), unlike JS Date.getMonth() which is 0-based
|
|
16619
|
+
day: get('day'),
|
|
16620
|
+
hour: hour === 24 ? 0 : hour, // normalize midnight — some browsers return 24 instead of 0
|
|
16621
|
+
minute: get('minute'),
|
|
16622
|
+
second: get('second')
|
|
16623
|
+
};
|
|
16624
|
+
}
|
|
16625
|
+
catch {
|
|
16626
|
+
return null;
|
|
16627
|
+
}
|
|
16628
|
+
}
|
|
16629
|
+
/**
|
|
16630
|
+
* Validates that a time value (in total seconds) is within a valid day range
|
|
16631
|
+
*/
|
|
16632
|
+
isValidTimeSec(timeSec) {
|
|
16633
|
+
return Number.isInteger(timeSec) && timeSec >= 0 && timeSec <= 86399;
|
|
16634
|
+
}
|
|
16635
|
+
/**
|
|
16636
|
+
* Splits total seconds since midnight into hours, minutes, seconds.
|
|
16637
|
+
* e.g. 3661 → { hours: 1, minutes: 1, seconds: 1 }
|
|
16638
|
+
*/
|
|
16639
|
+
splitTimeSec(timeSec) {
|
|
16640
|
+
return {
|
|
16641
|
+
hours: Math.floor(timeSec / 3600),
|
|
16642
|
+
minutes: Math.floor((timeSec % 3600) / 60),
|
|
16643
|
+
seconds: timeSec % 60
|
|
16644
|
+
};
|
|
16645
|
+
}
|
|
16646
|
+
/**
|
|
16647
|
+
* Writes a time (seconds) and date (Magic numeric) into their respective output fields.
|
|
16648
|
+
*/
|
|
16649
|
+
async writeDateTimeToFields(timeFld, dateTimeSec, dateFld, dateVal) {
|
|
16650
|
+
const tmpVal = new ExpVal();
|
|
16651
|
+
tmpVal.MgNumVal = new NUM_TYPE();
|
|
16652
|
+
tmpVal.Attr = StorageAttribute.TIME;
|
|
16653
|
+
tmpVal.MgNumVal.NUM_4_LONG(dateTimeSec);
|
|
16654
|
+
await timeFld.setValueAndStartRecompute(tmpVal.ToMgVal(), false, true, false, false);
|
|
16655
|
+
await timeFld.updateDisplay();
|
|
16656
|
+
tmpVal.Attr = StorageAttribute.DATE;
|
|
16657
|
+
tmpVal.MgNumVal.NUM_4_LONG(dateVal);
|
|
16658
|
+
await dateFld.setValueAndStartRecompute(tmpVal.ToMgVal(), false, true, false, false);
|
|
16659
|
+
await dateFld.updateDisplay();
|
|
16660
|
+
}
|
|
16661
|
+
/**
|
|
16662
|
+
* Converts local date/time to UTC and writes the result into output fields.
|
|
16663
|
+
*
|
|
16664
|
+
* Edge cases handled:
|
|
16665
|
+
* - Century years — setFullYear() avoids JS year < 100 bug
|
|
16666
|
+
* - Leap years — round-trip validation catches silent date rollovers
|
|
16667
|
+
* - DST gaps — Intl.DateTimeFormat resolves correctly per IANA tz rules
|
|
16668
|
+
* - DST ambiguity — Intl uses first occurrence consistently
|
|
16669
|
+
* - Cross-midnight — JS Date handles automatically
|
|
16670
|
+
* - Out-of-range — time < 0 or > 86399 explicitly rejected
|
|
16671
|
+
*
|
|
16672
|
+
* @param resVal - Output: Boolean result (true = success)
|
|
16673
|
+
* @param localTimeVal - Input: Local time as total seconds since midnight (Magic numeric)
|
|
16674
|
+
* @param localDateVal - Input: Local date as Magic numeric
|
|
16675
|
+
* @param utcTimeVar - Input: Field index for the UTC time output field
|
|
16676
|
+
* @param utcDateVar - Input: Field index for the UTC date output field
|
|
16677
|
+
*/
|
|
16678
|
+
async eval_op_localToUTC(resVal, localTimeVal, localDateVal, utcTimeVar, utcDateVar) {
|
|
16679
|
+
resVal.Attr = StorageAttribute.BOOLEAN;
|
|
16680
|
+
resVal.BoolVal = false;
|
|
16681
|
+
// Guard: all four numeric values must be present
|
|
16682
|
+
if (localTimeVal.MgNumVal === null || localDateVal.MgNumVal === null ||
|
|
16683
|
+
utcTimeVar.MgNumVal === null || utcDateVar.MgNumVal === null) {
|
|
16684
|
+
return;
|
|
16685
|
+
}
|
|
16686
|
+
// Fetch output fields
|
|
16687
|
+
const utcDateFld = this.GetFieldOfContextTask(utcDateVar.MgNumVal.NUM_2_LONG());
|
|
16688
|
+
const utcTimeFld = this.GetFieldOfContextTask(utcTimeVar.MgNumVal.NUM_2_LONG());
|
|
16689
|
+
if (utcTimeFld === null || utcDateFld === null)
|
|
16690
|
+
return;
|
|
16691
|
+
// Break the input date into parts
|
|
16692
|
+
const dateParts = new DateBreakParams();
|
|
16693
|
+
DisplayConvertor.Instance.date_break_datemode(dateParts, localDateVal.MgNumVal.NUM_2_LONG(), true, this.ExpTask.getCompIdx());
|
|
16694
|
+
// Reject zero/uninitialized Magic date parts
|
|
16695
|
+
if (dateParts.year === 0 || dateParts.month === 0 || dateParts.day === 0)
|
|
16696
|
+
return;
|
|
16697
|
+
// Guard: reject out-of-range time value
|
|
16698
|
+
const localTimeSec = localTimeVal.MgNumVal.NUM_2_LONG();
|
|
16699
|
+
if (!this.isValidTimeSec(localTimeSec))
|
|
16700
|
+
return;
|
|
16701
|
+
const { hours, minutes, seconds } = this.splitTimeSec(localTimeSec);
|
|
16702
|
+
// Use setFullYear to avoid JS bug where new Date(year < 100, ...) maps to 1900+year
|
|
16703
|
+
const localDateTime = new Date(0);
|
|
16704
|
+
localDateTime.setFullYear(dateParts.year, dateParts.month - 1, dateParts.day);
|
|
16705
|
+
localDateTime.setHours(hours, minutes, seconds, 0);
|
|
16706
|
+
// Guard: round-trip check catches silent rollovers (e.g. Feb 29 on non-leap year)
|
|
16707
|
+
if (localDateTime.getFullYear() !== dateParts.year ||
|
|
16708
|
+
localDateTime.getMonth() !== dateParts.month - 1 ||
|
|
16709
|
+
localDateTime.getDate() !== dateParts.day) {
|
|
16710
|
+
return;
|
|
16711
|
+
}
|
|
16712
|
+
if (isNaN(localDateTime.getTime()))
|
|
16713
|
+
return;
|
|
16714
|
+
// Extract UTC parts via Intl — DST, leap year, century year all handled automatically
|
|
16715
|
+
const utcParts = this.convertDateTimeParts(localDateTime, 'UTC');
|
|
16716
|
+
if (utcParts === null)
|
|
16717
|
+
return;
|
|
16718
|
+
const utcTime = utcParts.hour * 3600 + utcParts.minute * 60 + utcParts.second;
|
|
16719
|
+
const utcDate = DisplayConvertor.Instance.date_4_calender(utcParts.year, utcParts.month, utcParts.day, 1, false // month already 1-based
|
|
16720
|
+
);
|
|
16721
|
+
await this.writeDateTimeToFields(utcTimeFld, utcTime, utcDateFld, utcDate);
|
|
16722
|
+
resVal.BoolVal = true;
|
|
16723
|
+
}
|
|
16724
|
+
/**
|
|
16725
|
+
* Converts UTC date/time to local and writes the result into output fields.
|
|
16726
|
+
*
|
|
16727
|
+
* Edge cases handled:
|
|
16728
|
+
* - Century years — Date.UTC() does not have the year < 100 bug
|
|
16729
|
+
* - Leap years — round-trip validation catches silent date rollovers
|
|
16730
|
+
* - DST gaps — Intl.DateTimeFormat resolves to correct local time automatically
|
|
16731
|
+
* - DST ambiguity — Intl uses first occurrence consistently
|
|
16732
|
+
* - Cross-midnight — JS Date handles automatically
|
|
16733
|
+
* - Out-of-range — time < 0 or > 86399 explicitly rejected
|
|
16734
|
+
*
|
|
16735
|
+
* @param resVal - Output: Boolean result (true = success)
|
|
16736
|
+
* @param utcTimeVal - Input: UTC time as total seconds since midnight (Magic numeric)
|
|
16737
|
+
* @param utcDateVal - Input: UTC date as Magic numeric
|
|
16738
|
+
* @param localTimeVar - Input: Field index for the local time output field
|
|
16739
|
+
* @param localDateVar - Input: Field index for the local date output field
|
|
16740
|
+
*/
|
|
16741
|
+
async eval_op_utcToLocal(resVal, utcTimeVal, utcDateVal, localTimeVar, localDateVar) {
|
|
16742
|
+
resVal.Attr = StorageAttribute.BOOLEAN;
|
|
16743
|
+
resVal.BoolVal = false;
|
|
16744
|
+
// Guard: all four numeric values must be present
|
|
16745
|
+
if (utcTimeVal.MgNumVal === null || utcDateVal.MgNumVal === null ||
|
|
16746
|
+
localTimeVar.MgNumVal === null || localDateVar.MgNumVal === null) {
|
|
16747
|
+
return;
|
|
16748
|
+
}
|
|
16749
|
+
// Fetch output fields
|
|
16750
|
+
const localDateFld = this.GetFieldOfContextTask(localDateVar.MgNumVal.NUM_2_LONG());
|
|
16751
|
+
const localTimeFld = this.GetFieldOfContextTask(localTimeVar.MgNumVal.NUM_2_LONG());
|
|
16752
|
+
if (localTimeFld === null || localDateFld === null)
|
|
16753
|
+
return;
|
|
16754
|
+
// Break the input date into parts
|
|
16755
|
+
const dateParts = new DateBreakParams();
|
|
16756
|
+
DisplayConvertor.Instance.date_break_datemode(dateParts, utcDateVal.MgNumVal.NUM_2_LONG(), true, this.ExpTask.getCompIdx());
|
|
16757
|
+
// Reject zero/uninitialized Magic date parts
|
|
16758
|
+
if (dateParts.year === 0 || dateParts.month === 0 || dateParts.day === 0)
|
|
16759
|
+
return;
|
|
16760
|
+
// Guard: reject out-of-range time value
|
|
16761
|
+
const utcTimeSec = utcTimeVal.MgNumVal.NUM_2_LONG();
|
|
16762
|
+
if (!this.isValidTimeSec(utcTimeSec))
|
|
16763
|
+
return;
|
|
16764
|
+
const { hours, minutes, seconds } = this.splitTimeSec(utcTimeSec);
|
|
16765
|
+
// Why Date.UTC() instead of new Date(year, month, day, ...)?
|
|
16766
|
+
// JS has a bug: new Date(99, 0, 1) does not give year 99 — it gives 1999.
|
|
16767
|
+
// Date.UTC() always uses the exact year provided — safe for century years like 1900, 2000, 2100
|
|
16768
|
+
const utcDateTime = new Date(Date.UTC(dateParts.year, dateParts.month - 1, dateParts.day, hours, minutes, seconds, 0));
|
|
16769
|
+
// Guard: round-trip check catches silent rollovers (e.g. Feb 29 on non-leap year)
|
|
16770
|
+
if (utcDateTime.getUTCFullYear() !== dateParts.year ||
|
|
16771
|
+
utcDateTime.getUTCMonth() !== dateParts.month - 1 ||
|
|
16772
|
+
utcDateTime.getUTCDate() !== dateParts.day) {
|
|
16773
|
+
return;
|
|
16774
|
+
}
|
|
16775
|
+
if (isNaN(utcDateTime.getTime()))
|
|
16776
|
+
return;
|
|
16777
|
+
// Extract local datetime parts via Intl — no timeZone arg = browser's local timezone
|
|
16778
|
+
// DST, leap year, century year all handled automatically
|
|
16779
|
+
const localParts = this.convertDateTimeParts(utcDateTime);
|
|
16780
|
+
if (localParts === null)
|
|
16781
|
+
return;
|
|
16782
|
+
const localTime = localParts.hour * 3600 + localParts.minute * 60 + localParts.second;
|
|
16783
|
+
const localDate = DisplayConvertor.Instance.date_4_calender(localParts.year, localParts.month, localParts.day, 1, false // month already 1-based
|
|
16784
|
+
);
|
|
16785
|
+
await this.writeDateTimeToFields(localTimeFld, localTime, localDateFld, localDate);
|
|
16786
|
+
resVal.BoolVal = true;
|
|
16787
|
+
}
|
|
16381
16788
|
eval_op_ndow(resVal, val1, displayConvertor) {
|
|
16382
16789
|
if (val1.MgNumVal === null) {
|
|
16383
16790
|
super.SetNULL(resVal, StorageAttribute.NUMERIC);
|
|
@@ -18556,6 +18963,46 @@ class ExpressionEvaluator extends GuiExpressionEvaluator {
|
|
|
18556
18963
|
}
|
|
18557
18964
|
return CryptoJS.lib.WordArray.create(words, u8.length);
|
|
18558
18965
|
}
|
|
18966
|
+
async eval_op_Subscribe(valStack) {
|
|
18967
|
+
let nArgs = valStack.pop();
|
|
18968
|
+
let result = false;
|
|
18969
|
+
if (nArgs > 0) {
|
|
18970
|
+
// get the parameters
|
|
18971
|
+
let Exp_params = new Array(nArgs);
|
|
18972
|
+
for (let j = 0; j < nArgs; j++) {
|
|
18973
|
+
Exp_params[nArgs - 1 - j] = valStack.pop();
|
|
18974
|
+
}
|
|
18975
|
+
let topics = this.params2arguments(Exp_params, 0, Exp_params.length);
|
|
18976
|
+
let token = await RemoteCommandsProcessor.GetInstance().GetSubscriptionTokenFromServer(topics);
|
|
18977
|
+
let sc = SubscriberClient.getInstance(this.ExpTask);
|
|
18978
|
+
sc.subscribe(topics, token);
|
|
18979
|
+
result = true;
|
|
18980
|
+
}
|
|
18981
|
+
else {
|
|
18982
|
+
Logger.Instance.WriteExceptionToLogWithMsg('ExpressionEvaluator.Subscribe() there is problem with the arguments');
|
|
18983
|
+
result = false;
|
|
18984
|
+
}
|
|
18985
|
+
return result;
|
|
18986
|
+
}
|
|
18987
|
+
eval_op_UnSubscribe(valStack) {
|
|
18988
|
+
let nArgs = valStack.pop();
|
|
18989
|
+
let result = false;
|
|
18990
|
+
if (nArgs > 0) {
|
|
18991
|
+
// get the parameters
|
|
18992
|
+
let Exp_params = new Array(nArgs);
|
|
18993
|
+
for (let j = 0; j < nArgs; j++) {
|
|
18994
|
+
Exp_params[nArgs - 1 - j] = valStack.pop();
|
|
18995
|
+
}
|
|
18996
|
+
let sc = SubscriberClient.getInstance(this.ExpTask);
|
|
18997
|
+
let topics = this.params2arguments(Exp_params, 0, Exp_params.length);
|
|
18998
|
+
sc.unsubscribe(topics);
|
|
18999
|
+
}
|
|
19000
|
+
else {
|
|
19001
|
+
Logger.Instance.WriteExceptionToLogWithMsg('ExpressionEvaluator.UnSubscribe() there is problem with the arguments');
|
|
19002
|
+
result = false;
|
|
19003
|
+
}
|
|
19004
|
+
return result;
|
|
19005
|
+
}
|
|
18559
19006
|
}
|
|
18560
19007
|
/// <summary>
|
|
18561
19008
|
/// This exception used when at least one of the operands is null
|
|
@@ -32592,6 +33039,7 @@ class Task extends TaskBase {
|
|
|
32592
33039
|
enable = await this.checkProp(PropInterface.PROP_TYPE_TASK_PROPERTIES_ALLOW_INDEX, true);
|
|
32593
33040
|
this.ActionManager.enable(InternalInterface.MG_ACT_VIEW_BY_KEY, enable);
|
|
32594
33041
|
this.ActionManager.enable(InternalInterface.MG_ACT_DUMP_ENVIRONMENT, true);
|
|
33042
|
+
this.ActionManager.enable(InternalInterface.MG_ACT_PUBSUB_TOPIC_PUBLISHED, true);
|
|
32595
33043
|
}
|
|
32596
33044
|
/// <summary>
|
|
32597
33045
|
/// set hasZoomHandler to true
|
|
@@ -34814,6 +35262,22 @@ class EventsManager {
|
|
|
34814
35262
|
}
|
|
34815
35263
|
}
|
|
34816
35264
|
/// <summary>
|
|
35265
|
+
/// Add internal to handle published topic from pubsub middleware
|
|
35266
|
+
/// </summary>
|
|
35267
|
+
/// <param name = "task"> control </param>
|
|
35268
|
+
/// <param name = "topic"> value of control </param>
|
|
35269
|
+
/// <param name = "message"> refresh display </param>
|
|
35270
|
+
AddTopicPublishedEvent(task, topic, message) {
|
|
35271
|
+
const rtEvt = new RunTimeEvent(task); //, false);
|
|
35272
|
+
rtEvt.setInternal(InternalInterface.MG_ACT_PUBSUB_TOPIC_PUBLISHED);
|
|
35273
|
+
let argsList = new Array(2);
|
|
35274
|
+
argsList[0] = new ExpVal(StorageAttribute.ALPHA, false, topic);
|
|
35275
|
+
argsList[1] = new ExpVal(StorageAttribute.ALPHA, false, message);
|
|
35276
|
+
let args = new ArgumentsList(argsList);
|
|
35277
|
+
rtEvt.setArgList(args);
|
|
35278
|
+
this.addToTail(rtEvt);
|
|
35279
|
+
}
|
|
35280
|
+
/// <summary>
|
|
34817
35281
|
/// Add internal event ro set the value of control
|
|
34818
35282
|
/// </summary>
|
|
34819
35283
|
/// <param name = "ctrl"> control </param>
|
|
@@ -39642,7 +40106,7 @@ class CommandsTable {
|
|
|
39642
40106
|
}
|
|
39643
40107
|
}
|
|
39644
40108
|
|
|
39645
|
-
let CurrentClientVersion = '4.1300.0-dev4130.
|
|
40109
|
+
let CurrentClientVersion = '4.1300.0-dev4130.191';
|
|
39646
40110
|
|
|
39647
40111
|
// @dynamic
|
|
39648
40112
|
class ClientManager {
|
|
@@ -40256,5 +40720,5 @@ class DataSourceIdKey {
|
|
|
40256
40720
|
* Generated bundle index. Do not edit.
|
|
40257
40721
|
*/
|
|
40258
40722
|
|
|
40259
|
-
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 };
|
|
40723
|
+
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 };
|
|
40260
40724
|
//# sourceMappingURL=magic-xpa-engine.mjs.map
|