@magic-xpa/engine 4.1100.0-dev4110.2 → 4.1100.0-dev4110.202

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