@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,30 +1,43 @@
1
- "use strict";
2
- // Copyright (c) Microsoft Corporation.
3
- // Licensed under the MIT License.
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.userAgentPolicyName = void 0;
6
- exports.userAgentPolicy = userAgentPolicy;
7
- const userAgent_js_1 = require("../util/userAgent.js");
8
- const UserAgentHeaderName = (0, userAgent_js_1.getUserAgentHeaderName)();
9
- /**
10
- * The programmatic identifier of the userAgentPolicy.
11
- */
12
- exports.userAgentPolicyName = "userAgentPolicy";
13
- /**
14
- * A policy that sets the User-Agent header (or equivalent) to reflect
15
- * the library version.
16
- * @param options - Options to customize the user agent value.
17
- */
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 userAgentPolicy_exports = {};
19
+ __export(userAgentPolicy_exports, {
20
+ userAgentPolicy: () => userAgentPolicy,
21
+ userAgentPolicyName: () => userAgentPolicyName
22
+ });
23
+ module.exports = __toCommonJS(userAgentPolicy_exports);
24
+ var import_userAgent = require("../util/userAgent.js");
25
+ const UserAgentHeaderName = (0, import_userAgent.getUserAgentHeaderName)();
26
+ const userAgentPolicyName = "userAgentPolicy";
18
27
  function userAgentPolicy(options = {}) {
19
- const userAgentValue = (0, userAgent_js_1.getUserAgentValue)(options.userAgentPrefix);
20
- return {
21
- name: exports.userAgentPolicyName,
22
- async sendRequest(request, next) {
23
- if (!request.headers.has(UserAgentHeaderName)) {
24
- request.headers.set(UserAgentHeaderName, await userAgentValue);
25
- }
26
- return next(request);
27
- },
28
- };
28
+ const userAgentValue = (0, import_userAgent.getUserAgentValue)(options.userAgentPrefix);
29
+ return {
30
+ name: userAgentPolicyName,
31
+ async sendRequest(request, next) {
32
+ if (!request.headers.has(UserAgentHeaderName)) {
33
+ request.headers.set(UserAgentHeaderName, await userAgentValue);
34
+ }
35
+ return next(request);
36
+ }
37
+ };
29
38
  }
