@azure/core-rest-pipeline 1.19.2-alpha.20250417.3 → 1.20.0
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/browser/constants.js +1 -1
- package/dist/browser/constants.js.map +1 -1
- package/dist/browser/createPipelineFromOptions.js +2 -0
- package/dist/browser/createPipelineFromOptions.js.map +1 -1
- package/dist/browser/defaultHttpClient.d.ts +1 -1
- package/dist/browser/defaultHttpClient.js +21 -3
- package/dist/browser/defaultHttpClient.js.map +1 -0
- package/dist/browser/httpHeaders.js +2 -80
- package/dist/browser/httpHeaders.js.map +1 -1
- package/dist/browser/index.d.ts +1 -2
- package/dist/browser/index.js +1 -1
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/interfaces.d.ts +11 -0
- package/dist/browser/interfaces.js.map +1 -1
- package/dist/browser/pipeline.js +2 -253
- package/dist/browser/pipeline.js.map +1 -1
- package/dist/browser/pipelineRequest.d.ts +11 -0
- package/dist/browser/pipelineRequest.js +5 -28
- package/dist/browser/pipelineRequest.js.map +1 -1
- package/dist/browser/policies/agentPolicy.js +3 -11
- package/dist/browser/policies/agentPolicy.js.map +1 -1
- package/dist/browser/policies/decompressResponsePolicy.d.ts +8 -4
- package/dist/browser/policies/decompressResponsePolicy.js +8 -7
- package/dist/browser/policies/decompressResponsePolicy.js.map +1 -0
- package/dist/browser/policies/defaultRetryPolicy.js +3 -12
- package/dist/browser/policies/defaultRetryPolicy.js.map +1 -1
- package/dist/browser/policies/exponentialRetryPolicy.js +3 -10
- package/dist/browser/policies/exponentialRetryPolicy.js.map +1 -1
- package/dist/browser/policies/formDataPolicy.js +3 -85
- package/dist/browser/policies/formDataPolicy.js.map +1 -1
- package/dist/browser/policies/logPolicy.js +3 -21
- package/dist/browser/policies/logPolicy.js.map +1 -1
- package/dist/browser/policies/multipartPolicy.js +12 -95
- package/dist/browser/policies/multipartPolicy.js.map +1 -1
- package/dist/browser/policies/proxyPolicy.d.ts +26 -2
- package/dist/browser/policies/proxyPolicy.js +26 -2
- package/dist/browser/policies/proxyPolicy.js.map +1 -0
- package/dist/browser/policies/redirectPolicy.js +3 -38
- package/dist/browser/policies/redirectPolicy.js.map +1 -1
- package/dist/browser/policies/retryPolicy.d.ts +59 -1
- package/dist/browser/policies/retryPolicy.js +5 -94
- package/dist/browser/policies/retryPolicy.js.map +1 -1
- package/dist/browser/policies/systemErrorRetryPolicy.js +3 -13
- package/dist/browser/policies/systemErrorRetryPolicy.js.map +1 -1
- package/dist/browser/policies/throttlingRetryPolicy.js +3 -11
- package/dist/browser/policies/throttlingRetryPolicy.js.map +1 -1
- package/dist/browser/policies/tlsPolicy.js +3 -11
- package/dist/browser/policies/tlsPolicy.js.map +1 -1
- package/dist/browser/policies/tracingPolicy.js +1 -1
- package/dist/browser/policies/tracingPolicy.js.map +1 -1
- package/dist/browser/policies/wrapAbortSignalLikePolicy.d.ts +10 -0
- package/dist/browser/policies/wrapAbortSignalLikePolicy.js +30 -0
- package/dist/browser/policies/wrapAbortSignalLikePolicy.js.map +1 -0
- package/dist/browser/restError.js +8 -27
- package/dist/browser/restError.js.map +1 -1
- package/dist/browser/util/file.d.ts +28 -2
- package/dist/browser/util/file.js +9 -4
- package/dist/browser/util/file.js.map +1 -1
- package/dist/browser/util/tokenCycler.js +1 -1
- package/dist/browser/util/tokenCycler.js.map +1 -1
- package/dist/browser/util/wrapAbortSignal.d.ts +12 -0
- package/dist/browser/util/wrapAbortSignal.js +31 -0
- package/dist/browser/util/wrapAbortSignal.js.map +1 -0
- package/dist/commonjs/constants.js +1 -1
- package/dist/commonjs/constants.js.map +1 -1
- package/dist/commonjs/createPipelineFromOptions.js +2 -0
- package/dist/commonjs/createPipelineFromOptions.js.map +1 -1
- package/dist/commonjs/defaultHttpClient.js +20 -2
- package/dist/commonjs/defaultHttpClient.js.map +1 -1
- package/dist/commonjs/httpHeaders.js +2 -80
- package/dist/commonjs/httpHeaders.js.map +1 -1
- package/dist/commonjs/index.d.ts +1 -2
- package/dist/commonjs/index.js.map +1 -1
- package/dist/commonjs/interfaces.d.ts +11 -0
- package/dist/commonjs/interfaces.js.map +1 -1
- package/dist/commonjs/pipeline.js +2 -253
- package/dist/commonjs/pipeline.js.map +1 -1
- package/dist/commonjs/pipelineRequest.d.ts +11 -0
- package/dist/commonjs/pipelineRequest.js +5 -28
- package/dist/commonjs/pipelineRequest.js.map +1 -1
- package/dist/commonjs/policies/agentPolicy.js +3 -11
- package/dist/commonjs/policies/agentPolicy.js.map +1 -1
- package/dist/commonjs/policies/decompressResponsePolicy.js +3 -11
- package/dist/commonjs/policies/decompressResponsePolicy.js.map +1 -1
- package/dist/commonjs/policies/defaultRetryPolicy.js +3 -12
- package/dist/commonjs/policies/defaultRetryPolicy.js.map +1 -1
- package/dist/commonjs/policies/exponentialRetryPolicy.js +3 -10
- package/dist/commonjs/policies/exponentialRetryPolicy.js.map +1 -1
- package/dist/commonjs/policies/formDataPolicy.js +3 -85
- package/dist/commonjs/policies/formDataPolicy.js.map +1 -1
- package/dist/commonjs/policies/logPolicy.js +3 -21
- package/dist/commonjs/policies/logPolicy.js.map +1 -1
- package/dist/commonjs/policies/multipartPolicy.js +12 -95
- package/dist/commonjs/policies/multipartPolicy.js.map +1 -1
- package/dist/commonjs/policies/proxyPolicy.d.ts +0 -6
- package/dist/commonjs/policies/proxyPolicy.js +5 -169
- package/dist/commonjs/policies/proxyPolicy.js.map +1 -1
- package/dist/commonjs/policies/redirectPolicy.js +3 -38
- package/dist/commonjs/policies/redirectPolicy.js.map +1 -1
- package/dist/commonjs/policies/retryPolicy.d.ts +59 -1
- package/dist/commonjs/policies/retryPolicy.js +5 -94
- package/dist/commonjs/policies/retryPolicy.js.map +1 -1
- package/dist/commonjs/policies/systemErrorRetryPolicy.js +3 -13
- package/dist/commonjs/policies/systemErrorRetryPolicy.js.map +1 -1
- package/dist/commonjs/policies/throttlingRetryPolicy.js +3 -11
- package/dist/commonjs/policies/throttlingRetryPolicy.js.map +1 -1
- package/dist/commonjs/policies/tlsPolicy.js +3 -11
- package/dist/commonjs/policies/tlsPolicy.js.map +1 -1
- package/dist/commonjs/policies/tracingPolicy.js +2 -2
- package/dist/commonjs/policies/tracingPolicy.js.map +1 -1
- package/dist/commonjs/policies/wrapAbortSignalLikePolicy.d.ts +10 -0
- package/dist/commonjs/policies/wrapAbortSignalLikePolicy.js +34 -0
- package/dist/commonjs/policies/wrapAbortSignalLikePolicy.js.map +1 -0
- package/dist/commonjs/restError.js +8 -27
- package/dist/commonjs/restError.js.map +1 -1
- package/dist/commonjs/tsdoc-metadata.json +1 -1
- package/dist/commonjs/util/file.d.ts +28 -2
- package/dist/commonjs/util/file.js +10 -4
- package/dist/commonjs/util/file.js.map +1 -1
- package/dist/commonjs/util/tokenCycler.js +2 -2
- package/dist/commonjs/util/tokenCycler.js.map +1 -1
- package/dist/commonjs/util/wrapAbortSignal.d.ts +12 -0
- package/dist/commonjs/util/wrapAbortSignal.js +34 -0
- package/dist/commonjs/util/wrapAbortSignal.js.map +1 -0
- package/dist/esm/constants.js +1 -1
- package/dist/esm/constants.js.map +1 -1
- package/dist/esm/createPipelineFromOptions.js +2 -0
- package/dist/esm/createPipelineFromOptions.js.map +1 -1
- package/dist/esm/defaultHttpClient.js +20 -2
- package/dist/esm/defaultHttpClient.js.map +1 -1
- package/dist/esm/httpHeaders.js +2 -80
- package/dist/esm/httpHeaders.js.map +1 -1
- package/dist/esm/index.d.ts +1 -2
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/interfaces.d.ts +11 -0
- package/dist/esm/interfaces.js.map +1 -1
- package/dist/esm/pipeline.js +2 -253
- package/dist/esm/pipeline.js.map +1 -1
- package/dist/esm/pipelineRequest.d.ts +11 -0
- package/dist/esm/pipelineRequest.js +5 -28
- package/dist/esm/pipelineRequest.js.map +1 -1
- package/dist/esm/policies/agentPolicy.js +3 -11
- package/dist/esm/policies/agentPolicy.js.map +1 -1
- package/dist/esm/policies/decompressResponsePolicy.js +3 -11
- package/dist/esm/policies/decompressResponsePolicy.js.map +1 -1
- package/dist/esm/policies/defaultRetryPolicy.js +3 -12
- package/dist/esm/policies/defaultRetryPolicy.js.map +1 -1
- package/dist/esm/policies/exponentialRetryPolicy.js +3 -10
- package/dist/esm/policies/exponentialRetryPolicy.js.map +1 -1
- package/dist/esm/policies/formDataPolicy.js +3 -85
- package/dist/esm/policies/formDataPolicy.js.map +1 -1
- package/dist/esm/policies/logPolicy.js +3 -21
- package/dist/esm/policies/logPolicy.js.map +1 -1
- package/dist/esm/policies/multipartPolicy.js +12 -95
- package/dist/esm/policies/multipartPolicy.js.map +1 -1
- package/dist/esm/policies/proxyPolicy.d.ts +0 -6
- package/dist/esm/policies/proxyPolicy.js +4 -167
- package/dist/esm/policies/proxyPolicy.js.map +1 -1
- package/dist/esm/policies/redirectPolicy.js +3 -38
- package/dist/esm/policies/redirectPolicy.js.map +1 -1
- package/dist/esm/policies/retryPolicy.d.ts +59 -1
- package/dist/esm/policies/retryPolicy.js +5 -94
- package/dist/esm/policies/retryPolicy.js.map +1 -1
- package/dist/esm/policies/systemErrorRetryPolicy.js +3 -13
- package/dist/esm/policies/systemErrorRetryPolicy.js.map +1 -1
- package/dist/esm/policies/throttlingRetryPolicy.js +3 -11
- package/dist/esm/policies/throttlingRetryPolicy.js.map +1 -1
- package/dist/esm/policies/tlsPolicy.js +3 -11
- package/dist/esm/policies/tlsPolicy.js.map +1 -1
- package/dist/esm/policies/tracingPolicy.js +1 -1
- package/dist/esm/policies/tracingPolicy.js.map +1 -1
- package/dist/esm/policies/wrapAbortSignalLikePolicy.d.ts +10 -0
- package/dist/esm/policies/wrapAbortSignalLikePolicy.js +30 -0
- package/dist/esm/policies/wrapAbortSignalLikePolicy.js.map +1 -0
- package/dist/esm/restError.js +8 -27
- package/dist/esm/restError.js.map +1 -1
- package/dist/esm/util/file.d.ts +28 -2
- package/dist/esm/util/file.js +9 -4
- package/dist/esm/util/file.js.map +1 -1
- package/dist/esm/util/tokenCycler.js +1 -1
- package/dist/esm/util/tokenCycler.js.map +1 -1
- package/dist/esm/util/wrapAbortSignal.d.ts +12 -0
- package/dist/esm/util/wrapAbortSignal.js +31 -0
- package/dist/esm/util/wrapAbortSignal.js.map +1 -0
- package/dist/react-native/constants.js +1 -1
- package/dist/react-native/constants.js.map +1 -1
- package/dist/react-native/createPipelineFromOptions.js +2 -0
- package/dist/react-native/createPipelineFromOptions.js.map +1 -1
- package/dist/react-native/defaultHttpClient.d.ts +1 -1
- package/dist/react-native/defaultHttpClient.js +21 -3
- package/dist/react-native/defaultHttpClient.js.map +1 -0
- package/dist/react-native/httpHeaders.js +2 -80
- package/dist/react-native/httpHeaders.js.map +1 -1
- package/dist/react-native/index.d.ts +1 -2
- package/dist/react-native/index.js +1 -1
- package/dist/react-native/index.js.map +1 -1
- package/dist/react-native/interfaces.d.ts +11 -0
- package/dist/react-native/interfaces.js.map +1 -1
- package/dist/react-native/pipeline.js +2 -253
- package/dist/react-native/pipeline.js.map +1 -1
- package/dist/react-native/pipelineRequest.d.ts +11 -0
- package/dist/react-native/pipelineRequest.js +5 -28
- package/dist/react-native/pipelineRequest.js.map +1 -1
- package/dist/react-native/policies/agentPolicy.js +3 -11
- package/dist/react-native/policies/agentPolicy.js.map +1 -1
- package/dist/react-native/policies/decompressResponsePolicy.js +3 -11
- package/dist/react-native/policies/decompressResponsePolicy.js.map +1 -1
- package/dist/react-native/policies/defaultRetryPolicy.js +3 -12
- package/dist/react-native/policies/defaultRetryPolicy.js.map +1 -1
- package/dist/react-native/policies/exponentialRetryPolicy.js +3 -10
- package/dist/react-native/policies/exponentialRetryPolicy.js.map +1 -1
- package/dist/react-native/policies/formDataPolicy.js +3 -85
- package/dist/react-native/policies/formDataPolicy.js.map +1 -1
- package/dist/react-native/policies/logPolicy.js +3 -21
- package/dist/react-native/policies/logPolicy.js.map +1 -1
- package/dist/react-native/policies/multipartPolicy.js +12 -95
- package/dist/react-native/policies/multipartPolicy.js.map +1 -1
- package/dist/react-native/policies/proxyPolicy.d.ts +26 -2
- package/dist/react-native/policies/proxyPolicy.js +26 -2
- package/dist/react-native/policies/proxyPolicy.js.map +1 -0
- package/dist/react-native/policies/redirectPolicy.js +3 -38
- package/dist/react-native/policies/redirectPolicy.js.map +1 -1
- package/dist/react-native/policies/retryPolicy.d.ts +59 -1
- package/dist/react-native/policies/retryPolicy.js +5 -94
- package/dist/react-native/policies/retryPolicy.js.map +1 -1
- package/dist/react-native/policies/systemErrorRetryPolicy.js +3 -13
- package/dist/react-native/policies/systemErrorRetryPolicy.js.map +1 -1
- package/dist/react-native/policies/throttlingRetryPolicy.js +3 -11
- package/dist/react-native/policies/throttlingRetryPolicy.js.map +1 -1
- package/dist/react-native/policies/tlsPolicy.js +3 -11
- package/dist/react-native/policies/tlsPolicy.js.map +1 -1
- package/dist/react-native/policies/tracingPolicy.js +1 -1
- package/dist/react-native/policies/tracingPolicy.js.map +1 -1
- package/dist/react-native/policies/wrapAbortSignalLikePolicy.d.ts +10 -0
- package/dist/react-native/policies/wrapAbortSignalLikePolicy.js +30 -0
- package/dist/react-native/policies/wrapAbortSignalLikePolicy.js.map +1 -0
- package/dist/react-native/restError.js +8 -27
- package/dist/react-native/restError.js.map +1 -1
- package/dist/react-native/util/file.d.ts +28 -2
- package/dist/react-native/util/file.js +9 -4
- package/dist/react-native/util/file.js.map +1 -1
- package/dist/react-native/util/tokenCycler.js +1 -1
- package/dist/react-native/util/tokenCycler.js.map +1 -1
- package/dist/react-native/util/wrapAbortSignal.d.ts +12 -0
- package/dist/react-native/util/wrapAbortSignal.js +31 -0
- package/dist/react-native/util/wrapAbortSignal.js.map +1 -0
- package/package.json +5 -6
- package/dist/browser/accessTokenCache.d.ts +0 -40
- package/dist/browser/accessTokenCache.js +0 -32
- package/dist/browser/accessTokenCache.js.map +0 -1
- package/dist/browser/defaultHttpClient-browser.mjs.map +0 -1
- package/dist/browser/fetchHttpClient.d.ts +0 -7
- package/dist/browser/fetchHttpClient.js +0 -256
- package/dist/browser/fetchHttpClient.js.map +0 -1
- package/dist/browser/nodeHttpClient.d.ts +0 -9
- package/dist/browser/nodeHttpClient.js +0 -348
- package/dist/browser/nodeHttpClient.js.map +0 -1
- package/dist/browser/policies/decompressResponsePolicy-browser.mjs.map +0 -1
- package/dist/browser/policies/proxyPolicy-browser.mjs.map +0 -1
- package/dist/browser/policies/proxyPolicy.common.d.ts +0 -15
- package/dist/browser/policies/proxyPolicy.common.js +0 -24
- package/dist/browser/policies/proxyPolicy.common.js.map +0 -1
- package/dist/browser/retryStrategies/exponentialRetryStrategy.d.ts +0 -40
- package/dist/browser/retryStrategies/exponentialRetryStrategy.js +0 -64
- package/dist/browser/retryStrategies/exponentialRetryStrategy.js.map +0 -1
- package/dist/browser/retryStrategies/retryStrategy.d.ts +0 -61
- package/dist/browser/retryStrategies/retryStrategy.js +0 -4
- package/dist/browser/retryStrategies/retryStrategy.js.map +0 -1
- package/dist/browser/retryStrategies/throttlingRetryStrategy.d.ts +0 -9
- package/dist/browser/retryStrategies/throttlingRetryStrategy.js +0 -74
- package/dist/browser/retryStrategies/throttlingRetryStrategy.js.map +0 -1
- package/dist/browser/util/concat-browser.mjs.map +0 -1
- package/dist/browser/util/concat.common.d.ts +0 -18
- package/dist/browser/util/concat.common.js +0 -45
- package/dist/browser/util/concat.common.js.map +0 -1
- package/dist/browser/util/concat.d.ts +0 -2
- package/dist/browser/util/concat.js +0 -4
- package/dist/browser/util/helpers.d.ts +0 -21
- package/dist/browser/util/helpers.js +0 -58
- package/dist/browser/util/helpers.js.map +0 -1
- package/dist/browser/util/inspect-browser.mjs.map +0 -1
- package/dist/browser/util/inspect.common.d.ts +0 -2
- package/dist/browser/util/inspect.common.js +0 -4
- package/dist/browser/util/inspect.common.js.map +0 -1
- package/dist/browser/util/inspect.d.ts +0 -2
- package/dist/browser/util/inspect.js +0 -4
- package/dist/browser/util/sanitizer.d.ts +0 -30
- package/dist/browser/util/sanitizer.js +0 -139
- package/dist/browser/util/sanitizer.js.map +0 -1
- package/dist/browser/util/typeGuards.d.ts +0 -5
- package/dist/browser/util/typeGuards.js +0 -17
- package/dist/browser/util/typeGuards.js.map +0 -1
- package/dist/browser/xhrHttpClient.d.ts +0 -7
- package/dist/browser/xhrHttpClient.js +0 -167
- package/dist/browser/xhrHttpClient.js.map +0 -1
- package/dist/commonjs/accessTokenCache.d.ts +0 -40
- package/dist/commonjs/accessTokenCache.js +0 -36
- package/dist/commonjs/accessTokenCache.js.map +0 -1
- package/dist/commonjs/fetchHttpClient.d.ts +0 -7
- package/dist/commonjs/fetchHttpClient.js +0 -259
- package/dist/commonjs/fetchHttpClient.js.map +0 -1
- package/dist/commonjs/nodeHttpClient.d.ts +0 -9
- package/dist/commonjs/nodeHttpClient.js +0 -353
- package/dist/commonjs/nodeHttpClient.js.map +0 -1
- package/dist/commonjs/policies/proxyPolicy.common.d.ts +0 -15
- package/dist/commonjs/policies/proxyPolicy.common.js +0 -30
- package/dist/commonjs/policies/proxyPolicy.common.js.map +0 -1
- package/dist/commonjs/retryStrategies/exponentialRetryStrategy.d.ts +0 -40
- package/dist/commonjs/retryStrategies/exponentialRetryStrategy.js +0 -69
- package/dist/commonjs/retryStrategies/exponentialRetryStrategy.js.map +0 -1
- package/dist/commonjs/retryStrategies/retryStrategy.d.ts +0 -61
- package/dist/commonjs/retryStrategies/retryStrategy.js +0 -5
- package/dist/commonjs/retryStrategies/retryStrategy.js.map +0 -1
- package/dist/commonjs/retryStrategies/throttlingRetryStrategy.d.ts +0 -9
- package/dist/commonjs/retryStrategies/throttlingRetryStrategy.js +0 -78
- package/dist/commonjs/retryStrategies/throttlingRetryStrategy.js.map +0 -1
- package/dist/commonjs/util/concat.common.d.ts +0 -18
- package/dist/commonjs/util/concat.common.js +0 -48
- package/dist/commonjs/util/concat.common.js.map +0 -1
- package/dist/commonjs/util/concat.d.ts +0 -17
- package/dist/commonjs/util/concat.js +0 -91
- package/dist/commonjs/util/concat.js.map +0 -1
- package/dist/commonjs/util/helpers.d.ts +0 -21
- package/dist/commonjs/util/helpers.js +0 -62
- package/dist/commonjs/util/helpers.js.map +0 -1
- package/dist/commonjs/util/inspect.common.d.ts +0 -2
- package/dist/commonjs/util/inspect.common.js +0 -7
- package/dist/commonjs/util/inspect.common.js.map +0 -1
- package/dist/commonjs/util/inspect.d.ts +0 -2
- package/dist/commonjs/util/inspect.js +0 -8
- package/dist/commonjs/util/inspect.js.map +0 -1
- package/dist/commonjs/util/sanitizer.d.ts +0 -30
- package/dist/commonjs/util/sanitizer.js +0 -143
- package/dist/commonjs/util/sanitizer.js.map +0 -1
- package/dist/commonjs/util/typeGuards.d.ts +0 -5
- package/dist/commonjs/util/typeGuards.js +0 -23
- package/dist/commonjs/util/typeGuards.js.map +0 -1
- package/dist/commonjs/xhrHttpClient.d.ts +0 -7
- package/dist/commonjs/xhrHttpClient.js +0 -170
- package/dist/commonjs/xhrHttpClient.js.map +0 -1
- package/dist/esm/accessTokenCache.d.ts +0 -40
- package/dist/esm/accessTokenCache.js +0 -32
- package/dist/esm/accessTokenCache.js.map +0 -1
- package/dist/esm/fetchHttpClient.d.ts +0 -7
- package/dist/esm/fetchHttpClient.js +0 -256
- package/dist/esm/fetchHttpClient.js.map +0 -1
- package/dist/esm/nodeHttpClient.d.ts +0 -9
- package/dist/esm/nodeHttpClient.js +0 -348
- package/dist/esm/nodeHttpClient.js.map +0 -1
- package/dist/esm/policies/proxyPolicy.common.d.ts +0 -15
- package/dist/esm/policies/proxyPolicy.common.js +0 -24
- package/dist/esm/policies/proxyPolicy.common.js.map +0 -1
- package/dist/esm/retryStrategies/exponentialRetryStrategy.d.ts +0 -40
- package/dist/esm/retryStrategies/exponentialRetryStrategy.js +0 -64
- package/dist/esm/retryStrategies/exponentialRetryStrategy.js.map +0 -1
- package/dist/esm/retryStrategies/retryStrategy.d.ts +0 -61
- package/dist/esm/retryStrategies/retryStrategy.js +0 -4
- package/dist/esm/retryStrategies/retryStrategy.js.map +0 -1
- package/dist/esm/retryStrategies/throttlingRetryStrategy.d.ts +0 -9
- package/dist/esm/retryStrategies/throttlingRetryStrategy.js +0 -74
- package/dist/esm/retryStrategies/throttlingRetryStrategy.js.map +0 -1
- package/dist/esm/util/concat.common.d.ts +0 -18
- package/dist/esm/util/concat.common.js +0 -45
- package/dist/esm/util/concat.common.js.map +0 -1
- package/dist/esm/util/concat.d.ts +0 -17
- package/dist/esm/util/concat.js +0 -88
- package/dist/esm/util/concat.js.map +0 -1
- package/dist/esm/util/helpers.d.ts +0 -21
- package/dist/esm/util/helpers.js +0 -58
- package/dist/esm/util/helpers.js.map +0 -1
- package/dist/esm/util/inspect.common.d.ts +0 -2
- package/dist/esm/util/inspect.common.js +0 -4
- package/dist/esm/util/inspect.common.js.map +0 -1
- package/dist/esm/util/inspect.d.ts +0 -2
- package/dist/esm/util/inspect.js +0 -5
- package/dist/esm/util/inspect.js.map +0 -1
- package/dist/esm/util/sanitizer.d.ts +0 -30
- package/dist/esm/util/sanitizer.js +0 -139
- package/dist/esm/util/sanitizer.js.map +0 -1
- package/dist/esm/util/typeGuards.d.ts +0 -5
- package/dist/esm/util/typeGuards.js +0 -17
- package/dist/esm/util/typeGuards.js.map +0 -1
- package/dist/esm/xhrHttpClient.d.ts +0 -7
- package/dist/esm/xhrHttpClient.js +0 -167
- package/dist/esm/xhrHttpClient.js.map +0 -1
- package/dist/react-native/accessTokenCache.d.ts +0 -40
- package/dist/react-native/accessTokenCache.js +0 -32
- package/dist/react-native/accessTokenCache.js.map +0 -1
- package/dist/react-native/defaultHttpClient-react-native.mjs.map +0 -1
- package/dist/react-native/fetchHttpClient.d.ts +0 -7
- package/dist/react-native/fetchHttpClient.js +0 -256
- package/dist/react-native/fetchHttpClient.js.map +0 -1
- package/dist/react-native/nodeHttpClient.d.ts +0 -9
- package/dist/react-native/nodeHttpClient.js +0 -348
- package/dist/react-native/nodeHttpClient.js.map +0 -1
- package/dist/react-native/policies/proxyPolicy-react-native.mjs.map +0 -1
- package/dist/react-native/policies/proxyPolicy.common.d.ts +0 -15
- package/dist/react-native/policies/proxyPolicy.common.js +0 -24
- package/dist/react-native/policies/proxyPolicy.common.js.map +0 -1
- package/dist/react-native/retryStrategies/exponentialRetryStrategy.d.ts +0 -40
- package/dist/react-native/retryStrategies/exponentialRetryStrategy.js +0 -64
- package/dist/react-native/retryStrategies/exponentialRetryStrategy.js.map +0 -1
- package/dist/react-native/retryStrategies/retryStrategy.d.ts +0 -61
- package/dist/react-native/retryStrategies/retryStrategy.js +0 -4
- package/dist/react-native/retryStrategies/retryStrategy.js.map +0 -1
- package/dist/react-native/retryStrategies/throttlingRetryStrategy.d.ts +0 -9
- package/dist/react-native/retryStrategies/throttlingRetryStrategy.js +0 -74
- package/dist/react-native/retryStrategies/throttlingRetryStrategy.js.map +0 -1
- package/dist/react-native/util/concat-react-native.mjs.map +0 -1
- package/dist/react-native/util/concat.common.d.ts +0 -18
- package/dist/react-native/util/concat.common.js +0 -45
- package/dist/react-native/util/concat.common.js.map +0 -1
- package/dist/react-native/util/concat.d.ts +0 -2
- package/dist/react-native/util/concat.js +0 -4
- package/dist/react-native/util/helpers.d.ts +0 -21
- package/dist/react-native/util/helpers.js +0 -58
- package/dist/react-native/util/helpers.js.map +0 -1
- package/dist/react-native/util/inspect-react-native.mjs.map +0 -1
- package/dist/react-native/util/inspect.common.d.ts +0 -2
- package/dist/react-native/util/inspect.common.js +0 -4
- package/dist/react-native/util/inspect.common.js.map +0 -1
- package/dist/react-native/util/inspect.d.ts +0 -2
- package/dist/react-native/util/inspect.js +0 -4
- package/dist/react-native/util/sanitizer.d.ts +0 -30
- package/dist/react-native/util/sanitizer.js +0 -139
- package/dist/react-native/util/sanitizer.js.map +0 -1
- package/dist/react-native/util/typeGuards.d.ts +0 -5
- package/dist/react-native/util/typeGuards.js +0 -17
- package/dist/react-native/util/typeGuards.js.map +0 -1
- package/dist/react-native/xhrHttpClient.d.ts +0 -7
- package/dist/react-native/xhrHttpClient.js +0 -167
- package/dist/react-native/xhrHttpClient.js.map +0 -1
|
@@ -1,110 +1,27 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { isBlob } from "../util/typeGuards.js";
|
|
6
|
-
function generateBoundary() {
|
|
7
|
-
return `----AzSDKFormBoundary${randomUUID()}`;
|
|
8
|
-
}
|
|
9
|
-
function encodeHeaders(headers) {
|
|
10
|
-
let result = "";
|
|
11
|
-
for (const [key, value] of headers) {
|
|
12
|
-
result += `${key}: ${value}\r\n`;
|
|
13
|
-
}
|
|
14
|
-
return result;
|
|
15
|
-
}
|
|
16
|
-
function getLength(source) {
|
|
17
|
-
if (source instanceof Uint8Array) {
|
|
18
|
-
return source.byteLength;
|
|
19
|
-
}
|
|
20
|
-
else if (isBlob(source)) {
|
|
21
|
-
// if was created using createFile then -1 means we have an unknown size
|
|
22
|
-
return source.size === -1 ? undefined : source.size;
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
return undefined;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
function getTotalLength(sources) {
|
|
29
|
-
let total = 0;
|
|
30
|
-
for (const source of sources) {
|
|
31
|
-
const partLength = getLength(source);
|
|
32
|
-
if (partLength === undefined) {
|
|
33
|
-
return undefined;
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
total += partLength;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return total;
|
|
40
|
-
}
|
|
41
|
-
async function buildRequestBody(request, parts, boundary) {
|
|
42
|
-
const sources = [
|
|
43
|
-
stringToUint8Array(`--${boundary}`, "utf-8"),
|
|
44
|
-
...parts.flatMap((part) => [
|
|
45
|
-
stringToUint8Array("\r\n", "utf-8"),
|
|
46
|
-
stringToUint8Array(encodeHeaders(part.headers), "utf-8"),
|
|
47
|
-
stringToUint8Array("\r\n", "utf-8"),
|
|
48
|
-
part.body,
|
|
49
|
-
stringToUint8Array(`\r\n--${boundary}`, "utf-8"),
|
|
50
|
-
]),
|
|
51
|
-
stringToUint8Array("--\r\n\r\n", "utf-8"),
|
|
52
|
-
];
|
|
53
|
-
const contentLength = getTotalLength(sources);
|
|
54
|
-
if (contentLength) {
|
|
55
|
-
request.headers.set("Content-Length", contentLength);
|
|
56
|
-
}
|
|
57
|
-
request.body = await concat(sources);
|
|
58
|
-
}
|
|
3
|
+
import { multipartPolicyName as tspMultipartPolicyName, multipartPolicy as tspMultipartPolicy, } from "@typespec/ts-http-runtime/internal/policies";
|
|
4
|
+
import { getRawContent, hasRawContent } from "../util/file.js";
|
|
59
5
|
/**
|
|
60
6
|
* Name of multipart policy
|
|
61
7
|
*/
|
|
62
|
-
export const multipartPolicyName =
|
|
63
|
-
const maxBoundaryLength = 70;
|
|
64
|
-
const validBoundaryCharacters = new Set(`abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'()+,-./:=?`);
|
|
65
|
-
function assertValidBoundary(boundary) {
|
|
66
|
-
if (boundary.length > maxBoundaryLength) {
|
|
67
|
-
throw new Error(`Multipart boundary "${boundary}" exceeds maximum length of 70 characters`);
|
|
68
|
-
}
|
|
69
|
-
if (Array.from(boundary).some((x) => !validBoundaryCharacters.has(x))) {
|
|
70
|
-
throw new Error(`Multipart boundary "${boundary}" contains invalid characters`);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
8
|
+
export const multipartPolicyName = tspMultipartPolicyName;
|
|
73
9
|
/**
|
|
74
10
|
* Pipeline policy for multipart requests
|
|
75
11
|
*/
|
|
76
12
|
export function multipartPolicy() {
|
|
13
|
+
const tspPolicy = tspMultipartPolicy();
|
|
77
14
|
return {
|
|
78
15
|
name: multipartPolicyName,
|
|
79
|
-
async
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
let boundary = request.multipartBody.boundary;
|
|
88
|
-
const contentTypeHeader = (_a = request.headers.get("Content-Type")) !== null && _a !== void 0 ? _a : "multipart/mixed";
|
|
89
|
-
const parsedHeader = contentTypeHeader.match(/^(multipart\/[^ ;]+)(?:; *boundary=(.+))?$/);
|
|
90
|
-
if (!parsedHeader) {
|
|
91
|
-
throw new Error(`Got multipart request body, but content-type header was not multipart: ${contentTypeHeader}`);
|
|
92
|
-
}
|
|
93
|
-
const [, contentType, parsedBoundary] = parsedHeader;
|
|
94
|
-
if (parsedBoundary && boundary && parsedBoundary !== boundary) {
|
|
95
|
-
throw new Error(`Multipart boundary was specified as ${parsedBoundary} in the header, but got ${boundary} in the request body`);
|
|
96
|
-
}
|
|
97
|
-
boundary !== null && boundary !== void 0 ? boundary : (boundary = parsedBoundary);
|
|
98
|
-
if (boundary) {
|
|
99
|
-
assertValidBoundary(boundary);
|
|
100
|
-
}
|
|
101
|
-
else {
|
|
102
|
-
boundary = generateBoundary();
|
|
16
|
+
sendRequest: async (request, next) => {
|
|
17
|
+
if (request.multipartBody) {
|
|
18
|
+
for (const part of request.multipartBody.parts) {
|
|
19
|
+
if (hasRawContent(part.body)) {
|
|
20
|
+
part.body = getRawContent(part.body);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
103
23
|
}
|
|
104
|
-
|
|
105
|
-
await buildRequestBody(request, request.multipartBody.parts, boundary);
|
|
106
|
-
request.multipartBody = undefined;
|
|
107
|
-
return next(request);
|
|
24
|
+
return tspPolicy.sendRequest(request, next);
|
|
108
25
|
},
|
|
109
26
|
};
|
|
110
27
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multipartPolicy.js","sourceRoot":"","sources":["../../../src/policies/multipartPolicy.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;
|
|
1
|
+
{"version":3,"file":"multipartPolicy.js","sourceRoot":"","sources":["../../../src/policies/multipartPolicy.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC,OAAO,EACL,mBAAmB,IAAI,sBAAsB,EAC7C,eAAe,IAAI,kBAAkB,GACtC,MAAM,6CAA6C,CAAC;AAKrD,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAE/D;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,sBAAsB,CAAC;AAE1D;;GAEG;AACH,MAAM,UAAU,eAAe;IAC7B,MAAM,SAAS,GAAG,kBAAkB,EAAE,CAAC;IAEvC,OAAO;QACL,IAAI,EAAE,mBAAmB;QACzB,WAAW,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;YACnC,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;gBAC1B,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;oBAC/C,IAAI,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;wBAC7B,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;oBACvC,CAAC;gBACH,CAAC;YACH,CAAC;YAED,OAAO,SAAS,CAAC,WAAW,CAAC,OAA6B,EAAE,IAAsB,CAAC,CAAC;QACtF,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { PipelinePolicy } from \"../pipeline.js\";\n\nimport {\n multipartPolicyName as tspMultipartPolicyName,\n multipartPolicy as tspMultipartPolicy,\n} from \"@typespec/ts-http-runtime/internal/policies\";\nimport type {\n PipelineRequest as TspPipelineRequest,\n SendRequest as TspSendRequest,\n} from \"@typespec/ts-http-runtime\";\nimport { getRawContent, hasRawContent } from \"../util/file.js\";\n\n/**\n * Name of multipart policy\n */\nexport const multipartPolicyName = tspMultipartPolicyName;\n\n/**\n * Pipeline policy for multipart requests\n */\nexport function multipartPolicy(): PipelinePolicy {\n const tspPolicy = tspMultipartPolicy();\n\n return {\n name: multipartPolicyName,\n sendRequest: async (request, next) => {\n if (request.multipartBody) {\n for (const part of request.multipartBody.parts) {\n if (hasRawContent(part.body)) {\n part.body = getRawContent(part.body);\n }\n }\n }\n\n return tspPolicy.sendRequest(request as TspPipelineRequest, next as TspSendRequest);\n },\n };\n}\n"]}
|
|
@@ -1,2 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import type { ProxySettings } from "../interfaces.js";
|
|
2
|
+
import type { PipelinePolicy } from "../pipeline.js";
|
|
3
|
+
/**
|
|
4
|
+
* The programmatic identifier of the proxyPolicy.
|
|
5
|
+
*/
|
|
6
|
+
export declare const proxyPolicyName = "proxyPolicy";
|
|
7
|
+
/**
|
|
8
|
+
* This method converts a proxy url into `ProxySettings` for use with ProxyPolicy.
|
|
9
|
+
* If no argument is given, it attempts to parse a proxy URL from the environment
|
|
10
|
+
* variables `HTTPS_PROXY` or `HTTP_PROXY`.
|
|
11
|
+
* @param proxyUrl - The url of the proxy to use. May contain authentication information.
|
|
12
|
+
* @deprecated - Internally this method is no longer necessary when setting proxy information.
|
|
13
|
+
*/
|
|
14
|
+
export declare function getDefaultProxySettings(proxyUrl?: string): ProxySettings | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* A policy that allows one to apply proxy settings to all requests.
|
|
17
|
+
* If not passed static settings, they will be retrieved from the HTTPS_PROXY
|
|
18
|
+
* or HTTP_PROXY environment variables.
|
|
19
|
+
* @param proxySettings - ProxySettings to use on each request.
|
|
20
|
+
* @param options - additional settings, for example, custom NO_PROXY patterns
|
|
21
|
+
*/
|
|
22
|
+
export declare function proxyPolicy(proxySettings?: ProxySettings, options?: {
|
|
23
|
+
/** a list of patterns to override those loaded from NO_PROXY environment variable. */
|
|
24
|
+
customNoProxyList?: string[];
|
|
25
|
+
}): PipelinePolicy;
|
|
26
|
+
//# sourceMappingURL=proxyPolicy.d.ts.map
|
|
@@ -1,4 +1,28 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import { proxyPolicy as tspProxyPolicy, proxyPolicyName as tspProxyPolicyName, getDefaultProxySettings as tspGetDefaultProxySettings, } from "@typespec/ts-http-runtime/internal/policies";
|
|
4
|
+
/**
|
|
5
|
+
* The programmatic identifier of the proxyPolicy.
|
|
6
|
+
*/
|
|
7
|
+
export const proxyPolicyName = tspProxyPolicyName;
|
|
8
|
+
/**
|
|
9
|
+
* This method converts a proxy url into `ProxySettings` for use with ProxyPolicy.
|
|
10
|
+
* If no argument is given, it attempts to parse a proxy URL from the environment
|
|
11
|
+
* variables `HTTPS_PROXY` or `HTTP_PROXY`.
|
|
12
|
+
* @param proxyUrl - The url of the proxy to use. May contain authentication information.
|
|
13
|
+
* @deprecated - Internally this method is no longer necessary when setting proxy information.
|
|
14
|
+
*/
|
|
15
|
+
export function getDefaultProxySettings(proxyUrl) {
|
|
16
|
+
return tspGetDefaultProxySettings(proxyUrl);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* A policy that allows one to apply proxy settings to all requests.
|
|
20
|
+
* If not passed static settings, they will be retrieved from the HTTPS_PROXY
|
|
21
|
+
* or HTTP_PROXY environment variables.
|
|
22
|
+
* @param proxySettings - ProxySettings to use on each request.
|
|
23
|
+
* @param options - additional settings, for example, custom NO_PROXY patterns
|
|
24
|
+
*/
|
|
25
|
+
export function proxyPolicy(proxySettings, options) {
|
|
26
|
+
return tspProxyPolicy(proxySettings, options);
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=proxyPolicy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proxyPolicy.js","sourceRoot":"","sources":["../../../src/policies/proxyPolicy.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAKlC,OAAO,EACL,WAAW,IAAI,cAAc,EAC7B,eAAe,IAAI,kBAAkB,EACrC,uBAAuB,IAAI,0BAA0B,GACtD,MAAM,6CAA6C,CAAC;AAErD;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,kBAAkB,CAAC;AAElD;;;;;;GAMG;AACH,MAAM,UAAU,uBAAuB,CAAC,QAAiB;IACvD,OAAO,0BAA0B,CAAC,QAAQ,CAAC,CAAC;AAC9C,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CACzB,aAA6B,EAC7B,OAGC;IAED,OAAO,cAAc,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;AAChD,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { ProxySettings } from \"../interfaces.js\";\nimport type { PipelinePolicy } from \"../pipeline.js\";\n\nimport {\n proxyPolicy as tspProxyPolicy,\n proxyPolicyName as tspProxyPolicyName,\n getDefaultProxySettings as tspGetDefaultProxySettings,\n} from \"@typespec/ts-http-runtime/internal/policies\";\n\n/**\n * The programmatic identifier of the proxyPolicy.\n */\nexport const proxyPolicyName = tspProxyPolicyName;\n\n/**\n * This method converts a proxy url into `ProxySettings` for use with ProxyPolicy.\n * If no argument is given, it attempts to parse a proxy URL from the environment\n * variables `HTTPS_PROXY` or `HTTP_PROXY`.\n * @param proxyUrl - The url of the proxy to use. May contain authentication information.\n * @deprecated - Internally this method is no longer necessary when setting proxy information.\n */\nexport function getDefaultProxySettings(proxyUrl?: string): ProxySettings | undefined {\n return tspGetDefaultProxySettings(proxyUrl);\n}\n\n/**\n * A policy that allows one to apply proxy settings to all requests.\n * If not passed static settings, they will be retrieved from the HTTPS_PROXY\n * or HTTP_PROXY environment variables.\n * @param proxySettings - ProxySettings to use on each request.\n * @param options - additional settings, for example, custom NO_PROXY patterns\n */\nexport function proxyPolicy(\n proxySettings?: ProxySettings,\n options?: {\n /** a list of patterns to override those loaded from NO_PROXY environment variable. */\n customNoProxyList?: string[];\n },\n): PipelinePolicy {\n return tspProxyPolicy(proxySettings, options);\n}\n"]}
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
|
+
import { redirectPolicyName as tspRedirectPolicyName, redirectPolicy as tspRedirectPolicy, } from "@typespec/ts-http-runtime/internal/policies";
|
|
3
4
|
/**
|
|
4
5
|
* The programmatic identifier of the redirectPolicy.
|
|
5
6
|
*/
|
|
6
|
-
export const redirectPolicyName =
|
|
7
|
-
/**
|
|
8
|
-
* Methods that are allowed to follow redirects 301 and 302
|
|
9
|
-
*/
|
|
10
|
-
const allowedRedirect = ["GET", "HEAD"];
|
|
7
|
+
export const redirectPolicyName = tspRedirectPolicyName;
|
|
11
8
|
/**
|
|
12
9
|
* A policy to follow Location headers from the server in order
|
|
13
10
|
* to support server-side redirection.
|
|
@@ -15,38 +12,6 @@ const allowedRedirect = ["GET", "HEAD"];
|
|
|
15
12
|
* @param options - Options to control policy behavior.
|
|
16
13
|
*/
|
|
17
14
|
export function redirectPolicy(options = {}) {
|
|
18
|
-
|
|
19
|
-
return {
|
|
20
|
-
name: redirectPolicyName,
|
|
21
|
-
async sendRequest(request, next) {
|
|
22
|
-
const response = await next(request);
|
|
23
|
-
return handleRedirect(next, response, maxRetries);
|
|
24
|
-
},
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
async function handleRedirect(next, response, maxRetries, currentRetries = 0) {
|
|
28
|
-
const { request, status, headers } = response;
|
|
29
|
-
const locationHeader = headers.get("location");
|
|
30
|
-
if (locationHeader &&
|
|
31
|
-
(status === 300 ||
|
|
32
|
-
(status === 301 && allowedRedirect.includes(request.method)) ||
|
|
33
|
-
(status === 302 && allowedRedirect.includes(request.method)) ||
|
|
34
|
-
(status === 303 && request.method === "POST") ||
|
|
35
|
-
status === 307) &&
|
|
36
|
-
currentRetries < maxRetries) {
|
|
37
|
-
const url = new URL(locationHeader, request.url);
|
|
38
|
-
request.url = url.toString();
|
|
39
|
-
// POST request with Status code 303 should be converted into a
|
|
40
|
-
// redirected GET request if the redirect url is present in the location header
|
|
41
|
-
if (status === 303) {
|
|
42
|
-
request.method = "GET";
|
|
43
|
-
request.headers.delete("Content-Length");
|
|
44
|
-
delete request.body;
|
|
45
|
-
}
|
|
46
|
-
request.headers.delete("Authorization");
|
|
47
|
-
const res = await next(request);
|
|
48
|
-
return handleRedirect(next, res, maxRetries, currentRetries + 1);
|
|
49
|
-
}
|
|
50
|
-
return response;
|
|
15
|
+
return tspRedirectPolicy(options);
|
|
51
16
|
}
|
|
52
17
|
//# sourceMappingURL=redirectPolicy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"redirectPolicy.js","sourceRoot":"","sources":["../../../src/policies/redirectPolicy.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;
|
|
1
|
+
{"version":3,"file":"redirectPolicy.js","sourceRoot":"","sources":["../../../src/policies/redirectPolicy.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC,OAAO,EACL,kBAAkB,IAAI,qBAAqB,EAC3C,cAAc,IAAI,iBAAiB,GACpC,MAAM,6CAA6C,CAAC;AAErD;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,qBAAqB,CAAC;AAaxD;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,UAAiC,EAAE;IAChE,OAAO,iBAAiB,CAAC,OAAO,CAAC,CAAC;AACpC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { PipelinePolicy } from \"../pipeline.js\";\n\nimport {\n redirectPolicyName as tspRedirectPolicyName,\n redirectPolicy as tspRedirectPolicy,\n} from \"@typespec/ts-http-runtime/internal/policies\";\n\n/**\n * The programmatic identifier of the redirectPolicy.\n */\nexport const redirectPolicyName = tspRedirectPolicyName;\n\n/**\n * Options for how redirect responses are handled.\n */\nexport interface RedirectPolicyOptions {\n /**\n * The maximum number of times the redirect URL will be tried before\n * failing. Defaults to 20.\n */\n maxRetries?: number;\n}\n\n/**\n * A policy to follow Location headers from the server in order\n * to support server-side redirection.\n * In the browser, this policy is not used.\n * @param options - Options to control policy behavior.\n */\nexport function redirectPolicy(options: RedirectPolicyOptions = {}): PipelinePolicy {\n return tspRedirectPolicy(options);\n}\n"]}
|
|
@@ -1,6 +1,64 @@
|
|
|
1
1
|
import type { PipelinePolicy } from "../pipeline.js";
|
|
2
2
|
import { type AzureLogger } from "@azure/logger";
|
|
3
|
-
import type {
|
|
3
|
+
import type { PipelineResponse } from "../interfaces.js";
|
|
4
|
+
import type { RestError } from "../restError.js";
|
|
5
|
+
/**
|
|
6
|
+
* Information provided to the retry strategy about the current progress of the retry policy.
|
|
7
|
+
*/
|
|
8
|
+
export interface RetryInformation {
|
|
9
|
+
/**
|
|
10
|
+
* A {@link PipelineResponse}, if the last retry attempt succeeded.
|
|
11
|
+
*/
|
|
12
|
+
response?: PipelineResponse;
|
|
13
|
+
/**
|
|
14
|
+
* A {@link RestError}, if the last retry attempt failed.
|
|
15
|
+
*/
|
|
16
|
+
responseError?: RestError;
|
|
17
|
+
/**
|
|
18
|
+
* Total number of retries so far.
|
|
19
|
+
*/
|
|
20
|
+
retryCount: number;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Properties that can modify the behavior of the retry policy.
|
|
24
|
+
*/
|
|
25
|
+
export interface RetryModifiers {
|
|
26
|
+
/**
|
|
27
|
+
* If true, allows skipping the current strategy from running on the retry policy.
|
|
28
|
+
*/
|
|
29
|
+
skipStrategy?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Indicates to retry against this URL.
|
|
32
|
+
*/
|
|
33
|
+
redirectTo?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Controls whether to retry in a given number of milliseconds.
|
|
36
|
+
* If provided, a new retry will be attempted.
|
|
37
|
+
*/
|
|
38
|
+
retryAfterInMs?: number;
|
|
39
|
+
/**
|
|
40
|
+
* Indicates to throw this error instead of retrying.
|
|
41
|
+
*/
|
|
42
|
+
errorToThrow?: RestError;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* A retry strategy is intended to define whether to retry or not, and how to retry.
|
|
46
|
+
*/
|
|
47
|
+
export interface RetryStrategy {
|
|
48
|
+
/**
|
|
49
|
+
* Name of the retry strategy. Used for logging.
|
|
50
|
+
*/
|
|
51
|
+
name: string;
|
|
52
|
+
/**
|
|
53
|
+
* Logger. If it's not provided, a default logger for all retry strategies is used.
|
|
54
|
+
*/
|
|
55
|
+
logger?: AzureLogger;
|
|
56
|
+
/**
|
|
57
|
+
* Function that determines how to proceed with the subsequent requests.
|
|
58
|
+
* @param state - Retry state
|
|
59
|
+
*/
|
|
60
|
+
retry(state: RetryInformation): RetryModifiers;
|
|
61
|
+
}
|
|
4
62
|
/**
|
|
5
63
|
* Options to the {@link retryPolicy}
|
|
6
64
|
*/
|
|
@@ -1,105 +1,16 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
|
-
import { delay } from "../util/helpers.js";
|
|
4
3
|
import { createClientLogger } from "@azure/logger";
|
|
5
|
-
import { AbortError } from "@azure/abort-controller";
|
|
6
4
|
import { DEFAULT_RETRY_POLICY_COUNT } from "../constants.js";
|
|
5
|
+
import { retryPolicy as tspRetryPolicy, } from "@typespec/ts-http-runtime/internal/policies";
|
|
7
6
|
const retryPolicyLogger = createClientLogger("core-rest-pipeline retryPolicy");
|
|
8
|
-
/**
|
|
9
|
-
* The programmatic identifier of the retryPolicy.
|
|
10
|
-
*/
|
|
11
|
-
const retryPolicyName = "retryPolicy";
|
|
12
7
|
/**
|
|
13
8
|
* retryPolicy is a generic policy to enable retrying requests when certain conditions are met
|
|
14
9
|
*/
|
|
15
10
|
export function retryPolicy(strategies, options = { maxRetries: DEFAULT_RETRY_POLICY_COUNT }) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
var _a, _b;
|
|
21
|
-
let response;
|
|
22
|
-
let responseError;
|
|
23
|
-
let retryCount = -1;
|
|
24
|
-
retryRequest: while (true) {
|
|
25
|
-
retryCount += 1;
|
|
26
|
-
response = undefined;
|
|
27
|
-
responseError = undefined;
|
|
28
|
-
try {
|
|
29
|
-
logger.info(`Retry ${retryCount}: Attempting to send request`, request.requestId);
|
|
30
|
-
response = await next(request);
|
|
31
|
-
logger.info(`Retry ${retryCount}: Received a response from request`, request.requestId);
|
|
32
|
-
}
|
|
33
|
-
catch (e) {
|
|
34
|
-
logger.error(`Retry ${retryCount}: Received an error from request`, request.requestId);
|
|
35
|
-
// RestErrors are valid targets for the retry strategies.
|
|
36
|
-
// If none of the retry strategies can work with them, they will be thrown later in this policy.
|
|
37
|
-
// If the received error is not a RestError, it is immediately thrown.
|
|
38
|
-
responseError = e;
|
|
39
|
-
if (!e || responseError.name !== "RestError") {
|
|
40
|
-
throw e;
|
|
41
|
-
}
|
|
42
|
-
response = responseError.response;
|
|
43
|
-
}
|
|
44
|
-
if ((_a = request.abortSignal) === null || _a === void 0 ? void 0 : _a.aborted) {
|
|
45
|
-
logger.error(`Retry ${retryCount}: Request aborted.`);
|
|
46
|
-
const abortError = new AbortError();
|
|
47
|
-
throw abortError;
|
|
48
|
-
}
|
|
49
|
-
if (retryCount >= ((_b = options.maxRetries) !== null && _b !== void 0 ? _b : DEFAULT_RETRY_POLICY_COUNT)) {
|
|
50
|
-
logger.info(`Retry ${retryCount}: Maximum retries reached. Returning the last received response, or throwing the last received error.`);
|
|
51
|
-
if (responseError) {
|
|
52
|
-
throw responseError;
|
|
53
|
-
}
|
|
54
|
-
else if (response) {
|
|
55
|
-
return response;
|
|
56
|
-
}
|
|
57
|
-
else {
|
|
58
|
-
throw new Error("Maximum retries reached with no response or error to throw");
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
logger.info(`Retry ${retryCount}: Processing ${strategies.length} retry strategies.`);
|
|
62
|
-
strategiesLoop: for (const strategy of strategies) {
|
|
63
|
-
const strategyLogger = strategy.logger || retryPolicyLogger;
|
|
64
|
-
strategyLogger.info(`Retry ${retryCount}: Processing retry strategy ${strategy.name}.`);
|
|
65
|
-
const modifiers = strategy.retry({
|
|
66
|
-
retryCount,
|
|
67
|
-
response,
|
|
68
|
-
responseError,
|
|
69
|
-
});
|
|
70
|
-
if (modifiers.skipStrategy) {
|
|
71
|
-
strategyLogger.info(`Retry ${retryCount}: Skipped.`);
|
|
72
|
-
continue strategiesLoop;
|
|
73
|
-
}
|
|
74
|
-
const { errorToThrow, retryAfterInMs, redirectTo } = modifiers;
|
|
75
|
-
if (errorToThrow) {
|
|
76
|
-
strategyLogger.error(`Retry ${retryCount}: Retry strategy ${strategy.name} throws error:`, errorToThrow);
|
|
77
|
-
throw errorToThrow;
|
|
78
|
-
}
|
|
79
|
-
if (retryAfterInMs || retryAfterInMs === 0) {
|
|
80
|
-
strategyLogger.info(`Retry ${retryCount}: Retry strategy ${strategy.name} retries after ${retryAfterInMs}`);
|
|
81
|
-
await delay(retryAfterInMs, undefined, { abortSignal: request.abortSignal });
|
|
82
|
-
continue retryRequest;
|
|
83
|
-
}
|
|
84
|
-
if (redirectTo) {
|
|
85
|
-
strategyLogger.info(`Retry ${retryCount}: Retry strategy ${strategy.name} redirects to ${redirectTo}`);
|
|
86
|
-
request.url = redirectTo;
|
|
87
|
-
continue retryRequest;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
if (responseError) {
|
|
91
|
-
logger.info(`None of the retry strategies could work with the received error. Throwing it.`);
|
|
92
|
-
throw responseError;
|
|
93
|
-
}
|
|
94
|
-
if (response) {
|
|
95
|
-
logger.info(`None of the retry strategies could work with the received response. Returning it.`);
|
|
96
|
-
return response;
|
|
97
|
-
}
|
|
98
|
-
// If all the retries skip and there's no response,
|
|
99
|
-
// we're still in the retry loop, so a new request will be sent
|
|
100
|
-
// until `maxRetries` is reached.
|
|
101
|
-
}
|
|
102
|
-
},
|
|
103
|
-
};
|
|
11
|
+
// Cast is required since the TSP runtime retry strategy type is slightly different
|
|
12
|
+
// very deep down (using real AbortSignal vs. AbortSignalLike in RestError).
|
|
13
|
+
// In practice the difference doesn't actually matter.
|
|
14
|
+
return tspRetryPolicy(strategies, Object.assign({ logger: retryPolicyLogger }, options));
|
|
104
15
|
}
|
|
105
16
|
//# sourceMappingURL=retryPolicy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retryPolicy.js","sourceRoot":"","sources":["../../../src/policies/retryPolicy.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;
|
|
1
|
+
{"version":3,"file":"retryPolicy.js","sourceRoot":"","sources":["../../../src/policies/retryPolicy.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAoB,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACrE,OAAO,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAE7D,OAAO,EACL,WAAW,IAAI,cAAc,GAE9B,MAAM,6CAA6C,CAAC;AAIrD,MAAM,iBAAiB,GAAG,kBAAkB,CAAC,gCAAgC,CAAC,CAAC;AA4E/E;;GAEG;AACH,MAAM,UAAU,WAAW,CACzB,UAA2B,EAC3B,UAA8B,EAAE,UAAU,EAAE,0BAA0B,EAAE;IAExE,mFAAmF;IACnF,4EAA4E;IAC5E,sDAAsD;IACtD,OAAO,cAAc,CAAC,UAAgC,kBACpD,MAAM,EAAE,iBAAiB,IACtB,OAAO,EACV,CAAC;AACL,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { PipelinePolicy } from \"../pipeline.js\";\nimport { type AzureLogger, createClientLogger } from \"@azure/logger\";\nimport { DEFAULT_RETRY_POLICY_COUNT } from \"../constants.js\";\n\nimport {\n retryPolicy as tspRetryPolicy,\n type RetryStrategy as TspRetryStrategy,\n} from \"@typespec/ts-http-runtime/internal/policies\";\nimport type { PipelineResponse } from \"../interfaces.js\";\nimport type { RestError } from \"../restError.js\";\n\nconst retryPolicyLogger = createClientLogger(\"core-rest-pipeline retryPolicy\");\n\n/**\n * Information provided to the retry strategy about the current progress of the retry policy.\n */\nexport interface RetryInformation {\n /**\n * A {@link PipelineResponse}, if the last retry attempt succeeded.\n */\n response?: PipelineResponse;\n /**\n * A {@link RestError}, if the last retry attempt failed.\n */\n responseError?: RestError;\n /**\n * Total number of retries so far.\n */\n retryCount: number;\n}\n\n/**\n * Properties that can modify the behavior of the retry policy.\n */\nexport interface RetryModifiers {\n /**\n * If true, allows skipping the current strategy from running on the retry policy.\n */\n skipStrategy?: boolean;\n /**\n * Indicates to retry against this URL.\n */\n redirectTo?: string;\n /**\n * Controls whether to retry in a given number of milliseconds.\n * If provided, a new retry will be attempted.\n */\n retryAfterInMs?: number;\n /**\n * Indicates to throw this error instead of retrying.\n */\n errorToThrow?: RestError;\n}\n\n/**\n * A retry strategy is intended to define whether to retry or not, and how to retry.\n */\nexport interface RetryStrategy {\n /**\n * Name of the retry strategy. Used for logging.\n */\n name: string;\n /**\n * Logger. If it's not provided, a default logger for all retry strategies is used.\n */\n logger?: AzureLogger;\n /**\n * Function that determines how to proceed with the subsequent requests.\n * @param state - Retry state\n */\n retry(state: RetryInformation): RetryModifiers;\n}\n\n/**\n * Options to the {@link retryPolicy}\n */\nexport interface RetryPolicyOptions {\n /**\n * Maximum number of retries. If not specified, it will limit to 3 retries.\n */\n maxRetries?: number;\n /**\n * Logger. If it's not provided, a default logger is used.\n */\n logger?: AzureLogger;\n}\n\n/**\n * retryPolicy is a generic policy to enable retrying requests when certain conditions are met\n */\nexport function retryPolicy(\n strategies: RetryStrategy[],\n options: RetryPolicyOptions = { maxRetries: DEFAULT_RETRY_POLICY_COUNT },\n): PipelinePolicy {\n // Cast is required since the TSP runtime retry strategy type is slightly different\n // very deep down (using real AbortSignal vs. AbortSignalLike in RestError).\n // In practice the difference doesn't actually matter.\n return tspRetryPolicy(strategies as TspRetryStrategy[], {\n logger: retryPolicyLogger,\n ...options,\n });\n}\n"]}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
|
-
import {
|
|
4
|
-
import { retryPolicy } from "./retryPolicy.js";
|
|
5
|
-
import { DEFAULT_RETRY_POLICY_COUNT } from "../constants.js";
|
|
3
|
+
import { systemErrorRetryPolicy as tspSystemErrorRetryPolicy, systemErrorRetryPolicyName as tspSystemErrorRetryPolicyName, } from "@typespec/ts-http-runtime/internal/policies";
|
|
6
4
|
/**
|
|
7
5
|
* Name of the {@link systemErrorRetryPolicy}
|
|
8
6
|
*/
|
|
9
|
-
export const systemErrorRetryPolicyName =
|
|
7
|
+
export const systemErrorRetryPolicyName = tspSystemErrorRetryPolicyName;
|
|
10
8
|
/**
|
|
11
9
|
* A retry policy that specifically seeks to handle errors in the
|
|
12
10
|
* underlying transport layer (e.g. DNS lookup failures) rather than
|
|
@@ -14,14 +12,6 @@ export const systemErrorRetryPolicyName = "systemErrorRetryPolicy";
|
|
|
14
12
|
* @param options - Options that customize the policy.
|
|
15
13
|
*/
|
|
16
14
|
export function systemErrorRetryPolicy(options = {}) {
|
|
17
|
-
|
|
18
|
-
return {
|
|
19
|
-
name: systemErrorRetryPolicyName,
|
|
20
|
-
sendRequest: retryPolicy([
|
|
21
|
-
exponentialRetryStrategy(Object.assign(Object.assign({}, options), { ignoreHttpStatusCodes: true })),
|
|
22
|
-
], {
|
|
23
|
-
maxRetries: (_a = options.maxRetries) !== null && _a !== void 0 ? _a : DEFAULT_RETRY_POLICY_COUNT,
|
|
24
|
-
}).sendRequest,
|
|
25
|
-
};
|
|
15
|
+
return tspSystemErrorRetryPolicy(options);
|
|
26
16
|
}
|
|
27
17
|
//# sourceMappingURL=systemErrorRetryPolicy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"systemErrorRetryPolicy.js","sourceRoot":"","sources":["../../../src/policies/systemErrorRetryPolicy.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;
|
|
1
|
+
{"version":3,"file":"systemErrorRetryPolicy.js","sourceRoot":"","sources":["../../../src/policies/systemErrorRetryPolicy.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC,OAAO,EACL,sBAAsB,IAAI,yBAAyB,EACnD,0BAA0B,IAAI,6BAA6B,GAC5D,MAAM,6CAA6C,CAAC;AAErD;;GAEG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,6BAA6B,CAAC;AAyBxE;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CACpC,UAAyC,EAAE;IAE3C,OAAO,yBAAyB,CAAC,OAAO,CAAC,CAAC;AAC5C,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { PipelinePolicy } from \"../pipeline.js\";\n\nimport {\n systemErrorRetryPolicy as tspSystemErrorRetryPolicy,\n systemErrorRetryPolicyName as tspSystemErrorRetryPolicyName,\n} from \"@typespec/ts-http-runtime/internal/policies\";\n\n/**\n * Name of the {@link systemErrorRetryPolicy}\n */\nexport const systemErrorRetryPolicyName = tspSystemErrorRetryPolicyName;\n\n/**\n * Options that control how to retry failed requests.\n */\nexport interface SystemErrorRetryPolicyOptions {\n /**\n * The maximum number of retry attempts. Defaults to 3.\n */\n maxRetries?: number;\n\n /**\n * The amount of delay in milliseconds between retry attempts. Defaults to 1000\n * (1 second.) The delay increases exponentially with each retry up to a maximum\n * specified by maxRetryDelayInMs.\n */\n retryDelayInMs?: number;\n\n /**\n * The maximum delay in milliseconds allowed before retrying an operation. Defaults\n * to 64000 (64 seconds).\n */\n maxRetryDelayInMs?: number;\n}\n\n/**\n * A retry policy that specifically seeks to handle errors in the\n * underlying transport layer (e.g. DNS lookup failures) rather than\n * retryable error codes from the server itself.\n * @param options - Options that customize the policy.\n */\nexport function systemErrorRetryPolicy(\n options: SystemErrorRetryPolicyOptions = {},\n): PipelinePolicy {\n return tspSystemErrorRetryPolicy(options);\n}\n"]}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
|
-
import {
|
|
4
|
-
import { retryPolicy } from "./retryPolicy.js";
|
|
5
|
-
import { DEFAULT_RETRY_POLICY_COUNT } from "../constants.js";
|
|
3
|
+
import { throttlingRetryPolicyName as tspThrottlingRetryPolicyName, throttlingRetryPolicy as tspThrottlingRetryPolicy, } from "@typespec/ts-http-runtime/internal/policies";
|
|
6
4
|
/**
|
|
7
5
|
* Name of the {@link throttlingRetryPolicy}
|
|
8
6
|
*/
|
|
9
|
-
export const throttlingRetryPolicyName =
|
|
7
|
+
export const throttlingRetryPolicyName = tspThrottlingRetryPolicyName;
|
|
10
8
|
/**
|
|
11
9
|
* A policy that retries when the server sends a 429 response with a Retry-After header.
|
|
12
10
|
*
|
|
@@ -18,12 +16,6 @@ export const throttlingRetryPolicyName = "throttlingRetryPolicy";
|
|
|
18
16
|
* @param options - Options that configure retry logic.
|
|
19
17
|
*/
|
|
20
18
|
export function throttlingRetryPolicy(options = {}) {
|
|
21
|
-
|
|
22
|
-
return {
|
|
23
|
-
name: throttlingRetryPolicyName,
|
|
24
|
-
sendRequest: retryPolicy([throttlingRetryStrategy()], {
|
|
25
|
-
maxRetries: (_a = options.maxRetries) !== null && _a !== void 0 ? _a : DEFAULT_RETRY_POLICY_COUNT,
|
|
26
|
-
}).sendRequest,
|
|
27
|
-
};
|
|
19
|
+
return tspThrottlingRetryPolicy(options);
|
|
28
20
|
}
|
|
29
21
|
//# sourceMappingURL=throttlingRetryPolicy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"throttlingRetryPolicy.js","sourceRoot":"","sources":["../../../src/policies/throttlingRetryPolicy.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;
|
|
1
|
+
{"version":3,"file":"throttlingRetryPolicy.js","sourceRoot":"","sources":["../../../src/policies/throttlingRetryPolicy.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC,OAAO,EACL,yBAAyB,IAAI,4BAA4B,EACzD,qBAAqB,IAAI,wBAAwB,GAClD,MAAM,6CAA6C,CAAC;AAErD;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,4BAA4B,CAAC;AAYtE;;;;;;;;;GASG;AACH,MAAM,UAAU,qBAAqB,CAAC,UAAwC,EAAE;IAC9E,OAAO,wBAAwB,CAAC,OAAO,CAAC,CAAC;AAC3C,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { PipelinePolicy } from \"../pipeline.js\";\n\nimport {\n throttlingRetryPolicyName as tspThrottlingRetryPolicyName,\n throttlingRetryPolicy as tspThrottlingRetryPolicy,\n} from \"@typespec/ts-http-runtime/internal/policies\";\n\n/**\n * Name of the {@link throttlingRetryPolicy}\n */\nexport const throttlingRetryPolicyName = tspThrottlingRetryPolicyName;\n\n/**\n * Options that control how to retry failed requests.\n */\nexport interface ThrottlingRetryPolicyOptions {\n /**\n * The maximum number of retry attempts. Defaults to 3.\n */\n maxRetries?: number;\n}\n\n/**\n * A policy that retries when the server sends a 429 response with a Retry-After header.\n *\n * To learn more, please refer to\n * https://learn.microsoft.com/en-us/azure/azure-resource-manager/resource-manager-request-limits,\n * https://learn.microsoft.com/en-us/azure/azure-subscription-service-limits and\n * https://learn.microsoft.com/en-us/azure/virtual-machines/troubleshooting/troubleshooting-throttling-errors\n *\n * @param options - Options that configure retry logic.\n */\nexport function throttlingRetryPolicy(options: ThrottlingRetryPolicyOptions = {}): PipelinePolicy {\n return tspThrottlingRetryPolicy(options);\n}\n"]}
|