@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
@@ -0,0 +1,883 @@
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
+ this._requestInfo.recordSuffixTriggeredBy = cmd.getFieldsInfo()
291
+ ? cmd.getFieldsInfo()
292
+ : null;
293
+ }
294
+ }
295
+ }
296
+ }
297
+ async BuildXMLForMainProgramDataView() {
298
+ let message = new StringBuilder();
299
+ let firstMgData = MGDataCollection.Instance.getMGData(0);
300
+ let mainPrg = firstMgData.getMainProg(0);
301
+ while (mainPrg != null) {
302
+ await mainPrg.buildXML(message);
303
+ mainPrg = firstMgData.getNextMainProg(mainPrg.getCtlIdx());
304
+ }
305
+ if (RemoteCommandsProcessor.ShouldScrambleAndUnscrambleMessages) {
306
+ let scrambledChanges = Scrambler.Scramble(message.ToString());
307
+ message = new StringBuilder(scrambledChanges);
308
+ }
309
+ message.Insert(0, XMLConstants.MG_TAG_OPEN);
310
+ message.Append(XMLConstants.MG_TAG_XML_END_TAGGED);
311
+ return message.ToString();
312
+ }
313
+ async Execute_1(sendingInstruction, sessionStage, res) {
314
+ let reqBuf;
315
+ let isInitialCall = sessionStage === CommandsProcessorBase_SessionStage.INITIAL;
316
+ let globalParamsString = null;
317
+ let envVarsString = null;
318
+ if (this.DelayCommandExecution)
319
+ return;
320
+ if (Logger.Instance.LogLevel == Logger_LogLevels.RequestInfo && !isInitialCall)
321
+ await this.UpdateRequestInfo();
322
+ if (isInitialCall) {
323
+ let val = this.RestoreSessionReInitializingDataFromLocalStorage(ConstInterface.IS_SESSION_REINITIALIZING);
324
+ if (val === 'true') {
325
+ RemoteCommandsProcessor.IsSessionReInitializing = (val === "true") ? true : false;
326
+ RemoteCommandsProcessor.lastExceptionMessage = this.RestoreSessionReInitializingDataFromLocalStorage(ConstInterface.LAST_EXCEPTION);
327
+ let ctxRemoved = this.RestoreSessionReInitializingDataFromLocalStorage(ConstInterface.CTX_REMOVED_FROM_SRVR);
328
+ if (ctxRemoved !== '1') {
329
+ Logger.Instance.WriteErrorToLog(RemoteCommandsProcessor.lastExceptionMessage);
330
+ Logger.Instance.WriteToLog("Session is reinitializing...", true);
331
+ }
332
+ }
333
+ }
334
+ if (sendingInstruction === CommandsProcessorBase_SendingInstruction.NO_TASKS_OR_COMMANDS)
335
+ reqBuf = null;
336
+ else {
337
+ reqBuf = await this.PrepareRequest(sendingInstruction === CommandsProcessorBase_SendingInstruction.TASKS_AND_COMMANDS);
338
+ let changes = new StringBuilder();
339
+ let buffer = new StringBuilder();
340
+ if (!RemoteCommandsProcessor.IsSessionReInitializing)
341
+ buffer.Append(reqBuf);
342
+ if (RemoteCommandsProcessor.IsSessionReInitializing) {
343
+ globalParamsString = this.RestoreSessionReInitializingDataFromLocalStorage(ConstInterface.GLOBAL_PARAM_LIST);
344
+ envVarsString = this.RestoreSessionReInitializingDataFromLocalStorage(ConstInterface.ENV_VAR_LIST);
345
+ }
346
+ else {
347
+ globalParamsString = AccessHelper.globalParams.mirrorToXML();
348
+ envVarsString = AccessHelper.envParamsTable.mirrorToXML();
349
+ }
350
+ changes.Append(globalParamsString);
351
+ changes.Append(envVarsString);
352
+ if (changes.Length > 0) {
353
+ changes.Insert(0, "<" + ConstInterface.MG_TAG_ENV_CHANGES + ">");
354
+ changes.Append("</" + ConstInterface.MG_TAG_ENV_CHANGES + ">");
355
+ if (RemoteCommandsProcessor.ShouldScrambleAndUnscrambleMessages) {
356
+ let scrambledChanges = Scrambler.Scramble(changes.ToString());
357
+ changes = new StringBuilder(scrambledChanges);
358
+ }
359
+ changes.Insert(0, XMLConstants.MG_TAG_OPEN);
360
+ changes.Append(XMLConstants.MG_TAG_XML_END_TAGGED);
361
+ buffer.Append(changes.ToString());
362
+ }
363
+ reqBuf = buffer.ToString();
364
+ }
365
+ let requestStatus = new RefParam(RequestStatus.Handled);
366
+ let respBuf = null;
367
+ if (RemoteCommandsProcessor.IsSessionReInitializing) {
368
+ reqBuf = reqBuf + this.RestoreSessionReInitializingDataFromLocalStorage(ConstInterface.MAIN_PROG_VIEW);
369
+ }
370
+ if (RuntimeContextBase.Instance.RemovedContextFromServer)
371
+ requestStatus.value = RequestStatus.Retry;
372
+ else {
373
+ if (RuntimeContextBase.Instance.RemovingContextFromServer)
374
+ RuntimeContextBase.Instance.RemovedContextFromServer = true;
375
+ respBuf = await this.DispatchRequest(this.ServerUrl, reqBuf, sessionStage, requestStatus);
376
+ }
377
+ if (requestStatus.value == RequestStatus.Retry) {
378
+ await this.ReStartSession();
379
+ }
380
+ if (respBuf == null)
381
+ return;
382
+ if (isInitialCall) {
383
+ RemoteCommandsProcessor.InitialUrl = window.location.href;
384
+ if (RemoteCommandsProcessor.IsSessionReInitializing) {
385
+ let dataStorage = window.localStorage;
386
+ dataStorage.removeItem(ConstInterface.IS_SESSION_REINITIALIZING);
387
+ dataStorage.removeItem(ConstInterface.MAIN_PROG_VIEW);
388
+ dataStorage.removeItem(ConstInterface.GLOBAL_PARAM_LIST);
389
+ dataStorage.removeItem(ConstInterface.ENV_VAR_LIST);
390
+ dataStorage.removeItem(ConstInterface.LAST_EXCEPTION);
391
+ }
392
+ }
393
+ FlowMonitorQueue.Instance.enable(false);
394
+ await this.ProcessResponse(respBuf, AccessHelper.mgDataTable.currMgdID, null, res);
395
+ if (RemoteCommandsProcessor.IsSessionReInitializing) {
396
+ AccessHelper.globalParams.RestoreParams(globalParamsString);
397
+ AccessHelper.envParamsTable.RestoreParams(envVarsString);
398
+ let dataStorage = window.localStorage;
399
+ let ctxRemoved = dataStorage.getItem(ConstInterface.CTX_REMOVED_FROM_SRVR);
400
+ if (ctxRemoved === "1") {
401
+ EventsManager.Instance.restoreLastSavedRouteEventFromLocalStorage();
402
+ dataStorage.removeItem(ConstInterface.CTX_REMOVED_FROM_SRVR);
403
+ dataStorage.removeItem(ConstInterface.LAST_ROUTE_EVENT);
404
+ dataStorage.removeItem(ConstInterface.LAST_ROUTE_EVENT_SRC_TSK);
405
+ dataStorage.removeItem(ConstInterface.LAST_ROUTE_EVENT_ARG_LIST);
406
+ }
407
+ RemoteCommandsProcessor.IsSessionReInitializing = false;
408
+ }
409
+ if (sendingInstruction === CommandsProcessorBase_SendingInstruction.TASKS_AND_COMMANDS) {
410
+ AccessHelper.mgDataTable.startTasksIteration();
411
+ let task;
412
+ while ((task = AccessHelper.mgDataTable.getNextTask()) !== null) {
413
+ let dataViewWasRetrieved = task.DataViewWasRetrieved;
414
+ if (dataViewWasRetrieved) {
415
+ await task.RefreshDisplay();
416
+ }
417
+ }
418
+ }
419
+ if (isInitialCall)
420
+ ServerConfig.Instance.setGlobalParams(null);
421
+ }
422
+ async DispatchRequest(url, reqBuf, sessionStage, requestStatus) {
423
+ let response = null;
424
+ let encodedBody = null;
425
+ requestStatus.value = RequestStatus.Handled;
426
+ if (url === null) {
427
+ Logger.Instance.WriteExceptionToLogWithMsg("in sendMsgToSrvr() unknown server");
428
+ return response;
429
+ }
430
+ if (sessionStage !== CommandsProcessorBase_SessionStage.HANDSHAKE) {
431
+ let urlSuffix = this.BuildUrlSuffix(reqBuf !== null, sessionStage === CommandsProcessorBase_SessionStage.INITIAL);
432
+ let reqBufEncoded = HttpUtility.UrlEncode(reqBuf, Encoding.UTF8);
433
+ encodedBody = urlSuffix + reqBufEncoded;
434
+ }
435
+ try {
436
+ if (Logger.Instance.ShouldLogExtendedServerRelatedMessages())
437
+ Logger.Instance.WriteServerMessagesToLog(NString.Format("MESSAGE TO SERVER:\n URL: {0}\n BODY: {1}", url, encodedBody));
438
+ response = await this.ExecuteRequest(url, encodedBody);
439
+ if (!response.toUpperCase().startsWith("<HTML")) {
440
+ let startIdx = response.indexOf("<xml id=\"MGDATA\">");
441
+ if (startIdx > 0)
442
+ response = response.substr(startIdx);
443
+ }
444
+ Logger.Instance.WriteServerMessagesToLog("MESSAGE FROM SERVER: " + response);
445
+ if (sessionStage === CommandsProcessorBase_SessionStage.HANDSHAKE ||
446
+ (response.length > 0 &&
447
+ RemoteCommandsProcessor.ShouldScrambleAndUnscrambleMessages && response !== "<xml id=\"MGDATA\">\n</xml>")) {
448
+ if (sessionStage === CommandsProcessorBase_SessionStage.HANDSHAKE) {
449
+ Debug.Assert(response.length > 0 && response[0] !== '<');
450
+ }
451
+ response = CommandsProcessorBase.UnScramble(response);
452
+ }
453
+ Logger.Instance.WriteDevToLog("MESSAGE FROM SERVER: (size = " + response.length + ")" + OSEnvironment.EolSeq + response);
454
+ this._lastRequestTime = Misc.getSystemMilliseconds();
455
+ }
456
+ catch (ex) {
457
+ if (ex instanceof ServerError) {
458
+ requestStatus.value = RequestStatus.Abort;
459
+ if (sessionStage == CommandsProcessorBase_SessionStage.NORMAL) {
460
+ if (ex.GetCode() == ServerError.ERR_CTX_NOT_FOUND || ex.GetCode() == ServerError.ERR_THREAD_ABORTED) {
461
+ if (RuntimeContextBase.Instance.RemovedContextFromServer) {
462
+ requestStatus.value = RequestStatus.Retry;
463
+ }
464
+ else {
465
+ switch (Environment.Instance.getWebClientReinitSession()) {
466
+ case 'Y':
467
+ requestStatus.value = RequestStatus.Retry;
468
+ break;
469
+ case 'A':
470
+ let retval = await GUIManager.Instance.MessageBox("Error", "Unknown error occurred at server-side." +
471
+ " Would you like to reinitialize the session?", Styles.MSGBOX_BUTTON_YES_NO);
472
+ requestStatus.value = (retval == Styles.MSGBOX_RESULT_YES) ? RequestStatus.Retry : RequestStatus.Abort;
473
+ break;
474
+ case 'N':
475
+ default:
476
+ requestStatus.value = RequestStatus.Abort;
477
+ break;
478
+ }
479
+ }
480
+ if (requestStatus.value == RequestStatus.Abort) {
481
+ Environment.Instance.setWebClientReinitSession('N');
482
+ throw ex;
483
+ }
484
+ else {
485
+ let errForConsole = StrUtil.getConsoleErorString(ex.GetMessage());
486
+ RemoteCommandsProcessor.lastExceptionMessage = "Exception Occured at server side : " + ex.GetCode().toString() + " : " + errForConsole;
487
+ console.log(RemoteCommandsProcessor.lastExceptionMessage);
488
+ }
489
+ return null;
490
+ }
491
+ }
492
+ }
493
+ this.clearLocalStorage();
494
+ throw ex;
495
+ }
496
+ return response;
497
+ }
498
+ clearLocalStorage() {
499
+ window.localStorage.removeItem(ConstInterface.LAST_ROUTE_EVENT);
500
+ window.localStorage.removeItem(ConstInterface.LAST_ROUTE_EVENT_SRC_TSK);
501
+ window.localStorage.removeItem(ConstInterface.LAST_ROUTE_EVENT_ARG_LIST);
502
+ window.localStorage.removeItem(ConstInterface.IS_SESSION_REINITIALIZING);
503
+ window.localStorage.removeItem(ConstInterface.MAIN_PROG_VIEW);
504
+ window.localStorage.removeItem(ConstInterface.GLOBAL_PARAM_LIST);
505
+ window.localStorage.removeItem(ConstInterface.ENV_VAR_LIST);
506
+ window.localStorage.removeItem(ConstInterface.LAST_EXCEPTION);
507
+ window.localStorage.removeItem(ConstInterface.CTX_REMOVED_FROM_SRVR);
508
+ }
509
+ HandleErrorResponse(response) {
510
+ try {
511
+ Logger.Instance.WriteServerMessagesToLog("MESSAGE FROM SERVER: " + response);
512
+ response = CommandsProcessorBase.UnScramble(response);
513
+ Logger.Instance.WriteServerMessagesToLog("MESSAGE FROM SERVER: " + StrUtil.getConsoleErorString(response));
514
+ }
515
+ catch (ex) {
516
+ }
517
+ if (response.startsWith("<xmlerr")) {
518
+ let errorMessageXml = new ErrorMessageXml(response, this._lastRequestTime, AccessHelper.environment.getContextInactivityTimeout());
519
+ throw new ServerError(errorMessageXml.GetMessage(), errorMessageXml.GetCode());
520
+ }
521
+ else if (response.toUpperCase().startsWith("<HTML")) {
522
+ throw new ServerError(response);
523
+ }
524
+ }
525
+ async ExecuteRequest(url, encodedBody) {
526
+ return await this.GetContent(url, false, encodedBody);
527
+ }
528
+ async GetContent(requestedURL, useCache, requestContent) {
529
+ if (isUndefined(requestContent))
530
+ requestContent = null;
531
+ let responseStr;
532
+ try {
533
+ if (requestedURL.startsWith("/"))
534
+ requestedURL = ServerConfig.Instance.getProtocol() + "://" + ServerConfig.Instance.getServer() + requestedURL;
535
+ var spinnerTimer = timer(50, 50);
536
+ var spinnerTimerSubscription = spinnerTimer.subscribe(() => {
537
+ AccessHelper.eventsManager.CheckAndShowSpinner(true);
538
+ });
539
+ let isError = new RefParam(false);
540
+ responseStr = await HttpManager.GetInstance().GetContent(requestedURL, requestContent, useCache, isError);
541
+ spinnerTimerSubscription.unsubscribe();
542
+ spinnerTimerSubscription = null;
543
+ if (isError.value) {
544
+ this.HandleErrorResponse(responseStr);
545
+ }
546
+ }
547
+ catch (ex) {
548
+ if (!(ex instanceof ServerError) || Logger.Instance.LogLevel !== Logger_LogLevels.Basic) {
549
+ Logger.Instance.WriteExceptionToLog(ex, NString.Format("requested URL = \"{0}\"", requestedURL));
550
+ }
551
+ if (!(ex instanceof ServerError)) {
552
+ ex = new ServerError(ex.Message, ex.InnerException ? ex.InnerException : ex);
553
+ }
554
+ throw ex;
555
+ }
556
+ finally {
557
+ if (spinnerTimerSubscription != null)
558
+ spinnerTimerSubscription.unsubscribe();
559
+ }
560
+ return responseStr;
561
+ }
562
+ ClientActivated() {
563
+ }
564
+ BuildUrlSuffix(hasContent, isInitialCall) {
565
+ let prefix = ConstInterface.RC_INDICATION + ConstInterface.RC_TOKEN_CTX_ID + RuntimeContextBase.Instance.ContextID;
566
+ if (!isNullOrUndefined(this.SessionId))
567
+ prefix += (ConstInterface.REQ_ARG_SEPARATOR + ConstInterface.RC_TOKEN_SESSION_ID + this.SessionId);
568
+ if (isInitialCall) {
569
+ if (RemoteCommandsProcessor.IsSessionReInitializing)
570
+ prefix += (ConstInterface.REQ_ARG_SEPARATOR + ConstInterface.WEBCLIENT_REINITIALIZE_REQUEST);
571
+ let globalParams = ServerConfig.Instance.getGlobalParams();
572
+ if (globalParams !== null) {
573
+ globalParams = NString.Replace(globalParams, "+", "%2B");
574
+ prefix += ("&" + ConstInterface.MG_TAG_GLOBALPARAMS + "=" + globalParams);
575
+ }
576
+ }
577
+ if (hasContent) {
578
+ prefix += ("&" + ConstInterface.RC_TOKEN_SESSION_COUNT + this.GetSessionCounter() +
579
+ ConstInterface.REQ_ARG_SEPARATOR + ConstInterface.RC_TOKEN_DATA);
580
+ }
581
+ return prefix;
582
+ }
583
+ async SendMonitorOnly() {
584
+ let flowMonitor = FlowMonitorQueue.Instance;
585
+ if (AccessHelper.mgDataTable == null || AccessHelper.mgDataTable.getMGData(0) == null || AccessHelper.mgDataTable.getMGData(0).IsAborting)
586
+ return;
587
+ if (!flowMonitor.isEmpty()) {
588
+ let buffer = this.BuildMonitorMessage();
589
+ let shouldAccumulateClientLog = false;
590
+ if (shouldAccumulateClientLog) {
591
+ }
592
+ else {
593
+ try {
594
+ let requestStatus = new RefParam(RequestStatus.Handled);
595
+ await this.DispatchRequest(this.ServerUrl, buffer.ToString(), CommandsProcessorBase_SessionStage.NORMAL, requestStatus);
596
+ }
597
+ catch (err) {
598
+ }
599
+ }
600
+ }
601
+ }
602
+ BuildMonitorMessage() {
603
+ let buffer = new StringBuilder(1000);
604
+ let flowMonitor = FlowMonitorQueue.Instance;
605
+ if (!RemoteCommandsProcessor.ShouldScrambleAndUnscrambleMessages) {
606
+ buffer.Append(XMLConstants.MG_TAG_OPEN);
607
+ flowMonitor.buildXML(buffer);
608
+ }
609
+ else {
610
+ flowMonitor.buildXML(buffer);
611
+ let scrambledOut = Scrambler.Scramble(buffer.ToString());
612
+ buffer = new StringBuilder(1000);
613
+ buffer.Append(XMLConstants.MG_TAG_OPEN + scrambledOut);
614
+ }
615
+ buffer.Append("</" + XMLConstants.MG_TAG_XML + XMLConstants.TAG_CLOSE);
616
+ return buffer;
617
+ }
618
+ RegisterDelegates() {
619
+ HttpClientEvents.GetSessionCounter_Event = this.GetSessionCounter.bind(this);
620
+ HttpClientEvents.CheckAndSetSessionCounter_Event = this.CheckAndSetSessionCounter.bind(this);
621
+ HttpClientEvents.ComputeAndLogRequestInfo_Event = this.ComputeAndLogRequestInfo.bind(this);
622
+ AccessHelper.eventsManager.SpinnerStopped.subscribe(clientBusyTime => this.ClientActivated());
623
+ }
624
+ ComputeAndLogRequestInfo(contentLength, roundTrip, isLoggingResponse) {
625
+ if (!isNullOrUndefined(this._requestInfo.serverCallAt)) {
626
+ this._requestInfo.extraInfo.contentLength = contentLength;
627
+ this._requestInfo.extraInfo.timeStamp = new Date().toString();
628
+ let extraMessageStr = isLoggingResponse ? 'Response ⤵' : 'Request ⤵';
629
+ if (isLoggingResponse) {
630
+ this._requestInfo.roundtripTime = roundTrip;
631
+ }
632
+ Logger.Instance.WriteRequestInfoToLog(this._requestInfo, extraMessageStr);
633
+ if (isLoggingResponse)
634
+ this._requestInfo.clear();
635
+ }
636
+ }
637
+ static set ShouldScrambleAndUnscrambleMessages(value) {
638
+ RemoteCommandsProcessor._shouldScrambleAndUnscrambleMessages = value;
639
+ Logger.Instance.WriteServerMessagesToLog(NString.Format("ShouldScrambleAndUnscrambleMessages.Set: {0}", this._shouldScrambleAndUnscrambleMessages));
640
+ }
641
+ static get ShouldScrambleAndUnscrambleMessages() {
642
+ Logger.Instance.WriteServerMessagesToLog(NString.Format("ShouldScrambleAndUnscrambleMessages.Get: {0}", this._shouldScrambleAndUnscrambleMessages));
643
+ return RemoteCommandsProcessor._shouldScrambleAndUnscrambleMessages;
644
+ }
645
+ parseLogLevel(strLogLevel) {
646
+ let logLevel = Logger_LogLevels.None;
647
+ if (!NString.IsNullOrEmpty(strLogLevel)) {
648
+ if (strLogLevel.toUpperCase().startsWith("SERVER"))
649
+ logLevel = strLogLevel.endsWith("#") ? Logger_LogLevels.ServerMessages : Logger_LogLevels.Server;
650
+ else if (strLogLevel.toUpperCase().startsWith("S") || strLogLevel.toUpperCase().startsWith("Q"))
651
+ logLevel = Logger_LogLevels.Support;
652
+ else if (strLogLevel.toUpperCase().startsWith("G"))
653
+ logLevel = Logger_LogLevels.Gui;
654
+ else if (strLogLevel.toUpperCase().startsWith("D"))
655
+ logLevel = Logger_LogLevels.Development;
656
+ else if (strLogLevel.toUpperCase().startsWith("B"))
657
+ logLevel = Logger_LogLevels.Basic;
658
+ else if (strLogLevel.toUpperCase().startsWith("R"))
659
+ logLevel = Logger_LogLevels.RequestInfo;
660
+ }
661
+ return logLevel;
662
+ }
663
+ async PrepareRequest(serializeTasks) {
664
+ let xmlBuf = new StringBuilder();
665
+ xmlBuf.Append(XMLConstants.MG_TAG_OPEN);
666
+ if (AccessHelper.mgDataTable.getCurrMGData() !== null) {
667
+ let xmlUnscrambled = new StringBuilder();
668
+ await AccessHelper.mgDataTable.buildXML(xmlUnscrambled, serializeTasks);
669
+ if (RemoteCommandsProcessor.ShouldScrambleAndUnscrambleMessages)
670
+ xmlBuf.Append(Scrambler.Scramble(xmlUnscrambled.ToString()));
671
+ else
672
+ xmlBuf.Append(xmlUnscrambled.ToString());
673
+ }
674
+ xmlBuf.Append("</" + XMLConstants.MG_TAG_XML + XMLConstants.TAG_CLOSE);
675
+ return xmlBuf.ToString();
676
+ }
677
+ async ProcessResponse(response, currMgdID, openingTaskDetails, res) {
678
+ Logger.Instance.WriteDevToLog("<-- ProcessResponse started -->");
679
+ if (openingTaskDetails === null)
680
+ openingTaskDetails = new OpeningTaskDetails();
681
+ let systemMilliseconds = Misc.getSystemMilliseconds();
682
+ if (response === null || response.trim().length === 0)
683
+ return;
684
+ AccessHelper.mgDataTable.currMgdID = currMgdID;
685
+ RuntimeContextBase.Instance.Parser.push();
686
+ RuntimeContextBase.Instance.Parser.setXMLdata(response);
687
+ RuntimeContextBase.Instance.Parser.setCurrIndex(0);
688
+ let currMGData = AccessHelper.mgDataTable.getCurrMGData();
689
+ await currMGData.fillData(openingTaskDetails, RuntimeContextBase.Instance.Parser);
690
+ RuntimeContextBase.Instance.Parser.setXMLdata(null);
691
+ RuntimeContextBase.Instance.Parser.pop();
692
+ Logger.Instance.WriteDevToLog("<-- ProcessResponse finished --> (" + (Misc.getSystemMilliseconds() - systemMilliseconds) + ")");
693
+ await currMGData.CmdsToClient.Execute(res);
694
+ await this.ProcessRecovery();
695
+ }
696
+ async ProcessRecovery() {
697
+ AccessHelper.eventsManager.pushNewExecStacks();
698
+ await AccessHelper.mgDataTable.processRecovery();
699
+ AccessHelper.eventsManager.popNewExecStacks();
700
+ }
701
+ }
702
+ class HandshakeResponse {
703
+ static SYSTEM_LOGIN_AD = 'D';
704
+ _scrambleMessages = true;
705
+ get ScrambleMessages() {
706
+ return this._scrambleMessages;
707
+ }
708
+ _contextId = null;
709
+ get ContextId() {
710
+ return this._contextId;
711
+ }
712
+ _privateSessionId = null;
713
+ get GetSessionId() {
714
+ return this._privateSessionId;
715
+ }
716
+ _inputPassword = false;
717
+ get InputPassword() {
718
+ return this._inputPassword;
719
+ }
720
+ _httpTimeout = 0;
721
+ get HttpTimeout() {
722
+ return this._httpTimeout;
723
+ }
724
+ _systemLogin = null;
725
+ get SystemLogin() {
726
+ return this._systemLogin;
727
+ }
728
+ _maxInternalLogLevel = null;
729
+ get MaxInternalLogLevel() {
730
+ return this._maxInternalLogLevel;
731
+ }
732
+ constructor(responseXML) {
733
+ try {
734
+ JSON_Utils.JSONFromXML(responseXML, this.FillFromJSON.bind(this));
735
+ }
736
+ catch (ex) {
737
+ Logger.Instance.WriteExceptionToLog(ex, responseXML);
738
+ }
739
+ }
740
+ FillFromJSON(error, result) {
741
+ if (error != null) {
742
+ throw error;
743
+ }
744
+ let response = result['Richclientresponse'];
745
+ for (let elementName in response) {
746
+ if (response.hasOwnProperty(elementName)) {
747
+ switch (elementName) {
748
+ case "ContextID":
749
+ this._contextId = response[elementName][0];
750
+ break;
751
+ case "SessionID":
752
+ this._privateSessionId = response[elementName][0];
753
+ break;
754
+ case "Environment":
755
+ let envAttributes = response["Environment"][0]['$'];
756
+ if (!isNullOrUndefined(envAttributes["ScrambleMessages"])) {
757
+ Debug.Assert(envAttributes["ScrambleMessages"] === "N");
758
+ this._scrambleMessages = false;
759
+ }
760
+ if (!isNullOrUndefined(envAttributes["MaxInternalLogLevel"]))
761
+ this._maxInternalLogLevel = envAttributes["MaxInternalLogLevel"];
762
+ if (!isNullOrUndefined(envAttributes["InputPassword"]) && envAttributes["InputPassword"].toLocaleLowerCase() === "y")
763
+ this._inputPassword = true;
764
+ if (!isNullOrUndefined(envAttributes["SystemLogin"]))
765
+ this._systemLogin = envAttributes["SystemLogin"];
766
+ if (!isNullOrUndefined(envAttributes[ConstInterface.MG_TAG_HTTP_COMMUNICATION_TIMEOUT]))
767
+ this._httpTimeout = +envAttributes[ConstInterface.MG_TAG_HTTP_COMMUNICATION_TIMEOUT];
768
+ if (!isNullOrUndefined(envAttributes["ForwardSlash"]))
769
+ AccessHelper.environment.ForwardSlashUsage = envAttributes["ForwardSlash"];
770
+ break;
771
+ }
772
+ }
773
+ }
774
+ }
775
+ }
776
+ class ErrorMessageXml {
777
+ _lastRequestTime = 0;
778
+ contextInactivityTimeout;
779
+ _errorMessage = null;
780
+ _errorCode = 0;
781
+ _middlewareAddress = null;
782
+ _parsingFailed = false;
783
+ constructor(xmlContent, lastRequestTime, contextInactivityTimeout) {
784
+ this._lastRequestTime = lastRequestTime;
785
+ this.contextInactivityTimeout = contextInactivityTimeout;
786
+ try {
787
+ JSON_Utils.JSONFromXML(xmlContent, this.FillFromJSON.bind(this));
788
+ }
789
+ catch (ex) {
790
+ Logger.Instance.WriteExceptionToLog(ex);
791
+ Misc.WriteStackTrace(ex);
792
+ this._parsingFailed = true;
793
+ }
794
+ }
795
+ FillFromJSON(error, result) {
796
+ if (error != null) {
797
+ throw error;
798
+ }
799
+ let xmlerr = result['xmlerr'];
800
+ for (let elementName in xmlerr) {
801
+ if (xmlerr.hasOwnProperty(elementName)) {
802
+ switch (elementName) {
803
+ case "errmsg":
804
+ this._errorMessage = xmlerr[elementName][0];
805
+ break;
806
+ case "errcode":
807
+ this._errorCode = +(xmlerr[elementName]);
808
+ break;
809
+ case "server":
810
+ this._middlewareAddress = xmlerr[elementName][0];
811
+ break;
812
+ case "appname":
813
+ case "prgname":
814
+ case "arguments":
815
+ case "username":
816
+ case "xmlerr":
817
+ break;
818
+ default:
819
+ Logger.Instance.WriteExceptionToLogWithMsg(NString.Format("Unknown element: '{0}'", elementName));
820
+ break;
821
+ }
822
+ }
823
+ }
824
+ }
825
+ GetCode() {
826
+ return this._errorCode;
827
+ }
828
+ GetMessage() {
829
+ let sb = new StringBuilder();
830
+ if (this._parsingFailed) {
831
+ sb.Append(AccessHelper.languageData.getConstMessage(MsgInterface.RC_STR_F7_UNEXPECTED_ERR));
832
+ }
833
+ else {
834
+ switch (this._errorCode) {
835
+ case ServerError.ERR_CTX_NOT_FOUND:
836
+ if (this.InactivityTimeoutExpired())
837
+ 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)));
838
+ else
839
+ sb.Append(NString.Format("{0} ({1}).", AccessHelper.languageData.getConstMessage(MsgInterface.STR_ERR_SESSION_CLOSED), this._errorCode));
840
+ break;
841
+ case ServerError.ERR_WEBCLIENT_PROGRAM_RELOADED:
842
+ sb.Append(AccessHelper.languageData.getConstMessage(MsgInterface.STR_ERR_WEBCLIENT_PROGRAM_RELOADED));
843
+ break;
844
+ case ServerError.ERR_EXECUTED_PROGRAM_CHANGED:
845
+ sb.Append(AccessHelper.languageData.getConstMessage(MsgInterface.STR_ERR_EXECUTED_PROGRAM_CHANGED));
846
+ break;
847
+ case ServerError.ERR_AUTHENTICATION:
848
+ sb.Append(AccessHelper.languageData.getConstMessage(MsgInterface.USRINP_STR_BADPASSW));
849
+ break;
850
+ case ServerError.ERR_ACCESS_DENIED:
851
+ sb.Append(AccessHelper.languageData.getConstMessage(MsgInterface.STR_ERR_AUTHORIZATION_FAILURE));
852
+ break;
853
+ default:
854
+ sb.Append(this._errorMessage);
855
+ break;
856
+ }
857
+ sb.Append(OSEnvironment.EolSeq + OSEnvironment.EolSeq);
858
+ if (!ServerConfig.Instance.ShouldDisplayGenericError()) {
859
+ sb.Append(AccessHelper.languageData.getConstMessage(MsgInterface.BROWSER_OPT_INFO_SERVER_STR) + ": ");
860
+ sb.Append(ServerConfig.Instance.getServer());
861
+ if (!NString.IsNullOrEmpty(this._middlewareAddress)) {
862
+ sb.Append(" --> ");
863
+ sb.Append(this._middlewareAddress);
864
+ }
865
+ sb.Append(OSEnvironment.EolSeq);
866
+ }
867
+ sb.Append(AccessHelper.languageData.getConstMessage(MsgInterface.TASKRULE_STR_APPLICATION) + ": \"");
868
+ sb.Append(ServerConfig.Instance.getAppName());
869
+ sb.Append("\" (\"");
870
+ sb.Append("\")");
871
+ }
872
+ return sb.ToString();
873
+ }
874
+ InactivityTimeoutExpired() {
875
+ let expired = false;
876
+ if (this.contextInactivityTimeout > 0) {
877
+ let currTimeMilli = Misc.getSystemMilliseconds();
878
+ expired = ((currTimeMilli - this._lastRequestTime) > (this.contextInactivityTimeout * 100));
879
+ }
880
+ return expired;
881
+ }
882
+ }
883
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiUmVtb3RlQ29tbWFuZHNQcm9jZXNzb3IuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy9lbmdpbmUvc3JjL3JlbW90ZS9SZW1vdGVDb21tYW5kc1Byb2Nlc3Nvci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQ0wsTUFBTSxFQUNOLFVBQVUsRUFDVixNQUFNLEVBQ04sZ0JBQWdCLEVBQ2hCLElBQUksRUFDSixZQUFZLEVBQ1osYUFBYSxFQUNiLFdBQVcsRUFDWCxPQUFPLEVBQ1AsWUFBWSxFQUNiLE1BQU0sa0JBQWtCLENBQUM7QUFDMUIsT0FBTyx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ioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKlxyXG4gIC8vICoqKioqKioqIFdoZW4gY2hhbmdpbmcgV0VCX0NPTU1VTklDQVRJT05fUFJPVE9DT0xfVkVSU0lPTiwgcGxlYXNlIGNoYW5nZSBvbiBtb2JpbGUgcGxhdGZvcm1zIGFzIHdlbGw6XHJcbiAgLy8gKioqKioqKiogVzEwTTogUmVtb3RlQ29tbWFuZHNQcm9jZXNzb3IuY3NcclxuICBwcml2YXRlIHN0YXRpYyByZWFkb25seSBXRUJfQ09NTVVOSUNBVElPTl9QUk9UT0NPTF9WRVJTSU9OOiBzdHJpbmcgPSBcIjE0MDAyXCI7XHJcbiAgLy8gKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKipcclxuICAvLyAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKlxyXG5cclxuICAvLyBUT0RPOiBDaGVjayBpZiB3ZSBuZWVkIF9sb2dBY2N1bXVsYXRvci5cclxuICAvLyBwcml2YXRlIF9sb2dBY2N1bXVsYXRvcjogQ2xpZW50TG9nQWNjdW11bGF0b3IgPSBudWxsO1xyXG5cclxuICBwcml2YXRlIF9sYXN0UmVxdWVzdFRpbWU6IG51bWJlciA9IDA7IC8vIHRoZSB0aW1lIG9mIHRoZSBsYXN0IHJlcXVlc3QgdG8gdGhlIHNlcnZlclxyXG5cclxuICBTZXJ2ZXJVcmw6IHN0cmluZyA9IG51bGw7XHJcbiAgcHJpdmF0ZSBzdGF0aWMgX3Nob3VsZFNjcmFtYmxlQW5kVW5zY3JhbWJsZU1lc3NhZ2VzOiBib29sZWFuID0gZmFsc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ICAgICAgICAgICBsZXQgc2VydmVyRXJyb3I6IFNlcnZlckVycm9yID0gPFNlcnZlckVycm9yPmV4O1xyXG4gICAgICAgICAgICBpZiAoU2VydmVyQ29uZmlnLkluc3RhbmNlLmdldFNraXBBdXRoZW50aWNhdGlvbkRpYWxvZygpKSB7XHJcbiAgICAgICAgICAgICAgc3dpdGNoIChzZXJ2ZXJFcnJvci5HZXRDb2RlKCkpIHtcclxuICAgICAgICAgICAgICAgIGNhc2UgU2VydmVyRXJyb3IuRVJSX0FDQ0VTU19ERU5JRUQ6XHJcbiAgICAgICAgICAgICAgICAvLyBFeHRlcm5hbCBBdXRoZW50aWNhdG9yIGF1dGhlbnRpY2F0ZWQgdGhlIHVzZXIsIGFjY2VzcyB0byB0aGUgYXBwbGljYXRpb24gd2Fzbid0IGF1dGhvcml6ZWQuXHJcbiAgICAgICAgICAgICAgICBjYXNlIFNlcnZlckVycm9yLkVSUl9BVVRIRU5USUNBVElPTjpcclxuICAgICAgICAgICAgICAgICAgLy8gRXh0ZXJuYWwgQXV0aGVudGljYXRvciBhdXRoZW50aWNhdGVkIHRoZSB1c2VyIGJ1dCBhcHBsaWNhdGlvbiBhdXRoZW50aWNhdGlvbiBmYWlsZWRcclxuICAgICAgICAgICAgICAgICAgU2VydmVyQ29uZmlnLkluc3RhbmNlLnNldFNraXBBdXRoZW50aWNhdGlvbkRpYWxvZyhmYWxzZSk7XHJcbiAgICAgICAgICAgICAgICAgIHRocm93IHNlcnZlckVycm9yO1xyXG4gICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgLy8gdGhlIHNlc3Npb24gd2lsbCBuZXZlciBwcm92aWRlIGEgd2F5IHRvIGNoYW5nZSB0aGUgY3JlZGVudGlhbHMsIHRoZXJlZm9yZSBhYm9ydFxyXG4gICAgICAgICAgICBpZiAoIWhhbmRzaGFrZVJlc3BvbnNlLklucHV0UGFzc3dvcmQpXHJcbiAgICAgICAgICAgICAgdGhyb3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AgIGlmIChyZXNwb25zZS5oYXNPd25Qcm9wZXJ0eShlbGVtZW50TmFtZSkpIHtcclxuXHJcbiAgICAgICAgc3dpdGNoIChlbGVtZW50TmFtZSkge1xyXG4gICAgICAgICAgY2FzZSBcIkNvbnRleHRJRFwiOlxyXG4gICAgICAgICAgICB0aGlzLl9jb250ZXh0SWQgPSByZXNwb25zZVtlbGVtZW50TmFtZV1bMF07XHJcbiAgICAgICAgICAgIGJyZWFrO1xyXG4gICAgICAgICAgY2FzZSBcIlNlc3Npb25JRFwiOlxyXG4gICAgICAgICAgICB0aGlzLl9wcml2YXRlU2Vzc2lvbklkID0gcmVzcG9uc2VbZWxlbWVudE5hbWVdWzBdO1xyXG4gICAgICAgICAgICBicmVhaztcclxuICAgICAgICAgIGNhc2UgXCJFbnZpcm9ubWVudFwiOlxyXG4gICAgICAgICAgICBsZXQgZW52QXR0cmlidXRlcyA9IHJlc3BvbnNlW1wiRW52aXJvbm1lbnRcIl1bMF1bJyQnXTtcclxuXHJcbiAgICAgICAgICAgIGlmICghaXNOdWxsT3JVbmRlZmluZWQoZW52QXR0cmlidXRlc1tcIlNjcmFtYmxlTWVzc2FnZXNcIl0pKSB7XHJcbiAgICAgICAgICAgICAgRGVidWcuQXNzZXJ0KGVudkF0dHJpYnV0ZXNbXCJTY3JhbWJsZU1lc3NhZ2VzXCJdID09PSBcIk5cIik7XHJcbiAgICAgICAgICAgICAgdGhpcy5fc2NyYW1ibGVNZXNzYWdlcyA9IGZhbHNlO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmICghaXNOdWxsT3JVbmRlZmluZWQoZW52QXR0cmlidXRlc1tcIk1heEludGVybmFsTG9nTGV2ZWxcIl0pKVxyXG4gICAgICAgICAgICAgIHRoaXMuX21heEludGVybmFsTG9nTGV2ZWwgPSBlbnZBdHRyaWJ1dGVzW1wiTWF4SW50ZXJuYWxMb2dMZXZlbFwiXTtcclxuICAgICAgICAgICAgaWYgKCFpc051bGxPclVuZ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