30
- //# sourceMappingURL=userAgentPolicy.js.map
39
+ // Annotate the CommonJS export names for ESM import in node:
40
+ 0 && (module.exports = {
41
+ userAgentPolicy,
42
+ userAgentPolicyName
43
+ });
@@ -1 +1,7 @@
1
- {"version":3,"file":"userAgentPolicy.js","sourceRoot":"","sources":["../../../src/policies/userAgentPolicy.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AA6BlC,0CAWC;AApCD,uDAAiF;AAEjF,MAAM,mBAAmB,GAAG,IAAA,qCAAsB,GAAE,CAAC;AAErD;;GAEG;AACU,QAAA,mBAAmB,GAAG,iBAAiB,CAAC;AAarD;;;;GAIG;AACH,SAAgB,eAAe,CAAC,UAAkC,EAAE;IAClE,MAAM,cAAc,GAAG,IAAA,gCAAiB,EAAC,OAAO,CAAC,eAAe,CAAC,CAAC;IAClE,OAAO;QACL,IAAI,EAAE,2BAAmB;QACzB,KAAK,CAAC,WAAW,CAAC,OAAwB,EAAE,IAAiB;YAC3D,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,EAAE,CAAC;gBAC9C,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,MAAM,cAAc,CAAC,CAAC;YACjE,CAAC;YACD,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;QACvB,CAAC;KACF,CAAC;AACJ,CAAC","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 { getUserAgentHeaderName, getUserAgentValue } from \"../util/userAgent.js\";\n\nconst UserAgentHeaderName = getUserAgentHeaderName();\n\n/**\n * The programmatic identifier of the userAgentPolicy.\n */\nexport const userAgentPolicyName = \"userAgentPolicy\";\n\n/**\n * Options for adding user agent details to outgoing requests.\n */\nexport interface UserAgentPolicyOptions {\n /**\n * String prefix to add to the user agent for outgoing requests.\n * Defaults to an empty string.\n */\n userAgentPrefix?: string;\n}\n\n/**\n * A policy that sets the User-Agent header (or equivalent) to reflect\n * the library version.\n * @param options - Options to customize the user agent value.\n */\nexport function userAgentPolicy(options: UserAgentPolicyOptions = {}): PipelinePolicy {\n const userAgentValue = getUserAgentValue(options.userAgentPrefix);\n return {\n name: userAgentPolicyName,\n async sendRequest(request: PipelineRequest, next: SendRequest): Promise<PipelineResponse> {\n if (!request.headers.has(UserAgentHeaderName)) {\n request.headers.set(UserAgentHeaderName, await userAgentValue);\n }\n return next(request);\n },\n };\n}\n"]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["/mnt/vss/_work/1/s/sdk/core/ts-http-runtime/src/policies/userAgentPolicy.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 { getUserAgentHeaderName, getUserAgentValue } from \"../util/userAgent.js\";\n\nconst UserAgentHeaderName = getUserAgentHeaderName();\n\n/**\n * The programmatic identifier of the userAgentPolicy.\n */\nexport const userAgentPolicyName = \"userAgentPolicy\";\n\n/**\n * Options for adding user agent details to outgoing requests.\n */\nexport interface UserAgentPolicyOptions {\n /**\n * String prefix to add to the user agent for outgoing requests.\n * Defaults to an empty string.\n */\n userAgentPrefix?: string;\n}\n\n/**\n * A policy that sets the User-Agent header (or equivalent) to reflect\n * the library version.\n * @param options - Options to customize the user agent value.\n */\nexport function userAgentPolicy(options: UserAgentPolicyOptions = {}): PipelinePolicy {\n const userAgentValue = getUserAgentValue(options.userAgentPrefix);\n return {\n name: userAgentPolicyName,\n async sendRequest(request: PipelineRequest, next: SendRequest): Promise<PipelineResponse> {\n if (!request.headers.has(UserAgentHeaderName)) {\n request.headers.set(UserAgentHeaderName, await userAgentValue);\n }\n return next(request);\n },\n };\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,uBAA0D;AAE1D,MAAM,0BAAsB,yCAAuB;AAK5C,MAAM,sBAAsB;AAkB5B,SAAS,gBAAgB,UAAkC,CAAC,GAAmB;AACpF,QAAM,qBAAiB,oCAAkB,QAAQ,eAAe;AAChE,SAAO;AAAA,IACL,MAAM;AAAA,IACN,MAAM,YAAY,SAA0B,MAA8C;AACxF,UAAI,CAAC,QAAQ,QAAQ,IAAI,mBAAmB,GAAG;AAC7C,gBAAQ,QAAQ,IAAI,qBAAqB,MAAM,cAAc;AAAA,MAC/D;AACA,aAAO,KAAK,OAAO;AAAA,IACrB;AAAA,EACF;AACF;",
6
+ "names": []
7
+ }
@@ -1,94 +1,97 @@
1
- "use strict";
2
- // Copyright (c) Microsoft Corporation.
3
- // Licensed under the MIT License.
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.RestError = void 0;
6
- exports.isRestError = isRestError;
7
- const error_js_1 = require("./util/error.js");
8
- const inspect_js_1 = require("./util/inspect.js");
9
- const sanitizer_js_1 = require("./util/sanitizer.js");
10
- const errorSanitizer = new sanitizer_js_1.Sanitizer();
11
- /**
12
- * A custom error type for failed pipeline requests.
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 restError_exports = {};
19
+ __export(restError_exports, {
20
+ RestError: () => RestError,
21
+ isRestError: () => isRestError
22
+ });
23
+ module.exports = __toCommonJS(restError_exports);
24
+ var import_error = require("./util/error.js");
25
+ var import_inspect = require("./util/inspect.js");
26
+ var import_sanitizer = require("./util/sanitizer.js");
27
+ const errorSanitizer = new import_sanitizer.Sanitizer();
14
28
  class RestError extends Error {
15
- /**
16
- * Something went wrong when making the request.
17
- * This means the actual request failed for some reason,
18
- * such as a DNS issue or the connection being lost.
19
- */
20
- static REQUEST_SEND_ERROR = "REQUEST_SEND_ERROR";
21
- /**
22
- * This means that parsing the response from the server failed.
23
- * It may have been malformed.
24
- */
25
- static PARSE_ERROR = "PARSE_ERROR";
26
- /**
27
- * The code of the error itself (use statics on RestError if possible.)
28
- */
29
- code;
30
- /**
31
- * The HTTP status code of the request (if applicable.)
32
- */
33
- statusCode;
34
- /**
35
- * The request that was made.
36
- * This property is non-enumerable.
37
- */
38
- request;
39
- /**
40
- * The response received (if any.)
41
- * This property is non-enumerable.
42
- */
43
- response;
44
- /**
45
- * Bonus property set by the throw site.
46
- */
47
- details;
48
- constructor(message, options = {}) {
49
- super(message);
50
- this.name = "RestError";
51
- this.code = options.code;
52
- this.statusCode = options.statusCode;
53
- // The request and response may contain sensitive information in the headers or body.
54
- // To help prevent this sensitive information being accidentally logged, the request and response
55
- // properties are marked as non-enumerable here. This prevents them showing up in the output of
56
- // JSON.stringify and console.log.
57
- Object.defineProperty(this, "request", { value: options.request, enumerable: false });
58
- Object.defineProperty(this, "response", { value: options.response, enumerable: false });
59
- // Only include useful agent information in the request for logging, as the full agent object
60
- // may contain large binary data.
61
- const agent = this.request?.agent
62
- ? {
63
- maxFreeSockets: this.request.agent.maxFreeSockets,
64
- maxSockets: this.request.agent.maxSockets,
65
- }
66
- : undefined;
67
- // Logging method for util.inspect in Node
68
- Object.defineProperty(this, inspect_js_1.custom, {
69
- value: () => {
70
- // Extract non-enumerable properties and add them back. This is OK since in this output the request and
71
- // response get sanitized.
72
- return `RestError: ${this.message} \n ${errorSanitizer.sanitize({
73
- ...this,
74
- request: { ...this.request, agent },
75
- response: this.response,
76
- })}`;
77
- },
78
- enumerable: false,
79
- });
80
- Object.setPrototypeOf(this, RestError.prototype);
81
- }
29
+ /**
30
+ * Something went wrong when making the request.
31
+ * This means the actual request failed for some reason,
32
+ * such as a DNS issue or the connection being lost.
33
+ */
34
+ static REQUEST_SEND_ERROR = "REQUEST_SEND_ERROR";
35
+ /**
36
+ * This means that parsing the response from the server failed.
37
+ * It may have been malformed.
38
+ */
39
+ static PARSE_ERROR = "PARSE_ERROR";
40
+ /**
41
+ * The code of the error itself (use statics on RestError if possible.)
42
+ */
43
+ code;
44
+ /**
45
+ * The HTTP status code of the request (if applicable.)
46
+ */
47
+ statusCode;
48
+ /**
49
+ * The request that was made.
50
+ * This property is non-enumerable.
51
+ */
52
+ request;
53
+ /**
54
+ * The response received (if any.)
55
+ * This property is non-enumerable.
56
+ */
57
+ response;
58
+ /**
59
+ * Bonus property set by the throw site.
60
+ */
61
+ details;
62
+ constructor(message, options = {}) {
63
+ super(message);
64
+ this.name = "RestError";
65
+ this.code = options.code;
66
+ this.statusCode = options.statusCode;
67
+ Object.defineProperty(this, "request", { value: options.request, enumerable: false });
68
+ Object.defineProperty(this, "response", { value: options.response, enumerable: false });
69
+ const agent = this.request?.agent ? {
70
+ maxFreeSockets: this.request.agent.maxFreeSockets,
71
+ maxSockets: this.request.agent.maxSockets
72
+ } : void 0;
73
+ Object.defineProperty(this, import_inspect.custom, {
74
+ value: () => {
75
+ return `RestError: ${this.message}
76
+ ${errorSanitizer.sanitize({
77
+ ...this,
78
+ request: { ...this.request, agent },
79
+ response: this.response
80
+ })}`;
81
+ },
82
+ enumerable: false
83
+ });
84
+ Object.setPrototypeOf(this, RestError.prototype);
85
+ }
82
86
  }
