@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.
Files changed (295) hide show
  1. package/dist/browser/client/sendRequest.d.ts +10 -1
  2. package/dist/browser/client/sendRequest.js +8 -2
  3. package/dist/browser/client/sendRequest.js.map +1 -1
  4. package/dist/browser/defaultHttpClient.d.ts +1 -1
  5. package/dist/browser/defaultHttpClient.js +1 -1
  6. package/dist/browser/defaultHttpClient.js.map +1 -0
  7. package/dist/browser/index.d.ts +2 -2
  8. package/dist/browser/index.js +0 -2
  9. package/dist/browser/index.js.map +1 -1
  10. package/dist/browser/logger/log.d.ts +1 -1
  11. package/dist/browser/logger/log.js +1 -1
  12. package/dist/browser/logger/log.js.map +1 -0
  13. package/dist/browser/pipelineRequest.d.ts +1 -1
  14. package/dist/browser/pipelineRequest.js.map +1 -1
  15. package/dist/browser/policies/decompressResponsePolicy.d.ts +3 -2
  16. package/dist/browser/policies/decompressResponsePolicy.js +1 -4
  17. package/dist/browser/policies/decompressResponsePolicy.js.map +1 -0
  18. package/dist/browser/policies/internal.d.ts +7 -7
  19. package/dist/browser/policies/internal.js +2 -2
  20. package/dist/browser/policies/internal.js.map +1 -1
  21. package/dist/browser/policies/proxyPolicy.common.d.ts +7 -3
  22. package/dist/browser/policies/proxyPolicy.common.js +2 -2
  23. package/dist/browser/policies/proxyPolicy.common.js.map +1 -1
  24. package/dist/browser/policies/proxyPolicy.d.ts +1 -1
  25. package/dist/browser/policies/proxyPolicy.js +1 -1
  26. package/dist/browser/policies/proxyPolicy.js.map +1 -0
  27. package/dist/browser/policies/redirectPolicy.d.ts +7 -0
  28. package/dist/browser/policies/redirectPolicy.js +13 -4
  29. package/dist/browser/policies/redirectPolicy.js.map +1 -1
  30. package/dist/browser/util/bytesEncoding.d.ts +1 -1
  31. package/dist/browser/util/bytesEncoding.js +1 -1
  32. package/dist/browser/util/bytesEncoding.js.map +1 -0
  33. package/dist/browser/util/concat.common.d.ts +1 -2
  34. package/dist/browser/util/concat.common.js.map +1 -1
  35. package/dist/browser/util/concat.d.ts +1 -1
  36. package/dist/browser/util/concat.js +1 -1
  37. package/dist/browser/util/concat.js.map +1 -0
  38. package/dist/browser/util/inspect.d.ts +1 -1
  39. package/dist/browser/util/inspect.js +1 -1
  40. package/dist/browser/util/inspect.js.map +1 -0
  41. package/dist/browser/util/sha256.d.ts +1 -1
  42. package/dist/browser/util/sha256.js +1 -1
  43. package/dist/browser/util/sha256.js.map +1 -0
  44. package/dist/browser/util/userAgentPlatform.d.ts +1 -1
  45. package/dist/browser/util/userAgentPlatform.js +1 -1
  46. package/dist/browser/util/userAgentPlatform.js.map +1 -0
  47. package/dist/browser/util/uuidUtils.d.ts +1 -1
  48. package/dist/browser/util/uuidUtils.js +1 -1
  49. package/dist/browser/util/uuidUtils.js.map +1 -0
  50. package/dist/commonjs/abort-controller/AbortError.js +30 -40
  51. package/dist/commonjs/abort-controller/AbortError.js.map +7 -1
  52. package/dist/commonjs/auth/credentials.js +36 -25
  53. package/dist/commonjs/auth/credentials.js.map +7 -1
  54. package/dist/commonjs/auth/oauth2Flows.js +15 -5
  55. package/dist/commonjs/auth/oauth2Flows.js.map +7 -1
  56. package/dist/commonjs/auth/schemes.js +15 -5
  57. package/dist/commonjs/auth/schemes.js.map +7 -1
  58. package/dist/commonjs/client/apiVersionPolicy.js +39 -25
  59. package/dist/commonjs/client/apiVersionPolicy.js.map +7 -1
  60. package/dist/commonjs/client/clientHelpers.js +62 -39
  61. package/dist/commonjs/client/clientHelpers.js.map +7 -1
  62. package/dist/commonjs/client/common.js +15 -5
  63. package/dist/commonjs/client/common.js.map +7 -1
  64. package/dist/commonjs/client/getClient.js +170 -82
  65. package/dist/commonjs/client/getClient.js.map +7 -1
  66. package/dist/commonjs/client/multipart.js +119 -110
  67. package/dist/commonjs/client/multipart.js.map +7 -1
  68. package/dist/commonjs/client/operationOptionHelpers.js +36 -21
  69. package/dist/commonjs/client/operationOptionHelpers.js.map +7 -1
  70. package/dist/commonjs/client/restError.js +44 -26
  71. package/dist/commonjs/client/restError.js.map +7 -1
  72. package/dist/commonjs/client/sendRequest.d.ts +10 -1
  73. package/dist/commonjs/client/sendRequest.js +150 -164
  74. package/dist/commonjs/client/sendRequest.js.map +7 -1
  75. package/dist/commonjs/client/urlHelpers.js +124 -131
  76. package/dist/commonjs/client/urlHelpers.js.map +7 -1
  77. package/dist/commonjs/constants.js +30 -8
  78. package/dist/commonjs/constants.js.map +7 -1
  79. package/dist/commonjs/createPipelineFromOptions.js +56 -45
  80. package/dist/commonjs/createPipelineFromOptions.js.map +7 -1
  81. package/dist/commonjs/defaultHttpClient.js +28 -11
  82. package/dist/commonjs/defaultHttpClient.js.map +7 -1
  83. package/dist/commonjs/fetchHttpClient.js +211 -256
  84. package/dist/commonjs/fetchHttpClient.js.map +7 -1
  85. package/dist/commonjs/httpHeaders.js +97 -82
  86. package/dist/commonjs/httpHeaders.js.map +7 -1
  87. package/dist/commonjs/index.d.ts +2 -2
  88. package/dist/commonjs/index.js +67 -36
  89. package/dist/commonjs/index.js.map +7 -1
  90. package/dist/commonjs/interfaces.js +15 -5
  91. package/dist/commonjs/interfaces.js.map +7 -1
  92. package/dist/commonjs/log.js +28 -8
  93. package/dist/commonjs/log.js.map +7 -1
  94. package/dist/commonjs/logger/debug.js +150 -155
  95. package/dist/commonjs/logger/debug.js.map +7 -1
  96. package/dist/commonjs/logger/internal.js +27 -8
  97. package/dist/commonjs/logger/internal.js.map +7 -1
  98. package/dist/commonjs/logger/log.common.js +39 -23
  99. package/dist/commonjs/logger/log.common.js.map +7 -1
  100. package/dist/commonjs/logger/log.js +40 -11
  101. package/dist/commonjs/logger/log.js.map +7 -1
  102. package/dist/commonjs/logger/logger.js +120 -110
  103. package/dist/commonjs/logger/logger.js.map +7 -1
  104. package/dist/commonjs/nodeHttpClient.js +313 -321
  105. package/dist/commonjs/nodeHttpClient.js.map +7 -1
  106. package/dist/commonjs/pipeline.js +190 -247
  107. package/dist/commonjs/pipeline.js.map +7 -1
  108. package/dist/commonjs/pipelineRequest.d.ts +1 -1
  109. package/dist/commonjs/pipelineRequest.js +69 -54
  110. package/dist/commonjs/pipelineRequest.js.map +7 -1
  111. package/dist/commonjs/policies/agentPolicy.js +38 -24
  112. package/dist/commonjs/policies/agentPolicy.js.map +7 -1
  113. package/dist/commonjs/policies/auth/apiKeyAuthenticationPolicy.js +45 -32
  114. package/dist/commonjs/policies/auth/apiKeyAuthenticationPolicy.js.map +7 -1
  115. package/dist/commonjs/policies/auth/basicAuthenticationPolicy.js +50 -32
  116. package/dist/commonjs/policies/auth/basicAuthenticationPolicy.js.map +7 -1
  117. package/dist/commonjs/policies/auth/bearerAuthenticationPolicy.js +47 -32
  118. package/dist/commonjs/policies/auth/bearerAuthenticationPolicy.js.map +7 -1
  119. package/dist/commonjs/policies/auth/checkInsecureConnection.js +47 -44
  120. package/dist/commonjs/policies/auth/checkInsecureConnection.js.map +7 -1
  121. package/dist/commonjs/policies/auth/oauth2AuthenticationPolicy.js +45 -32
  122. package/dist/commonjs/policies/auth/oauth2AuthenticationPolicy.js.map +7 -1
  123. package/dist/commonjs/policies/decompressResponsePolicy.js +38 -25
  124. package/dist/commonjs/policies/decompressResponsePolicy.js.map +7 -1
  125. package/dist/commonjs/policies/defaultRetryPolicy.js +39 -27
  126. package/dist/commonjs/policies/defaultRetryPolicy.js.map +7 -1
  127. package/dist/commonjs/policies/exponentialRetryPolicy.js +43 -26
  128. package/dist/commonjs/policies/exponentialRetryPolicy.js.map +7 -1
  129. package/dist/commonjs/policies/formDataPolicy.js +101 -90
  130. package/dist/commonjs/policies/formDataPolicy.js.map +7 -1
  131. package/dist/commonjs/policies/internal.d.ts +7 -7
  132. package/dist/commonjs/policies/internal.js +94 -48
  133. package/dist/commonjs/policies/internal.js.map +7 -1
  134. package/dist/commonjs/policies/logPolicy.js +49 -35
  135. package/dist/commonjs/policies/logPolicy.js.map +7 -1
  136. package/dist/commonjs/policies/multipartPolicy.js +117 -99
  137. package/dist/commonjs/policies/multipartPolicy.js.map +7 -1
  138. package/dist/commonjs/policies/proxyPolicy.common.d.ts +7 -3
  139. package/dist/commonjs/policies/proxyPolicy.common.js +38 -25
  140. package/dist/commonjs/policies/proxyPolicy.common.js.map +7 -1
  141. package/dist/commonjs/policies/proxyPolicy.js +160 -171
  142. package/dist/commonjs/policies/proxyPolicy.js.map +7 -1
  143. package/dist/commonjs/policies/redirectPolicy.d.ts +7 -0
  144. package/dist/commonjs/policies/redirectPolicy.js +62 -51
  145. package/dist/commonjs/policies/redirectPolicy.js.map +7 -1
  146. package/dist/commonjs/policies/retryPolicy.js +123 -105
  147. package/dist/commonjs/policies/retryPolicy.js.map +7 -1
  148. package/dist/commonjs/policies/systemErrorRetryPolicy.js +46 -31
  149. package/dist/commonjs/policies/systemErrorRetryPolicy.js.map +7 -1
  150. package/dist/commonjs/policies/throttlingRetryPolicy.js +38 -30
  151. package/dist/commonjs/policies/throttlingRetryPolicy.js.map +7 -1
  152. package/dist/commonjs/policies/tlsPolicy.js +38 -24
  153. package/dist/commonjs/policies/tlsPolicy.js.map +7 -1
  154. package/dist/commonjs/policies/userAgentPolicy.js +41 -28
  155. package/dist/commonjs/policies/userAgentPolicy.js.map +7 -1
  156. package/dist/commonjs/restError.js +93 -90
  157. package/dist/commonjs/restError.js.map +7 -1
  158. package/dist/commonjs/retryStrategies/exponentialRetryStrategy.js +63 -62
  159. package/dist/commonjs/retryStrategies/exponentialRetryStrategy.js.map +7 -1
  160. package/dist/commonjs/retryStrategies/retryStrategy.js +15 -5
  161. package/dist/commonjs/retryStrategies/retryStrategy.js.map +7 -1
  162. package/dist/commonjs/retryStrategies/throttlingRetryStrategy.js +58 -69
  163. package/dist/commonjs/retryStrategies/throttlingRetryStrategy.js.map +7 -1
  164. package/dist/commonjs/util/arrayBuffer.js +34 -21
  165. package/dist/commonjs/util/arrayBuffer.js.map +7 -1
  166. package/dist/commonjs/util/bytesEncoding.common.js +83 -100
  167. package/dist/commonjs/util/bytesEncoding.common.js.map +7 -1
  168. package/dist/commonjs/util/bytesEncoding.js +30 -21
  169. package/dist/commonjs/util/bytesEncoding.js.map +7 -1
  170. package/dist/commonjs/util/checkEnvironment.js +45 -44
  171. package/dist/commonjs/util/checkEnvironment.js.map +7 -1
  172. package/dist/commonjs/util/concat.common.d.ts +1 -2
  173. package/dist/commonjs/util/concat.common.js +51 -52
  174. package/dist/commonjs/util/concat.common.js.map +7 -1
  175. package/dist/commonjs/util/concat.js +70 -61
  176. package/dist/commonjs/util/concat.js.map +7 -1
  177. package/dist/commonjs/util/delay.js +31 -21
  178. package/dist/commonjs/util/delay.js.map +7 -1
  179. package/dist/commonjs/util/error.js +33 -17
  180. package/dist/commonjs/util/error.js.map +7 -1
  181. package/dist/commonjs/util/helpers.js +65 -57
  182. package/dist/commonjs/util/helpers.js.map +7 -1
  183. package/dist/commonjs/util/inspect.common.js +27 -7
  184. package/dist/commonjs/util/inspect.common.js.map +7 -1
  185. package/dist/commonjs/util/inspect.js +28 -8
  186. package/dist/commonjs/util/inspect.js.map +7 -1
  187. package/dist/commonjs/util/internal.js +67 -32
  188. package/dist/commonjs/util/internal.js.map +7 -1
  189. package/dist/commonjs/util/object.js +27 -15
  190. package/dist/commonjs/util/object.js.map +7 -1
  191. package/dist/commonjs/util/random.js +30 -22
  192. package/dist/commonjs/util/random.js.map +7 -1
  193. package/dist/commonjs/util/sanitizer.js +157 -148
  194. package/dist/commonjs/util/sanitizer.js.map +7 -1
  195. package/dist/commonjs/util/sha256.common.js +61 -45
  196. package/dist/commonjs/util/sha256.common.js.map +7 -1
  197. package/dist/commonjs/util/sha256.js +32 -22
  198. package/dist/commonjs/util/sha256.js.map +7 -1
  199. package/dist/commonjs/util/typeGuards.js +41 -21
  200. package/dist/commonjs/util/typeGuards.js.map +7 -1
  201. package/dist/commonjs/util/userAgent.js +43 -28
  202. package/dist/commonjs/util/userAgent.js.map +7 -1
  203. package/dist/commonjs/util/userAgentPlatform.js +51 -29
  204. package/dist/commonjs/util/userAgentPlatform.js.map +7 -1
  205. package/dist/commonjs/util/uuidUtils.common.js +43 -39
  206. package/dist/commonjs/util/uuidUtils.common.js.map +7 -1
  207. package/dist/commonjs/util/uuidUtils.js +27 -12
  208. package/dist/commonjs/util/uuidUtils.js.map +7 -1
  209. package/dist/commonjs/xhrHttpClient.js +171 -163
  210. package/dist/commonjs/xhrHttpClient.js.map +7 -1
  211. package/dist/esm/client/sendRequest.d.ts +10 -1
  212. package/dist/esm/client/sendRequest.js +8 -2
  213. package/dist/esm/client/sendRequest.js.map +1 -1
  214. package/dist/esm/index.d.ts +2 -2
  215. package/dist/esm/index.js +0 -2
  216. package/dist/esm/index.js.map +1 -1
  217. package/dist/esm/pipelineRequest.d.ts +1 -1
  218. package/dist/esm/pipelineRequest.js.map +1 -1
  219. package/dist/esm/policies/internal.d.ts +7 -7
  220. package/dist/esm/policies/internal.js +2 -2
  221. package/dist/esm/policies/internal.js.map +1 -1
  222. package/dist/esm/policies/proxyPolicy.common.d.ts +7 -3
  223. package/dist/esm/policies/proxyPolicy.common.js +2 -2
  224. package/dist/esm/policies/proxyPolicy.common.js.map +1 -1
  225. package/dist/esm/policies/redirectPolicy.d.ts +7 -0
  226. package/dist/esm/policies/redirectPolicy.js +13 -4
  227. package/dist/esm/policies/redirectPolicy.js.map +1 -1
  228. package/dist/esm/util/concat.common.d.ts +1 -2
  229. package/dist/esm/util/concat.common.js.map +1 -1
  230. package/dist/react-native/client/sendRequest.d.ts +10 -1
  231. package/dist/react-native/client/sendRequest.js +8 -2
  232. package/dist/react-native/client/sendRequest.js.map +1 -1
  233. package/dist/react-native/defaultHttpClient.d.ts +1 -1
  234. package/dist/react-native/defaultHttpClient.js +1 -1
  235. package/dist/react-native/defaultHttpClient.js.map +1 -0
  236. package/dist/react-native/index.d.ts +2 -2
  237. package/dist/react-native/index.js +0 -2
  238. package/dist/react-native/index.js.map +1 -1
  239. package/dist/react-native/logger/log.d.ts +1 -1
  240. package/dist/react-native/logger/log.js +1 -1
  241. package/dist/react-native/logger/log.js.map +1 -0
  242. package/dist/react-native/pipelineRequest.d.ts +1 -1
  243. package/dist/react-native/pipelineRequest.js.map +1 -1
  244. package/dist/react-native/policies/internal.d.ts +7 -7
  245. package/dist/react-native/policies/internal.js +2 -2
  246. package/dist/react-native/policies/internal.js.map +1 -1
  247. package/dist/react-native/policies/proxyPolicy.common.d.ts +7 -3
  248. package/dist/react-native/policies/proxyPolicy.common.js +2 -2
  249. package/dist/react-native/policies/proxyPolicy.common.js.map +1 -1
  250. package/dist/react-native/policies/proxyPolicy.d.ts +1 -1
  251. package/dist/react-native/policies/proxyPolicy.js +1 -1
  252. package/dist/react-native/policies/proxyPolicy.js.map +1 -0
  253. package/dist/react-native/policies/redirectPolicy.d.ts +7 -0
  254. package/dist/react-native/policies/redirectPolicy.js +13 -4
  255. package/dist/react-native/policies/redirectPolicy.js.map +1 -1
  256. package/dist/react-native/util/bytesEncoding.d.ts +1 -1
  257. package/dist/react-native/util/bytesEncoding.js +1 -1
  258. package/dist/react-native/util/bytesEncoding.js.map +1 -0
  259. package/dist/react-native/util/concat.common.d.ts +1 -2
  260. package/dist/react-native/util/concat.common.js.map +1 -1
  261. package/dist/react-native/util/concat.d.ts +1 -1
  262. package/dist/react-native/util/concat.js +1 -1
  263. package/dist/react-native/util/concat.js.map +1 -0
  264. package/dist/react-native/util/inspect.d.ts +1 -1
  265. package/dist/react-native/util/inspect.js +1 -1
  266. package/dist/react-native/util/inspect.js.map +1 -0
  267. package/dist/react-native/util/sha256.d.ts +1 -1
  268. package/dist/react-native/util/sha256.js +1 -1
  269. package/dist/react-native/util/sha256.js.map +1 -0
  270. package/dist/react-native/util/userAgentPlatform.d.ts +1 -1
  271. package/dist/react-native/util/userAgentPlatform.js +1 -1
  272. package/dist/react-native/util/userAgentPlatform.js.map +1 -0
  273. package/dist/react-native/util/uuidUtils.d.ts +1 -1
  274. package/dist/react-native/util/uuidUtils.js +1 -1
  275. package/dist/react-native/util/uuidUtils.js.map +1 -0
  276. package/package.json +1 -21
  277. package/dist/browser/defaultHttpClient-browser.mjs.map +0 -1
  278. package/dist/browser/logger/log-browser.mjs.map +0 -1
  279. package/dist/browser/policies/decompressResponsePolicy-browser.mjs.map +0 -1
  280. package/dist/browser/policies/proxyPolicy-browser.mjs.map +0 -1
  281. package/dist/browser/util/bytesEncoding-browser.mjs.map +0 -1
  282. package/dist/browser/util/concat-browser.mjs.map +0 -1
  283. package/dist/browser/util/inspect-browser.mjs.map +0 -1
  284. package/dist/browser/util/sha256-browser.mjs.map +0 -1
  285. package/dist/browser/util/userAgentPlatform-browser.mjs.map +0 -1
  286. package/dist/browser/util/uuidUtils-browser.mjs.map +0 -1
  287. package/dist/react-native/defaultHttpClient-react-native.mjs.map +0 -1
  288. package/dist/react-native/logger/log-react-native.mjs.map +0 -1
  289. package/dist/react-native/policies/proxyPolicy-react-native.mjs.map +0 -1
  290. package/dist/react-native/util/bytesEncoding-react-native.mjs.map +0 -1
  291. package/dist/react-native/util/concat-react-native.mjs.map +0 -1
  292. package/dist/react-native/util/inspect-react-native.mjs.map +0 -1
  293. package/dist/react-native/util/sha256-react-native.mjs.map +0 -1
  294. package/dist/react-native/util/userAgentPlatform-react-native.mjs.map +0 -1
  295. package/dist/react-native/util/uuidUtils-react-native.mjs.map +0 -1
