@magic-xpa/engine 4.1100.0-dev4110.26 → 4.1100.0-dev4110.260

Sign up to get free protection for your applications and to get access to all the features.
Files changed (491) hide show
  1. package/{esm2020 → esm2022}/index.mjs +188 -188
  2. package/{esm2020 → esm2022}/magic-xpa-engine.mjs +1 -1
  3. package/esm2022/src/AccessHelper.mjs +15 -0
  4. package/esm2022/src/ClientManager.mjs +418 -0
  5. package/esm2022/src/CommandsProcessorBase.mjs +56 -0
  6. package/{esm2020 → esm2022}/src/CommandsProcessorManager.mjs +25 -25
  7. package/esm2022/src/CommandsTable.mjs +162 -0
  8. package/esm2022/src/ConstInterface.mjs +517 -0
  9. package/{esm2020 → esm2022}/src/CurrentClientVersion.mjs +2 -2
  10. package/esm2022/src/FlowMonitorInterface.mjs +16 -0
  11. package/esm2022/src/GUIManager.mjs +62 -0
  12. package/esm2022/src/GlobalCommandsManager.mjs +34 -0
  13. package/esm2022/src/GuiEventsProcessor.mjs +156 -0
  14. package/{esm2020 → esm2022}/src/ICommandsTable.mjs +1 -1
  15. package/esm2022/src/ServerConfig.mjs +122 -0
  16. package/{esm2020 → esm2022}/src/bridge/IGuiEvent.mjs +19 -19
  17. package/esm2022/src/bridge/MagicBridge.mjs +41 -0
  18. package/esm2022/src/commands/ClientOriginatedCommandTaskTag.mjs +12 -0
  19. package/{esm2020 → esm2022}/src/commands/ClientToServer/AddUserLocateDataViewCommand.mjs +8 -8
  20. package/{esm2020 → esm2022}/src/commands/ClientToServer/AddUserRangeDataviewCommand.mjs +9 -9
  21. package/{esm2020 → esm2022}/src/commands/ClientToServer/AddUserSortDataViewCommand.mjs +9 -9
  22. package/esm2022/src/commands/ClientToServer/BrowserEscEventCommand.mjs +26 -0
  23. package/{esm2020 → esm2022}/src/commands/ClientToServer/ClientOriginatedCommand.mjs +14 -14
  24. package/{esm2020 → esm2022}/src/commands/ClientToServer/ClientOriginatedCommandSerializer.mjs +59 -59
  25. package/esm2022/src/commands/ClientToServer/ColumnSortEventCommand.mjs +29 -0
  26. package/esm2022/src/commands/ClientToServer/CommandFactory.mjs +261 -0
  27. package/esm2022/src/commands/ClientToServer/CommandSerializationHelper.mjs +67 -0
  28. package/esm2022/src/commands/ClientToServer/ComputeEventCommand.mjs +26 -0
  29. package/{esm2020 → esm2022}/src/commands/ClientToServer/ContextTerminationEventCommand.mjs +24 -21
  30. package/{esm2020 → esm2022}/src/commands/ClientToServer/ContextTimeoutResetCommand.mjs +23 -20
  31. package/{esm2020 → esm2022}/src/commands/ClientToServer/ControlItemsRefreshCommand.mjs +8 -8
  32. package/esm2022/src/commands/ClientToServer/DataViewOutputCommand.mjs +13 -0
  33. package/{esm2020 → esm2022}/src/commands/ClientToServer/DataviewCommand.mjs +44 -44
  34. package/esm2022/src/commands/ClientToServer/EvaluateCommand.mjs +40 -0
  35. package/{esm2020 → esm2022}/src/commands/ClientToServer/EventCommand.mjs +43 -40
  36. package/esm2022/src/commands/ClientToServer/ExecOperCommand.mjs +70 -0
  37. package/esm2022/src/commands/ClientToServer/FetchDataControlValuesEventCommand.mjs +25 -0
  38. package/{esm2020 → esm2022}/src/commands/ClientToServer/GlobalParamsQueryCommand.mjs +10 -10
  39. package/{esm2020 → esm2022}/src/commands/ClientToServer/ICommandTaskTag.mjs +1 -1
  40. package/esm2022/src/commands/ClientToServer/IndexChangeEventCommand.mjs +24 -0
  41. package/esm2022/src/commands/ClientToServer/IniputForceWriteCommand.mjs +26 -0
  42. package/{esm2020 → esm2022}/src/commands/ClientToServer/NonReversibleExitEventCommand.mjs +26 -23
  43. package/{esm2020 → esm2022}/src/commands/ClientToServer/QueryCommand.mjs +20 -20
  44. package/esm2022/src/commands/ClientToServer/RecomputeCommand.mjs +30 -0
  45. package/esm2022/src/commands/ClientToServer/RefreshEventCommand.mjs +30 -0
  46. package/esm2022/src/commands/ClientToServer/RefreshScreenEventCommand.mjs +27 -0
  47. package/esm2022/src/commands/ClientToServer/RollbackEventCommand.mjs +43 -0
  48. package/esm2022/src/commands/ClientToServer/SelectProgramCommand.mjs +19 -0
  49. package/{esm2020 → esm2022}/src/commands/ClientToServer/SetTransactionStateDataviewCommand.mjs +9 -9
  50. package/esm2022/src/commands/ClientToServer/SubformOpenEventCommand.mjs +24 -0
  51. package/esm2022/src/commands/ClientToServer/SubformRefreshEventCommand.mjs +27 -0
  52. package/esm2022/src/commands/ClientToServer/TransactionCommand.mjs +34 -0
  53. package/{esm2020 → esm2022}/src/commands/ClientToServer/UnloadCommand.mjs +18 -15
  54. package/esm2022/src/commands/ClientToServer/WriteMessageToServerLogCommand.mjs +18 -0
  55. package/esm2022/src/commands/DataViewCommandBase.mjs +8 -0
  56. package/{esm2020 → esm2022}/src/commands/IClientCommand.mjs +1 -1
  57. package/esm2022/src/commands/IClientTargetedCommand.mjs +13 -0
  58. package/{esm2020 → esm2022}/src/commands/IClientToServerCommandInfo.mjs +2 -2
  59. package/esm2022/src/commands/ServerToClient/AbortCommand.mjs +65 -0
  60. package/{esm2020 → esm2022}/src/commands/ServerToClient/AddLocateCommand.mjs +21 -21
  61. package/{esm2020 → esm2022}/src/commands/ServerToClient/AddRangeCommand.mjs +62 -62
  62. package/{esm2020 → esm2022}/src/commands/ServerToClient/AddSortCommand.mjs +33 -33
  63. package/esm2022/src/commands/ServerToClient/ClientRefreshCommand.mjs +25 -0
  64. package/esm2022/src/commands/ServerToClient/ClientTargetedCommandBase.mjs +24 -0
  65. package/esm2022/src/commands/ServerToClient/EnhancedVerifyCommand.mjs +45 -0
  66. package/esm2022/src/commands/ServerToClient/OpenURLCommand.mjs +221 -0
  67. package/{esm2020 → esm2022}/src/commands/ServerToClient/ResetLocateCommand.mjs +14 -14
  68. package/{esm2020 → esm2022}/src/commands/ServerToClient/ResetRangeCommand.mjs +14 -14
  69. package/{esm2020 → esm2022}/src/commands/ServerToClient/ResetSortCommand.mjs +14 -14
  70. package/esm2022/src/commands/ServerToClient/ResultCommand.mjs +37 -0
  71. package/esm2022/src/commands/ServerToClient/VerifyCommand.mjs +83 -0
  72. package/{esm2020 → esm2022}/src/commands/ServerToClient/XMLBasedCommandBuilder.mjs +132 -132
  73. package/{esm2020 → esm2022}/src/communications/IConnectionStateManager.mjs +1 -1
  74. package/esm2022/src/communications/InteractiveCommunicationsFailureHandler.mjs +15 -0
  75. package/{esm2020 → esm2022}/src/data/DataSourceIdKey.mjs +2 -2
  76. package/esm2022/src/data/DataView.mjs +1613 -0
  77. package/{esm2020 → esm2022}/src/data/DataViewBase.mjs +3 -3
  78. package/esm2022/src/data/DataviewManager.mjs +28 -0
  79. package/esm2022/src/data/DataviewManagerBase.mjs +15 -0
  80. package/esm2022/src/data/DvCache.mjs +67 -0
  81. package/esm2022/src/data/Field.mjs +646 -0
  82. package/esm2022/src/data/FieldBase.mjs +15 -0
  83. package/esm2022/src/data/FieldsTable.mjs +103 -0
  84. package/{esm2020 → esm2022}/src/data/IRecordsTable.mjs +1 -1
  85. package/{esm2020 → esm2022}/src/data/Key.mjs +88 -88
  86. package/esm2022/src/data/Record.mjs +880 -0
  87. package/{esm2020 → esm2022}/src/data/RecordOutOfDataViewException.mjs +15 -15
  88. package/esm2022/src/data/RecordsTable.mjs +267 -0
  89. package/{esm2020 → esm2022}/src/data/TaskTransactionManager.mjs +107 -103
  90. package/{esm2020 → esm2022}/src/data/XMLBasedDcValuesBuilder.mjs +74 -74
  91. package/{esm2020 → esm2022}/src/enums.mjs +23 -23
  92. package/esm2022/src/env/EnvVariablesTable.mjs +340 -0
  93. package/esm2022/src/env/Environment.mjs +487 -0
  94. package/{esm2020 → esm2022}/src/env/ILanguageData.mjs +1 -1
  95. package/esm2022/src/env/LanguageData.mjs +227 -0
  96. package/{esm2020 → esm2022}/src/env/MirrorString.mjs +65 -65
  97. package/esm2022/src/event/ActionManager.mjs +91 -0
  98. package/esm2022/src/event/Event.mjs +1333 -0
  99. package/esm2022/src/event/EventHandler.mjs +766 -0
  100. package/esm2022/src/event/EventHandlerPosition.mjs +204 -0
  101. package/esm2022/src/event/EventsManager.mjs +2988 -0
  102. package/{esm2020 → esm2022}/src/event/IEventsManager.mjs +6 -6
  103. package/esm2022/src/event/RunTimeEvent.mjs +399 -0
  104. package/{esm2020 → esm2022}/src/event/RunTimeEventBase.mjs +3 -3
  105. package/esm2022/src/event/UserEventsTable.mjs +47 -0
  106. package/esm2022/src/exp/ExpTable.mjs +57 -0
  107. package/esm2022/src/exp/Expression.mjs +200 -0
  108. package/esm2022/src/exp/ExpressionDict.mjs +727 -0
  109. package/esm2022/src/exp/ExpressionEvaluator.mjs +4206 -0
  110. package/esm2022/src/exp/ExpressionLocalJpn.mjs +314 -0
  111. package/{esm2020 → esm2022}/src/exp/GlobalParamsTable.mjs +85 -85
  112. package/esm2022/src/exp/YesNoExp.mjs +36 -0
  113. package/esm2022/src/gui/CreatedFormVector.mjs +23 -0
  114. package/esm2022/src/gui/FormsTable.mjs +66 -0
  115. package/esm2022/src/gui/MgControl.mjs +363 -0
  116. package/esm2022/src/gui/MgForm.mjs +1224 -0
  117. package/esm2022/src/http/HttpManager.mjs +97 -0
  118. package/esm2022/src/http/client/HttpClientAsync.mjs +68 -0
  119. package/{esm2020 → esm2022}/src/http/client/HttpClientBase.mjs +132 -132
  120. package/esm2022/src/http/client/HttpClientEvents.mjs +39 -0
  121. package/esm2022/src/http/client/HttpClientSync.mjs +42 -0
  122. package/esm2022/src/http/client/HttpUtility.mjs +84 -0
  123. package/{esm2020 → esm2022}/src/http/client/ICommunicationsFailureHandler.mjs +1 -1
  124. package/{esm2020 → esm2022}/src/remote/AddUserLocateRemoteDataViewCommand.mjs +18 -18
  125. package/{esm2020 → esm2022}/src/remote/AddUserRangeRemoteDataViewCommand.mjs +18 -18
  126. package/{esm2020 → esm2022}/src/remote/AddUserSortRemoteDataViewCommand.mjs +18 -18
  127. package/esm2022/src/remote/RemoteCommandsProcessor.mjs +883 -0
  128. package/{esm2020 → esm2022}/src/remote/RemoteControlItemsRefreshCommand.mjs +25 -25
  129. package/{esm2020 → esm2022}/src/remote/RemoteDataViewCommandBase.mjs +24 -24
  130. package/{esm2020 → esm2022}/src/remote/RemoteDataViewCommandFactory.mjs +60 -60
  131. package/{esm2020 → esm2022}/src/remote/RemoteDataViewCommandUpdateNonModifiable.mjs +15 -15
  132. package/{esm2020 → esm2022}/src/remote/RemoteDataviewManager.mjs +17 -17
  133. package/{esm2020 → esm2022}/src/remote/RemoteInitDataViewCommand.mjs +10 -10
  134. package/{esm2020 → esm2022}/src/remote/ResetUserLocateRemoteDataviewCommand.mjs +16 -16
  135. package/{esm2020 → esm2022}/src/remote/ResetUserRangeRemoteDataviewCommand.mjs +12 -12
  136. package/{esm2020 → esm2022}/src/remote/ResetUserSortRemoteDataviewCommand.mjs +15 -15
  137. package/esm2022/src/remote/ServerError.mjs +40 -0
  138. package/{esm2020 → esm2022}/src/remote/SetTransactionStateRemoteDataViewCommand.mjs +19 -19
  139. package/esm2022/src/rt/Argument.mjs +265 -0
  140. package/esm2022/src/rt/ArgumentsList.mjs +103 -0
  141. package/esm2022/src/rt/Boundary.mjs +152 -0
  142. package/esm2022/src/rt/CompMainPrgTable.mjs +63 -0
  143. package/esm2022/src/rt/DataviewHeaderBase.mjs +98 -0
  144. package/{esm2020 → esm2022}/src/rt/DataviewHeaderFactory.mjs +6 -6
  145. package/esm2022/src/rt/DataviewHeaders.mjs +53 -0
  146. package/{esm2020 → esm2022}/src/rt/DataviewHeadersSaxHandler.mjs +38 -38
  147. package/{esm2020 → esm2022}/src/rt/ExecutionStack.mjs +94 -94
  148. package/{esm2020 → esm2022}/src/rt/ExecutionStackEntry.mjs +17 -17
  149. package/{esm2020 → esm2022}/src/rt/HandlersTable.mjs +96 -96
  150. package/{esm2020 → esm2022}/src/rt/IDataSourceViewDefinition.mjs +1 -1
  151. package/{esm2020 → esm2022}/src/rt/IDataviewHeader.mjs +1 -1
  152. package/{esm2020 → esm2022}/src/rt/IResultValue.mjs +1 -1
  153. package/esm2022/src/rt/LastFocusedManager.mjs +65 -0
  154. package/esm2022/src/rt/Operation.mjs +735 -0
  155. package/esm2022/src/rt/OperationTable.mjs +67 -0
  156. package/esm2022/src/rt/Recompute.mjs +355 -0
  157. package/{esm2020 → esm2022}/src/rt/RecomputeTable.mjs +62 -62
  158. package/{esm2020 → esm2022}/src/rt/RemoteDataviewHeader.mjs +108 -108
  159. package/esm2022/src/rt/ResultValue.mjs +10 -0
  160. package/esm2022/src/rt/TableCache.mjs +177 -0
  161. package/esm2022/src/rt/TableCacheManager.mjs +67 -0
  162. package/esm2022/src/rt/Transaction.mjs +53 -0
  163. package/esm2022/src/security/UserDetails.mjs +71 -0
  164. package/{esm2020 → esm2022}/src/tasks/IMGDataCollection.mjs +1 -1
  165. package/esm2022/src/tasks/MGData.mjs +552 -0
  166. package/esm2022/src/tasks/MGDataCollection.mjs +252 -0
  167. package/esm2022/src/tasks/RCTimer.mjs +63 -0
  168. package/{esm2020 → esm2022}/src/tasks/RemoteTaskService.mjs +44 -44
  169. package/esm2022/src/tasks/Task.mjs +2499 -0
  170. package/esm2022/src/tasks/TaskBase.mjs +83 -0
  171. package/{esm2020 → esm2022}/src/tasks/TaskServiceBase.mjs +24 -24
  172. package/esm2022/src/tasks/TasksTable.mjs +80 -0
  173. package/esm2022/src/tasks/sort/Sort.mjs +5 -0
  174. package/{esm2020 → esm2022}/src/tasks/sort/SortCollection.mjs +67 -67
  175. package/{esm2020 → esm2022}/src/util/ConstUtils.mjs +13 -13
  176. package/esm2022/src/util/FlowMonitorQueue.mjs +451 -0
  177. package/{esm2020 → esm2022}/src/util/HeapSort.mjs +69 -69
  178. package/{esm2020 → esm2022}/src/util/IMirrorXML.mjs +1 -1
  179. package/{esm2020 → esm2022}/src/util/IServerConfig.mjs +1 -1
  180. package/{esm2020 → esm2022}/src/util/MgBlockingQueue.mjs +1 -1
  181. package/esm2022/src/util/MgPriorityBlockingQueue.mjs +74 -0
  182. package/esm2022/src/util/MgPriorityQueue.mjs +66 -0
  183. package/{esm2020 → esm2022}/src/util/ParamParseResult.mjs +7 -7
  184. package/esm2022/src/util/PrmMap.mjs +152 -0
  185. package/esm2022/src/util/ReturnResult.mjs +46 -0
  186. package/esm2022/src/util/ReturnResultBase.mjs +18 -0
  187. package/esm2022/src/util/Scrambler.mjs +89 -0
  188. package/esm2022/src/util/UniqueIDUtils.mjs +13 -0
  189. package/{esm2020 → esm2022}/src/util/cookie.service.mjs +91 -91
  190. package/{fesm2020 → fesm2022}/magic-xpa-engine.mjs +29885 -29693
  191. package/fesm2022/magic-xpa-engine.mjs.map +1 -0
  192. package/index.d.ts +187 -187
  193. package/package.json +8 -14
  194. package/src/AccessHelper.d.ts +20 -20
  195. package/src/ClientManager.d.ts +35 -32
  196. package/src/CommandsProcessorBase.d.ts +23 -23
  197. package/src/CommandsProcessorManager.d.ts +6 -6
  198. package/src/CommandsTable.d.ts +22 -22
  199. package/src/ConstInterface.d.ts +516 -515
  200. package/src/CurrentClientVersion.d.ts +1 -1
  201. package/src/FlowMonitorInterface.d.ts +15 -15
  202. package/src/GUIManager.d.ts +17 -17
  203. package/src/GlobalCommandsManager.d.ts +17 -17
  204. package/src/GuiEventsProcessor.d.ts +24 -24
  205. package/src/ICommandsTable.d.ts +9 -9
  206. package/src/ServerConfig.d.ts +35 -34
  207. package/src/bridge/IGuiEvent.d.ts +19 -19
  208. package/src/bridge/MagicBridge.d.ts +16 -16
  209. package/src/commands/ClientOriginatedCommandTaskTag.d.ts +8 -8
  210. package/src/commands/ClientToServer/AddUserLocateDataViewCommand.d.ts +4 -4
  211. package/src/commands/ClientToServer/AddUserRangeDataviewCommand.d.ts +6 -6
  212. package/src/commands/ClientToServer/AddUserSortDataViewCommand.d.ts +6 -6
  213. package/src/commands/ClientToServer/BrowserEscEventCommand.d.ts +9 -8
  214. package/src/commands/ClientToServer/ClientOriginatedCommand.d.ts +8 -8
  215. package/src/commands/ClientToServer/ClientOriginatedCommandSerializer.d.ts +6 -6
  216. package/src/commands/ClientToServer/ColumnSortEventCommand.d.ts +11 -10
  217. package/src/commands/ClientToServer/CommandFactory.d.ts +64 -64
  218. package/src/commands/ClientToServer/CommandSerializationHelper.d.ts +20 -20
  219. package/src/commands/ClientToServer/ComputeEventCommand.d.ts +9 -8
  220. package/src/commands/ClientToServer/ContextTerminationEventCommand.d.ts +8 -7
  221. package/src/commands/ClientToServer/ContextTimeoutResetCommand.d.ts +8 -7
  222. package/src/commands/ClientToServer/ControlItemsRefreshCommand.d.ts +6 -6
  223. package/src/commands/ClientToServer/DataViewOutputCommand.d.ts +9 -9
  224. package/src/commands/ClientToServer/DataviewCommand.d.ts +32 -32
  225. package/src/commands/ClientToServer/EvaluateCommand.d.ts +16 -15
  226. package/src/commands/ClientToServer/EventCommand.d.ts +16 -15
  227. package/src/commands/ClientToServer/ExecOperCommand.d.ts +24 -23
  228. package/src/commands/ClientToServer/FetchDataControlValuesEventCommand.d.ts +9 -8
  229. package/src/commands/ClientToServer/GlobalParamsQueryCommand.d.ts +5 -5
  230. package/src/commands/ClientToServer/ICommandTaskTag.d.ts +3 -3
  231. package/src/commands/ClientToServer/IndexChangeEventCommand.d.ts +9 -8
  232. package/src/commands/ClientToServer/IniputForceWriteCommand.d.ts +11 -10
  233. package/src/commands/ClientToServer/NonReversibleExitEventCommand.d.ts +9 -8
  234. package/src/commands/ClientToServer/QueryCommand.d.ts +8 -8
  235. package/src/commands/ClientToServer/RecomputeCommand.d.ts +12 -11
  236. package/src/commands/ClientToServer/RefreshEventCommand.d.ts +13 -12
  237. package/src/commands/ClientToServer/RefreshScreenEventCommand.d.ts +11 -10
  238. package/src/commands/ClientToServer/RollbackEventCommand.d.ts +15 -14
  239. package/src/commands/ClientToServer/SelectProgramCommand.d.ts +7 -6
  240. package/src/commands/ClientToServer/SetTransactionStateDataviewCommand.d.ts +5 -5
  241. package/src/commands/ClientToServer/SubformOpenEventCommand.d.ts +9 -8
  242. package/src/commands/ClientToServer/SubformRefreshEventCommand.d.ts +10 -9
  243. package/src/commands/ClientToServer/TransactionCommand.d.ts +14 -12
  244. package/src/commands/ClientToServer/UnloadCommand.d.ts +8 -7
  245. package/src/commands/ClientToServer/WriteMessageToServerLogCommand.d.ts +6 -6
  246. package/src/commands/DataViewCommandBase.d.ts +6 -6
  247. package/src/commands/IClientCommand.d.ts +2 -2
  248. package/src/commands/IClientTargetedCommand.d.ts +12 -12
  249. package/src/commands/IClientToServerCommandInfo.d.ts +4 -3
  250. package/src/commands/ServerToClient/AbortCommand.d.ts +11 -11
  251. package/src/commands/ServerToClient/AddLocateCommand.d.ts +6 -6
  252. package/src/commands/ServerToClient/AddRangeCommand.d.ts +10 -10
  253. package/src/commands/ServerToClient/AddSortCommand.d.ts +9 -9
  254. package/src/commands/ServerToClient/ClientRefreshCommand.d.ts +7 -7
  255. package/src/commands/ServerToClient/ClientTargetedCommandBase.d.ts +12 -12
  256. package/src/commands/ServerToClient/EnhancedVerifyCommand.d.ts +13 -13
  257. package/src/commands/ServerToClient/OpenURLCommand.d.ts +21 -21
  258. package/src/commands/ServerToClient/ResetLocateCommand.d.ts +6 -6
  259. package/src/commands/ServerToClient/ResetRangeCommand.d.ts +6 -6
  260. package/src/commands/ServerToClient/ResetSortCommand.d.ts +6 -6
  261. package/src/commands/ServerToClient/ResultCommand.d.ts +10 -10
  262. package/src/commands/ServerToClient/VerifyCommand.d.ts +17 -17
  263. package/src/commands/ServerToClient/XMLBasedCommandBuilder.d.ts +11 -11
  264. package/src/communications/IConnectionStateManager.d.ts +4 -4
  265. package/src/communications/InteractiveCommunicationsFailureHandler.d.ts +6 -6
  266. package/src/data/DataSourceIdKey.d.ts +2 -2
  267. package/src/data/DataView.d.ts +162 -162
  268. package/src/data/DataViewBase.d.ts +12 -12
  269. package/src/data/DataviewManager.d.ts +14 -14
  270. package/src/data/DataviewManagerBase.d.ts +11 -11
  271. package/src/data/DvCache.d.ts +15 -15
  272. package/src/data/Field.d.ts +103 -103
  273. package/src/data/FieldBase.d.ts +23 -23
  274. package/src/data/FieldsTable.d.ts +27 -27
  275. package/src/data/IRecordsTable.d.ts +7 -7
  276. package/src/data/Key.d.ts +15 -15
  277. package/src/data/Record.d.ts +157 -156
  278. package/src/data/RecordOutOfDataViewException.d.ts +10 -10
  279. package/src/data/RecordsTable.d.ts +38 -38
  280. package/src/data/TaskTransactionManager.d.ts +17 -17
  281. package/src/data/XMLBasedDcValuesBuilder.d.ts +11 -11
  282. package/src/enums.d.ts +21 -21
  283. package/src/env/EnvVariablesTable.d.ts +17 -17
  284. package/src/env/Environment.d.ts +118 -118
  285. package/src/env/ILanguageData.d.ts +3 -3
  286. package/src/env/LanguageData.d.ts +20 -20
  287. package/src/env/MirrorString.d.ts +15 -15
  288. package/src/event/ActionManager.d.ts +14 -14
  289. package/src/event/Event.d.ts +79 -79
  290. package/src/event/EventHandler.d.ts +66 -66
  291. package/src/event/EventHandlerPosition.d.ts +25 -25
  292. package/src/event/EventsManager.d.ts +205 -204
  293. package/src/event/IEventsManager.d.ts +77 -77
  294. package/src/event/RunTimeEvent.d.ts +126 -123
  295. package/src/event/RunTimeEventBase.d.ts +5 -5
  296. package/src/event/UserEventsTable.d.ts +11 -11
  297. package/src/exp/ExpTable.d.ts +11 -11
  298. package/src/exp/Expression.d.ts +37 -37
  299. package/src/exp/ExpressionDict.d.ts +12 -12
  300. package/src/exp/ExpressionEvaluator.d.ts +198 -198
  301. package/src/exp/ExpressionLocalJpn.d.ts +18 -18
  302. package/src/exp/GlobalParamsTable.d.ts +19 -19
  303. package/src/exp/YesNoExp.d.ts +9 -9
  304. package/src/gui/CreatedFormVector.d.ts +10 -10
  305. package/src/gui/FormsTable.d.ts +15 -15
  306. package/src/gui/MgControl.d.ts +60 -60
  307. package/src/gui/MgForm.d.ts +96 -93
  308. package/src/http/HttpManager.d.ts +25 -25
  309. package/src/http/client/HttpClientAsync.d.ts +16 -16
  310. package/src/http/client/HttpClientBase.d.ts +30 -30
  311. package/src/http/client/HttpClientEvents.d.ts +18 -18
  312. package/src/http/client/HttpClientSync.d.ts +17 -17
  313. package/src/http/client/HttpUtility.d.ts +10 -10
  314. package/src/http/client/ICommunicationsFailureHandler.d.ts +5 -5
  315. package/src/remote/AddUserLocateRemoteDataViewCommand.d.ts +8 -8
  316. package/src/remote/AddUserRangeRemoteDataViewCommand.d.ts +8 -8
  317. package/src/remote/AddUserSortRemoteDataViewCommand.d.ts +8 -8
  318. package/src/remote/RemoteCommandsProcessor.d.ts +51 -51
  319. package/src/remote/RemoteControlItemsRefreshCommand.d.ts +8 -8
  320. package/src/remote/RemoteDataViewCommandBase.d.ts +10 -10
  321. package/src/remote/RemoteDataViewCommandFactory.d.ts +6 -6
  322. package/src/remote/RemoteDataViewCommandUpdateNonModifiable.d.ts +8 -8
  323. package/src/remote/RemoteDataviewManager.d.ts +9 -9
  324. package/src/remote/RemoteInitDataViewCommand.d.ts +7 -7
  325. package/src/remote/ResetUserLocateRemoteDataviewCommand.d.ts +7 -7
  326. package/src/remote/ResetUserRangeRemoteDataviewCommand.d.ts +7 -7
  327. package/src/remote/ResetUserSortRemoteDataviewCommand.d.ts +7 -7
  328. package/src/remote/ServerError.d.ts +16 -16
  329. package/src/remote/SetTransactionStateRemoteDataViewCommand.d.ts +8 -8
  330. package/src/rt/Argument.d.ts +36 -36
  331. package/src/rt/ArgumentsList.d.ts +24 -24
  332. package/src/rt/Boundary.d.ts +27 -27
  333. package/src/rt/CompMainPrgTable.d.ts +10 -10
  334. package/src/rt/DataviewHeaderBase.d.ts +34 -34
  335. package/src/rt/DataviewHeaderFactory.d.ts +5 -5
  336. package/src/rt/DataviewHeaders.d.ts +12 -12
  337. package/src/rt/DataviewHeadersSaxHandler.d.ts +10 -10
  338. package/src/rt/ExecutionStack.d.ts +22 -22
  339. package/src/rt/ExecutionStackEntry.d.ts +7 -7
  340. package/src/rt/HandlersTable.d.ts +19 -19
  341. package/src/rt/IDataSourceViewDefinition.d.ts +6 -6
  342. package/src/rt/IDataviewHeader.d.ts +10 -10
  343. package/src/rt/IResultValue.d.ts +4 -4
  344. package/src/rt/LastFocusedManager.d.ts +23 -23
  345. package/src/rt/Operation.d.ts +97 -97
  346. package/src/rt/OperationTable.d.ts +15 -15
  347. package/src/rt/Recompute.d.ts +41 -41
  348. package/src/rt/RecomputeTable.d.ts +9 -9
  349. package/src/rt/RemoteDataviewHeader.d.ts +14 -14
  350. package/src/rt/ResultValue.d.ts +7 -7
  351. package/src/rt/TableCache.d.ts +29 -29
  352. package/src/rt/TableCacheManager.d.ts +10 -10
  353. package/src/rt/Transaction.d.ts +23 -23
  354. package/src/security/UserDetails.d.ts +16 -16
  355. package/src/tasks/IMGDataCollection.d.ts +26 -26
  356. package/src/tasks/MGData.d.ts +63 -63
  357. package/src/tasks/MGDataCollection.d.ts +42 -42
  358. package/src/tasks/RCTimer.d.ts +13 -13
  359. package/src/tasks/RemoteTaskService.d.ts +16 -16
  360. package/src/tasks/Task.d.ts +312 -312
  361. package/src/tasks/TaskBase.d.ts +123 -123
  362. package/src/tasks/TaskServiceBase.d.ts +16 -16
  363. package/src/tasks/TasksTable.d.ts +21 -21
  364. package/src/tasks/sort/Sort.d.ts +4 -4
  365. package/src/tasks/sort/SortCollection.d.ts +11 -11
  366. package/src/util/ConstUtils.d.ts +3 -3
  367. package/src/util/FlowMonitorQueue.d.ts +70 -70
  368. package/src/util/HeapSort.d.ts +6 -6
  369. package/src/util/IMirrorXML.d.ts +6 -6
  370. package/src/util/IServerConfig.d.ts +11 -11
  371. package/src/util/MgBlockingQueue.d.ts +5 -5
  372. package/src/util/MgPriorityBlockingQueue.d.ts +17 -17
  373. package/src/util/MgPriorityQueue.d.ts +13 -13
  374. package/src/util/ParamParseResult.d.ts +6 -6
  375. package/src/util/PrmMap.d.ts +28 -28
  376. package/src/util/ReturnResult.d.ts +18 -18
  377. package/src/util/ReturnResultBase.d.ts +11 -11
  378. package/src/util/Scrambler.d.ts +10 -10
  379. package/src/util/UniqueIDUtils.d.ts +4 -4
  380. package/src/util/cookie.service.d.ts +8 -8
  381. package/esm2020/src/AccessHelper.mjs +0 -9
  382. package/esm2020/src/ClientManager.mjs +0 -399
  383. package/esm2020/src/CommandsProcessorBase.mjs +0 -58
  384. package/esm2020/src/CommandsTable.mjs +0 -162
  385. package/esm2020/src/ConstInterface.mjs +0 -516
  386. package/esm2020/src/FlowMonitorInterface.mjs +0 -16
  387. package/esm2020/src/GUIManager.mjs +0 -62
  388. package/esm2020/src/GlobalCommandsManager.mjs +0 -34
  389. package/esm2020/src/GuiEventsProcessor.mjs +0 -154
  390. package/esm2020/src/ServerConfig.mjs +0 -117
  391. package/esm2020/src/bridge/MagicBridge.mjs +0 -41
  392. package/esm2020/src/commands/ClientOriginatedCommandTaskTag.mjs +0 -11
  393. package/esm2020/src/commands/ClientToServer/BrowserEscEventCommand.mjs +0 -23
  394. package/esm2020/src/commands/ClientToServer/ColumnSortEventCommand.mjs +0 -26
  395. package/esm2020/src/commands/ClientToServer/CommandFactory.mjs +0 -260
  396. package/esm2020/src/commands/ClientToServer/CommandSerializationHelper.mjs +0 -69
  397. package/esm2020/src/commands/ClientToServer/ComputeEventCommand.mjs +0 -23
  398. package/esm2020/src/commands/ClientToServer/DataViewOutputCommand.mjs +0 -13
  399. package/esm2020/src/commands/ClientToServer/EvaluateCommand.mjs +0 -36
  400. package/esm2020/src/commands/ClientToServer/ExecOperCommand.mjs +0 -67
  401. package/esm2020/src/commands/ClientToServer/FetchDataControlValuesEventCommand.mjs +0 -22
  402. package/esm2020/src/commands/ClientToServer/IndexChangeEventCommand.mjs +0 -21
  403. package/esm2020/src/commands/ClientToServer/IniputForceWriteCommand.mjs +0 -23
  404. package/esm2020/src/commands/ClientToServer/RecomputeCommand.mjs +0 -27
  405. package/esm2020/src/commands/ClientToServer/RefreshEventCommand.mjs +0 -27
  406. package/esm2020/src/commands/ClientToServer/RefreshScreenEventCommand.mjs +0 -24
  407. package/esm2020/src/commands/ClientToServer/RollbackEventCommand.mjs +0 -39
  408. package/esm2020/src/commands/ClientToServer/SelectProgramCommand.mjs +0 -15
  409. package/esm2020/src/commands/ClientToServer/SubformOpenEventCommand.mjs +0 -21
  410. package/esm2020/src/commands/ClientToServer/SubformRefreshEventCommand.mjs +0 -24
  411. package/esm2020/src/commands/ClientToServer/TransactionCommand.mjs +0 -28
  412. package/esm2020/src/commands/ClientToServer/WriteMessageToServerLogCommand.mjs +0 -18
  413. package/esm2020/src/commands/DataViewCommandBase.mjs +0 -10
  414. package/esm2020/src/commands/IClientTargetedCommand.mjs +0 -9
  415. package/esm2020/src/commands/ServerToClient/AbortCommand.mjs +0 -65
  416. package/esm2020/src/commands/ServerToClient/ClientRefreshCommand.mjs +0 -25
  417. package/esm2020/src/commands/ServerToClient/ClientTargetedCommandBase.mjs +0 -27
  418. package/esm2020/src/commands/ServerToClient/EnhancedVerifyCommand.mjs +0 -45
  419. package/esm2020/src/commands/ServerToClient/OpenURLCommand.mjs +0 -221
  420. package/esm2020/src/commands/ServerToClient/ResultCommand.mjs +0 -37
  421. package/esm2020/src/commands/ServerToClient/VerifyCommand.mjs +0 -83
  422. package/esm2020/src/communications/InteractiveCommunicationsFailureHandler.mjs +0 -17
  423. package/esm2020/src/data/DataView.mjs +0 -1610
  424. package/esm2020/src/data/DataviewManager.mjs +0 -28
  425. package/esm2020/src/data/DataviewManagerBase.mjs +0 -15
  426. package/esm2020/src/data/DvCache.mjs +0 -67
  427. package/esm2020/src/data/Field.mjs +0 -646
  428. package/esm2020/src/data/FieldBase.mjs +0 -18
  429. package/esm2020/src/data/FieldsTable.mjs +0 -103
  430. package/esm2020/src/data/Record.mjs +0 -846
  431. package/esm2020/src/data/RecordsTable.mjs +0 -267
  432. package/esm2020/src/env/EnvVariablesTable.mjs +0 -340
  433. package/esm2020/src/env/Environment.mjs +0 -489
  434. package/esm2020/src/env/LanguageData.mjs +0 -226
  435. package/esm2020/src/event/ActionManager.mjs +0 -91
  436. package/esm2020/src/event/Event.mjs +0 -1333
  437. package/esm2020/src/event/EventHandler.mjs +0 -766
  438. package/esm2020/src/event/EventHandlerPosition.mjs +0 -204
  439. package/esm2020/src/event/EventsManager.mjs +0 -2975
  440. package/esm2020/src/event/RunTimeEvent.mjs +0 -392
  441. package/esm2020/src/event/UserEventsTable.mjs +0 -47
  442. package/esm2020/src/exp/ExpTable.mjs +0 -59
  443. package/esm2020/src/exp/Expression.mjs +0 -200
  444. package/esm2020/src/exp/ExpressionDict.mjs +0 -727
  445. package/esm2020/src/exp/ExpressionEvaluator.mjs +0 -4212
  446. package/esm2020/src/exp/ExpressionLocalJpn.mjs +0 -314
  447. package/esm2020/src/exp/YesNoExp.mjs +0 -36
  448. package/esm2020/src/gui/CreatedFormVector.mjs +0 -23
  449. package/esm2020/src/gui/FormsTable.mjs +0 -66
  450. package/esm2020/src/gui/MgControl.mjs +0 -353
  451. package/esm2020/src/gui/MgForm.mjs +0 -1181
  452. package/esm2020/src/http/HttpManager.mjs +0 -97
  453. package/esm2020/src/http/client/HttpClientAsync.mjs +0 -67
  454. package/esm2020/src/http/client/HttpClientEvents.mjs +0 -39
  455. package/esm2020/src/http/client/HttpClientSync.mjs +0 -42
  456. package/esm2020/src/http/client/HttpUtility.mjs +0 -84
  457. package/esm2020/src/remote/RemoteCommandsProcessor.mjs +0 -880
  458. package/esm2020/src/remote/ServerError.mjs +0 -40
  459. package/esm2020/src/rt/Argument.mjs +0 -265
  460. package/esm2020/src/rt/ArgumentsList.mjs +0 -103
  461. package/esm2020/src/rt/Boundary.mjs +0 -152
  462. package/esm2020/src/rt/CompMainPrgTable.mjs +0 -65
  463. package/esm2020/src/rt/DataviewHeaderBase.mjs +0 -96
  464. package/esm2020/src/rt/DataviewHeaders.mjs +0 -53
  465. package/esm2020/src/rt/LastFocusedManager.mjs +0 -67
  466. package/esm2020/src/rt/Operation.mjs +0 -735
  467. package/esm2020/src/rt/OperationTable.mjs +0 -67
  468. package/esm2020/src/rt/Recompute.mjs +0 -355
  469. package/esm2020/src/rt/ResultValue.mjs +0 -12
  470. package/esm2020/src/rt/TableCache.mjs +0 -177
  471. package/esm2020/src/rt/TableCacheManager.mjs +0 -67
  472. package/esm2020/src/rt/Transaction.mjs +0 -53
  473. package/esm2020/src/security/UserDetails.mjs +0 -71
  474. package/esm2020/src/tasks/MGData.mjs +0 -552
  475. package/esm2020/src/tasks/MGDataCollection.mjs +0 -252
  476. package/esm2020/src/tasks/RCTimer.mjs +0 -63
  477. package/esm2020/src/tasks/Task.mjs +0 -2495
  478. package/esm2020/src/tasks/TaskBase.mjs +0 -87
  479. package/esm2020/src/tasks/TasksTable.mjs +0 -80
  480. package/esm2020/src/tasks/sort/Sort.mjs +0 -7
  481. package/esm2020/src/util/FlowMonitorQueue.mjs +0 -453
  482. package/esm2020/src/util/MgPriorityBlockingQueue.mjs +0 -74
  483. package/esm2020/src/util/MgPriorityQueue.mjs +0 -66
  484. package/esm2020/src/util/PrmMap.mjs +0 -151
  485. package/esm2020/src/util/ReturnResult.mjs +0 -46
  486. package/esm2020/src/util/ReturnResultBase.mjs +0 -18
  487. package/esm2020/src/util/Scrambler.mjs +0 -89
  488. package/esm2020/src/util/UniqueIDUtils.mjs +0 -12
  489. package/fesm2015/magic-xpa-engine.mjs +0 -30835
  490. package/fesm2015/magic-xpa-engine.mjs.map +0 -1
  491. package/fesm2020/magic-xpa-engine.mjs.map +0 -1