83
- exports.RestError = RestError;
84
- /**
85
- * Typeguard for RestError
86
- * @param e - Something caught by a catch clause.
87
- */
88
87
  function isRestError(e) {
89
- if (e instanceof RestError) {
90
- return true;
91
- }
92
- return (0, error_js_1.isError)(e) && e.name === "RestError";
88
+ if (e instanceof RestError) {
89
+ return true;
90
+ }
91
+ return (0, import_error.isError)(e) && e.name === "RestError";
93
92
  }
94
- //# sourceMappingURL=restError.js.map
93
+ // Annotate the CommonJS export names for ESM import in node:
94
+ 0 && (module.exports = {
95
+ RestError,
96
+ isRestError
97
+ });
@@ -1 +1,7 @@
1
- {"version":3,"file":"restError.js","sourceRoot":"","sources":["../../src/restError.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAkHlC,kCAKC;AArHD,8CAA0C;AAE1C,kDAA2C;AAC3C,sDAAgD;AAEhD,MAAM,cAAc,GAAG,IAAI,wBAAS,EAAE,CAAC;AAwBvC;;GAEG;AACH,MAAa,SAAU,SAAQ,KAAK;IAClC;;;;OAIG;IACH,MAAM,CAAU,kBAAkB,GAAW,oBAAoB,CAAC;IAClE;;;OAGG;IACH,MAAM,CAAU,WAAW,GAAW,aAAa,CAAC;IAEpD;;OAEG;IACI,IAAI,CAAU;IACrB;;OAEG;IACI,UAAU,CAAU;IAC3B;;;OAGG;IACI,OAAO,CAAmB;IACjC;;;OAGG;IACI,QAAQ,CAAoB;IACnC;;OAEG;IACI,OAAO,CAAW;IAEzB,YAAY,OAAe,EAAE,UAA4B,EAAE;QACzD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QACzB,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;QAErC,qFAAqF;QACrF,iGAAiG;QACjG,+FAA+F;QAC/F,kCAAkC;QAClC,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC;QACtF,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,QAAQ,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC;QAExF,6FAA6F;QAC7F,iCAAiC;QACjC,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,EAAE,KAAK;YAC/B,CAAC,CAAC;gBACE,cAAc,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,cAAc;gBACjD,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU;aAC1C;YACH,CAAC,CAAC,SAAS,CAAC;QAEd,0CAA0C;QAC1C,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,mBAAM,EAAE;YAClC,KAAK,EAAE,GAAG,EAAE;gBACV,uGAAuG;gBACvG,0BAA0B;gBAC1B,OAAO,cAAc,IAAI,CAAC,OAAO,OAAO,cAAc,CAAC,QAAQ,CAAC;oBAC9D,GAAG,IAAI;oBACP,OAAO,EAAE,EAAE,GAAG,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE;oBACnC,QAAQ,EAAE,IAAI,CAAC,QAAQ;iBACxB,CAAC,EAAE,CAAC;YACP,CAAC;YACD,UAAU,EAAE,KAAK;SAClB,CAAC,CAAC;QAEH,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACnD,CAAC;;AAzEH,8BA0EC;AAED;;;GAGG;AACH,SAAgB,WAAW,CAAC,CAAU;IACpC,IAAI,CAAC,YAAY,SAAS,EAAE,CAAC;QAC3B,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,IAAA,kBAAO,EAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,WAAW,CAAC;AAC9C,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { isError } from \"./util/error.js\";\nimport type { PipelineRequest, PipelineResponse } from \"./interfaces.js\";\nimport { custom } from \"./util/inspect.js\";\nimport { Sanitizer } from \"./util/sanitizer.js\";\n\nconst errorSanitizer = new Sanitizer();\n\n/**\n * The options supported by RestError.\n */\nexport interface RestErrorOptions {\n /**\n * The code of the error itself (use statics on RestError if possible.)\n */\n code?: string;\n /**\n * The HTTP status code of the request (if applicable.)\n */\n statusCode?: number;\n /**\n * The request that was made.\n */\n request?: PipelineRequest;\n /**\n * The response received (if any.)\n */\n response?: PipelineResponse;\n}\n\n/**\n * A custom error type for failed pipeline requests.\n */\nexport class RestError extends Error {\n /**\n * Something went wrong when making the request.\n * This means the actual request failed for some reason,\n * such as a DNS issue or the connection being lost.\n */\n static readonly REQUEST_SEND_ERROR: string = \"REQUEST_SEND_ERROR\";\n /**\n * This means that parsing the response from the server failed.\n * It may have been malformed.\n */\n static readonly PARSE_ERROR: string = \"PARSE_ERROR\";\n\n /**\n * The code of the error itself (use statics on RestError if possible.)\n */\n public code?: string;\n /**\n * The HTTP status code of the request (if applicable.)\n */\n public statusCode?: number;\n /**\n * The request that was made.\n * This property is non-enumerable.\n */\n public request?: PipelineRequest;\n /**\n * The response received (if any.)\n * This property is non-enumerable.\n */\n public response?: PipelineResponse;\n /**\n * Bonus property set by the throw site.\n */\n public details?: unknown;\n\n constructor(message: string, options: RestErrorOptions = {}) {\n super(message);\n this.name = \"RestError\";\n this.code = options.code;\n this.statusCode = options.statusCode;\n\n // The request and response may contain sensitive information in the headers or body.\n // To help prevent this sensitive information being accidentally logged, the request and response\n // properties are marked as non-enumerable here. This prevents them showing up in the output of\n // JSON.stringify and console.log.\n Object.defineProperty(this, \"request\", { value: options.request, enumerable: false });\n Object.defineProperty(this, \"response\", { value: options.response, enumerable: false });\n\n // Only include useful agent information in the request for logging, as the full agent object\n // may contain large binary data.\n const agent = this.request?.agent\n ? {\n maxFreeSockets: this.request.agent.maxFreeSockets,\n maxSockets: this.request.agent.maxSockets,\n }\n : undefined;\n\n // Logging method for util.inspect in Node\n Object.defineProperty(this, custom, {\n value: () => {\n // Extract non-enumerable properties and add them back. This is OK since in this output the request and\n // response get sanitized.\n return `RestError: ${this.message} \\n ${errorSanitizer.sanitize({\n ...this,\n request: { ...this.request, agent },\n response: this.response,\n })}`;\n },\n enumerable: false,\n });\n\n Object.setPrototypeOf(this, RestError.prototype);\n }\n}\n\n/**\n * Typeguard for RestError\n * @param e - Something caught by a catch clause.\n */\nexport function isRestError(e: unknown): e is RestError {\n if (e instanceof RestError) {\n return true;\n }\n return isError(e) && e.name === \"RestError\";\n}\n"]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["/mnt/vss/_work/1/s/sdk/core/ts-http-runtime/src/restError.ts"],
4
+ "sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { isError } from \"./util/error.js\";\nimport type { PipelineRequest, PipelineResponse } from \"./interfaces.js\";\nimport { custom } from \"./util/inspect.js\";\nimport { Sanitizer } from \"./util/sanitizer.js\";\n\nconst errorSanitizer = new Sanitizer();\n\n/**\n * The options supported by RestError.\n */\nexport interface RestErrorOptions {\n /**\n * The code of the error itself (use statics on RestError if possible.)\n */\n code?: string;\n /**\n * The HTTP status code of the request (if applicable.)\n */\n statusCode?: number;\n /**\n * The request that was made.\n */\n request?: PipelineRequest;\n /**\n * The response received (if any.)\n */\n response?: PipelineResponse;\n}\n\n/**\n * A custom error type for failed pipeline requests.\n */\nexport class RestError extends Error {\n /**\n * Something went wrong when making the request.\n * This means the actual request failed for some reason,\n * such as a DNS issue or the connection being lost.\n */\n static readonly REQUEST_SEND_ERROR: string = \"REQUEST_SEND_ERROR\";\n /**\n * This means that parsing the response from the server failed.\n * It may have been malformed.\n */\n static readonly PARSE_ERROR: string = \"PARSE_ERROR\";\n\n /**\n * The code of the error itself (use statics on RestError if possible.)\n */\n public code?: string;\n /**\n * The HTTP status code of the request (if applicable.)\n */\n public statusCode?: number;\n /**\n * The request that was made.\n * This property is non-enumerable.\n */\n public request?: PipelineRequest;\n /**\n * The response received (if any.)\n * This property is non-enumerable.\n */\n public response?: PipelineResponse;\n /**\n * Bonus property set by the throw site.\n */\n public details?: unknown;\n\n constructor(message: string, options: RestErrorOptions = {}) {\n super(message);\n this.name = \"RestError\";\n this.code = options.code;\n this.statusCode = options.statusCode;\n\n // The request and response may contain sensitive information in the headers or body.\n // To help prevent this sensitive information being accidentally logged, the request and response\n // properties are marked as non-enumerable here. This prevents them showing up in the output of\n // JSON.stringify and console.log.\n Object.defineProperty(this, \"request\", { value: options.request, enumerable: false });\n Object.defineProperty(this, \"response\", { value: options.response, enumerable: false });\n\n // Only include useful agent information in the request for logging, as the full agent object\n // may contain large binary data.\n const agent = this.request?.agent\n ? {\n maxFreeSockets: this.request.agent.maxFreeSockets,\n maxSockets: this.request.agent.maxSockets,\n }\n : undefined;\n\n // Logging method for util.inspect in Node\n Object.defineProperty(this, custom, {\n value: () => {\n // Extract non-enumerable properties and add them back. This is OK since in this output the request and\n // response get sanitized.\n return `RestError: ${this.message} \\n ${errorSanitizer.sanitize({\n ...this,\n request: { ...this.request, agent },\n response: this.response,\n })}`;\n },\n enumerable: false,\n });\n\n Object.setPrototypeOf(this, RestError.prototype);\n }\n}\n\n/**\n * Typeguard for RestError\n * @param e - Something caught by a catch clause.\n */\nexport function isRestError(e: unknown): e is RestError {\n if (e instanceof RestError) {\n return true;\n }\n return isError(e) && e.name === \"RestError\";\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,mBAAwB;AAExB,qBAAuB;AACvB,uBAA0B;AAE1B,MAAM,iBAAiB,IAAI,2BAAU;AA2B9B,MAAM,kBAAkB,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMnC,OAAgB,qBAA6B;AAAA;AAAA;AAAA;AAAA;AAAA,EAK7C,OAAgB,cAAsB;AAAA;AAAA;AAAA;AAAA,EAK/B;AAAA;AAAA;AAAA;AAAA,EAIA;AAAA;AAAA;AAAA;AAAA;AAAA,EAKA;AAAA;AAAA;AAAA;AAAA;AAAA,EAKA;AAAA;AAAA;AAAA;AAAA,EAIA;AAAA,EAEP,YAAY,SAAiB,UAA4B,CAAC,GAAG;AAC3D,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,SAAK,OAAO,QAAQ;AACpB,SAAK,aAAa,QAAQ;AAM1B,WAAO,eAAe,MAAM,WAAW,EAAE,OAAO,QAAQ,SAAS,YAAY,MAAM,CAAC;AACpF,WAAO,eAAe,MAAM,YAAY,EAAE,OAAO,QAAQ,UAAU,YAAY,MAAM,CAAC;AAItF,UAAM,QAAQ,KAAK,SAAS,QACxB;AAAA,MACE,gBAAgB,KAAK,QAAQ,MAAM;AAAA,MACnC,YAAY,KAAK,QAAQ,MAAM;AAAA,IACjC,IACA;AAGJ,WAAO,eAAe,MAAM,uBAAQ;AAAA,MAClC,OAAO,MAAM;AAGX,eAAO,cAAc,KAAK,OAAO;AAAA,GAAO,eAAe,SAAS;AAAA,UAC9D,GAAG;AAAA,UACH,SAAS,EAAE,GAAG,KAAK,SAAS,MAAM;AAAA,UAClC,UAAU,KAAK;AAAA,QACjB,CAAC,CAAC;AAAA,MACJ;AAAA,MACA,YAAY;AAAA,IACd,CAAC;AAED,WAAO,eAAe,MAAM,UAAU,SAAS;AAAA,EACjD;AACF;AAMO,SAAS,YAAY,GAA4B;AACtD,MAAI,aAAa,WAAW;AAC1B,WAAO;AAAA,EACT;AACA,aAAO,sBAAQ,CAAC,KAAK,EAAE,SAAS;AAClC;",
6
+ "names": []
7
+ }
@@ -1,68 +1,69 @@
1
- "use strict";
2
- // Copyright (c) Microsoft Corporation.
3
- // Licensed under the MIT License.
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.exponentialRetryStrategy = exponentialRetryStrategy;
6
- exports.isExponentialRetryResponse = isExponentialRetryResponse;
7
- exports.isSystemError = isSystemError;
8
- const delay_js_1 = require("../util/delay.js");
9
- const throttlingRetryStrategy_js_1 = require("./throttlingRetryStrategy.js");
10
- // intervals are in milliseconds
11
- const DEFAULT_CLIENT_RETRY_INTERVAL = 1000;
12
- const DEFAULT_CLIENT_MAX_RETRY_INTERVAL = 1000 * 64;
13
- /**
14
- * A retry strategy that retries with an exponentially increasing delay in these two cases:
15
- * - When there are errors in the underlying transport layer (e.g. DNS lookup failures).
16
- * - Or otherwise if the outgoing request fails (408, greater or equal than 500, except for 501 and 505).
17
- */
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 exponentialRetryStrategy_exports = {};
19
+ __export(exponentialRetryStrategy_exports, {
20
+ exponentialRetryStrategy: () => exponentialRetryStrategy,
21
+ isExponentialRetryResponse: () => isExponentialRetryResponse,
22
+ isSystemError: () => isSystemError
23
+ });
24
+ module.exports = __toCommonJS(exponentialRetryStrategy_exports);
25
+ var import_delay = require("../util/delay.js");
26
+ var import_throttlingRetryStrategy = require("./throttlingRetryStrategy.js");
27
+ const DEFAULT_CLIENT_RETRY_INTERVAL = 1e3;
28
+ const DEFAULT_CLIENT_MAX_RETRY_INTERVAL = 1e3 * 64;
18
29
  function exponentialRetryStrategy(options = {}) {
19
- const retryInterval = options.retryDelayInMs ?? DEFAULT_CLIENT_RETRY_INTERVAL;
20
- const maxRetryInterval = options.maxRetryDelayInMs ?? DEFAULT_CLIENT_MAX_RETRY_INTERVAL;
21
- return {
22
- name: "exponentialRetryStrategy",
23
- retry({ retryCount, response, responseError }) {
24
- const matchedSystemError = isSystemError(responseError);
25
- const ignoreSystemErrors = matchedSystemError && options.ignoreSystemErrors;
26
- const isExponential = isExponentialRetryResponse(response);
27
- const ignoreExponentialResponse = isExponential && options.ignoreHttpStatusCodes;
28
- const unknownResponse = response && ((0, throttlingRetryStrategy_js_1.isThrottlingRetryResponse)(response) || !isExponential);
29
- if (unknownResponse || ignoreExponentialResponse || ignoreSystemErrors) {
30
- return { skipStrategy: true };
31
- }
32
- if (responseError && !matchedSystemError && !isExponential) {
33
- return { errorToThrow: responseError };
34
- }
35
- return (0, delay_js_1.calculateRetryDelay)(retryCount, {
36
- retryDelayInMs: retryInterval,
37
- maxRetryDelayInMs: maxRetryInterval,
38
- });
39
- },
40
- };
30
+ const retryInterval = options.retryDelayInMs ?? DEFAULT_CLIENT_RETRY_INTERVAL;
31
+ const maxRetryInterval = options.maxRetryDelayInMs ?? DEFAULT_CLIENT_MAX_RETRY_INTERVAL;
32
+ return {
33
+ name: "exponentialRetryStrategy",
34
+ retry({ retryCount, response, responseError }) {
35
+ const matchedSystemError = isSystemError(responseError);
36
+ const ignoreSystemErrors = matchedSystemError && options.ignoreSystemErrors;
37
+ const isExponential = isExponentialRetryResponse(response);
38
+ const ignoreExponentialResponse = isExponential && options.ignoreHttpStatusCodes;
39
+ const unknownResponse = response && ((0, import_throttlingRetryStrategy.isThrottlingRetryResponse)(response) || !isExponential);
40
+ if (unknownResponse || ignoreExponentialResponse || ignoreSystemErrors) {
41
+ return { skipStrategy: true };
42
+ }
43
+ if (responseError && !matchedSystemError && !isExponential) {
44
+ return { errorToThrow: responseError };
45
+ }
46
+ return (0, import_delay.calculateRetryDelay)(retryCount, {
47
+ retryDelayInMs: retryInterval,
48
+ maxRetryDelayInMs: maxRetryInterval
49
+ });
50
+ }
51
+ };
41
52
  }
