@magic-xpa/engine 4.1300.0-dev4130.23 → 4.1300.0-dev4130.233
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 +500 -3
- package/fesm2022/magic-xpa-engine.mjs.map +1 -1
- package/package.json +11 -8
- package/types/magic-xpa-engine.d.ts +4743 -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,16 @@ 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 */
|
|
9791
|
+
new ExpDesc('U', 0, 1, 1, 'N', false), /* 725- RouteParamGet */
|
|
9792
|
+
new ExpDesc('N', 0, 0, 0, '', false), /* 726- RouteParamCountGet */
|
|
9754
9793
|
];
|
|
9755
9794
|
}
|
|
9756
9795
|
|
|
@@ -11255,6 +11294,7 @@ class Environment {
|
|
|
11255
11294
|
_dropUserFormats = null;
|
|
11256
11295
|
_webclientReinitSession = "N";
|
|
11257
11296
|
_specialValNewPolicy = false; //??
|
|
11297
|
+
_pubsubServerURI = null;
|
|
11258
11298
|
static Instance = new Environment();
|
|
11259
11299
|
get Language() {
|
|
11260
11300
|
return this._language;
|
|
@@ -11463,6 +11503,9 @@ class Environment {
|
|
|
11463
11503
|
case ConstInterface.MG_ATTR_SPECIAL_DOTNET_ALLOW_ZERO_DATE:
|
|
11464
11504
|
case ConstInterface.MG_ATTR_SPECIAL_REUSE_TABLE_EDITOR:
|
|
11465
11505
|
break;
|
|
11506
|
+
case ConstInterface.MG_TAG_PUBSUB_SERVER_URI:
|
|
11507
|
+
this._pubsubServerURI = valueStr;
|
|
11508
|
+
break;
|
|
11466
11509
|
default:
|
|
11467
11510
|
Logger.Instance.WriteExceptionToLogWithMsg("in Environment.fillData(): unknown attribute: " + attribute);
|
|
11468
11511
|
break;
|
|
@@ -11899,6 +11942,9 @@ class Environment {
|
|
|
11899
11942
|
GetSpecialCancelOnCreate() {
|
|
11900
11943
|
return this._specialCancelOnCreate;
|
|
11901
11944
|
}
|
|
11945
|
+
GetPubSubServerURI() {
|
|
11946
|
+
return this._pubsubServerURI;
|
|
11947
|
+
}
|
|
11902
11948
|
}
|
|
11903
11949
|
/// <summary>
|
|
11904
11950
|
/// This class holds details for single Environment (per Component)
|
|
@@ -13824,6 +13870,136 @@ class CookieService {
|
|
|
13824
13870
|
}
|
|
13825
13871
|
}
|
|
13826
13872
|
|
|
13873
|
+
class SubscriberClient {
|
|
13874
|
+
static instance;
|
|
13875
|
+
socket;
|
|
13876
|
+
subscribedTopics = new Set();
|
|
13877
|
+
static SubscribeTopics_Event = null;
|
|
13878
|
+
constructor(task) {
|
|
13879
|
+
// Connect to the Socket.IO server with subscriber role
|
|
13880
|
+
const serverUrl = EnvParamsTable.Instance.get(ConstInterface.MG_TAG_PUBSUB_SERVER_URI);
|
|
13881
|
+
const taskRef = task;
|
|
13882
|
+
this.socket = io(serverUrl, {
|
|
13883
|
+
query: {
|
|
13884
|
+
role: 'subscriber'
|
|
13885
|
+
//token: '' // TODO: TO be used, in case subscriber needs to be authenticated with separate token.
|
|
13886
|
+
}
|
|
13887
|
+
});
|
|
13888
|
+
// Handle connection
|
|
13889
|
+
this.socket.on('connect', async () => {
|
|
13890
|
+
Logger.Instance.WriteDevToLog("SubscriberClient connected to server : " + this.socket.id);
|
|
13891
|
+
// Case 2: Subscribe to topics that were subscribed with previous session between client and pubsub middleware.
|
|
13892
|
+
// (reconnected to middleware after a disconnection)
|
|
13893
|
+
if (this.subscribedTopics.size > 0) {
|
|
13894
|
+
await SubscriberClient.SubscribeTopics_Event(this.subscribedTopics, this.socket);
|
|
13895
|
+
}
|
|
13896
|
+
});
|
|
13897
|
+
// Handle disconnection
|
|
13898
|
+
this.socket.on('disconnect', (reason) => {
|
|
13899
|
+
let disconnectReason;
|
|
13900
|
+
switch (reason) {
|
|
13901
|
+
case "ping timeout":
|
|
13902
|
+
disconnectReason = "Connection lost due to timeout";
|
|
13903
|
+
break;
|
|
13904
|
+
case "transport close":
|
|
13905
|
+
disconnectReason = "Network connection closed";
|
|
13906
|
+
break;
|
|
13907
|
+
case "io server disconnect":
|
|
13908
|
+
disconnectReason = "Disconnected by server";
|
|
13909
|
+
break;
|
|
13910
|
+
default:
|
|
13911
|
+
disconnectReason = "Disconnected:";
|
|
13912
|
+
}
|
|
13913
|
+
Logger.Instance.WriteDevToLog("SubscriberClient disconnected from server : " + reason + " : " + disconnectReason);
|
|
13914
|
+
});
|
|
13915
|
+
// Handle reconnection
|
|
13916
|
+
this.socket.on("reconnect", (attemptNumber) => {
|
|
13917
|
+
Logger.Instance.WriteDevToLog("Reconnected after " + attemptNumber + "attempts");
|
|
13918
|
+
});
|
|
13919
|
+
// Handle reconnection attempts
|
|
13920
|
+
this.socket.on("reconnect_attempt", (attemptNumber) => {
|
|
13921
|
+
Logger.Instance.WriteDevToLog("Reconnect attempt: " + attemptNumber);
|
|
13922
|
+
});
|
|
13923
|
+
// Handle reconnection errors
|
|
13924
|
+
this.socket.on("connect_error", (err) => {
|
|
13925
|
+
Logger.Instance.WriteDevToLog("Connection error: " + err.name + " Message: " + err.message);
|
|
13926
|
+
});
|
|
13927
|
+
// Handle subscription confirmation
|
|
13928
|
+
this.socket.on('subscribed', (data) => {
|
|
13929
|
+
this.subscribedTopics.add(data.topic);
|
|
13930
|
+
Logger.Instance.WriteDevToLog("SubscriberClient subscribed to topic : " + data.topic + " : " + data.message);
|
|
13931
|
+
});
|
|
13932
|
+
// Handle unsubscription confirmation
|
|
13933
|
+
this.socket.on('unsubscribed', (data) => {
|
|
13934
|
+
this.subscribedTopics.delete(data.topic);
|
|
13935
|
+
Logger.Instance.WriteDevToLog("SubscriberClient unsubscribed from topic : " + data.topic + " : " + data.message);
|
|
13936
|
+
});
|
|
13937
|
+
// Handle errors
|
|
13938
|
+
this.socket.on('error', (error) => {
|
|
13939
|
+
Logger.Instance.WriteErrorToLog("SubscriberClient error : " + error.message);
|
|
13940
|
+
});
|
|
13941
|
+
// Handle incoming messages
|
|
13942
|
+
this.socket.on('message', (data) => {
|
|
13943
|
+
//this.messageSubject.next(data);
|
|
13944
|
+
Logger.Instance.WriteDevToLog("SubscriberClient received message from topic : " + data.topic + " : " + data.message);
|
|
13945
|
+
EventsManager.Instance.AddTopicPublishedEvent(taskRef, data.topic, data.message);
|
|
13946
|
+
});
|
|
13947
|
+
}
|
|
13948
|
+
/**
|
|
13949
|
+
* Get the singleton instance of SubscriberClient
|
|
13950
|
+
*/
|
|
13951
|
+
static getInstance(task) {
|
|
13952
|
+
if (!SubscriberClient.instance) {
|
|
13953
|
+
SubscriberClient.instance = new SubscriberClient(task);
|
|
13954
|
+
}
|
|
13955
|
+
return SubscriberClient.instance;
|
|
13956
|
+
}
|
|
13957
|
+
/**
|
|
13958
|
+
* Subscribe to multiple topics at once
|
|
13959
|
+
* @param topics Array of topics to subscribe to
|
|
13960
|
+
*/
|
|
13961
|
+
subscribe(topics, token) {
|
|
13962
|
+
let ctxID = ClientManager.Instance.GetRuntimeCtxID();
|
|
13963
|
+
this.socket.emit('subscribe', topics, token, ctxID);
|
|
13964
|
+
// topics.forEach(topic => {
|
|
13965
|
+
// if (!this.subscribedTopics.has(topic)) {
|
|
13966
|
+
//
|
|
13967
|
+
// let ctxID = ClientManager.Instance.GetRuntimeCtxID()
|
|
13968
|
+
// this.socket.emit('subscribe', topic, token, ctxID);
|
|
13969
|
+
// }
|
|
13970
|
+
// });
|
|
13971
|
+
}
|
|
13972
|
+
/**
|
|
13973
|
+
* Unsubscribe from multiple topics at once
|
|
13974
|
+
* @param topics Array of topics to unsubscribe from
|
|
13975
|
+
*/
|
|
13976
|
+
unsubscribe(topics) {
|
|
13977
|
+
topics.forEach(topic => {
|
|
13978
|
+
if (this.subscribedTopics.has(topic)) {
|
|
13979
|
+
this.socket.emit('unsubscribe', topic);
|
|
13980
|
+
}
|
|
13981
|
+
});
|
|
13982
|
+
}
|
|
13983
|
+
/**
|
|
13984
|
+
* Unsubscribe from all topics
|
|
13985
|
+
* 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.
|
|
13986
|
+
*/
|
|
13987
|
+
unsubscribeFromAll() {
|
|
13988
|
+
this.subscribedTopics.forEach(topic => this.socket.emit('unsubscribe', topic));
|
|
13989
|
+
}
|
|
13990
|
+
/**
|
|
13991
|
+
* Disconnect from the server
|
|
13992
|
+
* TODO: To be called when client explicitly disconnects from the server.
|
|
13993
|
+
*/
|
|
13994
|
+
disconnect() {
|
|
13995
|
+
this.socket.disconnect();
|
|
13996
|
+
}
|
|
13997
|
+
static async SubscribeTopics(topics, socket) {
|
|
13998
|
+
if (this.SubscribeTopics_Event !== null)
|
|
13999
|
+
this.SubscribeTopics_Event(topics, socket);
|
|
14000
|
+
}
|
|
14001
|
+
}
|
|
14002
|
+
|
|
13827
14003
|
class ExpressionEvaluator extends GuiExpressionEvaluator {
|
|
13828
14004
|
static ASTERISK_CHR = String.fromCharCode(1);
|
|
13829
14005
|
static QUESTION_CHR = String.fromCharCode(2);
|
|
@@ -15464,6 +15640,34 @@ class ExpressionEvaluator extends GuiExpressionEvaluator {
|
|
|
15464
15640
|
this.eval_op_Hash(val1, val2, resVal);
|
|
15465
15641
|
expStrTracker.resetNullResult();
|
|
15466
15642
|
break;
|
|
15643
|
+
case ExpressionInterface.EXP_OP_SUBSCRIBE:
|
|
15644
|
+
resVal.Attr = StorageAttribute.BOOLEAN;
|
|
15645
|
+
this.eval_op_Subscribe(valStack);
|
|
15646
|
+
break;
|
|
15647
|
+
case ExpressionInterface.EXP_OP_UNSUBSCRIBE:
|
|
15648
|
+
resVal.Attr = StorageAttribute.BOOLEAN;
|
|
15649
|
+
resVal.BoolVal = this.eval_op_UnSubscribe(valStack);
|
|
15650
|
+
break;
|
|
15651
|
+
case ExpressionInterface.EXP_OP_LOCALTOUTC:
|
|
15652
|
+
val4 = valStack.pop(); // UTC date output variable
|
|
15653
|
+
val3 = valStack.pop(); // UTC time output variable
|
|
15654
|
+
val2 = valStack.pop(); // local date
|
|
15655
|
+
val1 = valStack.pop(); // local time
|
|
15656
|
+
await this.eval_op_localToUTC(resVal, val1, val2, val3, val4);
|
|
15657
|
+
break;
|
|
15658
|
+
case ExpressionInterface.EXP_OP_UTCTOLOCAL:
|
|
15659
|
+
val4 = valStack.pop(); // local date output variable
|
|
15660
|
+
val3 = valStack.pop(); // local time output variable
|
|
15661
|
+
val2 = valStack.pop(); // UTC date
|
|
15662
|
+
val1 = valStack.pop(); // UTC time
|
|
15663
|
+
await this.eval_op_utcToLocal(resVal, val1, val2, val3, val4);
|
|
15664
|
+
break;
|
|
15665
|
+
case ExpressionInterface.EXP_OP_ROUTEPARAMCOUNTGET:
|
|
15666
|
+
this.eval_op_route_param_count_get(resVal);
|
|
15667
|
+
break;
|
|
15668
|
+
case ExpressionInterface.EXP_OP_ROUTEPARAMGET:
|
|
15669
|
+
this.eval_op_route_param_get(valStack.pop(), resVal);
|
|
15670
|
+
break;
|
|
15467
15671
|
default:
|
|
15468
15672
|
return;
|
|
15469
15673
|
}
|
|
@@ -16378,6 +16582,217 @@ class ExpressionEvaluator extends GuiExpressionEvaluator {
|
|
|
16378
16582
|
resVal.Attr = StorageAttribute.BOOLEAN;
|
|
16379
16583
|
resVal.BoolVal = true;
|
|
16380
16584
|
}
|
|
16585
|
+
/**
|
|
16586
|
+
* Safely extracts date/time parts from a JS Date using Intl.DateTimeFormat.
|
|
16587
|
+
*
|
|
16588
|
+
* WHY: Native JS Date has known pitfalls — century year bug (year < 100 mapped to 1900+year),
|
|
16589
|
+
* silent leap year rollovers, DST gaps, and 0-based months. Intl.DateTimeFormat avoids all
|
|
16590
|
+
* of these by using the browser's IANA timezone database internally.
|
|
16591
|
+
*
|
|
16592
|
+
* Used by both eval_op_localToUTC and eval_op_utcToLocal as a single safe extraction point.
|
|
16593
|
+
*
|
|
16594
|
+
* @param date - A valid JS Date object
|
|
16595
|
+
* @param timeZone - IANA timezone string (e.g. 'Asia/Kolkata', 'UTC').
|
|
16596
|
+
* Defaults to browser's local timezone — correct for any user, any country.
|
|
16597
|
+
* @returns Parsed parts (month is 1-based) or null if date is invalid
|
|
16598
|
+
*/
|
|
16599
|
+
convertDateTimeParts(date, timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone) {
|
|
16600
|
+
if (!date || isNaN(date.getTime()))
|
|
16601
|
+
return null;
|
|
16602
|
+
// 'en-CA' locale formats date as YYYY-MM-DD — unambiguous and consistent across
|
|
16603
|
+
// all browsers. Other locales like en-US (MM/DD/YYYY) or en-GB (DD/MM/YYYY) can
|
|
16604
|
+
// behave differently across Chrome, Firefox and Safari. Nothing to do with Canada.
|
|
16605
|
+
const formatter = new Intl.DateTimeFormat('en-CA', {
|
|
16606
|
+
timeZone,
|
|
16607
|
+
year: 'numeric',
|
|
16608
|
+
month: '2-digit',
|
|
16609
|
+
day: '2-digit',
|
|
16610
|
+
hour: '2-digit',
|
|
16611
|
+
minute: '2-digit',
|
|
16612
|
+
second: '2-digit',
|
|
16613
|
+
hour12: false
|
|
16614
|
+
});
|
|
16615
|
+
const parts = formatter.formatToParts(date);
|
|
16616
|
+
const get = (type) => {
|
|
16617
|
+
const part = parts.find(p => p.type === type);
|
|
16618
|
+
if (!part)
|
|
16619
|
+
throw new Error(`Missing date part: ${type}`);
|
|
16620
|
+
return parseInt(part.value, 10);
|
|
16621
|
+
};
|
|
16622
|
+
try {
|
|
16623
|
+
const hour = get('hour');
|
|
16624
|
+
return {
|
|
16625
|
+
year: get('year'),
|
|
16626
|
+
month: get('month'), // 1-based because Intl returns display month (1–12), unlike JS Date.getMonth() which is 0-based
|
|
16627
|
+
day: get('day'),
|
|
16628
|
+
hour: hour === 24 ? 0 : hour, // normalize midnight — some browsers return 24 instead of 0
|
|
16629
|
+
minute: get('minute'),
|
|
16630
|
+
second: get('second')
|
|
16631
|
+
};
|
|
16632
|
+
}
|
|
16633
|
+
catch {
|
|
16634
|
+
return null;
|
|
16635
|
+
}
|
|
16636
|
+
}
|
|
16637
|
+
/**
|
|
16638
|
+
* Validates that a time value (in total seconds) is within a valid day range
|
|
16639
|
+
*/
|
|
16640
|
+
isValidTimeSec(timeSec) {
|
|
16641
|
+
return Number.isInteger(timeSec) && timeSec >= 0 && timeSec <= 86399;
|
|
16642
|
+
}
|
|
16643
|
+
/**
|
|
16644
|
+
* Splits total seconds since midnight into hours, minutes, seconds.
|
|
16645
|
+
* e.g. 3661 → { hours: 1, minutes: 1, seconds: 1 }
|
|
16646
|
+
*/
|
|
16647
|
+
splitTimeSec(timeSec) {
|
|
16648
|
+
return {
|
|
16649
|
+
hours: Math.floor(timeSec / 3600),
|
|
16650
|
+
minutes: Math.floor((timeSec % 3600) / 60),
|
|
16651
|
+
seconds: timeSec % 60
|
|
16652
|
+
};
|
|
16653
|
+
}
|
|
16654
|
+
/**
|
|
16655
|
+
* Writes a time (seconds) and date (Magic numeric) into their respective output fields.
|
|
16656
|
+
*/
|
|
16657
|
+
async writeDateTimeToFields(timeFld, dateTimeSec, dateFld, dateVal) {
|
|
16658
|
+
const tmpVal = new ExpVal();
|
|
16659
|
+
tmpVal.MgNumVal = new NUM_TYPE();
|
|
16660
|
+
tmpVal.Attr = StorageAttribute.TIME;
|
|
16661
|
+
tmpVal.MgNumVal.NUM_4_LONG(dateTimeSec);
|
|
16662
|
+
await timeFld.setValueAndStartRecompute(tmpVal.ToMgVal(), false, true, false, false);
|
|
16663
|
+
await timeFld.updateDisplay();
|
|
16664
|
+
tmpVal.Attr = StorageAttribute.DATE;
|
|
16665
|
+
tmpVal.MgNumVal.NUM_4_LONG(dateVal);
|
|
16666
|
+
await dateFld.setValueAndStartRecompute(tmpVal.ToMgVal(), false, true, false, false);
|
|
16667
|
+
await dateFld.updateDisplay();
|
|
16668
|
+
}
|
|
16669
|
+
/**
|
|
16670
|
+
* Converts local date/time to UTC and writes the result into output fields.
|
|
16671
|
+
*
|
|
16672
|
+
* Edge cases handled:
|
|
16673
|
+
* - Century years — setFullYear() avoids JS year < 100 bug
|
|
16674
|
+
* - Leap years — round-trip validation catches silent date rollovers
|
|
16675
|
+
* - DST gaps — Intl.DateTimeFormat resolves correctly per IANA tz rules
|
|
16676
|
+
* - DST ambiguity — Intl uses first occurrence consistently
|
|
16677
|
+
* - Cross-midnight — JS Date handles automatically
|
|
16678
|
+
* - Out-of-range — time < 0 or > 86399 explicitly rejected
|
|
16679
|
+
*
|
|
16680
|
+
* @param resVal - Output: Boolean result (true = success)
|
|
16681
|
+
* @param localTimeVal - Input: Local time as total seconds since midnight (Magic numeric)
|
|
16682
|
+
* @param localDateVal - Input: Local date as Magic numeric
|
|
16683
|
+
* @param utcTimeVar - Input: Field index for the UTC time output field
|
|
16684
|
+
* @param utcDateVar - Input: Field index for the UTC date output field
|
|
16685
|
+
*/
|
|
16686
|
+
async eval_op_localToUTC(resVal, localTimeVal, localDateVal, utcTimeVar, utcDateVar) {
|
|
16687
|
+
resVal.Attr = StorageAttribute.BOOLEAN;
|
|
16688
|
+
resVal.BoolVal = false;
|
|
16689
|
+
// Guard: all four numeric values must be present
|
|
16690
|
+
if (localTimeVal.MgNumVal === null || localDateVal.MgNumVal === null ||
|
|
16691
|
+
utcTimeVar.MgNumVal === null || utcDateVar.MgNumVal === null) {
|
|
16692
|
+
return;
|
|
16693
|
+
}
|
|
16694
|
+
// Fetch output fields
|
|
16695
|
+
const utcDateFld = this.GetFieldOfContextTask(utcDateVar.MgNumVal.NUM_2_LONG());
|
|
16696
|
+
const utcTimeFld = this.GetFieldOfContextTask(utcTimeVar.MgNumVal.NUM_2_LONG());
|
|
16697
|
+
if (utcTimeFld === null || utcDateFld === null)
|
|
16698
|
+
return;
|
|
16699
|
+
// Break the input date into parts
|
|
16700
|
+
const dateParts = new DateBreakParams();
|
|
16701
|
+
DisplayConvertor.Instance.date_break_datemode(dateParts, localDateVal.MgNumVal.NUM_2_LONG(), true, this.ExpTask.getCompIdx());
|
|
16702
|
+
// Reject zero/uninitialized Magic date parts
|
|
16703
|
+
if (dateParts.year === 0 || dateParts.month === 0 || dateParts.day === 0)
|
|
16704
|
+
return;
|
|
16705
|
+
// Guard: reject out-of-range time value
|
|
16706
|
+
const localTimeSec = localTimeVal.MgNumVal.NUM_2_LONG();
|
|
16707
|
+
if (!this.isValidTimeSec(localTimeSec))
|
|
16708
|
+
return;
|
|
16709
|
+
const { hours, minutes, seconds } = this.splitTimeSec(localTimeSec);
|
|
16710
|
+
// Use setFullYear to avoid JS bug where new Date(year < 100, ...) maps to 1900+year
|
|
16711
|
+
const localDateTime = new Date(0);
|
|
16712
|
+
localDateTime.setFullYear(dateParts.year, dateParts.month - 1, dateParts.day);
|
|
16713
|
+
localDateTime.setHours(hours, minutes, seconds, 0);
|
|
16714
|
+
// Guard: round-trip check catches silent rollovers (e.g. Feb 29 on non-leap year)
|
|
16715
|
+
if (localDateTime.getFullYear() !== dateParts.year ||
|
|
16716
|
+
localDateTime.getMonth() !== dateParts.month - 1 ||
|
|
16717
|
+
localDateTime.getDate() !== dateParts.day) {
|
|
16718
|
+
return;
|
|
16719
|
+
}
|
|
16720
|
+
if (isNaN(localDateTime.getTime()))
|
|
16721
|
+
return;
|
|
16722
|
+
// Extract UTC parts via Intl — DST, leap year, century year all handled automatically
|
|
16723
|
+
const utcParts = this.convertDateTimeParts(localDateTime, 'UTC');
|
|
16724
|
+
if (utcParts === null)
|
|
16725
|
+
return;
|
|
16726
|
+
const utcTime = utcParts.hour * 3600 + utcParts.minute * 60 + utcParts.second;
|
|
16727
|
+
const utcDate = DisplayConvertor.Instance.date_4_calender(utcParts.year, utcParts.month, utcParts.day, 1, false // month already 1-based
|
|
16728
|
+
);
|
|
16729
|
+
await this.writeDateTimeToFields(utcTimeFld, utcTime, utcDateFld, utcDate);
|
|
16730
|
+
resVal.BoolVal = true;
|
|
16731
|
+
}
|
|
16732
|
+
/**
|
|
16733
|
+
* Converts UTC date/time to local and writes the result into output fields.
|
|
16734
|
+
*
|
|
16735
|
+
* Edge cases handled:
|
|
16736
|
+
* - Century years — Date.UTC() does not have the year < 100 bug
|
|
16737
|
+
* - Leap years — round-trip validation catches silent date rollovers
|
|
16738
|
+
* - DST gaps — Intl.DateTimeFormat resolves to correct local time automatically
|
|
16739
|
+
* - DST ambiguity — Intl uses first occurrence consistently
|
|
16740
|
+
* - Cross-midnight — JS Date handles automatically
|
|
16741
|
+
* - Out-of-range — time < 0 or > 86399 explicitly rejected
|
|
16742
|
+
*
|
|
16743
|
+
* @param resVal - Output: Boolean result (true = success)
|
|
16744
|
+
* @param utcTimeVal - Input: UTC time as total seconds since midnight (Magic numeric)
|
|
16745
|
+
* @param utcDateVal - Input: UTC date as Magic numeric
|
|
16746
|
+
* @param localTimeVar - Input: Field index for the local time output field
|
|
16747
|
+
* @param localDateVar - Input: Field index for the local date output field
|
|
16748
|
+
*/
|
|
16749
|
+
async eval_op_utcToLocal(resVal, utcTimeVal, utcDateVal, localTimeVar, localDateVar) {
|
|
16750
|
+
resVal.Attr = StorageAttribute.BOOLEAN;
|
|
16751
|
+
resVal.BoolVal = false;
|
|
16752
|
+
// Guard: all four numeric values must be present
|
|
16753
|
+
if (utcTimeVal.MgNumVal === null || utcDateVal.MgNumVal === null ||
|
|
16754
|
+
localTimeVar.MgNumVal === null || localDateVar.MgNumVal === null) {
|
|
16755
|
+
return;
|
|
16756
|
+
}
|
|
16757
|
+
// Fetch output fields
|
|
16758
|
+
const localDateFld = this.GetFieldOfContextTask(localDateVar.MgNumVal.NUM_2_LONG());
|
|
16759
|
+
const localTimeFld = this.GetFieldOfContextTask(localTimeVar.MgNumVal.NUM_2_LONG());
|
|
16760
|
+
if (localTimeFld === null || localDateFld === null)
|
|
16761
|
+
return;
|
|
16762
|
+
// Break the input date into parts
|
|
16763
|
+
const dateParts = new DateBreakParams();
|
|
16764
|
+
DisplayConvertor.Instance.date_break_datemode(dateParts, utcDateVal.MgNumVal.NUM_2_LONG(), true, this.ExpTask.getCompIdx());
|
|
16765
|
+
// Reject zero/uninitialized Magic date parts
|
|
16766
|
+
if (dateParts.year === 0 || dateParts.month === 0 || dateParts.day === 0)
|
|
16767
|
+
return;
|
|
16768
|
+
// Guard: reject out-of-range time value
|
|
16769
|
+
const utcTimeSec = utcTimeVal.MgNumVal.NUM_2_LONG();
|
|
16770
|
+
if (!this.isValidTimeSec(utcTimeSec))
|
|
16771
|
+
return;
|
|
16772
|
+
const { hours, minutes, seconds } = this.splitTimeSec(utcTimeSec);
|
|
16773
|
+
// Why Date.UTC() instead of new Date(year, month, day, ...)?
|
|
16774
|
+
// JS has a bug: new Date(99, 0, 1) does not give year 99 — it gives 1999.
|
|
16775
|
+
// Date.UTC() always uses the exact year provided — safe for century years like 1900, 2000, 2100
|
|
16776
|
+
const utcDateTime = new Date(Date.UTC(dateParts.year, dateParts.month - 1, dateParts.day, hours, minutes, seconds, 0));
|
|
16777
|
+
// Guard: round-trip check catches silent rollovers (e.g. Feb 29 on non-leap year)
|
|
16778
|
+
if (utcDateTime.getUTCFullYear() !== dateParts.year ||
|
|
16779
|
+
utcDateTime.getUTCMonth() !== dateParts.month - 1 ||
|
|
16780
|
+
utcDateTime.getUTCDate() !== dateParts.day) {
|
|
16781
|
+
return;
|
|
16782
|
+
}
|
|
16783
|
+
if (isNaN(utcDateTime.getTime()))
|
|
16784
|
+
return;
|
|
16785
|
+
// Extract local datetime parts via Intl — no timeZone arg = browser's local timezone
|
|
16786
|
+
// DST, leap year, century year all handled automatically
|
|
16787
|
+
const localParts = this.convertDateTimeParts(utcDateTime);
|
|
16788
|
+
if (localParts === null)
|
|
16789
|
+
return;
|
|
16790
|
+
const localTime = localParts.hour * 3600 + localParts.minute * 60 + localParts.second;
|
|
16791
|
+
const localDate = DisplayConvertor.Instance.date_4_calender(localParts.year, localParts.month, localParts.day, 1, false // month already 1-based
|
|
16792
|
+
);
|
|
16793
|
+
await this.writeDateTimeToFields(localTimeFld, localTime, localDateFld, localDate);
|
|
16794
|
+
resVal.BoolVal = true;
|
|
16795
|
+
}
|
|
16381
16796
|
eval_op_ndow(resVal, val1, displayConvertor) {
|
|
16382
16797
|
if (val1.MgNumVal === null) {
|
|
16383
16798
|
super.SetNULL(resVal, StorageAttribute.NUMERIC);
|
|
@@ -18477,6 +18892,31 @@ class ExpressionEvaluator extends GuiExpressionEvaluator {
|
|
|
18477
18892
|
resVal.IsNull = false;
|
|
18478
18893
|
resVal.StrVal = Commands.getLastRoute();
|
|
18479
18894
|
}
|
|
18895
|
+
eval_op_route_param_count_get(resVal) {
|
|
18896
|
+
resVal.Attr = StorageAttribute.NUMERIC;
|
|
18897
|
+
resVal.IsNull = false;
|
|
18898
|
+
resVal.MgNumVal = new NUM_TYPE();
|
|
18899
|
+
let rtEvnt = AccessHelper.eventsManager.getLastRtEvent();
|
|
18900
|
+
if (rtEvnt !== null && rtEvnt.getInternalCode() === InternalInterface.MG_ACT_WEBCLIENT_ROUTE) {
|
|
18901
|
+
let params = rtEvnt.getRouteParamList();
|
|
18902
|
+
resVal.MgNumVal.NUM_4_LONG(params.length);
|
|
18903
|
+
}
|
|
18904
|
+
}
|
|
18905
|
+
eval_op_route_param_get(val1, resVal) {
|
|
18906
|
+
resVal.Attr = StorageAttribute.UNICODE;
|
|
18907
|
+
resVal.IsNull = false;
|
|
18908
|
+
resVal.StrVal = '';
|
|
18909
|
+
if (val1.MgNumVal === null)
|
|
18910
|
+
return;
|
|
18911
|
+
let index = val1.MgNumVal.NUM_2_LONG();
|
|
18912
|
+
let rtEvnt = AccessHelper.eventsManager.getLastRtEvent();
|
|
18913
|
+
if (rtEvnt !== null && rtEvnt.getInternalCode() === InternalInterface.MG_ACT_WEBCLIENT_ROUTE) {
|
|
18914
|
+
let params = rtEvnt.getRouteParamList();
|
|
18915
|
+
if (params !== null && index > 0 && index <= params.length) {
|
|
18916
|
+
resVal.StrVal = params.get_Item(index - 1);
|
|
18917
|
+
}
|
|
18918
|
+
}
|
|
18919
|
+
}
|
|
18480
18920
|
params2arguments(Exp_params, startAt, count) {
|
|
18481
18921
|
let NULL_STR = '';
|
|
18482
18922
|
let attr = new Array();
|
|
@@ -18556,6 +18996,46 @@ class ExpressionEvaluator extends GuiExpressionEvaluator {
|
|
|
18556
18996
|
}
|
|
18557
18997
|
return CryptoJS.lib.WordArray.create(words, u8.length);
|
|
18558
18998
|
}
|
|
18999
|
+
async eval_op_Subscribe(valStack) {
|
|
19000
|
+
let nArgs = valStack.pop();
|
|
19001
|
+
let result = false;
|
|
19002
|
+
if (nArgs > 0) {
|
|
19003
|
+
// get the parameters
|
|
19004
|
+
let Exp_params = new Array(nArgs);
|
|
19005
|
+
for (let j = 0; j < nArgs; j++) {
|
|
19006
|
+
Exp_params[nArgs - 1 - j] = valStack.pop();
|
|
19007
|
+
}
|
|
19008
|
+
let topics = this.params2arguments(Exp_params, 0, Exp_params.length);
|
|
19009
|
+
let token = await RemoteCommandsProcessor.GetInstance().GetSubscriptionTokenFromServer(topics);
|
|
19010
|
+
let sc = SubscriberClient.getInstance(this.ExpTask);
|
|
19011
|
+
sc.subscribe(topics, token);
|
|
19012
|
+
result = true;
|
|
19013
|
+
}
|
|
19014
|
+
else {
|
|
19015
|
+
Logger.Instance.WriteExceptionToLogWithMsg('ExpressionEvaluator.Subscribe() there is problem with the arguments');
|
|
19016
|
+
result = false;
|
|
19017
|
+
}
|
|
19018
|
+
return result;
|
|
19019
|
+
}
|
|
19020
|
+
eval_op_UnSubscribe(valStack) {
|
|
19021
|
+
let nArgs = valStack.pop();
|
|
19022
|
+
let result = false;
|
|
19023
|
+
if (nArgs > 0) {
|
|
19024
|
+
// get the parameters
|
|
19025
|
+
let Exp_params = new Array(nArgs);
|
|
19026
|
+
for (let j = 0; j < nArgs; j++) {
|
|
19027
|
+
Exp_params[nArgs - 1 - j] = valStack.pop();
|
|
19028
|
+
}
|
|
19029
|
+
let sc = SubscriberClient.getInstance(this.ExpTask);
|
|
19030
|
+
let topics = this.params2arguments(Exp_params, 0, Exp_params.length);
|
|
19031
|
+
sc.unsubscribe(topics);
|
|
19032
|
+
}
|
|
19033
|
+
else {
|
|
19034
|
+
Logger.Instance.WriteExceptionToLogWithMsg('ExpressionEvaluator.UnSubscribe() there is problem with the arguments');
|
|
19035
|
+
result = false;
|
|
19036
|
+
}
|
|
19037
|
+
return result;
|
|
19038
|
+
}
|
|
18559
19039
|
}
|
|
18560
19040
|
/// <summary>
|
|
18561
19041
|
/// This exception used when at least one of the operands is null
|
|
@@ -32592,6 +33072,7 @@ class Task extends TaskBase {
|
|
|
32592
33072
|
enable = await this.checkProp(PropInterface.PROP_TYPE_TASK_PROPERTIES_ALLOW_INDEX, true);
|
|
32593
33073
|
this.ActionManager.enable(InternalInterface.MG_ACT_VIEW_BY_KEY, enable);
|
|
32594
33074
|
this.ActionManager.enable(InternalInterface.MG_ACT_DUMP_ENVIRONMENT, true);
|
|
33075
|
+
this.ActionManager.enable(InternalInterface.MG_ACT_PUBSUB_TOPIC_PUBLISHED, true);
|
|
32595
33076
|
}
|
|
32596
33077
|
/// <summary>
|
|
32597
33078
|
/// set hasZoomHandler to true
|
|
@@ -34814,6 +35295,22 @@ class EventsManager {
|
|
|
34814
35295
|
}
|
|
34815
35296
|
}
|
|
34816
35297
|
/// <summary>
|
|
35298
|
+
/// Add internal to handle published topic from pubsub middleware
|
|
35299
|
+
/// </summary>
|
|
35300
|
+
/// <param name = "task"> control </param>
|
|
35301
|
+
/// <param name = "topic"> value of control </param>
|
|
35302
|
+
/// <param name = "message"> refresh display </param>
|
|
35303
|
+
AddTopicPublishedEvent(task, topic, message) {
|
|
35304
|
+
const rtEvt = new RunTimeEvent(task); //, false);
|
|
35305
|
+
rtEvt.setInternal(InternalInterface.MG_ACT_PUBSUB_TOPIC_PUBLISHED);
|
|
35306
|
+
let argsList = new Array(2);
|
|
35307
|
+
argsList[0] = new ExpVal(StorageAttribute.ALPHA, false, topic);
|
|
35308
|
+
argsList[1] = new ExpVal(StorageAttribute.ALPHA, false, message);
|
|
35309
|
+
let args = new ArgumentsList(argsList);
|
|
35310
|
+
rtEvt.setArgList(args);
|
|
35311
|
+
this.addToTail(rtEvt);
|
|
35312
|
+
}
|
|
35313
|
+
/// <summary>
|
|
34817
35314
|
/// Add internal event ro set the value of control
|
|
34818
35315
|
/// </summary>
|
|
34819
35316
|
/// <param name = "ctrl"> control </param>
|
|
@@ -39642,7 +40139,7 @@ class CommandsTable {
|
|
|
39642
40139
|
}
|
|
39643
40140
|
}
|
|
39644
40141
|
|
|
39645
|
-
let CurrentClientVersion = '4.1300.0-dev4130.
|
|
40142
|
+
let CurrentClientVersion = '4.1300.0-dev4130.233';
|
|
39646
40143
|
|
|
39647
40144
|
// @dynamic
|
|
39648
40145
|
class ClientManager {
|
|
@@ -40256,5 +40753,5 @@ class DataSourceIdKey {
|
|
|
40256
40753
|
* Generated bundle index. Do not edit.
|
|
40257
40754
|
*/
|
|
40258
40755
|
|
|
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 };
|
|
40756
|
+
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
40757
|
//# sourceMappingURL=magic-xpa-engine.mjs.map
|