@azure/core-rest-pipeline 1.19.2-alpha.20250418.1 → 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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,MAAM,CAAC,MAAM,WAAW,GAAW,QAAQ,CAAC;AAE5C,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport const SDK_VERSION: string = \"1.
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,MAAM,CAAC,MAAM,WAAW,GAAW,QAAQ,CAAC;AAE5C,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport const SDK_VERSION: string = \"1.20.0\";\n\nexport const DEFAULT_RETRY_POLICY_COUNT = 3;\n"]}
|
|
@@ -14,6 +14,7 @@ import { setClientRequestIdPolicy } from "./policies/setClientRequestIdPolicy.js
|
|
|
14
14
|
import { agentPolicy } from "./policies/agentPolicy.js";
|
|
15
15
|
import { tlsPolicy } from "./policies/tlsPolicy.js";
|
|
16
16
|
import { tracingPolicy } from "./policies/tracingPolicy.js";
|
|
17
|
+
import { wrapAbortSignalLikePolicy } from "./policies/wrapAbortSignalLikePolicy.js";
|
|
17
18
|
/**
|
|
18
19
|
* Create a new pipeline with a default set of customizable policies.
|
|
19
20
|
* @param options - Options to configure a custom pipeline.
|
|
@@ -31,6 +32,7 @@ export function createPipelineFromOptions(options) {
|
|
|
31
32
|
pipeline.addPolicy(proxyPolicy(options.proxyOptions));
|
|
32
33
|
pipeline.addPolicy(decompressResponsePolicy());
|
|
33
34
|
}
|
|
35
|
+
pipeline.addPolicy(wrapAbortSignalLikePolicy());
|
|
34
36
|
pipeline.addPolicy(formDataPolicy(), { beforePolicies: [multipartPolicyName] });
|
|
35
37
|
pipeline.addPolicy(userAgentPolicy(options.userAgentOptions));
|
|
36
38
|
pipeline.addPolicy(setClientRequestIdPolicy((_a = options.telemetryOptions) === null || _a === void 0 ? void 0 : _a.clientRequestIdHeaderName));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createPipelineFromOptions.js","sourceRoot":"","sources":["../../src/createPipelineFromOptions.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAyB,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAiB,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEnE,OAAO,EAA8B,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC1F,OAAO,EAA+B,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAC7F,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACrF,OAAO,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AAClF,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AAClF,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"createPipelineFromOptions.js","sourceRoot":"","sources":["../../src/createPipelineFromOptions.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAyB,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAiB,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEnE,OAAO,EAA8B,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC1F,OAAO,EAA+B,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAC7F,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACrF,OAAO,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AAClF,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AAClF,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AA4DpF;;;GAGG;AACH,MAAM,UAAU,yBAAyB,CAAC,OAAgC;;IACxE,MAAM,QAAQ,GAAG,mBAAmB,EAAE,CAAC;IAEvC,IAAI,UAAU,EAAE,CAAC;QACf,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;YAClB,QAAQ,CAAC,SAAS,CAAC,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;QACjD,CAAC;QACD,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;YACvB,QAAQ,CAAC,SAAS,CAAC,SAAS,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC;QACpD,CAAC;QACD,QAAQ,CAAC,SAAS,CAAC,WAAW,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC;QACtD,QAAQ,CAAC,SAAS,CAAC,wBAAwB,EAAE,CAAC,CAAC;IACjD,CAAC;IAED,QAAQ,CAAC,SAAS,CAAC,yBAAyB,EAAE,CAAC,CAAC;IAEhD,QAAQ,CAAC,SAAS,CAAC,cAAc,EAAE,EAAE,EAAE,cAAc,EAAE,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAAC;IAChF,QAAQ,CAAC,SAAS,CAAC,eAAe,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAC9D,QAAQ,CAAC,SAAS,CAAC,wBAAwB,CAAC,MAAA,OAAO,CAAC,gBAAgB,0CAAE,yBAAyB,CAAC,CAAC,CAAC;IAClG,sEAAsE;IACtE,gEAAgE;IAChE,qEAAqE;IACrE,QAAQ,CAAC,SAAS,CAAC,eAAe,EAAE,EAAE,EAAE,UAAU,EAAE,aAAa,EAAE,CAAC,CAAC;IACrE,QAAQ,CAAC,SAAS,CAAC,kBAAkB,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;IACjF,QAAQ,CAAC,SAAS,CAAC,aAAa,iCAAM,OAAO,CAAC,gBAAgB,GAAK,OAAO,CAAC,cAAc,EAAG,EAAE;QAC5F,UAAU,EAAE,OAAO;KACpB,CAAC,CAAC;IACH,IAAI,UAAU,EAAE,CAAC;QACf,+DAA+D;QAC/D,kDAAkD;QAClD,QAAQ,CAAC,SAAS,CAAC,cAAc,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC,CAAC;IACvF,CAAC;IACD,QAAQ,CAAC,SAAS,CAAC,SAAS,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,CAAC;IAE9E,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { type LogPolicyOptions, logPolicy } from \"./policies/logPolicy.js\";\nimport { type Pipeline, createEmptyPipeline } from \"./pipeline.js\";\nimport type { Agent, PipelineRetryOptions, ProxySettings, TlsSettings } from \"./interfaces.js\";\nimport { type RedirectPolicyOptions, redirectPolicy } from \"./policies/redirectPolicy.js\";\nimport { type UserAgentPolicyOptions, userAgentPolicy } from \"./policies/userAgentPolicy.js\";\nimport { multipartPolicy, multipartPolicyName } from \"./policies/multipartPolicy.js\";\nimport { decompressResponsePolicy } from \"./policies/decompressResponsePolicy.js\";\nimport { defaultRetryPolicy } from \"./policies/defaultRetryPolicy.js\";\nimport { formDataPolicy } from \"./policies/formDataPolicy.js\";\nimport { isNodeLike } from \"@azure/core-util\";\nimport { proxyPolicy } from \"./policies/proxyPolicy.js\";\nimport { setClientRequestIdPolicy } from \"./policies/setClientRequestIdPolicy.js\";\nimport { agentPolicy } from \"./policies/agentPolicy.js\";\nimport { tlsPolicy } from \"./policies/tlsPolicy.js\";\nimport { tracingPolicy } from \"./policies/tracingPolicy.js\";\nimport { wrapAbortSignalLikePolicy } from \"./policies/wrapAbortSignalLikePolicy.js\";\n\n/**\n * Defines options that are used to configure the HTTP pipeline for\n * an SDK client.\n */\nexport interface PipelineOptions {\n /**\n * Options that control how to retry failed requests.\n */\n retryOptions?: PipelineRetryOptions;\n\n /**\n * Options to configure a proxy for outgoing requests.\n */\n proxyOptions?: ProxySettings;\n\n /** Options for configuring Agent instance for outgoing requests */\n agent?: Agent;\n\n /** Options for configuring TLS authentication */\n tlsOptions?: TlsSettings;\n\n /**\n * Options for how redirect responses are handled.\n */\n redirectOptions?: RedirectPolicyOptions;\n\n /**\n * Options for adding user agent details to outgoing requests.\n */\n userAgentOptions?: UserAgentPolicyOptions;\n\n /**\n * Options for setting common telemetry and tracing info to outgoing requests.\n */\n telemetryOptions?: TelemetryOptions;\n}\n\n/**\n * Defines options that are used to configure common telemetry and tracing info\n */\nexport interface TelemetryOptions {\n /**\n * The name of the header to pass the request ID to.\n */\n clientRequestIdHeaderName?: string;\n}\n\n/**\n * Defines options that are used to configure internal options of\n * the HTTP pipeline for an SDK client.\n */\nexport interface InternalPipelineOptions extends PipelineOptions {\n /**\n * Options to configure request/response logging.\n */\n loggingOptions?: LogPolicyOptions;\n}\n\n/**\n * Create a new pipeline with a default set of customizable policies.\n * @param options - Options to configure a custom pipeline.\n */\nexport function createPipelineFromOptions(options: InternalPipelineOptions): Pipeline {\n const pipeline = createEmptyPipeline();\n\n if (isNodeLike) {\n if (options.agent) {\n pipeline.addPolicy(agentPolicy(options.agent));\n }\n if (options.tlsOptions) {\n pipeline.addPolicy(tlsPolicy(options.tlsOptions));\n }\n pipeline.addPolicy(proxyPolicy(options.proxyOptions));\n pipeline.addPolicy(decompressResponsePolicy());\n }\n\n pipeline.addPolicy(wrapAbortSignalLikePolicy());\n\n pipeline.addPolicy(formDataPolicy(), { beforePolicies: [multipartPolicyName] });\n pipeline.addPolicy(userAgentPolicy(options.userAgentOptions));\n pipeline.addPolicy(setClientRequestIdPolicy(options.telemetryOptions?.clientRequestIdHeaderName));\n // The multipart policy is added after policies with no phase, so that\n // policies can be added between it and formDataPolicy to modify\n // properties (e.g., making the boundary constant in recorded tests).\n pipeline.addPolicy(multipartPolicy(), { afterPhase: \"Deserialize\" });\n pipeline.addPolicy(defaultRetryPolicy(options.retryOptions), { phase: \"Retry\" });\n pipeline.addPolicy(tracingPolicy({ ...options.userAgentOptions, ...options.loggingOptions }), {\n afterPhase: \"Retry\",\n });\n if (isNodeLike) {\n // Both XHR and Fetch expect to handle redirects automatically,\n // so only include this policy when we're in Node.\n pipeline.addPolicy(redirectPolicy(options.redirectOptions), { afterPhase: \"Retry\" });\n }\n pipeline.addPolicy(logPolicy(options.loggingOptions), { afterPhase: \"Sign\" });\n\n return pipeline;\n}\n"]}
|
|
@@ -3,4 +3,4 @@ import type { HttpClient } from "./interfaces.js";
|
|
|
3
3
|
* Create the correct HttpClient for the current environment.
|
|
4
4
|
*/
|
|
5
5
|
export declare function createDefaultHttpClient(): HttpClient;
|
|
6
|
-
//# sourceMappingURL=defaultHttpClient
|
|
6
|
+
//# sourceMappingURL=defaultHttpClient.d.ts.map
|
|
@@ -1,10 +1,28 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
|
-
import {
|
|
3
|
+
import { createDefaultHttpClient as tspCreateDefaultHttpClient } from "@typespec/ts-http-runtime";
|
|
4
|
+
import { wrapAbortSignalLike } from "./util/wrapAbortSignal.js";
|
|
4
5
|
/**
|
|
5
6
|
* Create the correct HttpClient for the current environment.
|
|
6
7
|
*/
|
|
7
8
|
export function createDefaultHttpClient() {
|
|
8
|
-
|
|
9
|
+
const client = tspCreateDefaultHttpClient();
|
|
10
|
+
return {
|
|
11
|
+
async sendRequest(request) {
|
|
12
|
+
// we wrap any AbortSignalLike here since the TypeSpec runtime expects a native AbortSignal.
|
|
13
|
+
// 99% of the time, this should be a no-op since a native AbortSignal is passed in.
|
|
14
|
+
const { abortSignal, cleanup } = request.abortSignal
|
|
15
|
+
? wrapAbortSignalLike(request.abortSignal)
|
|
16
|
+
: {};
|
|
17
|
+
try {
|
|
18
|
+
// eslint-disable-next-line no-param-reassign
|
|
19
|
+
request.abortSignal = abortSignal;
|
|
20
|
+
return await client.sendRequest(request);
|
|
21
|
+
}
|
|
22
|
+
finally {
|
|
23
|
+
cleanup === null || cleanup === void 0 ? void 0 : cleanup();
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
};
|
|
9
27
|
}
|
|
10
|
-
//# sourceMappingURL=defaultHttpClient
|
|
28
|
+
//# sourceMappingURL=defaultHttpClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaultHttpClient.js","sourceRoot":"","sources":["../../src/defaultHttpClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,uBAAuB,IAAI,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AAClG,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAGhE;;GAEG;AACH,MAAM,UAAU,uBAAuB;IACrC,MAAM,MAAM,GAAG,0BAA0B,EAAE,CAAC;IAC5C,OAAO;QACL,KAAK,CAAC,WAAW,CAAC,OAAO;YACvB,4FAA4F;YAC5F,mFAAmF;YACnF,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,WAAW;gBAClD,CAAC,CAAC,mBAAmB,CAAC,OAAO,CAAC,WAAW,CAAC;gBAC1C,CAAC,CAAC,EAAE,CAAC;YACP,IAAI,CAAC;gBACH,6CAA6C;gBAC7C,OAAO,CAAC,WAAW,GAAG,WAAW,CAAC;gBAClC,OAAO,MAAM,MAAM,CAAC,WAAW,CAAC,OAA6B,CAAC,CAAC;YACjE,CAAC;oBAAS,CAAC;gBACT,OAAO,aAAP,OAAO,uBAAP,OAAO,EAAI,CAAC;YACd,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { HttpClient } from \"./interfaces.js\";\nimport { createDefaultHttpClient as tspCreateDefaultHttpClient } from \"@typespec/ts-http-runtime\";\nimport { wrapAbortSignalLike } from \"./util/wrapAbortSignal.js\";\nimport { type PipelineRequest as TspPipelineRequest } from \"@typespec/ts-http-runtime\";\n\n/**\n * Create the correct HttpClient for the current environment.\n */\nexport function createDefaultHttpClient(): HttpClient {\n const client = tspCreateDefaultHttpClient();\n return {\n async sendRequest(request) {\n // we wrap any AbortSignalLike here since the TypeSpec runtime expects a native AbortSignal.\n // 99% of the time, this should be a no-op since a native AbortSignal is passed in.\n const { abortSignal, cleanup } = request.abortSignal\n ? wrapAbortSignalLike(request.abortSignal)\n : {};\n try {\n // eslint-disable-next-line no-param-reassign\n request.abortSignal = abortSignal;\n return await client.sendRequest(request as TspPipelineRequest);\n } finally {\n cleanup?.();\n }\n },\n };\n}\n"]}
|
|
@@ -1,89 +1,11 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
|
-
|
|
4
|
-
return name.toLowerCase();
|
|
5
|
-
}
|
|
6
|
-
function* headerIterator(map) {
|
|
7
|
-
for (const entry of map.values()) {
|
|
8
|
-
yield [entry.name, entry.value];
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
class HttpHeadersImpl {
|
|
12
|
-
constructor(rawHeaders) {
|
|
13
|
-
this._headersMap = new Map();
|
|
14
|
-
if (rawHeaders) {
|
|
15
|
-
for (const headerName of Object.keys(rawHeaders)) {
|
|
16
|
-
this.set(headerName, rawHeaders[headerName]);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Set a header in this collection with the provided name and value. The name is
|
|
22
|
-
* case-insensitive.
|
|
23
|
-
* @param name - The name of the header to set. This value is case-insensitive.
|
|
24
|
-
* @param value - The value of the header to set.
|
|
25
|
-
*/
|
|
26
|
-
set(name, value) {
|
|
27
|
-
this._headersMap.set(normalizeName(name), { name, value: String(value).trim() });
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Get the header value for the provided header name, or undefined if no header exists in this
|
|
31
|
-
* collection with the provided name.
|
|
32
|
-
* @param name - The name of the header. This value is case-insensitive.
|
|
33
|
-
*/
|
|
34
|
-
get(name) {
|
|
35
|
-
var _a;
|
|
36
|
-
return (_a = this._headersMap.get(normalizeName(name))) === null || _a === void 0 ? void 0 : _a.value;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Get whether or not this header collection contains a header entry for the provided header name.
|
|
40
|
-
* @param name - The name of the header to set. This value is case-insensitive.
|
|
41
|
-
*/
|
|
42
|
-
has(name) {
|
|
43
|
-
return this._headersMap.has(normalizeName(name));
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Remove the header with the provided headerName.
|
|
47
|
-
* @param name - The name of the header to remove.
|
|
48
|
-
*/
|
|
49
|
-
delete(name) {
|
|
50
|
-
this._headersMap.delete(normalizeName(name));
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Get the JSON object representation of this HTTP header collection.
|
|
54
|
-
*/
|
|
55
|
-
toJSON(options = {}) {
|
|
56
|
-
const result = {};
|
|
57
|
-
if (options.preserveCase) {
|
|
58
|
-
for (const entry of this._headersMap.values()) {
|
|
59
|
-
result[entry.name] = entry.value;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
for (const [normalizedName, entry] of this._headersMap) {
|
|
64
|
-
result[normalizedName] = entry.value;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
return result;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Get the string representation of this HTTP header collection.
|
|
71
|
-
*/
|
|
72
|
-
toString() {
|
|
73
|
-
return JSON.stringify(this.toJSON({ preserveCase: true }));
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Iterate over tuples of header [name, value] pairs.
|
|
77
|
-
*/
|
|
78
|
-
[Symbol.iterator]() {
|
|
79
|
-
return headerIterator(this._headersMap);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
3
|
+
import { createHttpHeaders as tspCreateHttpHeaders } from "@typespec/ts-http-runtime";
|
|
82
4
|
/**
|
|
83
5
|
* Creates an object that satisfies the `HttpHeaders` interface.
|
|
84
6
|
* @param rawHeaders - A simple object representing initial headers
|
|
85
7
|
*/
|
|
86
8
|
export function createHttpHeaders(rawHeaders) {
|
|
87
|
-
return
|
|
9
|
+
return tspCreateHttpHeaders(rawHeaders);
|
|
88
10
|
}
|
|
89
11
|
//# sourceMappingURL=httpHeaders.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"httpHeaders.js","sourceRoot":"","sources":["../../src/httpHeaders.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;
|
|
1
|
+
{"version":3,"file":"httpHeaders.js","sourceRoot":"","sources":["../../src/httpHeaders.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC,OAAO,EAAE,iBAAiB,IAAI,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEtF;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,UAAgC;IAChE,OAAO,oBAAoB,CAAC,UAAU,CAAC,CAAC;AAC1C,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { HttpHeaders, RawHttpHeadersInput } from \"./interfaces.js\";\n\nimport { createHttpHeaders as tspCreateHttpHeaders } from \"@typespec/ts-http-runtime\";\n\n/**\n * Creates an object that satisfies the `HttpHeaders` interface.\n * @param rawHeaders - A simple object representing initial headers\n */\nexport function createHttpHeaders(rawHeaders?: RawHttpHeadersInput): HttpHeaders {\n return tspCreateHttpHeaders(rawHeaders);\n}\n"]}
|
package/dist/browser/index.d.ts
CHANGED
|
@@ -27,8 +27,7 @@ export { proxyPolicy, proxyPolicyName, getDefaultProxySettings } from "./policie
|
|
|
27
27
|
export { redirectPolicy, redirectPolicyName, type RedirectPolicyOptions, } from "./policies/redirectPolicy.js";
|
|
28
28
|
export { systemErrorRetryPolicy, type SystemErrorRetryPolicyOptions, systemErrorRetryPolicyName, } from "./policies/systemErrorRetryPolicy.js";
|
|
29
29
|
export { throttlingRetryPolicy, throttlingRetryPolicyName, type ThrottlingRetryPolicyOptions, } from "./policies/throttlingRetryPolicy.js";
|
|
30
|
-
export { retryPolicy, type RetryPolicyOptions } from "./policies/retryPolicy.js";
|
|
31
|
-
export type { RetryStrategy, RetryInformation, RetryModifiers, } from "./retryStrategies/retryStrategy.js";
|
|
30
|
+
export { retryPolicy, type RetryPolicyOptions, type RetryStrategy, type RetryInformation, type RetryModifiers, } from "./policies/retryPolicy.js";
|
|
32
31
|
export { tracingPolicy, tracingPolicyName, type TracingPolicyOptions, } from "./policies/tracingPolicy.js";
|
|
33
32
|
export { defaultRetryPolicy, type DefaultRetryPolicyOptions, } from "./policies/defaultRetryPolicy.js";
|
|
34
33
|
export { userAgentPolicy, userAgentPolicyName, type UserAgentPolicyOptions, } from "./policies/userAgentPolicy.js";
|
package/dist/browser/index.js
CHANGED
|
@@ -15,7 +15,7 @@ export { proxyPolicy, proxyPolicyName, getDefaultProxySettings } from "./policie
|
|
|
15
15
|
export { redirectPolicy, redirectPolicyName, } from "./policies/redirectPolicy.js";
|
|
16
16
|
export { systemErrorRetryPolicy, systemErrorRetryPolicyName, } from "./policies/systemErrorRetryPolicy.js";
|
|
17
17
|
export { throttlingRetryPolicy, throttlingRetryPolicyName, } from "./policies/throttlingRetryPolicy.js";
|
|
18
|
-
export { retryPolicy } from "./policies/retryPolicy.js";
|
|
18
|
+
export { retryPolicy, } from "./policies/retryPolicy.js";
|
|
19
19
|
export { tracingPolicy, tracingPolicyName, } from "./policies/tracingPolicy.js";
|
|
20
20
|
export { defaultRetryPolicy, } from "./policies/defaultRetryPolicy.js";
|
|
21
21
|
export { userAgentPolicy, userAgentPolicyName, } from "./policies/userAgentPolicy.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAgClC,OAAO,EAKL,mBAAmB,GACpB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,yBAAyB,GAI1B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAA+B,MAAM,sBAAsB,CAAC;AAC1F,OAAO,EAAE,SAAS,EAAyB,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC/E,OAAO,EACL,wBAAwB,EACxB,4BAA4B,GAC7B,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACL,sBAAsB,EAEtB,0BAA0B,GAC3B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,wBAAwB,EACxB,4BAA4B,GAC7B,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,aAAa,EAAyB,MAAM,yBAAyB,CAAC;AAC1F,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACrF,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAClG,OAAO,EACL,cAAc,EACd,kBAAkB,GAEnB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,sBAAsB,EAEtB,0BAA0B,GAC3B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,qBAAqB,EACrB,yBAAyB,GAE1B,MAAM,qCAAqC,CAAC;AAC7C,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAgClC,OAAO,EAKL,mBAAmB,GACpB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,yBAAyB,GAI1B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAA+B,MAAM,sBAAsB,CAAC;AAC1F,OAAO,EAAE,SAAS,EAAyB,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC/E,OAAO,EACL,wBAAwB,EACxB,4BAA4B,GAC7B,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACL,sBAAsB,EAEtB,0BAA0B,GAC3B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,wBAAwB,EACxB,4BAA4B,GAC7B,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,aAAa,EAAyB,MAAM,yBAAyB,CAAC;AAC1F,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACrF,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAClG,OAAO,EACL,cAAc,EACd,kBAAkB,GAEnB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,sBAAsB,EAEtB,0BAA0B,GAC3B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,qBAAqB,EACrB,yBAAyB,GAE1B,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACL,WAAW,GAKZ,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,aAAa,EACb,iBAAiB,GAElB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,kBAAkB,GAEnB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,eAAe,EACf,mBAAmB,GAEpB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClF,OAAO,EACL,+BAA+B,EAE/B,mCAAmC,GAIpC,MAAM,+CAA+C,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC5E,OAAO,EACL,mCAAmC,EAEnC,uCAAuC,GACxC,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,EACL,UAAU,EACV,oBAAoB,GAGrB,MAAM,gBAAgB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\ndeclare global {\n interface FormData {}\n interface Blob {}\n interface File {}\n interface ReadableStream<R = any> {}\n interface TransformStream<I = any, O = any> {}\n}\n\nexport type { HttpMethods } from \"@azure/core-util\";\nexport type {\n Agent,\n BodyPart,\n FormDataMap,\n FormDataValue,\n HttpClient,\n HttpHeaders,\n KeyObject,\n MultipartRequestBody,\n PipelineRequest,\n PipelineResponse,\n PipelineRetryOptions,\n ProxySettings,\n PxfObject,\n RawHttpHeaders,\n RawHttpHeadersInput,\n RequestBodyType,\n SendRequest,\n TlsSettings,\n TransferProgressEvent,\n} from \"./interfaces.js\";\nexport {\n type AddPolicyOptions as AddPipelineOptions,\n type PipelinePhase,\n type PipelinePolicy,\n type Pipeline,\n createEmptyPipeline,\n} from \"./pipeline.js\";\nexport {\n createPipelineFromOptions,\n type TelemetryOptions,\n type InternalPipelineOptions,\n type PipelineOptions,\n} from \"./createPipelineFromOptions.js\";\nexport { createDefaultHttpClient } from \"./defaultHttpClient.js\";\nexport { createHttpHeaders } from \"./httpHeaders.js\";\nexport { createPipelineRequest, type PipelineRequestOptions } from \"./pipelineRequest.js\";\nexport { RestError, type RestErrorOptions, isRestError } from \"./restError.js\";\nexport {\n decompressResponsePolicy,\n decompressResponsePolicyName,\n} from \"./policies/decompressResponsePolicy.js\";\nexport {\n exponentialRetryPolicy,\n type ExponentialRetryPolicyOptions,\n exponentialRetryPolicyName,\n} from \"./policies/exponentialRetryPolicy.js\";\nexport {\n setClientRequestIdPolicy,\n setClientRequestIdPolicyName,\n} from \"./policies/setClientRequestIdPolicy.js\";\nexport { logPolicy, logPolicyName, type LogPolicyOptions } from \"./policies/logPolicy.js\";\nexport { multipartPolicy, multipartPolicyName } from \"./policies/multipartPolicy.js\";\nexport { proxyPolicy, proxyPolicyName, getDefaultProxySettings } from \"./policies/proxyPolicy.js\";\nexport {\n redirectPolicy,\n redirectPolicyName,\n type RedirectPolicyOptions,\n} from \"./policies/redirectPolicy.js\";\nexport {\n systemErrorRetryPolicy,\n type SystemErrorRetryPolicyOptions,\n systemErrorRetryPolicyName,\n} from \"./policies/systemErrorRetryPolicy.js\";\nexport {\n throttlingRetryPolicy,\n throttlingRetryPolicyName,\n type ThrottlingRetryPolicyOptions,\n} from \"./policies/throttlingRetryPolicy.js\";\nexport {\n retryPolicy,\n type RetryPolicyOptions,\n type RetryStrategy,\n type RetryInformation,\n type RetryModifiers,\n} from \"./policies/retryPolicy.js\";\nexport {\n tracingPolicy,\n tracingPolicyName,\n type TracingPolicyOptions,\n} from \"./policies/tracingPolicy.js\";\nexport {\n defaultRetryPolicy,\n type DefaultRetryPolicyOptions,\n} from \"./policies/defaultRetryPolicy.js\";\nexport {\n userAgentPolicy,\n userAgentPolicyName,\n type UserAgentPolicyOptions,\n} from \"./policies/userAgentPolicy.js\";\nexport { tlsPolicy, tlsPolicyName } from \"./policies/tlsPolicy.js\";\nexport { formDataPolicy, formDataPolicyName } from \"./policies/formDataPolicy.js\";\nexport {\n bearerTokenAuthenticationPolicy,\n type BearerTokenAuthenticationPolicyOptions,\n bearerTokenAuthenticationPolicyName,\n type ChallengeCallbacks,\n type AuthorizeRequestOptions,\n type AuthorizeRequestOnChallengeOptions,\n} from \"./policies/bearerTokenAuthenticationPolicy.js\";\nexport { ndJsonPolicy, ndJsonPolicyName } from \"./policies/ndJsonPolicy.js\";\nexport {\n auxiliaryAuthenticationHeaderPolicy,\n type AuxiliaryAuthenticationHeaderPolicyOptions,\n auxiliaryAuthenticationHeaderPolicyName,\n} from \"./policies/auxiliaryAuthenticationHeaderPolicy.js\";\nexport { agentPolicy, agentPolicyName } from \"./policies/agentPolicy.js\";\nexport {\n createFile,\n createFileFromStream,\n type CreateFileOptions,\n type CreateFileFromStreamOptions,\n} from \"./util/file.js\";\n"]}
|
|
@@ -197,6 +197,17 @@ export interface PipelineRequest {
|
|
|
197
197
|
enableBrowserStreams?: boolean;
|
|
198
198
|
/** Settings for configuring TLS authentication */
|
|
199
199
|
tlsSettings?: TlsSettings;
|
|
200
|
+
/**
|
|
201
|
+
* Additional options to set on the request. This provides a way to override
|
|
202
|
+
* existing ones or provide request properties that are not declared.
|
|
203
|
+
*
|
|
204
|
+
* For possible valid properties, see
|
|
205
|
+
* - NodeJS https.request options: https://nodejs.org/api/http.html#httprequestoptions-callback
|
|
206
|
+
* - Browser RequestInit: https://developer.mozilla.org/en-US/docs/Web/API/RequestInit
|
|
207
|
+
*
|
|
208
|
+
* WARNING: Options specified here will override any properties of same names when request is sent by {@link HttpClient}.
|
|
209
|
+
*/
|
|
210
|
+
requestOverrides?: Record<string, unknown>;
|
|
200
211
|
}
|
|
201
212
|
/**
|
|
202
213
|
* Metadata about a response received by the pipeline.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../src/interfaces.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { AbortSignalLike } from \"@azure/abort-controller\";\nimport type { OperationTracingOptions } from \"@azure/core-tracing\";\nimport type { HttpMethods } from \"@azure/core-util\";\n\n/**\n * A HttpHeaders collection represented as a simple JSON object.\n */\nexport type RawHttpHeaders = { [headerName: string]: string };\n\n/**\n * A HttpHeaders collection for input, represented as a simple JSON object.\n */\nexport type RawHttpHeadersInput = Record<string, string | number | boolean>;\n\n/**\n * Represents a set of HTTP headers on a request/response.\n * Header names are treated as case insensitive.\n */\nexport interface HttpHeaders extends Iterable<[string, string]> {\n /**\n * Returns the value of a specific header or undefined if not set.\n * @param name - The name of the header to retrieve.\n */\n get(name: string): string | undefined;\n /**\n * Returns true if the specified header exists.\n * @param name - The name of the header to check.\n */\n has(name: string): boolean;\n /**\n * Sets a specific header with a given value.\n * @param name - The name of the header to set.\n * @param value - The value to use for the header.\n */\n set(name: string, value: string | number | boolean): void;\n /**\n * Removes a specific header from the collection.\n * @param name - The name of the header to delete.\n */\n delete(name: string): void;\n /**\n * Accesses a raw JS object that acts as a simple map\n * of header names to values.\n */\n toJSON(options?: { preserveCase?: boolean }): RawHttpHeaders;\n}\n\n/**\n * A part of the request body in a multipart request.\n */\nexport interface BodyPart {\n /**\n * The headers for this part of the multipart request.\n */\n headers: HttpHeaders;\n\n /**\n * The body of this part of the multipart request.\n */\n body:\n | ((() => ReadableStream<Uint8Array>) | (() => NodeJS.ReadableStream))\n | ReadableStream<Uint8Array>\n | NodeJS.ReadableStream\n | Uint8Array\n | Blob;\n}\n\n/**\n * A request body consisting of multiple parts.\n */\nexport interface MultipartRequestBody {\n /**\n * The parts of the request body.\n */\n parts: BodyPart[];\n\n /**\n * The boundary separating each part of the request body.\n * If not specified, a random boundary will be generated.\n *\n * When specified, '--' will be prepended to the boundary in the request to ensure the boundary follows the specification.\n */\n boundary?: string;\n}\n\n/**\n * Types of bodies supported on the request.\n * NodeJS.ReadableStream and () =\\> NodeJS.ReadableStream is Node only.\n * Blob, ReadableStream<Uint8Array>, and () =\\> ReadableStream<Uint8Array> are browser only.\n */\nexport type RequestBodyType =\n | NodeJS.ReadableStream\n | (() => NodeJS.ReadableStream)\n | ReadableStream<Uint8Array>\n | (() => ReadableStream<Uint8Array>)\n | Blob\n | ArrayBuffer\n | ArrayBufferView\n | FormData\n | string\n | null;\n\n/**\n * An interface compatible with NodeJS's `http.Agent`.\n * We want to avoid publicly re-exporting the actual interface,\n * since it might vary across runtime versions.\n */\nexport interface Agent {\n /**\n * Destroy any sockets that are currently in use by the agent.\n */\n destroy(): void;\n /**\n * For agents with keepAlive enabled, this sets the maximum number of sockets that will be left open in the free state.\n */\n maxFreeSockets: number;\n /**\n * Determines how many concurrent sockets the agent can have open per origin.\n */\n maxSockets: number;\n /**\n * An object which contains queues of requests that have not yet been assigned to sockets.\n */\n requests: unknown;\n /**\n * An object which contains arrays of sockets currently in use by the agent.\n */\n sockets: unknown;\n}\n\n/**\n * Metadata about a request being made by the pipeline.\n */\nexport interface PipelineRequest {\n /**\n * The URL to make the request to.\n */\n url: string;\n\n /**\n * The HTTP method to use when making the request.\n */\n method: HttpMethods;\n\n /**\n * The HTTP headers to use when making the request.\n */\n headers: HttpHeaders;\n\n /**\n * The number of milliseconds a request can take before automatically being terminated.\n * If the request is terminated, an `AbortError` is thrown.\n * Defaults to 0, which disables the timeout.\n */\n timeout: number;\n\n /**\n * Indicates whether the user agent should send cookies from the other domain in the case of cross-origin requests.\n * Defaults to false.\n */\n withCredentials: boolean;\n\n /**\n * A unique identifier for the request. Used for logging and tracing.\n */\n requestId: string;\n\n /**\n * The HTTP body content (if any)\n */\n body?: RequestBodyType;\n\n /**\n * Body for a multipart request.\n */\n multipartBody?: MultipartRequestBody;\n\n /**\n * To simulate a browser form post\n */\n formData?: FormDataMap;\n\n /**\n * A list of response status codes whose corresponding PipelineResponse body should be treated as a stream.\n * When streamResponseStatusCodes contains the value Number.POSITIVE_INFINITY any status would be treated as a stream.\n */\n streamResponseStatusCodes?: Set<number>;\n\n /**\n * Proxy configuration.\n */\n proxySettings?: ProxySettings;\n\n /**\n * If the connection should not be reused.\n */\n disableKeepAlive?: boolean;\n\n /**\n * Used to abort the request later.\n */\n abortSignal?: AbortSignalLike;\n\n /**\n * Tracing options to use for any created Spans.\n */\n tracingOptions?: OperationTracingOptions;\n\n /**\n * Callback which fires upon upload progress.\n */\n onUploadProgress?: (progress: TransferProgressEvent) => void;\n\n /** Callback which fires upon download progress. */\n onDownloadProgress?: (progress: TransferProgressEvent) => void;\n\n /** Set to true if the request is sent over HTTP instead of HTTPS */\n allowInsecureConnection?: boolean;\n\n /**\n * NODEJS ONLY\n *\n * A Node-only option to provide a custom `http.Agent`/`https.Agent`.\n * Does nothing when running in the browser.\n */\n agent?: Agent;\n\n /**\n * BROWSER ONLY\n *\n * A browser only option to enable browser Streams. If this option is set and a response is a stream\n * the response will have a property `browserStream` instead of `blobBody` which will be undefined.\n *\n * Default value is false\n */\n enableBrowserStreams?: boolean;\n\n /** Settings for configuring TLS authentication */\n tlsSettings?: TlsSettings;\n}\n\n/**\n * Metadata about a response received by the pipeline.\n */\nexport interface PipelineResponse {\n /**\n * The request that generated this response.\n */\n request: PipelineRequest;\n /**\n * The HTTP status code of the response.\n */\n status: number;\n /**\n * The HTTP response headers.\n */\n headers: HttpHeaders;\n\n /**\n * The response body as text (string format)\n */\n bodyAsText?: string | null;\n\n /**\n * BROWSER ONLY\n *\n * The response body as a browser Blob.\n * Always undefined in node.js.\n */\n blobBody?: Promise<Blob>;\n\n /**\n * BROWSER ONLY\n *\n * The response body as a browser ReadableStream.\n * Always undefined in node.js.\n */\n browserStreamBody?: ReadableStream<Uint8Array>;\n\n /**\n * NODEJS ONLY\n *\n * The response body as a node.js Readable stream.\n * Always undefined in the browser.\n */\n readableStreamBody?: NodeJS.ReadableStream;\n}\n\n/**\n * A simple interface for making a pipeline request and receiving a response.\n */\nexport type SendRequest = (request: PipelineRequest) => Promise<PipelineResponse>;\n\n/**\n * The required interface for a client that makes HTTP requests\n * on behalf of a pipeline.\n */\nexport interface HttpClient {\n /**\n * The method that makes the request and returns a response.\n */\n sendRequest: SendRequest;\n}\n\n/**\n * Fired in response to upload or download progress.\n */\nexport type TransferProgressEvent = {\n /**\n * The number of bytes loaded so far.\n */\n loadedBytes: number;\n};\n\n/**\n * Options to configure a proxy for outgoing requests (Node.js only).\n */\nexport interface ProxySettings {\n /**\n * The proxy's host address.\n * Must include the protocol (e.g., http:// or https://).\n */\n host: string;\n\n /**\n * The proxy host's port.\n */\n port: number;\n\n /**\n * The user name to authenticate with the proxy, if required.\n */\n username?: string;\n\n /**\n * The password to authenticate with the proxy, if required.\n */\n password?: string;\n}\n\n/**\n * Each form data entry can be a string, Blob, or a File. If you wish to pass a file with a name but do not have\n * access to the File class, you can use the createFile helper to create one.\n */\nexport type FormDataValue = string | Blob | File;\n\n/**\n * A simple object that provides form data, as if from a browser form.\n */\nexport type FormDataMap = { [key: string]: FormDataValue | FormDataValue[] };\n\n/**\n * Options that control how to retry failed requests.\n */\nexport interface PipelineRetryOptions {\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 * Represents a certificate credential for authentication.\n */\nexport interface CertificateCredential {\n /**\n * Optionally override the trusted CA certificates. Default is to trust\n * the well-known CAs curated by Mozilla. Mozilla's CAs are completely\n * replaced when CAs are explicitly specified using this option.\n */\n ca?: string | Buffer | Array<string | Buffer> | undefined;\n /**\n * Cert chains in PEM format. One cert chain should be provided per\n * private key. Each cert chain should consist of the PEM formatted\n * certificate for a provided private key, followed by the PEM\n * formatted intermediate certificates (if any), in order, and not\n * including the root CA (the root CA must be pre-known to the peer,\n * see ca). When providing multiple cert chains, they do not have to\n * be in the same order as their private keys in key. If the\n * intermediate certificates are not provided, the peer will not be\n * able to validate the certificate, and the handshake will fail.\n */\n cert?: string | Buffer | Array<string | Buffer> | undefined;\n /**\n * Private keys in PEM format. PEM allows the option of private keys\n * being encrypted. Encrypted keys will be decrypted with\n * options.passphrase. Multiple keys using different algorithms can be\n * provided either as an array of unencrypted key strings or buffers,\n * or an array of objects in the form `{pem: <string|buffer>[,passphrase: <string>]}`.\n * The object form can only occur in an array.object.passphrase is optional.\n * Encrypted keys will be decrypted with object.passphrase if provided, or options.passphrase if it is not.\n */\n key?: string | Buffer | Array<Buffer | KeyObject> | undefined;\n /**\n * Shared passphrase used for a single private key and/or a PFX.\n */\n passphrase?: string | undefined;\n /**\n * PFX or PKCS12 encoded private key and certificate chain. pfx is an\n * alternative to providing key and cert individually. PFX is usually\n * encrypted, if it is, passphrase will be used to decrypt it. Multiple\n * PFX can be provided either as an array of unencrypted PFX buffers,\n * or an array of objects in the form `{buf: <string|buffer>[,passphrase: <string>]}`.\n * The object form can only occur in an array.object.passphrase is optional.\n * Encrypted PFX will be decrypted with object.passphrase if provided, or options.passphrase if it is not.\n */\n pfx?: string | Buffer | Array<string | Buffer | PxfObject> | undefined;\n}\n\n/**\n * Represents a certificate for TLS authentication.\n */\nexport interface TlsSettings {\n /**\n * Optionally override the trusted CA certificates. Default is to trust\n * the well-known CAs curated by Mozilla. Mozilla's CAs are completely\n * replaced when CAs are explicitly specified using this option.\n */\n ca?: string | Buffer | Array<string | Buffer> | undefined;\n /**\n * Cert chains in PEM format. One cert chain should be provided per\n * private key. Each cert chain should consist of the PEM formatted\n * certificate for a provided private key, followed by the PEM\n * formatted intermediate certificates (if any), in order, and not\n * including the root CA (the root CA must be pre-known to the peer,\n * see ca). When providing multiple cert chains, they do not have to\n * be in the same order as their private keys in key. If the\n * intermediate certificates are not provided, the peer will not be\n * able to validate the certificate, and the handshake will fail.\n */\n cert?: string | Buffer | Array<string | Buffer> | undefined;\n /**\n * Private keys in PEM format. PEM allows the option of private keys\n * being encrypted. Encrypted keys will be decrypted with\n * options.passphrase. Multiple keys using different algorithms can be\n * provided either as an array of unencrypted key strings or buffers,\n * or an array of objects in the form `{pem: <string|buffer>[,passphrase: <string>]}`.\n * The object form can only occur in an array.object.passphrase is optional.\n * Encrypted keys will be decrypted with object.passphrase if provided, or options.passphrase if it is not.\n */\n key?: string | Buffer | Array<Buffer | KeyObject> | undefined;\n /**\n * Shared passphrase used for a single private key and/or a PFX.\n */\n passphrase?: string | undefined;\n /**\n * PFX or PKCS12 encoded private key and certificate chain. pfx is an\n * alternative to providing key and cert individually. PFX is usually\n * encrypted, if it is, passphrase will be used to decrypt it. Multiple\n * PFX can be provided either as an array of unencrypted PFX buffers,\n * or an array of objects in the form `{buf: <string|buffer>[,passphrase: <string>]}`.\n * The object form can only occur in an array.object.passphrase is optional.\n * Encrypted PFX will be decrypted with object.passphrase if provided, or options.passphrase if it is not.\n */\n pfx?: string | Buffer | Array<string | Buffer | PxfObject> | undefined;\n}\n\n/**\n * An interface compatible with NodeJS's `tls.KeyObject`.\n * We want to avoid publicly re-exporting the actual interface,\n * since it might vary across runtime versions.\n */\nexport interface KeyObject {\n /**\n * Private keys in PEM format.\n */\n pem: string | Buffer;\n /**\n * Optional passphrase.\n */\n passphrase?: string | undefined;\n}\n\n/**\n * An interface compatible with NodeJS's `tls.PxfObject`.\n * We want to avoid publicly re-exporting the actual interface,\n * since it might vary across runtime versions.\n */\nexport interface PxfObject {\n /**\n * PFX or PKCS12 encoded private key and certificate chain.\n */\n buf: string | Buffer;\n /**\n * Optional passphrase.\n */\n passphrase?: string | undefined;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../src/interfaces.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { AbortSignalLike } from \"@azure/abort-controller\";\nimport type { OperationTracingOptions } from \"@azure/core-tracing\";\nimport type { HttpMethods } from \"@azure/core-util\";\n\n/**\n * A HttpHeaders collection represented as a simple JSON object.\n */\nexport type RawHttpHeaders = { [headerName: string]: string };\n\n/**\n * A HttpHeaders collection for input, represented as a simple JSON object.\n */\nexport type RawHttpHeadersInput = Record<string, string | number | boolean>;\n\n/**\n * Represents a set of HTTP headers on a request/response.\n * Header names are treated as case insensitive.\n */\nexport interface HttpHeaders extends Iterable<[string, string]> {\n /**\n * Returns the value of a specific header or undefined if not set.\n * @param name - The name of the header to retrieve.\n */\n get(name: string): string | undefined;\n /**\n * Returns true if the specified header exists.\n * @param name - The name of the header to check.\n */\n has(name: string): boolean;\n /**\n * Sets a specific header with a given value.\n * @param name - The name of the header to set.\n * @param value - The value to use for the header.\n */\n set(name: string, value: string | number | boolean): void;\n /**\n * Removes a specific header from the collection.\n * @param name - The name of the header to delete.\n */\n delete(name: string): void;\n /**\n * Accesses a raw JS object that acts as a simple map\n * of header names to values.\n */\n toJSON(options?: { preserveCase?: boolean }): RawHttpHeaders;\n}\n\n/**\n * A part of the request body in a multipart request.\n */\nexport interface BodyPart {\n /**\n * The headers for this part of the multipart request.\n */\n headers: HttpHeaders;\n\n /**\n * The body of this part of the multipart request.\n */\n body:\n | ((() => ReadableStream<Uint8Array>) | (() => NodeJS.ReadableStream))\n | ReadableStream<Uint8Array>\n | NodeJS.ReadableStream\n | Uint8Array\n | Blob;\n}\n\n/**\n * A request body consisting of multiple parts.\n */\nexport interface MultipartRequestBody {\n /**\n * The parts of the request body.\n */\n parts: BodyPart[];\n\n /**\n * The boundary separating each part of the request body.\n * If not specified, a random boundary will be generated.\n *\n * When specified, '--' will be prepended to the boundary in the request to ensure the boundary follows the specification.\n */\n boundary?: string;\n}\n\n/**\n * Types of bodies supported on the request.\n * NodeJS.ReadableStream and () =\\> NodeJS.ReadableStream is Node only.\n * Blob, ReadableStream<Uint8Array>, and () =\\> ReadableStream<Uint8Array> are browser only.\n */\nexport type RequestBodyType =\n | NodeJS.ReadableStream\n | (() => NodeJS.ReadableStream)\n | ReadableStream<Uint8Array>\n | (() => ReadableStream<Uint8Array>)\n | Blob\n | ArrayBuffer\n | ArrayBufferView\n | FormData\n | string\n | null;\n\n/**\n * An interface compatible with NodeJS's `http.Agent`.\n * We want to avoid publicly re-exporting the actual interface,\n * since it might vary across runtime versions.\n */\nexport interface Agent {\n /**\n * Destroy any sockets that are currently in use by the agent.\n */\n destroy(): void;\n /**\n * For agents with keepAlive enabled, this sets the maximum number of sockets that will be left open in the free state.\n */\n maxFreeSockets: number;\n /**\n * Determines how many concurrent sockets the agent can have open per origin.\n */\n maxSockets: number;\n /**\n * An object which contains queues of requests that have not yet been assigned to sockets.\n */\n requests: unknown;\n /**\n * An object which contains arrays of sockets currently in use by the agent.\n */\n sockets: unknown;\n}\n\n/**\n * Metadata about a request being made by the pipeline.\n */\nexport interface PipelineRequest {\n /**\n * The URL to make the request to.\n */\n url: string;\n\n /**\n * The HTTP method to use when making the request.\n */\n method: HttpMethods;\n\n /**\n * The HTTP headers to use when making the request.\n */\n headers: HttpHeaders;\n\n /**\n * The number of milliseconds a request can take before automatically being terminated.\n * If the request is terminated, an `AbortError` is thrown.\n * Defaults to 0, which disables the timeout.\n */\n timeout: number;\n\n /**\n * Indicates whether the user agent should send cookies from the other domain in the case of cross-origin requests.\n * Defaults to false.\n */\n withCredentials: boolean;\n\n /**\n * A unique identifier for the request. Used for logging and tracing.\n */\n requestId: string;\n\n /**\n * The HTTP body content (if any)\n */\n body?: RequestBodyType;\n\n /**\n * Body for a multipart request.\n */\n multipartBody?: MultipartRequestBody;\n\n /**\n * To simulate a browser form post\n */\n formData?: FormDataMap;\n\n /**\n * A list of response status codes whose corresponding PipelineResponse body should be treated as a stream.\n * When streamResponseStatusCodes contains the value Number.POSITIVE_INFINITY any status would be treated as a stream.\n */\n streamResponseStatusCodes?: Set<number>;\n\n /**\n * Proxy configuration.\n */\n proxySettings?: ProxySettings;\n\n /**\n * If the connection should not be reused.\n */\n disableKeepAlive?: boolean;\n\n /**\n * Used to abort the request later.\n */\n abortSignal?: AbortSignalLike;\n\n /**\n * Tracing options to use for any created Spans.\n */\n tracingOptions?: OperationTracingOptions;\n\n /**\n * Callback which fires upon upload progress.\n */\n onUploadProgress?: (progress: TransferProgressEvent) => void;\n\n /** Callback which fires upon download progress. */\n onDownloadProgress?: (progress: TransferProgressEvent) => void;\n\n /** Set to true if the request is sent over HTTP instead of HTTPS */\n allowInsecureConnection?: boolean;\n\n /**\n * NODEJS ONLY\n *\n * A Node-only option to provide a custom `http.Agent`/`https.Agent`.\n * Does nothing when running in the browser.\n */\n agent?: Agent;\n\n /**\n * BROWSER ONLY\n *\n * A browser only option to enable browser Streams. If this option is set and a response is a stream\n * the response will have a property `browserStream` instead of `blobBody` which will be undefined.\n *\n * Default value is false\n */\n enableBrowserStreams?: boolean;\n\n /** Settings for configuring TLS authentication */\n tlsSettings?: TlsSettings;\n\n /**\n * Additional options to set on the request. This provides a way to override\n * existing ones or provide request properties that are not declared.\n *\n * For possible valid properties, see\n * - NodeJS https.request options: https://nodejs.org/api/http.html#httprequestoptions-callback\n * - Browser RequestInit: https://developer.mozilla.org/en-US/docs/Web/API/RequestInit\n *\n * WARNING: Options specified here will override any properties of same names when request is sent by {@link HttpClient}.\n */\n requestOverrides?: Record<string, unknown>;\n}\n\n/**\n * Metadata about a response received by the pipeline.\n */\nexport interface PipelineResponse {\n /**\n * The request that generated this response.\n */\n request: PipelineRequest;\n /**\n * The HTTP status code of the response.\n */\n status: number;\n /**\n * The HTTP response headers.\n */\n headers: HttpHeaders;\n\n /**\n * The response body as text (string format)\n */\n bodyAsText?: string | null;\n\n /**\n * BROWSER ONLY\n *\n * The response body as a browser Blob.\n * Always undefined in node.js.\n */\n blobBody?: Promise<Blob>;\n\n /**\n * BROWSER ONLY\n *\n * The response body as a browser ReadableStream.\n * Always undefined in node.js.\n */\n browserStreamBody?: ReadableStream<Uint8Array>;\n\n /**\n * NODEJS ONLY\n *\n * The response body as a node.js Readable stream.\n * Always undefined in the browser.\n */\n readableStreamBody?: NodeJS.ReadableStream;\n}\n\n/**\n * A simple interface for making a pipeline request and receiving a response.\n */\nexport type SendRequest = (request: PipelineRequest) => Promise<PipelineResponse>;\n\n/**\n * The required interface for a client that makes HTTP requests\n * on behalf of a pipeline.\n */\nexport interface HttpClient {\n /**\n * The method that makes the request and returns a response.\n */\n sendRequest: SendRequest;\n}\n\n/**\n * Fired in response to upload or download progress.\n */\nexport type TransferProgressEvent = {\n /**\n * The number of bytes loaded so far.\n */\n loadedBytes: number;\n};\n\n/**\n * Options to configure a proxy for outgoing requests (Node.js only).\n */\nexport interface ProxySettings {\n /**\n * The proxy's host address.\n * Must include the protocol (e.g., http:// or https://).\n */\n host: string;\n\n /**\n * The proxy host's port.\n */\n port: number;\n\n /**\n * The user name to authenticate with the proxy, if required.\n */\n username?: string;\n\n /**\n * The password to authenticate with the proxy, if required.\n */\n password?: string;\n}\n\n/**\n * Each form data entry can be a string, Blob, or a File. If you wish to pass a file with a name but do not have\n * access to the File class, you can use the createFile helper to create one.\n */\nexport type FormDataValue = string | Blob | File;\n\n/**\n * A simple object that provides form data, as if from a browser form.\n */\nexport type FormDataMap = { [key: string]: FormDataValue | FormDataValue[] };\n\n/**\n * Options that control how to retry failed requests.\n */\nexport interface PipelineRetryOptions {\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 * Represents a certificate credential for authentication.\n */\nexport interface CertificateCredential {\n /**\n * Optionally override the trusted CA certificates. Default is to trust\n * the well-known CAs curated by Mozilla. Mozilla's CAs are completely\n * replaced when CAs are explicitly specified using this option.\n */\n ca?: string | Buffer | Array<string | Buffer> | undefined;\n /**\n * Cert chains in PEM format. One cert chain should be provided per\n * private key. Each cert chain should consist of the PEM formatted\n * certificate for a provided private key, followed by the PEM\n * formatted intermediate certificates (if any), in order, and not\n * including the root CA (the root CA must be pre-known to the peer,\n * see ca). When providing multiple cert chains, they do not have to\n * be in the same order as their private keys in key. If the\n * intermediate certificates are not provided, the peer will not be\n * able to validate the certificate, and the handshake will fail.\n */\n cert?: string | Buffer | Array<string | Buffer> | undefined;\n /**\n * Private keys in PEM format. PEM allows the option of private keys\n * being encrypted. Encrypted keys will be decrypted with\n * options.passphrase. Multiple keys using different algorithms can be\n * provided either as an array of unencrypted key strings or buffers,\n * or an array of objects in the form `{pem: <string|buffer>[,passphrase: <string>]}`.\n * The object form can only occur in an array.object.passphrase is optional.\n * Encrypted keys will be decrypted with object.passphrase if provided, or options.passphrase if it is not.\n */\n key?: string | Buffer | Array<Buffer | KeyObject> | undefined;\n /**\n * Shared passphrase used for a single private key and/or a PFX.\n */\n passphrase?: string | undefined;\n /**\n * PFX or PKCS12 encoded private key and certificate chain. pfx is an\n * alternative to providing key and cert individually. PFX is usually\n * encrypted, if it is, passphrase will be used to decrypt it. Multiple\n * PFX can be provided either as an array of unencrypted PFX buffers,\n * or an array of objects in the form `{buf: <string|buffer>[,passphrase: <string>]}`.\n * The object form can only occur in an array.object.passphrase is optional.\n * Encrypted PFX will be decrypted with object.passphrase if provided, or options.passphrase if it is not.\n */\n pfx?: string | Buffer | Array<string | Buffer | PxfObject> | undefined;\n}\n\n/**\n * Represents a certificate for TLS authentication.\n */\nexport interface TlsSettings {\n /**\n * Optionally override the trusted CA certificates. Default is to trust\n * the well-known CAs curated by Mozilla. Mozilla's CAs are completely\n * replaced when CAs are explicitly specified using this option.\n */\n ca?: string | Buffer | Array<string | Buffer> | undefined;\n /**\n * Cert chains in PEM format. One cert chain should be provided per\n * private key. Each cert chain should consist of the PEM formatted\n * certificate for a provided private key, followed by the PEM\n * formatted intermediate certificates (if any), in order, and not\n * including the root CA (the root CA must be pre-known to the peer,\n * see ca). When providing multiple cert chains, they do not have to\n * be in the same order as their private keys in key. If the\n * intermediate certificates are not provided, the peer will not be\n * able to validate the certificate, and the handshake will fail.\n */\n cert?: string | Buffer | Array<string | Buffer> | undefined;\n /**\n * Private keys in PEM format. PEM allows the option of private keys\n * being encrypted. Encrypted keys will be decrypted with\n * options.passphrase. Multiple keys using different algorithms can be\n * provided either as an array of unencrypted key strings or buffers,\n * or an array of objects in the form `{pem: <string|buffer>[,passphrase: <string>]}`.\n * The object form can only occur in an array.object.passphrase is optional.\n * Encrypted keys will be decrypted with object.passphrase if provided, or options.passphrase if it is not.\n */\n key?: string | Buffer | Array<Buffer | KeyObject> | undefined;\n /**\n * Shared passphrase used for a single private key and/or a PFX.\n */\n passphrase?: string | undefined;\n /**\n * PFX or PKCS12 encoded private key and certificate chain. pfx is an\n * alternative to providing key and cert individually. PFX is usually\n * encrypted, if it is, passphrase will be used to decrypt it. Multiple\n * PFX can be provided either as an array of unencrypted PFX buffers,\n * or an array of objects in the form `{buf: <string|buffer>[,passphrase: <string>]}`.\n * The object form can only occur in an array.object.passphrase is optional.\n * Encrypted PFX will be decrypted with object.passphrase if provided, or options.passphrase if it is not.\n */\n pfx?: string | Buffer | Array<string | Buffer | PxfObject> | undefined;\n}\n\n/**\n * An interface compatible with NodeJS's `tls.KeyObject`.\n * We want to avoid publicly re-exporting the actual interface,\n * since it might vary across runtime versions.\n */\nexport interface KeyObject {\n /**\n * Private keys in PEM format.\n */\n pem: string | Buffer;\n /**\n * Optional passphrase.\n */\n passphrase?: string | undefined;\n}\n\n/**\n * An interface compatible with NodeJS's `tls.PxfObject`.\n * We want to avoid publicly re-exporting the actual interface,\n * since it might vary across runtime versions.\n */\nexport interface PxfObject {\n /**\n * PFX or PKCS12 encoded private key and certificate chain.\n */\n buf: string | Buffer;\n /**\n * Optional passphrase.\n */\n passphrase?: string | undefined;\n}\n"]}
|
package/dist/browser/pipeline.js
CHANGED
|
@@ -1,262 +1,11 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* A private implementation of Pipeline.
|
|
6
|
-
* Do not export this class from the package.
|
|
7
|
-
* @internal
|
|
8
|
-
*/
|
|
9
|
-
class HttpPipeline {
|
|
10
|
-
constructor(policies) {
|
|
11
|
-
var _a;
|
|
12
|
-
this._policies = [];
|
|
13
|
-
this._policies = (_a = policies === null || policies === void 0 ? void 0 : policies.slice(0)) !== null && _a !== void 0 ? _a : [];
|
|
14
|
-
this._orderedPolicies = undefined;
|
|
15
|
-
}
|
|
16
|
-
addPolicy(policy, options = {}) {
|
|
17
|
-
if (options.phase && options.afterPhase) {
|
|
18
|
-
throw new Error("Policies inside a phase cannot specify afterPhase.");
|
|
19
|
-
}
|
|
20
|
-
if (options.phase && !ValidPhaseNames.has(options.phase)) {
|
|
21
|
-
throw new Error(`Invalid phase name: ${options.phase}`);
|
|
22
|
-
}
|
|
23
|
-
if (options.afterPhase && !ValidPhaseNames.has(options.afterPhase)) {
|
|
24
|
-
throw new Error(`Invalid afterPhase name: ${options.afterPhase}`);
|
|
25
|
-
}
|
|
26
|
-
this._policies.push({
|
|
27
|
-
policy,
|
|
28
|
-
options,
|
|
29
|
-
});
|
|
30
|
-
this._orderedPolicies = undefined;
|
|
31
|
-
}
|
|
32
|
-
removePolicy(options) {
|
|
33
|
-
const removedPolicies = [];
|
|
34
|
-
this._policies = this._policies.filter((policyDescriptor) => {
|
|
35
|
-
if ((options.name && policyDescriptor.policy.name === options.name) ||
|
|
36
|
-
(options.phase && policyDescriptor.options.phase === options.phase)) {
|
|
37
|
-
removedPolicies.push(policyDescriptor.policy);
|
|
38
|
-
return false;
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
return true;
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
this._orderedPolicies = undefined;
|
|
45
|
-
return removedPolicies;
|
|
46
|
-
}
|
|
47
|
-
sendRequest(httpClient, request) {
|
|
48
|
-
const policies = this.getOrderedPolicies();
|
|
49
|
-
const pipeline = policies.reduceRight((next, policy) => {
|
|
50
|
-
return (req) => {
|
|
51
|
-
return policy.sendRequest(req, next);
|
|
52
|
-
};
|
|
53
|
-
}, (req) => httpClient.sendRequest(req));
|
|
54
|
-
return pipeline(request);
|
|
55
|
-
}
|
|
56
|
-
getOrderedPolicies() {
|
|
57
|
-
if (!this._orderedPolicies) {
|
|
58
|
-
this._orderedPolicies = this.orderPolicies();
|
|
59
|
-
}
|
|
60
|
-
return this._orderedPolicies;
|
|
61
|
-
}
|
|
62
|
-
clone() {
|
|
63
|
-
return new HttpPipeline(this._policies);
|
|
64
|
-
}
|
|
65
|
-
static create() {
|
|
66
|
-
return new HttpPipeline();
|
|
67
|
-
}
|
|
68
|
-
orderPolicies() {
|
|
69
|
-
/**
|
|
70
|
-
* The goal of this method is to reliably order pipeline policies
|
|
71
|
-
* based on their declared requirements when they were added.
|
|
72
|
-
*
|
|
73
|
-
* Order is first determined by phase:
|
|
74
|
-
*
|
|
75
|
-
* 1. Serialize Phase
|
|
76
|
-
* 2. Policies not in a phase
|
|
77
|
-
* 3. Deserialize Phase
|
|
78
|
-
* 4. Retry Phase
|
|
79
|
-
* 5. Sign Phase
|
|
80
|
-
*
|
|
81
|
-
* Within each phase, policies are executed in the order
|
|
82
|
-
* they were added unless they were specified to execute
|
|
83
|
-
* before/after other policies or after a particular phase.
|
|
84
|
-
*
|
|
85
|
-
* To determine the final order, we will walk the policy list
|
|
86
|
-
* in phase order multiple times until all dependencies are
|
|
87
|
-
* satisfied.
|
|
88
|
-
*
|
|
89
|
-
* `afterPolicies` are the set of policies that must be
|
|
90
|
-
* executed before a given policy. This requirement is
|
|
91
|
-
* considered satisfied when each of the listed policies
|
|
92
|
-
* have been scheduled.
|
|
93
|
-
*
|
|
94
|
-
* `beforePolicies` are the set of policies that must be
|
|
95
|
-
* executed after a given policy. Since this dependency
|
|
96
|
-
* can be expressed by converting it into a equivalent
|
|
97
|
-
* `afterPolicies` declarations, they are normalized
|
|
98
|
-
* into that form for simplicity.
|
|
99
|
-
*
|
|
100
|
-
* An `afterPhase` dependency is considered satisfied when all
|
|
101
|
-
* policies in that phase have scheduled.
|
|
102
|
-
*
|
|
103
|
-
*/
|
|
104
|
-
const result = [];
|
|
105
|
-
// Track all policies we know about.
|
|
106
|
-
const policyMap = new Map();
|
|
107
|
-
function createPhase(name) {
|
|
108
|
-
return {
|
|
109
|
-
name,
|
|
110
|
-
policies: new Set(),
|
|
111
|
-
hasRun: false,
|
|
112
|
-
hasAfterPolicies: false,
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
// Track policies for each phase.
|
|
116
|
-
const serializePhase = createPhase("Serialize");
|
|
117
|
-
const noPhase = createPhase("None");
|
|
118
|
-
const deserializePhase = createPhase("Deserialize");
|
|
119
|
-
const retryPhase = createPhase("Retry");
|
|
120
|
-
const signPhase = createPhase("Sign");
|
|
121
|
-
// a list of phases in order
|
|
122
|
-
const orderedPhases = [serializePhase, noPhase, deserializePhase, retryPhase, signPhase];
|
|
123
|
-
// Small helper function to map phase name to each Phase
|
|
124
|
-
function getPhase(phase) {
|
|
125
|
-
if (phase === "Retry") {
|
|
126
|
-
return retryPhase;
|
|
127
|
-
}
|
|
128
|
-
else if (phase === "Serialize") {
|
|
129
|
-
return serializePhase;
|
|
130
|
-
}
|
|
131
|
-
else if (phase === "Deserialize") {
|
|
132
|
-
return deserializePhase;
|
|
133
|
-
}
|
|
134
|
-
else if (phase === "Sign") {
|
|
135
|
-
return signPhase;
|
|
136
|
-
}
|
|
137
|
-
else {
|
|
138
|
-
return noPhase;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
// First walk each policy and create a node to track metadata.
|
|
142
|
-
for (const descriptor of this._policies) {
|
|
143
|
-
const policy = descriptor.policy;
|
|
144
|
-
const options = descriptor.options;
|
|
145
|
-
const policyName = policy.name;
|
|
146
|
-
if (policyMap.has(policyName)) {
|
|
147
|
-
throw new Error("Duplicate policy names not allowed in pipeline");
|
|
148
|
-
}
|
|
149
|
-
const node = {
|
|
150
|
-
policy,
|
|
151
|
-
dependsOn: new Set(),
|
|
152
|
-
dependants: new Set(),
|
|
153
|
-
};
|
|
154
|
-
if (options.afterPhase) {
|
|
155
|
-
node.afterPhase = getPhase(options.afterPhase);
|
|
156
|
-
node.afterPhase.hasAfterPolicies = true;
|
|
157
|
-
}
|
|
158
|
-
policyMap.set(policyName, node);
|
|
159
|
-
const phase = getPhase(options.phase);
|
|
160
|
-
phase.policies.add(node);
|
|
161
|
-
}
|
|
162
|
-
// Now that each policy has a node, connect dependency references.
|
|
163
|
-
for (const descriptor of this._policies) {
|
|
164
|
-
const { policy, options } = descriptor;
|
|
165
|
-
const policyName = policy.name;
|
|
166
|
-
const node = policyMap.get(policyName);
|
|
167
|
-
if (!node) {
|
|
168
|
-
throw new Error(`Missing node for policy ${policyName}`);
|
|
169
|
-
}
|
|
170
|
-
if (options.afterPolicies) {
|
|
171
|
-
for (const afterPolicyName of options.afterPolicies) {
|
|
172
|
-
const afterNode = policyMap.get(afterPolicyName);
|
|
173
|
-
if (afterNode) {
|
|
174
|
-
// Linking in both directions helps later
|
|
175
|
-
// when we want to notify dependants.
|
|
176
|
-
node.dependsOn.add(afterNode);
|
|
177
|
-
afterNode.dependants.add(node);
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
if (options.beforePolicies) {
|
|
182
|
-
for (const beforePolicyName of options.beforePolicies) {
|
|
183
|
-
const beforeNode = policyMap.get(beforePolicyName);
|
|
184
|
-
if (beforeNode) {
|
|
185
|
-
// To execute before another node, make it
|
|
186
|
-
// depend on the current node.
|
|
187
|
-
beforeNode.dependsOn.add(node);
|
|
188
|
-
node.dependants.add(beforeNode);
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
function walkPhase(phase) {
|
|
194
|
-
phase.hasRun = true;
|
|
195
|
-
// Sets iterate in insertion order
|
|
196
|
-
for (const node of phase.policies) {
|
|
197
|
-
if (node.afterPhase && (!node.afterPhase.hasRun || node.afterPhase.policies.size)) {
|
|
198
|
-
// If this node is waiting on a phase to complete,
|
|
199
|
-
// we need to skip it for now.
|
|
200
|
-
// Even if the phase is empty, we should wait for it
|
|
201
|
-
// to be walked to avoid re-ordering policies.
|
|
202
|
-
continue;
|
|
203
|
-
}
|
|
204
|
-
if (node.dependsOn.size === 0) {
|
|
205
|
-
// If there's nothing else we're waiting for, we can
|
|
206
|
-
// add this policy to the result list.
|
|
207
|
-
result.push(node.policy);
|
|
208
|
-
// Notify anything that depends on this policy that
|
|
209
|
-
// the policy has been scheduled.
|
|
210
|
-
for (const dependant of node.dependants) {
|
|
211
|
-
dependant.dependsOn.delete(node);
|
|
212
|
-
}
|
|
213
|
-
policyMap.delete(node.policy.name);
|
|
214
|
-
phase.policies.delete(node);
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
function walkPhases() {
|
|
219
|
-
for (const phase of orderedPhases) {
|
|
220
|
-
walkPhase(phase);
|
|
221
|
-
// if the phase isn't complete
|
|
222
|
-
if (phase.policies.size > 0 && phase !== noPhase) {
|
|
223
|
-
if (!noPhase.hasRun) {
|
|
224
|
-
// Try running noPhase to see if that unblocks this phase next tick.
|
|
225
|
-
// This can happen if a phase that happens before noPhase
|
|
226
|
-
// is waiting on a noPhase policy to complete.
|
|
227
|
-
walkPhase(noPhase);
|
|
228
|
-
}
|
|
229
|
-
// Don't proceed to the next phase until this phase finishes.
|
|
230
|
-
return;
|
|
231
|
-
}
|
|
232
|
-
if (phase.hasAfterPolicies) {
|
|
233
|
-
// Run any policies unblocked by this phase
|
|
234
|
-
walkPhase(noPhase);
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
// Iterate until we've put every node in the result list.
|
|
239
|
-
let iteration = 0;
|
|
240
|
-
while (policyMap.size > 0) {
|
|
241
|
-
iteration++;
|
|
242
|
-
const initialResultLength = result.length;
|
|
243
|
-
// Keep walking each phase in order until we can order every node.
|
|
244
|
-
walkPhases();
|
|
245
|
-
// The result list *should* get at least one larger each time
|
|
246
|
-
// after the first full pass.
|
|
247
|
-
// Otherwise, we're going to loop forever.
|
|
248
|
-
if (result.length <= initialResultLength && iteration > 1) {
|
|
249
|
-
throw new Error("Cannot satisfy policy dependencies due to requirements cycle.");
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
return result;
|
|
253
|
-
}
|
|
254
|
-
}
|
|
3
|
+
import { createEmptyPipeline as tspCreateEmptyPipeline } from "@typespec/ts-http-runtime";
|
|
255
4
|
/**
|
|
256
5
|
* Creates a totally empty pipeline.
|
|
257
6
|
* Useful for testing or creating a custom one.
|
|
258
7
|
*/
|
|
259
8
|
export function createEmptyPipeline() {
|
|
260
|
-
return
|
|
9
|
+
return tspCreateEmptyPipeline();
|
|
261
10
|
}
|
|
262
11
|
//# sourceMappingURL=pipeline.js.map
|