42
- /**
43
- * A response is a retry response if it has status codes:
44
- * - 408, or
45
- * - Greater or equal than 500, except for 501 and 505.
46
- */
47
53
  function isExponentialRetryResponse(response) {
48
- return Boolean(response &&
49
- response.status !== undefined &&
50
- (response.status >= 500 || response.status === 408) &&
51
- response.status !== 501 &&
52
- response.status !== 505);
54
+ return Boolean(
55
+ response && response.status !== void 0 && (response.status >= 500 || response.status === 408) && response.status !== 501 && response.status !== 505
56
+ );
53
57
  }
54
- /**
55
- * Determines whether an error from a pipeline response was triggered in the network layer.
56
- */
57
58
  function isSystemError(err) {
58
- if (!err) {
59
- return false;
60
- }
61
- return (err.code === "ETIMEDOUT" ||
62
- err.code === "ESOCKETTIMEDOUT" ||
63
- err.code === "ECONNREFUSED" ||
64
- err.code === "ECONNRESET" ||
65
- err.code === "ENOENT" ||
66
- err.code === "ENOTFOUND");
59
+ if (!err) {
60
+ return false;
61
+ }
62
+ return err.code === "ETIMEDOUT" || err.code === "ESOCKETTIMEDOUT" || err.code === "ECONNREFUSED" || err.code === "ECONNRESET" || err.code === "ENOENT" || err.code === "ENOTFOUND";
67
63
  }
