@magic-xpa/engine 4.1100.0-dev4110.98 → 4.1100.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +7 -7
- package/{esm2020 → esm2022}/index.mjs +188 -188
- package/{esm2020 → esm2022}/magic-xpa-engine.mjs +1 -1
- package/esm2022/src/AccessHelper.mjs +15 -0
- package/esm2022/src/ClientManager.mjs +421 -0
- package/esm2022/src/CommandsProcessorBase.mjs +56 -0
- package/{esm2020 → esm2022}/src/CommandsProcessorManager.mjs +25 -25
- package/esm2022/src/CommandsTable.mjs +162 -0
- package/esm2022/src/ConstInterface.mjs +517 -0
- package/{esm2020 → esm2022}/src/CurrentClientVersion.mjs +2 -2
- package/esm2022/src/FlowMonitorInterface.mjs +16 -0
- package/esm2022/src/GUIManager.mjs +62 -0
- package/esm2022/src/GlobalCommandsManager.mjs +34 -0
- package/esm2022/src/GuiEventsProcessor.mjs +156 -0
- package/{esm2020 → esm2022}/src/ICommandsTable.mjs +1 -1
- package/esm2022/src/ServerConfig.mjs +122 -0
- package/{esm2020 → esm2022}/src/bridge/IGuiEvent.mjs +19 -19
- package/esm2022/src/bridge/MagicBridge.mjs +41 -0
- package/esm2022/src/commands/ClientOriginatedCommandTaskTag.mjs +12 -0
- package/{esm2020 → esm2022}/src/commands/ClientToServer/AddUserLocateDataViewCommand.mjs +8 -8
- package/{esm2020 → esm2022}/src/commands/ClientToServer/AddUserRangeDataviewCommand.mjs +9 -9
- package/{esm2020 → esm2022}/src/commands/ClientToServer/AddUserSortDataViewCommand.mjs +9 -9
- package/esm2022/src/commands/ClientToServer/BrowserEscEventCommand.mjs +26 -0
- package/{esm2020 → esm2022}/src/commands/ClientToServer/ClientOriginatedCommand.mjs +14 -14
- package/{esm2020 → esm2022}/src/commands/ClientToServer/ClientOriginatedCommandSerializer.mjs +59 -59
- package/esm2022/src/commands/ClientToServer/ColumnSortEventCommand.mjs +29 -0
- package/esm2022/src/commands/ClientToServer/CommandFactory.mjs +261 -0
- package/esm2022/src/commands/ClientToServer/CommandSerializationHelper.mjs +67 -0
- package/esm2022/src/commands/ClientToServer/ComputeEventCommand.mjs +26 -0
- package/{esm2020 → esm2022}/src/commands/ClientToServer/ContextTerminationEventCommand.mjs +24 -21
- package/{esm2020 → esm2022}/src/commands/ClientToServer/ContextTimeoutResetCommand.mjs +23 -20
- package/{esm2020 → esm2022}/src/commands/ClientToServer/ControlItemsRefreshCommand.mjs +8 -8
- package/esm2022/src/commands/ClientToServer/DataViewOutputCommand.mjs +13 -0
- package/{esm2020 → esm2022}/src/commands/ClientToServer/DataviewCommand.mjs +44 -44
- package/esm2022/src/commands/ClientToServer/EvaluateCommand.mjs +40 -0
- package/{esm2020 → esm2022}/src/commands/ClientToServer/EventCommand.mjs +43 -40
- package/esm2022/src/commands/ClientToServer/ExecOperCommand.mjs +70 -0
- package/esm2022/src/commands/ClientToServer/FetchDataControlValuesEventCommand.mjs +25 -0
- package/{esm2020 → esm2022}/src/commands/ClientToServer/GlobalParamsQueryCommand.mjs +10 -10
- package/{esm2020 → esm2022}/src/commands/ClientToServer/ICommandTaskTag.mjs +1 -1
- package/esm2022/src/commands/ClientToServer/IndexChangeEventCommand.mjs +24 -0
- package/esm2022/src/commands/ClientToServer/IniputForceWriteCommand.mjs +26 -0
- package/{esm2020 → esm2022}/src/commands/ClientToServer/NonReversibleExitEventCommand.mjs +26 -23
- package/{esm2020 → esm2022}/src/commands/ClientToServer/QueryCommand.mjs +20 -20
- package/esm2022/src/commands/ClientToServer/RecomputeCommand.mjs +30 -0
- package/esm2022/src/commands/ClientToServer/RefreshEventCommand.mjs +30 -0
- package/esm2022/src/commands/ClientToServer/RefreshScreenEventCommand.mjs +27 -0
- package/esm2022/src/commands/ClientToServer/RollbackEventCommand.mjs +43 -0
- package/esm2022/src/commands/ClientToServer/SelectProgramCommand.mjs +19 -0
- package/{esm2020 → esm2022}/src/commands/ClientToServer/SetTransactionStateDataviewCommand.mjs +9 -9
- package/esm2022/src/commands/ClientToServer/SubformOpenEventCommand.mjs +24 -0
- package/esm2022/src/commands/ClientToServer/SubformRefreshEventCommand.mjs +27 -0
- package/esm2022/src/commands/ClientToServer/TransactionCommand.mjs +34 -0
- package/{esm2020 → esm2022}/src/commands/ClientToServer/UnloadCommand.mjs +18 -15
- package/esm2022/src/commands/ClientToServer/WriteMessageToServerLogCommand.mjs +18 -0
- package/esm2022/src/commands/DataViewCommandBase.mjs +8 -0
- package/{esm2020 → esm2022}/src/commands/IClientCommand.mjs +1 -1
- package/esm2022/src/commands/IClientTargetedCommand.mjs +13 -0
- package/{esm2020 → esm2022}/src/commands/IClientToServerCommandInfo.mjs +2 -2
- package/esm2022/src/commands/ServerToClient/AbortCommand.mjs +65 -0
- package/{esm2020 → esm2022}/src/commands/ServerToClient/AddLocateCommand.mjs +21 -21
- package/{esm2020 → esm2022}/src/commands/ServerToClient/AddRangeCommand.mjs +62 -62
- package/{esm2020 → esm2022}/src/commands/ServerToClient/AddSortCommand.mjs +33 -33
- package/esm2022/src/commands/ServerToClient/ClientRefreshCommand.mjs +25 -0
- package/esm2022/src/commands/ServerToClient/ClientTargetedCommandBase.mjs +24 -0
- package/esm2022/src/commands/ServerToClient/EnhancedVerifyCommand.mjs +45 -0
- package/esm2022/src/commands/ServerToClient/OpenURLCommand.mjs +221 -0
- package/{esm2020 → esm2022}/src/commands/ServerToClient/ResetLocateCommand.mjs +14 -14
- package/{esm2020 → esm2022}/src/commands/ServerToClient/ResetRangeCommand.mjs +14 -14
- package/{esm2020 → esm2022}/src/commands/ServerToClient/ResetSortCommand.mjs +14 -14
- package/esm2022/src/commands/ServerToClient/ResultCommand.mjs +37 -0
- package/esm2022/src/commands/ServerToClient/VerifyCommand.mjs +83 -0
- package/{esm2020 → esm2022}/src/commands/ServerToClient/XMLBasedCommandBuilder.mjs +132 -132
- package/{esm2020 → esm2022}/src/communications/IConnectionStateManager.mjs +1 -1
- package/esm2022/src/communications/InteractiveCommunicationsFailureHandler.mjs +15 -0
- package/{esm2020 → esm2022}/src/data/DataSourceIdKey.mjs +2 -2
- package/esm2022/src/data/DataView.mjs +1613 -0
- package/{esm2020 → esm2022}/src/data/DataViewBase.mjs +3 -3
- package/esm2022/src/data/DataviewManager.mjs +28 -0
- package/esm2022/src/data/DataviewManagerBase.mjs +15 -0
- package/esm2022/src/data/DvCache.mjs +67 -0
- package/esm2022/src/data/Field.mjs +646 -0
- package/esm2022/src/data/FieldBase.mjs +15 -0
- package/esm2022/src/data/FieldsTable.mjs +103 -0
- package/{esm2020 → esm2022}/src/data/IRecordsTable.mjs +1 -1
- package/{esm2020 → esm2022}/src/data/Key.mjs +88 -88
- package/esm2022/src/data/Record.mjs +880 -0
- package/{esm2020 → esm2022}/src/data/RecordOutOfDataViewException.mjs +15 -15
- package/esm2022/src/data/RecordsTable.mjs +267 -0
- package/{esm2020 → esm2022}/src/data/TaskTransactionManager.mjs +107 -103
- package/{esm2020 → esm2022}/src/data/XMLBasedDcValuesBuilder.mjs +74 -74
- package/{esm2020 → esm2022}/src/enums.mjs +23 -23
- package/esm2022/src/env/EnvVariablesTable.mjs +340 -0
- package/esm2022/src/env/Environment.mjs +487 -0
- package/{esm2020 → esm2022}/src/env/ILanguageData.mjs +1 -1
- package/esm2022/src/env/LanguageData.mjs +227 -0
- package/{esm2020 → esm2022}/src/env/MirrorString.mjs +65 -65
- package/esm2022/src/event/ActionManager.mjs +91 -0
- package/esm2022/src/event/Event.mjs +1333 -0
- package/esm2022/src/event/EventHandler.mjs +766 -0
- package/esm2022/src/event/EventHandlerPosition.mjs +204 -0
- package/esm2022/src/event/EventsManager.mjs +2988 -0
- package/{esm2020 → esm2022}/src/event/IEventsManager.mjs +6 -6
- package/esm2022/src/event/RunTimeEvent.mjs +399 -0
- package/{esm2020 → esm2022}/src/event/RunTimeEventBase.mjs +3 -3
- package/esm2022/src/event/UserEventsTable.mjs +47 -0
- package/esm2022/src/exp/ExpTable.mjs +57 -0
- package/esm2022/src/exp/Expression.mjs +200 -0
- package/esm2022/src/exp/ExpressionDict.mjs +727 -0
- package/esm2022/src/exp/ExpressionEvaluator.mjs +4206 -0
- package/esm2022/src/exp/ExpressionLocalJpn.mjs +314 -0
- package/{esm2020 → esm2022}/src/exp/GlobalParamsTable.mjs +85 -85
- package/esm2022/src/exp/YesNoExp.mjs +36 -0
- package/esm2022/src/gui/CreatedFormVector.mjs +23 -0
- package/esm2022/src/gui/FormsTable.mjs +66 -0
- package/esm2022/src/gui/MgControl.mjs +363 -0
- package/esm2022/src/gui/MgForm.mjs +1224 -0
- package/esm2022/src/http/HttpManager.mjs +97 -0
- package/esm2022/src/http/client/HttpClientAsync.mjs +68 -0
- package/{esm2020 → esm2022}/src/http/client/HttpClientBase.mjs +132 -132
- package/esm2022/src/http/client/HttpClientEvents.mjs +39 -0
- package/esm2022/src/http/client/HttpClientSync.mjs +42 -0
- package/esm2022/src/http/client/HttpUtility.mjs +84 -0
- package/{esm2020 → esm2022}/src/http/client/ICommunicationsFailureHandler.mjs +1 -1
- package/{esm2020 → esm2022}/src/remote/AddUserLocateRemoteDataViewCommand.mjs +18 -18
- package/{esm2020 → esm2022}/src/remote/AddUserRangeRemoteDataViewCommand.mjs +18 -18
- package/{esm2020 → esm2022}/src/remote/AddUserSortRemoteDataViewCommand.mjs +18 -18
- package/esm2022/src/remote/RemoteCommandsProcessor.mjs +883 -0
- package/{esm2020 → esm2022}/src/remote/RemoteControlItemsRefreshCommand.mjs +25 -25
- package/{esm2020 → esm2022}/src/remote/RemoteDataViewCommandBase.mjs +24 -24
- package/{esm2020 → esm2022}/src/remote/RemoteDataViewCommandFactory.mjs +60 -60
- package/{esm2020 → esm2022}/src/remote/RemoteDataViewCommandUpdateNonModifiable.mjs +15 -15
- package/{esm2020 → esm2022}/src/remote/RemoteDataviewManager.mjs +17 -17
- package/{esm2020 → esm2022}/src/remote/RemoteInitDataViewCommand.mjs +10 -10
- package/{esm2020 → esm2022}/src/remote/ResetUserLocateRemoteDataviewCommand.mjs +16 -16
- package/{esm2020 → esm2022}/src/remote/ResetUserRangeRemoteDataviewCommand.mjs +12 -12
- package/{esm2020 → esm2022}/src/remote/ResetUserSortRemoteDataviewCommand.mjs +15 -15
- package/esm2022/src/remote/ServerError.mjs +40 -0
- package/{esm2020 → esm2022}/src/remote/SetTransactionStateRemoteDataViewCommand.mjs +19 -19
- package/esm2022/src/rt/Argument.mjs +265 -0
- package/esm2022/src/rt/ArgumentsList.mjs +103 -0
- package/esm2022/src/rt/Boundary.mjs +152 -0
- package/esm2022/src/rt/CompMainPrgTable.mjs +63 -0
- package/esm2022/src/rt/DataviewHeaderBase.mjs +98 -0
- package/{esm2020 → esm2022}/src/rt/DataviewHeaderFactory.mjs +6 -6
- package/esm2022/src/rt/DataviewHeaders.mjs +53 -0
- package/{esm2020 → esm2022}/src/rt/DataviewHeadersSaxHandler.mjs +38 -38
- package/{esm2020 → esm2022}/src/rt/ExecutionStack.mjs +94 -94
- package/{esm2020 → esm2022}/src/rt/ExecutionStackEntry.mjs +17 -17
- package/{esm2020 → esm2022}/src/rt/HandlersTable.mjs +96 -96
- package/{esm2020 → esm2022}/src/rt/IDataSourceViewDefinition.mjs +1 -1
- package/{esm2020 → esm2022}/src/rt/IDataviewHeader.mjs +1 -1
- package/{esm2020 → esm2022}/src/rt/IResultValue.mjs +1 -1
- package/esm2022/src/rt/LastFocusedManager.mjs +65 -0
- package/esm2022/src/rt/Operation.mjs +735 -0
- package/esm2022/src/rt/OperationTable.mjs +67 -0
- package/esm2022/src/rt/Recompute.mjs +355 -0
- package/{esm2020 → esm2022}/src/rt/RecomputeTable.mjs +62 -62
- package/{esm2020 → esm2022}/src/rt/RemoteDataviewHeader.mjs +108 -108
- package/esm2022/src/rt/ResultValue.mjs +10 -0
- package/esm2022/src/rt/TableCache.mjs +177 -0
- package/esm2022/src/rt/TableCacheManager.mjs +67 -0
- package/esm2022/src/rt/Transaction.mjs +53 -0
- package/esm2022/src/security/UserDetails.mjs +71 -0
- package/{esm2020 → esm2022}/src/tasks/IMGDataCollection.mjs +1 -1
- package/esm2022/src/tasks/MGData.mjs +552 -0
- package/esm2022/src/tasks/MGDataCollection.mjs +252 -0
- package/esm2022/src/tasks/RCTimer.mjs +63 -0
- package/{esm2020 → esm2022}/src/tasks/RemoteTaskService.mjs +44 -44
- package/esm2022/src/tasks/Task.mjs +2499 -0
- package/esm2022/src/tasks/TaskBase.mjs +83 -0
- package/{esm2020 → esm2022}/src/tasks/TaskServiceBase.mjs +24 -24
- package/esm2022/src/tasks/TasksTable.mjs +80 -0
- package/esm2022/src/tasks/sort/Sort.mjs +5 -0
- package/{esm2020 → esm2022}/src/tasks/sort/SortCollection.mjs +67 -67
- package/{esm2020 → esm2022}/src/util/ConstUtils.mjs +13 -13
- package/esm2022/src/util/FlowMonitorQueue.mjs +451 -0
- package/{esm2020 → esm2022}/src/util/HeapSort.mjs +69 -69
- package/{esm2020 → esm2022}/src/util/IMirrorXML.mjs +1 -1
- package/{esm2020 → esm2022}/src/util/IServerConfig.mjs +1 -1
- package/{esm2020 → esm2022}/src/util/MgBlockingQueue.mjs +1 -1
- package/esm2022/src/util/MgPriorityBlockingQueue.mjs +74 -0
- package/esm2022/src/util/MgPriorityQueue.mjs +66 -0
- package/{esm2020 → esm2022}/src/util/ParamParseResult.mjs +7 -7
- package/esm2022/src/util/PrmMap.mjs +152 -0
- package/esm2022/src/util/ReturnResult.mjs +46 -0
- package/esm2022/src/util/ReturnResultBase.mjs +18 -0
- package/esm2022/src/util/Scrambler.mjs +89 -0
- package/esm2022/src/util/UniqueIDUtils.mjs +13 -0
- package/{esm2020 → esm2022}/src/util/cookie.service.mjs +92 -92
- package/{fesm2020 → fesm2022}/magic-xpa-engine.mjs +29888 -29690
- package/fesm2022/magic-xpa-engine.mjs.map +1 -0
- package/index.d.ts +187 -187
- package/package.json +8 -14
- package/src/AccessHelper.d.ts +20 -20
- package/src/ClientManager.d.ts +35 -32
- package/src/CommandsProcessorBase.d.ts +23 -23
- package/src/CommandsProcessorManager.d.ts +6 -6
- package/src/CommandsTable.d.ts +22 -22
- package/src/ConstInterface.d.ts +516 -515
- package/src/CurrentClientVersion.d.ts +1 -1
- package/src/FlowMonitorInterface.d.ts +15 -15
- package/src/GUIManager.d.ts +17 -17
- package/src/GlobalCommandsManager.d.ts +17 -17
- package/src/GuiEventsProcessor.d.ts +24 -24
- package/src/ICommandsTable.d.ts +9 -9
- package/src/ServerConfig.d.ts +35 -34
- package/src/bridge/IGuiEvent.d.ts +19 -19
- package/src/bridge/MagicBridge.d.ts +16 -16
- package/src/commands/ClientOriginatedCommandTaskTag.d.ts +8 -8
- package/src/commands/ClientToServer/AddUserLocateDataViewCommand.d.ts +4 -4
- package/src/commands/ClientToServer/AddUserRangeDataviewCommand.d.ts +6 -6
- package/src/commands/ClientToServer/AddUserSortDataViewCommand.d.ts +6 -6
- package/src/commands/ClientToServer/BrowserEscEventCommand.d.ts +9 -8
- package/src/commands/ClientToServer/ClientOriginatedCommand.d.ts +8 -8
- package/src/commands/ClientToServer/ClientOriginatedCommandSerializer.d.ts +6 -6
- package/src/commands/ClientToServer/ColumnSortEventCommand.d.ts +11 -10
- package/src/commands/ClientToServer/CommandFactory.d.ts +64 -64
- package/src/commands/ClientToServer/CommandSerializationHelper.d.ts +20 -20
- package/src/commands/ClientToServer/ComputeEventCommand.d.ts +9 -8
- package/src/commands/ClientToServer/ContextTerminationEventCommand.d.ts +8 -7
- package/src/commands/ClientToServer/ContextTimeoutResetCommand.d.ts +8 -7
- package/src/commands/ClientToServer/ControlItemsRefreshCommand.d.ts +6 -6
- package/src/commands/ClientToServer/DataViewOutputCommand.d.ts +9 -9
- package/src/commands/ClientToServer/DataviewCommand.d.ts +32 -32
- package/src/commands/ClientToServer/EvaluateCommand.d.ts +16 -15
- package/src/commands/ClientToServer/EventCommand.d.ts +16 -15
- package/src/commands/ClientToServer/ExecOperCommand.d.ts +24 -23
- package/src/commands/ClientToServer/FetchDataControlValuesEventCommand.d.ts +9 -8
- package/src/commands/ClientToServer/GlobalParamsQueryCommand.d.ts +5 -5
- package/src/commands/ClientToServer/ICommandTaskTag.d.ts +3 -3
- package/src/commands/ClientToServer/IndexChangeEventCommand.d.ts +9 -8
- package/src/commands/ClientToServer/IniputForceWriteCommand.d.ts +11 -10
- package/src/commands/ClientToServer/NonReversibleExitEventCommand.d.ts +9 -8
- package/src/commands/ClientToServer/QueryCommand.d.ts +8 -8
- package/src/commands/ClientToServer/RecomputeCommand.d.ts +12 -11
- package/src/commands/ClientToServer/RefreshEventCommand.d.ts +13 -12
- package/src/commands/ClientToServer/RefreshScreenEventCommand.d.ts +11 -10
- package/src/commands/ClientToServer/RollbackEventCommand.d.ts +15 -14
- package/src/commands/ClientToServer/SelectProgramCommand.d.ts +7 -6
- package/src/commands/ClientToServer/SetTransactionStateDataviewCommand.d.ts +5 -5
- package/src/commands/ClientToServer/SubformOpenEventCommand.d.ts +9 -8
- package/src/commands/ClientToServer/SubformRefreshEventCommand.d.ts +10 -9
- package/src/commands/ClientToServer/TransactionCommand.d.ts +14 -12
- package/src/commands/ClientToServer/UnloadCommand.d.ts +8 -7
- package/src/commands/ClientToServer/WriteMessageToServerLogCommand.d.ts +6 -6
- package/src/commands/DataViewCommandBase.d.ts +6 -6
- package/src/commands/IClientCommand.d.ts +2 -2
- package/src/commands/IClientTargetedCommand.d.ts +12 -12
- package/src/commands/IClientToServerCommandInfo.d.ts +4 -3
- package/src/commands/ServerToClient/AbortCommand.d.ts +11 -11
- package/src/commands/ServerToClient/AddLocateCommand.d.ts +6 -6
- package/src/commands/ServerToClient/AddRangeCommand.d.ts +10 -10
- package/src/commands/ServerToClient/AddSortCommand.d.ts +9 -9
- package/src/commands/ServerToClient/ClientRefreshCommand.d.ts +7 -7
- package/src/commands/ServerToClient/ClientTargetedCommandBase.d.ts +12 -12
- package/src/commands/ServerToClient/EnhancedVerifyCommand.d.ts +13 -13
- package/src/commands/ServerToClient/OpenURLCommand.d.ts +21 -21
- package/src/commands/ServerToClient/ResetLocateCommand.d.ts +6 -6
- package/src/commands/ServerToClient/ResetRangeCommand.d.ts +6 -6
- package/src/commands/ServerToClient/ResetSortCommand.d.ts +6 -6
- package/src/commands/ServerToClient/ResultCommand.d.ts +10 -10
- package/src/commands/ServerToClient/VerifyCommand.d.ts +17 -17
- package/src/commands/ServerToClient/XMLBasedCommandBuilder.d.ts +11 -11
- package/src/communications/IConnectionStateManager.d.ts +4 -4
- package/src/communications/InteractiveCommunicationsFailureHandler.d.ts +6 -6
- package/src/data/DataSourceIdKey.d.ts +2 -2
- package/src/data/DataView.d.ts +162 -162
- package/src/data/DataViewBase.d.ts +12 -12
- package/src/data/DataviewManager.d.ts +14 -14
- package/src/data/DataviewManagerBase.d.ts +11 -11
- package/src/data/DvCache.d.ts +15 -15
- package/src/data/Field.d.ts +103 -103
- package/src/data/FieldBase.d.ts +23 -23
- package/src/data/FieldsTable.d.ts +27 -27
- package/src/data/IRecordsTable.d.ts +7 -7
- package/src/data/Key.d.ts +15 -15
- package/src/data/Record.d.ts +157 -156
- package/src/data/RecordOutOfDataViewException.d.ts +10 -10
- package/src/data/RecordsTable.d.ts +38 -38
- package/src/data/TaskTransactionManager.d.ts +17 -17
- package/src/data/XMLBasedDcValuesBuilder.d.ts +11 -11
- package/src/enums.d.ts +21 -21
- package/src/env/EnvVariablesTable.d.ts +17 -17
- package/src/env/Environment.d.ts +118 -118
- package/src/env/ILanguageData.d.ts +3 -3
- package/src/env/LanguageData.d.ts +20 -20
- package/src/env/MirrorString.d.ts +15 -15
- package/src/event/ActionManager.d.ts +14 -14
- package/src/event/Event.d.ts +79 -79
- package/src/event/EventHandler.d.ts +66 -66
- package/src/event/EventHandlerPosition.d.ts +25 -25
- package/src/event/EventsManager.d.ts +205 -204
- package/src/event/IEventsManager.d.ts +77 -77
- package/src/event/RunTimeEvent.d.ts +126 -123
- package/src/event/RunTimeEventBase.d.ts +5 -5
- package/src/event/UserEventsTable.d.ts +11 -11
- package/src/exp/ExpTable.d.ts +11 -11
- package/src/exp/Expression.d.ts +37 -37
- package/src/exp/ExpressionDict.d.ts +12 -12
- package/src/exp/ExpressionEvaluator.d.ts +198 -198
- package/src/exp/ExpressionLocalJpn.d.ts +18 -18
- package/src/exp/GlobalParamsTable.d.ts +19 -19
- package/src/exp/YesNoExp.d.ts +9 -9
- package/src/gui/CreatedFormVector.d.ts +10 -10
- package/src/gui/FormsTable.d.ts +15 -15
- package/src/gui/MgControl.d.ts +60 -60
- package/src/gui/MgForm.d.ts +96 -93
- package/src/http/HttpManager.d.ts +25 -25
- package/src/http/client/HttpClientAsync.d.ts +16 -16
- package/src/http/client/HttpClientBase.d.ts +30 -30
- package/src/http/client/HttpClientEvents.d.ts +18 -18
- package/src/http/client/HttpClientSync.d.ts +17 -17
- package/src/http/client/HttpUtility.d.ts +10 -10
- package/src/http/client/ICommunicationsFailureHandler.d.ts +5 -5
- package/src/remote/AddUserLocateRemoteDataViewCommand.d.ts +8 -8
- package/src/remote/AddUserRangeRemoteDataViewCommand.d.ts +8 -8
- package/src/remote/AddUserSortRemoteDataViewCommand.d.ts +8 -8
- package/src/remote/RemoteCommandsProcessor.d.ts +51 -51
- package/src/remote/RemoteControlItemsRefreshCommand.d.ts +8 -8
- package/src/remote/RemoteDataViewCommandBase.d.ts +10 -10
- package/src/remote/RemoteDataViewCommandFactory.d.ts +6 -6
- package/src/remote/RemoteDataViewCommandUpdateNonModifiable.d.ts +8 -8
- package/src/remote/RemoteDataviewManager.d.ts +9 -9
- package/src/remote/RemoteInitDataViewCommand.d.ts +7 -7
- package/src/remote/ResetUserLocateRemoteDataviewCommand.d.ts +7 -7
- package/src/remote/ResetUserRangeRemoteDataviewCommand.d.ts +7 -7
- package/src/remote/ResetUserSortRemoteDataviewCommand.d.ts +7 -7
- package/src/remote/ServerError.d.ts +16 -16
- package/src/remote/SetTransactionStateRemoteDataViewCommand.d.ts +8 -8
- package/src/rt/Argument.d.ts +36 -36
- package/src/rt/ArgumentsList.d.ts +24 -24
- package/src/rt/Boundary.d.ts +27 -27
- package/src/rt/CompMainPrgTable.d.ts +10 -10
- package/src/rt/DataviewHeaderBase.d.ts +34 -34
- package/src/rt/DataviewHeaderFactory.d.ts +5 -5
- package/src/rt/DataviewHeaders.d.ts +12 -12
- package/src/rt/DataviewHeadersSaxHandler.d.ts +10 -10
- package/src/rt/ExecutionStack.d.ts +22 -22
- package/src/rt/ExecutionStackEntry.d.ts +7 -7
- package/src/rt/HandlersTable.d.ts +19 -19
- package/src/rt/IDataSourceViewDefinition.d.ts +6 -6
- package/src/rt/IDataviewHeader.d.ts +10 -10
- package/src/rt/IResultValue.d.ts +4 -4
- package/src/rt/LastFocusedManager.d.ts +23 -23
- package/src/rt/Operation.d.ts +97 -97
- package/src/rt/OperationTable.d.ts +15 -15
- package/src/rt/Recompute.d.ts +41 -41
- package/src/rt/RecomputeTable.d.ts +9 -9
- package/src/rt/RemoteDataviewHeader.d.ts +14 -14
- package/src/rt/ResultValue.d.ts +7 -7
- package/src/rt/TableCache.d.ts +29 -29
- package/src/rt/TableCacheManager.d.ts +10 -10
- package/src/rt/Transaction.d.ts +23 -23
- package/src/security/UserDetails.d.ts +16 -16
- package/src/tasks/IMGDataCollection.d.ts +26 -26
- package/src/tasks/MGData.d.ts +63 -63
- package/src/tasks/MGDataCollection.d.ts +42 -42
- package/src/tasks/RCTimer.d.ts +13 -13
- package/src/tasks/RemoteTaskService.d.ts +16 -16
- package/src/tasks/Task.d.ts +312 -312
- package/src/tasks/TaskBase.d.ts +123 -123
- package/src/tasks/TaskServiceBase.d.ts +16 -16
- package/src/tasks/TasksTable.d.ts +21 -21
- package/src/tasks/sort/Sort.d.ts +4 -4
- package/src/tasks/sort/SortCollection.d.ts +11 -11
- package/src/util/ConstUtils.d.ts +3 -3
- package/src/util/FlowMonitorQueue.d.ts +70 -70
- package/src/util/HeapSort.d.ts +6 -6
- package/src/util/IMirrorXML.d.ts +6 -6
- package/src/util/IServerConfig.d.ts +11 -11
- package/src/util/MgBlockingQueue.d.ts +5 -5
- package/src/util/MgPriorityBlockingQueue.d.ts +17 -17
- package/src/util/MgPriorityQueue.d.ts +13 -13
- package/src/util/ParamParseResult.d.ts +6 -6
- package/src/util/PrmMap.d.ts +28 -28
- package/src/util/ReturnResult.d.ts +18 -18
- package/src/util/ReturnResultBase.d.ts +11 -11
- package/src/util/Scrambler.d.ts +10 -10
- package/src/util/UniqueIDUtils.d.ts +4 -4
- package/src/util/cookie.service.d.ts +8 -8
- package/esm2020/src/AccessHelper.mjs +0 -9
- package/esm2020/src/ClientManager.mjs +0 -399
- package/esm2020/src/CommandsProcessorBase.mjs +0 -58
- package/esm2020/src/CommandsTable.mjs +0 -162
- package/esm2020/src/ConstInterface.mjs +0 -516
- package/esm2020/src/FlowMonitorInterface.mjs +0 -16
- package/esm2020/src/GUIManager.mjs +0 -62
- package/esm2020/src/GlobalCommandsManager.mjs +0 -34
- package/esm2020/src/GuiEventsProcessor.mjs +0 -154
- package/esm2020/src/ServerConfig.mjs +0 -117
- package/esm2020/src/bridge/MagicBridge.mjs +0 -41
- package/esm2020/src/commands/ClientOriginatedCommandTaskTag.mjs +0 -11
- package/esm2020/src/commands/ClientToServer/BrowserEscEventCommand.mjs +0 -23
- package/esm2020/src/commands/ClientToServer/ColumnSortEventCommand.mjs +0 -26
- package/esm2020/src/commands/ClientToServer/CommandFactory.mjs +0 -260
- package/esm2020/src/commands/ClientToServer/CommandSerializationHelper.mjs +0 -69
- package/esm2020/src/commands/ClientToServer/ComputeEventCommand.mjs +0 -23
- package/esm2020/src/commands/ClientToServer/DataViewOutputCommand.mjs +0 -13
- package/esm2020/src/commands/ClientToServer/EvaluateCommand.mjs +0 -36
- package/esm2020/src/commands/ClientToServer/ExecOperCommand.mjs +0 -67
- package/esm2020/src/commands/ClientToServer/FetchDataControlValuesEventCommand.mjs +0 -22
- package/esm2020/src/commands/ClientToServer/IndexChangeEventCommand.mjs +0 -21
- package/esm2020/src/commands/ClientToServer/IniputForceWriteCommand.mjs +0 -23
- package/esm2020/src/commands/ClientToServer/RecomputeCommand.mjs +0 -27
- package/esm2020/src/commands/ClientToServer/RefreshEventCommand.mjs +0 -27
- package/esm2020/src/commands/ClientToServer/RefreshScreenEventCommand.mjs +0 -24
- package/esm2020/src/commands/ClientToServer/RollbackEventCommand.mjs +0 -39
- package/esm2020/src/commands/ClientToServer/SelectProgramCommand.mjs +0 -15
- package/esm2020/src/commands/ClientToServer/SubformOpenEventCommand.mjs +0 -21
- package/esm2020/src/commands/ClientToServer/SubformRefreshEventCommand.mjs +0 -24
- package/esm2020/src/commands/ClientToServer/TransactionCommand.mjs +0 -28
- package/esm2020/src/commands/ClientToServer/WriteMessageToServerLogCommand.mjs +0 -18
- package/esm2020/src/commands/DataViewCommandBase.mjs +0 -10
- package/esm2020/src/commands/IClientTargetedCommand.mjs +0 -9
- package/esm2020/src/commands/ServerToClient/AbortCommand.mjs +0 -65
- package/esm2020/src/commands/ServerToClient/ClientRefreshCommand.mjs +0 -25
- package/esm2020/src/commands/ServerToClient/ClientTargetedCommandBase.mjs +0 -27
- package/esm2020/src/commands/ServerToClient/EnhancedVerifyCommand.mjs +0 -45
- package/esm2020/src/commands/ServerToClient/OpenURLCommand.mjs +0 -221
- package/esm2020/src/commands/ServerToClient/ResultCommand.mjs +0 -37
- package/esm2020/src/commands/ServerToClient/VerifyCommand.mjs +0 -83
- package/esm2020/src/communications/InteractiveCommunicationsFailureHandler.mjs +0 -17
- package/esm2020/src/data/DataView.mjs +0 -1610
- package/esm2020/src/data/DataviewManager.mjs +0 -28
- package/esm2020/src/data/DataviewManagerBase.mjs +0 -15
- package/esm2020/src/data/DvCache.mjs +0 -67
- package/esm2020/src/data/Field.mjs +0 -646
- package/esm2020/src/data/FieldBase.mjs +0 -18
- package/esm2020/src/data/FieldsTable.mjs +0 -103
- package/esm2020/src/data/Record.mjs +0 -846
- package/esm2020/src/data/RecordsTable.mjs +0 -267
- package/esm2020/src/env/EnvVariablesTable.mjs +0 -340
- package/esm2020/src/env/Environment.mjs +0 -489
- package/esm2020/src/env/LanguageData.mjs +0 -226
- package/esm2020/src/event/ActionManager.mjs +0 -91
- package/esm2020/src/event/Event.mjs +0 -1333
- package/esm2020/src/event/EventHandler.mjs +0 -766
- package/esm2020/src/event/EventHandlerPosition.mjs +0 -204
- package/esm2020/src/event/EventsManager.mjs +0 -2975
- package/esm2020/src/event/RunTimeEvent.mjs +0 -392
- package/esm2020/src/event/UserEventsTable.mjs +0 -47
- package/esm2020/src/exp/ExpTable.mjs +0 -59
- package/esm2020/src/exp/Expression.mjs +0 -200
- package/esm2020/src/exp/ExpressionDict.mjs +0 -727
- package/esm2020/src/exp/ExpressionEvaluator.mjs +0 -4208
- package/esm2020/src/exp/ExpressionLocalJpn.mjs +0 -314
- package/esm2020/src/exp/YesNoExp.mjs +0 -36
- package/esm2020/src/gui/CreatedFormVector.mjs +0 -23
- package/esm2020/src/gui/FormsTable.mjs +0 -66
- package/esm2020/src/gui/MgControl.mjs +0 -353
- package/esm2020/src/gui/MgForm.mjs +0 -1181
- package/esm2020/src/http/HttpManager.mjs +0 -97
- package/esm2020/src/http/client/HttpClientAsync.mjs +0 -67
- package/esm2020/src/http/client/HttpClientEvents.mjs +0 -39
- package/esm2020/src/http/client/HttpClientSync.mjs +0 -42
- package/esm2020/src/http/client/HttpUtility.mjs +0 -84
- package/esm2020/src/remote/RemoteCommandsProcessor.mjs +0 -880
- package/esm2020/src/remote/ServerError.mjs +0 -40
- package/esm2020/src/rt/Argument.mjs +0 -265
- package/esm2020/src/rt/ArgumentsList.mjs +0 -103
- package/esm2020/src/rt/Boundary.mjs +0 -152
- package/esm2020/src/rt/CompMainPrgTable.mjs +0 -65
- package/esm2020/src/rt/DataviewHeaderBase.mjs +0 -96
- package/esm2020/src/rt/DataviewHeaders.mjs +0 -53
- package/esm2020/src/rt/LastFocusedManager.mjs +0 -67
- package/esm2020/src/rt/Operation.mjs +0 -735
- package/esm2020/src/rt/OperationTable.mjs +0 -67
- package/esm2020/src/rt/Recompute.mjs +0 -355
- package/esm2020/src/rt/ResultValue.mjs +0 -12
- package/esm2020/src/rt/TableCache.mjs +0 -177
- package/esm2020/src/rt/TableCacheManager.mjs +0 -67
- package/esm2020/src/rt/Transaction.mjs +0 -53
- package/esm2020/src/security/UserDetails.mjs +0 -71
- package/esm2020/src/tasks/MGData.mjs +0 -552
- package/esm2020/src/tasks/MGDataCollection.mjs +0 -252
- package/esm2020/src/tasks/RCTimer.mjs +0 -63
- package/esm2020/src/tasks/Task.mjs +0 -2496
- package/esm2020/src/tasks/TaskBase.mjs +0 -87
- package/esm2020/src/tasks/TasksTable.mjs +0 -80
- package/esm2020/src/tasks/sort/Sort.mjs +0 -7
- package/esm2020/src/util/FlowMonitorQueue.mjs +0 -453
- package/esm2020/src/util/MgPriorityBlockingQueue.mjs +0 -74
- package/esm2020/src/util/MgPriorityQueue.mjs +0 -66
- package/esm2020/src/util/PrmMap.mjs +0 -151
- package/esm2020/src/util/ReturnResult.mjs +0 -46
- package/esm2020/src/util/ReturnResultBase.mjs +0 -18
- package/esm2020/src/util/Scrambler.mjs +0 -89
- package/esm2020/src/util/UniqueIDUtils.mjs +0 -12
- package/fesm2015/magic-xpa-engine.mjs +0 -30837
- package/fesm2015/magic-xpa-engine.mjs.map +0 -1
- package/fesm2020/magic-xpa-engine.mjs.map +0 -1
@@ -0,0 +1,97 @@
|
|
1
|
+
import { ApplicationException, Debug, NString } from "@magic-xpa/mscorelib";
|
2
|
+
import { Logger } from "@magic-xpa/utils";
|
3
|
+
import { ConstInterface } from "../ConstInterface";
|
4
|
+
import { HttpClientEvents } from "./client/HttpClientEvents";
|
5
|
+
import { HttpClientSync } from "./client/HttpClientSync";
|
6
|
+
import { HttpClientAsync } from "./client/HttpClientAsync";
|
7
|
+
export class HttpManager {
|
8
|
+
static _instance = null;
|
9
|
+
static DEFAULT_HTTP_COMMUNICATION_TIMEOUT = 5 * 1000;
|
10
|
+
static DEFAULT_OFFLINE_HTTP_COMMUNICATION_TIMEOUT = 2 * 1000;
|
11
|
+
_httpCommunicationTimeoutMS = HttpManager.DEFAULT_HTTP_COMMUNICATION_TIMEOUT;
|
12
|
+
_httpClientAsync = null;
|
13
|
+
getHttpClient() {
|
14
|
+
if (this.IsAbortingMagicEngine)
|
15
|
+
return new HttpClientSync();
|
16
|
+
return this._httpClientAsync;
|
17
|
+
}
|
18
|
+
set HttpCommunicationTimeoutMS(value) {
|
19
|
+
this._httpCommunicationTimeoutMS = value;
|
20
|
+
}
|
21
|
+
static _nativeHttpClient = null;
|
22
|
+
static setNativeHttpClient(httpClient) {
|
23
|
+
HttpManager._nativeHttpClient = httpClient;
|
24
|
+
}
|
25
|
+
static GetInstance() {
|
26
|
+
if (HttpManager._instance === null) {
|
27
|
+
HttpManager._instance = new HttpManager();
|
28
|
+
}
|
29
|
+
return HttpManager._instance;
|
30
|
+
}
|
31
|
+
_isAbortingMagicEngine = false;
|
32
|
+
get IsAbortingMagicEngine() { return this._isAbortingMagicEngine; }
|
33
|
+
set IsAbortingMagicEngine(isAbortingMagicEngine) { this._isAbortingMagicEngine = isAbortingMagicEngine; }
|
34
|
+
constructor() {
|
35
|
+
this._httpClientAsync = new HttpClientAsync(HttpManager._nativeHttpClient);
|
36
|
+
this.RegisterBasicDelegates();
|
37
|
+
}
|
38
|
+
RegisterBasicDelegates() {
|
39
|
+
HttpClientEvents.GetHttpCommunicationTimeout_Event = this.GetHttpCommunicationTimeoutMS.bind(this);
|
40
|
+
}
|
41
|
+
GetHttpCommunicationTimeoutMS() {
|
42
|
+
return this._httpCommunicationTimeoutMS;
|
43
|
+
}
|
44
|
+
SetCommunicationsFailureHandler(handler) {
|
45
|
+
this.getHttpClient().CommunicationsFailureHandler = handler;
|
46
|
+
}
|
47
|
+
async GetContent(requestedURL, requestContent, useCache, isError) {
|
48
|
+
let response;
|
49
|
+
Debug.Assert(this.getHttpClient() != null);
|
50
|
+
try {
|
51
|
+
Logger.Instance.WriteServerToLog("*************************************************************************************************");
|
52
|
+
isError.value = false;
|
53
|
+
Logger.Instance.WriteServerToLog(requestedURL);
|
54
|
+
HttpManager.LogAccessToServer("", requestContent);
|
55
|
+
response = await this.getHttpClient().GetContent(requestedURL, requestContent, useCache);
|
56
|
+
Debug.Assert(response !== null);
|
57
|
+
let errorResponse = HttpManager.CheckAndGetErrorResponse(response);
|
58
|
+
if (errorResponse !== null) {
|
59
|
+
response = errorResponse;
|
60
|
+
isError.value = true;
|
61
|
+
}
|
62
|
+
return response;
|
63
|
+
}
|
64
|
+
catch (ex) {
|
65
|
+
let url = new URL(requestedURL);
|
66
|
+
throw new ApplicationException(ex.Message + "\n" + url.origin + url.pathname, ex);
|
67
|
+
}
|
68
|
+
finally {
|
69
|
+
}
|
70
|
+
}
|
71
|
+
static CheckAndGetErrorResponse(httpResponse) {
|
72
|
+
let errorResponse = null;
|
73
|
+
if (httpResponse.startsWith(ConstInterface.V24_RIA_ERROR_PREFIX))
|
74
|
+
errorResponse = httpResponse.substr(ConstInterface.V24_RIA_ERROR_PREFIX.length);
|
75
|
+
return errorResponse;
|
76
|
+
}
|
77
|
+
static LogAccessToServer(msg, requestContent) {
|
78
|
+
if (Logger.Instance.ShouldLogServerRelatedMessages()) {
|
79
|
+
if (!NString.IsNullOrEmpty(msg)) {
|
80
|
+
msg = msg + "; accessing server ...";
|
81
|
+
}
|
82
|
+
if (requestContent === null) {
|
83
|
+
if (!NString.IsNullOrEmpty(msg)) {
|
84
|
+
Logger.Instance.WriteServerToLog(msg);
|
85
|
+
}
|
86
|
+
}
|
87
|
+
else {
|
88
|
+
if (!NString.IsNullOrEmpty(msg)) {
|
89
|
+
msg = msg + " ";
|
90
|
+
}
|
91
|
+
msg = msg + "uploading " + requestContent.length + " bytes";
|
92
|
+
Logger.Instance.WriteServerToLog(msg);
|
93
|
+
}
|
94
|
+
}
|
95
|
+
}
|
96
|
+
}
|
97
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiSHR0cE1hbmFnZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9wcm9qZ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dXJuZWQgZm9ybSBicm93c2VyIGNhY2hlP1xyXG4gICAgICAvLyBsZXQgZWxhcHNlZFRpbWU6IG51bWJlciA9IE1pc2MuZ2V0U3lzdGVtTWlsbGlzZWNvbmRzKCkgLSBzdGFydFRpbWU7XHJcblxyXG4gICAgICAvLyBMb2dnZXIuSW5zdGFuY2UuV3JpdGVTZXJ2ZXJUb0xvZyhcclxuICAgICAgLy8gICAgICAgICAgICAgICBzdHJpbmcuRm9ybWF0KFxyXG4gICAgICAvLyAgICAgICAgICAgICAgICAgIFwiQ29tcGxldGVkIHswfTogezE6TjB9IG1zLCBhY2N1bXVsYXRlZDogezI6TjB9IG1zIChzZXJ2ZXI6IHszOk4wfSksIHs0fXs1fXs2fSoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqXCIsXHJcbiAgICAgIC8vICAgICAgICAgICAgICAgICAgKGNhY2hpbmdTdHJhdGVneS5Gb3VuZEluQ2FjaGVcclxuICAgICAgLy8gICAgICAgICAgICAgICAgICAgICAgPyBcIlwiXHJcbiAgICAgIC8vICAgICAgICAgICAgICAgICAgICAgIDogTlN0cmluZy5Gb3JtYXQoXCIjezA6TjB9XCIsIFN0YXRpc3RpY3MuR2V0UmVxdWVzdHNDbnQoKSlcclxuICAgICAgLy8gICAgICAgICAgICAgICAgICApLFxyXG4gICAgICAvLyAgICAgICAgICAgICAgICAgIGVsYXBzZWRUaW1lLFxyXG4gICAgICAvLyAgICAgICAgICAgICAgICAgIFN0YXRpc3RpY3MuR2V0QWNjdW11bGF0ZWRFeHRlcm5hbFRpbWUoKSwgU3RhdGlzdGljcy5HZXRBY2N1bXVsYXRlZFNlcnZlclRpbWUoKSxcclxuICAgICAgLy8gICAgICAgICAgICAgICAgICAoY2FjaGluZ1N0cmF0ZWd5LkZvdW5kSW5DYWNoZVxyXG4gICAgICAvLyAgICAgICAgICAgICAg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1ZXN0Q29udGVudC5sZW5ndGggKyBcIiBieXRlc1wiO1xyXG4gICAgICAgIExvZ2dlci5JbnN0YW5jZS5Xcml0ZVNlcnZlclRvTG9nKG1zZyk7XHJcbiAgICAgIH1cclxuICAgIH1cclxuICB9XHJcbn1cclxuIl19
|
@@ -0,0 +1,68 @@
|
|
1
|
+
import { HttpErrorResponse } from "@angular/common/http";
|
2
|
+
import { NString, Thread, WebException } from "@magic-xpa/mscorelib";
|
3
|
+
import { HttpClientBase, RequestMethod } from "./HttpClientBase";
|
4
|
+
import { Logger, Logger_LogLevels, Logger_MessageDirection, Misc } from "@magic-xpa/utils";
|
5
|
+
import { HttpClientEvents } from "./HttpClientEvents";
|
6
|
+
export class HttpClientAsync extends HttpClientBase {
|
7
|
+
httpClient;
|
8
|
+
constructor(httpClient) {
|
9
|
+
super();
|
10
|
+
this.httpClient = httpClient;
|
11
|
+
}
|
12
|
+
prepareRequest() {
|
13
|
+
}
|
14
|
+
addHeaders(urlString, useCache, httpHeaders, clientID) {
|
15
|
+
if (!urlString.startsWith("/"))
|
16
|
+
httpHeaders = httpHeaders.append("MgxpaRIAglobalUniqueSessionID", clientID);
|
17
|
+
if (!useCache)
|
18
|
+
httpHeaders = httpHeaders.append("Cache-Control", 'no-cache');
|
19
|
+
return httpHeaders;
|
20
|
+
}
|
21
|
+
async sendRequestToServer(httpMethod, urlString, httpHeaders, requestContent, contentFromServer) {
|
22
|
+
let httpResponse = await this.httpClient.request(RequestMethod[httpMethod], urlString, { headers: httpHeaders, responseType: "text", observe: "response", body: requestContent }).toPromise();
|
23
|
+
contentFromServer.value = httpResponse.body;
|
24
|
+
return httpResponse;
|
25
|
+
}
|
26
|
+
logResponse(httpResponse, clientID, urlString, contentFromServer, timeBeforeRequest) {
|
27
|
+
let statusCode = httpResponse['status'];
|
28
|
+
let responseTime = Misc.getSystemMilliseconds() - timeBeforeRequest;
|
29
|
+
if (Logger.Instance.LogLevel === Logger_LogLevels.Basic)
|
30
|
+
Logger.Instance.WriteBasicToLog(Logger_MessageDirection.MessageEntering, HttpClientEvents.GetRuntimeCtxID(), HttpClientEvents.GetSessionCounter(), clientID, HttpClientEvents.ShouldDisplayGenericError() ? "-" : new URL(urlString).host, responseTime, statusCode.toString(), JSON.stringify(httpResponse.headers), contentFromServer.value.length);
|
31
|
+
}
|
32
|
+
handleHttpErrorException(ex, urlString) {
|
33
|
+
if (ex instanceof HttpErrorResponse) {
|
34
|
+
let statusCode = ex['status'];
|
35
|
+
if (statusCode === 404 || statusCode === 403)
|
36
|
+
throw new WebException(new Error("bad URL: " + urlString + " - StatusCode = " + statusCode));
|
37
|
+
}
|
38
|
+
}
|
39
|
+
async shouldRetry(httpCommunicationTimeoutMS, urlString, communicationsFailureHandler, ex, startTimeRef) {
|
40
|
+
let currentDelayMS = Math.floor(httpCommunicationTimeoutMS / 10);
|
41
|
+
let httpElapsedTimeMS = Misc.getSystemMilliseconds() - startTimeRef.value + currentDelayMS;
|
42
|
+
if (httpElapsedTimeMS <= httpCommunicationTimeoutMS) {
|
43
|
+
await Thread.Sleep(currentDelayMS);
|
44
|
+
Logger.Instance.WriteWarningToLogWithMsg(NString.Format("Retrying {0} : elapsed time {1:N0}ms out of {2:N0}ms", urlString, httpElapsedTimeMS, httpCommunicationTimeoutMS));
|
45
|
+
return true;
|
46
|
+
}
|
47
|
+
Logger.Instance.WriteWarningToLogWithMsg(NString.Format("{0} : http timeout {1:N0}ms expired", urlString, httpCommunicationTimeoutMS));
|
48
|
+
if (communicationsFailureHandler != null) {
|
49
|
+
communicationsFailureHandler.CommunicationFailed(urlString, ex);
|
50
|
+
if (communicationsFailureHandler.ShouldRetryLastRequest) {
|
51
|
+
Logger.Instance.WriteServerToLog(NString.Format("Retrying {0}, confirmed by user ...", urlString));
|
52
|
+
startTimeRef.value = Misc.getSystemMilliseconds();
|
53
|
+
return true;
|
54
|
+
}
|
55
|
+
}
|
56
|
+
return false;
|
57
|
+
}
|
58
|
+
logAndThrowException(ex) {
|
59
|
+
Logger.Instance.WriteWarningToLogWithMsg("Re-throwing ...");
|
60
|
+
Logger.Instance.WriteWarningToLog(ex);
|
61
|
+
throw new WebException(ex);
|
62
|
+
}
|
63
|
+
logExecutionAttempts(executionAttempts) {
|
64
|
+
if (executionAttempts > 1)
|
65
|
+
Logger.Instance.WriteServerToLog(NString.Format("Succeeded after {0} attempts ...", executionAttempts));
|
66
|
+
}
|
67
|
+
}
|
68
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiSHR0cENsaWVudEFzeW5jLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vcHJvamVjdHMvZW5naW5lL3NyYy9odHRwL2NsaWVudC9IdHRwQ2xpZW50QXN5bmMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFhLGlCQUFpQixFQUE0QixNQUFNLHNCQUFzQixDQUFDO0FBQzlGLE9BQU8sRUFBQyxPQUFPLEVBQVksTUFBTSxFQUFFLFlBQVksRUFBQyxNQUFNLHNCQUFzQixDQUFDO0FBQzdFLE9BQU8sRUFBQyxjQUFjLEVBQUUsYUFBYSxFQUFDLE1BQU0sa0JBQWtCLENBQUM7QUFDL0QsT0FBTyxFQUFDLE1BQU0sRUFBRSxnQkFBZ0IsRUFBRSx1QkFBdUIsRUFBRSxJQUFJLEVBQUMsTUFBTSxrQkFBa0IsQ0FBQztBQUN6RixPQUFPLEVBQUMsZ0JBQWdCLEVBQUMsTUFBTSxvQkFBb0IsQ0FBQztBQUlwRCxNQUFNLE9BQU8sZUFBZ0IsU0FBUSxjQUFjO0lBQzdCO0lBQXBCLFlBQW9CLFVBQXNCO1FBQ3hDLEtBQUssRUFBRSxDQUFDO1FBRFUsZUFBVSxHQUFWLFVBQVUsQ0FBWTtJQUUxQyxDQUFDO0lBRUQsY0FBYztJQUdkLENBQUM7SUFFRCxVQUFVLENBQUMsU0FB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G9Mb2coTG9nZ2VyX01lc3NhZ2VEaXJlY3Rpb24uTWVzc2FnZUVudGVyaW5nLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEh0dHBDbGllbnRFdmVudHMuR2V0UnVudGltZUN0eElEKCksXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgSHR0cENsaWVudEV2ZW50cy5HZXRTZXNzaW9uQ291bnRlcigpLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsaWVudElELFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEh0dHBDbGllbnRFdmVudHMuU2hvdWxkRGlzcGxheUdlbmVyaWNFcnJvcigpID8gXCItXCIgOiBuZXcgVVJMKHVybFN0cmluZykuaG9zdCxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXNwb25zZVRpbWUsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhdHVzQ29kZS50b1N0cmluZygpLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEpTT04uc3RyaW5naWZ5KGh0dHBSZXNwb25zZS5oZWFkZXJzKSxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250ZW50RnJvbVNlcnZlci52YWx1ZS5sZW5ndGgpO1xyXG4gIH1cclxuXHJcbiAgaGFuZGxlSHR0cEVycm9yRXhjZXB0aW9uKGV4OiBhbnksIHVybFN0cmluZzogc3RyaW5nKSB7XHJcbiAgICBpZiAoZXggaW5zdGFuY2VvZiBIdHRwRXJyb3JSZXNwb25zZSlcclxuICAgIHtcclxuICAgICAgbGV0IHN0YXR1c0NvZGUgPSBleFsnc3RhdHVzJ107XHJcbiAgICAgIGlmIChzdGF0dXNDb2RlID09PSA0MDQgfHwgc3RhdHVzQ29kZSA9PT0gNDAzKVxyXG4gICAgICAgIHRocm93IG5ld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uaW5nVG9Mb2coZXgpO1xyXG4gICAgdGhyb3cgbmV3IFdlYkV4Y2VwdGlvbihleCk7XHJcbiAgfVxyXG5cclxuICBsb2dFeGVjdXRpb25BdHRlbXB0cyhleGVjdXRpb25BdHRlbXB0czogbnVtYmVyKVxyXG4gIHtcclxuICAgIGlmIChleGVjdXRpb25BdHRlbXB0cyA+IDEpXHJcbiAgICAgIExvZ2dlci5JbnN0YW5jZS5Xcml0ZVNlcnZlclRvTG9nKE5TdHJpbmcuRm9ybWF0KFwiU3VjY2VlZGVkIGFmdGVyIHswfSBhdHRlbXB0cyAuLi5cIiwgZXhlY3V0aW9uQXR0ZW1wdHMpKTtcclxuICB9XHJcbn1cclxuIl19
|
@@ -1,132 +1,132 @@
|
|
1
|
-
import { NString, RefParam, StringBuilder, isNullOrUndefined } from "@magic-xpa/mscorelib";
|
2
|
-
import { Logger, Logger_LogLevels, Logger_MessageDirection, Misc } from "@magic-xpa/utils";
|
3
|
-
import { HttpClientEvents } from "./HttpClientEvents";
|
4
|
-
import { HttpHeaders } from "@angular/common/http";
|
5
|
-
export var RequestMethod;
|
6
|
-
(function (RequestMethod) {
|
7
|
-
RequestMethod[RequestMethod["Get"] = 0] = "Get";
|
8
|
-
RequestMethod[RequestMethod["Post"] = 1] = "Post";
|
9
|
-
RequestMethod[RequestMethod["Put"] = 2] = "Put";
|
10
|
-
RequestMethod[RequestMethod["Delete"] = 3] = "Delete";
|
11
|
-
RequestMethod[RequestMethod["Options"] = 4] = "Options";
|
12
|
-
RequestMethod[RequestMethod["Head"] = 5] = "Head";
|
13
|
-
RequestMethod[RequestMethod["Patch"] = 6] = "Patch";
|
14
|
-
})(RequestMethod || (RequestMethod = {}));
|
15
|
-
export class HttpClientBase {
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
this.CommunicationsFailureHandler = null;
|
20
|
-
}
|
21
|
-
DecideOnRequestMethod(requestContent, requestURL) {
|
22
|
-
let method = RequestMethod.Get;
|
23
|
-
if (requestContent === null) {
|
24
|
-
method = RequestMethod.Get;
|
25
|
-
}
|
26
|
-
else {
|
27
|
-
if (requestURL.value.length + 1 + requestContent.length <= this._HTTPMaxURLLength) {
|
28
|
-
requestURL.value = requestURL.value + "?" + requestContent;
|
29
|
-
method = RequestMethod.Get;
|
30
|
-
}
|
31
|
-
else {
|
32
|
-
method = RequestMethod.Post;
|
33
|
-
}
|
34
|
-
}
|
35
|
-
return method;
|
36
|
-
}
|
37
|
-
async GetContent(requestURL, requestContent, useCache) {
|
38
|
-
let contentFromServer = new RefParam(null);
|
39
|
-
let requestUrlRef = new RefParam(requestURL);
|
40
|
-
let httpMethod = this.DecideOnRequestMethod(requestContent, requestUrlRef);
|
41
|
-
requestURL = requestUrlRef.value;
|
42
|
-
try {
|
43
|
-
let response = await this.ExecuteHttpRequest(requestURL, requestContent, useCache, httpMethod, contentFromServer);
|
44
|
-
if (response != null) {
|
45
|
-
Logger.Instance.WriteServerToLog("Incoming Headers : " + HttpClientBase.HeadersToString(response.headers, true));
|
46
|
-
let nextSessionCounterString = response.headers.get("MgxpaNextSessionCounter".toLowerCase());
|
47
|
-
if (!isNullOrUndefined(nextSessionCounterString)) {
|
48
|
-
HttpClientEvents.CheckAndSetSessionCounter(+nextSessionCounterString);
|
49
|
-
}
|
50
|
-
}
|
51
|
-
}
|
52
|
-
catch (ex) {
|
53
|
-
Logger.Instance.WriteWarningToLog(ex);
|
54
|
-
throw ex;
|
55
|
-
}
|
56
|
-
return contentFromServer.value;
|
57
|
-
}
|
58
|
-
async ExecuteHttpRequest(urlString, requestContent, useCache, httpMethod, contentFromServer) {
|
59
|
-
let httpResponse = null;
|
60
|
-
this.prepareRequest();
|
61
|
-
let httpCommunicationTimeoutMS = HttpClientEvents.GetHttpCommunicationTimeout();
|
62
|
-
let clientID = HttpClientEvents.GetGlobalUniqueSessionID();
|
63
|
-
let executionAttempts = 0;
|
64
|
-
let startTime = Misc.getSystemMilliseconds();
|
65
|
-
while (true) {
|
66
|
-
executionAttempts++;
|
67
|
-
try {
|
68
|
-
let httpHeaders = new HttpHeaders();
|
69
|
-
httpHeaders = this.addHeaders(urlString, useCache, httpHeaders, clientID);
|
70
|
-
Logger.Instance.WriteServerToLog(NString.Format("Request Timeout set to {0} ms", httpCommunicationTimeoutMS));
|
71
|
-
if (Logger.Instance.LogLevel === Logger_LogLevels.Basic) {
|
72
|
-
let contentLength = 0;
|
73
|
-
if (httpMethod === RequestMethod.Get) {
|
74
|
-
let parts = urlString.split('?');
|
75
|
-
if (parts.length === 2)
|
76
|
-
contentLength = parts[1].length;
|
77
|
-
}
|
78
|
-
else
|
79
|
-
contentLength = requestContent.length;
|
80
|
-
Logger.Instance.WriteBasicToLog(Logger_MessageDirection.MessageLeaving, HttpClientEvents.GetRuntimeCtxID(), HttpClientEvents.GetSessionCounter(), clientID, HttpClientEvents.ShouldDisplayGenericError() ? "-" : new URL(urlString).host, 0, '-', JSON.stringify(httpHeaders), contentLength);
|
81
|
-
}
|
82
|
-
let timeBeforeRequest = Misc.getSystemMilliseconds();
|
83
|
-
Logger.Instance.WriteServerToLog(NString.Format("Accessing (method: '{0}'): '{1}'", httpMethod, urlString));
|
84
|
-
Logger.Instance.WriteServerToLog("Outgoing Headers : " + HttpClientBase.HeadersToString(httpHeaders, false));
|
85
|
-
if (httpMethod === RequestMethod.Post) {
|
86
|
-
}
|
87
|
-
let requestTime = Misc.getSystemMilliseconds();
|
88
|
-
this.LogRequestInfo(!isNullOrUndefined(requestContent) ? requestContent.length : 0, requestTime, false);
|
89
|
-
httpResponse = await this.sendRequestToServer(httpMethod, urlString, httpHeaders, requestContent, contentFromServer);
|
90
|
-
this.logResponse(httpResponse, clientID, urlString, contentFromServer, timeBeforeRequest);
|
91
|
-
this.LogRequestInfo(!isNullOrUndefined(requestContent) ? requestContent.length : 0, Misc.getSystemMilliseconds() - requestTime, true);
|
92
|
-
break;
|
93
|
-
}
|
94
|
-
catch (ex) {
|
95
|
-
if (Logger.Instance.LogLevel === Logger_LogLevels.Basic)
|
96
|
-
Logger.Instance.WriteBasicErrorToLog();
|
97
|
-
else
|
98
|
-
Logger.Instance.WriteWarningToLog(ex);
|
99
|
-
this.handleHttpErrorException(ex, urlString);
|
100
|
-
let startTimeRef = new RefParam(startTime);
|
101
|
-
if (this.shouldRetry(httpCommunicationTimeoutMS, urlString, this.CommunicationsFailureHandler, ex, startTimeRef)) {
|
102
|
-
startTime = startTimeRef.value;
|
103
|
-
continue;
|
104
|
-
}
|
105
|
-
this.logAndThrowException(ex);
|
106
|
-
}
|
107
|
-
}
|
108
|
-
this.logExecutionAttempts(executionAttempts);
|
109
|
-
return httpResponse;
|
110
|
-
}
|
111
|
-
LogRequestInfo(contentLength, roundTrip, isLoggingResponse) {
|
112
|
-
if (Logger.Instance.LogLevel == Logger_LogLevels.RequestInfo) {
|
113
|
-
HttpClientEvents.ComputeAndLogRequestInfo(contentLength, roundTrip, isLoggingResponse);
|
114
|
-
}
|
115
|
-
}
|
116
|
-
static HeadersToString(headers, bFilter) {
|
117
|
-
let headersStr = new StringBuilder();
|
118
|
-
let headerKeys = headers.keys();
|
119
|
-
for (let key in headerKeys) {
|
120
|
-
if (!bFilter || headerKeys[key].startsWith("Mg"))
|
121
|
-
headersStr.Append(NString.Format("{0}:{1} ", headerKeys[key], headers.get(headerKeys[key])));
|
122
|
-
}
|
123
|
-
return headersStr;
|
124
|
-
}
|
125
|
-
async sendRequestToServer(httpMethod, urlString, httpHeaders, requestContent, contentFromServer) {
|
126
|
-
return Promise.resolve();
|
127
|
-
}
|
128
|
-
async shouldRetry(httpCommunicationTimeoutMS, urlString, communicationsFailureHandler, ex, startTimeRef) {
|
129
|
-
return Promise.resolve(false);
|
130
|
-
}
|
131
|
-
}
|
132
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiSHR0cENsaWVudEJhc2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi9wcm9qZ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AgICAgICAvLyA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09XHJcbiAgICAgICAgLy8gVE9ETyA6IEhhbmRsZSBlcnJvcnNcclxuICAgICAgICAvLyBUT0RPOiBIYW5kbGUgdGltZW91dFxyXG5cclxuICAgICAgICBsZXQgcmVxdWVzdFRpbWU6bnVtYmVyID0gTWlzYy5nZXRTeXN0ZW1NaWxsaXNlY29uZHMoKTtcclxuXHJcbiAgICAgICAgdGhpcy5Mb2dSZXF1ZXN0SW5mbyghaXNOdWxsT3JVbmRlZmluZWQocmVxdWVzdENvbnRlbnQpID8gcmVxdWVzdENvbnRlbnQubGVuZ3RoIDogMCwgcmVxdWVzdFRpbWUsIGZhbHNlKTtcclxuXHJcbiAgICAgICAgaHR0cFJlc3BvbnNlID0gYXdhaXQgdGhpcy5zZW5kUmVxdWVzdFRvU2VydmVyKGh0dHBNZXRob2QsIHVybFN0cmluZywgaHR0cEhlYWRlcnMsIHJlcXVlc3RDb250ZW50LCBjb250ZW50RnJvbVNlcnZlcik7XHJcblxyXG4gICAgICAgIHRoaXMubG9nUmVzcG9uc2UoaHR0cFJlc3BvbnNlLCBjbGllbnRJRCwgdXJsU3RyaW5nLCBjb250ZW50RnJvbVNlcnZlciwgdGltZUJlZm9yZVJlcXVlc3QpO1xyXG5cclxuICAgICAgICB0aGlzLkxvZ1JlcXVlc3RJbmZvKCFpc051bGxPclVuZGVmaW5lZChyZXF1ZXN0Q29udGVudCkgPyByZXF1ZXN0Q29udGVudC5sZW5ndGggOiAwLCBNaXNjLmdldFN5c3RlbU1pbGxpc2Vjb25kcygpIC0gcmVxdWVzdFRpbWUsIHRydWUpO1xyXG5cclxuICAgICAgICBicmVhaztcclxuICAgICAgfVxyXG4gICAgICBjYXRjaCAoZXgpIHtcclxuICAgICAgICBpZiAoTG9nZ2VyLkluc3Rhb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ZUJlZm9yZVJlcXVlc3Q6IG51bWJlcik7XHJcbiAgYWJzdHJhY3QgaGFuZGxlSHR0cEVycm9yRXhjZXB0aW9uKGV4OiBhbnksIHVybFN0cmluZzogc3RyaW5nKTtcclxuICBhc3luYyBzaG91bGRSZXRyeShodHRwQ29tbXVuaWNhdGlvblRpbWVvdXRNUzogbnVtYmVyLCB1cmxTdHJpbmc6IHN0cmluZywgY29tbXVuaWNhdGlvbnNGYWlsdXJlSGFuZGxlcjogSUNvbW11bmljYXRpb25zRmFpbHVyZUhhbmRsZXIsIGV4OiBhbnksIHN0YXJ0VGltZVJlZjogUmVmUGFyYW08bnVtYmVyPik6IFByb21pc2U8Ym9vbGVhbj57XHJcbiAgICByZXR1cm4gUHJvbWlzZS5yZXNvbHZlKGZhbHNlKTtcclxuICB9XHJcbiAgYWJzdHJhY3QgbG9nQW5kVGhyb3dFeGNlcHRpb24oZXg6IGFueSk7XHJcbiAgYWJzdHJhY3QgbG9nRXhlY3V0aW9uQXR0ZW1wdHMoZXhlY3V0aW9uQXR0ZW1wdHM6IG51bWJlcik7XHJcbn1cclxuIl19
|
1
|
+
import { NString, RefParam, StringBuilder, isNullOrUndefined } from "@magic-xpa/mscorelib";
|
2
|
+
import { Logger, Logger_LogLevels, Logger_MessageDirection, Misc } from "@magic-xpa/utils";
|
3
|
+
import { HttpClientEvents } from "./HttpClientEvents";
|
4
|
+
import { HttpHeaders } from "@angular/common/http";
|
5
|
+
export var RequestMethod;
|
6
|
+
(function (RequestMethod) {
|
7
|
+
RequestMethod[RequestMethod["Get"] = 0] = "Get";
|
8
|
+
RequestMethod[RequestMethod["Post"] = 1] = "Post";
|
9
|
+
RequestMethod[RequestMethod["Put"] = 2] = "Put";
|
10
|
+
RequestMethod[RequestMethod["Delete"] = 3] = "Delete";
|
11
|
+
RequestMethod[RequestMethod["Options"] = 4] = "Options";
|
12
|
+
RequestMethod[RequestMethod["Head"] = 5] = "Head";
|
13
|
+
RequestMethod[RequestMethod["Patch"] = 6] = "Patch";
|
14
|
+
})(RequestMethod || (RequestMethod = {}));
|
15
|
+
export class HttpClientBase {
|
16
|
+
_HTTPMaxURLLength = 2048;
|
17
|
+
CommunicationsFailureHandler = null;
|
18
|
+
constructor() {
|
19
|
+
this.CommunicationsFailureHandler = null;
|
20
|
+
}
|
21
|
+
DecideOnRequestMethod(requestContent, requestURL) {
|
22
|
+
let method = RequestMethod.Get;
|
23
|
+
if (requestContent === null) {
|
24
|
+
method = RequestMethod.Get;
|
25
|
+
}
|
26
|
+
else {
|
27
|
+
if (requestURL.value.length + 1 + requestContent.length <= this._HTTPMaxURLLength) {
|
28
|
+
requestURL.value = requestURL.value + "?" + requestContent;
|
29
|
+
method = RequestMethod.Get;
|
30
|
+
}
|
31
|
+
else {
|
32
|
+
method = RequestMethod.Post;
|
33
|
+
}
|
34
|
+
}
|
35
|
+
return method;
|
36
|
+
}
|
37
|
+
async GetContent(requestURL, requestContent, useCache) {
|
38
|
+
let contentFromServer = new RefParam(null);
|
39
|
+
let requestUrlRef = new RefParam(requestURL);
|
40
|
+
let httpMethod = this.DecideOnRequestMethod(requestContent, requestUrlRef);
|
41
|
+
requestURL = requestUrlRef.value;
|
42
|
+
try {
|
43
|
+
let response = await this.ExecuteHttpRequest(requestURL, requestContent, useCache, httpMethod, contentFromServer);
|
44
|
+
if (response != null) {
|
45
|
+
Logger.Instance.WriteServerToLog("Incoming Headers : " + HttpClientBase.HeadersToString(response.headers, true));
|
46
|
+
let nextSessionCounterString = response.headers.get("MgxpaNextSessionCounter".toLowerCase());
|
47
|
+
if (!isNullOrUndefined(nextSessionCounterString)) {
|
48
|
+
HttpClientEvents.CheckAndSetSessionCounter(+nextSessionCounterString);
|
49
|
+
}
|
50
|
+
}
|
51
|
+
}
|
52
|
+
catch (ex) {
|
53
|
+
Logger.Instance.WriteWarningToLog(ex);
|
54
|
+
throw ex;
|
55
|
+
}
|
56
|
+
return contentFromServer.value;
|
57
|
+
}
|
58
|
+
async ExecuteHttpRequest(urlString, requestContent, useCache, httpMethod, contentFromServer) {
|
59
|
+
let httpResponse = null;
|
60
|
+
this.prepareRequest();
|
61
|
+
let httpCommunicationTimeoutMS = HttpClientEvents.GetHttpCommunicationTimeout();
|
62
|
+
let clientID = HttpClientEvents.GetGlobalUniqueSessionID();
|
63
|
+
let executionAttempts = 0;
|
64
|
+
let startTime = Misc.getSystemMilliseconds();
|
65
|
+
while (true) {
|
66
|
+
executionAttempts++;
|
67
|
+
try {
|
68
|
+
let httpHeaders = new HttpHeaders();
|
69
|
+
httpHeaders = this.addHeaders(urlString, useCache, httpHeaders, clientID);
|
70
|
+
Logger.Instance.WriteServerToLog(NString.Format("Request Timeout set to {0} ms", httpCommunicationTimeoutMS));
|
71
|
+
if (Logger.Instance.LogLevel === Logger_LogLevels.Basic) {
|
72
|
+
let contentLength = 0;
|
73
|
+
if (httpMethod === RequestMethod.Get) {
|
74
|
+
let parts = urlString.split('?');
|
75
|
+
if (parts.length === 2)
|
76
|
+
contentLength = parts[1].length;
|
77
|
+
}
|
78
|
+
else
|
79
|
+
contentLength = requestContent.length;
|
80
|
+
Logger.Instance.WriteBasicToLog(Logger_MessageDirection.MessageLeaving, HttpClientEvents.GetRuntimeCtxID(), HttpClientEvents.GetSessionCounter(), clientID, HttpClientEvents.ShouldDisplayGenericError() ? "-" : new URL(urlString).host, 0, '-', JSON.stringify(httpHeaders), contentLength);
|
81
|
+
}
|
82
|
+
let timeBeforeRequest = Misc.getSystemMilliseconds();
|
83
|
+
Logger.Instance.WriteServerToLog(NString.Format("Accessing (method: '{0}'): '{1}'", httpMethod, urlString));
|
84
|
+
Logger.Instance.WriteServerToLog("Outgoing Headers : " + HttpClientBase.HeadersToString(httpHeaders, false));
|
85
|
+
if (httpMethod === RequestMethod.Post) {
|
86
|
+
}
|
87
|
+
let requestTime = Misc.getSystemMilliseconds();
|
88
|
+
this.LogRequestInfo(!isNullOrUndefined(requestContent) ? requestContent.length : 0, requestTime, false);
|
89
|
+
httpResponse = await this.sendRequestToServer(httpMethod, urlString, httpHeaders, requestContent, contentFromServer);
|
90
|
+
this.logResponse(httpResponse, clientID, urlString, contentFromServer, timeBeforeRequest);
|
91
|
+
this.LogRequestInfo(!isNullOrUndefined(requestContent) ? requestContent.length : 0, Misc.getSystemMilliseconds() - requestTime, true);
|
92
|
+
break;
|
93
|
+
}
|
94
|
+
catch (ex) {
|
95
|
+
if (Logger.Instance.LogLevel === Logger_LogLevels.Basic)
|
96
|
+
Logger.Instance.WriteBasicErrorToLog();
|
97
|
+
else
|
98
|
+
Logger.Instance.WriteWarningToLog(ex);
|
99
|
+
this.handleHttpErrorException(ex, urlString);
|
100
|
+
let startTimeRef = new RefParam(startTime);
|
101
|
+
if (this.shouldRetry(httpCommunicationTimeoutMS, urlString, this.CommunicationsFailureHandler, ex, startTimeRef)) {
|
102
|
+
startTime = startTimeRef.value;
|
103
|
+
continue;
|
104
|
+
}
|
105
|
+
this.logAndThrowException(ex);
|
106
|
+
}
|
107
|
+
}
|
108
|
+
this.logExecutionAttempts(executionAttempts);
|
109
|
+
return httpResponse;
|
110
|
+
}
|
111
|
+
LogRequestInfo(contentLength, roundTrip, isLoggingResponse) {
|
112
|
+
if (Logger.Instance.LogLevel == Logger_LogLevels.RequestInfo) {
|
113
|
+
HttpClientEvents.ComputeAndLogRequestInfo(contentLength, roundTrip, isLoggingResponse);
|
114
|
+
}
|
115
|
+
}
|
116
|
+
static HeadersToString(headers, bFilter) {
|
117
|
+
let headersStr = new StringBuilder();
|
118
|
+
let headerKeys = headers.keys();
|
119
|
+
for (let key in headerKeys) {
|
120
|
+
if (!bFilter || headerKeys[key].startsWith("Mg"))
|
121
|
+
headersStr.Append(NString.Format("{0}:{1} ", headerKeys[key], headers.get(headerKeys[key])));
|
122
|
+
}
|
123
|
+
return headersStr;
|
124
|
+
}
|
125
|
+
async sendRequestToServer(httpMethod, urlString, httpHeaders, requestContent, contentFromServer) {
|
126
|
+
return Promise.resolve();
|
127
|
+
}
|
128
|
+
async shouldRetry(httpCommunicationTimeoutMS, urlString, communicationsFailureHandler, ex, startTimeRef) {
|
129
|
+
return Promise.resolve(false);
|
130
|
+
}
|
131
|
+
}
|
132
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiSHR0cENsaWVudEJhc2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy9lbmdpbmUvc3JjL2h0dHAvY2xpZW50L0h0dHBDbGllbnRCYXNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBQyxPQUFPLEVBQUUsUUFBUSxFQUFFLGFBQWEsRUFBRSxpQkFBaUIsRUFBQyxNQUFNLHNCQUFzQixDQUFDO0FBQ3pGLE9BQU8sRUFBQyxNQUFNLEVBQUUsZ0JBQWdCLEVBQUUsdUJBQXVCLEVBQUUsSUFBSSxFQUFDLE1BQU0sa0JBQWtCLENBQUM7QUFFekYsT0FBTyxFQUFDLGdCQUFnQixFQUFDLE1BQU0sb0JBQW9CLENBQUM7QUFDcEQsT0FBTyxFQUFDLFdBQVcsRUFBZSxNQUFNLHNCQUFzQixDQUFDO0FBRy9ELE1BQU0sQ0FBTixJQUFZLGFBU1g7QUFURCxXQUFZLGFBQWE7SUFFdkIsK0NBQU8sQ0FBQTtJQUNQLGlEQUFRLENBQUE7SUFDUiwrQ0FBTyxDQUFBO0lBQ1AscURBQVUsQ0FBQTtJQUNWLHVEQUFXLENBQUE7SUFDWCxpREFBUSxDQUFBO0lBQ1IsbURBQVMsQ0FBQTtBQUNYLENBQUMsRUFUVyxhQUFhLEtBQWIsYUFBYSxRQVN4QjtBQVVELE1BQU0sT0FBZ0IsY0FBYztJQUMxQixpQkFBaUIsR0FBVyxJQUFJLENBQUM7SUFPekMsNEJBQTRCLEdBQWtDLElBQUksQ0FBQztJQUVuRTtRQUNFLElBQUksQ0FBQyw0QkFBNEIsR0FBR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WJSZXF1ZXN0KTtcclxuICAgICAgICB9XHJcblxyXG4gICAgICAgIC8vID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT1cclxuICAgICAgICAvLyBzZW5kIHRoZSByZXF1ZXN0ICYgZ2V0IHRoZSByZXNwb25zZTpcclxuICAgICAgICAvLyA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09XHJcbiAgICAgICAgLy8gVE9ETyA6IEhhbmRsZSBlcnJvcnNcclxuICAgICAgICAvLyBUT0RPOiBIYW5kbGUgdGltZW91dFxyXG5cclxuICAgICAgICBsZXQgcmVxdWVzdFRpbWU6bnVtYmVyID0gTWlzYy5nZXRTeXN0ZW1NaWxsaXNlY29uZHMoKTtcclxuXHJcbiAgICAgICAgdGhpcy5Mb2dSZXF1ZXN0SW5mbyghaXNOdWxsT3JVbmRlZmluZWQocmVxdWVzdENvbnRlbnQpID8gcmVxdWVzdENvbnRlbnQubGVuZ3RoIDogMCwgcmVxdWVzdFRpbWUsIGZhbHNlKTtcclxuXHJcbiAgICAgICAgaHR0cFJlc3BvbnNlID0gYXdhaXQgdGhpcy5zZW5kUmVxdWVzdFRvU2VydmVyKGh0dHBNZXRob2QsIHVybFN0cmluZywgaHR0cEhlYWRlcnMsIHJlcXVlc3RDb250ZW50LCBjb250ZW50RnJvbVNlcnZlcik7XHJcblxyXG4gICAgICAgIHRoaXMubG9nUmVzcG9uc2UoaHR0cFJlc3BvbnNlLCBjbGllbnRJRCwgdXJsU3RyaW5nLCBjb250ZW50RnJvbVNlcnZlciwgdGltZUJlZm9yZVJlcXVlc3QpO1xyXG5cclxuICAgICAgICB0aGlzLkxvZ1JlcXVlc3RJbmZvKCFpc051bGxPclV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