@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
|
@@ -61,7 +61,7 @@ import { RobustExternalAPICallerService } from "../../../../robustExternalAPICal
|
|
|
61
61
|
*/
|
|
62
62
|
describe("RobustExternalAPICallerService", function () {
|
|
63
63
|
describe("#callExternalAPI>_performCallAttempt", function () {
|
|
64
|
-
const anyAxiosResponse =
|
|
64
|
+
const anyAxiosResponse = method => `${method}-result`;
|
|
65
65
|
|
|
66
66
|
const generateProviders = (
|
|
67
67
|
count,
|
|
@@ -80,38 +80,26 @@ describe("RobustExternalAPICallerService", function () {
|
|
|
80
80
|
endpoints === "any" ? "any" : endpoints[i],
|
|
81
81
|
httpMethods === "any" ? "get" : httpMethods[i],
|
|
82
82
|
timeouts ? timeouts[i] : null,
|
|
83
|
-
RPSes === null
|
|
84
|
-
? new ApiGroup(v4(), 10)
|
|
85
|
-
: new ApiGroup(v4(), RPSes[i])
|
|
83
|
+
RPSes === null ? new ApiGroup(v4(), 10) : new ApiGroup(v4(), RPSes[i])
|
|
86
84
|
);
|
|
87
85
|
}
|
|
88
|
-
getDataByResponse(
|
|
89
|
-
response,
|
|
90
|
-
params = [],
|
|
91
|
-
subRequestIndex = 0,
|
|
92
|
-
iterationsData = []
|
|
93
|
-
) {
|
|
86
|
+
getDataByResponse(response, params = [], subRequestIndex = 0, iterationsData = []) {
|
|
94
87
|
const func =
|
|
95
88
|
getDataByResponseFunctions === "any"
|
|
96
89
|
? "any"
|
|
97
90
|
: Array.isArray(getDataByResponseFunctions[i])
|
|
98
|
-
? getDataByResponseFunctions[i][
|
|
99
|
-
subRequestIndex
|
|
100
|
-
]
|
|
91
|
+
? getDataByResponseFunctions[i][subRequestIndex]
|
|
101
92
|
: getDataByResponseFunctions[i];
|
|
102
93
|
return func();
|
|
103
94
|
}
|
|
104
95
|
}
|
|
105
96
|
const provider = new TempProvider();
|
|
106
97
|
providers.push(provider);
|
|
107
|
-
const composeQueryStringStub = sinon.stub(
|
|
108
|
-
provider,
|
|
109
|
-
"composeQueryString"
|
|
110
|
-
);
|
|
98
|
+
const composeQueryStringStub = sinon.stub(provider, "composeQueryString");
|
|
111
99
|
composeQueryStringStubs.push(composeQueryStringStub);
|
|
112
100
|
}
|
|
113
101
|
const isRpsExceededStubs = [];
|
|
114
|
-
providers.forEach(
|
|
102
|
+
providers.forEach(provider => {
|
|
115
103
|
if (
|
|
116
104
|
provider.httpMethod === "post" ||
|
|
117
105
|
provider.httpMethod === "put" ||
|
|
@@ -128,7 +116,7 @@ describe("RobustExternalAPICallerService", function () {
|
|
|
128
116
|
return { providers, isRpsExceededStubs, composeQueryStringStubs };
|
|
129
117
|
};
|
|
130
118
|
|
|
131
|
-
const anyRPSes =
|
|
119
|
+
const anyRPSes = count => new Array(count).fill(10);
|
|
132
120
|
|
|
133
121
|
let anyParameters = [];
|
|
134
122
|
let anyTimeout = 10000;
|
|
@@ -138,44 +126,19 @@ describe("RobustExternalAPICallerService", function () {
|
|
|
138
126
|
beforeEach(function () {
|
|
139
127
|
callStub = sinon.stub(AxiosAdapter, "call");
|
|
140
128
|
callStub
|
|
141
|
-
.withArgs(
|
|
142
|
-
"get",
|
|
143
|
-
sinon.match.any,
|
|
144
|
-
sinon.match.any,
|
|
145
|
-
sinon.match.any
|
|
146
|
-
)
|
|
129
|
+
.withArgs("get", sinon.match.any, sinon.match.any, sinon.match.any)
|
|
147
130
|
.resolves(anyAxiosResponse("get"));
|
|
148
131
|
callStub
|
|
149
|
-
.withArgs(
|
|
150
|
-
"post",
|
|
151
|
-
sinon.match.any,
|
|
152
|
-
sinon.match.any,
|
|
153
|
-
sinon.match.any
|
|
154
|
-
)
|
|
132
|
+
.withArgs("post", sinon.match.any, sinon.match.any, sinon.match.any)
|
|
155
133
|
.resolves(anyAxiosResponse("post"));
|
|
156
134
|
callStub
|
|
157
|
-
.withArgs(
|
|
158
|
-
"patch",
|
|
159
|
-
sinon.match.any,
|
|
160
|
-
sinon.match.any,
|
|
161
|
-
sinon.match.any
|
|
162
|
-
)
|
|
135
|
+
.withArgs("patch", sinon.match.any, sinon.match.any, sinon.match.any)
|
|
163
136
|
.resolves(anyAxiosResponse("patch"));
|
|
164
137
|
callStub
|
|
165
|
-
.withArgs(
|
|
166
|
-
"delete",
|
|
167
|
-
sinon.match.any,
|
|
168
|
-
sinon.match.any,
|
|
169
|
-
sinon.match.any
|
|
170
|
-
)
|
|
138
|
+
.withArgs("delete", sinon.match.any, sinon.match.any, sinon.match.any)
|
|
171
139
|
.resolves(anyAxiosResponse("delete"));
|
|
172
140
|
callStub
|
|
173
|
-
.withArgs(
|
|
174
|
-
"put",
|
|
175
|
-
sinon.match.any,
|
|
176
|
-
sinon.match.any,
|
|
177
|
-
sinon.match.any
|
|
178
|
-
)
|
|
141
|
+
.withArgs("put", sinon.match.any, sinon.match.any, sinon.match.any)
|
|
179
142
|
.resolves(anyAxiosResponse("put"));
|
|
180
143
|
});
|
|
181
144
|
|
|
@@ -190,32 +153,15 @@ describe("RobustExternalAPICallerService", function () {
|
|
|
190
153
|
["get", "get", "get"],
|
|
191
154
|
[() => "any", () => null, () => null]
|
|
192
155
|
);
|
|
193
|
-
const retriever = new RobustExternalAPICallerService(
|
|
194
|
-
|
|
195
|
-
providers
|
|
196
|
-
);
|
|
197
|
-
[1, 5, 3].forEach(
|
|
198
|
-
(niceFactor, i) =>
|
|
199
|
-
(retriever.providers[i].niceFactor = niceFactor)
|
|
200
|
-
);
|
|
156
|
+
const retriever = new RobustExternalAPICallerService("any", providers);
|
|
157
|
+
[1, 5, 3].forEach((niceFactor, i) => (retriever.providers[i].niceFactor = niceFactor));
|
|
201
158
|
|
|
202
|
-
await retriever._performCallAttempt(
|
|
203
|
-
anyParameters,
|
|
204
|
-
anyTimeout,
|
|
205
|
-
anyCancelToken,
|
|
206
|
-
anyRPSFactor
|
|
207
|
-
);
|
|
159
|
+
await retriever._performCallAttempt(anyParameters, anyTimeout, anyCancelToken, anyRPSFactor);
|
|
208
160
|
|
|
209
161
|
callStub.args[0][0].should.be.equal("get");
|
|
210
|
-
callStub.args[0][1].should.startWith(
|
|
211
|
-
|
|
212
|
-
);
|
|
213
|
-
callStub.args[1][1].should.startWith(
|
|
214
|
-
retriever.providers[2].endpoint
|
|
215
|
-
);
|
|
216
|
-
callStub.args[2][1].should.startWith(
|
|
217
|
-
retriever.providers[0].endpoint
|
|
218
|
-
);
|
|
162
|
+
callStub.args[0][1].should.startWith(retriever.providers[1].endpoint);
|
|
163
|
+
callStub.args[1][1].should.startWith(retriever.providers[2].endpoint);
|
|
164
|
+
callStub.args[2][1].should.startWith(retriever.providers[0].endpoint);
|
|
219
165
|
});
|
|
220
166
|
|
|
221
167
|
it("Should not touch the instance's providers list during the reordering", async function () {
|
|
@@ -225,31 +171,14 @@ describe("RobustExternalAPICallerService", function () {
|
|
|
225
171
|
["get", "get", "get"],
|
|
226
172
|
[() => "any", () => null, () => null]
|
|
227
173
|
);
|
|
228
|
-
const retriever = new RobustExternalAPICallerService(
|
|
229
|
-
|
|
230
|
-
providers
|
|
231
|
-
);
|
|
232
|
-
[1, 5, 3].forEach(
|
|
233
|
-
(niceFactor, i) =>
|
|
234
|
-
(retriever.providers[i].niceFactor = niceFactor)
|
|
235
|
-
);
|
|
174
|
+
const retriever = new RobustExternalAPICallerService("any", providers);
|
|
175
|
+
[1, 5, 3].forEach((niceFactor, i) => (retriever.providers[i].niceFactor = niceFactor));
|
|
236
176
|
|
|
237
|
-
await retriever._performCallAttempt(
|
|
238
|
-
anyParameters,
|
|
239
|
-
anyTimeout,
|
|
240
|
-
anyCancelToken,
|
|
241
|
-
anyRPSFactor
|
|
242
|
-
);
|
|
177
|
+
await retriever._performCallAttempt(anyParameters, anyTimeout, anyCancelToken, anyRPSFactor);
|
|
243
178
|
|
|
244
|
-
retriever.providers[0].endpoint.should.be.equal(
|
|
245
|
-
|
|
246
|
-
);
|
|
247
|
-
retriever.providers[1].endpoint.should.be.equal(
|
|
248
|
-
providers[1].endpoint
|
|
249
|
-
);
|
|
250
|
-
retriever.providers[2].endpoint.should.be.equal(
|
|
251
|
-
providers[2].endpoint
|
|
252
|
-
);
|
|
179
|
+
retriever.providers[0].endpoint.should.be.equal(providers[0].endpoint);
|
|
180
|
+
retriever.providers[1].endpoint.should.be.equal(providers[1].endpoint);
|
|
181
|
+
retriever.providers[2].endpoint.should.be.equal(providers[2].endpoint);
|
|
253
182
|
});
|
|
254
183
|
|
|
255
184
|
it("Should call only first provider if it returns data", async function () {
|
|
@@ -259,23 +188,13 @@ describe("RobustExternalAPICallerService", function () {
|
|
|
259
188
|
["get", "get", "get"],
|
|
260
189
|
[() => "any", () => "any", () => "any"]
|
|
261
190
|
);
|
|
262
|
-
const retriever = new RobustExternalAPICallerService(
|
|
263
|
-
"any",
|
|
264
|
-
providers
|
|
265
|
-
);
|
|
191
|
+
const retriever = new RobustExternalAPICallerService("any", providers);
|
|
266
192
|
|
|
267
|
-
await retriever._performCallAttempt(
|
|
268
|
-
anyParameters,
|
|
269
|
-
anyTimeout,
|
|
270
|
-
anyCancelToken,
|
|
271
|
-
anyRPSFactor
|
|
272
|
-
);
|
|
193
|
+
await retriever._performCallAttempt(anyParameters, anyTimeout, anyCancelToken, anyRPSFactor);
|
|
273
194
|
|
|
274
195
|
callStub.callCount.should.be.equal(1);
|
|
275
196
|
callStub.args[0][0].should.be.equal("get");
|
|
276
|
-
callStub.args[0][1].should.startWith(
|
|
277
|
-
retriever.providers[0].endpoint
|
|
278
|
-
);
|
|
197
|
+
callStub.args[0][1].should.startWith(retriever.providers[0].endpoint);
|
|
279
198
|
});
|
|
280
199
|
|
|
281
200
|
it("Should call several providers until the data retrieved", async function () {
|
|
@@ -285,31 +204,17 @@ describe("RobustExternalAPICallerService", function () {
|
|
|
285
204
|
["get", "get", "get"],
|
|
286
205
|
[() => null, () => null, () => "any"]
|
|
287
206
|
);
|
|
288
|
-
const retriever = new RobustExternalAPICallerService(
|
|
289
|
-
"any",
|
|
290
|
-
providers
|
|
291
|
-
);
|
|
207
|
+
const retriever = new RobustExternalAPICallerService("any", providers);
|
|
292
208
|
|
|
293
|
-
await retriever._performCallAttempt(
|
|
294
|
-
anyParameters,
|
|
295
|
-
anyTimeout,
|
|
296
|
-
anyCancelToken,
|
|
297
|
-
anyRPSFactor
|
|
298
|
-
);
|
|
209
|
+
await retriever._performCallAttempt(anyParameters, anyTimeout, anyCancelToken, anyRPSFactor);
|
|
299
210
|
|
|
300
211
|
callStub.callCount.should.be.equal(3);
|
|
301
212
|
callStub.args[0][0].should.be.equal("get");
|
|
302
213
|
callStub.args[1][0].should.be.equal("get");
|
|
303
214
|
callStub.args[2][0].should.be.equal("get");
|
|
304
|
-
callStub.args[0][1].should.startWith(
|
|
305
|
-
|
|
306
|
-
);
|
|
307
|
-
callStub.args[1][1].should.startWith(
|
|
308
|
-
retriever.providers[1].endpoint
|
|
309
|
-
);
|
|
310
|
-
callStub.args[2][1].should.startWith(
|
|
311
|
-
retriever.providers[2].endpoint
|
|
312
|
-
);
|
|
215
|
+
callStub.args[0][1].should.startWith(retriever.providers[0].endpoint);
|
|
216
|
+
callStub.args[1][1].should.startWith(retriever.providers[1].endpoint);
|
|
217
|
+
callStub.args[2][1].should.startWith(retriever.providers[2].endpoint);
|
|
313
218
|
});
|
|
314
219
|
|
|
315
220
|
it("Should return null data if all providers returns null", async function () {
|
|
@@ -319,45 +224,23 @@ describe("RobustExternalAPICallerService", function () {
|
|
|
319
224
|
["get", "get", "get"],
|
|
320
225
|
[() => null, () => null, () => null]
|
|
321
226
|
);
|
|
322
|
-
const retriever = new RobustExternalAPICallerService(
|
|
323
|
-
"any",
|
|
324
|
-
providers
|
|
325
|
-
);
|
|
227
|
+
const retriever = new RobustExternalAPICallerService("any", providers);
|
|
326
228
|
|
|
327
|
-
const result = await retriever._performCallAttempt(
|
|
328
|
-
anyParameters,
|
|
329
|
-
anyTimeout,
|
|
330
|
-
anyCancelToken,
|
|
331
|
-
anyRPSFactor
|
|
332
|
-
);
|
|
229
|
+
const result = await retriever._performCallAttempt(anyParameters, anyTimeout, anyCancelToken, anyRPSFactor);
|
|
333
230
|
|
|
334
231
|
(result.data === null).should.be.true();
|
|
335
232
|
});
|
|
336
233
|
|
|
337
234
|
it("Should return shouldBeForceRetried=true if providers have RPS and all providers declined by RPS (isRPSExceeded returns true)", async function () {
|
|
338
|
-
const { providers, isRpsExceededStubs } = generateProviders(
|
|
339
|
-
|
|
340
|
-
["1", "2", "3"],
|
|
341
|
-
"any",
|
|
342
|
-
"any",
|
|
343
|
-
anyRPSes(3)
|
|
344
|
-
);
|
|
345
|
-
const retriever = new RobustExternalAPICallerService(
|
|
346
|
-
"any",
|
|
347
|
-
providers
|
|
348
|
-
);
|
|
235
|
+
const { providers, isRpsExceededStubs } = generateProviders(3, ["1", "2", "3"], "any", "any", anyRPSes(3));
|
|
236
|
+
const retriever = new RobustExternalAPICallerService("any", providers);
|
|
349
237
|
|
|
350
|
-
isRpsExceededStubs.forEach(
|
|
238
|
+
isRpsExceededStubs.forEach(stub => {
|
|
351
239
|
stub.resetBehavior();
|
|
352
240
|
stub.returns(true);
|
|
353
241
|
});
|
|
354
242
|
|
|
355
|
-
const result = await retriever._performCallAttempt(
|
|
356
|
-
anyParameters,
|
|
357
|
-
anyTimeout,
|
|
358
|
-
anyCancelToken,
|
|
359
|
-
anyRPSFactor
|
|
360
|
-
);
|
|
243
|
+
const result = await retriever._performCallAttempt(anyParameters, anyTimeout, anyCancelToken, anyRPSFactor);
|
|
361
244
|
|
|
362
245
|
result.shouldBeForceRetried.should.be.true();
|
|
363
246
|
});
|
|
@@ -370,10 +253,7 @@ describe("RobustExternalAPICallerService", function () {
|
|
|
370
253
|
[() => null, () => "any", () => null, () => "any", () => "any"],
|
|
371
254
|
anyRPSes(5)
|
|
372
255
|
);
|
|
373
|
-
const retriever = new RobustExternalAPICallerService(
|
|
374
|
-
"any",
|
|
375
|
-
providers
|
|
376
|
-
);
|
|
256
|
+
const retriever = new RobustExternalAPICallerService("any", providers);
|
|
377
257
|
|
|
378
258
|
isRpsExceededStubs.forEach((stub, index) => {
|
|
379
259
|
if (index === 1 || index === 3 || index === 4) {
|
|
@@ -382,46 +262,25 @@ describe("RobustExternalAPICallerService", function () {
|
|
|
382
262
|
}
|
|
383
263
|
});
|
|
384
264
|
|
|
385
|
-
const result = await retriever._performCallAttempt(
|
|
386
|
-
anyParameters,
|
|
387
|
-
anyTimeout,
|
|
388
|
-
anyCancelToken,
|
|
389
|
-
anyRPSFactor
|
|
390
|
-
);
|
|
265
|
+
const result = await retriever._performCallAttempt(anyParameters, anyTimeout, anyCancelToken, anyRPSFactor);
|
|
391
266
|
|
|
392
267
|
result.shouldBeForceRetried.should.be.true();
|
|
393
268
|
});
|
|
394
269
|
|
|
395
270
|
it("Should return rpsFactor multiplied by rpsMultiplier if providers have RPS and all providers declined by RPS (isRPSExceeded returns true)", async function () {
|
|
396
|
-
const { providers, isRpsExceededStubs } = generateProviders(
|
|
397
|
-
|
|
398
|
-
["1", "2", "3"],
|
|
399
|
-
"any",
|
|
400
|
-
"any",
|
|
401
|
-
anyRPSes(3)
|
|
402
|
-
);
|
|
403
|
-
const retriever = new RobustExternalAPICallerService(
|
|
404
|
-
"any",
|
|
405
|
-
providers
|
|
406
|
-
);
|
|
271
|
+
const { providers, isRpsExceededStubs } = generateProviders(3, ["1", "2", "3"], "any", "any", anyRPSes(3));
|
|
272
|
+
const retriever = new RobustExternalAPICallerService("any", providers);
|
|
407
273
|
|
|
408
|
-
isRpsExceededStubs.forEach(
|
|
274
|
+
isRpsExceededStubs.forEach(stub => {
|
|
409
275
|
stub.resetBehavior();
|
|
410
276
|
stub.returns(true);
|
|
411
277
|
});
|
|
412
278
|
|
|
413
279
|
const rpsFactor = 1;
|
|
414
280
|
|
|
415
|
-
const result = await retriever._performCallAttempt(
|
|
416
|
-
anyParameters,
|
|
417
|
-
anyTimeout,
|
|
418
|
-
anyCancelToken,
|
|
419
|
-
anyRPSFactor
|
|
420
|
-
);
|
|
281
|
+
const result = await retriever._performCallAttempt(anyParameters, anyTimeout, anyCancelToken, anyRPSFactor);
|
|
421
282
|
|
|
422
|
-
result.rpsFactor.should.be.equal(
|
|
423
|
-
rpsFactor * RobustExternalAPICallerService.rpsMultiplier
|
|
424
|
-
);
|
|
283
|
+
result.rpsFactor.should.be.equal(rpsFactor * RobustExternalAPICallerService.rpsMultiplier);
|
|
425
284
|
});
|
|
426
285
|
|
|
427
286
|
it("Should return rpsFactor multiplied by rpsMultiplier if some providers fail and the rest ones declined by RPS (isRPSExceeded returns true) and count of requests declined by RPS is more than ceil of half of providers count", async function () {
|
|
@@ -432,10 +291,7 @@ describe("RobustExternalAPICallerService", function () {
|
|
|
432
291
|
["any", () => null, "any", () => null, () => null],
|
|
433
292
|
anyRPSes(5)
|
|
434
293
|
);
|
|
435
|
-
const retriever = new RobustExternalAPICallerService(
|
|
436
|
-
"any",
|
|
437
|
-
providers
|
|
438
|
-
);
|
|
294
|
+
const retriever = new RobustExternalAPICallerService("any", providers);
|
|
439
295
|
|
|
440
296
|
isRpsExceededStubs.forEach((stub, index) => {
|
|
441
297
|
if (index === 1 || index === 3 || index === 4) {
|
|
@@ -446,16 +302,9 @@ describe("RobustExternalAPICallerService", function () {
|
|
|
446
302
|
|
|
447
303
|
const rpsFactor = 1;
|
|
448
304
|
|
|
449
|
-
const result = await retriever._performCallAttempt(
|
|
450
|
-
[],
|
|
451
|
-
anyTimeout,
|
|
452
|
-
null,
|
|
453
|
-
rpsFactor
|
|
454
|
-
);
|
|
305
|
+
const result = await retriever._performCallAttempt([], anyTimeout, null, rpsFactor);
|
|
455
306
|
|
|
456
|
-
result.rpsFactor.should.be.equal(
|
|
457
|
-
rpsFactor * RobustExternalAPICallerService.rpsMultiplier
|
|
458
|
-
);
|
|
307
|
+
result.rpsFactor.should.be.equal(rpsFactor * RobustExternalAPICallerService.rpsMultiplier);
|
|
459
308
|
});
|
|
460
309
|
|
|
461
310
|
it("Should return the errors list caught when calling the providers and one of them fails", async function () {
|
|
@@ -465,10 +314,7 @@ describe("RobustExternalAPICallerService", function () {
|
|
|
465
314
|
["get", "get", "get"],
|
|
466
315
|
[() => null, () => "any", () => "any"]
|
|
467
316
|
);
|
|
468
|
-
const retriever = new RobustExternalAPICallerService(
|
|
469
|
-
"any",
|
|
470
|
-
providers
|
|
471
|
-
);
|
|
317
|
+
const retriever = new RobustExternalAPICallerService("any", providers);
|
|
472
318
|
|
|
473
319
|
const someError = new Error("E1");
|
|
474
320
|
callStub.resetBehavior();
|
|
@@ -476,12 +322,7 @@ describe("RobustExternalAPICallerService", function () {
|
|
|
476
322
|
callStub.onCall(1).rejects(someError);
|
|
477
323
|
callStub.onCall(2).resolves("any");
|
|
478
324
|
|
|
479
|
-
const result = await retriever._performCallAttempt(
|
|
480
|
-
anyParameters,
|
|
481
|
-
anyTimeout,
|
|
482
|
-
anyCancelToken,
|
|
483
|
-
anyRPSFactor
|
|
484
|
-
);
|
|
325
|
+
const result = await retriever._performCallAttempt(anyParameters, anyTimeout, anyCancelToken, anyRPSFactor);
|
|
485
326
|
|
|
486
327
|
result.errors.should.be.deepEqual([someError]);
|
|
487
328
|
});
|
|
@@ -493,10 +334,7 @@ describe("RobustExternalAPICallerService", function () {
|
|
|
493
334
|
["get", "get", "get"],
|
|
494
335
|
[() => null, () => null, () => null]
|
|
495
336
|
);
|
|
496
|
-
const retriever = new RobustExternalAPICallerService(
|
|
497
|
-
"any",
|
|
498
|
-
providers
|
|
499
|
-
);
|
|
337
|
+
const retriever = new RobustExternalAPICallerService("any", providers);
|
|
500
338
|
|
|
501
339
|
const someError1 = new Error("E1");
|
|
502
340
|
const someError2 = new Error("E2");
|
|
@@ -506,18 +344,9 @@ describe("RobustExternalAPICallerService", function () {
|
|
|
506
344
|
callStub.onCall(1).rejects(someError2);
|
|
507
345
|
callStub.onCall(2).rejects(someError3);
|
|
508
346
|
|
|
509
|
-
const result = await retriever._performCallAttempt(
|
|
510
|
-
anyParameters,
|
|
511
|
-
anyTimeout,
|
|
512
|
-
anyCancelToken,
|
|
513
|
-
anyRPSFactor
|
|
514
|
-
);
|
|
347
|
+
const result = await retriever._performCallAttempt(anyParameters, anyTimeout, anyCancelToken, anyRPSFactor);
|
|
515
348
|
|
|
516
|
-
result.errors.should.be.deepEqual([
|
|
517
|
-
someError1,
|
|
518
|
-
someError2,
|
|
519
|
-
someError3,
|
|
520
|
-
]);
|
|
349
|
+
result.errors.should.be.deepEqual([someError1, someError2, someError3]);
|
|
521
350
|
});
|
|
522
351
|
|
|
523
352
|
it("Should return null data when all the providers fail", async function () {
|
|
@@ -527,21 +356,13 @@ describe("RobustExternalAPICallerService", function () {
|
|
|
527
356
|
["get", "get", "get"],
|
|
528
357
|
[() => "any", () => "any", () => "any"]
|
|
529
358
|
);
|
|
530
|
-
const retriever = new RobustExternalAPICallerService(
|
|
531
|
-
"any",
|
|
532
|
-
providers
|
|
533
|
-
);
|
|
359
|
+
const retriever = new RobustExternalAPICallerService("any", providers);
|
|
534
360
|
|
|
535
361
|
const someError = new Error("E1");
|
|
536
362
|
callStub.resetBehavior();
|
|
537
363
|
callStub.rejects(someError);
|
|
538
364
|
|
|
539
|
-
const result = await retriever._performCallAttempt(
|
|
540
|
-
anyParameters,
|
|
541
|
-
anyTimeout,
|
|
542
|
-
anyCancelToken,
|
|
543
|
-
anyRPSFactor
|
|
544
|
-
);
|
|
365
|
+
const result = await retriever._performCallAttempt(anyParameters, anyTimeout, anyCancelToken, anyRPSFactor);
|
|
545
366
|
|
|
546
367
|
(result.data === null).should.be.true();
|
|
547
368
|
});
|
|
@@ -554,10 +375,7 @@ describe("RobustExternalAPICallerService", function () {
|
|
|
554
375
|
[() => null, () => null, () => null],
|
|
555
376
|
anyRPSes(3)
|
|
556
377
|
);
|
|
557
|
-
const retriever = new RobustExternalAPICallerService(
|
|
558
|
-
"any",
|
|
559
|
-
providers
|
|
560
|
-
);
|
|
378
|
+
const retriever = new RobustExternalAPICallerService("any", providers);
|
|
561
379
|
|
|
562
380
|
isRpsExceededStubs.forEach((stub, index) => {
|
|
563
381
|
if (index === 0 || index === 2) {
|
|
@@ -569,18 +387,9 @@ describe("RobustExternalAPICallerService", function () {
|
|
|
569
387
|
}
|
|
570
388
|
});
|
|
571
389
|
|
|
572
|
-
await retriever._performCallAttempt(
|
|
573
|
-
anyParameters,
|
|
574
|
-
anyTimeout,
|
|
575
|
-
anyCancelToken,
|
|
576
|
-
anyRPSFactor
|
|
577
|
-
);
|
|
390
|
+
await retriever._performCallAttempt(anyParameters, anyTimeout, anyCancelToken, anyRPSFactor);
|
|
578
391
|
|
|
579
|
-
(
|
|
580
|
-
callStub.args.find((params) =>
|
|
581
|
-
params[1].startsWith(providers[1].endpoint)
|
|
582
|
-
) == null
|
|
583
|
-
).should.be.true();
|
|
392
|
+
(callStub.args.find(params => params[1].startsWith(providers[1].endpoint)) == null).should.be.true();
|
|
584
393
|
});
|
|
585
394
|
|
|
586
395
|
it("Should correctly count the number of requests declined by RPS exceeding", async function () {
|
|
@@ -591,10 +400,7 @@ describe("RobustExternalAPICallerService", function () {
|
|
|
591
400
|
[() => null, () => "any", () => "any", () => null, () => null],
|
|
592
401
|
anyRPSes(5)
|
|
593
402
|
);
|
|
594
|
-
const retriever = new RobustExternalAPICallerService(
|
|
595
|
-
"any",
|
|
596
|
-
providers
|
|
597
|
-
);
|
|
403
|
+
const retriever = new RobustExternalAPICallerService("any", providers);
|
|
598
404
|
|
|
599
405
|
isRpsExceededStubs.forEach((stub, index) => {
|
|
600
406
|
if (index === 0 || index === 3 || index === 4) {
|
|
@@ -606,40 +412,20 @@ describe("RobustExternalAPICallerService", function () {
|
|
|
606
412
|
}
|
|
607
413
|
});
|
|
608
414
|
|
|
609
|
-
const result = await retriever._performCallAttempt(
|
|
610
|
-
anyParameters,
|
|
611
|
-
anyTimeout,
|
|
612
|
-
anyCancelToken,
|
|
613
|
-
anyRPSFactor
|
|
614
|
-
);
|
|
415
|
+
const result = await retriever._performCallAttempt(anyParameters, anyTimeout, anyCancelToken, anyRPSFactor);
|
|
615
416
|
|
|
616
417
|
result.shouldBeForceRetried.should.be.false();
|
|
617
418
|
});
|
|
618
419
|
|
|
619
420
|
it("Should add cancelToken to axios params if it is not null", async function () {
|
|
620
|
-
const { providers } = generateProviders(
|
|
621
|
-
|
|
622
|
-
["1", "2"],
|
|
623
|
-
["get", "get"],
|
|
624
|
-
[() => null, () => "any"]
|
|
625
|
-
);
|
|
626
|
-
const retriever = new RobustExternalAPICallerService(
|
|
627
|
-
"any",
|
|
628
|
-
providers
|
|
629
|
-
);
|
|
421
|
+
const { providers } = generateProviders(2, ["1", "2"], ["get", "get"], [() => null, () => "any"]);
|
|
422
|
+
const retriever = new RobustExternalAPICallerService("any", providers);
|
|
630
423
|
|
|
631
424
|
const someCancelToken = "someCC";
|
|
632
|
-
await retriever._performCallAttempt(
|
|
633
|
-
anyParameters,
|
|
634
|
-
anyTimeout,
|
|
635
|
-
someCancelToken,
|
|
636
|
-
anyRPSFactor
|
|
637
|
-
);
|
|
425
|
+
await retriever._performCallAttempt(anyParameters, anyTimeout, someCancelToken, anyRPSFactor);
|
|
638
426
|
|
|
639
427
|
for (let i = 0; i < callStub.args.length; ++i) {
|
|
640
|
-
callStub.args[i][2]?.cancelToken.should.be.equal(
|
|
641
|
-
someCancelToken
|
|
642
|
-
);
|
|
428
|
+
callStub.args[i][2]?.cancelToken.should.be.equal(someCancelToken);
|
|
643
429
|
}
|
|
644
430
|
});
|
|
645
431
|
|
|
@@ -653,22 +439,12 @@ describe("RobustExternalAPICallerService", function () {
|
|
|
653
439
|
[1001, 1002]
|
|
654
440
|
);
|
|
655
441
|
|
|
656
|
-
const retriever = new RobustExternalAPICallerService(
|
|
657
|
-
"any",
|
|
658
|
-
providers
|
|
659
|
-
);
|
|
442
|
+
const retriever = new RobustExternalAPICallerService("any", providers);
|
|
660
443
|
|
|
661
|
-
await retriever._performCallAttempt(
|
|
662
|
-
anyParameters,
|
|
663
|
-
anyTimeout,
|
|
664
|
-
anyCancelToken,
|
|
665
|
-
anyRPSFactor
|
|
666
|
-
);
|
|
444
|
+
await retriever._performCallAttempt(anyParameters, anyTimeout, anyCancelToken, anyRPSFactor);
|
|
667
445
|
|
|
668
446
|
for (let i = 0; i < callStub.args.length; ++i) {
|
|
669
|
-
callStub.args[i][2]?.timeout.should.be.equal(
|
|
670
|
-
providers[i].timeout
|
|
671
|
-
);
|
|
447
|
+
callStub.args[i][2]?.timeout.should.be.equal(providers[i].timeout);
|
|
672
448
|
}
|
|
673
449
|
});
|
|
674
450
|
|
|
@@ -680,10 +456,7 @@ describe("RobustExternalAPICallerService", function () {
|
|
|
680
456
|
[() => "any", () => "any"]
|
|
681
457
|
);
|
|
682
458
|
|
|
683
|
-
const retriever = new RobustExternalAPICallerService(
|
|
684
|
-
"any",
|
|
685
|
-
providers
|
|
686
|
-
);
|
|
459
|
+
const retriever = new RobustExternalAPICallerService("any", providers);
|
|
687
460
|
|
|
688
461
|
const someError = new Error("E1");
|
|
689
462
|
callStub.resetBehavior();
|
|
@@ -691,12 +464,7 @@ describe("RobustExternalAPICallerService", function () {
|
|
|
691
464
|
callStub.onSecondCall().resolves("any");
|
|
692
465
|
callStub.onThirdCall().rejects(someError);
|
|
693
466
|
|
|
694
|
-
await retriever._performCallAttempt(
|
|
695
|
-
anyParameters,
|
|
696
|
-
anyTimeout,
|
|
697
|
-
anyCancelToken,
|
|
698
|
-
anyRPSFactor
|
|
699
|
-
);
|
|
467
|
+
await retriever._performCallAttempt(anyParameters, anyTimeout, anyCancelToken, anyRPSFactor);
|
|
700
468
|
|
|
701
469
|
for (let i = 0; i < 3; ++i) {
|
|
702
470
|
callStub.args[i][1].should.startWith(providers[0].endpoint);
|
|
@@ -720,17 +488,9 @@ describe("RobustExternalAPICallerService", function () {
|
|
|
720
488
|
]
|
|
721
489
|
);
|
|
722
490
|
|
|
723
|
-
const retriever = new RobustExternalAPICallerService(
|
|
724
|
-
"any",
|
|
725
|
-
providers
|
|
726
|
-
);
|
|
491
|
+
const retriever = new RobustExternalAPICallerService("any", providers);
|
|
727
492
|
|
|
728
|
-
await retriever._performCallAttempt(
|
|
729
|
-
anyParameters,
|
|
730
|
-
anyTimeout,
|
|
731
|
-
anyCancelToken,
|
|
732
|
-
anyRPSFactor
|
|
733
|
-
);
|
|
493
|
+
await retriever._performCallAttempt(anyParameters, anyTimeout, anyCancelToken, anyRPSFactor);
|
|
734
494
|
|
|
735
495
|
composeQueryStringStubs[0].callCount.should.be.equal(2);
|
|
736
496
|
composeQueryStringStubs[1].callCount.should.be.equal(1);
|
|
@@ -756,28 +516,14 @@ describe("RobustExternalAPICallerService", function () {
|
|
|
756
516
|
const query2 = "a/s?j3jk=lkk0-3&h=oool230";
|
|
757
517
|
const query3 = "?jijiji2332=09o3i4r3&p1=-121120&hfwowfif=wqoi23";
|
|
758
518
|
composeQueryStringStubs[0].resetBehavior();
|
|
759
|
-
composeQueryStringStubs[0]
|
|
760
|
-
|
|
761
|
-
.returns(query1);
|
|
762
|
-
composeQueryStringStubs[0]
|
|
763
|
-
.withArgs(anyParameters, 1)
|
|
764
|
-
.returns(query2);
|
|
519
|
+
composeQueryStringStubs[0].withArgs(anyParameters, 0).returns(query1);
|
|
520
|
+
composeQueryStringStubs[0].withArgs(anyParameters, 1).returns(query2);
|
|
765
521
|
composeQueryStringStubs[1].resetBehavior();
|
|
766
|
-
composeQueryStringStubs[1]
|
|
767
|
-
.withArgs(anyParameters, 0)
|
|
768
|
-
.returns(query3);
|
|
522
|
+
composeQueryStringStubs[1].withArgs(anyParameters, 0).returns(query3);
|
|
769
523
|
|
|
770
|
-
const retriever = new RobustExternalAPICallerService(
|
|
771
|
-
"any",
|
|
772
|
-
providers
|
|
773
|
-
);
|
|
524
|
+
const retriever = new RobustExternalAPICallerService("any", providers);
|
|
774
525
|
|
|
775
|
-
await retriever._performCallAttempt(
|
|
776
|
-
anyParameters,
|
|
777
|
-
anyTimeout,
|
|
778
|
-
anyCancelToken,
|
|
779
|
-
anyRPSFactor
|
|
780
|
-
);
|
|
526
|
+
await retriever._performCallAttempt(anyParameters, anyTimeout, anyCancelToken, anyRPSFactor);
|
|
781
527
|
|
|
782
528
|
callStub.args[0][1].should.be.equal(providers[0].endpoint + query1);
|
|
783
529
|
callStub.args[1][1].should.be.equal(providers[0].endpoint + query2);
|