@typespec/ts-http-runtime 0.3.4-alpha.20260227.2 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/client/sendRequest.d.ts +10 -1
- package/dist/browser/client/sendRequest.js +8 -2
- package/dist/browser/client/sendRequest.js.map +1 -1
- package/dist/browser/defaultHttpClient.d.ts +1 -1
- package/dist/browser/defaultHttpClient.js +1 -1
- package/dist/browser/defaultHttpClient.js.map +1 -0
- package/dist/browser/index.d.ts +2 -2
- package/dist/browser/index.js +0 -2
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/logger/log.d.ts +1 -1
- package/dist/browser/logger/log.js +1 -1
- package/dist/browser/logger/log.js.map +1 -0
- package/dist/browser/pipelineRequest.d.ts +1 -1
- package/dist/browser/pipelineRequest.js.map +1 -1
- package/dist/browser/policies/decompressResponsePolicy.d.ts +3 -2
- package/dist/browser/policies/decompressResponsePolicy.js +1 -4
- package/dist/browser/policies/decompressResponsePolicy.js.map +1 -0
- package/dist/browser/policies/internal.d.ts +7 -7
- package/dist/browser/policies/internal.js +2 -2
- package/dist/browser/policies/internal.js.map +1 -1
- package/dist/browser/policies/proxyPolicy.common.d.ts +7 -3
- package/dist/browser/policies/proxyPolicy.common.js +2 -2
- package/dist/browser/policies/proxyPolicy.common.js.map +1 -1
- package/dist/browser/policies/proxyPolicy.d.ts +1 -1
- package/dist/browser/policies/proxyPolicy.js +1 -1
- package/dist/browser/policies/proxyPolicy.js.map +1 -0
- package/dist/browser/policies/redirectPolicy.d.ts +7 -0
- package/dist/browser/policies/redirectPolicy.js +13 -4
- package/dist/browser/policies/redirectPolicy.js.map +1 -1
- package/dist/browser/util/bytesEncoding.d.ts +1 -1
- package/dist/browser/util/bytesEncoding.js +1 -1
- package/dist/browser/util/bytesEncoding.js.map +1 -0
- package/dist/browser/util/concat.common.d.ts +1 -2
- package/dist/browser/util/concat.common.js.map +1 -1
- package/dist/browser/util/concat.d.ts +1 -1
- package/dist/browser/util/concat.js +1 -1
- package/dist/browser/util/concat.js.map +1 -0
- package/dist/browser/util/inspect.d.ts +1 -1
- package/dist/browser/util/inspect.js +1 -1
- package/dist/browser/util/inspect.js.map +1 -0
- package/dist/browser/util/sha256.d.ts +1 -1
- package/dist/browser/util/sha256.js +1 -1
- package/dist/browser/util/sha256.js.map +1 -0
- package/dist/browser/util/userAgentPlatform.d.ts +1 -1
- package/dist/browser/util/userAgentPlatform.js +1 -1
- package/dist/browser/util/userAgentPlatform.js.map +1 -0
- package/dist/browser/util/uuidUtils.d.ts +1 -1
- package/dist/browser/util/uuidUtils.js +1 -1
- package/dist/browser/util/uuidUtils.js.map +1 -0
- package/dist/commonjs/abort-controller/AbortError.js +30 -40
- package/dist/commonjs/abort-controller/AbortError.js.map +7 -1
- package/dist/commonjs/auth/credentials.js +36 -25
- package/dist/commonjs/auth/credentials.js.map +7 -1
- package/dist/commonjs/auth/oauth2Flows.js +15 -5
- package/dist/commonjs/auth/oauth2Flows.js.map +7 -1
- package/dist/commonjs/auth/schemes.js +15 -5
- package/dist/commonjs/auth/schemes.js.map +7 -1
- package/dist/commonjs/client/apiVersionPolicy.js +39 -25
- package/dist/commonjs/client/apiVersionPolicy.js.map +7 -1
- package/dist/commonjs/client/clientHelpers.js +62 -39
- package/dist/commonjs/client/clientHelpers.js.map +7 -1
- package/dist/commonjs/client/common.js +15 -5
- package/dist/commonjs/client/common.js.map +7 -1
- package/dist/commonjs/client/getClient.js +170 -82
- package/dist/commonjs/client/getClient.js.map +7 -1
- package/dist/commonjs/client/multipart.js +119 -110
- package/dist/commonjs/client/multipart.js.map +7 -1
- package/dist/commonjs/client/operationOptionHelpers.js +36 -21
- package/dist/commonjs/client/operationOptionHelpers.js.map +7 -1
- package/dist/commonjs/client/restError.js +44 -26
- package/dist/commonjs/client/restError.js.map +7 -1
- package/dist/commonjs/client/sendRequest.d.ts +10 -1
- package/dist/commonjs/client/sendRequest.js +150 -164
- package/dist/commonjs/client/sendRequest.js.map +7 -1
- package/dist/commonjs/client/urlHelpers.js +124 -131
- package/dist/commonjs/client/urlHelpers.js.map +7 -1
- package/dist/commonjs/constants.js +30 -8
- package/dist/commonjs/constants.js.map +7 -1
- package/dist/commonjs/createPipelineFromOptions.js +56 -45
- package/dist/commonjs/createPipelineFromOptions.js.map +7 -1
- package/dist/commonjs/defaultHttpClient.js +28 -11
- package/dist/commonjs/defaultHttpClient.js.map +7 -1
- package/dist/commonjs/fetchHttpClient.js +211 -256
- package/dist/commonjs/fetchHttpClient.js.map +7 -1
- package/dist/commonjs/httpHeaders.js +97 -82
- package/dist/commonjs/httpHeaders.js.map +7 -1
- package/dist/commonjs/index.d.ts +2 -2
- package/dist/commonjs/index.js +67 -36
- package/dist/commonjs/index.js.map +7 -1
- package/dist/commonjs/interfaces.js +15 -5
- package/dist/commonjs/interfaces.js.map +7 -1
- package/dist/commonjs/log.js +28 -8
- package/dist/commonjs/log.js.map +7 -1
- package/dist/commonjs/logger/debug.js +150 -155
- package/dist/commonjs/logger/debug.js.map +7 -1
- package/dist/commonjs/logger/internal.js +27 -8
- package/dist/commonjs/logger/internal.js.map +7 -1
- package/dist/commonjs/logger/log.common.js +39 -23
- package/dist/commonjs/logger/log.common.js.map +7 -1
- package/dist/commonjs/logger/log.js +40 -11
- package/dist/commonjs/logger/log.js.map +7 -1
- package/dist/commonjs/logger/logger.js +120 -110
- package/dist/commonjs/logger/logger.js.map +7 -1
- package/dist/commonjs/nodeHttpClient.js +313 -321
- package/dist/commonjs/nodeHttpClient.js.map +7 -1
- package/dist/commonjs/pipeline.js +190 -247
- package/dist/commonjs/pipeline.js.map +7 -1
- package/dist/commonjs/pipelineRequest.d.ts +1 -1
- package/dist/commonjs/pipelineRequest.js +69 -54
- package/dist/commonjs/pipelineRequest.js.map +7 -1
- package/dist/commonjs/policies/agentPolicy.js +38 -24
- package/dist/commonjs/policies/agentPolicy.js.map +7 -1
- package/dist/commonjs/policies/auth/apiKeyAuthenticationPolicy.js +45 -32
- package/dist/commonjs/policies/auth/apiKeyAuthenticationPolicy.js.map +7 -1
- package/dist/commonjs/policies/auth/basicAuthenticationPolicy.js +50 -32
- package/dist/commonjs/policies/auth/basicAuthenticationPolicy.js.map +7 -1
- package/dist/commonjs/policies/auth/bearerAuthenticationPolicy.js +47 -32
- package/dist/commonjs/policies/auth/bearerAuthenticationPolicy.js.map +7 -1
- package/dist/commonjs/policies/auth/checkInsecureConnection.js +47 -44
- package/dist/commonjs/policies/auth/checkInsecureConnection.js.map +7 -1
- package/dist/commonjs/policies/auth/oauth2AuthenticationPolicy.js +45 -32
- package/dist/commonjs/policies/auth/oauth2AuthenticationPolicy.js.map +7 -1
- package/dist/commonjs/policies/decompressResponsePolicy.js +38 -25
- package/dist/commonjs/policies/decompressResponsePolicy.js.map +7 -1
- package/dist/commonjs/policies/defaultRetryPolicy.js +39 -27
- package/dist/commonjs/policies/defaultRetryPolicy.js.map +7 -1
- package/dist/commonjs/policies/exponentialRetryPolicy.js +43 -26
- package/dist/commonjs/policies/exponentialRetryPolicy.js.map +7 -1
- package/dist/commonjs/policies/formDataPolicy.js +101 -90
- package/dist/commonjs/policies/formDataPolicy.js.map +7 -1
- package/dist/commonjs/policies/internal.d.ts +7 -7
- package/dist/commonjs/policies/internal.js +94 -48
- package/dist/commonjs/policies/internal.js.map +7 -1
- package/dist/commonjs/policies/logPolicy.js +49 -35
- package/dist/commonjs/policies/logPolicy.js.map +7 -1
- package/dist/commonjs/policies/multipartPolicy.js +117 -99
- package/dist/commonjs/policies/multipartPolicy.js.map +7 -1
- package/dist/commonjs/policies/proxyPolicy.common.d.ts +7 -3
- package/dist/commonjs/policies/proxyPolicy.common.js +38 -25
- package/dist/commonjs/policies/proxyPolicy.common.js.map +7 -1
- package/dist/commonjs/policies/proxyPolicy.js +160 -171
- package/dist/commonjs/policies/proxyPolicy.js.map +7 -1
- package/dist/commonjs/policies/redirectPolicy.d.ts +7 -0
- package/dist/commonjs/policies/redirectPolicy.js +62 -51
- package/dist/commonjs/policies/redirectPolicy.js.map +7 -1
- package/dist/commonjs/policies/retryPolicy.js +123 -105
- package/dist/commonjs/policies/retryPolicy.js.map +7 -1
- package/dist/commonjs/policies/systemErrorRetryPolicy.js +46 -31
- package/dist/commonjs/policies/systemErrorRetryPolicy.js.map +7 -1
- package/dist/commonjs/policies/throttlingRetryPolicy.js +38 -30
- package/dist/commonjs/policies/throttlingRetryPolicy.js.map +7 -1
- package/dist/commonjs/policies/tlsPolicy.js +38 -24
- package/dist/commonjs/policies/tlsPolicy.js.map +7 -1
- package/dist/commonjs/policies/userAgentPolicy.js +41 -28
- package/dist/commonjs/policies/userAgentPolicy.js.map +7 -1
- package/dist/commonjs/restError.js +93 -90
- package/dist/commonjs/restError.js.map +7 -1
- package/dist/commonjs/retryStrategies/exponentialRetryStrategy.js +63 -62
- package/dist/commonjs/retryStrategies/exponentialRetryStrategy.js.map +7 -1
- package/dist/commonjs/retryStrategies/retryStrategy.js +15 -5
- package/dist/commonjs/retryStrategies/retryStrategy.js.map +7 -1
- package/dist/commonjs/retryStrategies/throttlingRetryStrategy.js +58 -69
- package/dist/commonjs/retryStrategies/throttlingRetryStrategy.js.map +7 -1
- package/dist/commonjs/util/arrayBuffer.js +34 -21
- package/dist/commonjs/util/arrayBuffer.js.map +7 -1
- package/dist/commonjs/util/bytesEncoding.common.js +83 -100
- package/dist/commonjs/util/bytesEncoding.common.js.map +7 -1
- package/dist/commonjs/util/bytesEncoding.js +30 -21
- package/dist/commonjs/util/bytesEncoding.js.map +7 -1
- package/dist/commonjs/util/checkEnvironment.js +45 -44
- package/dist/commonjs/util/checkEnvironment.js.map +7 -1
- package/dist/commonjs/util/concat.common.d.ts +1 -2
- package/dist/commonjs/util/concat.common.js +51 -52
- package/dist/commonjs/util/concat.common.js.map +7 -1
- package/dist/commonjs/util/concat.js +70 -61
- package/dist/commonjs/util/concat.js.map +7 -1
- package/dist/commonjs/util/delay.js +31 -21
- package/dist/commonjs/util/delay.js.map +7 -1
- package/dist/commonjs/util/error.js +33 -17
- package/dist/commonjs/util/error.js.map +7 -1
- package/dist/commonjs/util/helpers.js +65 -57
- package/dist/commonjs/util/helpers.js.map +7 -1
- package/dist/commonjs/util/inspect.common.js +27 -7
- package/dist/commonjs/util/inspect.common.js.map +7 -1
- package/dist/commonjs/util/inspect.js +28 -8
- package/dist/commonjs/util/inspect.js.map +7 -1
- package/dist/commonjs/util/internal.js +67 -32
- package/dist/commonjs/util/internal.js.map +7 -1
- package/dist/commonjs/util/object.js +27 -15
- package/dist/commonjs/util/object.js.map +7 -1
- package/dist/commonjs/util/random.js +30 -22
- package/dist/commonjs/util/random.js.map +7 -1
- package/dist/commonjs/util/sanitizer.js +157 -148
- package/dist/commonjs/util/sanitizer.js.map +7 -1
- package/dist/commonjs/util/sha256.common.js +61 -45
- package/dist/commonjs/util/sha256.common.js.map +7 -1
- package/dist/commonjs/util/sha256.js +32 -22
- package/dist/commonjs/util/sha256.js.map +7 -1
- package/dist/commonjs/util/typeGuards.js +41 -21
- package/dist/commonjs/util/typeGuards.js.map +7 -1
- package/dist/commonjs/util/userAgent.js +43 -28
- package/dist/commonjs/util/userAgent.js.map +7 -1
- package/dist/commonjs/util/userAgentPlatform.js +51 -29
- package/dist/commonjs/util/userAgentPlatform.js.map +7 -1
- package/dist/commonjs/util/uuidUtils.common.js +43 -39
- package/dist/commonjs/util/uuidUtils.common.js.map +7 -1
- package/dist/commonjs/util/uuidUtils.js +27 -12
- package/dist/commonjs/util/uuidUtils.js.map +7 -1
- package/dist/commonjs/xhrHttpClient.js +171 -163
- package/dist/commonjs/xhrHttpClient.js.map +7 -1
- package/dist/esm/client/sendRequest.d.ts +10 -1
- package/dist/esm/client/sendRequest.js +8 -2
- package/dist/esm/client/sendRequest.js.map +1 -1
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js +0 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/pipelineRequest.d.ts +1 -1
- package/dist/esm/pipelineRequest.js.map +1 -1
- package/dist/esm/policies/internal.d.ts +7 -7
- package/dist/esm/policies/internal.js +2 -2
- package/dist/esm/policies/internal.js.map +1 -1
- package/dist/esm/policies/proxyPolicy.common.d.ts +7 -3
- package/dist/esm/policies/proxyPolicy.common.js +2 -2
- package/dist/esm/policies/proxyPolicy.common.js.map +1 -1
- package/dist/esm/policies/redirectPolicy.d.ts +7 -0
- package/dist/esm/policies/redirectPolicy.js +13 -4
- package/dist/esm/policies/redirectPolicy.js.map +1 -1
- package/dist/esm/util/concat.common.d.ts +1 -2
- package/dist/esm/util/concat.common.js.map +1 -1
- package/dist/react-native/client/sendRequest.d.ts +10 -1
- package/dist/react-native/client/sendRequest.js +8 -2
- package/dist/react-native/client/sendRequest.js.map +1 -1
- package/dist/react-native/defaultHttpClient.d.ts +1 -1
- package/dist/react-native/defaultHttpClient.js +1 -1
- package/dist/react-native/defaultHttpClient.js.map +1 -0
- package/dist/react-native/index.d.ts +2 -2
- package/dist/react-native/index.js +0 -2
- package/dist/react-native/index.js.map +1 -1
- package/dist/react-native/logger/log.d.ts +1 -1
- package/dist/react-native/logger/log.js +1 -1
- package/dist/react-native/logger/log.js.map +1 -0
- package/dist/react-native/pipelineRequest.d.ts +1 -1
- package/dist/react-native/pipelineRequest.js.map +1 -1
- package/dist/react-native/policies/internal.d.ts +7 -7
- package/dist/react-native/policies/internal.js +2 -2
- package/dist/react-native/policies/internal.js.map +1 -1
- package/dist/react-native/policies/proxyPolicy.common.d.ts +7 -3
- package/dist/react-native/policies/proxyPolicy.common.js +2 -2
- package/dist/react-native/policies/proxyPolicy.common.js.map +1 -1
- package/dist/react-native/policies/proxyPolicy.d.ts +1 -1
- package/dist/react-native/policies/proxyPolicy.js +1 -1
- package/dist/react-native/policies/proxyPolicy.js.map +1 -0
- package/dist/react-native/policies/redirectPolicy.d.ts +7 -0
- package/dist/react-native/policies/redirectPolicy.js +13 -4
- package/dist/react-native/policies/redirectPolicy.js.map +1 -1
- package/dist/react-native/util/bytesEncoding.d.ts +1 -1
- package/dist/react-native/util/bytesEncoding.js +1 -1
- package/dist/react-native/util/bytesEncoding.js.map +1 -0
- package/dist/react-native/util/concat.common.d.ts +1 -2
- package/dist/react-native/util/concat.common.js.map +1 -1
- package/dist/react-native/util/concat.d.ts +1 -1
- package/dist/react-native/util/concat.js +1 -1
- package/dist/react-native/util/concat.js.map +1 -0
- package/dist/react-native/util/inspect.d.ts +1 -1
- package/dist/react-native/util/inspect.js +1 -1
- package/dist/react-native/util/inspect.js.map +1 -0
- package/dist/react-native/util/sha256.d.ts +1 -1
- package/dist/react-native/util/sha256.js +1 -1
- package/dist/react-native/util/sha256.js.map +1 -0
- package/dist/react-native/util/userAgentPlatform.d.ts +1 -1
- package/dist/react-native/util/userAgentPlatform.js +1 -1
- package/dist/react-native/util/userAgentPlatform.js.map +1 -0
- package/dist/react-native/util/uuidUtils.d.ts +1 -1
- package/dist/react-native/util/uuidUtils.js +1 -1
- package/dist/react-native/util/uuidUtils.js.map +1 -0
- package/package.json +1 -21
- package/dist/browser/defaultHttpClient-browser.mjs.map +0 -1
- package/dist/browser/logger/log-browser.mjs.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/util/bytesEncoding-browser.mjs.map +0 -1
- package/dist/browser/util/concat-browser.mjs.map +0 -1
- package/dist/browser/util/inspect-browser.mjs.map +0 -1
- package/dist/browser/util/sha256-browser.mjs.map +0 -1
- package/dist/browser/util/userAgentPlatform-browser.mjs.map +0 -1
- package/dist/browser/util/uuidUtils-browser.mjs.map +0 -1
- package/dist/react-native/defaultHttpClient-react-native.mjs.map +0 -1
- package/dist/react-native/logger/log-react-native.mjs.map +0 -1
- package/dist/react-native/policies/proxyPolicy-react-native.mjs.map +0 -1
- package/dist/react-native/util/bytesEncoding-react-native.mjs.map +0 -1
- package/dist/react-native/util/concat-react-native.mjs.map +0 -1
- package/dist/react-native/util/inspect-react-native.mjs.map +0 -1
- package/dist/react-native/util/sha256-react-native.mjs.map +0 -1
- package/dist/react-native/util/userAgentPlatform-react-native.mjs.map +0 -1
- package/dist/react-native/util/uuidUtils-react-native.mjs.map +0 -1
|
@@ -1,107 +1,125 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var retryPolicy_exports = {};
|
|
19
|
+
__export(retryPolicy_exports, {
|
|
20
|
+
retryPolicy: () => retryPolicy
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(retryPolicy_exports);
|
|
23
|
+
var import_helpers = require("../util/helpers.js");
|
|
24
|
+
var import_AbortError = require("../abort-controller/AbortError.js");
|
|
25
|
+
var import_logger = require("../logger/logger.js");
|
|
26
|
+
var import_constants = require("../constants.js");
|
|
27
|
+
const retryPolicyLogger = (0, import_logger.createClientLogger)("ts-http-runtime retryPolicy");
|
|
14
28
|
const retryPolicyName = "retryPolicy";
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
29
|
+
function retryPolicy(strategies, options = { maxRetries: import_constants.DEFAULT_RETRY_POLICY_COUNT }) {
|
|
30
|
+
const logger = options.logger || retryPolicyLogger;
|
|
31
|
+
return {
|
|
32
|
+
name: retryPolicyName,
|
|
33
|
+
async sendRequest(request, next) {
|
|
34
|
+
let response;
|
|
35
|
+
let responseError;
|
|
36
|
+
let retryCount = -1;
|
|
37
|
+
retryRequest: while (true) {
|
|
38
|
+
retryCount += 1;
|
|
39
|
+
response = void 0;
|
|
40
|
+
responseError = void 0;
|
|
41
|
+
try {
|
|
42
|
+
logger.info(`Retry ${retryCount}: Attempting to send request`, request.requestId);
|
|
43
|
+
response = await next(request);
|
|
44
|
+
logger.info(`Retry ${retryCount}: Received a response from request`, request.requestId);
|
|
45
|
+
} catch (e) {
|
|
46
|
+
logger.error(`Retry ${retryCount}: Received an error from request`, request.requestId);
|
|
47
|
+
responseError = e;
|
|
48
|
+
if (!e || responseError.name !== "RestError") {
|
|
49
|
+
throw e;
|
|
50
|
+
}
|
|
51
|
+
response = responseError.response;
|
|
52
|
+
}
|
|
53
|
+
if (request.abortSignal?.aborted) {
|
|
54
|
+
logger.error(`Retry ${retryCount}: Request aborted.`);
|
|
55
|
+
const abortError = new import_AbortError.AbortError();
|
|
56
|
+
throw abortError;
|
|
57
|
+
}
|
|
58
|
+
if (retryCount >= (options.maxRetries ?? import_constants.DEFAULT_RETRY_POLICY_COUNT)) {
|
|
59
|
+
logger.info(
|
|
60
|
+
`Retry ${retryCount}: Maximum retries reached. Returning the last received response, or throwing the last received error.`
|
|
61
|
+
);
|
|
62
|
+
if (responseError) {
|
|
63
|
+
throw responseError;
|
|
64
|
+
} else if (response) {
|
|
65
|
+
return response;
|
|
66
|
+
} else {
|
|
67
|
+
throw new Error("Maximum retries reached with no response or error to throw");
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
logger.info(`Retry ${retryCount}: Processing ${strategies.length} retry strategies.`);
|
|
71
|
+
strategiesLoop: for (const strategy of strategies) {
|
|
72
|
+
const strategyLogger = strategy.logger || logger;
|
|
73
|
+
strategyLogger.info(`Retry ${retryCount}: Processing retry strategy ${strategy.name}.`);
|
|
74
|
+
const modifiers = strategy.retry({
|
|
75
|
+
retryCount,
|
|
76
|
+
response,
|
|
77
|
+
responseError
|
|
78
|
+
});
|
|
79
|
+
if (modifiers.skipStrategy) {
|
|
80
|
+
strategyLogger.info(`Retry ${retryCount}: Skipped.`);
|
|
81
|
+
continue strategiesLoop;
|
|
82
|
+
}
|
|
83
|
+
const { errorToThrow, retryAfterInMs, redirectTo } = modifiers;
|
|
84
|
+
if (errorToThrow) {
|
|
85
|
+
strategyLogger.error(
|
|
86
|
+
`Retry ${retryCount}: Retry strategy ${strategy.name} throws error:`,
|
|
87
|
+
errorToThrow
|
|
88
|
+
);
|
|
89
|
+
throw errorToThrow;
|
|
90
|
+
}
|
|
91
|
+
if (retryAfterInMs || retryAfterInMs === 0) {
|
|
92
|
+
strategyLogger.info(
|
|
93
|
+
`Retry ${retryCount}: Retry strategy ${strategy.name} retries after ${retryAfterInMs}`
|
|
94
|
+
);
|
|
95
|
+
await (0, import_helpers.delay)(retryAfterInMs, void 0, { abortSignal: request.abortSignal });
|
|
96
|
+
continue retryRequest;
|
|
97
|
+
}
|
|
98
|
+
if (redirectTo) {
|
|
99
|
+
strategyLogger.info(
|
|
100
|
+
`Retry ${retryCount}: Retry strategy ${strategy.name} redirects to ${redirectTo}`
|
|
101
|
+
);
|
|
102
|
+
request.url = redirectTo;
|
|
103
|
+
continue retryRequest;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
if (responseError) {
|
|
107
|
+
logger.info(
|
|
108
|
+
`None of the retry strategies could work with the received error. Throwing it.`
|
|
109
|
+
);
|
|
110
|
+
throw responseError;
|
|
111
|
+
}
|
|
112
|
+
if (response) {
|
|
113
|
+
logger.info(
|
|
114
|
+
`None of the retry strategies could work with the received response. Returning it.`
|
|
115
|
+
);
|
|
116
|
+
return response;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
};
|
|
106
121
|
}
|
|
107
|
-
|
|
122
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
123
|
+
0 && (module.exports = {
|
|
124
|
+
retryPolicy
|
|
125
|
+
});
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["/mnt/vss/_work/1/s/sdk/core/ts-http-runtime/src/policies/retryPolicy.ts"],
|
|
4
|
+
"sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { PipelineRequest, PipelineResponse, SendRequest } from \"../interfaces.js\";\nimport type { PipelinePolicy } from \"../pipeline.js\";\nimport { delay } from \"../util/helpers.js\";\nimport type { RetryStrategy } from \"../retryStrategies/retryStrategy.js\";\nimport type { RestError } from \"../restError.js\";\nimport { AbortError } from \"../abort-controller/AbortError.js\";\nimport type { TypeSpecRuntimeLogger } from \"../logger/logger.js\";\nimport { createClientLogger } from \"../logger/logger.js\";\nimport { DEFAULT_RETRY_POLICY_COUNT } from \"../constants.js\";\n\nconst retryPolicyLogger = createClientLogger(\"ts-http-runtime retryPolicy\");\n\n/**\n * The programmatic identifier of the retryPolicy.\n */\nconst retryPolicyName = \"retryPolicy\";\n\n/**\n * Options to the {@link retryPolicy}\n */\nexport interface RetryPolicyOptions {\n /**\n * Maximum number of retries. If not specified, it will limit to 3 retries.\n */\n maxRetries?: number;\n /**\n * Logger. If it's not provided, a default logger is used.\n */\n logger?: TypeSpecRuntimeLogger;\n}\n\n/**\n * retryPolicy is a generic policy to enable retrying requests when certain conditions are met\n */\nexport function retryPolicy(\n strategies: RetryStrategy[],\n options: RetryPolicyOptions = { maxRetries: DEFAULT_RETRY_POLICY_COUNT },\n): PipelinePolicy {\n const logger = options.logger || retryPolicyLogger;\n return {\n name: retryPolicyName,\n async sendRequest(request: PipelineRequest, next: SendRequest): Promise<PipelineResponse> {\n let response: PipelineResponse | undefined;\n let responseError: RestError | undefined;\n let retryCount = -1;\n\n retryRequest: while (true) {\n retryCount += 1;\n response = undefined;\n responseError = undefined;\n\n try {\n logger.info(`Retry ${retryCount}: Attempting to send request`, request.requestId);\n response = await next(request);\n logger.info(`Retry ${retryCount}: Received a response from request`, request.requestId);\n } catch (e: any) {\n logger.error(`Retry ${retryCount}: Received an error from request`, request.requestId);\n\n // RestErrors are valid targets for the retry strategies.\n // If none of the retry strategies can work with them, they will be thrown later in this policy.\n // If the received error is not a RestError, it is immediately thrown.\n responseError = e as RestError;\n if (!e || responseError.name !== \"RestError\") {\n throw e;\n }\n\n response = responseError.response;\n }\n\n if (request.abortSignal?.aborted) {\n logger.error(`Retry ${retryCount}: Request aborted.`);\n const abortError = new AbortError();\n throw abortError;\n }\n\n if (retryCount >= (options.maxRetries ?? DEFAULT_RETRY_POLICY_COUNT)) {\n logger.info(\n `Retry ${retryCount}: Maximum retries reached. Returning the last received response, or throwing the last received error.`,\n );\n if (responseError) {\n throw responseError;\n } else if (response) {\n return response;\n } else {\n throw new Error(\"Maximum retries reached with no response or error to throw\");\n }\n }\n\n logger.info(`Retry ${retryCount}: Processing ${strategies.length} retry strategies.`);\n\n strategiesLoop: for (const strategy of strategies) {\n const strategyLogger = strategy.logger || logger;\n strategyLogger.info(`Retry ${retryCount}: Processing retry strategy ${strategy.name}.`);\n\n const modifiers = strategy.retry({\n retryCount,\n response,\n responseError,\n });\n\n if (modifiers.skipStrategy) {\n strategyLogger.info(`Retry ${retryCount}: Skipped.`);\n continue strategiesLoop;\n }\n\n const { errorToThrow, retryAfterInMs, redirectTo } = modifiers;\n\n if (errorToThrow) {\n strategyLogger.error(\n `Retry ${retryCount}: Retry strategy ${strategy.name} throws error:`,\n errorToThrow,\n );\n throw errorToThrow;\n }\n\n if (retryAfterInMs || retryAfterInMs === 0) {\n strategyLogger.info(\n `Retry ${retryCount}: Retry strategy ${strategy.name} retries after ${retryAfterInMs}`,\n );\n await delay(retryAfterInMs, undefined, { abortSignal: request.abortSignal });\n continue retryRequest;\n }\n\n if (redirectTo) {\n strategyLogger.info(\n `Retry ${retryCount}: Retry strategy ${strategy.name} redirects to ${redirectTo}`,\n );\n request.url = redirectTo;\n continue retryRequest;\n }\n }\n\n if (responseError) {\n logger.info(\n `None of the retry strategies could work with the received error. Throwing it.`,\n );\n throw responseError;\n }\n if (response) {\n logger.info(\n `None of the retry strategies could work with the received response. Returning it.`,\n );\n return response;\n }\n\n // If all the retries skip and there's no response,\n // we're still in the retry loop, so a new request will be sent\n // until `maxRetries` is reached.\n }\n },\n };\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,qBAAsB;AAGtB,wBAA2B;AAE3B,oBAAmC;AACnC,uBAA2C;AAE3C,MAAM,wBAAoB,kCAAmB,6BAA6B;AAK1E,MAAM,kBAAkB;AAmBjB,SAAS,YACd,YACA,UAA8B,EAAE,YAAY,4CAA2B,GACvD;AAChB,QAAM,SAAS,QAAQ,UAAU;AACjC,SAAO;AAAA,IACL,MAAM;AAAA,IACN,MAAM,YAAY,SAA0B,MAA8C;AACxF,UAAI;AACJ,UAAI;AACJ,UAAI,aAAa;AAEjB,mBAAc,QAAO,MAAM;AACzB,sBAAc;AACd,mBAAW;AACX,wBAAgB;AAEhB,YAAI;AACF,iBAAO,KAAK,SAAS,UAAU,gCAAgC,QAAQ,SAAS;AAChF,qBAAW,MAAM,KAAK,OAAO;AAC7B,iBAAO,KAAK,SAAS,UAAU,sCAAsC,QAAQ,SAAS;AAAA,QACxF,SAAS,GAAQ;AACf,iBAAO,MAAM,SAAS,UAAU,oCAAoC,QAAQ,SAAS;AAKrF,0BAAgB;AAChB,cAAI,CAAC,KAAK,cAAc,SAAS,aAAa;AAC5C,kBAAM;AAAA,UACR;AAEA,qBAAW,cAAc;AAAA,QAC3B;AAEA,YAAI,QAAQ,aAAa,SAAS;AAChC,iBAAO,MAAM,SAAS,UAAU,oBAAoB;AACpD,gBAAM,aAAa,IAAI,6BAAW;AAClC,gBAAM;AAAA,QACR;AAEA,YAAI,eAAe,QAAQ,cAAc,8CAA6B;AACpE,iBAAO;AAAA,YACL,SAAS,UAAU;AAAA,UACrB;AACA,cAAI,eAAe;AACjB,kBAAM;AAAA,UACR,WAAW,UAAU;AACnB,mBAAO;AAAA,UACT,OAAO;AACL,kBAAM,IAAI,MAAM,4DAA4D;AAAA,UAC9E;AAAA,QACF;AAEA,eAAO,KAAK,SAAS,UAAU,gBAAgB,WAAW,MAAM,oBAAoB;AAEpF,uBAAgB,YAAW,YAAY,YAAY;AACjD,gBAAM,iBAAiB,SAAS,UAAU;AAC1C,yBAAe,KAAK,SAAS,UAAU,+BAA+B,SAAS,IAAI,GAAG;AAEtF,gBAAM,YAAY,SAAS,MAAM;AAAA,YAC/B;AAAA,YACA;AAAA,YACA;AAAA,UACF,CAAC;AAED,cAAI,UAAU,cAAc;AAC1B,2BAAe,KAAK,SAAS,UAAU,YAAY;AACnD,qBAAS;AAAA,UACX;AAEA,gBAAM,EAAE,cAAc,gBAAgB,WAAW,IAAI;AAErD,cAAI,cAAc;AAChB,2BAAe;AAAA,cACb,SAAS,UAAU,oBAAoB,SAAS,IAAI;AAAA,cACpD;AAAA,YACF;AACA,kBAAM;AAAA,UACR;AAEA,cAAI,kBAAkB,mBAAmB,GAAG;AAC1C,2BAAe;AAAA,cACb,SAAS,UAAU,oBAAoB,SAAS,IAAI,kBAAkB,cAAc;AAAA,YACtF;AACA,sBAAM,sBAAM,gBAAgB,QAAW,EAAE,aAAa,QAAQ,YAAY,CAAC;AAC3E,qBAAS;AAAA,UACX;AAEA,cAAI,YAAY;AACd,2BAAe;AAAA,cACb,SAAS,UAAU,oBAAoB,SAAS,IAAI,iBAAiB,UAAU;AAAA,YACjF;AACA,oBAAQ,MAAM;AACd,qBAAS;AAAA,UACX;AAAA,QACF;AAEA,YAAI,eAAe;AACjB,iBAAO;AAAA,YACL;AAAA,UACF;AACA,gBAAM;AAAA,QACR;AACA,YAAI,UAAU;AACZ,iBAAO;AAAA,YACL;AAAA,UACF;AACA,iBAAO;AAAA,QACT;AAAA,MAKF;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,33 +1,48 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var systemErrorRetryPolicy_exports = {};
|
|
19
|
+
__export(systemErrorRetryPolicy_exports, {
|
|
20
|
+
systemErrorRetryPolicy: () => systemErrorRetryPolicy,
|
|
21
|
+
systemErrorRetryPolicyName: () => systemErrorRetryPolicyName
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(systemErrorRetryPolicy_exports);
|
|
24
|
+
var import_exponentialRetryStrategy = require("../retryStrategies/exponentialRetryStrategy.js");
|
|
25
|
+
var import_retryPolicy = require("./retryPolicy.js");
|
|
26
|
+
var import_constants = require("../constants.js");
|
|
27
|
+
const systemErrorRetryPolicyName = "systemErrorRetryPolicy";
|
|
20
28
|
function systemErrorRetryPolicy(options = {}) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
return {
|
|
30
|
+
name: systemErrorRetryPolicyName,
|
|
31
|
+
sendRequest: (0, import_retryPolicy.retryPolicy)(
|
|
32
|
+
[
|
|
33
|
+
(0, import_exponentialRetryStrategy.exponentialRetryStrategy)({
|
|
34
|
+
...options,
|
|
35
|
+
ignoreHttpStatusCodes: true
|
|
36
|
+
})
|
|
37
|
+
],
|
|
38
|
+
{
|
|
39
|
+
maxRetries: options.maxRetries ?? import_constants.DEFAULT_RETRY_POLICY_COUNT
|
|
40
|
+
}
|
|
41
|
+
).sendRequest
|
|
42
|
+
};
|
|
32
43
|
}
|
|
33
|
-
|
|
44
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
45
|
+
0 && (module.exports = {
|
|
46
|
+
systemErrorRetryPolicy,
|
|
47
|
+
systemErrorRetryPolicyName
|
|
48
|
+
});
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["/mnt/vss/_work/1/s/sdk/core/ts-http-runtime/src/policies/systemErrorRetryPolicy.ts"],
|
|
4
|
+
"sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { PipelinePolicy } from \"../pipeline.js\";\nimport { exponentialRetryStrategy } from \"../retryStrategies/exponentialRetryStrategy.js\";\nimport { retryPolicy } from \"./retryPolicy.js\";\nimport { DEFAULT_RETRY_POLICY_COUNT } from \"../constants.js\";\n\n/**\n * Name of the {@link systemErrorRetryPolicy}\n */\nexport const systemErrorRetryPolicyName = \"systemErrorRetryPolicy\";\n\n/**\n * Options that control how to retry failed requests.\n */\nexport interface SystemErrorRetryPolicyOptions {\n /**\n * The maximum number of retry attempts. Defaults to 3.\n */\n maxRetries?: number;\n\n /**\n * The amount of delay in milliseconds between retry attempts. Defaults to 1000\n * (1 second.) The delay increases exponentially with each retry up to a maximum\n * specified by maxRetryDelayInMs.\n */\n retryDelayInMs?: number;\n\n /**\n * The maximum delay in milliseconds allowed before retrying an operation. Defaults\n * to 64000 (64 seconds).\n */\n maxRetryDelayInMs?: number;\n}\n\n/**\n * A retry policy that specifically seeks to handle errors in the\n * underlying transport layer (e.g. DNS lookup failures) rather than\n * retryable error codes from the server itself.\n * @param options - Options that customize the policy.\n */\nexport function systemErrorRetryPolicy(\n options: SystemErrorRetryPolicyOptions = {},\n): PipelinePolicy {\n return {\n name: systemErrorRetryPolicyName,\n sendRequest: retryPolicy(\n [\n exponentialRetryStrategy({\n ...options,\n ignoreHttpStatusCodes: true,\n }),\n ],\n {\n maxRetries: options.maxRetries ?? DEFAULT_RETRY_POLICY_COUNT,\n },\n ).sendRequest,\n };\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,sCAAyC;AACzC,yBAA4B;AAC5B,uBAA2C;AAKpC,MAAM,6BAA6B;AA+BnC,SAAS,uBACd,UAAyC,CAAC,GAC1B;AAChB,SAAO;AAAA,IACL,MAAM;AAAA,IACN,iBAAa;AAAA,MACX;AAAA,YACE,0DAAyB;AAAA,UACvB,GAAG;AAAA,UACH,uBAAuB;AAAA,QACzB,CAAC;AAAA,MACH;AAAA,MACA;AAAA,QACE,YAAY,QAAQ,cAAc;AAAA,MACpC;AAAA,IACF,EAAE;AAAA,EACJ;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,32 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var throttlingRetryPolicy_exports = {};
|
|
19
|
+
__export(throttlingRetryPolicy_exports, {
|
|
20
|
+
throttlingRetryPolicy: () => throttlingRetryPolicy,
|
|
21
|
+
throttlingRetryPolicyName: () => throttlingRetryPolicyName
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(throttlingRetryPolicy_exports);
|
|
24
|
+
var import_throttlingRetryStrategy = require("../retryStrategies/throttlingRetryStrategy.js");
|
|
25
|
+
var import_retryPolicy = require("./retryPolicy.js");
|
|
26
|
+
var import_constants = require("../constants.js");
|
|
27
|
+
const throttlingRetryPolicyName = "throttlingRetryPolicy";
|
|
24
28
|
function throttlingRetryPolicy(options = {}) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
return {
|
|
30
|
+
name: throttlingRetryPolicyName,
|
|
31
|
+
sendRequest: (0, import_retryPolicy.retryPolicy)([(0, import_throttlingRetryStrategy.throttlingRetryStrategy)()], {
|
|
32
|
+
maxRetries: options.maxRetries ?? import_constants.DEFAULT_RETRY_POLICY_COUNT
|
|
33
|
+
}).sendRequest
|
|
34
|
+
};
|
|
31
35
|
}
|
|
32
|
-
|
|
36
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
+
0 && (module.exports = {
|
|
38
|
+
throttlingRetryPolicy,
|
|
39
|
+
throttlingRetryPolicyName
|
|
40
|
+
});
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["/mnt/vss/_work/1/s/sdk/core/ts-http-runtime/src/policies/throttlingRetryPolicy.ts"],
|
|
4
|
+
"sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { PipelinePolicy } from \"../pipeline.js\";\nimport { throttlingRetryStrategy } from \"../retryStrategies/throttlingRetryStrategy.js\";\nimport { retryPolicy } from \"./retryPolicy.js\";\nimport { DEFAULT_RETRY_POLICY_COUNT } from \"../constants.js\";\n\n/**\n * Name of the {@link throttlingRetryPolicy}\n */\nexport const throttlingRetryPolicyName = \"throttlingRetryPolicy\";\n\n/**\n * Options that control how to retry failed requests.\n */\nexport interface ThrottlingRetryPolicyOptions {\n /**\n * The maximum number of retry attempts. Defaults to 3.\n */\n maxRetries?: number;\n}\n\n/**\n * A policy that retries when the server sends a 429 response with a Retry-After header.\n *\n * To learn more, please refer to\n * https://learn.microsoft.com/azure/azure-resource-manager/resource-manager-request-limits,\n * https://learn.microsoft.com/azure/azure-subscription-service-limits and\n * https://learn.microsoft.com/azure/virtual-machines/troubleshooting/troubleshooting-throttling-errors\n *\n * @param options - Options that configure retry logic.\n */\nexport function throttlingRetryPolicy(options: ThrottlingRetryPolicyOptions = {}): PipelinePolicy {\n return {\n name: throttlingRetryPolicyName,\n sendRequest: retryPolicy([throttlingRetryStrategy()], {\n maxRetries: options.maxRetries ?? DEFAULT_RETRY_POLICY_COUNT,\n }).sendRequest,\n };\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,qCAAwC;AACxC,yBAA4B;AAC5B,uBAA2C;AAKpC,MAAM,4BAA4B;AAsBlC,SAAS,sBAAsB,UAAwC,CAAC,GAAmB;AAChG,SAAO;AAAA,IACL,MAAM;AAAA,IACN,iBAAa,gCAAY,KAAC,wDAAwB,CAAC,GAAG;AAAA,MACpD,YAAY,QAAQ,cAAc;AAAA,IACpC,CAAC,EAAE;AAAA,EACL;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,26 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var tlsPolicy_exports = {};
|
|
19
|
+
__export(tlsPolicy_exports, {
|
|
20
|
+
tlsPolicy: () => tlsPolicy,
|
|
21
|
+
tlsPolicyName: () => tlsPolicyName
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(tlsPolicy_exports);
|
|
24
|
+
const tlsPolicyName = "tlsPolicy";
|
|
14
25
|
function tlsPolicy(tlsSettings) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
26
|
+
return {
|
|
27
|
+
name: tlsPolicyName,
|
|
28
|
+
sendRequest: async (req, next) => {
|
|
29
|
+
if (!req.tlsSettings) {
|
|
30
|
+
req.tlsSettings = tlsSettings;
|
|
31
|
+
}
|
|
32
|
+
return next(req);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
25
35
|
}
|
|
26
|
-
|
|
36
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
+
0 && (module.exports = {
|
|
38
|
+
tlsPolicy,
|
|
39
|
+
tlsPolicyName
|
|
40
|
+
});
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["/mnt/vss/_work/1/s/sdk/core/ts-http-runtime/src/policies/tlsPolicy.ts"],
|
|
4
|
+
"sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { PipelinePolicy } from \"../pipeline.js\";\nimport type { TlsSettings } from \"../interfaces.js\";\n\n/**\n * Name of the TLS Policy\n */\nexport const tlsPolicyName = \"tlsPolicy\";\n\n/**\n * Gets a pipeline policy that adds the client certificate to the HttpClient agent for authentication.\n */\nexport function tlsPolicy(tlsSettings?: TlsSettings): PipelinePolicy {\n return {\n name: tlsPolicyName,\n sendRequest: async (req, next) => {\n // Users may define a request tlsSettings, honor those over the client level one\n if (!req.tlsSettings) {\n req.tlsSettings = tlsSettings;\n }\n return next(req);\n },\n };\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASO,MAAM,gBAAgB;AAKtB,SAAS,UAAU,aAA2C;AACnE,SAAO;AAAA,IACL,MAAM;AAAA,IACN,aAAa,OAAO,KAAK,SAAS;AAEhC,UAAI,CAAC,IAAI,aAAa;AACpB,YAAI,cAAc;AAAA,MACpB;AACA,aAAO,KAAK,GAAG;AAAA,IACjB;AAAA,EACF;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|