@@ -1,107 +1,125 @@
1
- "use strict";
2
- // Copyright (c) Microsoft Corporation.
3
- // Licensed under the MIT License.
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.retryPolicy = retryPolicy;
6
- const helpers_js_1 = require("../util/helpers.js");
7
- const AbortError_js_1 = require("../abort-controller/AbortError.js");
8
- const logger_js_1 = require("../logger/logger.js");
9
- const constants_js_1 = require("../constants.js");
10
- const retryPolicyLogger = (0, logger_js_1.createClientLogger)("ts-http-runtime retryPolicy");
11
- /**
12
- * The programmatic identifier of the retryPolicy.
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
- * retryPolicy is a generic policy to enable retrying requests when certain conditions are met
17
- */
18
- function retryPolicy(strategies, options = { maxRetries: constants_js_1.DEFAULT_RETRY_POLICY_COUNT }) {
19
- const logger = options.logger || retryPolicyLogger;
20
- return {
21
- name: retryPolicyName,
22
- async sendRequest(request, next) {
23
- let response;
24
- let responseError;
25
- let retryCount = -1;
26
- retryRequest: while (true) {
27
- retryCount += 1;
28
- response = undefined;
29
- responseError = undefined;
30
- try {
31
- logger.info(`Retry ${retryCount}: Attempting to send request`, request.requestId);
32
- response = await next(request);
33
- logger.info(`Retry ${retryCount}: Received a response from request`, request.requestId);
34
- }
35
- catch (e) {
36
- logger.error(`Retry ${retryCount}: Received an error from request`, request.requestId);
37
- // RestErrors are valid targets for the retry strategies.
38
- // If none of the retry strategies can work with them, they will be thrown later in this policy.
39
- // If the received error is not a RestError, it is immediately thrown.
40
- responseError = e;
41
- if (!e || responseError.name !== "RestError") {
42
- throw e;
43
- }
44
- response = responseError.response;
45
- }
46
- if (request.abortSignal?.aborted) {
47
- logger.error(`Retry ${retryCount}: Request aborted.`);
48
- const abortError = new AbortError_js_1.AbortError();
49
- throw abortError;
50
- }
51
- if (retryCount >= (options.maxRetries ?? constants_js_1.DEFAULT_RETRY_POLICY_COUNT)) {
52
- logger.info(`Retry ${retryCount}: Maximum retries reached. Returning the last received response, or throwing the last received error.`);
53
- if (responseError) {
54
- throw responseError;
55
- }
56
- else if (response) {
57
- return response;
58
- }
59
- else {
60
- throw new Error("Maximum retries reached with no response or error to throw");
61
- }
62
- }
63
- logger.info(`Retry ${retryCount}: Processing ${strategies.length} retry strategies.`);
64
- strategiesLoop: for (const strategy of strategies) {
65
- const strategyLogger = strategy.logger || logger;
66
- strategyLogger.info(`Retry ${retryCount}: Processing retry strategy ${strategy.name}.`);
67
- const modifiers = strategy.retry({
68
- retryCount,
69
- response,
70
- responseError,
71
- });
72
- if (modifiers.skipStrategy) {
73
- strategyLogger.info(`Retry ${retryCount}: Skipped.`);
74
- continue strategiesLoop;
75
- }
76
- const { errorToThrow, retryAfterInMs, redirectTo } = modifiers;
77
- if (errorToThrow) {
78
- strategyLogger.error(`Retry ${retryCount}: Retry strategy ${strategy.name} throws error:`, errorToThrow);
79
- throw errorToThrow;
80
- }
81
- if (retryAfterInMs || retryAfterInMs === 0) {
82
- strategyLogger.info(`Retry ${retryCount}: Retry strategy ${strategy.name} retries after ${retryAfterInMs}`);
83
- await (0, helpers_js_1.delay)(retryAfterInMs, undefined, { abortSignal: request.abortSignal });
84
- continue retryRequest;
85
- }
86
- if (redirectTo) {
87
- strategyLogger.info(`Retry ${retryCount}: Retry strategy ${strategy.name} redirects to ${redirectTo}`);
88
- request.url = redirectTo;
89
- continue retryRequest;
90
- }
91
- }
92
- if (responseError) {
93
- logger.info(`None of the retry strategies could work with the received error. Throwing it.`);
94
- throw responseError;
95
- }
96
- if (response) {
97
- logger.info(`None of the retry strategies could work with the received response. Returning it.`);
98
- return response;
99
- }
100
- // If all the retries skip and there's no response,
101
- // we're still in the retry loop, so a new request will be sent
102
- // until `maxRetries` is reached.
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
- //# sourceMappingURL=retryPolicy.js.map
122
+ // Annotate the CommonJS export names for ESM import in node:
123
+ 0 && (module.exports = {
124
+ retryPolicy
125
+ });
@@ -1 +1,7 @@
1
- {"version":3,"file":"retryPolicy.js","sourceRoot":"","sources":["../../../src/policies/retryPolicy.ts"],"names":[],"mappings":"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","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"]}
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
- "use strict";
2
- // Copyright (c) Microsoft Corporation.
3
- // Licensed under the MIT License.
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.systemErrorRetryPolicyName = void 0;
6
- exports.systemErrorRetryPolicy = systemErrorRetryPolicy;
7
- const exponentialRetryStrategy_js_1 = require("../retryStrategies/exponentialRetryStrategy.js");
8
- const retryPolicy_js_1 = require("./retryPolicy.js");
9
- const constants_js_1 = require("../constants.js");
10
- /**
11
- * Name of the {@link systemErrorRetryPolicy}
12
- */
13
- exports.systemErrorRetryPolicyName = "systemErrorRetryPolicy";
14
- /**
15
- * A retry policy that specifically seeks to handle errors in the
16
- * underlying transport layer (e.g. DNS lookup failures) rather than
17
- * retryable error codes from the server itself.
18
- * @param options - Options that customize the policy.
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
- return {
22
- name: exports.systemErrorRetryPolicyName,
23
- sendRequest: (0, retryPolicy_js_1.retryPolicy)([
24
- (0, exponentialRetryStrategy_js_1.exponentialRetryStrategy)({
25
- ...options,
26
- ignoreHttpStatusCodes: true,
27
- }),
28
- ], {
29
- maxRetries: options.maxRetries ?? constants_js_1.DEFAULT_RETRY_POLICY_COUNT,
30
- }).sendRequest,
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
- //# sourceMappingURL=systemErrorRetryPolicy.js.map
44
+ // Annotate the CommonJS export names for ESM import in node:
45
+ 0 && (module.exports = {
46
+ systemErrorRetryPolicy,
47
+ systemErrorRetryPolicyName
48
+ });
@@ -1 +1,7 @@
1
- {"version":3,"file":"systemErrorRetryPolicy.js","sourceRoot":"","sources":["../../../src/policies/systemErrorRetryPolicy.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAyClC,wDAiBC;AAvDD,gGAA0F;AAC1F,qDAA+C;AAC/C,kDAA6D;AAE7D;;GAEG;AACU,QAAA,0BAA0B,GAAG,wBAAwB,CAAC;AAyBnE;;;;;GAKG;AACH,SAAgB,sBAAsB,CACpC,UAAyC,EAAE;IAE3C,OAAO;QACL,IAAI,EAAE,kCAA0B;QAChC,WAAW,EAAE,IAAA,4BAAW,EACtB;YACE,IAAA,sDAAwB,EAAC;gBACvB,GAAG,OAAO;gBACV,qBAAqB,EAAE,IAAI;aAC5B,CAAC;SACH,EACD;YACE,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,yCAA0B;SAC7D,CACF,CAAC,WAAW;KACd,CAAC;AACJ,CAAC","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"]}
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
- "use strict";
2
- // Copyright (c) Microsoft Corporation.
3
- // Licensed under the MIT License.
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.throttlingRetryPolicyName = void 0;
6
- exports.throttlingRetryPolicy = throttlingRetryPolicy;
7
- const throttlingRetryStrategy_js_1 = require("../retryStrategies/throttlingRetryStrategy.js");
8
- const retryPolicy_js_1 = require("./retryPolicy.js");
9
- const constants_js_1 = require("../constants.js");
10
- /**
11
- * Name of the {@link throttlingRetryPolicy}
12
- */
13
- exports.throttlingRetryPolicyName = "throttlingRetryPolicy";
14
- /**
15
- * A policy that retries when the server sends a 429 response with a Retry-After header.
16
- *
17
- * To learn more, please refer to
18
- * https://learn.microsoft.com/azure/azure-resource-manager/resource-manager-request-limits,
19
- * https://learn.microsoft.com/azure/azure-subscription-service-limits and
20
- * https://learn.microsoft.com/azure/virtual-machines/troubleshooting/troubleshooting-throttling-errors
21
- *
22
- * @param options - Options that configure retry logic.
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
- return {
26
- name: exports.throttlingRetryPolicyName,
27
- sendRequest: (0, retryPolicy_js_1.retryPolicy)([(0, throttlingRetryStrategy_js_1.throttlingRetryStrategy)()], {
28
- maxRetries: options.maxRetries ?? constants_js_1.DEFAULT_RETRY_POLICY_COUNT,
29
- }).sendRequest,
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
- //# sourceMappingURL=throttlingRetryPolicy.js.map
36
+ // Annotate the CommonJS export names for ESM import in node:
37
+ 0 && (module.exports = {
38
+ throttlingRetryPolicy,
39
+ throttlingRetryPolicyName
40
+ });
@@ -1 +1,7 @@
1
- {"version":3,"file":"throttlingRetryPolicy.js","sourceRoot":"","sources":["../../../src/policies/throttlingRetryPolicy.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAgClC,sDAOC;AApCD,8FAAwF;AACxF,qDAA+C;AAC/C,kDAA6D;AAE7D;;GAEG;AACU,QAAA,yBAAyB,GAAG,uBAAuB,CAAC;AAYjE;;;;;;;;;GASG;AACH,SAAgB,qBAAqB,CAAC,UAAwC,EAAE;IAC9E,OAAO;QACL,IAAI,EAAE,iCAAyB;QAC/B,WAAW,EAAE,IAAA,4BAAW,EAAC,CAAC,IAAA,oDAAuB,GAAE,CAAC,EAAE;YACpD,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,yCAA0B;SAC7D,CAAC,CAAC,WAAW;KACf,CAAC;AACJ,CAAC","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"]}
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
- "use strict";
2
- // Copyright (c) Microsoft Corporation.
3
- // Licensed under the MIT License.
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.tlsPolicyName = void 0;
6
- exports.tlsPolicy = tlsPolicy;
7
- /**
8
- * Name of the TLS Policy
9
- */
10
- exports.tlsPolicyName = "tlsPolicy";
11
- /**
12
- * Gets a pipeline policy that adds the client certificate to the HttpClient agent for authentication.
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
- return {
16
- name: exports.tlsPolicyName,
17
- sendRequest: async (req, next) => {
18
- // Users may define a request tlsSettings, honor those over the client level one
19
- if (!req.tlsSettings) {
20
- req.tlsSettings = tlsSettings;
21
- }
22
- return next(req);
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
- //# sourceMappingURL=tlsPolicy.js.map
36
+ // Annotate the CommonJS export names for ESM import in node:
37
+ 0 && (module.exports = {
38
+ tlsPolicy,
39
+ tlsPolicyName
40
+ });
@@ -1 +1,7 @@
1
- {"version":3,"file":"tlsPolicy.js","sourceRoot":"","sources":["../../../src/policies/tlsPolicy.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAalC,8BAWC;AAnBD;;GAEG;AACU,QAAA,aAAa,GAAG,WAAW,CAAC;AAEzC;;GAEG;AACH,SAAgB,SAAS,CAAC,WAAyB;IACjD,OAAO;QACL,IAAI,EAAE,qBAAa;QACnB,WAAW,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;YAC/B,gFAAgF;YAChF,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC;gBACrB,GAAG,CAAC,WAAW,GAAG,WAAW,CAAC;YAChC,CAAC;YACD,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;KACF,CAAC;AACJ,CAAC","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"]}
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
+ }