@@ -1,880 +0,0 @@
1
- import { Base64, JSON_Utils, Logger, Logger_LogLevels, Misc, MsgInterface, OSEnvironment, RequestInfo, StrUtil, XMLConstants } from "@magic-xpa/utils";
2
- import { Debug, Encoding, Exception, List, NString, RefParam, StringBuilder, isNullOrUndefined, isUndefined } from "@magic-xpa/mscorelib";
3
- import { Commands, RuntimeContextBase, Styles, UsernamePasswordCredentials } from "@magic-xpa/gui";
4
- import { ExecOperCommand } from '../commands/ClientToServer/ExecOperCommand';
5
- import { CommandsProcessorBase, CommandsProcessorBase_SendingInstruction, CommandsProcessorBase_SessionStage } from "../CommandsProcessorBase";
6
- import { HttpManager } from "../http/HttpManager";
7
- import { ConstInterface } from "../ConstInterface";
8
- import { Scrambler } from "../util/Scrambler";
9
- import { ServerError } from "./ServerError";
10
- import { FlowMonitorQueue } from "../util/FlowMonitorQueue";
11
- import { OpeningTaskDetails } from "../tasks/TaskBase";
12
- import { HttpUtility } from "../http/client/HttpUtility";
13
- import { HttpClientEvents } from "../http/client/HttpClientEvents";
14
- import { ServerConfig } from "../ServerConfig";
15
- import { AccessHelper } from "../AccessHelper";
16
- import { Environment, Event, EventCommand, EventsManager, GUIManager } from "../../";
17
- import { MGDataCollection } from "../tasks/MGDataCollection";
18
- import { timer } from "rxjs";
19
- var RequestStatus;
20
- (function (RequestStatus) {
21
- RequestStatus[RequestStatus["Handled"] = 0] = "Handled";
22
- RequestStatus[RequestStatus["Retry"] = 1] = "Retry";
23
- RequestStatus[RequestStatus["Abort"] = 2] = "Abort";
24
- })(RequestStatus || (RequestStatus = {}));
25
- export class RemoteCommandsProcessor extends CommandsProcessorBase {
26
- static GetInstance() {
27
- if (RemoteCommandsProcessor._instance === null) {
28
- RemoteCommandsProcessor._instance = new RemoteCommandsProcessor();
29
- }
30
- return RemoteCommandsProcessor._instance;
31
- }
32
- constructor() {
33
- super();
34
- this._lastRequestTime = 0;
35
- this.ServerUrl = null;
36
- this.DelayCommandExecution = false;
37
- this._requestInfo = new RequestInfo();
38
- this.ServerUrl = ServerConfig.Instance.getServerURL();
39
- HttpManager.GetInstance();
40
- this.RegisterDelegates();
41
- }
42
- CheckAndSetSessionCounter(newSessionCounter) {
43
- if (newSessionCounter === ConstInterface.SESSION_COUNTER_CLOSE_CTX_INDICATION) {
44
- Debug.Assert(this.GetSessionCounter() === ConstInterface.SESSION_COUNTER_CLOSE_CTX_INDICATION);
45
- }
46
- else {
47
- Debug.Assert(newSessionCounter === this.GetSessionCounter() + 1);
48
- this.SetSessionCounter(newSessionCounter);
49
- Logger.Instance.WriteServerToLog(NString.Format("Session Counter --> {0}", this._sessionCounter));
50
- }
51
- }
52
- ClearSessionCounter() {
53
- this._sessionCounter = 0;
54
- Logger.Instance.WriteServerToLog(NString.Format("Session Counter --> {0}", this._sessionCounter));
55
- }
56
- SetSessionCounter(newSessionCounter) {
57
- this._sessionCounter = newSessionCounter;
58
- }
59
- get GetLastRequestTime() {
60
- return this._lastRequestTime;
61
- }
62
- async ReStartSession() {
63
- RemoteCommandsProcessor.IsSessionReInitializing = true;
64
- await this.StoreSessionReInitializingDataOnLocalStorage();
65
- let navigateRootRoute = false;
66
- if (!RuntimeContextBase.Instance.RemovedContextFromServer)
67
- navigateRootRoute = Environment.Instance.getSpecialRouteToRootProgOnContextRecreation() ? true : false;
68
- Commands.addRefreshPage(navigateRootRoute, RemoteCommandsProcessor.InitialUrl);
69
- throw new Exception('');
70
- }
71
- async StoreSessionReInitializingDataOnLocalStorage() {
72
- let mainPrgViewStringForServer = await this.BuildXMLForMainProgramDataView();
73
- let globalParamsString = AccessHelper.globalParams.mirrorAllToXML();
74
- let changedEnvVarList = AccessHelper.envParamsTable.mirrorAllToXML();
75
- let dataStorage = window.localStorage;
76
- dataStorage.setItem(ConstInterface.IS_SESSION_REINITIALIZING, "true");
77
- dataStorage.setItem(ConstInterface.MAIN_PROG_VIEW, mainPrgViewStringForServer.toString());
78
- dataStorage.setItem(ConstInterface.GLOBAL_PARAM_LIST, globalParamsString);
79
- dataStorage.setItem(ConstInterface.ENV_VAR_LIST, changedEnvVarList);
80
- dataStorage.setItem(ConstInterface.LAST_EXCEPTION, RemoteCommandsProcessor.lastExceptionMessage);
81
- if (RuntimeContextBase.Instance.RemovedContextFromServer)
82
- dataStorage.setItem(ConstInterface.CTX_REMOVED_FROM_SRVR, "1");
83
- EventsManager.Instance.storeLastSavedRouteEventOnLocalStorage();
84
- }
85
- RestoreSessionReInitializingDataFromLocalStorage(key) {
86
- let dataStorage = window.localStorage;
87
- let val = dataStorage.getItem(key);
88
- return val;
89
- }
90
- async StartSession() {
91
- let authenticationCancelled = false;
92
- let handshakeResponse = null;
93
- try {
94
- let lastTypedUserId = null;
95
- let handshakeInitialTokens = new StringBuilder();
96
- handshakeInitialTokens.Append(ConstInterface.UTF8TRANS +
97
- ConstInterface.REQ_APP_NAME + "=" +
98
- HttpUtility.UrlEncode(ServerConfig.Instance.getAppName(), Encoding.UTF8));
99
- handshakeInitialTokens.Append("&" + ConstInterface.REQ_ARGS + "=" + ConstInterface.REQ_ARG_ALPHA +
100
- "<Richclient><Requires EncryptionKey=\"False\"/><RIAProtocolVersion=\"" + RemoteCommandsProcessor.WEB_COMMUNICATION_PROTOCOL_VERSION + "\"/></Richclient>");
101
- Logger.Instance.WriteDevToLog(NString.Format("Handshake request #1 (not scrambled) : {0}", this.ServerUrl + ConstInterface.REQ_ARG_START +
102
- ConstInterface.RC_INDICATION_INITIAL + handshakeInitialTokens));
103
- let handshakeInitialUrl = this.ServerUrl + ConstInterface.REQ_ARG_START +
104
- ConstInterface.RC_INDICATION_INITIAL +
105
- ConstInterface.RC_TOKEN_DATA +
106
- HttpUtility.UrlEncode(Scrambler.Scramble(handshakeInitialTokens.ToString()), Encoding.UTF8);
107
- Logger.Instance.WriteServerMessagesToLog("");
108
- Logger.Instance.WriteServerMessagesToLog(NString.Format("Handshake request #1: {0}", handshakeInitialUrl));
109
- let ctxGroup = ServerConfig.Instance.getCtxGroup();
110
- while (!authenticationCancelled) {
111
- let requestStatus = new RefParam(RequestStatus.Handled);
112
- let responseStr = await this.DispatchRequest(handshakeInitialUrl, null, CommandsProcessorBase_SessionStage.HANDSHAKE, requestStatus);
113
- if (NString.IsNullOrEmpty(responseStr)) {
114
- throw new ServerError("Client failed to initialize a session." + OSEnvironment.EolSeq +
115
- "Empty response was received from the web server." + OSEnvironment.EolSeq + OSEnvironment.EolSeq + this.ServerUrl);
116
- }
117
- Logger.Instance.WriteServerMessagesToLog(NString.Format("Handshake response #1: {0}", responseStr));
118
- Logger.Instance.WriteServerMessagesToLog("");
119
- handshakeResponse = new HandshakeResponse(responseStr);
120
- RuntimeContextBase.Instance.ContextID = handshakeResponse.ContextId;
121
- this.SessionId = handshakeResponse.GetSessionId;
122
- HttpManager.GetInstance().HttpCommunicationTimeoutMS = handshakeResponse.HttpTimeout * 1000;
123
- if (NString.IsNullOrEmpty(ServerConfig.Instance.getCtxGroup())) {
124
- ctxGroup = handshakeResponse.ContextId;
125
- }
126
- let credentials = null;
127
- if (ServerConfig.Instance.getSkipAuthenticationDialog()) {
128
- if (ServerConfig.Instance.getUsername() !== null) {
129
- credentials = new UsernamePasswordCredentials(ServerConfig.Instance.getUsername(), ServerConfig.Instance.getPassword());
130
- ServerConfig.Instance.setUsername("");
131
- ServerConfig.Instance.setPassword("");
132
- }
133
- }
134
- else if (handshakeResponse.InputPassword && handshakeResponse.SystemLogin !== HandshakeResponse.SYSTEM_LOGIN_AD) {
135
- if (lastTypedUserId !== null) {
136
- let title = AccessHelper.languageData.getConstMessage(MsgInterface.BRKTAB_STR_ERROR);
137
- let error = AccessHelper.languageData.getConstMessage(MsgInterface.USRINP_STR_BADPASSW);
138
- await GUIManager.Instance.MessageBox(title, error, Styles.MSGBOX_ICON_ERROR | Styles.MSGBOX_BUTTON_OK);
139
- }
140
- }
141
- if (authenticationCancelled) {
142
- this.SetSessionCounter(ConstInterface.SESSION_COUNTER_CLOSE_CTX_INDICATION);
143
- }
144
- let handshakeAuthUrl = this.PrepareAuthenticationUrl(handshakeResponse.ContextId, ctxGroup, this.GetSessionCounter());
145
- try {
146
- if (credentials !== null) {
147
- let credentialsStr = credentials.Username + ":";
148
- if (!NString.IsNullOrEmpty(credentials.Password)) {
149
- credentialsStr = credentialsStr + credentials.Password + ":";
150
- }
151
- credentialsStr += handshakeResponse.ContextId;
152
- credentialsStr = Scrambler.Scramble(credentialsStr);
153
- credentialsStr = Base64.encode(credentialsStr, true, Encoding.UTF8);
154
- handshakeAuthUrl += ("&USERNAME=" + HttpUtility.UrlEncode(credentialsStr, Encoding.UTF8));
155
- Logger.Instance.WriteServerMessagesToLog(NString.Format("Handshake request #2: {0}", handshakeAuthUrl));
156
- let statusRequest = new RefParam(RequestStatus.Handled);
157
- responseStr = await this.DispatchRequest(handshakeAuthUrl, null, CommandsProcessorBase_SessionStage.HANDSHAKE, statusRequest);
158
- if (responseStr.indexOf(handshakeResponse.ContextId) === -1) {
159
- throw new ServerError(AccessHelper.languageData.getConstMessage(MsgInterface.USRINP_STR_BADPASSW));
160
- }
161
- ServerConfig.Instance.setUsername(credentials.Username);
162
- ServerConfig.Instance.setPassword(credentials.Password);
163
- }
164
- else {
165
- let requestStatus = new RefParam(RequestStatus.Handled);
166
- Logger.Instance.WriteServerMessagesToLog(NString.Format("Handshake request #2: {0}", handshakeAuthUrl));
167
- responseStr = await this.DispatchRequest(handshakeAuthUrl, null, CommandsProcessorBase_SessionStage.HANDSHAKE, requestStatus);
168
- }
169
- Logger.Instance.WriteServerMessagesToLog(NString.Format("Handshake response #2: {0}", responseStr));
170
- Logger.Instance.WriteServerMessagesToLog("");
171
- break;
172
- }
173
- catch (ex) {
174
- if (ex instanceof ServerError) {
175
- let serverError = ex;
176
- if (ServerConfig.Instance.getSkipAuthenticationDialog()) {
177
- switch (serverError.GetCode()) {
178
- case ServerError.ERR_ACCESS_DENIED:
179
- case ServerError.ERR_AUTHENTICATION:
180
- ServerConfig.Instance.setSkipAuthenticationDialog(false);
181
- throw serverError;
182
- }
183
- }
184
- if (!handshakeResponse.InputPassword)
185
- throw serverError;
186
- if (serverError.GetCode() !== ServerError.ERR_AUTHENTICATION &&
187
- (!authenticationCancelled || serverError.GetCode() !== ServerError.INF_NO_RESULT)) {
188
- throw serverError;
189
- }
190
- }
191
- else
192
- throw ex;
193
- }
194
- }
195
- ServerConfig.Instance.setSkipAuthenticationDialog(true);
196
- ServerConfig.Instance.setCtxGroup(ctxGroup);
197
- RemoteCommandsProcessor.ShouldScrambleAndUnscrambleMessages = handshakeResponse.ScrambleMessages;
198
- if (Logger.Instance.LogLevel !== Logger_LogLevels.Basic) {
199
- let maxInternalLogLevel = handshakeResponse.MaxInternalLogLevel;
200
- if (maxInternalLogLevel !== null) {
201
- let maxLogLevel = this.parseLogLevel(maxInternalLogLevel);
202
- if (maxLogLevel < Logger.Instance.LogLevel) {
203
- ServerConfig.Instance.setInternalLogLevel(maxInternalLogLevel);
204
- Logger.Instance.WriteToLog(NString.Format("Internal log level was restricted to '{0}' by the Magic xpa server.", maxInternalLogLevel), false);
205
- Logger.Instance.LogLevel = maxLogLevel;
206
- }
207
- }
208
- }
209
- if (!authenticationCancelled) {
210
- await this.ExecuteInitialRequest();
211
- }
212
- }
213
- catch (ex) {
214
- if (ex instanceof ServerError)
215
- throw ex;
216
- if (isNullOrUndefined(ex.InnerException))
217
- throw new ServerError(ex.message, new Exception(ex));
218
- else
219
- throw new ServerError(ex.message, ex.InnerException);
220
- }
221
- return !authenticationCancelled;
222
- }
223
- PrepareAuthenticationUrl(contextId, ctxGroup, sessionCount) {
224
- let handshakeAuthUrl = this.ServerUrl + ConstInterface.REQ_ARG_START +
225
- ConstInterface.RC_INDICATION + ConstInterface.UTF8TRANS +
226
- ConstInterface.RC_TOKEN_CTX_ID + contextId;
227
- if (!isNullOrUndefined(this.SessionId))
228
- handshakeAuthUrl += (ConstInterface.REQ_ARG_SEPARATOR + ConstInterface.RC_TOKEN_SESSION_ID + this.SessionId);
229
- handshakeAuthUrl += (ConstInterface.REQ_ARG_SEPARATOR +
230
- ConstInterface.RC_TOKEN_SESSION_COUNT + sessionCount +
231
- ConstInterface.REQ_ARG_SEPARATOR +
232
- ConstInterface.RC_TOKEN_CTX_GROUP + ctxGroup +
233
- ConstInterface.REQ_ARG_SEPARATOR +
234
- ConstInterface.RC_AUTHENTICATION_REQUEST);
235
- return handshakeAuthUrl;
236
- }
237
- async ExecuteInitialRequest() {
238
- await this.Execute_1(CommandsProcessorBase_SendingInstruction.TASKS_AND_COMMANDS, CommandsProcessorBase_SessionStage.INITIAL, null);
239
- }
240
- GetTaskTree(task) {
241
- let taskTree = new List();
242
- while (!isNullOrUndefined(task)) {
243
- taskTree.push(task.getTaskInfo());
244
- task = task.getParent();
245
- }
246
- return taskTree;
247
- }
248
- async UpdateRequestInfo() {
249
- let currMGData = AccessHelper.mgDataTable.getCurrMGData();
250
- let eventsManager = AccessHelper.eventsManager;
251
- let operExecution = false;
252
- let cmdsToServer = currMGData.CmdsToServer;
253
- for (let i = 0; i < cmdsToServer.getSize(); i++) {
254
- if (cmdsToServer.getCmd(i) instanceof ExecOperCommand) {
255
- let operCmd = currMGData.CmdsToServer.getCmd(i);
256
- this._requestInfo.serverCallAt = operCmd.getCommandInfo();
257
- this._requestInfo.runtimeTaskTree = this.GetTaskTree(operCmd.getTask());
258
- operExecution = true;
259
- break;
260
- }
261
- }
262
- this._requestInfo.extraInfo.contextID = RuntimeContextBase.Instance.ContextID;
263
- this._requestInfo.extraInfo.sessionCounter = this.GetSessionCounter();
264
- if (!operExecution) {
265
- if (eventsManager.getLastRtEvent() != null && eventsManager.getLastRtEvent().InternalEvent != 0) {
266
- let rtEvt = eventsManager.getLastRtEvent();
267
- this._requestInfo.runtimeTaskTree = this.GetTaskTree(rtEvt.getTask());
268
- let eventDescription = rtEvt.isNewInternalEvent()
269
- ? NString.TrimEnd(rtEvt.getNewInternalEventDescription())
270
- : Event.getInternalEvtDescription(rtEvt.InternalEvent);
271
- let cmd = cmdsToServer.getCmd(cmdsToServer.getSize() - 1);
272
- if (cmd) {
273
- let commandInfo = NString.IsNullOrEmpty(cmd.getCommandInfo())
274
- ? NString.Empty
275
- : cmd.getCommandInfo();
276
- if (cmd instanceof EventCommand && rtEvt.InternalEvent == cmd.MagicEvent)
277
- eventDescription = NString.Empty;
278
- this._requestInfo.serverCallAt = 'Event ' + commandInfo +
279
- (!NString.IsNullOrEmpty(eventDescription)
280
- ? NString.Format(' while executing [{0}]', eventDescription)
281
- : NString.Empty);
282
- }
283
- }
284
- }
285
- }
286
- async BuildXMLForMainProgramDataView() {
287
- let message = new StringBuilder();
288
- let firstMgData = MGDataCollection.Instance.getMGData(0);
289
- let mainPrg = firstMgData.getMainProg(0);
290
- while (mainPrg != null) {
291
- await mainPrg.buildXML(message);
292
- mainPrg = firstMgData.getNextMainProg(mainPrg.getCtlIdx());
293
- }
294
- if (RemoteCommandsProcessor.ShouldScrambleAndUnscrambleMessages) {
295
- let scrambledChanges = Scrambler.Scramble(message.ToString());
296
- message = new StringBuilder(scrambledChanges);
297
- }
298
- message.Insert(0, XMLConstants.MG_TAG_OPEN);
299
- message.Append(XMLConstants.MG_TAG_XML_END_TAGGED);
300
- return message.ToString();
301
- }
302
- async Execute_1(sendingInstruction, sessionStage, res) {
303
- let reqBuf;
304
- let isInitialCall = sessionStage === CommandsProcessorBase_SessionStage.INITIAL;
305
- let globalParamsString = null;
306
- let envVarsString = null;
307
- if (this.DelayCommandExecution)
308
- return;
309
- if (Logger.Instance.LogLevel == Logger_LogLevels.RequestInfo && !isInitialCall)
310
- await this.UpdateRequestInfo();
311
- if (isInitialCall) {
312
- let val = this.RestoreSessionReInitializingDataFromLocalStorage(ConstInterface.IS_SESSION_REINITIALIZING);
313
- if (val === 'true') {
314
- RemoteCommandsProcessor.IsSessionReInitializing = (val === "true") ? true : false;
315
- RemoteCommandsProcessor.lastExceptionMessage = this.RestoreSessionReInitializingDataFromLocalStorage(ConstInterface.LAST_EXCEPTION);
316
- let ctxRemoved = this.RestoreSessionReInitializingDataFromLocalStorage(ConstInterface.CTX_REMOVED_FROM_SRVR);
317
- if (ctxRemoved !== '1') {
318
- Logger.Instance.WriteErrorToLog(RemoteCommandsProcessor.lastExceptionMessage);
319
- Logger.Instance.WriteToLog("Session is reinitializing...", true);
320
- }
321
- }
322
- }
323
- if (sendingInstruction === CommandsProcessorBase_SendingInstruction.NO_TASKS_OR_COMMANDS)
324
- reqBuf = null;
325
- else {
326
- reqBuf = await this.PrepareRequest(sendingInstruction === CommandsProcessorBase_SendingInstruction.TASKS_AND_COMMANDS);
327
- if (RemoteCommandsProcessor.IsSessionReInitializing || !isInitialCall) {
328
- let changes = new StringBuilder();
329
- let buffer = new StringBuilder();
330
- if (!RemoteCommandsProcessor.IsSessionReInitializing)
331
- buffer.Append(reqBuf);
332
- if (RemoteCommandsProcessor.IsSessionReInitializing) {
333
- globalParamsString = this.RestoreSessionReInitializingDataFromLocalStorage(ConstInterface.GLOBAL_PARAM_LIST);
334
- envVarsString = this.RestoreSessionReInitializingDataFromLocalStorage(ConstInterface.ENV_VAR_LIST);
335
- }
336
- else {
337
- globalParamsString = AccessHelper.globalParams.mirrorToXML();
338
- envVarsString = AccessHelper.envParamsTable.mirrorToXML();
339
- }
340
- changes.Append(globalParamsString);
341
- changes.Append(envVarsString);
342
- if (changes.Length > 0) {
343
- changes.Insert(0, "<" + ConstInterface.MG_TAG_ENV_CHANGES + ">");
344
- changes.Append("</" + ConstInterface.MG_TAG_ENV_CHANGES + ">");
345
- if (RemoteCommandsProcessor.ShouldScrambleAndUnscrambleMessages) {
346
- let scrambledChanges = Scrambler.Scramble(changes.ToString());
347
- changes = new StringBuilder(scrambledChanges);
348
- }
349
- changes.Insert(0, XMLConstants.MG_TAG_OPEN);
350
- changes.Append(XMLConstants.MG_TAG_XML_END_TAGGED);
351
- buffer.Append(changes.ToString());
352
- }
353
- reqBuf = buffer.ToString();
354
- }
355
- }
356
- let requestStatus = new RefParam(RequestStatus.Handled);
357
- let respBuf = null;
358
- if (RemoteCommandsProcessor.IsSessionReInitializing) {
359
- reqBuf = reqBuf + this.RestoreSessionReInitializingDataFromLocalStorage(ConstInterface.MAIN_PROG_VIEW);
360
- }
361
- if (RuntimeContextBase.Instance.RemovedContextFromServer)
362
- requestStatus.value = RequestStatus.Retry;
363
- else {
364
- if (RuntimeContextBase.Instance.RemovingContextFromServer)
365
- RuntimeContextBase.Instance.RemovedContextFromServer = true;
366
- respBuf = await this.DispatchRequest(this.ServerUrl, reqBuf, sessionStage, requestStatus);
367
- }
368
- if (requestStatus.value == RequestStatus.Retry) {
369
- await this.ReStartSession();
370
- }
371
- if (respBuf == null)
372
- return;
373
- if (isInitialCall) {
374
- RemoteCommandsProcessor.InitialUrl = window.location.href;
375
- if (RemoteCommandsProcessor.IsSessionReInitializing) {
376
- let dataStorage = window.localStorage;
377
- dataStorage.removeItem(ConstInterface.IS_SESSION_REINITIALIZING);
378
- dataStorage.removeItem(ConstInterface.MAIN_PROG_VIEW);
379
- dataStorage.removeItem(ConstInterface.GLOBAL_PARAM_LIST);
380
- dataStorage.removeItem(ConstInterface.ENV_VAR_LIST);
381
- dataStorage.removeItem(ConstInterface.LAST_EXCEPTION);
382
- }
383
- }
384
- FlowMonitorQueue.Instance.enable(false);
385
- await this.ProcessResponse(respBuf, AccessHelper.mgDataTable.currMgdID, null, res);
386
- if (RemoteCommandsProcessor.IsSessionReInitializing) {
387
- AccessHelper.globalParams.RestoreParams(globalParamsString);
388
- AccessHelper.envParamsTable.RestoreParams(envVarsString);
389
- let dataStorage = window.localStorage;
390
- let ctxRemoved = dataStorage.getItem(ConstInterface.CTX_REMOVED_FROM_SRVR);
391
- if (ctxRemoved === "1") {
392
- EventsManager.Instance.restoreLastSavedRouteEventFromLocalStorage();
393
- dataStorage.removeItem(ConstInterface.CTX_REMOVED_FROM_SRVR);
394
- dataStorage.removeItem(ConstInterface.LAST_ROUTE_EVENT);
395
- dataStorage.removeItem(ConstInterface.LAST_ROUTE_EVENT_SRC_TSK);
396
- dataStorage.removeItem(ConstInterface.LAST_ROUTE_EVENT_ARG_LIST);
397
- }
398
- RemoteCommandsProcessor.IsSessionReInitializing = false;
399
- }
400
- if (sendingInstruction === CommandsProcessorBase_SendingInstruction.TASKS_AND_COMMANDS) {
401
- AccessHelper.mgDataTable.startTasksIteration();
402
- let task;
403
- while ((task = AccessHelper.mgDataTable.getNextTask()) !== null) {
404
- let dataViewWasRetrieved = task.DataViewWasRetrieved;
405
- if (dataViewWasRetrieved) {
406
- await task.RefreshDisplay();
407
- }
408
- }
409
- }
410
- if (isInitialCall)
411
- ServerConfig.Instance.setGlobalParams(null);
412
- }
413
- async DispatchRequest(url, reqBuf, sessionStage, requestStatus) {
414
- let response = null;
415
- let encodedBody = null;
416
- requestStatus.value = RequestStatus.Handled;
417
- if (url === null) {
418
- Logger.Instance.WriteExceptionToLogWithMsg("in sendMsgToSrvr() unknown server");
419
- return response;
420
- }
421
- if (sessionStage !== CommandsProcessorBase_SessionStage.HANDSHAKE) {
422
- let urlSuffix = this.BuildUrlSuffix(reqBuf !== null, sessionStage === CommandsProcessorBase_SessionStage.INITIAL);
423
- let reqBufEncoded = HttpUtility.UrlEncode(reqBuf, Encoding.UTF8);
424
- encodedBody = urlSuffix + reqBufEncoded;
425
- }
426
- try {
427
- if (Logger.Instance.ShouldLogExtendedServerRelatedMessages())
428
- Logger.Instance.WriteServerMessagesToLog(NString.Format("MESSAGE TO SERVER:\n URL: {0}\n BODY: {1}", url, encodedBody));
429
- response = await this.ExecuteRequest(url, encodedBody);
430
- if (!response.toUpperCase().startsWith("<HTML")) {
431
- let startIdx = response.indexOf("<xml id=\"MGDATA\">");
432
- if (startIdx > 0)
433
- response = response.substr(startIdx);
434
- }
435
- Logger.Instance.WriteServerMessagesToLog("MESSAGE FROM SERVER: " + response);
436
- if (sessionStage === CommandsProcessorBase_SessionStage.HANDSHAKE ||
437
- (response.length > 0 &&
438
- RemoteCommandsProcessor.ShouldScrambleAndUnscrambleMessages && response !== "<xml id=\"MGDATA\">\n</xml>")) {
439
- if (sessionStage === CommandsProcessorBase_SessionStage.HANDSHAKE) {
440
- Debug.Assert(response.length > 0 && response[0] !== '<');
441
- }
442
- response = CommandsProcessorBase.UnScramble(response);
443
- }
444
- Logger.Instance.WriteDevToLog("MESSAGE FROM SERVER: (size = " + response.length + ")" + OSEnvironment.EolSeq + response);
445
- this._lastRequestTime = Misc.getSystemMilliseconds();
446
- }
447
- catch (ex) {
448
- if (ex instanceof ServerError) {
449
- requestStatus.value = RequestStatus.Abort;
450
- if (sessionStage == CommandsProcessorBase_SessionStage.NORMAL) {
451
- if (ex.GetCode() == ServerError.ERR_CTX_NOT_FOUND || ex.GetCode() == ServerError.ERR_THREAD_ABORTED) {
452
- if (RuntimeContextBase.Instance.RemovedContextFromServer) {
453
- requestStatus.value = RequestStatus.Retry;
454
- }
455
- else {
456
- switch (Environment.Instance.getWebClientReinitSession()) {
457
- case 'Y':
458
- requestStatus.value = RequestStatus.Retry;
459
- break;
460
- case 'A':
461
- let retval = await GUIManager.Instance.MessageBox("Error", "Unknown error occurred at server-side." +
462
- " Would you like to reinitialize the session?", Styles.MSGBOX_BUTTON_YES_NO);
463
- requestStatus.value = (retval == Styles.MSGBOX_RESULT_YES) ? RequestStatus.Retry : RequestStatus.Abort;
464
- break;
465
- case 'N':
466
- default:
467
- requestStatus.value = RequestStatus.Abort;
468
- break;
469
- }
470
- }
471
- if (requestStatus.value == RequestStatus.Abort) {
472
- Environment.Instance.setWebClientReinitSession('N');
473
- throw ex;
474
- }
475
- else {
476
- let errForConsole = StrUtil.getConsoleErorString(ex.GetMessage());
477
- RemoteCommandsProcessor.lastExceptionMessage = "Exception Occured at server side : " + ex.GetCode().toString() + " : " + errForConsole;
478
- console.log(RemoteCommandsProcessor.lastExceptionMessage);
479
- }
480
- return null;
481
- }
482
- }
483
- }
484
- this.clearLocalStorage();
485
- throw ex;
486
- }
487
- return response;
488
- }
489
- clearLocalStorage() {
490
- window.localStorage.removeItem(ConstInterface.LAST_ROUTE_EVENT);
491
- window.localStorage.removeItem(ConstInterface.LAST_ROUTE_EVENT_SRC_TSK);
492
- window.localStorage.removeItem(ConstInterface.LAST_ROUTE_EVENT_ARG_LIST);
493
- window.localStorage.removeItem(ConstInterface.IS_SESSION_REINITIALIZING);
494
- window.localStorage.removeItem(ConstInterface.MAIN_PROG_VIEW);
495
- window.localStorage.removeItem(ConstInterface.GLOBAL_PARAM_LIST);
496
- window.localStorage.removeItem(ConstInterface.ENV_VAR_LIST);
497
- window.localStorage.removeItem(ConstInterface.LAST_EXCEPTION);
498
- window.localStorage.removeItem(ConstInterface.CTX_REMOVED_FROM_SRVR);
499
- }
500
- HandleErrorResponse(response) {
501
- try {
502
- Logger.Instance.WriteServerMessagesToLog("MESSAGE FROM SERVER: " + response);
503
- response = CommandsProcessorBase.UnScramble(response);
504
- Logger.Instance.WriteServerMessagesToLog("MESSAGE FROM SERVER: " + StrUtil.getConsoleErorString(response));
505
- }
506
- catch (ex) {
507
- }
508
- if (response.startsWith("<xmlerr")) {
509
- let errorMessageXml = new ErrorMessageXml(response, this._lastRequestTime, AccessHelper.environment.getContextInactivityTimeout());
510
- throw new ServerError(errorMessageXml.GetMessage(), errorMessageXml.GetCode());
511
- }
512
- else if (response.toUpperCase().startsWith("<HTML")) {
513
- throw new ServerError(response);
514
- }
515
- }
516
- async ExecuteRequest(url, encodedBody) {
517
- return await this.GetContent(url, false, encodedBody);
518
- }
519
- async GetContent(requestedURL, useCache, requestContent) {
520
- if (isUndefined(requestContent))
521
- requestContent = null;
522
- let responseStr;
523
- try {
524
- if (requestedURL.startsWith("/"))
525
- requestedURL = ServerConfig.Instance.getProtocol() + "://" + ServerConfig.Instance.getServer() + requestedURL;
526
- var spinnerTimer = timer(50, 50);
527
- var spinnerTimerSubscription = spinnerTimer.subscribe(() => {
528
- AccessHelper.eventsManager.CheckAndShowSpinner(true);
529
- });
530
- let isError = new RefParam(false);
531
- responseStr = await HttpManager.GetInstance().GetContent(requestedURL, requestContent, useCache, isError);
532
- spinnerTimerSubscription.unsubscribe();
533
- spinnerTimerSubscription = null;
534
- if (isError.value) {
535
- this.HandleErrorResponse(responseStr);
536
- }
537
- }
538
- catch (ex) {
539
- if (!(ex instanceof ServerError) || Logger.Instance.LogLevel !== Logger_LogLevels.Basic) {
540
- Logger.Instance.WriteExceptionToLog(ex, NString.Format("requested URL = \"{0}\"", requestedURL));
541
- }
542
- if (!(ex instanceof ServerError)) {
543
- ex = new ServerError(ex.Message, ex.InnerException ? ex.InnerException : ex);
544
- }
545
- throw ex;
546
- }
547
- finally {
548
- if (spinnerTimerSubscription != null)
549
- spinnerTimerSubscription.unsubscribe();
550
- }
551
- return responseStr;
552
- }
553
- ClientActivated() {
554
- }
555
- BuildUrlSuffix(hasContent, isInitialCall) {
556
- let prefix = ConstInterface.RC_INDICATION + ConstInterface.RC_TOKEN_CTX_ID + RuntimeContextBase.Instance.ContextID;
557
- if (!isNullOrUndefined(this.SessionId))
558
- prefix += (ConstInterface.REQ_ARG_SEPARATOR + ConstInterface.RC_TOKEN_SESSION_ID + this.SessionId);
559
- if (isInitialCall) {
560
- if (RemoteCommandsProcessor.IsSessionReInitializing)
561
- prefix += (ConstInterface.REQ_ARG_SEPARATOR + ConstInterface.WEBCLIENT_REINITIALIZE_REQUEST);
562
- let globalParams = ServerConfig.Instance.getGlobalParams();
563
- if (globalParams !== null) {
564
- globalParams = NString.Replace(globalParams, "+", "%2B");
565
- prefix += ("&" + ConstInterface.MG_TAG_GLOBALPARAMS + "=" + globalParams);
566
- }
567
- }
568
- if (hasContent) {
569
- prefix += ("&" + ConstInterface.RC_TOKEN_SESSION_COUNT + this.GetSessionCounter() +
570
- ConstInterface.REQ_ARG_SEPARATOR + ConstInterface.RC_TOKEN_DATA);
571
- }
572
- return prefix;
573
- }
574
- async SendMonitorOnly() {
575
- let flowMonitor = FlowMonitorQueue.Instance;
576
- if (AccessHelper.mgDataTable == null || AccessHelper.mgDataTable.getMGData(0) == null || AccessHelper.mgDataTable.getMGData(0).IsAborting)
577
- return;
578
- if (!flowMonitor.isEmpty()) {
579
- let buffer = this.BuildMonitorMessage();
580
- let shouldAccumulateClientLog = false;
581
- if (shouldAccumulateClientLog) {
582
- }
583
- else {
584
- try {
585
- let requestStatus = new RefParam(RequestStatus.Handled);
586
- await this.DispatchRequest(this.ServerUrl, buffer.ToString(), CommandsProcessorBase_SessionStage.NORMAL, requestStatus);
587
- }
588
- catch (err) {
589
- }
590
- }
591
- }
592
- }
593
- BuildMonitorMessage() {
594
- let buffer = new StringBuilder(1000);
595
- let flowMonitor = FlowMonitorQueue.Instance;
596
- if (!RemoteCommandsProcessor.ShouldScrambleAndUnscrambleMessages) {
597
- buffer.Append(XMLConstants.MG_TAG_OPEN);
598
- flowMonitor.buildXML(buffer);
599
- }
600
- else {
601
- flowMonitor.buildXML(buffer);
602
- let scrambledOut = Scrambler.Scramble(buffer.ToString());
603
- buffer = new StringBuilder(1000);
604
- buffer.Append(XMLConstants.MG_TAG_OPEN + scrambledOut);
605
- }
606
- buffer.Append("</" + XMLConstants.MG_TAG_XML + XMLConstants.TAG_CLOSE);
607
- return buffer;
608
- }
609
- RegisterDelegates() {
610
- HttpClientEvents.GetSessionCounter_Event = this.GetSessionCounter.bind(this);
611
- HttpClientEvents.CheckAndSetSessionCounter_Event = this.CheckAndSetSessionCounter.bind(this);
612
- HttpClientEvents.ComputeAndLogRequestInfo_Event = this.ComputeAndLogRequestInfo.bind(this);
613
- AccessHelper.eventsManager.SpinnerStopped.subscribe(clientBusyTime => this.ClientActivated());
614
- }
615
- ComputeAndLogRequestInfo(contentLength, roundTrip, isLoggingResponse) {
616
- if (!isNullOrUndefined(this._requestInfo.serverCallAt)) {
617
- this._requestInfo.extraInfo.contentLength = contentLength;
618
- this._requestInfo.extraInfo.timeStamp = new Date().toString();
619
- let extraMessageStr = isLoggingResponse ? 'Response ⤵' : 'Request ⤵';
620
- if (isLoggingResponse) {
621
- this._requestInfo.roundtripTime = roundTrip;
622
- }
623
- Logger.Instance.WriteRequestInfoToLog(this._requestInfo, extraMessageStr);
624
- if (isLoggingResponse)
625
- this._requestInfo.clear();
626
- }
627
- }
628
- static set ShouldScrambleAndUnscrambleMessages(value) {
629
- RemoteCommandsProcessor._shouldScrambleAndUnscrambleMessages = value;
630
- Logger.Instance.WriteServerMessagesToLog(NString.Format("ShouldScrambleAndUnscrambleMessages.Set: {0}", this._shouldScrambleAndUnscrambleMessages));
631
- }
632
- static get ShouldScrambleAndUnscrambleMessages() {
633
- Logger.Instance.WriteServerMessagesToLog(NString.Format("ShouldScrambleAndUnscrambleMessages.Get: {0}", this._shouldScrambleAndUnscrambleMessages));
634
- return RemoteCommandsProcessor._shouldScrambleAndUnscrambleMessages;
635
- }
636
- parseLogLevel(strLogLevel) {
637
- let logLevel = Logger_LogLevels.None;
638
- if (!NString.IsNullOrEmpty(strLogLevel)) {
639
- if (strLogLevel.toUpperCase().startsWith("SERVER"))
640
- logLevel = strLogLevel.endsWith("#") ? Logger_LogLevels.ServerMessages : Logger_LogLevels.Server;
641
- else if (strLogLevel.toUpperCase().startsWith("S") || strLogLevel.toUpperCase().startsWith("Q"))
642
- logLevel = Logger_LogLevels.Support;
643
- else if (strLogLevel.toUpperCase().startsWith("G"))
644
- logLevel = Logger_LogLevels.Gui;
645
- else if (strLogLevel.toUpperCase().startsWith("D"))
646
- logLevel = Logger_LogLevels.Development;
647
- else if (strLogLevel.toUpperCase().startsWith("B"))
648
- logLevel = Logger_LogLevels.Basic;
649
- else if (strLogLevel.toUpperCase().startsWith("R"))
650
- logLevel = Logger_LogLevels.RequestInfo;
651
- }
652
- return logLevel;
653
- }
654
- async PrepareRequest(serializeTasks) {
655
- let xmlBuf = new StringBuilder();
656
- xmlBuf.Append(XMLConstants.MG_TAG_OPEN);
657
- if (AccessHelper.mgDataTable.getCurrMGData() !== null) {
658
- let xmlUnscrambled = new StringBuilder();
659
- await AccessHelper.mgDataTable.buildXML(xmlUnscrambled, serializeTasks);
660
- if (RemoteCommandsProcessor.ShouldScrambleAndUnscrambleMessages)
661
- xmlBuf.Append(Scrambler.Scramble(xmlUnscrambled.ToString()));
662
- else
663
- xmlBuf.Append(xmlUnscrambled.ToString());
664
- }
665
- xmlBuf.Append("</" + XMLConstants.MG_TAG_XML + XMLConstants.TAG_CLOSE);
666
- return xmlBuf.ToString();
667
- }
668
- async ProcessResponse(response, currMgdID, openingTaskDetails, res) {
669
- Logger.Instance.WriteDevToLog("<-- ProcessResponse started -->");
670
- if (openingTaskDetails === null)
671
- openingTaskDetails = new OpeningTaskDetails();
672
- let systemMilliseconds = Misc.getSystemMilliseconds();
673
- if (response === null || response.trim().length === 0)
674
- return;
675
- AccessHelper.mgDataTable.currMgdID = currMgdID;
676
- RuntimeContextBase.Instance.Parser.push();
677
- RuntimeContextBase.Instance.Parser.setXMLdata(response);
678
- RuntimeContextBase.Instance.Parser.setCurrIndex(0);
679
- let currMGData = AccessHelper.mgDataTable.getCurrMGData();
680
- await currMGData.fillData(openingTaskDetails, RuntimeContextBase.Instance.Parser);
681
- RuntimeContextBase.Instance.Parser.setXMLdata(null);
682
- RuntimeContextBase.Instance.Parser.pop();
683
- Logger.Instance.WriteDevToLog("<-- ProcessResponse finished --> (" + (Misc.getSystemMilliseconds() - systemMilliseconds) + ")");
684
- await currMGData.CmdsToClient.Execute(res);
685
- await this.ProcessRecovery();
686
- }
687
- async ProcessRecovery() {
688
- AccessHelper.eventsManager.pushNewExecStacks();
689
- await AccessHelper.mgDataTable.processRecovery();
690
- AccessHelper.eventsManager.popNewExecStacks();
691
- }
692
- }
693
- RemoteCommandsProcessor.RC_NO_CONTEXT_ID = '-1';
694
- RemoteCommandsProcessor._instance = null;
695
- RemoteCommandsProcessor.IsSessionReInitializing = false;
696
- RemoteCommandsProcessor.lastExceptionMessage = null;
697
- RemoteCommandsProcessor.InitialUrl = null;
698
- RemoteCommandsProcessor.WEB_COMMUNICATION_PROTOCOL_VERSION = "14002";
699
- RemoteCommandsProcessor._shouldScrambleAndUnscrambleMessages = false;
700
- class HandshakeResponse {
701
- get ScrambleMessages() {
702
- return this._scrambleMessages;
703
- }
704
- get ContextId() {
705
- return this._contextId;
706
- }
707
- get GetSessionId() {
708
- return this._privateSessionId;
709
- }
710
- get InputPassword() {
711
- return this._inputPassword;
712
- }
713
- get HttpTimeout() {
714
- return this._httpTimeout;
715
- }
716
- get SystemLogin() {
717
- return this._systemLogin;
718
- }
719
- get MaxInternalLogLevel() {
720
- return this._maxInternalLogLevel;
721
- }
722
- constructor(responseXML) {
723
- this._scrambleMessages = true;
724
- this._contextId = null;
725
- this._privateSessionId = null;
726
- this._inputPassword = false;
727
- this._httpTimeout = 0;
728
- this._systemLogin = null;
729
- this._maxInternalLogLevel = null;
730
- try {
731
- JSON_Utils.JSONFromXML(responseXML, this.FillFromJSON.bind(this));
732
- }
733
- catch (ex) {
734
- Logger.Instance.WriteExceptionToLog(ex, responseXML);
735
- }
736
- }
737
- FillFromJSON(error, result) {
738
- if (error != null) {
739
- throw error;
740
- }
741
- let response = result['Richclientresponse'];
742
- for (let elementName in response) {
743
- if (response.hasOwnProperty(elementName)) {
744
- switch (elementName) {
745
- case "ContextID":
746
- this._contextId = response[elementName][0];
747
- break;
748
- case "SessionID":
749
- this._privateSessionId = response[elementName][0];
750
- break;
751
- case "Environment":
752
- let envAttributes = response["Environment"][0]['$'];
753
- if (!isNullOrUndefined(envAttributes["ScrambleMessages"])) {
754
- Debug.Assert(envAttributes["ScrambleMessages"] === "N");
755
- this._scrambleMessages = false;
756
- }
757
- if (!isNullOrUndefined(envAttributes["MaxInternalLogLevel"]))
758
- this._maxInternalLogLevel = envAttributes["MaxInternalLogLevel"];
759
- if (!isNullOrUndefined(envAttributes["InputPassword"]) && envAttributes["InputPassword"].toLocaleLowerCase() === "y")
760
- this._inputPassword = true;
761
- if (!isNullOrUndefined(envAttributes["SystemLogin"]))
762
- this._systemLogin = envAttributes["SystemLogin"];
763
- if (!isNullOrUndefined(envAttributes[ConstInterface.MG_TAG_HTTP_COMMUNICATION_TIMEOUT]))
764
- this._httpTimeout = +envAttributes[ConstInterface.MG_TAG_HTTP_COMMUNICATION_TIMEOUT];
765
- if (!isNullOrUndefined(envAttributes["ForwardSlash"]))
766
- AccessHelper.environment.ForwardSlashUsage = envAttributes["ForwardSlash"];
767
- break;
768
- }
769
- }
770
- }
771
- }
772
- }
773
- HandshakeResponse.SYSTEM_LOGIN_AD = 'D';
774
- class ErrorMessageXml {
775
- constructor(xmlContent, lastRequestTime, contextInactivityTimeout) {
776
- this._lastRequestTime = 0;
777
- this._errorMessage = null;
778
- this._errorCode = 0;
779
- this._middlewareAddress = null;
780
- this._parsingFailed = false;
781
- this._lastRequestTime = lastRequestTime;
782
- this.contextInactivityTimeout = contextInactivityTimeout;
783
- try {
784
- JSON_Utils.JSONFromXML(xmlContent, this.FillFromJSON.bind(this));
785
- }
786
- catch (ex) {
787
- Logger.Instance.WriteExceptionToLog(ex);
788
- Misc.WriteStackTrace(ex);
789
- this._parsingFailed = true;
790
- }
791
- }
792
- FillFromJSON(error, result) {
793
- if (error != null) {
794
- throw error;
795
- }
796
- let xmlerr = result['xmlerr'];
797
- for (let elementName in xmlerr) {
798
- if (xmlerr.hasOwnProperty(elementName)) {
799
- switch (elementName) {
800
- case "errmsg":
801
- this._errorMessage = xmlerr[elementName][0];
802
- break;
803
- case "errcode":
804
- this._errorCode = +(xmlerr[elementName]);
805
- break;
806
- case "server":
807
- this._middlewareAddress = xmlerr[elementName][0];
808
- break;
809
- case "appname":
810
- case "prgname":
811
- case "arguments":
812
- case "username":
813
- case "xmlerr":
814
- break;
815
- default:
816
- Logger.Instance.WriteExceptionToLogWithMsg(NString.Format("Unknown element: '{0}'", elementName));
817
- break;
818
- }
819
- }
820
- }
821
- }
822
- GetCode() {
823
- return this._errorCode;
824
- }
825
- GetMessage() {
826
- let sb = new StringBuilder();
827
- if (this._parsingFailed) {
828
- sb.Append(AccessHelper.languageData.getConstMessage(MsgInterface.RC_STR_F7_UNEXPECTED_ERR));
829
- }
830
- else {
831
- switch (this._errorCode) {
832
- case ServerError.ERR_CTX_NOT_FOUND:
833
- if (this.InactivityTimeoutExpired())
834
- sb.Append(NString.Format("{0} ({1} {2})", AccessHelper.languageData.getConstMessage(MsgInterface.STR_ERR_SESSION_CLOSED_INACTIVITY), Math.floor(this.contextInactivityTimeout / 600), AccessHelper.languageData.getConstMessage(MsgInterface.STR_MINUTES)));
835
- else
836
- sb.Append(NString.Format("{0} ({1}).", AccessHelper.languageData.getConstMessage(MsgInterface.STR_ERR_SESSION_CLOSED), this._errorCode));
837
- break;
838
- case ServerError.ERR_WEBCLIENT_PROGRAM_RELOADED:
839
- sb.Append(AccessHelper.languageData.getConstMessage(MsgInterface.STR_ERR_WEBCLIENT_PROGRAM_RELOADED));
840
- break;
841
- case ServerError.ERR_EXECUTED_PROGRAM_CHANGED:
842
- sb.Append(AccessHelper.languageData.getConstMessage(MsgInterface.STR_ERR_EXECUTED_PROGRAM_CHANGED));
843
- break;
844
- case ServerError.ERR_AUTHENTICATION:
845
- sb.Append(AccessHelper.languageData.getConstMessage(MsgInterface.USRINP_STR_BADPASSW));
846
- break;
847
- case ServerError.ERR_ACCESS_DENIED:
848
- sb.Append(AccessHelper.languageData.getConstMessage(MsgInterface.STR_ERR_AUTHORIZATION_FAILURE));
849
- break;
850
- default:
851
- sb.Append(this._errorMessage);
852
- break;
853
- }
854
- sb.Append(OSEnvironment.EolSeq + OSEnvironment.EolSeq);
855
- if (!ServerConfig.Instance.ShouldDisplayGenericError()) {
856
- sb.Append(AccessHelper.languageData.getConstMessage(MsgInterface.BROWSER_OPT_INFO_SERVER_STR) + ": ");
857
- sb.Append(ServerConfig.Instance.getServer());
858
- if (!NString.IsNullOrEmpty(this._middlewareAddress)) {
859
- sb.Append(" --> ");
860
- sb.Append(this._middlewareAddress);
861
- }
862
- sb.Append(OSEnvironment.EolSeq);
863
- }
864
- sb.Append(AccessHelper.languageData.getConstMessage(MsgInterface.TASKRULE_STR_APPLICATION) + ": \"");
865
- sb.Append(ServerConfig.Instance.getAppName());
866
- sb.Append("\" (\"");
867
- sb.Append("\")");
868
- }
869
- return sb.ToString();
870
- }
871
- InactivityTimeoutExpired() {
872
- let expired = false;
873
- if (this.contextInactivityTimeout > 0) {
874
- let currTimeMilli = Misc.getSystemMilliseconds();
875
- expired = ((currTimeMilli - this._lastRequestTime) > (this.contextInactivityTimeout * 100));
876
- }
877
- return expired;
878
- }
879
- }
880
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiUmVtb3RlQ29tbWFuZHNQcm9jZXNzb3IuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy9lbmdpbmUvc3JjL3JlbW90ZS9SZW1vdGVDb21tYW5kc1Byb2Nlc3Nvci50cyJdLCJuYW1lcyI6W10sIm1hcH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qKipcclxuICAvLyAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKlxyXG4gIC8vICoqKioqKioqIFdoZW4gY2hhbmdpbmcgV0VCX0NPTU1VTklDQVRJT05fUFJPVE9DT0xfVkVSU0lPTiwgcGxlYXNlIGNoYW5nZSBvbiBtb2JpbGUgcGxhdGZvcm1zIGFzIHdlbGw6XHJcbiAgLy8gKioqKioqKiogVzEwTTogUmVtb3RlQ29tbWFuZHNQcm9jZXNzb3IuY3NcclxuICBwcml2YXRlIHN0YXRpYyByZWFkb25seSBXRUJfQ09NTVVOSUNBVElPTl9QUk9UT0NPTF9WRVJTSU9OOiBzdHJpbmcgPSBcIjE0MDAyXCI7XHJcbiAgLy8gKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKipcclxuICAvLyAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKlxyXG5cclxuICAvLyBUT0RPOiBDaGVjayBpZiB3ZSBuZWVkIF9sb2dBY2N1bXVsYXRvci5cclxuICAvLyBwcml2YXRlIF9sb2dBY2N1bXVsYXRvcjogQ2xpZW50TG9nQWNjdW11bGF0b3IgPSBudWxsO1xyXG5cclxuICBwcml2YXRlIF9sYXN0UmVxdWVzdFRpbWU6IG51bWJlciA9IDA7IC8vIHRoZSB0aW1lIG9mIHRoZSBsYXN0IHJlcXVlc3QgdG8gdGhlIHNlcnZlclxyXG5cclxuICBTZXJ2ZXJVcmw6IHN0cmluZyA9IG51bGw7XHJcbiAgcHJpdmF0ZSBzdGF0aWMgX3Nob3VsZFNjcmFtYmxlQW5kVW5zY3JhbWJsZU1l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vci5FUlJfVEhSRUFEX0FCT1JURUQpIHtcclxuICAgICAgICAgICAgaWYgKFJ1bnRpbWVDb250ZXh0QmFzZS5JbnN0YW5jZS5SZW1vdmVkQ29udGV4dEZyb21TZXJ2ZXIpIHtcclxuICAgICAgICAgICAgICByZXF1ZXN0U3RhdHVzLnZhbHVlID0gUmVxdWVzdFN0YXR1cy5SZXRyeTtcclxuICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICBzd2l0Y2ggKEVudmlyb25tZW50Lkluc3RhbmNlLmdldFdlYkNsaWVudFJlaW5pdFNlc3Npb24oKSkge1xyXG4gICAgICAgICAgICAgICAgY2FzZSAnWScgOlxyXG4gICAgICAgICAgICAgICAgICByZXF1ZXN0U3RhdHVzLnZhbHVlID0gUmVxdWVzdFN0YXR1cy5SZXRyeTtcclxuICAgICAgICAgICAgICAgICAgYnJlYWs7XHJcbiAgICAgICAgICAgICAgICBjYXNlICdBJzpcclxuICAgICAgICAgICAgICAgICAgbGV0IHJldHZhbCA9IGF3YWl0IEdVSU1hbmFnZXIuSW5zdGFuY2UuTWVzc2FnZUJveChcIkVycm9yXCIsIFwiVW5rbm93biBlcnJvciBvY2N1cnJlZCBhdCBzZXJ2ZXItc2lkZS5cIiArXHJcbiAgICAgICAgICAgICAgICAgICAgXCIgV291bGQgeW91IGxpa2UgdG8gcmVpbml0aWFsaXplIHRoZSBzZXNzaW9uP1wiLCBTdHlsZXMuTVNHQk9YX0JVVFRPTl9ZRVNfTk8pO1xyXG4gICAgICAgICAgICAgICAgICByZXF1ZXN0U3RhdHVzLnZhbHVlID0gKHJldHZhbCA9PSBTdHlsZXMuTVNHQk9YX1JFU1VMVF9ZRVMpID8gUmVxdWVzdFN0YXR1cy5SZXRyeSA6IFJlcXVlc3RTdGF0dXMuQWJvcnQ7XHJcbiAgICAgICAgICAgICAgICAgIGJyZWFrO1xyXG4gICAgICAgICAgICAgICAgY2FzZSAnTic6XHJcbiAgICAgICAgICAgICAgICBkZWZ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