68
- //# sourceMappingURL=exponentialRetryStrategy.js.map
64
+ // Annotate the CommonJS export names for ESM import in node:
65
+ 0 && (module.exports = {
66
+ exponentialRetryStrategy,
67
+ isExponentialRetryResponse,
68
+ isSystemError
69
+ });
@@ -1 +1,7 @@
1
- {"version":3,"file":"exponentialRetryStrategy.js","sourceRoot":"","sources":["../../../src/retryStrategies/exponentialRetryStrategy.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAiBlC,4DAqDC;AAOD,gEAQC;AAKD,sCAYC;AAlGD,+CAAuD;AAEvD,6EAAyE;AAEzE,gCAAgC;AAChC,MAAM,6BAA6B,GAAG,IAAI,CAAC;AAC3C,MAAM,iCAAiC,GAAG,IAAI,GAAG,EAAE,CAAC;AAEpD;;;;GAIG;AACH,SAAgB,wBAAwB,CACtC,UAuBI,EAAE;IAEN,MAAM,aAAa,GAAG,OAAO,CAAC,cAAc,IAAI,6BAA6B,CAAC;IAC9E,MAAM,gBAAgB,GAAG,OAAO,CAAC,iBAAiB,IAAI,iCAAiC,CAAC;IAExF,OAAO;QACL,IAAI,EAAE,0BAA0B;QAChC,KAAK,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,aAAa,EAAE;YAC3C,MAAM,kBAAkB,GAAG,aAAa,CAAC,aAAa,CAAC,CAAC;YACxD,MAAM,kBAAkB,GAAG,kBAAkB,IAAI,OAAO,CAAC,kBAAkB,CAAC;YAE5E,MAAM,aAAa,GAAG,0BAA0B,CAAC,QAAQ,CAAC,CAAC;YAC3D,MAAM,yBAAyB,GAAG,aAAa,IAAI,OAAO,CAAC,qBAAqB,CAAC;YACjF,MAAM,eAAe,GAAG,QAAQ,IAAI,CAAC,IAAA,sDAAyB,EAAC,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;YAE5F,IAAI,eAAe,IAAI,yBAAyB,IAAI,kBAAkB,EAAE,CAAC;gBACvE,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;YAChC,CAAC;YAED,IAAI,aAAa,IAAI,CAAC,kBAAkB,IAAI,CAAC,aAAa,EAAE,CAAC;gBAC3D,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,CAAC;YACzC,CAAC;YAED,OAAO,IAAA,8BAAmB,EAAC,UAAU,EAAE;gBACrC,cAAc,EAAE,aAAa;gBAC7B,iBAAiB,EAAE,gBAAgB;aACpC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,SAAgB,0BAA0B,CAAC,QAA2B;IACpE,OAAO,OAAO,CACZ,QAAQ;QACR,QAAQ,CAAC,MAAM,KAAK,SAAS;QAC7B,CAAC,QAAQ,CAAC,MAAM,IAAI,GAAG,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,CAAC;QACnD,QAAQ,CAAC,MAAM,KAAK,GAAG;QACvB,QAAQ,CAAC,MAAM,KAAK,GAAG,CACxB,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAgB,aAAa,CAAC,GAAe;IAC3C,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,CACL,GAAG,CAAC,IAAI,KAAK,WAAW;QACxB,GAAG,CAAC,IAAI,KAAK,iBAAiB;QAC9B,GAAG,CAAC,IAAI,KAAK,cAAc;QAC3B,GAAG,CAAC,IAAI,KAAK,YAAY;QACzB,GAAG,CAAC,IAAI,KAAK,QAAQ;QACrB,GAAG,CAAC,IAAI,KAAK,WAAW,CACzB,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { PipelineResponse } from \"../interfaces.js\";\nimport type { RestError } from \"../restError.js\";\nimport { calculateRetryDelay } from \"../util/delay.js\";\nimport type { RetryStrategy } from \"./retryStrategy.js\";\nimport { isThrottlingRetryResponse } from \"./throttlingRetryStrategy.js\";\n\n// intervals are in milliseconds\nconst DEFAULT_CLIENT_RETRY_INTERVAL = 1000;\nconst DEFAULT_CLIENT_MAX_RETRY_INTERVAL = 1000 * 64;\n\n/**\n * A retry strategy that retries with an exponentially increasing delay in these two cases:\n * - When there are errors in the underlying transport layer (e.g. DNS lookup failures).\n * - Or otherwise if the outgoing request fails (408, greater or equal than 500, except for 501 and 505).\n */\nexport function exponentialRetryStrategy(\n options: {\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 * If true it won't retry if it received a system error.\n */\n ignoreSystemErrors?: boolean;\n\n /**\n * If true it won't retry if it received a non-fatal HTTP status code.\n */\n ignoreHttpStatusCodes?: boolean;\n } = {},\n): RetryStrategy {\n const retryInterval = options.retryDelayInMs ?? DEFAULT_CLIENT_RETRY_INTERVAL;\n const maxRetryInterval = options.maxRetryDelayInMs ?? DEFAULT_CLIENT_MAX_RETRY_INTERVAL;\n\n return {\n name: \"exponentialRetryStrategy\",\n retry({ retryCount, response, responseError }) {\n const matchedSystemError = isSystemError(responseError);\n const ignoreSystemErrors = matchedSystemError && options.ignoreSystemErrors;\n\n const isExponential = isExponentialRetryResponse(response);\n const ignoreExponentialResponse = isExponential && options.ignoreHttpStatusCodes;\n const unknownResponse = response && (isThrottlingRetryResponse(response) || !isExponential);\n\n if (unknownResponse || ignoreExponentialResponse || ignoreSystemErrors) {\n return { skipStrategy: true };\n }\n\n if (responseError && !matchedSystemError && !isExponential) {\n return { errorToThrow: responseError };\n }\n\n return calculateRetryDelay(retryCount, {\n retryDelayInMs: retryInterval,\n maxRetryDelayInMs: maxRetryInterval,\n });\n },\n };\n}\n\n/**\n * A response is a retry response if it has status codes:\n * - 408, or\n * - Greater or equal than 500, except for 501 and 505.\n */\nexport function isExponentialRetryResponse(response?: PipelineResponse): boolean {\n return Boolean(\n response &&\n response.status !== undefined &&\n (response.status >= 500 || response.status === 408) &&\n response.status !== 501 &&\n response.status !== 505,\n );\n}\n\n/**\n * Determines whether an error from a pipeline response was triggered in the network layer.\n */\nexport function isSystemError(err?: RestError): boolean {\n if (!err) {\n return false;\n }\n return (\n err.code === \"ETIMEDOUT\" ||\n err.code === \"ESOCKETTIMEDOUT\" ||\n err.code === \"ECONNREFUSED\" ||\n err.code === \"ECONNRESET\" ||\n err.code === \"ENOENT\" ||\n err.code === \"ENOTFOUND\"\n );\n}\n"]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["/mnt/vss/_work/1/s/sdk/core/ts-http-runtime/src/retryStrategies/exponentialRetryStrategy.ts"],
4
+ "sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { PipelineResponse } from \"../interfaces.js\";\nimport type { RestError } from \"../restError.js\";\nimport { calculateRetryDelay } from \"../util/delay.js\";\nimport type { RetryStrategy } from \"./retryStrategy.js\";\nimport { isThrottlingRetryResponse } from \"./throttlingRetryStrategy.js\";\n\n// intervals are in milliseconds\nconst DEFAULT_CLIENT_RETRY_INTERVAL = 1000;\nconst DEFAULT_CLIENT_MAX_RETRY_INTERVAL = 1000 * 64;\n\n/**\n * A retry strategy that retries with an exponentially increasing delay in these two cases:\n * - When there are errors in the underlying transport layer (e.g. DNS lookup failures).\n * - Or otherwise if the outgoing request fails (408, greater or equal than 500, except for 501 and 505).\n */\nexport function exponentialRetryStrategy(\n options: {\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 * If true it won't retry if it received a system error.\n */\n ignoreSystemErrors?: boolean;\n\n /**\n * If true it won't retry if it received a non-fatal HTTP status code.\n */\n ignoreHttpStatusCodes?: boolean;\n } = {},\n): RetryStrategy {\n const retryInterval = options.retryDelayInMs ?? DEFAULT_CLIENT_RETRY_INTERVAL;\n const maxRetryInterval = options.maxRetryDelayInMs ?? DEFAULT_CLIENT_MAX_RETRY_INTERVAL;\n\n return {\n name: \"exponentialRetryStrategy\",\n retry({ retryCount, response, responseError }) {\n const matchedSystemError = isSystemError(responseError);\n const ignoreSystemErrors = matchedSystemError && options.ignoreSystemErrors;\n\n const isExponential = isExponentialRetryResponse(response);\n const ignoreExponentialResponse = isExponential && options.ignoreHttpStatusCodes;\n const unknownResponse = response && (isThrottlingRetryResponse(response) || !isExponential);\n\n if (unknownResponse || ignoreExponentialResponse || ignoreSystemErrors) {\n return { skipStrategy: true };\n }\n\n if (responseError && !matchedSystemError && !isExponential) {\n return { errorToThrow: responseError };\n }\n\n return calculateRetryDelay(retryCount, {\n retryDelayInMs: retryInterval,\n maxRetryDelayInMs: maxRetryInterval,\n });\n },\n };\n}\n\n/**\n * A response is a retry response if it has status codes:\n * - 408, or\n * - Greater or equal than 500, except for 501 and 505.\n */\nexport function isExponentialRetryResponse(response?: PipelineResponse): boolean {\n return Boolean(\n response &&\n response.status !== undefined &&\n (response.status >= 500 || response.status === 408) &&\n response.status !== 501 &&\n response.status !== 505,\n );\n}\n\n/**\n * Determines whether an error from a pipeline response was triggered in the network layer.\n */\nexport function isSystemError(err?: RestError): boolean {\n if (!err) {\n return false;\n }\n return (\n err.code === \"ETIMEDOUT\" ||\n err.code === \"ESOCKETTIMEDOUT\" ||\n err.code === \"ECONNREFUSED\" ||\n err.code === \"ECONNRESET\" ||\n err.code === \"ENOENT\" ||\n err.code === \"ENOTFOUND\"\n );\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,mBAAoC;AAEpC,qCAA0C;AAG1C,MAAM,gCAAgC;AACtC,MAAM,oCAAoC,MAAO;AAO1C,SAAS,yBACd,UAuBI,CAAC,GACU;AACf,QAAM,gBAAgB,QAAQ,kBAAkB;AAChD,QAAM,mBAAmB,QAAQ,qBAAqB;AAEtD,SAAO;AAAA,IACL,MAAM;AAAA,IACN,MAAM,EAAE,YAAY,UAAU,cAAc,GAAG;AAC7C,YAAM,qBAAqB,cAAc,aAAa;AACtD,YAAM,qBAAqB,sBAAsB,QAAQ;AAEzD,YAAM,gBAAgB,2BAA2B,QAAQ;AACzD,YAAM,4BAA4B,iBAAiB,QAAQ;AAC3D,YAAM,kBAAkB,iBAAa,0DAA0B,QAAQ,KAAK,CAAC;AAE7E,UAAI,mBAAmB,6BAA6B,oBAAoB;AACtE,eAAO,EAAE,cAAc,KAAK;AAAA,MAC9B;AAEA,UAAI,iBAAiB,CAAC,sBAAsB,CAAC,eAAe;AAC1D,eAAO,EAAE,cAAc,cAAc;AAAA,MACvC;AAEA,iBAAO,kCAAoB,YAAY;AAAA,QACrC,gBAAgB;AAAA,QAChB,mBAAmB;AAAA,MACrB,CAAC;AAAA,IACH;AAAA,EACF;AACF;AAOO,SAAS,2BAA2B,UAAsC;AAC/E,SAAO;AAAA,IACL,YACA,SAAS,WAAW,WACnB,SAAS,UAAU,OAAO,SAAS,WAAW,QAC/C,SAAS,WAAW,OACpB,SAAS,WAAW;AAAA,EACtB;AACF;AAKO,SAAS,cAAc,KAA0B;AACtD,MAAI,CAAC,KAAK;AACR,WAAO;AAAA,EACT;AACA,SACE,IAAI,SAAS,eACb,IAAI,SAAS,qBACb,IAAI,SAAS,kBACb,IAAI,SAAS,gBACb,IAAI,SAAS,YACb,IAAI,SAAS;AAEjB;",
6
+ "names": []
7
+ }
@@ -1,5 +1,15 @@
1
- "use strict";
2
- // Copyright (c) Microsoft Corporation.
3
- // Licensed under the MIT License.
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- //# sourceMappingURL=retryStrategy.js.map
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
+ var retryStrategy_exports = {};
15
+ module.exports = __toCommonJS(retryStrategy_exports);
@@ -1 +1,7 @@
1
- {"version":3,"file":"retryStrategy.js","sourceRoot":"","sources":["../../../src/retryStrategies/retryStrategy.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { TypeSpecRuntimeLogger } from \"../logger/logger.js\";\nimport type { PipelineResponse } from \"../interfaces.js\";\nimport type { RestError } from \"../restError.js\";\n\n/**\n * Information provided to the retry strategy about the current progress of the retry policy.\n */\nexport interface RetryInformation {\n /**\n * A {@link PipelineResponse}, if the last retry attempt succeeded.\n */\n response?: PipelineResponse;\n /**\n * A {@link RestError}, if the last retry attempt failed.\n */\n responseError?: RestError;\n /**\n * Total number of retries so far.\n */\n retryCount: number;\n}\n\n/**\n * Properties that can modify the behavior of the retry policy.\n */\nexport interface RetryModifiers {\n /**\n * If true, allows skipping the current strategy from running on the retry policy.\n */\n skipStrategy?: boolean;\n /**\n * Indicates to retry against this URL.\n */\n redirectTo?: string;\n /**\n * Controls whether to retry in a given number of milliseconds.\n * If provided, a new retry will be attempted.\n */\n retryAfterInMs?: number;\n /**\n * Indicates to throw this error instead of retrying.\n */\n errorToThrow?: RestError;\n}\n\n/**\n * A retry strategy is intended to define whether to retry or not, and how to retry.\n */\nexport interface RetryStrategy {\n /**\n * Name of the retry strategy. Used for logging.\n */\n name: string;\n /**\n * Logger. If it's not provided, a default logger for all retry strategies is used.\n */\n logger?: TypeSpecRuntimeLogger;\n /**\n * Function that determines how to proceed with the subsequent requests.\n * @param state - Retry state\n */\n retry(state: RetryInformation): RetryModifiers;\n}\n"]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["/mnt/vss/_work/1/s/sdk/core/ts-http-runtime/src/retryStrategies/retryStrategy.ts"],
4
+ "sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { TypeSpecRuntimeLogger } from \"../logger/logger.js\";\nimport type { PipelineResponse } from \"../interfaces.js\";\nimport type { RestError } from \"../restError.js\";\n\n/**\n * Information provided to the retry strategy about the current progress of the retry policy.\n */\nexport interface RetryInformation {\n /**\n * A {@link PipelineResponse}, if the last retry attempt succeeded.\n */\n response?: PipelineResponse;\n /**\n * A {@link RestError}, if the last retry attempt failed.\n */\n responseError?: RestError;\n /**\n * Total number of retries so far.\n */\n retryCount: number;\n}\n\n/**\n * Properties that can modify the behavior of the retry policy.\n */\nexport interface RetryModifiers {\n /**\n * If true, allows skipping the current strategy from running on the retry policy.\n */\n skipStrategy?: boolean;\n /**\n * Indicates to retry against this URL.\n */\n redirectTo?: string;\n /**\n * Controls whether to retry in a given number of milliseconds.\n * If provided, a new retry will be attempted.\n */\n retryAfterInMs?: number;\n /**\n * Indicates to throw this error instead of retrying.\n */\n errorToThrow?: RestError;\n}\n\n/**\n * A retry strategy is intended to define whether to retry or not, and how to retry.\n */\nexport interface RetryStrategy {\n /**\n * Name of the retry strategy. Used for logging.\n */\n name: string;\n /**\n * Logger. If it's not provided, a default logger for all retry strategies is used.\n */\n logger?: TypeSpecRuntimeLogger;\n /**\n * Function that determines how to proceed with the subsequent requests.\n * @param state - Retry state\n */\n retry(state: RetryInformation): RetryModifiers;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;AAAA;AAAA;",
6
+ "names": []
7
+ }