@elliemae/pui-app-sdk 2.17.2 → 3.0.0-beta.4
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/dist/cjs/analytics/appdynamics.js +34 -30
- package/dist/cjs/analytics/index.js +32 -26
- package/dist/cjs/analytics/page-view-event.js +34 -34
- package/dist/cjs/analytics/user-session-event.js +34 -27
- package/dist/cjs/analytics/user-wait-event.js +31 -17
- package/dist/cjs/analytics/web-analytics.js +16 -19
- package/dist/cjs/api/auth/index.js +41 -39
- package/dist/cjs/api/helpers.js +33 -99
- package/dist/cjs/api/users/index.js +28 -16
- package/dist/cjs/communication/http-client/index.js +44 -48
- package/dist/cjs/communication/http-client/request-interceptor.js +28 -12
- package/dist/cjs/communication/http-client/response-interceptor.js +41 -38
- package/dist/cjs/communication/http-client/retry-axios.js +68 -122
- package/dist/cjs/communication/http-client/retry.js +42 -36
- package/dist/cjs/communication/http-client/tests/index.test-disable.js +48 -56
- package/dist/cjs/data/auth/actions.js +17 -26
- package/dist/cjs/data/auth/reducer.js +30 -18
- package/dist/cjs/data/breakpoint/index.js +38 -32
- package/dist/cjs/data/error/index.js +33 -18
- package/dist/cjs/data/live-message/index.js +34 -25
- package/dist/cjs/data/logout/actions.js +12 -9
- package/dist/cjs/data/navigation-prompt/actions.js +12 -9
- package/dist/cjs/data/react-redux.js +29 -13
- package/dist/cjs/data/reducers.js +35 -23
- package/dist/cjs/data/saga.js +12 -9
- package/dist/cjs/data/store.js +52 -60
- package/dist/cjs/data/wait-message/actions.js +14 -13
- package/dist/cjs/data/wait-message/reducer.js +32 -24
- package/dist/cjs/index.js +189 -809
- package/dist/cjs/route/index.js +37 -32
- package/dist/cjs/route/page-view.js +30 -22
- package/dist/cjs/route/private-route/index.js +52 -60
- package/dist/cjs/sideeffect/auth/index.js +42 -30
- package/dist/cjs/sideeffect/error-toast/index.js +39 -26
- package/dist/cjs/sideeffect/wait-message/index.js +45 -29
- package/dist/cjs/typings/custom.d.js +0 -1
- package/dist/cjs/typings/elliemae.d.js +0 -1
- package/dist/cjs/typings/styled.d.js +19 -3
- package/dist/cjs/utils/app-config/config.js +33 -33
- package/dist/cjs/utils/app-config/index.js +42 -44
- package/dist/cjs/utils/app-host-integration/react.js +27 -14
- package/dist/cjs/utils/auth/helper.js +30 -18
- package/dist/cjs/utils/auth/index.js +76 -116
- package/dist/cjs/utils/await.js +3 -0
- package/dist/cjs/utils/constants.js +22 -21
- package/dist/cjs/utils/font-size.js +13 -14
- package/dist/cjs/utils/guest-with-service.js +11 -12
- package/dist/cjs/utils/helpers.js +15 -19
- package/dist/cjs/utils/history.js +29 -12
- package/dist/cjs/utils/log-records.js +38 -35
- package/dist/cjs/utils/micro-frontend/console-logger.js +39 -23
- package/dist/cjs/utils/micro-frontend/guest.js +80 -128
- package/dist/cjs/utils/micro-frontend/host.js +84 -124
- package/dist/cjs/utils/micro-frontend/index.js +60 -61
- package/dist/cjs/utils/micro-frontend/types.js +3 -5
- package/dist/cjs/utils/redact-pii.js +15 -17
- package/dist/cjs/utils/service-worker.js +36 -21
- package/dist/cjs/utils/session.js +64 -70
- package/dist/cjs/utils/storybook/main.js +32 -25
- package/dist/cjs/utils/storybook/manager.js +31 -16
- package/dist/cjs/utils/storybook/middleware.js +3 -7
- package/dist/cjs/utils/storybook/preview.js +57 -48
- package/dist/cjs/utils/storybook/theme.js +30 -14
- package/dist/cjs/utils/storybook/vite.js +6 -0
- package/dist/cjs/utils/storybook/webpack.js +21 -0
- package/dist/cjs/utils/testing/index.js +38 -50
- package/dist/cjs/utils/testing/render-with-redux.js +34 -27
- package/dist/cjs/utils/testing/render-with-router-redux.js +40 -37
- package/dist/cjs/utils/testing/render-with-router.js +34 -28
- package/dist/cjs/utils/testing/render-with-state-addons.js +40 -36
- package/dist/cjs/utils/types.js +3 -0
- package/dist/cjs/utils/url.js +12 -13
- package/dist/cjs/utils/web-storage.js +40 -30
- package/dist/cjs/utils/window.js +36 -28
- package/dist/cjs/view/app-root/hosted-app.js +35 -32
- package/dist/cjs/view/app-root/index.js +57 -62
- package/dist/cjs/view/app-root/stand-alone-app.js +38 -37
- package/dist/cjs/view/app-root/style.js +50 -12
- package/dist/cjs/view/error-boundary/default-error-template.js +10 -15
- package/dist/cjs/view/error-boundary/index.js +41 -43
- package/dist/cjs/view/error-toast/index.js +42 -32
- package/dist/cjs/view/fetch-host-app-data/index.js +34 -26
- package/dist/cjs/view/fetch-host-app-data/store.js +31 -24
- package/dist/cjs/view/fields/check-box/index.js +34 -39
- package/dist/cjs/view/fields/combo-box/index.js +37 -31
- package/dist/cjs/view/fields/connect-form.js +30 -15
- package/dist/cjs/view/fields/date-input/index.js +34 -26
- package/dist/cjs/view/fields/date-picker/index.js +34 -26
- package/dist/cjs/view/fields/form-item-layout/index.js +36 -30
- package/dist/cjs/view/fields/input-mask/index.js +35 -41
- package/dist/cjs/view/fields/large-text-box/index.js +34 -26
- package/dist/cjs/view/fields/radio/index.js +34 -30
- package/dist/cjs/view/fields/radio-group/index.js +32 -27
- package/dist/cjs/view/fields/text-box/index.js +34 -26
- package/dist/cjs/view/fields/watch-value.js +41 -35
- package/dist/cjs/view/form/index.js +41 -34
- package/dist/cjs/view/form/personal-info-section.js +56 -80
- package/dist/cjs/view/form/submit-button/index.js +34 -23
- package/dist/cjs/view/guest-unload-handlers/index.js +33 -22
- package/dist/cjs/view/header/center-region/index.js +61 -38
- package/dist/cjs/view/header/index.js +41 -35
- package/dist/cjs/view/header/logo-region/index.js +31 -23
- package/dist/cjs/view/header/nav-region/index.js +44 -30
- package/dist/cjs/view/header/nav-region/notification/index.js +28 -18
- package/dist/cjs/view/header/nav-region/user/index.js +28 -18
- package/dist/cjs/view/host-binding-events/index.js +10 -11
- package/dist/cjs/view/intro.stories.mdx +1 -1
- package/dist/cjs/view/live-message/index.js +33 -34
- package/dist/cjs/view/loadable/index.js +33 -27
- package/dist/cjs/view/login/index.js +36 -30
- package/dist/cjs/view/media-breakpoint/index.js +43 -34
- package/dist/cjs/view/message-to-host-app/index.js +31 -20
- package/dist/cjs/view/micro-app/app-factory/index.js +98 -134
- package/dist/cjs/view/micro-app/const.js +10 -7
- package/dist/cjs/view/micro-app/index.js +37 -27
- package/dist/cjs/view/micro-app/resources/manifest.js +41 -34
- package/dist/cjs/view/micro-app/resources/script.js +56 -53
- package/dist/cjs/view/micro-app/resources/style.js +44 -38
- package/dist/cjs/view/micro-app/types.js +3 -5
- package/dist/cjs/view/micro-app/use-app-will-render.js +58 -50
- package/dist/cjs/view/micro-app/utils.js +32 -21
- package/dist/cjs/view/micro-iframe-app/app.js +37 -39
- package/dist/cjs/view/micro-iframe-app/iframe/const.js +10 -7
- package/dist/cjs/view/micro-iframe-app/iframe/index.js +51 -47
- package/dist/cjs/view/micro-iframe-app/index.js +36 -24
- package/dist/cjs/view/micro-iframe-app/types.js +3 -5
- package/dist/cjs/view/micro-iframe-app/use-frame-loaded.js +40 -36
- package/dist/cjs/view/modals/error/index.js +35 -28
- package/dist/cjs/view/modals/navigation-prompt/index.js +38 -37
- package/dist/cjs/view/modals/session-expiry/customHooks.js +40 -35
- package/dist/cjs/view/modals/session-expiry/index.js +45 -50
- package/dist/cjs/view/modals/wait-message/html-wait-message.js +32 -18
- package/dist/cjs/view/modals/wait-message/index.js +50 -53
- package/dist/cjs/view/modals/wait-message/wait-message-launcher.js +33 -21
- package/dist/cjs/view/render-with-delay/index.js +30 -19
- package/dist/cjs/view/render-with-host-data/index.js +35 -30
- package/dist/cjs/view/session-timeout/index.js +44 -35
- package/dist/cjs/view/storybook/decorator.js +32 -21
- package/dist/cjs/view/use-previous.js +29 -13
- package/dist/cjs/view/useMediaBreakpoints/index.js +34 -19
- package/dist/cjs/view/visually-hidden/index.js +41 -21
- package/dist/cjs/view/window-size/index.js +34 -22
- package/dist/es/analytics/appdynamics.js +14 -15
- package/dist/es/analytics/index.js +11 -17
- package/dist/es/analytics/page-view-event.js +12 -26
- package/dist/es/analytics/user-session-event.js +13 -15
- package/dist/es/analytics/user-wait-event.js +10 -6
- package/dist/es/analytics/web-analytics.js +12 -10
- package/dist/es/api/auth/index.js +22 -27
- package/dist/es/api/helpers.js +8 -81
- package/dist/es/api/users/index.js +7 -8
- package/dist/es/communication/http-client/index.js +24 -30
- package/dist/es/communication/http-client/request-interceptor.js +6 -3
- package/dist/es/communication/http-client/response-interceptor.js +20 -21
- package/dist/es/communication/http-client/retry-axios.js +45 -105
- package/dist/es/communication/http-client/retry.js +22 -25
- package/dist/es/communication/http-client/tests/index.test-disable.js +28 -47
- package/dist/es/data/auth/actions.js +13 -19
- package/dist/es/data/auth/reducer.js +9 -7
- package/dist/es/data/breakpoint/index.js +19 -21
- package/dist/es/data/error/index.js +11 -9
- package/dist/es/data/live-message/index.js +12 -16
- package/dist/es/data/logout/actions.js +9 -5
- package/dist/es/data/navigation-prompt/actions.js +9 -5
- package/dist/es/data/react-redux.js +7 -3
- package/dist/es/data/reducers.js +10 -7
- package/dist/es/data/saga.js +8 -5
- package/dist/es/data/store.js +26 -44
- package/dist/es/data/wait-message/actions.js +11 -9
- package/dist/es/data/wait-message/reducer.js +10 -10
- package/dist/es/index.js +183 -84
- package/dist/es/route/index.js +16 -19
- package/dist/es/route/page-view.js +9 -9
- package/dist/es/route/private-route/index.js +30 -38
- package/dist/es/sideeffect/auth/index.js +27 -14
- package/dist/es/sideeffect/error-toast/index.js +15 -14
- package/dist/es/sideeffect/wait-message/index.js +18 -14
- package/dist/es/typings/styled.d.js +1 -1
- package/dist/es/utils/app-config/config.js +11 -9
- package/dist/es/utils/app-config/index.js +21 -31
- package/dist/es/utils/app-host-integration/react.js +8 -6
- package/dist/es/utils/auth/helper.js +8 -4
- package/dist/es/utils/auth/index.js +59 -83
- package/dist/es/utils/constants.js +18 -13
- package/dist/es/utils/font-size.js +7 -3
- package/dist/es/utils/guest-with-service.js +6 -7
- package/dist/es/utils/helpers.js +10 -6
- package/dist/es/utils/history.js +7 -3
- package/dist/es/utils/log-records.js +34 -31
- package/dist/es/utils/micro-frontend/console-logger.js +17 -13
- package/dist/es/utils/micro-frontend/guest.js +52 -108
- package/dist/es/utils/micro-frontend/host.js +53 -89
- package/dist/es/utils/micro-frontend/index.js +39 -37
- package/dist/es/utils/micro-frontend/types.js +0 -1
- package/dist/es/utils/redact-pii.js +10 -11
- package/dist/es/utils/service-worker.js +14 -11
- package/dist/es/utils/session.js +47 -48
- package/dist/es/utils/storybook/manager.js +8 -5
- package/dist/es/utils/storybook/preview.js +30 -26
- package/dist/es/utils/storybook/theme.js +9 -6
- package/dist/es/utils/testing/index.js +14 -21
- package/dist/es/utils/testing/render-with-redux.js +13 -13
- package/dist/es/utils/testing/render-with-router-redux.js +19 -21
- package/dist/es/utils/testing/render-with-router.js +14 -16
- package/dist/es/utils/testing/render-with-state-addons.js +18 -18
- package/dist/es/utils/url.js +7 -3
- package/dist/es/utils/web-storage.js +21 -17
- package/dist/es/utils/window.js +18 -18
- package/dist/es/view/app-root/hosted-app.js +13 -17
- package/dist/es/view/app-root/index.js +34 -39
- package/dist/es/view/app-root/stand-alone-app.js +17 -19
- package/dist/es/view/app-root/style.js +30 -5
- package/dist/es/view/error-boundary/default-error-template.js +4 -5
- package/dist/es/view/error-boundary/index.js +20 -27
- package/dist/es/view/error-toast/index.js +21 -16
- package/dist/es/view/fetch-host-app-data/index.js +13 -13
- package/dist/es/view/fetch-host-app-data/store.js +10 -7
- package/dist/es/view/fields/check-box/index.js +16 -18
- package/dist/es/view/fields/combo-box/index.js +19 -19
- package/dist/es/view/fields/connect-form.js +8 -6
- package/dist/es/view/fields/date-input/index.js +16 -14
- package/dist/es/view/fields/date-picker/index.js +16 -14
- package/dist/es/view/fields/form-item-layout/index.js +15 -16
- package/dist/es/view/fields/input-mask/index.js +20 -14
- package/dist/es/view/fields/large-text-box/index.js +16 -14
- package/dist/es/view/fields/radio/index.js +16 -18
- package/dist/es/view/fields/radio-group/index.js +14 -15
- package/dist/es/view/fields/text-box/index.js +16 -14
- package/dist/es/view/fields/watch-value.js +19 -24
- package/dist/es/view/form/index.js +22 -22
- package/dist/es/view/form/personal-info-section.js +31 -52
- package/dist/es/view/form/submit-button/index.js +12 -10
- package/dist/es/view/guest-unload-handlers/index.js +11 -10
- package/dist/es/view/header/center-region/index.js +40 -23
- package/dist/es/view/header/index.js +19 -19
- package/dist/es/view/header/logo-region/index.js +9 -10
- package/dist/es/view/header/nav-region/index.js +22 -15
- package/dist/es/view/header/nav-region/notification/index.js +6 -7
- package/dist/es/view/header/nav-region/user/index.js +6 -7
- package/dist/es/view/host-binding-events/index.js +7 -3
- package/dist/es/view/intro.stories.mdx +1 -1
- package/dist/es/view/live-message/index.js +13 -23
- package/dist/es/view/loadable/index.js +12 -15
- package/dist/es/view/login/index.js +14 -18
- package/dist/es/view/media-breakpoint/index.js +19 -17
- package/dist/es/view/message-to-host-app/index.js +11 -10
- package/dist/es/view/micro-app/app-factory/index.js +67 -86
- package/dist/es/view/micro-app/const.js +4 -1
- package/dist/es/view/micro-app/index.js +13 -11
- package/dist/es/view/micro-app/resources/manifest.js +19 -19
- package/dist/es/view/micro-app/resources/script.js +36 -36
- package/dist/es/view/micro-app/resources/style.js +23 -22
- package/dist/es/view/micro-app/types.js +0 -1
- package/dist/es/view/micro-app/use-app-will-render.js +32 -28
- package/dist/es/view/micro-app/utils.js +12 -14
- package/dist/es/view/micro-iframe-app/app.js +15 -22
- package/dist/es/view/micro-iframe-app/iframe/const.js +4 -1
- package/dist/es/view/micro-iframe-app/iframe/index.js +27 -32
- package/dist/es/view/micro-iframe-app/index.js +11 -12
- package/dist/es/view/micro-iframe-app/types.js +0 -1
- package/dist/es/view/micro-iframe-app/use-frame-loaded.js +16 -21
- package/dist/es/view/modals/error/index.js +12 -10
- package/dist/es/view/modals/navigation-prompt/index.js +12 -16
- package/dist/es/view/modals/session-expiry/customHooks.js +13 -15
- package/dist/es/view/modals/session-expiry/index.js +16 -24
- package/dist/es/view/modals/wait-message/html-wait-message.js +10 -10
- package/dist/es/view/modals/wait-message/index.js +31 -39
- package/dist/es/view/modals/wait-message/wait-message-launcher.js +9 -8
- package/dist/es/view/render-with-delay/index.js +7 -10
- package/dist/es/view/render-with-host-data/index.js +11 -15
- package/dist/es/view/session-timeout/index.js +21 -12
- package/dist/es/view/storybook/decorator.js +9 -7
- package/dist/es/view/use-previous.js +6 -3
- package/dist/es/view/useMediaBreakpoints/index.js +11 -9
- package/dist/es/view/visually-hidden/index.js +19 -10
- package/dist/es/view/window-size/index.js +12 -11
- package/dist/types/data/store.d.ts +1 -1
- package/dist/types/utils/storybook/main.d.cts +49 -0
- package/dist/types/utils/storybook/{middleware.d.ts → middleware.d.cts} +0 -0
- package/dist/types/utils/storybook/preview.d.ts +2 -2
- package/dist/types/utils/storybook/vite.d.cts +4 -0
- package/dist/types/utils/storybook/webpack.d.cts +16 -0
- package/dist/types/utils/testing/render-with-redux.d.ts +1 -1
- package/dist/types/utils/testing/render-with-router-redux.d.ts +1 -1
- package/dist/types/utils/window.d.ts +1 -1
- package/dist/types/view/visually-hidden/index.d.ts +1 -3
- package/package.json +8 -6
- package/dist/cjs/api/users/index.endpoint.js +0 -14
- package/dist/cjs/communication/http-client/tests/hello.endpoint.js +0 -14
- package/dist/cjs/communication/http-client/tests/private.endpoint.js +0 -14
- package/dist/cjs/view/error-toast/index.stories.js +0 -128
- package/dist/cjs/view/fields/check-box/index.stories.js +0 -64
- package/dist/cjs/view/fields/check-box/set-value.stories.js +0 -83
- package/dist/cjs/view/fields/combo-box/index.stories.js +0 -65
- package/dist/cjs/view/fields/date-input/index.stories.js +0 -53
- package/dist/cjs/view/fields/date-input/index1.stories.js +0 -53
- package/dist/cjs/view/fields/date-picker/index.stories.js +0 -53
- package/dist/cjs/view/fields/form-item-layout/index.stories.js +0 -43
- package/dist/cjs/view/fields/input-mask/index.stories.js +0 -52
- package/dist/cjs/view/fields/large-text-box/index.stories.js +0 -47
- package/dist/cjs/view/fields/radio/index.stories.js +0 -60
- package/dist/cjs/view/fields/radio/set-value.stories.js +0 -81
- package/dist/cjs/view/fields/radio-group/index.stories.js +0 -85
- package/dist/cjs/view/fields/text-box/index.stories.js +0 -48
- package/dist/cjs/view/form/index.stories.js +0 -71
- package/dist/cjs/view/form/usecases.stories.js +0 -59
- package/dist/cjs/view/header/index.stories.js +0 -24
- package/dist/cjs/view/live-message/index.stories.js +0 -53
- package/dist/cjs/view/media-breakpoint/index.stories.js +0 -24
- package/dist/cjs/view/modals/error/index.stories.js +0 -36
- package/dist/cjs/view/modals/navigation-prompt/index.stories.js +0 -32
- package/dist/cjs/view/modals/session-expiry/index.stories.js +0 -30
- package/dist/cjs/view/modals/wait-message/index.stories.js +0 -47
- package/dist/cjs/view/session-timeout/index.stories.js +0 -28
- package/dist/es/api/users/index.endpoint.js +0 -14
- package/dist/es/communication/http-client/tests/hello.endpoint.js +0 -14
- package/dist/es/communication/http-client/tests/private.endpoint.js +0 -14
- package/dist/es/utils/storybook/main.js +0 -38
- package/dist/es/utils/storybook/middleware.js +0 -9
- package/dist/es/view/error-toast/index.stories.js +0 -108
- package/dist/es/view/fields/check-box/index.stories.js +0 -47
- package/dist/es/view/fields/check-box/set-value.stories.js +0 -65
- package/dist/es/view/fields/combo-box/index.stories.js +0 -48
- package/dist/es/view/fields/date-input/index.stories.js +0 -35
- package/dist/es/view/fields/date-input/index1.stories.js +0 -35
- package/dist/es/view/fields/date-picker/index.stories.js +0 -35
- package/dist/es/view/fields/form-item-layout/index.stories.js +0 -27
- package/dist/es/view/fields/input-mask/index.stories.js +0 -35
- package/dist/es/view/fields/large-text-box/index.stories.js +0 -30
- package/dist/es/view/fields/radio/index.stories.js +0 -43
- package/dist/es/view/fields/radio/set-value.stories.js +0 -63
- package/dist/es/view/fields/radio-group/index.stories.js +0 -68
- package/dist/es/view/fields/text-box/index.stories.js +0 -31
- package/dist/es/view/form/index.stories.js +0 -56
- package/dist/es/view/form/usecases.stories.js +0 -43
- package/dist/es/view/header/index.stories.js +0 -14
- package/dist/es/view/live-message/index.stories.js +0 -32
- package/dist/es/view/media-breakpoint/index.stories.js +0 -10
- package/dist/es/view/modals/error/index.stories.js +0 -21
- package/dist/es/view/modals/navigation-prompt/index.stories.js +0 -18
- package/dist/es/view/modals/session-expiry/index.stories.js +0 -18
- package/dist/es/view/modals/wait-message/index.stories.js +0 -33
- package/dist/es/view/session-timeout/index.stories.js +0 -13
- package/dist/types/utils/storybook/main.d.ts +0 -30
- package/dist/types/view/fields/date-input/index1.stories.d.ts +0 -24
|
@@ -1,19 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
__markAsModule(target);
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __reExport = (target, module2, desc) => {
|
|
14
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(module2))
|
|
16
|
+
if (!__hasOwnProp.call(target, key) && key !== "default")
|
|
17
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return target;
|
|
20
|
+
};
|
|
21
|
+
var __toModule = (module2) => {
|
|
22
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
23
|
+
};
|
|
24
|
+
__export(exports, {
|
|
25
|
+
getUser: () => getUser
|
|
5
26
|
});
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const getUser = async ({
|
|
11
|
-
userName
|
|
12
|
-
}) => {
|
|
13
|
-
const {
|
|
14
|
-
data
|
|
15
|
-
} = await (0, _index.getAuthHTTPClient)().get(`/encompass/v1/users/${userName}`);
|
|
27
|
+
var import_http_client = __toModule(require("../../communication/http-client"));
|
|
28
|
+
const getUser = async ({ userName }) => {
|
|
29
|
+
const { data } = await (0, import_http_client.getAuthHTTPClient)().get(`/encompass/v1/users/${userName}`);
|
|
16
30
|
return data;
|
|
17
31
|
};
|
|
18
|
-
|
|
19
|
-
exports.getUser = getUser;
|
|
@@ -1,62 +1,58 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
Object.
|
|
6
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
__markAsModule(target);
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __reExport = (target, module2, desc) => {
|
|
14
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(module2))
|
|
16
|
+
if (!__hasOwnProp.call(target, key) && key !== "default")
|
|
17
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return target;
|
|
20
|
+
};
|
|
21
|
+
var __toModule = (module2) => {
|
|
22
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
23
|
+
};
|
|
24
|
+
__export(exports, {
|
|
25
|
+
getAuthHTTPClient: () => getAuthHTTPClient,
|
|
26
|
+
getHTTPClient: () => getHTTPClient
|
|
7
27
|
});
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
var _retry = _interopRequireDefault(require("./retry.js"));
|
|
17
|
-
|
|
18
|
-
var _requestInterceptor = require("./request-interceptor.js");
|
|
19
|
-
|
|
20
|
-
var _responseInterceptor = require("./response-interceptor.js");
|
|
21
|
-
|
|
22
|
-
const REQUEST_TIMEOUT = 2 * 60 * 1000; // 2 mins
|
|
23
|
-
|
|
28
|
+
var import_axios = __toModule(require("axios"));
|
|
29
|
+
var import_config = __toModule(require("../../utils/app-config/config"));
|
|
30
|
+
var import_helper = __toModule(require("../../utils/auth/helper"));
|
|
31
|
+
var import_retry = __toModule(require("./retry"));
|
|
32
|
+
var import_request_interceptor = __toModule(require("./request-interceptor"));
|
|
33
|
+
var import_response_interceptor = __toModule(require("./response-interceptor"));
|
|
34
|
+
const REQUEST_TIMEOUT = 2 * 60 * 1e3;
|
|
24
35
|
const getHTTPClient = ({
|
|
25
|
-
baseURL = (0,
|
|
36
|
+
baseURL = (0, import_config.getAppConfigValue)("serviceEndpoints.api", ""),
|
|
26
37
|
headers = {}
|
|
27
38
|
} = {}) => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
(0, _retry.default)(client);
|
|
38
|
-
const {
|
|
39
|
-
request,
|
|
40
|
-
response
|
|
41
|
-
} = (client === null || client === void 0 ? void 0 : client.interceptors) || {};
|
|
42
|
-
if (request) request.use(_requestInterceptor.requestInterceptor);
|
|
43
|
-
if (response) response.use(_responseInterceptor.handleSuccess, _responseInterceptor.handleFailure);
|
|
39
|
+
const client = import_axios.default.create({ baseURL, headers });
|
|
40
|
+
if (client?.defaults?.timeout)
|
|
41
|
+
client.defaults.timeout = REQUEST_TIMEOUT;
|
|
42
|
+
(0, import_retry.default)(client);
|
|
43
|
+
const { request, response } = client?.interceptors || {};
|
|
44
|
+
if (request)
|
|
45
|
+
request.use(import_request_interceptor.requestInterceptor);
|
|
46
|
+
if (response)
|
|
47
|
+
response.use(import_response_interceptor.handleSuccess, import_response_interceptor.handleFailure);
|
|
44
48
|
return client;
|
|
45
49
|
};
|
|
46
|
-
|
|
47
|
-
exports.getHTTPClient = getHTTPClient;
|
|
48
|
-
|
|
49
50
|
const getAuthHTTPClient = ({
|
|
50
51
|
baseURL,
|
|
51
52
|
headers = {},
|
|
52
53
|
...rest
|
|
53
54
|
} = {}) => getHTTPClient({
|
|
54
55
|
baseURL,
|
|
55
|
-
|
|
56
|
-
headers: { ...headers,
|
|
57
|
-
Authorization: (0, _helper.getAuthorizationHeader)()
|
|
58
|
-
},
|
|
56
|
+
headers: { ...headers, Authorization: (0, import_helper.getAuthorizationHeader)() },
|
|
59
57
|
...rest
|
|
60
58
|
});
|
|
61
|
-
|
|
62
|
-
exports.getAuthHTTPClient = getAuthHTTPClient;
|
|
@@ -1,15 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
__markAsModule(target);
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __reExport = (target, module2, desc) => {
|
|
14
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(module2))
|
|
16
|
+
if (!__hasOwnProp.call(target, key) && key !== "default")
|
|
17
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return target;
|
|
20
|
+
};
|
|
21
|
+
var __toModule = (module2) => {
|
|
22
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
23
|
+
};
|
|
24
|
+
__export(exports, {
|
|
25
|
+
requestInterceptor: () => requestInterceptor
|
|
5
26
|
});
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const requestInterceptor = config => {
|
|
11
|
-
(0, _session.resetUserIdleTime)();
|
|
27
|
+
var import_session = __toModule(require("../../utils/session"));
|
|
28
|
+
const requestInterceptor = (config) => {
|
|
29
|
+
(0, import_session.resetUserIdleTime)();
|
|
12
30
|
return config;
|
|
13
31
|
};
|
|
14
|
-
|
|
15
|
-
exports.requestInterceptor = requestInterceptor;
|
|
@@ -1,52 +1,55 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
Object.
|
|
6
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
__markAsModule(target);
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __reExport = (target, module2, desc) => {
|
|
14
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(module2))
|
|
16
|
+
if (!__hasOwnProp.call(target, key) && key !== "default")
|
|
17
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return target;
|
|
20
|
+
};
|
|
21
|
+
var __toModule = (module2) => {
|
|
22
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
23
|
+
};
|
|
24
|
+
__export(exports, {
|
|
25
|
+
handleFailure: () => handleFailure,
|
|
26
|
+
handleSuccess: () => handleSuccess,
|
|
27
|
+
onAuthorizationFailure: () => onAuthorizationFailure
|
|
7
28
|
});
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var _axios = _interopRequireDefault(require("axios"));
|
|
11
|
-
|
|
29
|
+
var import_axios = __toModule(require("axios"));
|
|
12
30
|
const HTTP_UNAUTHORIZED = 401;
|
|
13
31
|
let unAuthorizedFailureHandler = null;
|
|
14
|
-
|
|
15
|
-
const onAuthorizationFailure = callback => {
|
|
32
|
+
const onAuthorizationFailure = (callback) => {
|
|
16
33
|
unAuthorizedFailureHandler = callback;
|
|
17
34
|
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const {
|
|
27
|
-
status
|
|
28
|
-
} = (error || {}).response || {}; // incase of authorization issues give a chance to the sdk consumer to refresh the authroization token and resubmit the request
|
|
29
|
-
|
|
30
|
-
if (status === HTTP_UNAUTHORIZED && unAuthorizedFailureHandler && typeof unAuthorizedFailureHandler === 'function') {
|
|
31
|
-
return unAuthorizedFailureHandler(error).then(authorizationHeader => {
|
|
32
|
-
const {
|
|
33
|
-
config
|
|
34
|
-
} = error;
|
|
35
|
-
if (config.headers) config.headers.Authorization = authorizationHeader;
|
|
35
|
+
const handleSuccess = (response) => response;
|
|
36
|
+
const handleFailure = (error) => {
|
|
37
|
+
const { status } = (error || {}).response || {};
|
|
38
|
+
if (status === HTTP_UNAUTHORIZED && unAuthorizedFailureHandler && typeof unAuthorizedFailureHandler === "function") {
|
|
39
|
+
return unAuthorizedFailureHandler(error).then((authorizationHeader) => {
|
|
40
|
+
const { config } = error;
|
|
41
|
+
if (config.headers)
|
|
42
|
+
config.headers.Authorization = authorizationHeader;
|
|
36
43
|
return new Promise((resolve, reject) => {
|
|
37
|
-
|
|
44
|
+
import_axios.default.request(config).then((response) => {
|
|
38
45
|
resolve(response);
|
|
39
|
-
}).catch(exception => {
|
|
46
|
+
}).catch((exception) => {
|
|
40
47
|
reject(exception);
|
|
41
48
|
});
|
|
42
49
|
});
|
|
43
|
-
}).catch(exception => Promise.reject(exception));
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
50
|
+
}).catch((exception) => Promise.reject(exception));
|
|
51
|
+
}
|
|
47
52
|
return new Promise((resolve, reject) => {
|
|
48
53
|
reject(error);
|
|
49
54
|
});
|
|
50
55
|
};
|
|
51
|
-
|
|
52
|
-
exports.handleFailure = handleFailure;
|
|
@@ -1,165 +1,111 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
Object.
|
|
6
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
__markAsModule(target);
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __reExport = (target, module2, desc) => {
|
|
14
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(module2))
|
|
16
|
+
if (!__hasOwnProp.call(target, key) && key !== "default")
|
|
17
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return target;
|
|
20
|
+
};
|
|
21
|
+
var __toModule = (module2) => {
|
|
22
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
23
|
+
};
|
|
24
|
+
__export(exports, {
|
|
25
|
+
attach: () => attach,
|
|
26
|
+
detach: () => detach,
|
|
27
|
+
getConfig: () => getConfig
|
|
7
28
|
});
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var _axios = _interopRequireDefault(require("axios"));
|
|
11
|
-
|
|
12
|
-
/* eslint-disable no-param-reassign,jsdoc/require-returns,jsdoc/require-param-type,jsdoc/require-returns-type,max-lines,@typescript-eslint/no-non-null-assertion */
|
|
13
|
-
const onFulfilled = res => res;
|
|
14
|
-
/**
|
|
15
|
-
* Eject the Axios interceptor that is providing retry capabilities.
|
|
16
|
-
*
|
|
17
|
-
* @param interceptorId The interceptorId provided in the config.
|
|
18
|
-
* @param instance The axios instance using this interceptor.
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
|
|
29
|
+
var import_axios = __toModule(require("axios"));
|
|
30
|
+
const onFulfilled = (res) => res;
|
|
22
31
|
const detach = (interceptorId, instance) => {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if ((_instance = instance) !== null && _instance !== void 0 && (_instance$interceptor = _instance.interceptors) !== null && _instance$interceptor !== void 0 && _instance$interceptor.response) instance.interceptors.response.eject(interceptorId);
|
|
32
|
+
instance = instance || import_axios.default;
|
|
33
|
+
if (instance?.interceptors?.response)
|
|
34
|
+
instance.interceptors.response.eject(interceptorId);
|
|
27
35
|
};
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
*
|
|
31
|
-
* @param err The AxiosError passed to the interceptor.
|
|
32
|
-
*/
|
|
33
|
-
// eslint-disable-next-line complexity
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
exports.detach = detach;
|
|
37
|
-
|
|
38
|
-
const shouldRetryRequest = err => {
|
|
39
|
-
const config = err.config.retryConfig; // If there's no config, or retries are disabled, return.
|
|
40
|
-
|
|
36
|
+
const shouldRetryRequest = (err) => {
|
|
37
|
+
const config = err.config.retryConfig;
|
|
41
38
|
if (!config || config.retry === 0) {
|
|
42
39
|
return false;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
|
|
40
|
+
}
|
|
46
41
|
if (!err.response && (config.currentRetryAttempt || 0) >= config.noResponseRetries) {
|
|
47
42
|
return false;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
43
|
+
}
|
|
51
44
|
if (!err.config.method || config.httpMethodsToRetry.indexOf(err.config.method.toUpperCase()) < 0) {
|
|
52
45
|
return false;
|
|
53
|
-
}
|
|
54
|
-
// to automatically retry, return.
|
|
55
|
-
|
|
56
|
-
|
|
46
|
+
}
|
|
57
47
|
if (err.response && err.response.status) {
|
|
58
|
-
let isInRange = false;
|
|
59
|
-
|
|
48
|
+
let isInRange = false;
|
|
60
49
|
for (const [min, max] of config.statusCodesToRetry) {
|
|
61
|
-
const {
|
|
62
|
-
status
|
|
63
|
-
} = err.response;
|
|
64
|
-
|
|
50
|
+
const { status } = err.response;
|
|
65
51
|
if (status >= min && status <= max) {
|
|
66
52
|
isInRange = true;
|
|
67
53
|
break;
|
|
68
54
|
}
|
|
69
55
|
}
|
|
70
|
-
|
|
71
56
|
if (!isInRange) {
|
|
72
57
|
return false;
|
|
73
58
|
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
|
|
59
|
+
}
|
|
77
60
|
config.currentRetryAttempt = config.currentRetryAttempt || 0;
|
|
78
|
-
|
|
79
61
|
if (config.currentRetryAttempt >= config.retry) {
|
|
80
62
|
return false;
|
|
81
63
|
}
|
|
82
|
-
|
|
83
64
|
return true;
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
const onError = err => {
|
|
65
|
+
};
|
|
66
|
+
const onError = (err) => {
|
|
88
67
|
if (!err.config) {
|
|
89
68
|
return Promise.reject(err);
|
|
90
69
|
}
|
|
91
|
-
|
|
92
70
|
const config = err.config.retryConfig || {};
|
|
93
71
|
config.currentRetryAttempt = config.currentRetryAttempt || 0;
|
|
94
|
-
config.retry = config.retry ===
|
|
72
|
+
config.retry = config.retry === void 0 || config.retry === null ? 3 : config.retry;
|
|
95
73
|
config.retryDelay = config.retryDelay || 100;
|
|
96
|
-
config.instance = config.instance ||
|
|
97
|
-
config.httpMethodsToRetry = config.httpMethodsToRetry || [
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
err.config.retryConfig = config;
|
|
112
|
-
|
|
74
|
+
config.instance = config.instance || import_axios.default;
|
|
75
|
+
config.httpMethodsToRetry = config.httpMethodsToRetry || [
|
|
76
|
+
"GET",
|
|
77
|
+
"HEAD",
|
|
78
|
+
"PUT",
|
|
79
|
+
"OPTIONS",
|
|
80
|
+
"DELETE"
|
|
81
|
+
];
|
|
82
|
+
config.noResponseRetries = config.noResponseRetries === void 0 || config.noResponseRetries === null ? 2 : config.noResponseRetries;
|
|
83
|
+
const retryRanges = [
|
|
84
|
+
[100, 199],
|
|
85
|
+
[429, 429],
|
|
86
|
+
[500, 599]
|
|
87
|
+
];
|
|
88
|
+
config.statusCodesToRetry = config.statusCodesToRetry || retryRanges;
|
|
89
|
+
err.config.retryConfig = config;
|
|
113
90
|
const shouldRetryFn = config.shouldRetry || shouldRetryRequest;
|
|
114
|
-
|
|
115
91
|
if (!shouldRetryFn(err)) {
|
|
116
92
|
return Promise.reject(err);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
const onBackoffPromise = new Promise(resolve => {
|
|
121
|
-
// Calculate time to wait with exponential backoff.
|
|
122
|
-
// Formula: (2^c - 1 / 2) * 1000
|
|
123
|
-
// eslint-disable-next-line no-restricted-properties
|
|
124
|
-
const delay = (Math.pow(2, config.currentRetryAttempt) - 1) / 2 * 1000;
|
|
93
|
+
}
|
|
94
|
+
const onBackoffPromise = new Promise((resolve) => {
|
|
95
|
+
const delay = (Math.pow(2, config.currentRetryAttempt) - 1) / 2 * 1e3;
|
|
125
96
|
err.config.retryConfig.currentRetryAttempt += 1;
|
|
126
97
|
setTimeout(resolve, delay);
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
const onRetryAttemptPromise = config.onRetryAttempt ? Promise.resolve(config.onRetryAttempt(err)) : Promise.resolve(); // Return the promise in which recalls axios to retry the request
|
|
130
|
-
|
|
98
|
+
});
|
|
99
|
+
const onRetryAttemptPromise = config.onRetryAttempt ? Promise.resolve(config.onRetryAttempt(err)) : Promise.resolve();
|
|
131
100
|
return Promise.resolve().then(() => onBackoffPromise).then(() => onRetryAttemptPromise).then(() => config.instance.request(err.config));
|
|
132
101
|
};
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
* @param instance The optional Axios instance on which to attach the
|
|
137
|
-
* interceptor.
|
|
138
|
-
* @returns The id of the interceptor attached to the axios instance.
|
|
139
|
-
*/
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
const attach = instance => {
|
|
143
|
-
var _instance2, _instance2$intercepto;
|
|
144
|
-
|
|
145
|
-
instance = instance || _axios.default;
|
|
146
|
-
return (_instance2 = instance) !== null && _instance2 !== void 0 && (_instance2$intercepto = _instance2.interceptors) !== null && _instance2$intercepto !== void 0 && _instance2$intercepto.response ? instance.interceptors.response.use(onFulfilled, onError) : null;
|
|
102
|
+
const attach = (instance) => {
|
|
103
|
+
instance = instance || import_axios.default;
|
|
104
|
+
return instance?.interceptors?.response ? instance.interceptors.response.use(onFulfilled, onError) : null;
|
|
147
105
|
};
|
|
148
|
-
|
|
149
|
-
* Acquire the retryConfig object from an AxiosError if available.
|
|
150
|
-
*
|
|
151
|
-
* @param err The Axios error with a config object.
|
|
152
|
-
*/
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
exports.attach = attach;
|
|
156
|
-
|
|
157
|
-
const getConfig = err => {
|
|
106
|
+
const getConfig = (err) => {
|
|
158
107
|
if (err && err.config) {
|
|
159
108
|
return err.config.retryConfig;
|
|
160
109
|
}
|
|
161
|
-
|
|
162
110
|
return null;
|
|
163
111
|
};
|
|
164
|
-
|
|
165
|
-
exports.getConfig = getConfig;
|
|
@@ -1,45 +1,51 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
__markAsModule(target);
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __reExport = (target, module2, desc) => {
|
|
14
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(module2))
|
|
16
|
+
if (!__hasOwnProp.call(target, key) && key !== "default")
|
|
17
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return target;
|
|
20
|
+
};
|
|
21
|
+
var __toModule = (module2) => {
|
|
22
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
23
|
+
};
|
|
24
|
+
__export(exports, {
|
|
25
|
+
default: () => retry_default,
|
|
26
|
+
getRaxConfig: () => getRaxConfig
|
|
5
27
|
});
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var _retryAxios = require("./retry-axios.js");
|
|
9
|
-
|
|
10
|
-
const getRaxConfig = httpClient => ({
|
|
11
|
-
// Retry 3 times on requests that return a response (500, etc) before giving up. Defaults to 3.
|
|
28
|
+
var import_retry_axios = __toModule(require("./retry-axios"));
|
|
29
|
+
const getRaxConfig = (httpClient) => ({
|
|
12
30
|
retry: 3,
|
|
13
|
-
// Retry twice on errors that don't return a response (ENOTFOUND, ETIMEDOUT, etc).
|
|
14
31
|
noResponseRetries: 2,
|
|
15
|
-
// Milliseconds to delay at first. Defaults to 100.
|
|
16
32
|
retryDelay: 100,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
statusCodesToRetry: [[100, 199], [429, 429], [500, 599]],
|
|
24
|
-
// If you are using a non static instance of Axios you need
|
|
25
|
-
// to pass that instance here (const ax = axios.create())
|
|
33
|
+
httpMethodsToRetry: ["GET", "HEAD", "OPTIONS", "DELETE", "PUT"],
|
|
34
|
+
statusCodesToRetry: [
|
|
35
|
+
[100, 199],
|
|
36
|
+
[429, 429],
|
|
37
|
+
[500, 599]
|
|
38
|
+
],
|
|
26
39
|
instance: httpClient,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
if (cfg && cfg.currentRetryAttempt) {}
|
|
40
|
+
onRetryAttempt: (err) => {
|
|
41
|
+
const cfg = (0, import_retry_axios.getConfig)(err);
|
|
42
|
+
if (cfg && cfg.currentRetryAttempt)
|
|
43
|
+
console.log(`Retry attempt #${cfg.currentRetryAttempt}`);
|
|
33
44
|
}
|
|
34
45
|
});
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const setupRetry = httpClient => {
|
|
39
|
-
if (httpClient !== null && httpClient !== void 0 && httpClient.defaults) // eslint-disable-next-line no-param-reassign
|
|
46
|
+
const setupRetry = (httpClient) => {
|
|
47
|
+
if (httpClient?.defaults)
|
|
40
48
|
httpClient.defaults.retryConfig = getRaxConfig(httpClient);
|
|
41
|
-
(0,
|
|
49
|
+
(0, import_retry_axios.attach)(httpClient);
|
|
42
50
|
};
|
|
43
|
-
|
|
44
|
-
var _default = setupRetry;
|
|
45
|
-
exports.default = _default;
|
|
51
|
+
var retry_default = setupRetry;
|