@rabbitio/ui-kit 1.0.0-beta.64 → 1.0.0-beta.66
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/coverage/clover.xml +6325 -4201
- package/coverage/coverage-final.json +160 -99
- package/coverage/index.html +444 -189
- package/coverage/{rabbit-ui-kit → ui-kit}/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/index.js.html +3 -3
- package/coverage/{rabbit-ui-kit/src/assets/wrappedImages/arrowTosca.jsx.html → ui-kit/src/assets/wrappedImages/arrowIcon.jsx.html} +8 -29
- package/coverage/{rabbit-ui-kit/src/assets/wrappedImages/arrowIcon.jsx.html → ui-kit/src/assets/wrappedImages/arrowTosca.jsx.html} +9 -24
- package/coverage/{rabbit-ui-kit → ui-kit}/src/assets/wrappedImages/arrowWhite.jsx.html +7 -25
- package/coverage/ui-kit/src/assets/wrappedImages/darkRectangle.jsx.html +106 -0
- package/coverage/{rabbit-ui-kit → ui-kit}/src/assets/wrappedImages/determinedError.jsx.html +9 -42
- package/coverage/{rabbit-ui-kit/src/assets/wrappedImages/successfulValidationIcon.jsx.html → ui-kit/src/assets/wrappedImages/failedValidationIcon.jsx.html} +28 -31
- package/coverage/{rabbit-ui-kit → ui-kit}/src/assets/wrappedImages/index.html +25 -25
- package/coverage/{rabbit-ui-kit/src/assets/wrappedImages/darkRectangle.jsx.html → ui-kit/src/assets/wrappedImages/infoIcon.jsx.html} +13 -19
- package/coverage/{rabbit-ui-kit → ui-kit}/src/assets/wrappedImages/noticeQuestionIcon.jsx.html +7 -25
- package/coverage/{rabbit-ui-kit/src/assets/wrappedImages/walletIcon.jsx.html → ui-kit/src/assets/wrappedImages/successfulValidationIcon.jsx.html} +23 -59
- package/coverage/{rabbit-ui-kit/src/assets/wrappedImages/infoIcon.jsx.html → ui-kit/src/assets/wrappedImages/walletIcon.jsx.html} +16 -16
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/adapters/axiosAdapter.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/adapters/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/adapters/qrUtils.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/amountUtils.js.html +44 -308
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/errorUtils.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/external-apis/apiGroups.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/external-apis/index.html +14 -14
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/external-apis/ipAddressProviders.js.html +31 -178
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/fiatCurrenciesService.js.html +12 -36
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/index.html +20 -20
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/models/blockchain.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/models/coin.js.html +10 -22
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/models/index.html +13 -13
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/models/protocol.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/utils/cache.js.html +23 -101
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/utils/emailAPI.js.html +9 -15
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/utils/index.html +19 -19
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/utils/logging/index.html +9 -9
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/utils/logging/logger.js.html +14 -35
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/utils/logging/logsStorage.js.html +5 -5
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/utils/postponeExecution.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/common/utils/safeStringify.js.html +29 -29
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/AssetIcon/AssetIcon.jsx.html +11 -41
- package/coverage/ui-kit/src/components/atoms/AssetIcon/index.html +116 -0
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/AssetSelection/AssetSelection.jsx.html +9 -33
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/AssetSelection/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/BackgroundTitle/BackgroundTitle.jsx.html +8 -38
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/BackgroundTitle/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/InformationMessage/InformationMessage.jsx.html +8 -38
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/InformationMessage/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/Input/Input.jsx.html +15 -63
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/Input/index.html +7 -7
- package/coverage/ui-kit/src/components/atoms/LoadingDots/LoadingDots.jsx.html +196 -0
- package/coverage/{rabbit-ui-kit/src/components/atoms/RateSelector → ui-kit/src/components/atoms/LoadingDots}/index.html +4 -4
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/NoticeIcon/NoticeIcon.jsx.html +10 -40
- package/coverage/{rabbit-ui-kit/src/components/atoms/AssetIcon → ui-kit/src/components/atoms/NoticeIcon}/index.html +4 -4
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/QrCode/QrCode.jsx.html +8 -26
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/QrCode/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/RateSelector/RateSelector.jsx.html +10 -34
- package/coverage/ui-kit/src/components/atoms/RateSelector/index.html +116 -0
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/SupportChat/SupportChat.jsx.html +7 -22
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/SupportChat/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/Textarea/Textarea.jsx.html +17 -53
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/Textarea/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/TitleBox/TitleBox.jsx.html +13 -82
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/TitleBox/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/Tooltip/Tooltip.jsx.html +12 -18
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/Tooltip/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/TwoLinesOfText/LinesOfText.jsx.html +12 -30
- package/coverage/{rabbit-ui-kit/src/components/atoms/NoticeIcon → ui-kit/src/components/atoms/TwoLinesOfText}/index.html +4 -4
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/Validation/Validation.jsx.html +19 -13
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/Validation/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/buttons/Button/Button.jsx.html +23 -113
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/buttons/Button/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/buttons/Close/Close.jsx.html +9 -27
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/buttons/Close/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/buttons/LinkButton/LinkButton.jsx.html +11 -38
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/buttons/LinkButton/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/buttons/RadioButtonWithText/RadioButtonWithText.jsx.html +13 -67
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/atoms/buttons/RadioButtonWithText/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/hooks/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/hooks/useCallHandlingErrors.js.html +7 -19
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/hooks/useReferredState.js.html +4 -4
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/molecules/AmountInput/AmountInput.jsx.html +56 -407
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/molecules/AmountInput/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/molecules/CoinPicker/CoinPicker.jsx.html +67 -466
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/molecules/CoinPicker/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/molecules/LineWithIconLink/LineWithIconLink.jsx.html +7 -22
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/molecules/LineWithIconLink/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/molecules/TitledLineWithIconLink/TitledLineWithIconLink.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/molecules/TitledLineWithIconLink/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/organisms/CoinPickerDialogStep/CoinPickerDialogStep.jsx.html +9 -15
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/organisms/CoinPickerDialogStep/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/organisms/Dialog/Dialog.jsx.html +44 -194
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/organisms/Dialog/DialogButtons/DialogButtons.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/organisms/Dialog/DialogButtons/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/organisms/Dialog/DialogStep/DialogStep.jsx.html +63 -525
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/organisms/Dialog/DialogStep/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/organisms/Dialog/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/organisms/SwapForm/SwapForm.jsx.html +145 -670
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/organisms/SwapForm/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/templates/DeterminedErrorDialogStep/DeterminedErrorDialogStep.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/templates/DeterminedErrorDialogStep/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/utils/index.html +20 -20
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/utils/inputValueProviders.js.html +11 -35
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/utils/textUtils.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/utils/uiUtils.js.html +7 -13
- package/coverage/{rabbit-ui-kit → ui-kit}/src/components/utils/urlQueryUtils.js.html +18 -93
- package/coverage/{rabbit-ui-kit → ui-kit}/src/constants/atoms/Close/close.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/constants/atoms/Close/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/constants/atoms/LinkButton/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/constants/atoms/LinkButton/linkButton.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/constants/atoms/Tooltip/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/constants/atoms/Tooltip/tooltip.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/constants/globalConstants.jsx.html +7 -10
- package/coverage/{rabbit-ui-kit → ui-kit}/src/constants/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/constants/organisms/dialog/DialogStep/dialogStep.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/constants/organisms/dialog/DialogStep/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/constants/organisms/dialog/dialog.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/constants/organisms/dialog/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/index.js.html +8 -26
- package/coverage/{rabbit-ui-kit → ui-kit}/src/robustExteranlApiCallerService/cacheAndConcurrentRequestsResolver.js.html +30 -222
- package/coverage/{rabbit-ui-kit → ui-kit}/src/robustExteranlApiCallerService/cachedRobustExternalApiCallerService.js.html +24 -147
- package/coverage/{rabbit-ui-kit → ui-kit}/src/robustExteranlApiCallerService/cancelProcessing.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/robustExteranlApiCallerService/concurrentCalculationsMetadataHolder.js.html +19 -103
- package/coverage/{rabbit-ui-kit → ui-kit}/src/robustExteranlApiCallerService/externalApiProvider.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/robustExteranlApiCallerService/externalServicesStatsCollector.js.html +11 -23
- package/coverage/{rabbit-ui-kit → ui-kit}/src/robustExteranlApiCallerService/index.html +38 -38
- package/coverage/{rabbit-ui-kit → ui-kit}/src/robustExteranlApiCallerService/robustExternalAPICallerService.js.html +53 -305
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/external-apis/index.html +24 -24
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/external-apis/swapProvider.js.html +10 -28
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/external-apis/swapspaceSwapProvider.js.html +277 -1009
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/models/baseSwapCreationInfo.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/models/existingSwap.js.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/models/existingSwapWithFiatData.js.html +9 -27
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/models/index.html +13 -13
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/services/index.html +7 -7
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/services/publicSwapService.js.html +53 -374
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/utils/index.html +13 -13
- package/coverage/{rabbit-ui-kit → ui-kit}/src/swaps-lib/utils/swapUtils.js.html +32 -179
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/BackgroundTitle.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/LinesOfText.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/LoadingDots.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/QrCode.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/RateSelector.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/Validation.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/buttons/Button.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/buttons/Close.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/buttons/LinkButton.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/buttons/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/atoms/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/molecules/LineWithIconLink.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/molecules/TitledLineWithIconLink.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/molecules/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/organisms/Dialog/Dialog.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/organisms/Dialog/DialogButtons/DialogButtons.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/organisms/Dialog/DialogButtons/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/organisms/Dialog/DialogStep/DialogStep.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/organisms/Dialog/DialogStep/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/organisms/Dialog/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/stubs/exampleContent.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/stubs/index.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/templates/DeterminedErrorDialogStep.stories.jsx.html +3 -3
- package/coverage/{rabbit-ui-kit → ui-kit}/stories/templates/index.html +3 -3
- package/dist/index.cjs +65 -49
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +5 -2
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +43 -28
- package/dist/index.modern.js.map +1 -1
- package/dist/index.module.js +65 -49
- package/dist/index.module.js.map +1 -1
- package/dist/index.umd.js +65 -49
- package/dist/index.umd.js.map +1 -1
- package/package.json +5 -3
- package/src/assets/wrappedImages/arrowIcon.jsx +1 -7
- package/src/assets/wrappedImages/arrowTosca.jsx +1 -7
- package/src/assets/wrappedImages/arrowWhite.jsx +1 -7
- package/src/assets/wrappedImages/darkRectangle.jsx +2 -13
- package/src/assets/wrappedImages/determinedError.jsx +2 -13
- package/src/assets/wrappedImages/failedValidationIcon.jsx +2 -16
- package/src/assets/wrappedImages/infoIcon.jsx +1 -7
- package/src/assets/wrappedImages/noticeQuestionIcon.jsx +1 -7
- package/src/assets/wrappedImages/successfulValidationIcon.jsx +2 -16
- package/src/assets/wrappedImages/walletIcon.jsx +3 -19
- package/src/common/amountUtils.js +36 -124
- package/src/common/external-apis/ipAddressProviders.js +22 -71
- package/src/common/fiatCurrenciesService.js +4 -12
- package/src/common/models/coin.js +2 -6
- package/src/common/tests/amountUtils/composeRateText.test.js +12 -69
- package/src/common/tests/integration/external-apis/ipAddressProviders/getClientIpAddress.test.js +1 -3
- package/src/common/utils/cache.js +10 -36
- package/src/common/utils/emailAPI.js +1 -3
- package/src/common/utils/logging/logger.js +5 -12
- package/src/components/atoms/AssetIcon/AssetIcon.jsx +4 -14
- package/src/components/atoms/AssetSelection/AssetSelection.jsx +3 -11
- package/src/components/atoms/BackgroundTitle/BackgroundTitle.jsx +2 -12
- package/src/components/atoms/InformationMessage/InformationMessage.jsx +2 -12
- package/src/components/atoms/InformationMessage/information-message.module.scss +4 -2
- package/src/components/atoms/Input/Input.jsx +9 -25
- package/src/components/atoms/LoadingDots/LoadingDots.jsx +8 -28
- package/src/components/atoms/NoticeIcon/NoticeIcon.jsx +4 -14
- package/src/components/atoms/QrCode/QrCode.jsx +2 -8
- package/src/components/atoms/RateSelector/RateSelector.jsx +4 -12
- package/src/components/atoms/SupportChat/SupportChat.jsx +1 -6
- package/src/components/atoms/Textarea/Textarea.jsx +11 -23
- package/src/components/atoms/TitleBox/TitleBox.jsx +7 -30
- package/src/components/atoms/TitleBox/title-box.module.scss +2 -0
- package/src/components/atoms/Tooltip/Tooltip.jsx +6 -8
- package/src/components/atoms/TwoLinesOfText/LinesOfText.jsx +5 -11
- package/src/components/atoms/Validation/Validation.jsx +9 -7
- package/src/components/atoms/buttons/Button/Button.jsx +17 -47
- package/src/components/atoms/buttons/Close/Close.jsx +3 -9
- package/src/components/atoms/buttons/LinkButton/LinkButton.jsx +5 -14
- package/src/components/atoms/buttons/RadioButtonWithText/RadioButtonWithText.jsx +7 -25
- package/src/components/hooks/useCallHandlingErrors.js +1 -5
- package/src/components/hooks/useReferredState.js +1 -1
- package/src/components/molecules/AmountInput/AmountInput.jsx +50 -167
- package/src/components/molecules/CoinPicker/CoinPicker.jsx +61 -194
- package/src/components/molecules/CoinPicker/coin-picker.module.scss +1 -4
- package/src/components/molecules/LineWithIconLink/LineWithIconLink.jsx +1 -6
- package/src/components/organisms/CoinPickerDialogStep/CoinPickerDialogStep.jsx +3 -5
- package/src/components/organisms/Dialog/Dialog.jsx +38 -88
- package/src/components/organisms/Dialog/DialogStep/DialogStep.jsx +57 -211
- package/src/components/organisms/Dialog/DialogStep/dialog-step.module.scss +2 -4
- package/src/components/organisms/SwapForm/SwapForm.jsx +139 -314
- package/src/components/tests/utils/inputValueProviders/provideFormatOfFloatValueByInputString.test.js +5 -12
- package/src/components/tests/utils/urlQueryUtils/getQueryParameterValues.test.js +3 -9
- package/src/components/tests/utils/urlQueryUtils/saveQueryParameterAndValues.test.js +11 -51
- package/src/components/utils/inputValueProviders.js +3 -11
- package/src/components/utils/uiUtils.js +1 -3
- package/src/components/utils/urlQueryUtils.js +10 -35
- package/src/constants/globalConstants.jsx +1 -2
- package/src/index.js +2 -8
- package/src/robustExteranlApiCallerService/cacheAndConcurrentRequestsResolver.js +22 -86
- package/src/robustExteranlApiCallerService/cachedRobustExternalApiCallerService.js +15 -56
- package/src/robustExteranlApiCallerService/concurrentCalculationsMetadataHolder.js +11 -39
- package/src/robustExteranlApiCallerService/externalServicesStatsCollector.js +3 -7
- package/src/robustExteranlApiCallerService/robustExternalAPICallerService.js +45 -129
- package/src/robustExteranlApiCallerService/tests/robustExternalAPICallerService/robustExternalAPICallerService/callExternalAPI/_performCallAttempt.test.js +76 -330
- package/src/robustExteranlApiCallerService/tests/robustExternalAPICallerService/robustExternalAPICallerService/callExternalAPI/callExternalAPI.test.js +57 -270
- package/src/robustExteranlApiCallerService/tests/robustExternalAPICallerService/robustExternalAPICallerService/constructor.test.js +3 -15
- package/src/swaps-lib/external-apis/swapProvider.js +1 -7
- package/src/swaps-lib/external-apis/swapspaceSwapProvider.js +117 -361
- package/src/swaps-lib/models/existingSwapWithFiatData.js +1 -7
- package/src/swaps-lib/services/publicSwapService.js +47 -154
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/_fetchSupportedCurrenciesIfNeeded.test.js +33 -118
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/createSwap.test.js +23 -85
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/getAllSupportedCurrencies.test.js +4 -14
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/getDepositCurrencies.test.js +3 -9
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/getSwapInfo.test.js +148 -460
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/getWithdrawalCurrencies.test.js +5 -11
- package/src/swaps-lib/test/utils/swapUtils/safeHandleRequestsLimitExceeding.test.js +2 -10
- package/src/swaps-lib/utils/swapUtils.js +24 -73
- package/coverage/rabbit-ui-kit/src/assets/wrappedImages/failedValidationIcon.jsx.html +0 -244
- package/coverage/rabbit-ui-kit/src/components/atoms/LoadingDots/LoadingDots.jsx.html +0 -256
- package/coverage/rabbit-ui-kit/src/components/atoms/LoadingDots/index.html +0 -116
- package/coverage/rabbit-ui-kit/src/components/atoms/TwoLinesOfText/index.html +0 -116
|
@@ -34,11 +34,7 @@ export class CachedRobustExternalApiCallerService {
|
|
|
34
34
|
maxCallAttemptsToWaitForAlreadyRunningRequest = 100,
|
|
35
35
|
timeoutBetweenAttemptsToCheckWhetherAlreadyRunningRequestFinished = 1000
|
|
36
36
|
) {
|
|
37
|
-
this._provider = new RobustExternalAPICallerService(
|
|
38
|
-
`cached_${bio}`,
|
|
39
|
-
providersData,
|
|
40
|
-
Logger.logError
|
|
41
|
-
);
|
|
37
|
+
this._provider = new RobustExternalAPICallerService(`cached_${bio}`, providersData, Logger.logError);
|
|
42
38
|
this._cacheTtlMs = cacheTtlMs;
|
|
43
39
|
this._cahceAndRequestsResolver = new CacheAndConcurrentRequestsResolver(
|
|
44
40
|
bio,
|
|
@@ -49,8 +45,7 @@ export class CachedRobustExternalApiCallerService {
|
|
|
49
45
|
timeoutBetweenAttemptsToCheckWhetherAlreadyRunningRequestFinished
|
|
50
46
|
);
|
|
51
47
|
this._cahceIds = [];
|
|
52
|
-
this._mergeCachedAndNewlyRetrievedData =
|
|
53
|
-
mergeCachedAndNewlyRetrievedData;
|
|
48
|
+
this._mergeCachedAndNewlyRetrievedData = mergeCachedAndNewlyRetrievedData;
|
|
54
49
|
}
|
|
55
50
|
|
|
56
51
|
/**
|
|
@@ -79,14 +74,8 @@ export class CachedRobustExternalApiCallerService {
|
|
|
79
74
|
let cacheId;
|
|
80
75
|
let result;
|
|
81
76
|
try {
|
|
82
|
-
cacheId = this._calculateCacheId(
|
|
83
|
-
|
|
84
|
-
customHashFunctionForParams
|
|
85
|
-
);
|
|
86
|
-
result =
|
|
87
|
-
await this._cahceAndRequestsResolver.getCachedOrWaitForCachedOrAcquireLock(
|
|
88
|
-
cacheId
|
|
89
|
-
);
|
|
77
|
+
cacheId = this._calculateCacheId(parametersValues, customHashFunctionForParams);
|
|
78
|
+
result = await this._cahceAndRequestsResolver.getCachedOrWaitForCachedOrAcquireLock(cacheId);
|
|
90
79
|
if (!result?.canStartDataRetrieval) {
|
|
91
80
|
return result?.cachedData;
|
|
92
81
|
}
|
|
@@ -99,27 +88,14 @@ export class CachedRobustExternalApiCallerService {
|
|
|
99
88
|
doNotFailForNowData
|
|
100
89
|
);
|
|
101
90
|
|
|
102
|
-
const canPerformMerge =
|
|
103
|
-
typeof this._mergeCachedAndNewlyRetrievedData === "function";
|
|
91
|
+
const canPerformMerge = typeof this._mergeCachedAndNewlyRetrievedData === "function";
|
|
104
92
|
if (canPerformMerge) {
|
|
105
|
-
const mostRecentCached =
|
|
106
|
-
|
|
107
|
-
data = this._mergeCachedAndNewlyRetrievedData(
|
|
108
|
-
mostRecentCached,
|
|
109
|
-
data,
|
|
110
|
-
parametersValues
|
|
111
|
-
);
|
|
93
|
+
const mostRecentCached = this._cahceAndRequestsResolver.getCached(cacheId);
|
|
94
|
+
data = this._mergeCachedAndNewlyRetrievedData(mostRecentCached, data, parametersValues);
|
|
112
95
|
}
|
|
113
96
|
if (data != null) {
|
|
114
|
-
this._cahceAndRequestsResolver.saveCachedData(
|
|
115
|
-
|
|
116
|
-
result?.lockId,
|
|
117
|
-
data,
|
|
118
|
-
true,
|
|
119
|
-
canPerformMerge
|
|
120
|
-
);
|
|
121
|
-
this._cahceIds.indexOf(cacheId) < 0 &&
|
|
122
|
-
this._cahceIds.push(cacheId);
|
|
97
|
+
this._cahceAndRequestsResolver.saveCachedData(cacheId, result?.lockId, data, true, canPerformMerge);
|
|
98
|
+
this._cahceIds.indexOf(cacheId) < 0 && this._cahceIds.push(cacheId);
|
|
123
99
|
}
|
|
124
100
|
|
|
125
101
|
return data;
|
|
@@ -131,9 +107,7 @@ export class CachedRobustExternalApiCallerService {
|
|
|
131
107
|
}
|
|
132
108
|
|
|
133
109
|
invalidateCaches() {
|
|
134
|
-
this._cahceIds.forEach((key)
|
|
135
|
-
this._cahceAndRequestsResolver.invalidate(key)
|
|
136
|
-
);
|
|
110
|
+
this._cahceIds.forEach(key => this._cahceAndRequestsResolver.invalidate(key));
|
|
137
111
|
}
|
|
138
112
|
|
|
139
113
|
actualizeCachedData(
|
|
@@ -143,27 +117,14 @@ export class CachedRobustExternalApiCallerService {
|
|
|
143
117
|
sessionDependent = true,
|
|
144
118
|
actualizedAtTimestamp
|
|
145
119
|
) {
|
|
146
|
-
const cacheId = this._calculateCacheId(
|
|
147
|
-
|
|
148
|
-
customHashFunctionForParams
|
|
149
|
-
);
|
|
150
|
-
this._cahceAndRequestsResolver.actualizeCachedData(
|
|
151
|
-
cacheId,
|
|
152
|
-
synchronousCurrentCacheProcessor,
|
|
153
|
-
sessionDependent
|
|
154
|
-
);
|
|
120
|
+
const cacheId = this._calculateCacheId(params, customHashFunctionForParams);
|
|
121
|
+
this._cahceAndRequestsResolver.actualizeCachedData(cacheId, synchronousCurrentCacheProcessor, sessionDependent);
|
|
155
122
|
}
|
|
156
123
|
|
|
157
|
-
markCacheAsExpiredButDontRemove(
|
|
158
|
-
parametersValues,
|
|
159
|
-
customHashFunctionForParams
|
|
160
|
-
) {
|
|
124
|
+
markCacheAsExpiredButDontRemove(parametersValues, customHashFunctionForParams) {
|
|
161
125
|
try {
|
|
162
126
|
this._cahceAndRequestsResolver.markAsExpiredButDontRemove(
|
|
163
|
-
this._calculateCacheId(
|
|
164
|
-
parametersValues,
|
|
165
|
-
customHashFunctionForParams
|
|
166
|
-
)
|
|
127
|
+
this._calculateCacheId(parametersValues, customHashFunctionForParams)
|
|
167
128
|
);
|
|
168
129
|
} catch (e) {
|
|
169
130
|
improveAndRethrow(e, "markCacheAsExpiredButDontRemove");
|
|
@@ -177,9 +138,7 @@ export class CachedRobustExternalApiCallerService {
|
|
|
177
138
|
? customHashFunctionForParams(parametersValues)
|
|
178
139
|
: !parametersValues
|
|
179
140
|
? ""
|
|
180
|
-
: new Hashes.SHA512().hex(
|
|
181
|
-
safeStringify(parametersValues)
|
|
182
|
-
);
|
|
141
|
+
: new Hashes.SHA512().hex(safeStringify(parametersValues));
|
|
183
142
|
return `${this._provider.bio}-${hash}`;
|
|
184
143
|
} catch (e) {
|
|
185
144
|
improveAndRethrow(e, this._provider.bio + "_calculateCacheId");
|
|
@@ -32,26 +32,14 @@ export class ConcurrentCalculationsMetadataHolder {
|
|
|
32
32
|
|
|
33
33
|
endCalculation(domain, uuid, isFailed = false) {
|
|
34
34
|
try {
|
|
35
|
-
const calculation = this._calculations[domain].find(
|
|
36
|
-
(calculation) => calculation?.uuid === uuid
|
|
37
|
-
);
|
|
35
|
+
const calculation = this._calculations[domain].find(calculation => calculation?.uuid === uuid);
|
|
38
36
|
if (calculation) {
|
|
39
37
|
calculation.endTimestamp = Date.now();
|
|
40
38
|
calculation.isFiled = isFailed;
|
|
41
39
|
}
|
|
42
40
|
|
|
43
|
-
const elapsed = (
|
|
44
|
-
|
|
45
|
-
(calculation?.startTimestamp ?? 0)) /
|
|
46
|
-
1000
|
|
47
|
-
).toFixed(1);
|
|
48
|
-
Logger.log(
|
|
49
|
-
"endCalculation",
|
|
50
|
-
`${elapsed} ms: ${domain}.${(calculation?.uuid ?? "").slice(
|
|
51
|
-
0,
|
|
52
|
-
7
|
|
53
|
-
)}`
|
|
54
|
-
);
|
|
41
|
+
const elapsed = (((calculation?.endTimestamp ?? 0) - (calculation?.startTimestamp ?? 0)) / 1000).toFixed(1);
|
|
42
|
+
Logger.log("endCalculation", `${elapsed} ms: ${domain}.${(calculation?.uuid ?? "").slice(0, 7)}`);
|
|
55
43
|
|
|
56
44
|
return calculation;
|
|
57
45
|
} catch (e) {
|
|
@@ -61,43 +49,27 @@ export class ConcurrentCalculationsMetadataHolder {
|
|
|
61
49
|
|
|
62
50
|
isCalculationLate(domain, uuid) {
|
|
63
51
|
const queue = this._calculations[domain];
|
|
64
|
-
const analysingCalculation = queue.find(
|
|
52
|
+
const analysingCalculation = queue.find(item => item.uuid === uuid);
|
|
65
53
|
return (
|
|
66
54
|
analysingCalculation &&
|
|
67
55
|
!!queue.find(
|
|
68
|
-
|
|
69
|
-
calculation.endTimestamp != null &&
|
|
70
|
-
calculation.startTimestamp >
|
|
71
|
-
analysingCalculation.startTimestamp
|
|
56
|
+
calculation =>
|
|
57
|
+
calculation.endTimestamp != null && calculation.startTimestamp > analysingCalculation.startTimestamp
|
|
72
58
|
)
|
|
73
59
|
);
|
|
74
60
|
}
|
|
75
61
|
|
|
76
62
|
printCalculationsWaitingMoreThanSpecifiedSeconds(waitingLastsMs = 2000) {
|
|
77
63
|
const calculations = Object.keys(this._calculations)
|
|
78
|
-
.map((domain)
|
|
79
|
-
this._calculations[domain].map((c) => ({ ...c, domain }))
|
|
80
|
-
)
|
|
64
|
+
.map(domain => this._calculations[domain].map(c => ({ ...c, domain })))
|
|
81
65
|
.flat()
|
|
82
|
-
.filter(
|
|
83
|
-
(c) =>
|
|
84
|
-
c.endTimestamp === null &&
|
|
85
|
-
Date.now() - c.startTimestamp > waitingLastsMs
|
|
86
|
-
);
|
|
66
|
+
.filter(c => c.endTimestamp === null && Date.now() - c.startTimestamp > waitingLastsMs);
|
|
87
67
|
Logger.log(
|
|
88
68
|
"printCalculationsWaitingMoreThanSpecifiedSeconds",
|
|
89
|
-
`Calculations waiting more than ${(waitingLastsMs / 1000).toFixed(
|
|
90
|
-
|
|
91
|
-
)}s:\n` +
|
|
92
|
-
calculations.map(
|
|
93
|
-
(c) =>
|
|
94
|
-
`${c.domain}.${c.uuid.slice(0, 8)}: ${
|
|
95
|
-
Date.now() - c.startTimestamp
|
|
96
|
-
}\n`
|
|
97
|
-
)
|
|
69
|
+
`Calculations waiting more than ${(waitingLastsMs / 1000).toFixed(1)}s:\n` +
|
|
70
|
+
calculations.map(c => `${c.domain}.${c.uuid.slice(0, 8)}: ${Date.now() - c.startTimestamp}\n`)
|
|
98
71
|
);
|
|
99
72
|
}
|
|
100
73
|
}
|
|
101
74
|
|
|
102
|
-
export const concurrentCalculationsMetadataHolder =
|
|
103
|
-
new ConcurrentCalculationsMetadataHolder();
|
|
75
|
+
export const concurrentCalculationsMetadataHolder = new ConcurrentCalculationsMetadataHolder();
|
|
@@ -14,8 +14,7 @@ export class ExternalServicesStatsCollector {
|
|
|
14
14
|
if (errorMessage.match(/.*network.+error.*/i)) {
|
|
15
15
|
errors["networkError"] = (errors["networkError"] || 0) + 1;
|
|
16
16
|
} else if (errorMessage.match(/.*timeout.+exceeded.*/i)) {
|
|
17
|
-
errors["timeoutExceeded"] =
|
|
18
|
-
(errors["timeoutExceeded"] || 0) + 1;
|
|
17
|
+
errors["timeoutExceeded"] = (errors["timeoutExceeded"] || 0) + 1;
|
|
19
18
|
} else if (errors["other"]) {
|
|
20
19
|
errors["other"].push(message);
|
|
21
20
|
} else {
|
|
@@ -62,14 +61,11 @@ export class ExternalServicesStatsCollector {
|
|
|
62
61
|
getStats() {
|
|
63
62
|
try {
|
|
64
63
|
return Array.from(this.stats.keys())
|
|
65
|
-
.map(
|
|
64
|
+
.map(key => {
|
|
66
65
|
const stat = this.stats.get(key);
|
|
67
66
|
return {
|
|
68
67
|
url: key,
|
|
69
|
-
failsPerCent: (
|
|
70
|
-
(stat.failsCount / stat.callsCount) *
|
|
71
|
-
100
|
|
72
|
-
).toFixed(2),
|
|
68
|
+
failsPerCent: ((stat.failsCount / stat.callsCount) * 100).toFixed(2),
|
|
73
69
|
calls: stat.callsCount,
|
|
74
70
|
errors: stat.errors ?? [],
|
|
75
71
|
};
|
|
@@ -28,23 +28,16 @@ export class RobustExternalAPICallerService {
|
|
|
28
28
|
* @param [logger] {function} function to be used for logging
|
|
29
29
|
*/
|
|
30
30
|
constructor(bio, providersData, logger = Logger.logError) {
|
|
31
|
-
providersData.forEach(
|
|
32
|
-
if (
|
|
33
|
-
(
|
|
34
|
-
!provider.httpMethod
|
|
35
|
-
) {
|
|
36
|
-
throw new Error(
|
|
37
|
-
`Wrong format of providers data for: ${JSON.stringify(
|
|
38
|
-
provider
|
|
39
|
-
)}`
|
|
40
|
-
);
|
|
31
|
+
providersData.forEach(provider => {
|
|
32
|
+
if ((!provider.endpoint && provider.endpoint !== "") || !provider.httpMethod) {
|
|
33
|
+
throw new Error(`Wrong format of providers data for: ${JSON.stringify(provider)}`);
|
|
41
34
|
}
|
|
42
35
|
});
|
|
43
36
|
|
|
44
37
|
// We add niceFactor - just number to order the providers array by. It is helpful to call
|
|
45
38
|
// less robust APIs only if more robust fails
|
|
46
39
|
this.providers = providersData;
|
|
47
|
-
providersData.forEach(
|
|
40
|
+
providersData.forEach(provider => provider.resetNiceFactor());
|
|
48
41
|
this.bio = bio;
|
|
49
42
|
this._logger = (...args) => {
|
|
50
43
|
Logger.logError(...args);
|
|
@@ -74,24 +67,16 @@ export class RobustExternalAPICallerService {
|
|
|
74
67
|
doNotFailForNowData = false
|
|
75
68
|
) {
|
|
76
69
|
let result;
|
|
77
|
-
const calculationUuid =
|
|
78
|
-
concurrentCalculationsMetadataHolder.startCalculation(this.bio);
|
|
70
|
+
const calculationUuid = concurrentCalculationsMetadataHolder.startCalculation(this.bio);
|
|
79
71
|
|
|
80
72
|
try {
|
|
81
|
-
for (
|
|
82
|
-
let i = 0;
|
|
83
|
-
(i < attemptsCount || result?.shouldBeForceRetried) &&
|
|
84
|
-
result?.data == null;
|
|
85
|
-
++i
|
|
86
|
-
) {
|
|
73
|
+
for (let i = 0; (i < attemptsCount || result?.shouldBeForceRetried) && result?.data == null; ++i) {
|
|
87
74
|
/**
|
|
88
75
|
* We use rpsFactor to improve re-attempting to call the providers if the last attempt resulted with
|
|
89
76
|
* the fail due to abused RPSes of some (most part of) providers.
|
|
90
77
|
* The _performCallAttempt in such a case will return increased rpsFactor inside the result object.
|
|
91
78
|
*/
|
|
92
|
-
const rpsFactor = result
|
|
93
|
-
? result.rpsFactor
|
|
94
|
-
: RobustExternalAPICallerService.defaultRPSFactor;
|
|
79
|
+
const rpsFactor = result ? result.rpsFactor : RobustExternalAPICallerService.defaultRPSFactor;
|
|
95
80
|
|
|
96
81
|
result = null;
|
|
97
82
|
|
|
@@ -105,14 +90,8 @@ export class RobustExternalAPICallerService {
|
|
|
105
90
|
doNotFailForNowData
|
|
106
91
|
);
|
|
107
92
|
} else {
|
|
108
|
-
const maxRps = Math.max(
|
|
109
|
-
|
|
110
|
-
(provider) => provider.getRps() ?? 0
|
|
111
|
-
)
|
|
112
|
-
);
|
|
113
|
-
const waitingTimeMs = maxRps
|
|
114
|
-
? 1000 / (maxRps / rpsFactor)
|
|
115
|
-
: 0;
|
|
93
|
+
const maxRps = Math.max(...this.providers.map(provider => provider.getRps() ?? 0));
|
|
94
|
+
const waitingTimeMs = maxRps ? 1000 / (maxRps / rpsFactor) : 0;
|
|
116
95
|
|
|
117
96
|
result = await new Promise((resolve, reject) => {
|
|
118
97
|
setTimeout(async () => {
|
|
@@ -136,10 +115,8 @@ export class RobustExternalAPICallerService {
|
|
|
136
115
|
const errors = result.errors;
|
|
137
116
|
this._logger(
|
|
138
117
|
new Error(
|
|
139
|
-
`Failed at attempt ${i}. ${
|
|
140
|
-
errors.
|
|
141
|
-
} errors. Messages: ${safeStringify(
|
|
142
|
-
errors.map((error) => error.message)
|
|
118
|
+
`Failed at attempt ${i}. ${errors.length} errors. Messages: ${safeStringify(
|
|
119
|
+
errors.map(error => error.message)
|
|
143
120
|
)}: ${safeStringify(errors)}.`
|
|
144
121
|
),
|
|
145
122
|
`${this.bio}.callExternalAPI`,
|
|
@@ -148,11 +125,7 @@ export class RobustExternalAPICallerService {
|
|
|
148
125
|
);
|
|
149
126
|
}
|
|
150
127
|
} catch (e) {
|
|
151
|
-
this._logger(
|
|
152
|
-
e,
|
|
153
|
-
`${this.bio}.callExternalAPI`,
|
|
154
|
-
"Failed to perform external providers calling"
|
|
155
|
-
);
|
|
128
|
+
this._logger(e, `${this.bio}.callExternalAPI`, "Failed to perform external providers calling");
|
|
156
129
|
}
|
|
157
130
|
}
|
|
158
131
|
|
|
@@ -172,20 +145,11 @@ export class RobustExternalAPICallerService {
|
|
|
172
145
|
} catch (e) {
|
|
173
146
|
improveAndRethrow(e, `${this.bio}.callExternalAPI`);
|
|
174
147
|
} finally {
|
|
175
|
-
concurrentCalculationsMetadataHolder.endCalculation(
|
|
176
|
-
this.bio,
|
|
177
|
-
calculationUuid
|
|
178
|
-
);
|
|
148
|
+
concurrentCalculationsMetadataHolder.endCalculation(this.bio, calculationUuid);
|
|
179
149
|
}
|
|
180
150
|
}
|
|
181
151
|
|
|
182
|
-
async _performCallAttempt(
|
|
183
|
-
parametersValues,
|
|
184
|
-
timeoutMS,
|
|
185
|
-
cancelToken,
|
|
186
|
-
rpsFactor,
|
|
187
|
-
doNotFailForNowData
|
|
188
|
-
) {
|
|
152
|
+
async _performCallAttempt(parametersValues, timeoutMS, cancelToken, rpsFactor, doNotFailForNowData) {
|
|
189
153
|
const providers = this._reorderProvidersByNiceFactor();
|
|
190
154
|
let data = undefined,
|
|
191
155
|
providerIndex = 0,
|
|
@@ -209,31 +173,14 @@ export class RobustExternalAPICallerService {
|
|
|
209
173
|
timeout: provider.timeout || timeoutMS,
|
|
210
174
|
headers: provider.specificHeaders ?? {},
|
|
211
175
|
};
|
|
212
|
-
const httpMethods = Array.isArray(provider.httpMethod)
|
|
213
|
-
? provider.httpMethod
|
|
214
|
-
: [provider.httpMethod];
|
|
176
|
+
const httpMethods = Array.isArray(provider.httpMethod) ? provider.httpMethod : [provider.httpMethod];
|
|
215
177
|
const iterationsData = [];
|
|
216
|
-
for (
|
|
217
|
-
|
|
218
|
-
subRequestIndex < httpMethods.length;
|
|
219
|
-
++subRequestIndex
|
|
220
|
-
) {
|
|
221
|
-
const query = provider.composeQueryString(
|
|
222
|
-
parametersValues,
|
|
223
|
-
subRequestIndex
|
|
224
|
-
);
|
|
178
|
+
for (let subRequestIndex = 0; subRequestIndex < httpMethods.length; ++subRequestIndex) {
|
|
179
|
+
const query = provider.composeQueryString(parametersValues, subRequestIndex);
|
|
225
180
|
const endpoint = `${provider.endpoint}${query}`;
|
|
226
181
|
const axiosParams = [endpoint, axiosConfig];
|
|
227
|
-
if (
|
|
228
|
-
|
|
229
|
-
(method) => method === httpMethods[subRequestIndex]
|
|
230
|
-
)
|
|
231
|
-
) {
|
|
232
|
-
const body =
|
|
233
|
-
provider.composeBody(
|
|
234
|
-
parametersValues,
|
|
235
|
-
subRequestIndex
|
|
236
|
-
) ?? null;
|
|
182
|
+
if (["post", "put", "patch"].find(method => method === httpMethods[subRequestIndex])) {
|
|
183
|
+
const body = provider.composeBody(parametersValues, subRequestIndex) ?? null;
|
|
237
184
|
axiosParams.splice(1, 0, body);
|
|
238
185
|
}
|
|
239
186
|
|
|
@@ -243,27 +190,22 @@ export class RobustExternalAPICallerService {
|
|
|
243
190
|
do {
|
|
244
191
|
if (subRequestIndex === 0 && pageNumber === 0) {
|
|
245
192
|
provider.actualizeLastCalledTimestamp();
|
|
246
|
-
responsesForPages[pageNumber] =
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
);
|
|
193
|
+
responsesForPages[pageNumber] = await AxiosAdapter.call(
|
|
194
|
+
httpMethods[subRequestIndex],
|
|
195
|
+
...axiosParams
|
|
196
|
+
);
|
|
251
197
|
RobustExternalAPICallerService.statsCollector.externalServiceCalledWithoutError(
|
|
252
198
|
provider.getApiGroupId()
|
|
253
199
|
);
|
|
254
200
|
} else {
|
|
255
201
|
if (pageNumber > 0) {
|
|
256
|
-
const actualizedParams =
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
pageNumber,
|
|
261
|
-
subRequestIndex
|
|
262
|
-
);
|
|
263
|
-
const query = provider.composeQueryString(
|
|
264
|
-
actualizedParams,
|
|
202
|
+
const actualizedParams = provider.changeQueryParametersForPageNumber(
|
|
203
|
+
parametersValues,
|
|
204
|
+
responsesForPages[pageNumber - 1],
|
|
205
|
+
pageNumber,
|
|
265
206
|
subRequestIndex
|
|
266
207
|
);
|
|
208
|
+
const query = provider.composeQueryString(actualizedParams, subRequestIndex);
|
|
267
209
|
axiosParams[0] = `${provider.endpoint}${query}`;
|
|
268
210
|
}
|
|
269
211
|
/**
|
|
@@ -273,56 +215,35 @@ export class RobustExternalAPICallerService {
|
|
|
273
215
|
* TODO: [dev] test RPS factor logic (units or integration)
|
|
274
216
|
*/
|
|
275
217
|
|
|
276
|
-
const waitingTimeMS = provider.getRps()
|
|
277
|
-
? 1000 / (provider.getRps() / rpsFactor)
|
|
278
|
-
: 0;
|
|
218
|
+
const waitingTimeMS = provider.getRps() ? 1000 / (provider.getRps() / rpsFactor) : 0;
|
|
279
219
|
|
|
280
|
-
const postponeUntilRpsExceeded = async (
|
|
281
|
-
recursionLevel = 0
|
|
282
|
-
) => {
|
|
220
|
+
const postponeUntilRpsExceeded = async (recursionLevel = 0) => {
|
|
283
221
|
return await postponeExecution(async () => {
|
|
284
222
|
const maxCountOfPostponingAttempts = 2;
|
|
285
|
-
if (
|
|
286
|
-
|
|
287
|
-
recursionLevel <
|
|
288
|
-
maxCountOfPostponingAttempts
|
|
289
|
-
) {
|
|
290
|
-
return await postponeUntilRpsExceeded(
|
|
291
|
-
recursionLevel + 1
|
|
292
|
-
);
|
|
223
|
+
if (provider.isRpsExceeded() && recursionLevel < maxCountOfPostponingAttempts) {
|
|
224
|
+
return await postponeUntilRpsExceeded(recursionLevel + 1);
|
|
293
225
|
}
|
|
294
226
|
provider.actualizeLastCalledTimestamp();
|
|
295
|
-
return await AxiosAdapter.call(
|
|
296
|
-
httpMethods[subRequestIndex],
|
|
297
|
-
...axiosParams
|
|
298
|
-
);
|
|
227
|
+
return await AxiosAdapter.call(httpMethods[subRequestIndex], ...axiosParams);
|
|
299
228
|
}, waitingTimeMS);
|
|
300
229
|
};
|
|
301
230
|
|
|
302
|
-
responsesForPages[pageNumber] =
|
|
303
|
-
await postponeUntilRpsExceeded();
|
|
231
|
+
responsesForPages[pageNumber] = await postponeUntilRpsExceeded();
|
|
304
232
|
}
|
|
305
233
|
|
|
306
234
|
if (hasNextPage) {
|
|
307
|
-
hasNextPage =
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
);
|
|
235
|
+
hasNextPage = !provider.checkWhetherResponseIsForLastPage(
|
|
236
|
+
responsesForPages[pageNumber - 1],
|
|
237
|
+
responsesForPages[pageNumber],
|
|
238
|
+
pageNumber,
|
|
239
|
+
subRequestIndex
|
|
240
|
+
);
|
|
314
241
|
}
|
|
315
242
|
pageNumber++;
|
|
316
243
|
} while (hasNextPage);
|
|
317
244
|
|
|
318
|
-
const responsesDataForPages = responsesForPages.map(
|
|
319
|
-
(response)
|
|
320
|
-
provider.getDataByResponse(
|
|
321
|
-
response,
|
|
322
|
-
parametersValues,
|
|
323
|
-
subRequestIndex,
|
|
324
|
-
iterationsData
|
|
325
|
-
)
|
|
245
|
+
const responsesDataForPages = responsesForPages.map(response =>
|
|
246
|
+
provider.getDataByResponse(response, parametersValues, subRequestIndex, iterationsData)
|
|
326
247
|
);
|
|
327
248
|
|
|
328
249
|
let allData = responsesDataForPages;
|
|
@@ -336,8 +257,7 @@ export class RobustExternalAPICallerService {
|
|
|
336
257
|
}
|
|
337
258
|
if (iterationsData.length) {
|
|
338
259
|
if (httpMethods.length > 1) {
|
|
339
|
-
data =
|
|
340
|
-
provider.incorporateIterationsData(iterationsData);
|
|
260
|
+
data = provider.incorporateIterationsData(iterationsData);
|
|
341
261
|
} else {
|
|
342
262
|
data = iterationsData[0];
|
|
343
263
|
}
|
|
@@ -361,12 +281,8 @@ export class RobustExternalAPICallerService {
|
|
|
361
281
|
}
|
|
362
282
|
|
|
363
283
|
// If we are declining more than 50% of providers (by exceeding RPS) then we note that it better to retry the whole process of providers requesting
|
|
364
|
-
const shouldBeForceRetried =
|
|
365
|
-
|
|
366
|
-
countOfRequestsDeclinedByRps > Math.floor(providers.length * 0.5);
|
|
367
|
-
const rpsMultiplier = shouldBeForceRetried
|
|
368
|
-
? RobustExternalAPICallerService.rpsMultiplier
|
|
369
|
-
: 1;
|
|
284
|
+
const shouldBeForceRetried = data == null && countOfRequestsDeclinedByRps > Math.floor(providers.length * 0.5);
|
|
285
|
+
const rpsMultiplier = shouldBeForceRetried ? RobustExternalAPICallerService.rpsMultiplier : 1;
|
|
370
286
|
|
|
371
287
|
return {
|
|
372
288
|
data: data ?? null,
|