@typespec/ts-http-runtime 1.0.0-alpha.20240826.2 → 1.0.0-alpha.20240828.1

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 (633) hide show
  1. package/dist/browser/abort-controller/AbortError.js +1 -1
  2. package/dist/browser/abort-controller/AbortError.js.map +1 -1
  3. package/dist/browser/abort-controller/AbortSignalLike.js +1 -1
  4. package/dist/browser/abort-controller/AbortSignalLike.js.map +1 -1
  5. package/dist/browser/accessTokenCache.js +1 -1
  6. package/dist/browser/accessTokenCache.js.map +1 -1
  7. package/dist/browser/auth/keyCredential.js +1 -1
  8. package/dist/browser/auth/keyCredential.js.map +1 -1
  9. package/dist/browser/auth/tokenCredential.js +1 -1
  10. package/dist/browser/auth/tokenCredential.js.map +1 -1
  11. package/dist/browser/client/apiVersionPolicy.js +1 -1
  12. package/dist/browser/client/apiVersionPolicy.js.map +1 -1
  13. package/dist/browser/client/clientHelpers.js +1 -1
  14. package/dist/browser/client/clientHelpers.js.map +1 -1
  15. package/dist/browser/client/common.js +1 -1
  16. package/dist/browser/client/common.js.map +1 -1
  17. package/dist/browser/client/getClient.js +1 -1
  18. package/dist/browser/client/getClient.js.map +1 -1
  19. package/dist/browser/client/keyCredentialAuthenticationPolicy.js +1 -1
  20. package/dist/browser/client/keyCredentialAuthenticationPolicy.js.map +1 -1
  21. package/dist/browser/client/multipart.js +1 -1
  22. package/dist/browser/client/multipart.js.map +1 -1
  23. package/dist/browser/client/operationOptionHelpers.js +1 -1
  24. package/dist/browser/client/operationOptionHelpers.js.map +1 -1
  25. package/dist/browser/client/restError.js +1 -1
  26. package/dist/browser/client/restError.js.map +1 -1
  27. package/dist/browser/client/sendRequest.js +1 -1
  28. package/dist/browser/client/sendRequest.js.map +1 -1
  29. package/dist/browser/client/urlHelpers.js +1 -1
  30. package/dist/browser/client/urlHelpers.js.map +1 -1
  31. package/dist/browser/constants.js +1 -1
  32. package/dist/browser/constants.js.map +1 -1
  33. package/dist/browser/createPipelineFromOptions.js +1 -1
  34. package/dist/browser/createPipelineFromOptions.js.map +1 -1
  35. package/dist/browser/defaultHttpClient-browser.mjs.map +1 -1
  36. package/dist/browser/defaultHttpClient.js +1 -1
  37. package/dist/browser/fetchHttpClient.js +1 -1
  38. package/dist/browser/fetchHttpClient.js.map +1 -1
  39. package/dist/browser/httpHeaders.js +1 -1
  40. package/dist/browser/httpHeaders.js.map +1 -1
  41. package/dist/browser/index.js +1 -1
  42. package/dist/browser/index.js.map +1 -1
  43. package/dist/browser/interfaces.js +1 -1
  44. package/dist/browser/interfaces.js.map +1 -1
  45. package/dist/browser/log.js +1 -1
  46. package/dist/browser/log.js.map +1 -1
  47. package/dist/browser/logger/debug.js +1 -1
  48. package/dist/browser/logger/debug.js.map +1 -1
  49. package/dist/browser/logger/log-browser.mjs.map +1 -1
  50. package/dist/browser/logger/log.common.js +1 -1
  51. package/dist/browser/logger/log.common.js.map +1 -1
  52. package/dist/browser/logger/log.js +1 -1
  53. package/dist/browser/logger/logger.js +1 -1
  54. package/dist/browser/logger/logger.js.map +1 -1
  55. package/dist/browser/nodeHttpClient.js +1 -1
  56. package/dist/browser/nodeHttpClient.js.map +1 -1
  57. package/dist/browser/pipeline.js +1 -1
  58. package/dist/browser/pipeline.js.map +1 -1
  59. package/dist/browser/pipelineRequest.js +1 -1
  60. package/dist/browser/pipelineRequest.js.map +1 -1
  61. package/dist/browser/policies/bearerTokenAuthenticationPolicy.js +1 -1
  62. package/dist/browser/policies/bearerTokenAuthenticationPolicy.js.map +1 -1
  63. package/dist/browser/policies/decompressResponsePolicy-browser.mjs.map +1 -1
  64. package/dist/browser/policies/decompressResponsePolicy.js +1 -1
  65. package/dist/browser/policies/defaultRetryPolicy.js +1 -1
  66. package/dist/browser/policies/defaultRetryPolicy.js.map +1 -1
  67. package/dist/browser/policies/exponentialRetryPolicy.js +1 -1
  68. package/dist/browser/policies/exponentialRetryPolicy.js.map +1 -1
  69. package/dist/browser/policies/formDataPolicy.js +1 -1
  70. package/dist/browser/policies/formDataPolicy.js.map +1 -1
  71. package/dist/browser/policies/logPolicy.js +1 -1
  72. package/dist/browser/policies/logPolicy.js.map +1 -1
  73. package/dist/browser/policies/multipartPolicy.js +1 -1
  74. package/dist/browser/policies/multipartPolicy.js.map +1 -1
  75. package/dist/browser/policies/proxyPolicy-browser.mjs.map +1 -1
  76. package/dist/browser/policies/proxyPolicy.common.js +1 -1
  77. package/dist/browser/policies/proxyPolicy.common.js.map +1 -1
  78. package/dist/browser/policies/proxyPolicy.js +1 -1
  79. package/dist/browser/policies/redirectPolicy.js +1 -1
  80. package/dist/browser/policies/redirectPolicy.js.map +1 -1
  81. package/dist/browser/policies/retryPolicy.js +1 -1
  82. package/dist/browser/policies/retryPolicy.js.map +1 -1
  83. package/dist/browser/policies/systemErrorRetryPolicy.js +1 -1
  84. package/dist/browser/policies/systemErrorRetryPolicy.js.map +1 -1
  85. package/dist/browser/policies/throttlingRetryPolicy.js +1 -1
  86. package/dist/browser/policies/throttlingRetryPolicy.js.map +1 -1
  87. package/dist/browser/policies/tlsPolicy.js +1 -1
  88. package/dist/browser/policies/tlsPolicy.js.map +1 -1
  89. package/dist/browser/policies/tracingPolicy.js +1 -1
  90. package/dist/browser/policies/tracingPolicy.js.map +1 -1
  91. package/dist/browser/policies/userAgentPolicy.js +1 -1
  92. package/dist/browser/policies/userAgentPolicy.js.map +1 -1
  93. package/dist/browser/restError.js +1 -1
  94. package/dist/browser/restError.js.map +1 -1
  95. package/dist/browser/retryStrategies/exponentialRetryStrategy.js +1 -1
  96. package/dist/browser/retryStrategies/exponentialRetryStrategy.js.map +1 -1
  97. package/dist/browser/retryStrategies/retryStrategy.js +1 -1
  98. package/dist/browser/retryStrategies/retryStrategy.js.map +1 -1
  99. package/dist/browser/retryStrategies/throttlingRetryStrategy.js +1 -1
  100. package/dist/browser/retryStrategies/throttlingRetryStrategy.js.map +1 -1
  101. package/dist/browser/tracing/instrumenter.js +1 -1
  102. package/dist/browser/tracing/instrumenter.js.map +1 -1
  103. package/dist/browser/tracing/interfaces.js +1 -1
  104. package/dist/browser/tracing/interfaces.js.map +1 -1
  105. package/dist/browser/tracing/tracingClient.js +1 -1
  106. package/dist/browser/tracing/tracingClient.js.map +1 -1
  107. package/dist/browser/tracing/tracingContext.js +1 -1
  108. package/dist/browser/tracing/tracingContext.js.map +1 -1
  109. package/dist/browser/util/aborterUtils.js +1 -1
  110. package/dist/browser/util/aborterUtils.js.map +1 -1
  111. package/dist/browser/util/bytesEncoding-browser.mjs.map +1 -1
  112. package/dist/browser/util/bytesEncoding.common.js +1 -1
  113. package/dist/browser/util/bytesEncoding.common.js.map +1 -1
  114. package/dist/browser/util/bytesEncoding.js +1 -1
  115. package/dist/browser/util/checkEnvironment.js +1 -1
  116. package/dist/browser/util/checkEnvironment.js.map +1 -1
  117. package/dist/browser/util/concat-browser.mjs.map +1 -1
  118. package/dist/browser/util/concat.common.js +1 -1
  119. package/dist/browser/util/concat.common.js.map +1 -1
  120. package/dist/browser/util/concat.js +1 -1
  121. package/dist/browser/util/createAbortablePromise.js +1 -1
  122. package/dist/browser/util/createAbortablePromise.js.map +1 -1
  123. package/dist/browser/util/delay.js +1 -1
  124. package/dist/browser/util/delay.js.map +1 -1
  125. package/dist/browser/util/error.js +1 -1
  126. package/dist/browser/util/error.js.map +1 -1
  127. package/dist/browser/util/file.js +1 -1
  128. package/dist/browser/util/file.js.map +1 -1
  129. package/dist/browser/util/helpers.js +1 -1
  130. package/dist/browser/util/helpers.js.map +1 -1
  131. package/dist/browser/util/inspect-browser.mjs.map +1 -1
  132. package/dist/browser/util/inspect.common.js +1 -1
  133. package/dist/browser/util/inspect.common.js.map +1 -1
  134. package/dist/browser/util/inspect.js +1 -1
  135. package/dist/browser/util/object.js +1 -1
  136. package/dist/browser/util/object.js.map +1 -1
  137. package/dist/browser/util/random.js +1 -1
  138. package/dist/browser/util/random.js.map +1 -1
  139. package/dist/browser/util/sanitizer.js +1 -1
  140. package/dist/browser/util/sanitizer.js.map +1 -1
  141. package/dist/browser/util/sha256-browser.mjs.map +1 -1
  142. package/dist/browser/util/sha256.common.js +1 -1
  143. package/dist/browser/util/sha256.common.js.map +1 -1
  144. package/dist/browser/util/sha256.js +1 -1
  145. package/dist/browser/util/tokenCycler.js +1 -1
  146. package/dist/browser/util/tokenCycler.js.map +1 -1
  147. package/dist/browser/util/typeGuards.js +1 -1
  148. package/dist/browser/util/typeGuards.js.map +1 -1
  149. package/dist/browser/util/userAgent.js +1 -1
  150. package/dist/browser/util/userAgent.js.map +1 -1
  151. package/dist/browser/util/userAgentPlatform-browser.mjs.map +1 -1
  152. package/dist/browser/util/userAgentPlatform.js +1 -1
  153. package/dist/browser/util/uuidUtils-browser.mjs.map +1 -1
  154. package/dist/browser/util/uuidUtils.common.js +1 -1
  155. package/dist/browser/util/uuidUtils.common.js.map +1 -1
  156. package/dist/browser/util/uuidUtils.js +1 -1
  157. package/dist/browser/xhrHttpClient.js +1 -1
  158. package/dist/browser/xhrHttpClient.js.map +1 -1
  159. package/dist/commonjs/abort-controller/AbortError.js +1 -1
  160. package/dist/commonjs/abort-controller/AbortError.js.map +1 -1
  161. package/dist/commonjs/abort-controller/AbortSignalLike.js +1 -1
  162. package/dist/commonjs/abort-controller/AbortSignalLike.js.map +1 -1
  163. package/dist/commonjs/accessTokenCache.js +1 -1
  164. package/dist/commonjs/accessTokenCache.js.map +1 -1
  165. package/dist/commonjs/auth/keyCredential.js +1 -1
  166. package/dist/commonjs/auth/keyCredential.js.map +1 -1
  167. package/dist/commonjs/auth/tokenCredential.js +1 -1
  168. package/dist/commonjs/auth/tokenCredential.js.map +1 -1
  169. package/dist/commonjs/client/apiVersionPolicy.js +1 -1
  170. package/dist/commonjs/client/apiVersionPolicy.js.map +1 -1
  171. package/dist/commonjs/client/clientHelpers.js +1 -1
  172. package/dist/commonjs/client/clientHelpers.js.map +1 -1
  173. package/dist/commonjs/client/common.js +1 -1
  174. package/dist/commonjs/client/common.js.map +1 -1
  175. package/dist/commonjs/client/getClient.js +1 -1
  176. package/dist/commonjs/client/getClient.js.map +1 -1
  177. package/dist/commonjs/client/keyCredentialAuthenticationPolicy.js +1 -1
  178. package/dist/commonjs/client/keyCredentialAuthenticationPolicy.js.map +1 -1
  179. package/dist/commonjs/client/multipart.js +1 -1
  180. package/dist/commonjs/client/multipart.js.map +1 -1
  181. package/dist/commonjs/client/operationOptionHelpers.js +1 -1
  182. package/dist/commonjs/client/operationOptionHelpers.js.map +1 -1
  183. package/dist/commonjs/client/restError.js +1 -1
  184. package/dist/commonjs/client/restError.js.map +1 -1
  185. package/dist/commonjs/client/sendRequest.js +1 -1
  186. package/dist/commonjs/client/sendRequest.js.map +1 -1
  187. package/dist/commonjs/client/urlHelpers.js +1 -1
  188. package/dist/commonjs/client/urlHelpers.js.map +1 -1
  189. package/dist/commonjs/constants.js +1 -1
  190. package/dist/commonjs/constants.js.map +1 -1
  191. package/dist/commonjs/createPipelineFromOptions.js +1 -1
  192. package/dist/commonjs/createPipelineFromOptions.js.map +1 -1
  193. package/dist/commonjs/defaultHttpClient.js +1 -1
  194. package/dist/commonjs/defaultHttpClient.js.map +1 -1
  195. package/dist/commonjs/fetchHttpClient.js +1 -1
  196. package/dist/commonjs/fetchHttpClient.js.map +1 -1
  197. package/dist/commonjs/httpHeaders.js +1 -1
  198. package/dist/commonjs/httpHeaders.js.map +1 -1
  199. package/dist/commonjs/index.js +1 -1
  200. package/dist/commonjs/index.js.map +1 -1
  201. package/dist/commonjs/interfaces.js +1 -1
  202. package/dist/commonjs/interfaces.js.map +1 -1
  203. package/dist/commonjs/log.js +1 -1
  204. package/dist/commonjs/log.js.map +1 -1
  205. package/dist/commonjs/logger/debug.js +1 -1
  206. package/dist/commonjs/logger/debug.js.map +1 -1
  207. package/dist/commonjs/logger/log.common.js +1 -1
  208. package/dist/commonjs/logger/log.common.js.map +1 -1
  209. package/dist/commonjs/logger/log.js +1 -1
  210. package/dist/commonjs/logger/log.js.map +1 -1
  211. package/dist/commonjs/logger/logger.js +1 -1
  212. package/dist/commonjs/logger/logger.js.map +1 -1
  213. package/dist/commonjs/nodeHttpClient.js +1 -1
  214. package/dist/commonjs/nodeHttpClient.js.map +1 -1
  215. package/dist/commonjs/pipeline.js +1 -1
  216. package/dist/commonjs/pipeline.js.map +1 -1
  217. package/dist/commonjs/pipelineRequest.js +1 -1
  218. package/dist/commonjs/pipelineRequest.js.map +1 -1
  219. package/dist/commonjs/policies/bearerTokenAuthenticationPolicy.js +1 -1
  220. package/dist/commonjs/policies/bearerTokenAuthenticationPolicy.js.map +1 -1
  221. package/dist/commonjs/policies/decompressResponsePolicy.js +1 -1
  222. package/dist/commonjs/policies/decompressResponsePolicy.js.map +1 -1
  223. package/dist/commonjs/policies/defaultRetryPolicy.js +1 -1
  224. package/dist/commonjs/policies/defaultRetryPolicy.js.map +1 -1
  225. package/dist/commonjs/policies/exponentialRetryPolicy.js +1 -1
  226. package/dist/commonjs/policies/exponentialRetryPolicy.js.map +1 -1
  227. package/dist/commonjs/policies/formDataPolicy.js +1 -1
  228. package/dist/commonjs/policies/formDataPolicy.js.map +1 -1
  229. package/dist/commonjs/policies/logPolicy.js +1 -1
  230. package/dist/commonjs/policies/logPolicy.js.map +1 -1
  231. package/dist/commonjs/policies/multipartPolicy.js +1 -1
  232. package/dist/commonjs/policies/multipartPolicy.js.map +1 -1
  233. package/dist/commonjs/policies/proxyPolicy.common.js +1 -1
  234. package/dist/commonjs/policies/proxyPolicy.common.js.map +1 -1
  235. package/dist/commonjs/policies/proxyPolicy.js +1 -1
  236. package/dist/commonjs/policies/proxyPolicy.js.map +1 -1
  237. package/dist/commonjs/policies/redirectPolicy.js +1 -1
  238. package/dist/commonjs/policies/redirectPolicy.js.map +1 -1
  239. package/dist/commonjs/policies/retryPolicy.js +1 -1
  240. package/dist/commonjs/policies/retryPolicy.js.map +1 -1
  241. package/dist/commonjs/policies/systemErrorRetryPolicy.js +1 -1
  242. package/dist/commonjs/policies/systemErrorRetryPolicy.js.map +1 -1
  243. package/dist/commonjs/policies/throttlingRetryPolicy.js +1 -1
  244. package/dist/commonjs/policies/throttlingRetryPolicy.js.map +1 -1
  245. package/dist/commonjs/policies/tlsPolicy.js +1 -1
  246. package/dist/commonjs/policies/tlsPolicy.js.map +1 -1
  247. package/dist/commonjs/policies/tracingPolicy.js +1 -1
  248. package/dist/commonjs/policies/tracingPolicy.js.map +1 -1
  249. package/dist/commonjs/policies/userAgentPolicy.js +1 -1
  250. package/dist/commonjs/policies/userAgentPolicy.js.map +1 -1
  251. package/dist/commonjs/restError.js +1 -1
  252. package/dist/commonjs/restError.js.map +1 -1
  253. package/dist/commonjs/retryStrategies/exponentialRetryStrategy.js +1 -1
  254. package/dist/commonjs/retryStrategies/exponentialRetryStrategy.js.map +1 -1
  255. package/dist/commonjs/retryStrategies/retryStrategy.js +1 -1
  256. package/dist/commonjs/retryStrategies/retryStrategy.js.map +1 -1
  257. package/dist/commonjs/retryStrategies/throttlingRetryStrategy.js +1 -1
  258. package/dist/commonjs/retryStrategies/throttlingRetryStrategy.js.map +1 -1
  259. package/dist/commonjs/tracing/instrumenter.js +1 -1
  260. package/dist/commonjs/tracing/instrumenter.js.map +1 -1
  261. package/dist/commonjs/tracing/interfaces.js +1 -1
  262. package/dist/commonjs/tracing/interfaces.js.map +1 -1
  263. package/dist/commonjs/tracing/tracingClient.js +1 -1
  264. package/dist/commonjs/tracing/tracingClient.js.map +1 -1
  265. package/dist/commonjs/tracing/tracingContext.js +1 -1
  266. package/dist/commonjs/tracing/tracingContext.js.map +1 -1
  267. package/dist/commonjs/util/aborterUtils.js +1 -1
  268. package/dist/commonjs/util/aborterUtils.js.map +1 -1
  269. package/dist/commonjs/util/bytesEncoding.common.js +1 -1
  270. package/dist/commonjs/util/bytesEncoding.common.js.map +1 -1
  271. package/dist/commonjs/util/bytesEncoding.js +1 -1
  272. package/dist/commonjs/util/bytesEncoding.js.map +1 -1
  273. package/dist/commonjs/util/checkEnvironment.js +1 -1
  274. package/dist/commonjs/util/checkEnvironment.js.map +1 -1
  275. package/dist/commonjs/util/concat.common.js +1 -1
  276. package/dist/commonjs/util/concat.common.js.map +1 -1
  277. package/dist/commonjs/util/concat.js +1 -1
  278. package/dist/commonjs/util/concat.js.map +1 -1
  279. package/dist/commonjs/util/createAbortablePromise.js +1 -1
  280. package/dist/commonjs/util/createAbortablePromise.js.map +1 -1
  281. package/dist/commonjs/util/delay.js +1 -1
  282. package/dist/commonjs/util/delay.js.map +1 -1
  283. package/dist/commonjs/util/error.js +1 -1
  284. package/dist/commonjs/util/error.js.map +1 -1
  285. package/dist/commonjs/util/file.js +1 -1
  286. package/dist/commonjs/util/file.js.map +1 -1
  287. package/dist/commonjs/util/helpers.js +1 -1
  288. package/dist/commonjs/util/helpers.js.map +1 -1
  289. package/dist/commonjs/util/inspect.common.js +1 -1
  290. package/dist/commonjs/util/inspect.common.js.map +1 -1
  291. package/dist/commonjs/util/inspect.js +1 -1
  292. package/dist/commonjs/util/inspect.js.map +1 -1
  293. package/dist/commonjs/util/object.js +1 -1
  294. package/dist/commonjs/util/object.js.map +1 -1
  295. package/dist/commonjs/util/random.js +1 -1
  296. package/dist/commonjs/util/random.js.map +1 -1
  297. package/dist/commonjs/util/sanitizer.js +1 -1
  298. package/dist/commonjs/util/sanitizer.js.map +1 -1
  299. package/dist/commonjs/util/sha256.common.js +1 -1
  300. package/dist/commonjs/util/sha256.common.js.map +1 -1
  301. package/dist/commonjs/util/sha256.js +1 -1
  302. package/dist/commonjs/util/sha256.js.map +1 -1
  303. package/dist/commonjs/util/tokenCycler.js +1 -1
  304. package/dist/commonjs/util/tokenCycler.js.map +1 -1
  305. package/dist/commonjs/util/typeGuards.js +1 -1
  306. package/dist/commonjs/util/typeGuards.js.map +1 -1
  307. package/dist/commonjs/util/userAgent.js +1 -1
  308. package/dist/commonjs/util/userAgent.js.map +1 -1
  309. package/dist/commonjs/util/userAgentPlatform.js +1 -1
  310. package/dist/commonjs/util/userAgentPlatform.js.map +1 -1
  311. package/dist/commonjs/util/uuidUtils.common.js +1 -1
  312. package/dist/commonjs/util/uuidUtils.common.js.map +1 -1
  313. package/dist/commonjs/util/uuidUtils.js +1 -1
  314. package/dist/commonjs/util/uuidUtils.js.map +1 -1
  315. package/dist/commonjs/xhrHttpClient.js +1 -1
  316. package/dist/commonjs/xhrHttpClient.js.map +1 -1
  317. package/dist/esm/abort-controller/AbortError.js +1 -1
  318. package/dist/esm/abort-controller/AbortError.js.map +1 -1
  319. package/dist/esm/abort-controller/AbortSignalLike.js +1 -1
  320. package/dist/esm/abort-controller/AbortSignalLike.js.map +1 -1
  321. package/dist/esm/accessTokenCache.js +1 -1
  322. package/dist/esm/accessTokenCache.js.map +1 -1
  323. package/dist/esm/auth/keyCredential.js +1 -1
  324. package/dist/esm/auth/keyCredential.js.map +1 -1
  325. package/dist/esm/auth/tokenCredential.js +1 -1
  326. package/dist/esm/auth/tokenCredential.js.map +1 -1
  327. package/dist/esm/client/apiVersionPolicy.js +1 -1
  328. package/dist/esm/client/apiVersionPolicy.js.map +1 -1
  329. package/dist/esm/client/clientHelpers.js +1 -1
  330. package/dist/esm/client/clientHelpers.js.map +1 -1
  331. package/dist/esm/client/common.js +1 -1
  332. package/dist/esm/client/common.js.map +1 -1
  333. package/dist/esm/client/getClient.js +1 -1
  334. package/dist/esm/client/getClient.js.map +1 -1
  335. package/dist/esm/client/keyCredentialAuthenticationPolicy.js +1 -1
  336. package/dist/esm/client/keyCredentialAuthenticationPolicy.js.map +1 -1
  337. package/dist/esm/client/multipart.js +1 -1
  338. package/dist/esm/client/multipart.js.map +1 -1
  339. package/dist/esm/client/operationOptionHelpers.js +1 -1
  340. package/dist/esm/client/operationOptionHelpers.js.map +1 -1
  341. package/dist/esm/client/restError.js +1 -1
  342. package/dist/esm/client/restError.js.map +1 -1
  343. package/dist/esm/client/sendRequest.js +1 -1
  344. package/dist/esm/client/sendRequest.js.map +1 -1
  345. package/dist/esm/client/urlHelpers.js +1 -1
  346. package/dist/esm/client/urlHelpers.js.map +1 -1
  347. package/dist/esm/constants.js +1 -1
  348. package/dist/esm/constants.js.map +1 -1
  349. package/dist/esm/createPipelineFromOptions.js +1 -1
  350. package/dist/esm/createPipelineFromOptions.js.map +1 -1
  351. package/dist/esm/defaultHttpClient.js +1 -1
  352. package/dist/esm/defaultHttpClient.js.map +1 -1
  353. package/dist/esm/fetchHttpClient.js +1 -1
  354. package/dist/esm/fetchHttpClient.js.map +1 -1
  355. package/dist/esm/httpHeaders.js +1 -1
  356. package/dist/esm/httpHeaders.js.map +1 -1
  357. package/dist/esm/index.js +1 -1
  358. package/dist/esm/index.js.map +1 -1
  359. package/dist/esm/interfaces.js +1 -1
  360. package/dist/esm/interfaces.js.map +1 -1
  361. package/dist/esm/log.js +1 -1
  362. package/dist/esm/log.js.map +1 -1
  363. package/dist/esm/logger/debug.js +1 -1
  364. package/dist/esm/logger/debug.js.map +1 -1
  365. package/dist/esm/logger/log.common.js +1 -1
  366. package/dist/esm/logger/log.common.js.map +1 -1
  367. package/dist/esm/logger/log.js +1 -1
  368. package/dist/esm/logger/log.js.map +1 -1
  369. package/dist/esm/logger/logger.js +1 -1
  370. package/dist/esm/logger/logger.js.map +1 -1
  371. package/dist/esm/nodeHttpClient.js +1 -1
  372. package/dist/esm/nodeHttpClient.js.map +1 -1
  373. package/dist/esm/pipeline.js +1 -1
  374. package/dist/esm/pipeline.js.map +1 -1
  375. package/dist/esm/pipelineRequest.js +1 -1
  376. package/dist/esm/pipelineRequest.js.map +1 -1
  377. package/dist/esm/policies/bearerTokenAuthenticationPolicy.js +1 -1
  378. package/dist/esm/policies/bearerTokenAuthenticationPolicy.js.map +1 -1
  379. package/dist/esm/policies/decompressResponsePolicy.js +1 -1
  380. package/dist/esm/policies/decompressResponsePolicy.js.map +1 -1
  381. package/dist/esm/policies/defaultRetryPolicy.js +1 -1
  382. package/dist/esm/policies/defaultRetryPolicy.js.map +1 -1
  383. package/dist/esm/policies/exponentialRetryPolicy.js +1 -1
  384. package/dist/esm/policies/exponentialRetryPolicy.js.map +1 -1
  385. package/dist/esm/policies/formDataPolicy.js +1 -1
  386. package/dist/esm/policies/formDataPolicy.js.map +1 -1
  387. package/dist/esm/policies/logPolicy.js +1 -1
  388. package/dist/esm/policies/logPolicy.js.map +1 -1
  389. package/dist/esm/policies/multipartPolicy.js +1 -1
  390. package/dist/esm/policies/multipartPolicy.js.map +1 -1
  391. package/dist/esm/policies/proxyPolicy.common.js +1 -1
  392. package/dist/esm/policies/proxyPolicy.common.js.map +1 -1
  393. package/dist/esm/policies/proxyPolicy.js +1 -1
  394. package/dist/esm/policies/proxyPolicy.js.map +1 -1
  395. package/dist/esm/policies/redirectPolicy.js +1 -1
  396. package/dist/esm/policies/redirectPolicy.js.map +1 -1
  397. package/dist/esm/policies/retryPolicy.js +1 -1
  398. package/dist/esm/policies/retryPolicy.js.map +1 -1
  399. package/dist/esm/policies/systemErrorRetryPolicy.js +1 -1
  400. package/dist/esm/policies/systemErrorRetryPolicy.js.map +1 -1
  401. package/dist/esm/policies/throttlingRetryPolicy.js +1 -1
  402. package/dist/esm/policies/throttlingRetryPolicy.js.map +1 -1
  403. package/dist/esm/policies/tlsPolicy.js +1 -1
  404. package/dist/esm/policies/tlsPolicy.js.map +1 -1
  405. package/dist/esm/policies/tracingPolicy.js +1 -1
  406. package/dist/esm/policies/tracingPolicy.js.map +1 -1
  407. package/dist/esm/policies/userAgentPolicy.js +1 -1
  408. package/dist/esm/policies/userAgentPolicy.js.map +1 -1
  409. package/dist/esm/restError.js +1 -1
  410. package/dist/esm/restError.js.map +1 -1
  411. package/dist/esm/retryStrategies/exponentialRetryStrategy.js +1 -1
  412. package/dist/esm/retryStrategies/exponentialRetryStrategy.js.map +1 -1
  413. package/dist/esm/retryStrategies/retryStrategy.js +1 -1
  414. package/dist/esm/retryStrategies/retryStrategy.js.map +1 -1
  415. package/dist/esm/retryStrategies/throttlingRetryStrategy.js +1 -1
  416. package/dist/esm/retryStrategies/throttlingRetryStrategy.js.map +1 -1
  417. package/dist/esm/tracing/instrumenter.js +1 -1
  418. package/dist/esm/tracing/instrumenter.js.map +1 -1
  419. package/dist/esm/tracing/interfaces.js +1 -1
  420. package/dist/esm/tracing/interfaces.js.map +1 -1
  421. package/dist/esm/tracing/tracingClient.js +1 -1
  422. package/dist/esm/tracing/tracingClient.js.map +1 -1
  423. package/dist/esm/tracing/tracingContext.js +1 -1
  424. package/dist/esm/tracing/tracingContext.js.map +1 -1
  425. package/dist/esm/util/aborterUtils.js +1 -1
  426. package/dist/esm/util/aborterUtils.js.map +1 -1
  427. package/dist/esm/util/bytesEncoding.common.js +1 -1
  428. package/dist/esm/util/bytesEncoding.common.js.map +1 -1
  429. package/dist/esm/util/bytesEncoding.js +1 -1
  430. package/dist/esm/util/bytesEncoding.js.map +1 -1
  431. package/dist/esm/util/checkEnvironment.js +1 -1
  432. package/dist/esm/util/checkEnvironment.js.map +1 -1
  433. package/dist/esm/util/concat.common.js +1 -1
  434. package/dist/esm/util/concat.common.js.map +1 -1
  435. package/dist/esm/util/concat.js +1 -1
  436. package/dist/esm/util/concat.js.map +1 -1
  437. package/dist/esm/util/createAbortablePromise.js +1 -1
  438. package/dist/esm/util/createAbortablePromise.js.map +1 -1
  439. package/dist/esm/util/delay.js +1 -1
  440. package/dist/esm/util/delay.js.map +1 -1
  441. package/dist/esm/util/error.js +1 -1
  442. package/dist/esm/util/error.js.map +1 -1
  443. package/dist/esm/util/file.js +1 -1
  444. package/dist/esm/util/file.js.map +1 -1
  445. package/dist/esm/util/helpers.js +1 -1
  446. package/dist/esm/util/helpers.js.map +1 -1
  447. package/dist/esm/util/inspect.common.js +1 -1
  448. package/dist/esm/util/inspect.common.js.map +1 -1
  449. package/dist/esm/util/inspect.js +1 -1
  450. package/dist/esm/util/inspect.js.map +1 -1
  451. package/dist/esm/util/object.js +1 -1
  452. package/dist/esm/util/object.js.map +1 -1
  453. package/dist/esm/util/random.js +1 -1
  454. package/dist/esm/util/random.js.map +1 -1
  455. package/dist/esm/util/sanitizer.js +1 -1
  456. package/dist/esm/util/sanitizer.js.map +1 -1
  457. package/dist/esm/util/sha256.common.js +1 -1
  458. package/dist/esm/util/sha256.common.js.map +1 -1
  459. package/dist/esm/util/sha256.js +1 -1
  460. package/dist/esm/util/sha256.js.map +1 -1
  461. package/dist/esm/util/tokenCycler.js +1 -1
  462. package/dist/esm/util/tokenCycler.js.map +1 -1
  463. package/dist/esm/util/typeGuards.js +1 -1
  464. package/dist/esm/util/typeGuards.js.map +1 -1
  465. package/dist/esm/util/userAgent.js +1 -1
  466. package/dist/esm/util/userAgent.js.map +1 -1
  467. package/dist/esm/util/userAgentPlatform.js +1 -1
  468. package/dist/esm/util/userAgentPlatform.js.map +1 -1
  469. package/dist/esm/util/uuidUtils.common.js +1 -1
  470. package/dist/esm/util/uuidUtils.common.js.map +1 -1
  471. package/dist/esm/util/uuidUtils.js +1 -1
  472. package/dist/esm/util/uuidUtils.js.map +1 -1
  473. package/dist/esm/xhrHttpClient.js +1 -1
  474. package/dist/esm/xhrHttpClient.js.map +1 -1
  475. package/dist/react-native/abort-controller/AbortError.js +1 -1
  476. package/dist/react-native/abort-controller/AbortError.js.map +1 -1
  477. package/dist/react-native/abort-controller/AbortSignalLike.js +1 -1
  478. package/dist/react-native/abort-controller/AbortSignalLike.js.map +1 -1
  479. package/dist/react-native/accessTokenCache.js +1 -1
  480. package/dist/react-native/accessTokenCache.js.map +1 -1
  481. package/dist/react-native/auth/keyCredential.js +1 -1
  482. package/dist/react-native/auth/keyCredential.js.map +1 -1
  483. package/dist/react-native/auth/tokenCredential.js +1 -1
  484. package/dist/react-native/auth/tokenCredential.js.map +1 -1
  485. package/dist/react-native/client/apiVersionPolicy.js +1 -1
  486. package/dist/react-native/client/apiVersionPolicy.js.map +1 -1
  487. package/dist/react-native/client/clientHelpers.js +1 -1
  488. package/dist/react-native/client/clientHelpers.js.map +1 -1
  489. package/dist/react-native/client/common.js +1 -1
  490. package/dist/react-native/client/common.js.map +1 -1
  491. package/dist/react-native/client/getClient.js +1 -1
  492. package/dist/react-native/client/getClient.js.map +1 -1
  493. package/dist/react-native/client/keyCredentialAuthenticationPolicy.js +1 -1
  494. package/dist/react-native/client/keyCredentialAuthenticationPolicy.js.map +1 -1
  495. package/dist/react-native/client/multipart.js +1 -1
  496. package/dist/react-native/client/multipart.js.map +1 -1
  497. package/dist/react-native/client/operationOptionHelpers.js +1 -1
  498. package/dist/react-native/client/operationOptionHelpers.js.map +1 -1
  499. package/dist/react-native/client/restError.js +1 -1
  500. package/dist/react-native/client/restError.js.map +1 -1
  501. package/dist/react-native/client/sendRequest.js +1 -1
  502. package/dist/react-native/client/sendRequest.js.map +1 -1
  503. package/dist/react-native/client/urlHelpers.js +1 -1
  504. package/dist/react-native/client/urlHelpers.js.map +1 -1
  505. package/dist/react-native/constants.js +1 -1
  506. package/dist/react-native/constants.js.map +1 -1
  507. package/dist/react-native/createPipelineFromOptions.js +1 -1
  508. package/dist/react-native/createPipelineFromOptions.js.map +1 -1
  509. package/dist/react-native/defaultHttpClient-react-native.mjs.map +1 -1
  510. package/dist/react-native/defaultHttpClient.js +1 -1
  511. package/dist/react-native/fetchHttpClient.js +1 -1
  512. package/dist/react-native/fetchHttpClient.js.map +1 -1
  513. package/dist/react-native/httpHeaders.js +1 -1
  514. package/dist/react-native/httpHeaders.js.map +1 -1
  515. package/dist/react-native/index.js +1 -1
  516. package/dist/react-native/index.js.map +1 -1
  517. package/dist/react-native/interfaces.js +1 -1
  518. package/dist/react-native/interfaces.js.map +1 -1
  519. package/dist/react-native/log.js +1 -1
  520. package/dist/react-native/log.js.map +1 -1
  521. package/dist/react-native/logger/debug.js +1 -1
  522. package/dist/react-native/logger/debug.js.map +1 -1
  523. package/dist/react-native/logger/log-react-native.mjs.map +1 -1
  524. package/dist/react-native/logger/log.common.js +1 -1
  525. package/dist/react-native/logger/log.common.js.map +1 -1
  526. package/dist/react-native/logger/log.js +1 -1
  527. package/dist/react-native/logger/logger.js +1 -1
  528. package/dist/react-native/logger/logger.js.map +1 -1
  529. package/dist/react-native/nodeHttpClient.js +1 -1
  530. package/dist/react-native/nodeHttpClient.js.map +1 -1
  531. package/dist/react-native/pipeline.js +1 -1
  532. package/dist/react-native/pipeline.js.map +1 -1
  533. package/dist/react-native/pipelineRequest.js +1 -1
  534. package/dist/react-native/pipelineRequest.js.map +1 -1
  535. package/dist/react-native/policies/bearerTokenAuthenticationPolicy.js +1 -1
  536. package/dist/react-native/policies/bearerTokenAuthenticationPolicy.js.map +1 -1
  537. package/dist/react-native/policies/decompressResponsePolicy.js +1 -1
  538. package/dist/react-native/policies/decompressResponsePolicy.js.map +1 -1
  539. package/dist/react-native/policies/defaultRetryPolicy.js +1 -1
  540. package/dist/react-native/policies/defaultRetryPolicy.js.map +1 -1
  541. package/dist/react-native/policies/exponentialRetryPolicy.js +1 -1
  542. package/dist/react-native/policies/exponentialRetryPolicy.js.map +1 -1
  543. package/dist/react-native/policies/formDataPolicy.js +1 -1
  544. package/dist/react-native/policies/formDataPolicy.js.map +1 -1
  545. package/dist/react-native/policies/logPolicy.js +1 -1
  546. package/dist/react-native/policies/logPolicy.js.map +1 -1
  547. package/dist/react-native/policies/multipartPolicy.js +1 -1
  548. package/dist/react-native/policies/multipartPolicy.js.map +1 -1
  549. package/dist/react-native/policies/proxyPolicy-react-native.mjs.map +1 -1
  550. package/dist/react-native/policies/proxyPolicy.common.js +1 -1
  551. package/dist/react-native/policies/proxyPolicy.common.js.map +1 -1
  552. package/dist/react-native/policies/proxyPolicy.js +1 -1
  553. package/dist/react-native/policies/redirectPolicy.js +1 -1
  554. package/dist/react-native/policies/redirectPolicy.js.map +1 -1
  555. package/dist/react-native/policies/retryPolicy.js +1 -1
  556. package/dist/react-native/policies/retryPolicy.js.map +1 -1
  557. package/dist/react-native/policies/systemErrorRetryPolicy.js +1 -1
  558. package/dist/react-native/policies/systemErrorRetryPolicy.js.map +1 -1
  559. package/dist/react-native/policies/throttlingRetryPolicy.js +1 -1
  560. package/dist/react-native/policies/throttlingRetryPolicy.js.map +1 -1
  561. package/dist/react-native/policies/tlsPolicy.js +1 -1
  562. package/dist/react-native/policies/tlsPolicy.js.map +1 -1
  563. package/dist/react-native/policies/tracingPolicy.js +1 -1
  564. package/dist/react-native/policies/tracingPolicy.js.map +1 -1
  565. package/dist/react-native/policies/userAgentPolicy.js +1 -1
  566. package/dist/react-native/policies/userAgentPolicy.js.map +1 -1
  567. package/dist/react-native/restError.js +1 -1
  568. package/dist/react-native/restError.js.map +1 -1
  569. package/dist/react-native/retryStrategies/exponentialRetryStrategy.js +1 -1
  570. package/dist/react-native/retryStrategies/exponentialRetryStrategy.js.map +1 -1
  571. package/dist/react-native/retryStrategies/retryStrategy.js +1 -1
  572. package/dist/react-native/retryStrategies/retryStrategy.js.map +1 -1
  573. package/dist/react-native/retryStrategies/throttlingRetryStrategy.js +1 -1
  574. package/dist/react-native/retryStrategies/throttlingRetryStrategy.js.map +1 -1
  575. package/dist/react-native/tracing/instrumenter.js +1 -1
  576. package/dist/react-native/tracing/instrumenter.js.map +1 -1
  577. package/dist/react-native/tracing/interfaces.js +1 -1
  578. package/dist/react-native/tracing/interfaces.js.map +1 -1
  579. package/dist/react-native/tracing/tracingClient.js +1 -1
  580. package/dist/react-native/tracing/tracingClient.js.map +1 -1
  581. package/dist/react-native/tracing/tracingContext.js +1 -1
  582. package/dist/react-native/tracing/tracingContext.js.map +1 -1
  583. package/dist/react-native/util/aborterUtils.js +1 -1
  584. package/dist/react-native/util/aborterUtils.js.map +1 -1
  585. package/dist/react-native/util/bytesEncoding-react-native.mjs.map +1 -1
  586. package/dist/react-native/util/bytesEncoding.common.js +1 -1
  587. package/dist/react-native/util/bytesEncoding.common.js.map +1 -1
  588. package/dist/react-native/util/bytesEncoding.js +1 -1
  589. package/dist/react-native/util/checkEnvironment.js +1 -1
  590. package/dist/react-native/util/checkEnvironment.js.map +1 -1
  591. package/dist/react-native/util/concat-react-native.mjs.map +1 -1
  592. package/dist/react-native/util/concat.common.js +1 -1
  593. package/dist/react-native/util/concat.common.js.map +1 -1
  594. package/dist/react-native/util/concat.js +1 -1
  595. package/dist/react-native/util/createAbortablePromise.js +1 -1
  596. package/dist/react-native/util/createAbortablePromise.js.map +1 -1
  597. package/dist/react-native/util/delay.js +1 -1
  598. package/dist/react-native/util/delay.js.map +1 -1
  599. package/dist/react-native/util/error.js +1 -1
  600. package/dist/react-native/util/error.js.map +1 -1
  601. package/dist/react-native/util/file.js +1 -1
  602. package/dist/react-native/util/file.js.map +1 -1
  603. package/dist/react-native/util/helpers.js +1 -1
  604. package/dist/react-native/util/helpers.js.map +1 -1
  605. package/dist/react-native/util/inspect-react-native.mjs.map +1 -1
  606. package/dist/react-native/util/inspect.common.js +1 -1
  607. package/dist/react-native/util/inspect.common.js.map +1 -1
  608. package/dist/react-native/util/inspect.js +1 -1
  609. package/dist/react-native/util/object.js +1 -1
  610. package/dist/react-native/util/object.js.map +1 -1
  611. package/dist/react-native/util/random.js +1 -1
  612. package/dist/react-native/util/random.js.map +1 -1
  613. package/dist/react-native/util/sanitizer.js +1 -1
  614. package/dist/react-native/util/sanitizer.js.map +1 -1
  615. package/dist/react-native/util/sha256-react-native.mjs.map +1 -1
  616. package/dist/react-native/util/sha256.common.js +1 -1
  617. package/dist/react-native/util/sha256.common.js.map +1 -1
  618. package/dist/react-native/util/sha256.js +1 -1
  619. package/dist/react-native/util/tokenCycler.js +1 -1
  620. package/dist/react-native/util/tokenCycler.js.map +1 -1
  621. package/dist/react-native/util/typeGuards.js +1 -1
  622. package/dist/react-native/util/typeGuards.js.map +1 -1
  623. package/dist/react-native/util/userAgent.js +1 -1
  624. package/dist/react-native/util/userAgent.js.map +1 -1
  625. package/dist/react-native/util/userAgentPlatform-react-native.mjs.map +1 -1
  626. package/dist/react-native/util/userAgentPlatform.js +1 -1
  627. package/dist/react-native/util/uuidUtils-react-native.mjs.map +1 -1
  628. package/dist/react-native/util/uuidUtils.common.js +1 -1
  629. package/dist/react-native/util/uuidUtils.common.js.map +1 -1
  630. package/dist/react-native/util/uuidUtils.js +1 -1
  631. package/dist/react-native/xhrHttpClient.js +1 -1
  632. package/dist/react-native/xhrHttpClient.js.map +1 -1
  633. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  // Copyright (c) Microsoft Corporation.
3
- // Licensed under the MIT license.
3
+ // Licensed under the MIT License.
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.systemErrorRetryPolicyName = void 0;
6
6
  exports.systemErrorRetryPolicy = systemErrorRetryPolicy;
@@ -1 +1 @@
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,kCACnB,OAAO,KACV,qBAAqB,EAAE,IAAI,IAC3B;SACH,EACD;YACE,UAAU,EAAE,MAAA,OAAO,CAAC,UAAU,mCAAI,yCAA0B;SAC7D,CACF,CAAC,WAAW;KACd,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { 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
+ {"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,kCACnB,OAAO,KACV,qBAAqB,EAAE,IAAI,IAC3B;SACH,EACD;YACE,UAAU,EAAE,MAAA,OAAO,CAAC,UAAU,mCAAI,yCAA0B;SAC7D,CACF,CAAC,WAAW;KACd,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { 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,6 +1,6 @@
1
1
  "use strict";
2
2
  // Copyright (c) Microsoft Corporation.
3
- // Licensed under the MIT license.
3
+ // Licensed under the MIT License.
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.throttlingRetryPolicyName = void 0;
6
6
  exports.throttlingRetryPolicy = throttlingRetryPolicy;
@@ -1 +1 @@
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,MAAA,OAAO,CAAC,UAAU,mCAAI,yCAA0B;SAC7D,CAAC,CAAC,WAAW;KACf,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { 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://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-manager-request-limits,\n * https://docs.microsoft.com/en-us/azure/azure-subscription-service-limits and\n * https://docs.microsoft.com/en-us/azure/virtual-machines/troubleshooting/troubleshooting-throttling-errors\n *\n * @param options - Options that configure retry logic.\n */\nexport function throttlingRetryPolicy(options: ThrottlingRetryPolicyOptions = {}): PipelinePolicy {\n return {\n name: throttlingRetryPolicyName,\n sendRequest: retryPolicy([throttlingRetryStrategy()], {\n maxRetries: options.maxRetries ?? DEFAULT_RETRY_POLICY_COUNT,\n }).sendRequest,\n };\n}\n"]}
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,MAAA,OAAO,CAAC,UAAU,mCAAI,yCAA0B;SAC7D,CAAC,CAAC,WAAW;KACf,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { 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://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-manager-request-limits,\n * https://docs.microsoft.com/en-us/azure/azure-subscription-service-limits and\n * https://docs.microsoft.com/en-us/azure/virtual-machines/troubleshooting/troubleshooting-throttling-errors\n *\n * @param options - Options that configure retry logic.\n */\nexport function throttlingRetryPolicy(options: ThrottlingRetryPolicyOptions = {}): PipelinePolicy {\n return {\n name: throttlingRetryPolicyName,\n sendRequest: retryPolicy([throttlingRetryStrategy()], {\n maxRetries: options.maxRetries ?? DEFAULT_RETRY_POLICY_COUNT,\n }).sendRequest,\n };\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  // Copyright (c) Microsoft Corporation.
3
- // Licensed under the MIT license.
3
+ // Licensed under the MIT License.
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.tlsPolicyName = void 0;
6
6
  exports.tlsPolicy = tlsPolicy;
@@ -1 +1 @@
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 { PipelinePolicy } from \"../pipeline.js\";\nimport { 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
+ {"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 { PipelinePolicy } from \"../pipeline.js\";\nimport { 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,6 +1,6 @@
1
1
  "use strict";
2
2
  // Copyright (c) Microsoft Corporation.
3
- // Licensed under the MIT license.
3
+ // Licensed under the MIT License.
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.tracingPolicyName = void 0;
6
6
  exports.tracingPolicy = tracingPolicy;
@@ -1 +1 @@
1
- {"version":3,"file":"tracingPolicy.js","sourceRoot":"","sources":["../../../src/policies/tracingPolicy.ts"],"names":[],"mappings":";AAA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MAAM,CAAC,CAAC;QACvD,MAAM,gBAAgB,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;QACjE,IAAI,gBAAgB,EAAE,CAAC;YACrB,IAAI,CAAC,YAAY,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAC;QAC1D,CAAC;QACD,IAAI,CAAC,SAAS,CAAC;YACb,MAAM,EAAE,SAAS;SAClB,CAAC,CAAC;QACH,IAAI,CAAC,GAAG,EAAE,CAAC;IACb,CAAC;IAAC,OAAO,CAAM,EAAE,CAAC;QAChB,eAAM,CAAC,OAAO,CAAC,qDAAqD,IAAA,0BAAe,EAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAC5F,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { TracingClient, TracingContext, TracingSpan } from \"../tracing/interfaces.js\";\nimport { createTracingClient } from \"../tracing/tracingClient.js\";\nimport { SDK_VERSION } from \"../constants.js\";\nimport { PipelineRequest, PipelineResponse, SendRequest } from \"../interfaces.js\";\nimport { PipelinePolicy } from \"../pipeline.js\";\nimport { getUserAgentValue } from \"../util/userAgent.js\";\nimport { logger } from \"../log.js\";\nimport { getErrorMessage, isError } from \"../util/error.js\";\nimport { isRestError } from \"../restError.js\";\nimport { Sanitizer } from \"../util/sanitizer.js\";\n\n/**\n * The programmatic identifier of the tracingPolicy.\n */\nexport const tracingPolicyName = \"tracingPolicy\";\n\n/**\n * Options to configure the tracing policy.\n */\nexport interface TracingPolicyOptions {\n /**\n * String prefix to add to the user agent logged as metadata\n * on the generated Span.\n * Defaults to an empty string.\n */\n userAgentPrefix?: string;\n /**\n * Query string names whose values will be logged when logging is enabled. By default no\n * query string values are logged.\n */\n additionalAllowedQueryParameters?: string[];\n}\n\n/**\n * A simple policy to create OpenTelemetry Spans for each request made by the pipeline\n * that has SpanOptions with a parent.\n * Requests made without a parent Span will not be recorded.\n * @param options - Options to configure the telemetry logged by the tracing policy.\n */\nexport function tracingPolicy(options: TracingPolicyOptions = {}): PipelinePolicy {\n const userAgentValue = getUserAgentValue(options.userAgentPrefix);\n const sanitizer = new Sanitizer({\n additionalAllowedQueryParameters: options.additionalAllowedQueryParameters,\n });\n const tracingClient = tryCreateTracingClient();\n\n return {\n name: tracingPolicyName,\n async sendRequest(request: PipelineRequest, next: SendRequest): Promise<PipelineResponse> {\n if (!tracingClient || !request.tracingOptions?.tracingContext) {\n return next(request);\n }\n\n const userAgent = await userAgentValue;\n\n const spanAttributes = {\n \"http.url\": sanitizer.sanitizeUrl(request.url),\n \"http.method\": request.method,\n \"http.user_agent\": userAgent,\n requestId: request.requestId,\n };\n if (userAgent) {\n spanAttributes[\"http.user_agent\"] = userAgent;\n }\n\n const { span, tracingContext } = tryCreateSpan(tracingClient, request, spanAttributes) ?? {};\n\n if (!span || !tracingContext) {\n return next(request);\n }\n\n try {\n const response = await tracingClient.withContext(tracingContext, next, request);\n tryProcessResponse(span, response);\n return response;\n } catch (err: any) {\n tryProcessError(span, err);\n throw err;\n }\n },\n };\n}\n\nfunction tryCreateTracingClient(): TracingClient | undefined {\n try {\n return createTracingClient({\n namespace: \"\",\n packageName: \"@typespec/ts-http-runtime\",\n packageVersion: SDK_VERSION,\n });\n } catch (e: unknown) {\n logger.warning(`Error when creating the TracingClient: ${getErrorMessage(e)}`);\n return undefined;\n }\n}\n\nfunction tryCreateSpan(\n tracingClient: TracingClient,\n request: PipelineRequest,\n spanAttributes: Record<string, unknown>,\n): { span: TracingSpan; tracingContext: TracingContext } | undefined {\n try {\n // As per spec, we do not need to differentiate between HTTP and HTTPS in span name.\n const { span, updatedOptions } = tracingClient.startSpan(\n `HTTP ${request.method}`,\n { tracingOptions: request.tracingOptions },\n {\n spanKind: \"client\",\n spanAttributes,\n },\n );\n\n // If the span is not recording, don't do any more work.\n if (!span.isRecording()) {\n span.end();\n return undefined;\n }\n\n // set headers\n const headers = tracingClient.createRequestHeaders(\n updatedOptions.tracingOptions.tracingContext,\n );\n for (const [key, value] of Object.entries(headers)) {\n request.headers.set(key, value);\n }\n return { span, tracingContext: updatedOptions.tracingOptions.tracingContext };\n } catch (e: any) {\n logger.warning(`Skipping creating a tracing span due to an error: ${getErrorMessage(e)}`);\n return undefined;\n }\n}\n\nfunction tryProcessError(span: TracingSpan, error: unknown): void {\n try {\n span.setStatus({\n status: \"error\",\n error: isError(error) ? error : undefined,\n });\n if (isRestError(error) && error.statusCode) {\n span.setAttribute(\"http.status_code\", error.statusCode);\n }\n span.end();\n } catch (e: any) {\n logger.warning(`Skipping tracing span processing due to an error: ${getErrorMessage(e)}`);\n }\n}\n\nfunction tryProcessResponse(span: TracingSpan, response: PipelineResponse): void {\n try {\n span.setAttribute(\"http.status_code\", response.status);\n const serviceRequestId = response.headers.get(\"x-ms-request-id\");\n if (serviceRequestId) {\n span.setAttribute(\"serviceRequestId\", serviceRequestId);\n }\n span.setStatus({\n status: \"success\",\n });\n span.end();\n } catch (e: any) {\n logger.warning(`Skipping tracing span processing due to an error: ${getErrorMessage(e)}`);\n }\n}\n"]}
1
+ {"version":3,"file":"tracingPolicy.js","sourceRoot":"","sources":["../../../src/policies/tracingPolicy.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAyClC,sCA0CC;AAhFD,kEAAkE;AAClE,kDAA8C;AAG9C,uDAAyD;AACzD,sCAAmC;AACnC,+CAA4D;AAC5D,kDAA8C;AAC9C,uDAAiD;AAEjD;;GAEG;AACU,QAAA,iBAAiB,GAAG,eAAe,CAAC;AAmBjD;;;;;GAKG;AACH,SAAgB,aAAa,CAAC,UAAgC,EAAE;IAC9D,MAAM,cAAc,GAAG,IAAA,gCAAiB,EAAC,OAAO,CAAC,eAAe,CAAC,CAAC;IAClE,MAAM,SAAS,GAAG,IAAI,wBAAS,CAAC;QAC9B,gCAAgC,EAAE,OAAO,CAAC,gCAAgC;KAC3E,CAAC,CAAC;IACH,MAAM,aAAa,GAAG,sBAAsB,EAA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cesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { TracingClient, TracingContext, TracingSpan } from \"../tracing/interfaces.js\";\nimport { createTracingClient } from \"../tracing/tracingClient.js\";\nimport { SDK_VERSION } from \"../constants.js\";\nimport { PipelineRequest, PipelineResponse, SendRequest } from \"../interfaces.js\";\nimport { PipelinePolicy } from \"../pipeline.js\";\nimport { getUserAgentValue } from \"../util/userAgent.js\";\nimport { logger } from \"../log.js\";\nimport { getErrorMessage, isError } from \"../util/error.js\";\nimport { isRestError } from \"../restError.js\";\nimport { Sanitizer } from \"../util/sanitizer.js\";\n\n/**\n * The programmatic identifier of the tracingPolicy.\n */\nexport const tracingPolicyName = \"tracingPolicy\";\n\n/**\n * Options to configure the tracing policy.\n */\nexport interface TracingPolicyOptions {\n /**\n * String prefix to add to the user agent logged as metadata\n * on the generated Span.\n * Defaults to an empty string.\n */\n userAgentPrefix?: string;\n /**\n * Query string names whose values will be logged when logging is enabled. By default no\n * query string values are logged.\n */\n additionalAllowedQueryParameters?: string[];\n}\n\n/**\n * A simple policy to create OpenTelemetry Spans for each request made by the pipeline\n * that has SpanOptions with a parent.\n * Requests made without a parent Span will not be recorded.\n * @param options - Options to configure the telemetry logged by the tracing policy.\n */\nexport function tracingPolicy(options: TracingPolicyOptions = {}): PipelinePolicy {\n const userAgentValue = getUserAgentValue(options.userAgentPrefix);\n const sanitizer = new Sanitizer({\n additionalAllowedQueryParameters: options.additionalAllowedQueryParameters,\n });\n const tracingClient = tryCreateTracingClient();\n\n return {\n name: tracingPolicyName,\n async sendRequest(request: PipelineRequest, next: SendRequest): Promise<PipelineResponse> {\n if (!tracingClient || !request.tracingOptions?.tracingContext) {\n return next(request);\n }\n\n const userAgent = await userAgentValue;\n\n const spanAttributes = {\n \"http.url\": sanitizer.sanitizeUrl(request.url),\n \"http.method\": request.method,\n \"http.user_agent\": userAgent,\n requestId: request.requestId,\n };\n if (userAgent) {\n spanAttributes[\"http.user_agent\"] = userAgent;\n }\n\n const { span, tracingContext } = tryCreateSpan(tracingClient, request, spanAttributes) ?? {};\n\n if (!span || !tracingContext) {\n return next(request);\n }\n\n try {\n const response = await tracingClient.withContext(tracingContext, next, request);\n tryProcessResponse(span, response);\n return response;\n } catch (err: any) {\n tryProcessError(span, err);\n throw err;\n }\n },\n };\n}\n\nfunction tryCreateTracingClient(): TracingClient | undefined {\n try {\n return createTracingClient({\n namespace: \"\",\n packageName: \"@typespec/ts-http-runtime\",\n packageVersion: SDK_VERSION,\n });\n } catch (e: unknown) {\n logger.warning(`Error when creating the TracingClient: ${getErrorMessage(e)}`);\n return undefined;\n }\n}\n\nfunction tryCreateSpan(\n tracingClient: TracingClient,\n request: PipelineRequest,\n spanAttributes: Record<string, unknown>,\n): { span: TracingSpan; tracingContext: TracingContext } | undefined {\n try {\n // As per spec, we do not need to differentiate between HTTP and HTTPS in span name.\n const { span, updatedOptions } = tracingClient.startSpan(\n `HTTP ${request.method}`,\n { tracingOptions: request.tracingOptions },\n {\n spanKind: \"client\",\n spanAttributes,\n },\n );\n\n // If the span is not recording, don't do any more work.\n if (!span.isRecording()) {\n span.end();\n return undefined;\n }\n\n // set headers\n const headers = tracingClient.createRequestHeaders(\n updatedOptions.tracingOptions.tracingContext,\n );\n for (const [key, value] of Object.entries(headers)) {\n request.headers.set(key, value);\n }\n return { span, tracingContext: updatedOptions.tracingOptions.tracingContext };\n } catch (e: any) {\n logger.warning(`Skipping creating a tracing span due to an error: ${getErrorMessage(e)}`);\n return undefined;\n }\n}\n\nfunction tryProcessError(span: TracingSpan, error: unknown): void {\n try {\n span.setStatus({\n status: \"error\",\n error: isError(error) ? error : undefined,\n });\n if (isRestError(error) && error.statusCode) {\n span.setAttribute(\"http.status_code\", error.statusCode);\n }\n span.end();\n } catch (e: any) {\n logger.warning(`Skipping tracing span processing due to an error: ${getErrorMessage(e)}`);\n }\n}\n\nfunction tryProcessResponse(span: TracingSpan, response: PipelineResponse): void {\n try {\n span.setAttribute(\"http.status_code\", response.status);\n const serviceRequestId = response.headers.get(\"x-ms-request-id\");\n if (serviceRequestId) {\n span.setAttribute(\"serviceRequestId\", serviceRequestId);\n }\n span.setStatus({\n status: \"success\",\n });\n span.end();\n } catch (e: any) {\n logger.warning(`Skipping tracing span processing due to an error: ${getErrorMessage(e)}`);\n }\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  // Copyright (c) Microsoft Corporation.
3
- // Licensed under the MIT license.
3
+ // Licensed under the MIT License.
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.userAgentPolicyName = void 0;
6
6
  exports.userAgentPolicy = userAgentPolicy;
@@ -1 +1 @@
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 { PipelineRequest, PipelineResponse, SendRequest } from \"../interfaces.js\";\nimport { 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
+ {"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 { PipelineRequest, PipelineResponse, SendRequest } from \"../interfaces.js\";\nimport { 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,6 +1,6 @@
1
1
  "use strict";
2
2
  // Copyright (c) Microsoft Corporation.
3
- // Licensed under the MIT license.
3
+ // Licensed under the MIT License.
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.RestError = void 0;
6
6
  exports.isRestError = isRestError;
@@ -1 +1 @@
1
- {"version":3,"file":"restError.js","sourceRoot":"","sources":["../../src/restError.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAwGlC,kCAKC;AA3GD,8CAA0C;AAE1C,kDAA2C;AAC3C,sDAAgD;AAEhD,MAAM,cAAc,GAAG,IA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AC,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 { 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 Object.setPrototypeOf(this, RestError.prototype);\n }\n\n /**\n * Logging method for util.inspect in Node\n */\n [custom](): string {\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,\n response: this.response,\n })}`;\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
+ {"version":3,"file":"restError.js","sourceRoot":"","sources":["../../src/restError.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAwGlC,kCAKC;AA3GD,8CAA0C;AAE1C,kDAA2C;AAC3C,sDAAgD;AAEhD,MAAM,cAAc,GAAG,IAAI,wBAAS,EAAE,CAAC;AAwBvC;;GAEG;AACH,MAAa,SAAU,SAAQ,KAAK;IAoClC,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,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACnD,CAAC;IAED;;OAEG;IACH,CAAC,mBAAM,CAAC;QACN,uGAAuG;QACvG,0BAA0B;QAC1B,OAAO,cAAc,IAAI,CAAC,OAAO,OAAO,cAAc,CAAC,QAAQ,iCAC1D,IAAI,KACP,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ,IACvB,EAAE,CAAC;IACP,CAAC;;AA/DH,8BAgEC;AA/DC;;;;GAIG;AACa,4BAAkB,GAAW,oBAAoB,CAAC;AAClE;;;GAGG;AACa,qBAAW,GAAW,aAAa,CAAC;AAuDtD;;;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 { 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 Object.setPrototypeOf(this, RestError.prototype);\n }\n\n /**\n * Logging method for util.inspect in Node\n */\n [custom](): string {\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,\n response: this.response,\n })}`;\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,6 +1,6 @@
1
1
  "use strict";
2
2
  // Copyright (c) Microsoft Corporation.
3
- // Licensed under the MIT license.
3
+ // Licensed under the MIT License.
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.exponentialRetryStrategy = exponentialRetryStrategy;
6
6
  exports.isExponentialRetryResponse = isExponentialRetryResponse;
@@ -1 +1 @@
1
- {"version":3,"file":"exponentialRetryStrategy.js","sourceRoot":"","sources":["../../../src/retryStrategies/exponentialRetryStrategy.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAiBlC,4DA4DC;AAOD,gEAQC;AAKD,sCAYC;AAzGD,iDAA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,GAAG,CAAC,gBAAgB,EAAE,gBAAgB,CAAC,CAAC;YAC7E,gFAAgF;YAChF,mEAAmE;YACnE,cAAc;gBACZ,uBAAuB,GAAG,CAAC,GAAG,IAAA,qCAAyB,EAAC,CAAC,EAAE,uBAAuB,GAAG,CAAC,CAAC,CAAC;YAC1F,OAAO,EAAE,cAAc,EAAE,CAAC;QAC5B,CAAC;KACF,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,SAAgB,0BAA0B,CAAC,QAA2B;IACpE,OAAO,OAAO,CACZ,QAAQ;QACN,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,CAC1B,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 { PipelineResponse } from \"../interfaces.js\";\nimport { RestError } from \"../restError.js\";\nimport { getRandomIntegerInclusive } from \"../util/random.js\";\nimport { 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 let retryAfterInMs = retryInterval;\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 // Exponentially increase the delay each time\n const exponentialDelay = retryAfterInMs * Math.pow(2, retryCount);\n // Don't let the delay exceed the maximum\n const clampedExponentialDelay = Math.min(maxRetryInterval, exponentialDelay);\n // Allow the final value to have some \"jitter\" (within 50% of the delay size) so\n // that retries across multiple clients don't occur simultaneously.\n retryAfterInMs =\n clampedExponentialDelay / 2 + getRandomIntegerInclusive(0, clampedExponentialDelay / 2);\n return { retryAfterInMs };\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
+ {"version":3,"file":"exponentialRetryStrategy.js","sourceRoot":"","sources":["../../../src/retryStrategies/exponentialRetryStrategy.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAiBlC,4DA4DC;AAOD,gEAQC;AAKD,sCAYC;AAzGD,iDAA8D;AAE9D,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,MAAA,OAAO,CAAC,cAAc,mCAAI,6BAA6B,CAAC;IAC9E,MAAM,gBAAgB,GAAG,MAAA,OAAO,CAAC,iBAAiB,mCAAI,iCAAiC,CAAC;IAExF,IAAI,cAAc,GAAG,aAAa,CAAC;IAEnC,OAAO;QACL,IAAI,EAAE,0BAA0B;QAChC,KAAK,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,aAAa,EAAE;YAC3C,MAAM,kBAAkB,GAAG,aAAa,CAAC,aAAa,CAAC,CAAC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,MAAM,KAAK,GAAG,CAC1B,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 { PipelineResponse } from \"../interfaces.js\";\nimport { RestError } from \"../restError.js\";\nimport { getRandomIntegerInclusive } from \"../util/random.js\";\nimport { 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 let retryAfterInMs = retryInterval;\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 // Exponentially increase the delay each time\n const exponentialDelay = retryAfterInMs * Math.pow(2, retryCount);\n // Don't let the delay exceed the maximum\n const clampedExponentialDelay = Math.min(maxRetryInterval, exponentialDelay);\n // Allow the final value to have some \"jitter\" (within 50% of the delay size) so\n // that retries across multiple clients don't occur simultaneously.\n retryAfterInMs =\n clampedExponentialDelay / 2 + getRandomIntegerInclusive(0, clampedExponentialDelay / 2);\n return { retryAfterInMs };\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,5 +1,5 @@
1
1
  "use strict";
2
2
  // Copyright (c) Microsoft Corporation.
3
- // Licensed under the MIT license.
3
+ // Licensed under the MIT License.
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  //# sourceMappingURL=retryStrategy.js.map
@@ -1 +1 @@
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 { TypeSpecRuntimeLogger } from \"../logger/logger.js\";\nimport { PipelineResponse } from \"../interfaces.js\";\nimport { 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
+ {"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 { TypeSpecRuntimeLogger } from \"../logger/logger.js\";\nimport { PipelineResponse } from \"../interfaces.js\";\nimport { 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,6 +1,6 @@
1
1
  "use strict";
2
2
  // Copyright (c) Microsoft Corporation.
3
- // Licensed under the MIT license.
3
+ // Licensed under the MIT License.
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.isThrottlingRetryResponse = isThrottlingRetryResponse;
6
6
  exports.throttlingRetryStrategy = throttlingRetryStrategy;
@@ -1 +1 @@
1
- {"version":3,"file":"throttlingRetryStrategy.js","sourceRoot":"","sources":["../../../src/retryStrategies/throttlingRetryStr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CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC/D,CAAC;IAAC,OAAO,CAAM,EAAE,CAAC;QAChB,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,SAAgB,yBAAyB,CAAC,QAA2B;IACnE,OAAO,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAAC;AACtD,CAAC;AAED,SAAgB,uBAAuB;IACrC,OAAO;QACL,IAAI,EAAE,yBAAyB;QAC/B,KAAK,CAAC,EAAE,QAAQ,EAAE;YAChB,MAAM,cAAc,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAC;YACnD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC;gBACrC,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;YAChC,CAAC;YACD,OAAO;gBACL,cAAc;aACf,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { PipelineResponse } from \"../index.js\";\nimport { parseHeaderValueAsNumber } from \"../util/helpers.js\";\nimport { RetryStrategy } from \"./retryStrategy.js\";\n\n/**\n * The header that comes back from services representing\n * the amount of time (minimum) to wait to retry (in seconds or timestamp after which we can retry).\n */\nconst RetryAfterHeader = \"Retry-After\";\n/**\n * The headers that come back from services representing\n * the amount of time (minimum) to wait to retry.\n *\n * \"retry-after-ms\", \"x-ms-retry-after-ms\" : milliseconds\n * \"Retry-After\" : seconds or timestamp\n */\nconst AllRetryAfterHeaders: string[] = [\"retry-after-ms\", \"x-ms-retry-after-ms\", RetryAfterHeader];\n\n/**\n * A response is a throttling retry response if it has a throttling status code (429 or 503),\n * as long as one of the [ \"Retry-After\" or \"retry-after-ms\" or \"x-ms-retry-after-ms\" ] headers has a valid value.\n *\n * Returns the `retryAfterInMs` value if the response is a throttling retry response.\n * If not throttling retry response, returns `undefined`.\n *\n * @internal\n */\nfunction getRetryAfterInMs(response?: PipelineResponse): number | undefined {\n if (!(response && [429, 503].includes(response.status))) return undefined;\n try {\n // Headers: \"retry-after-ms\", \"x-ms-retry-after-ms\", \"Retry-After\"\n for (const header of AllRetryAfterHeaders) {\n const retryAfterValue = parseHeaderValueAsNumber(response, header);\n if (retryAfterValue === 0 || retryAfterValue) {\n // \"Retry-After\" header ==> seconds\n // \"retry-after-ms\", \"x-ms-retry-after-ms\" headers ==> milli-seconds\n const multiplyingFactor = header === RetryAfterHeader ? 1000 : 1;\n return retryAfterValue * multiplyingFactor; // in milli-seconds\n }\n }\n\n // RetryAfterHeader (\"Retry-After\") has a special case where it might be formatted as a date instead of a number of seconds\n const retryAfterHeader = response.headers.get(RetryAfterHeader);\n if (!retryAfterHeader) return;\n\n const date = Date.parse(retryAfterHeader);\n const diff = date - Date.now();\n // negative diff would mean a date in the past, so retry asap with 0 milliseconds\n return Number.isFinite(diff) ? Math.max(0, diff) : undefined;\n } catch (e: any) {\n return undefined;\n }\n}\n\n/**\n * A response is a retry response if it has a throttling status code (429 or 503),\n * as long as one of the [ \"Retry-After\" or \"retry-after-ms\" or \"x-ms-retry-after-ms\" ] headers has a valid value.\n */\nexport function isThrottlingRetryResponse(response?: PipelineResponse): boolean {\n return Number.isFinite(getRetryAfterInMs(response));\n}\n\nexport function throttlingRetryStrategy(): RetryStrategy {\n return {\n name: \"throttlingRetryStrategy\",\n retry({ response }) {\n const retryAfterInMs = getRetryAfterInMs(response);\n if (!Number.isFinite(retryAfterInMs)) {\n return { skipStrategy: true };\n }\n return {\n retryAfterInMs,\n };\n },\n };\n}\n"]}
1
+ {"version":3,"file":"throttlingRetryStrategy.js","sourceRoot":"","sources":["../../../src/retryStrategies/throttlingRetryStrategy.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AA4DlC,8DAEC;AAED,0DAaC;AA1ED,mDAA8D;AAG9D;;;GAG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,CAAC;QAChB,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,SAAgB,yBAAyB,CAAC,QAA2B;IACnE,OAAO,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAAC;AACtD,CAAC;AAED,SAAgB,uBAAuB;IACrC,OAAO;QACL,IAAI,EAAE,yBAAyB;QAC/B,KAAK,CAAC,EAAE,QAAQ,EAAE;YAChB,MAAM,cAAc,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAC;YACnD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC;gBACrC,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;YAChC,CAAC;YACD,OAAO;gBACL,cAAc;aACf,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { PipelineResponse } from \"../index.js\";\nimport { parseHeaderValueAsNumber } from \"../util/helpers.js\";\nimport { RetryStrategy } from \"./retryStrategy.js\";\n\n/**\n * The header that comes back from services representing\n * the amount of time (minimum) to wait to retry (in seconds or timestamp after which we can retry).\n */\nconst RetryAfterHeader = \"Retry-After\";\n/**\n * The headers that come back from services representing\n * the amount of time (minimum) to wait to retry.\n *\n * \"retry-after-ms\", \"x-ms-retry-after-ms\" : milliseconds\n * \"Retry-After\" : seconds or timestamp\n */\nconst AllRetryAfterHeaders: string[] = [\"retry-after-ms\", \"x-ms-retry-after-ms\", RetryAfterHeader];\n\n/**\n * A response is a throttling retry response if it has a throttling status code (429 or 503),\n * as long as one of the [ \"Retry-After\" or \"retry-after-ms\" or \"x-ms-retry-after-ms\" ] headers has a valid value.\n *\n * Returns the `retryAfterInMs` value if the response is a throttling retry response.\n * If not throttling retry response, returns `undefined`.\n *\n * @internal\n */\nfunction getRetryAfterInMs(response?: PipelineResponse): number | undefined {\n if (!(response && [429, 503].includes(response.status))) return undefined;\n try {\n // Headers: \"retry-after-ms\", \"x-ms-retry-after-ms\", \"Retry-After\"\n for (const header of AllRetryAfterHeaders) {\n const retryAfterValue = parseHeaderValueAsNumber(response, header);\n if (retryAfterValue === 0 || retryAfterValue) {\n // \"Retry-After\" header ==> seconds\n // \"retry-after-ms\", \"x-ms-retry-after-ms\" headers ==> milli-seconds\n const multiplyingFactor = header === RetryAfterHeader ? 1000 : 1;\n return retryAfterValue * multiplyingFactor; // in milli-seconds\n }\n }\n\n // RetryAfterHeader (\"Retry-After\") has a special case where it might be formatted as a date instead of a number of seconds\n const retryAfterHeader = response.headers.get(RetryAfterHeader);\n if (!retryAfterHeader) return;\n\n const date = Date.parse(retryAfterHeader);\n const diff = date - Date.now();\n // negative diff would mean a date in the past, so retry asap with 0 milliseconds\n return Number.isFinite(diff) ? Math.max(0, diff) : undefined;\n } catch (e: any) {\n return undefined;\n }\n}\n\n/**\n * A response is a retry response if it has a throttling status code (429 or 503),\n * as long as one of the [ \"Retry-After\" or \"retry-after-ms\" or \"x-ms-retry-after-ms\" ] headers has a valid value.\n */\nexport function isThrottlingRetryResponse(response?: PipelineResponse): boolean {\n return Number.isFinite(getRetryAfterInMs(response));\n}\n\nexport function throttlingRetryStrategy(): RetryStrategy {\n return {\n name: \"throttlingRetryStrategy\",\n retry({ response }) {\n const retryAfterInMs = getRetryAfterInMs(response);\n if (!Number.isFinite(retryAfterInMs)) {\n return { skipStrategy: true };\n }\n return {\n retryAfterInMs,\n };\n },\n };\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  // Copyright (c) Microsoft Corporation.
3
- // Licensed under the MIT license.
3
+ // Licensed under the MIT License.
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.createDefaultTracingSpan = createDefaultTracingSpan;
6
6
  exports.createDefaultInstrumenter = createDefaultInstrumenter;
@@ -1 +1 @@
1
- {"version":3,"file":"instrumenter.js","sourceRoot":"","sources":["../../../src/tracing/instrumenter.ts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AAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n Instrumenter,\n InstrumenterSpanOptions,\n TracingContext,\n TracingSpan,\n} from \"./interfaces.js\";\nimport { createTracingContext } from \"./tracingContext.js\";\n\nexport function createDefaultTracingSpan(): TracingSpan {\n return {\n end: () => {\n // noop\n },\n isRecording: () => false,\n recordException: () => {\n // noop\n },\n setAttribute: () => {\n // noop\n },\n setStatus: () => {\n // noop\n },\n };\n}\n\nexport function createDefaultInstrumenter(): Instrumenter {\n return {\n createRequestHeaders: (): Record<string, string> => {\n return {};\n },\n parseTraceparentHeader: (): TracingContext | undefined => {\n return undefined;\n },\n startSpan: (\n _name: string,\n spanOptions: InstrumenterSpanOptions,\n ): { span: TracingSpan; tracingContext: TracingContext } => {\n return {\n span: createDefaultTracingSpan(),\n tracingContext: createTracingContext({ parentContext: spanOptions.tracingContext }),\n };\n },\n withContext<\n CallbackArgs extends unknown[],\n Callback extends (...args: CallbackArgs) => ReturnType<Callback>,\n >(\n _context: TracingContext,\n callback: Callback,\n ...callbackArgs: CallbackArgs\n ): ReturnType<Callback> {\n return callback(...callbackArgs);\n },\n };\n}\n\n/** @internal */\nlet instrumenterImplementation: Instrumenter | undefined;\n\n/**\n * Extends the SDK with support for a given instrumenter implementation.\n *\n * @param instrumenter - The instrumenter implementation to use.\n */\nexport function useInstrumenter(instrumenter: Instrumenter): void {\n instrumenterImplementation = instrumenter;\n}\n\n/**\n * Gets the currently set instrumenter, a No-Op instrumenter by default.\n *\n * @returns The currently set instrumenter\n */\nexport function getInstrumenter(): Instrumenter {\n if (!instrumenterImplementation) {\n instrumenterImplementation = createDefaultInstrumenter();\n }\n return instrumenterImplementation;\n}\n"]}
1
+ {"version":3,"file":"instrumenter.js","sourceRoot":"","sources":["../../../src/tracing/instrumenter.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAUlC,4DAgBC;AAED,8DA4BC;AAUD,0CAEC;AAOD,0CAKC;AAxED,2DAA2D;AAE3D,SAAgB,wBAAwB;IACtC,OAAO;QACL,GAAG,EAAE,GAAG,EAAE;YACR,OAAO;QACT,CAAC;QACD,WAAW,EAAE,GAAG,EAAE,CAAC,KAAK;QACxB,eAAe,EAAE,GAAG,EAAE;YACpB,OAAO;QACT,CAAC;QACD,YAAY,EAAE,GAAG,EAAE;YACjB,OAAO;QACT,CAAC;QACD,SAAS,EAAE,GAAG,EAAE;YACd,OAAO;QACT,CAAC;KACF,CAAC;AACJ,CAAC;AAED,SAAgB,yBAAyB;IACvC,OAAO;QACL,oBAAoB,EAAE,GAA2B,EAAE;YACjD,OAAO,EAAE,CAAC;QACZ,CAAC;QACD,sBAAsB,EAAE,GAA+B,EAAE;YACvD,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,SAAS,EAAE,CACT,KAAa,EACb,WAAoC,EACmB,EAAE;YACzD,OAAO;gBACL,IAAI,EAAE,wBAAwB,EAAE;gBAChC,cAAc,EAAE,IAAA,wCAAoB,EAAC,EAAE,aAAa,EAAE,WAAW,CAAC,cAAc,EAAE,CAAC;aACpF,CAAC;QACJ,CAAC;QACD,WAAW,CAIT,QAAwB,EACxB,QAAkB,EAClB,GAAG,YAA0B;YAE7B,OAAO,QAAQ,CAAC,GAAG,YAAY,CAAC,CAAC;QACnC,CAAC;KACF,CAAC;AACJ,CAAC;AAED,gBAAgB;AAChB,IAAI,0BAAoD,CAAC;AAEzD;;;;GAIG;AACH,SAAgB,eAAe,CAAC,YAA0B;IACxD,0BAA0B,GAAG,YAAY,CAAC;AAC5C,CAAC;AAED;;;;GAIG;AACH,SAAgB,eAAe;IAC7B,IAAI,CAAC,0BAA0B,EAAE,CAAC;QAChC,0BAA0B,GAAG,yBAAyB,EAAE,CAAC;IAC3D,CAAC;IACD,OAAO,0BAA0B,CAAC;AACpC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n Instrumenter,\n InstrumenterSpanOptions,\n TracingContext,\n TracingSpan,\n} from \"./interfaces.js\";\nimport { createTracingContext } from \"./tracingContext.js\";\n\nexport function createDefaultTracingSpan(): TracingSpan {\n return {\n end: () => {\n // noop\n },\n isRecording: () => false,\n recordException: () => {\n // noop\n },\n setAttribute: () => {\n // noop\n },\n setStatus: () => {\n // noop\n },\n };\n}\n\nexport function createDefaultInstrumenter(): Instrumenter {\n return {\n createRequestHeaders: (): Record<string, string> => {\n return {};\n },\n parseTraceparentHeader: (): TracingContext | undefined => {\n return undefined;\n },\n startSpan: (\n _name: string,\n spanOptions: InstrumenterSpanOptions,\n ): { span: TracingSpan; tracingContext: TracingContext } => {\n return {\n span: createDefaultTracingSpan(),\n tracingContext: createTracingContext({ parentContext: spanOptions.tracingContext }),\n };\n },\n withContext<\n CallbackArgs extends unknown[],\n Callback extends (...args: CallbackArgs) => ReturnType<Callback>,\n >(\n _context: TracingContext,\n callback: Callback,\n ...callbackArgs: CallbackArgs\n ): ReturnType<Callback> {\n return callback(...callbackArgs);\n },\n };\n}\n\n/** @internal */\nlet instrumenterImplementation: Instrumenter | undefined;\n\n/**\n * Extends the SDK with support for a given instrumenter implementation.\n *\n * @param instrumenter - The instrumenter implementation to use.\n */\nexport function useInstrumenter(instrumenter: Instrumenter): void {\n instrumenterImplementation = instrumenter;\n}\n\n/**\n * Gets the currently set instrumenter, a No-Op instrumenter by default.\n *\n * @returns The currently set instrumenter\n */\nexport function getInstrumenter(): Instrumenter {\n if (!instrumenterImplementation) {\n instrumenterImplementation = createDefaultInstrumenter();\n }\n return instrumenterImplementation;\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  // Copyright (c) Microsoft Corporation.
3
- // Licensed under the MIT license.
3
+ // Licensed under the MIT License.
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  //# sourceMappingURL=interfaces.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/tracing/interfaces.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * A narrower version of TypeScript 4.5's Awaited type which Recursively\n * unwraps the \"awaited type\", emulating the behavior of `await`.\n */\nexport type Resolved<T> = T extends { then(onfulfilled: infer F): any } // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped\n ? F extends (value: infer V) => any // if the argument to `then` is callable, extracts the first argument\n ? Resolved<V> // recursively unwrap the value\n : never // the argument to `then` was not callable\n : T; // non-object or non-thenable\n\n/**\n * Represents a client that can integrate with the currently configured {@link Instrumenter}.\n *\n * Create an instance using {@link createTracingClient}.\n */\nexport interface TracingClient {\n /**\n * Wraps a callback in a tracing span, calls the callback, and closes the span.\n *\n * This is the primary interface for using Tracing and will handle error recording as well as setting the status on the span.\n *\n * Both synchronous and asynchronous functions will be awaited in order to reflect the result of the callback on the span.\n *\n * Example:\n *\n * ```ts\n * const myOperationResult = await tracingClient.withSpan(\"myClassName.myOperationName\", options, (updatedOptions) => myOperation(updatedOptions));\n * ```\n * @param name - The name of the span. By convention this should be `${className}.${methodName}`.\n * @param operationOptions - The original options passed to the method. The callback will receive these options with the newly created {@link TracingContext}.\n * @param callback - The callback to be invoked with the updated options and newly created {@link TracingSpan}.\n */\n withSpan<\n Options extends { tracingOptions?: OperationTracingOptions },\n Callback extends (\n updatedOptions: Options,\n span: Omit<TracingSpan, \"end\">,\n ) => ReturnType<Callback>,\n >(\n name: string,\n operationOptions: Options,\n callback: Callback,\n spanOptions?: TracingSpanOptions,\n ): Promise<Resolved<ReturnType<Callback>>>;\n /**\n * Starts a given span but does not set it as the active span.\n *\n * You must end the span using {@link TracingSpan.end}.\n *\n * Most of the time you will want to use {@link withSpan} instead.\n *\n * @param name - The name of the span. By convention this should be `${className}.${methodName}`.\n * @param operationOptions - The original operation options.\n * @param spanOptions - The options to use when creating the span.\n *\n * @returns A {@link TracingSpan} and the updated operation options.\n */\n startSpan<Options extends { tracingOptions?: OperationTracingOptions }>(\n name: string,\n operationOptions?: Options,\n spanOptions?: TracingSpanOptions,\n ): {\n span: TracingSpan;\n updatedOptions: OptionsWithTracingContext<Options>;\n };\n /**\n * Wraps a callback with an active context and calls the callback.\n * Depending on the implementation, this may set the globally available active context.\n *\n * Useful when you want to leave the boundaries of the SDK (make a request or callback to user code) and are unable to use the {@link withSpan} API.\n *\n * @param context - The {@link TracingContext} to use as the active context in the scope of the callback.\n * @param callback - The callback to be invoked with the given context set as the globally active context.\n * @param callbackArgs - The callback arguments.\n */\n withContext<\n CallbackArgs extends unknown[],\n Callback extends (...args: CallbackArgs) => ReturnType<Callback>,\n >(\n context: TracingContext,\n callback: Callback,\n ...callbackArgs: CallbackArgs\n ): ReturnType<Callback>;\n\n /**\n * Parses a traceparent header value into a {@link TracingSpanContext}.\n *\n * @param traceparentHeader - The traceparent header to parse.\n * @returns An implementation-specific identifier for the span.\n */\n parseTraceparentHeader(traceparentHeader: string): TracingContext | undefined;\n\n /**\n * Creates a set of request headers to propagate tracing information to a backend.\n *\n * @param tracingContext - The context containing the span to propagate.\n * @returns The set of headers to add to a request.\n */\n createRequestHeaders(tracingContext?: TracingContext): Record<string, string>;\n}\n\n/**\n * Options that can be passed to {@link createTracingClient}\n */\nexport interface TracingClientOptions {\n /** The value of the az.namespace tracing attribute on newly created spans. */\n namespace: string;\n /** The name of the package invoking this trace. */\n packageName: string;\n /** An optional version of the package invoking this trace. */\n packageVersion?: string;\n}\n\n/** The kind of span. */\nexport type TracingSpanKind = \"client\" | \"server\" | \"producer\" | \"consumer\" | \"internal\";\n\n/** Options used to configure the newly created span. */\nexport interface TracingSpanOptions {\n /** The kind of span. Implementations should default this to \"client\". */\n spanKind?: TracingSpanKind;\n /** A collection of {@link TracingSpanLink} to link to this span. */\n spanLinks?: TracingSpanLink[];\n /** Initial set of attributes to set on a span. */\n spanAttributes?: { [key: string]: unknown };\n}\n\n/** A pointer from the current {@link TracingSpan} to another span in the same or a different trace. */\nexport interface TracingSpanLink {\n /** The {@link TracingContext} containing the span context to link to. */\n tracingContext: TracingContext;\n /** A set of attributes on the link. */\n attributes?: { [key: string]: unknown };\n}\n\n/**\n * Represents an implementation agnostic instrumenter.\n */\nexport interface Instrumenter {\n /**\n * Creates a new {@link TracingSpan} with the given name and options and sets it on a new context.\n * @param name - The name of the span. By convention this should be `${className}.${methodName}`.\n * @param spanOptions - The options to use when creating the span.\n *\n * @returns A {@link TracingSpan} that can be used to end the span, and the context this span has been set on.\n */\n startSpan(\n name: string,\n spanOptions: InstrumenterSpanOptions,\n ): { span: TracingSpan; tracingContext: TracingContext };\n /**\n * Wraps a callback with an active context and calls the callback.\n * Depending on the implementation, this may set the globally available active context.\n *\n * @param context - The {@link TracingContext} to use as the active context in the scope of the callback.\n * @param callback - The callback to be invoked with the given context set as the globally active context.\n * @param callbackArgs - The callback arguments.\n */\n withContext<\n CallbackArgs extends unknown[],\n Callback extends (...args: CallbackArgs) => ReturnType<Callback>,\n >(\n context: TracingContext,\n callback: Callback,\n ...callbackArgs: CallbackArgs\n ): ReturnType<Callback>;\n\n /**\n * Provides an implementation-specific method to parse a {@link https://www.w3.org/TR/trace-context/#traceparent-header}\n * into a {@link TracingSpanContext} which can be used to link non-parented spans together.\n */\n parseTraceparentHeader(traceparentHeader: string): TracingContext | undefined;\n /**\n * Provides an implementation-specific method to serialize a {@link TracingSpan} to a set of headers.\n * @param tracingContext - The context containing the span to serialize.\n */\n createRequestHeaders(tracingContext?: TracingContext): Record<string, string>;\n}\n\n/**\n * Options passed to {@link Instrumenter.startSpan} as a superset of {@link TracingSpanOptions}.\n */\nexport interface InstrumenterSpanOptions extends TracingSpanOptions {\n /** The name of the package invoking this trace. */\n packageName: string;\n /** The version of the package invoking this trace. */\n packageVersion?: string;\n /** The current tracing context. Defaults to an implementation-specific \"active\" context. */\n tracingContext?: TracingContext;\n}\n\n/**\n * Status representing a successful operation that can be sent to {@link TracingSpan.setStatus}\n */\nexport type SpanStatusSuccess = { status: \"success\" };\n\n/**\n * Status representing an error that can be sent to {@link TracingSpan.setStatus}\n */\nexport type SpanStatusError = { status: \"error\"; error?: Error | string };\n\n/**\n * Represents the statuses that can be passed to {@link TracingSpan.setStatus}.\n *\n * By default, all spans will be created with status \"unset\".\n */\nexport type SpanStatus = SpanStatusSuccess | SpanStatusError;\n\n/**\n * Represents an implementation agnostic tracing span.\n */\nexport interface TracingSpan {\n /**\n * Sets the status of the span. When an error is provided, it will be recorded on the span as well.\n *\n * @param status - The {@link SpanStatus} to set on the span.\n */\n setStatus(status: SpanStatus): void;\n\n /**\n * Sets a given attribute on a span.\n *\n * @param name - The attribute's name.\n * @param value - The attribute's value to set. May be any non-nullish value.\n */\n setAttribute(name: string, value: unknown): void;\n\n /**\n * Ends the span.\n */\n end(): void;\n\n /**\n * Records an exception on a {@link TracingSpan} without modifying its status.\n *\n * When recording an unhandled exception that should fail the span, please use {@link TracingSpan.setStatus} instead.\n *\n * @param exception - The exception to record on the span.\n *\n */\n recordException(exception: Error | string): void;\n\n /**\n * Returns true if this {@link TracingSpan} is recording information.\n *\n * Depending on the span implementation, this may return false if the span is not being sampled.\n */\n isRecording(): boolean;\n}\n\n/** An immutable context bag of tracing values for the current operation. */\nexport interface TracingContext {\n /**\n * Sets a given object on a context.\n * @param key - The key of the given context value.\n * @param value - The value to set on the context.\n *\n * @returns - A new context with the given value set.\n */\n setValue(key: symbol, value: unknown): TracingContext;\n /**\n * Gets an object from the context if it exists.\n * @param key - The key of the given context value.\n *\n * @returns - The value of the given context value if it exists, otherwise `undefined`.\n */\n getValue(key: symbol): unknown;\n /**\n * Deletes an object from the context if it exists.\n * @param key - The key of the given context value to delete.\n */\n deleteValue(key: symbol): TracingContext;\n}\n\n/**\n * Tracing options to set on an operation.\n */\nexport interface OperationTracingOptions {\n /** The context to use for created Tracing Spans. */\n tracingContext?: TracingContext;\n}\n\n/**\n * A utility type for when we know a TracingContext has been set\n * as part of an operation's options.\n */\nexport type OptionsWithTracingContext<\n Options extends { tracingOptions?: OperationTracingOptions },\n> = Options & {\n tracingOptions: {\n tracingContext: TracingContext;\n };\n};\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/tracing/interfaces.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * A narrower version of TypeScript 4.5's Awaited type which Recursively\n * unwraps the \"awaited type\", emulating the behavior of `await`.\n */\nexport type Resolved<T> = T extends { then(onfulfilled: infer F): any } // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped\n ? F extends (value: infer V) => any // if the argument to `then` is callable, extracts the first argument\n ? Resolved<V> // recursively unwrap the value\n : never // the argument to `then` was not callable\n : T; // non-object or non-thenable\n\n/**\n * Represents a client that can integrate with the currently configured {@link Instrumenter}.\n *\n * Create an instance using {@link createTracingClient}.\n */\nexport interface TracingClient {\n /**\n * Wraps a callback in a tracing span, calls the callback, and closes the span.\n *\n * This is the primary interface for using Tracing and will handle error recording as well as setting the status on the span.\n *\n * Both synchronous and asynchronous functions will be awaited in order to reflect the result of the callback on the span.\n *\n * Example:\n *\n * ```ts\n * const myOperationResult = await tracingClient.withSpan(\"myClassName.myOperationName\", options, (updatedOptions) => myOperation(updatedOptions));\n * ```\n * @param name - The name of the span. By convention this should be `${className}.${methodName}`.\n * @param operationOptions - The original options passed to the method. The callback will receive these options with the newly created {@link TracingContext}.\n * @param callback - The callback to be invoked with the updated options and newly created {@link TracingSpan}.\n */\n withSpan<\n Options extends { tracingOptions?: OperationTracingOptions },\n Callback extends (\n updatedOptions: Options,\n span: Omit<TracingSpan, \"end\">,\n ) => ReturnType<Callback>,\n >(\n name: string,\n operationOptions: Options,\n callback: Callback,\n spanOptions?: TracingSpanOptions,\n ): Promise<Resolved<ReturnType<Callback>>>;\n /**\n * Starts a given span but does not set it as the active span.\n *\n * You must end the span using {@link TracingSpan.end}.\n *\n * Most of the time you will want to use {@link withSpan} instead.\n *\n * @param name - The name of the span. By convention this should be `${className}.${methodName}`.\n * @param operationOptions - The original operation options.\n * @param spanOptions - The options to use when creating the span.\n *\n * @returns A {@link TracingSpan} and the updated operation options.\n */\n startSpan<Options extends { tracingOptions?: OperationTracingOptions }>(\n name: string,\n operationOptions?: Options,\n spanOptions?: TracingSpanOptions,\n ): {\n span: TracingSpan;\n updatedOptions: OptionsWithTracingContext<Options>;\n };\n /**\n * Wraps a callback with an active context and calls the callback.\n * Depending on the implementation, this may set the globally available active context.\n *\n * Useful when you want to leave the boundaries of the SDK (make a request or callback to user code) and are unable to use the {@link withSpan} API.\n *\n * @param context - The {@link TracingContext} to use as the active context in the scope of the callback.\n * @param callback - The callback to be invoked with the given context set as the globally active context.\n * @param callbackArgs - The callback arguments.\n */\n withContext<\n CallbackArgs extends unknown[],\n Callback extends (...args: CallbackArgs) => ReturnType<Callback>,\n >(\n context: TracingContext,\n callback: Callback,\n ...callbackArgs: CallbackArgs\n ): ReturnType<Callback>;\n\n /**\n * Parses a traceparent header value into a {@link TracingSpanContext}.\n *\n * @param traceparentHeader - The traceparent header to parse.\n * @returns An implementation-specific identifier for the span.\n */\n parseTraceparentHeader(traceparentHeader: string): TracingContext | undefined;\n\n /**\n * Creates a set of request headers to propagate tracing information to a backend.\n *\n * @param tracingContext - The context containing the span to propagate.\n * @returns The set of headers to add to a request.\n */\n createRequestHeaders(tracingContext?: TracingContext): Record<string, string>;\n}\n\n/**\n * Options that can be passed to {@link createTracingClient}\n */\nexport interface TracingClientOptions {\n /** The value of the az.namespace tracing attribute on newly created spans. */\n namespace: string;\n /** The name of the package invoking this trace. */\n packageName: string;\n /** An optional version of the package invoking this trace. */\n packageVersion?: string;\n}\n\n/** The kind of span. */\nexport type TracingSpanKind = \"client\" | \"server\" | \"producer\" | \"consumer\" | \"internal\";\n\n/** Options used to configure the newly created span. */\nexport interface TracingSpanOptions {\n /** The kind of span. Implementations should default this to \"client\". */\n spanKind?: TracingSpanKind;\n /** A collection of {@link TracingSpanLink} to link to this span. */\n spanLinks?: TracingSpanLink[];\n /** Initial set of attributes to set on a span. */\n spanAttributes?: { [key: string]: unknown };\n}\n\n/** A pointer from the current {@link TracingSpan} to another span in the same or a different trace. */\nexport interface TracingSpanLink {\n /** The {@link TracingContext} containing the span context to link to. */\n tracingContext: TracingContext;\n /** A set of attributes on the link. */\n attributes?: { [key: string]: unknown };\n}\n\n/**\n * Represents an implementation agnostic instrumenter.\n */\nexport interface Instrumenter {\n /**\n * Creates a new {@link TracingSpan} with the given name and options and sets it on a new context.\n * @param name - The name of the span. By convention this should be `${className}.${methodName}`.\n * @param spanOptions - The options to use when creating the span.\n *\n * @returns A {@link TracingSpan} that can be used to end the span, and the context this span has been set on.\n */\n startSpan(\n name: string,\n spanOptions: InstrumenterSpanOptions,\n ): { span: TracingSpan; tracingContext: TracingContext };\n /**\n * Wraps a callback with an active context and calls the callback.\n * Depending on the implementation, this may set the globally available active context.\n *\n * @param context - The {@link TracingContext} to use as the active context in the scope of the callback.\n * @param callback - The callback to be invoked with the given context set as the globally active context.\n * @param callbackArgs - The callback arguments.\n */\n withContext<\n CallbackArgs extends unknown[],\n Callback extends (...args: CallbackArgs) => ReturnType<Callback>,\n >(\n context: TracingContext,\n callback: Callback,\n ...callbackArgs: CallbackArgs\n ): ReturnType<Callback>;\n\n /**\n * Provides an implementation-specific method to parse a {@link https://www.w3.org/TR/trace-context/#traceparent-header}\n * into a {@link TracingSpanContext} which can be used to link non-parented spans together.\n */\n parseTraceparentHeader(traceparentHeader: string): TracingContext | undefined;\n /**\n * Provides an implementation-specific method to serialize a {@link TracingSpan} to a set of headers.\n * @param tracingContext - The context containing the span to serialize.\n */\n createRequestHeaders(tracingContext?: TracingContext): Record<string, string>;\n}\n\n/**\n * Options passed to {@link Instrumenter.startSpan} as a superset of {@link TracingSpanOptions}.\n */\nexport interface InstrumenterSpanOptions extends TracingSpanOptions {\n /** The name of the package invoking this trace. */\n packageName: string;\n /** The version of the package invoking this trace. */\n packageVersion?: string;\n /** The current tracing context. Defaults to an implementation-specific \"active\" context. */\n tracingContext?: TracingContext;\n}\n\n/**\n * Status representing a successful operation that can be sent to {@link TracingSpan.setStatus}\n */\nexport type SpanStatusSuccess = { status: \"success\" };\n\n/**\n * Status representing an error that can be sent to {@link TracingSpan.setStatus}\n */\nexport type SpanStatusError = { status: \"error\"; error?: Error | string };\n\n/**\n * Represents the statuses that can be passed to {@link TracingSpan.setStatus}.\n *\n * By default, all spans will be created with status \"unset\".\n */\nexport type SpanStatus = SpanStatusSuccess | SpanStatusError;\n\n/**\n * Represents an implementation agnostic tracing span.\n */\nexport interface TracingSpan {\n /**\n * Sets the status of the span. When an error is provided, it will be recorded on the span as well.\n *\n * @param status - The {@link SpanStatus} to set on the span.\n */\n setStatus(status: SpanStatus): void;\n\n /**\n * Sets a given attribute on a span.\n *\n * @param name - The attribute's name.\n * @param value - The attribute's value to set. May be any non-nullish value.\n */\n setAttribute(name: string, value: unknown): void;\n\n /**\n * Ends the span.\n */\n end(): void;\n\n /**\n * Records an exception on a {@link TracingSpan} without modifying its status.\n *\n * When recording an unhandled exception that should fail the span, please use {@link TracingSpan.setStatus} instead.\n *\n * @param exception - The exception to record on the span.\n *\n */\n recordException(exception: Error | string): void;\n\n /**\n * Returns true if this {@link TracingSpan} is recording information.\n *\n * Depending on the span implementation, this may return false if the span is not being sampled.\n */\n isRecording(): boolean;\n}\n\n/** An immutable context bag of tracing values for the current operation. */\nexport interface TracingContext {\n /**\n * Sets a given object on a context.\n * @param key - The key of the given context value.\n * @param value - The value to set on the context.\n *\n * @returns - A new context with the given value set.\n */\n setValue(key: symbol, value: unknown): TracingContext;\n /**\n * Gets an object from the context if it exists.\n * @param key - The key of the given context value.\n *\n * @returns - The value of the given context value if it exists, otherwise `undefined`.\n */\n getValue(key: symbol): unknown;\n /**\n * Deletes an object from the context if it exists.\n * @param key - The key of the given context value to delete.\n */\n deleteValue(key: symbol): TracingContext;\n}\n\n/**\n * Tracing options to set on an operation.\n */\nexport interface OperationTracingOptions {\n /** The context to use for created Tracing Spans. */\n tracingContext?: TracingContext;\n}\n\n/**\n * A utility type for when we know a TracingContext has been set\n * as part of an operation's options.\n */\nexport type OptionsWithTracingContext<\n Options extends { tracingOptions?: OperationTracingOptions },\n> = Options & {\n tracingOptions: {\n tracingContext: TracingContext;\n };\n};\n"]}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  // Copyright (c) Microsoft Corporation.
3
- // Licensed under the MIT license.
3
+ // Licensed under the MIT License.
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.createTracingClient = createTracingClient;
6
6
  const instrumenter_js_1 = require("./instrumenter.js");
@@ -1 +1 @@
1
- {"version":3,"file":"tracingClient.js","sourceRoot":"","sources":["../../../src/tracing/tracingClient.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAqBlC,kDAkGC;AA3GD,uDAAoD;AACpD,2DAAuD;AAEvD;;;;;GAKG;AACH,SAAgB,mBAAmB,CAAC,OAA6B;IAC/D,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC;IAE3D,SAAS,SAAS,CAChB,IAAY,EACZ,gBAA0B,EAC1B,WAAgC;;QAKhC,MAAM,eAAe,GAAG,IAAA,iCAAe,GAAE,CAAC,SAAS,CAAC,IAAI,kCACnD,WAAW,KACd,WAAW,EAAE,WAAW,EACxB,cAAc,EAAE,cAAc,EAC9B,cAAc,EAAE,MAAA,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,cAAc,0CAAE,cAAc,IAChE,CAAC;QACH,IAAI,cAAc,GAAG,eAAe,CAAC,cAAc,CAAC;QACpD,MAAM,IAAI,GAAG,eAAe,CAAC,IAAI,CAAC;QAClC,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,oCAAgB,CAAC,SAAS,CAAC,EAAE,CAAC;YACzD,cAAc,GAAG,cAAc,CAAC,QAAQ,CAAC,oCAAgB,CAAC,SAAS,EAAE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EAAE,GAAG,YAAY,CAAC,CAAC;IAC3E,CAAC;IAED;;;;;OAKG;IACH,SAAS,sBAAsB,CAAC,iBAAyB;QACvD,OAAO,IAAA,iCAAe,GAAE,CAAC,sBAAsB,CAAC,iBAAiB,CAAC,CAAC;IACrE,CAAC;IAED;;;;;OAKG;IACH,SAAS,oBAAoB,CAAC,cAA+B;QAC3D,OAAO,IAAA,iCAAe,GAAE,CAAC,oBAAoB,CAAC,cAAc,CAAC,CAAC;IAChE,CAAC;IAED,OAAO;QACL,SAAS;QACT,QAAQ;QACR,WAAW;QACX,sBAAsB;QACtB,oBAAoB;KACrB,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n OperationTracingOptions,\n OptionsWithTracingContext,\n Resolved,\n TracingClient,\n TracingClientOptions,\n TracingContext,\n TracingSpan,\n TracingSpanOptions,\n} from \"./interfaces.js\";\nimport { getInstrumenter } from \"./instrumenter.js\";\nimport { knownContextKeys } from \"./tracingContext.js\";\n\n/**\n * Creates a new tracing client.\n *\n * @param options - Options used to configure the tracing client.\n * @returns - An instance of {@link TracingClient}.\n */\nexport function createTracingClient(options: TracingClientOptions): TracingClient {\n const { namespace, packageName, packageVersion } = options;\n\n function startSpan<Options extends { tracingOptions?: OperationTracingOptions }>(\n name: string,\n operationOptions?: Options,\n spanOptions?: TracingSpanOptions,\n ): {\n span: TracingSpan;\n updatedOptions: OptionsWithTracingContext<Options>;\n } {\n const startSpanResult = getInstrumenter().startSpan(name, {\n ...spanOptions,\n packageName: packageName,\n packageVersion: packageVersion,\n tracingContext: operationOptions?.tracingOptions?.tracingContext,\n });\n let tracingContext = startSpanResult.tracingContext;\n const span = startSpanResult.span;\n if (!tracingContext.getValue(knownContextKeys.namespace)) {\n tracingContext = tracingContext.setValue(knownContextKeys.namespace, namespace);\n }\n span.setAttribute(\"az.namespace\", tracingContext.getValue(knownContextKeys.namespace));\n const updatedOptions: OptionsWithTracingContext<Options> = Object.assign({}, operationOptions, {\n tracingOptions: { ...operationOptions?.tracingOptions, tracingContext },\n });\n\n return {\n span,\n updatedOptions,\n };\n }\n\n async function withSpan<\n Options extends { tracingOptions?: OperationTracingOptions },\n Callback extends (\n updatedOptions: Options,\n span: Omit<TracingSpan, \"end\">,\n ) => ReturnType<Callback>,\n >(\n name: string,\n operationOptions: Options,\n callback: Callback,\n spanOptions?: TracingSpanOptions,\n ): Promise<Resolved<ReturnType<Callback>>> {\n const { span, updatedOptions } = startSpan(name, operationOptions, spanOptions);\n try {\n const result = await withContext(updatedOptions.tracingOptions.tracingContext, () =>\n Promise.resolve(callback(updatedOptions, span)),\n );\n span.setStatus({ status: \"success\" });\n return result as ReturnType<typeof withSpan>;\n } catch (err: any) {\n span.setStatus({ status: \"error\", error: err });\n throw err;\n } finally {\n span.end();\n }\n }\n\n function withContext<\n CallbackArgs extends unknown[],\n Callback extends (...args: CallbackArgs) => ReturnType<Callback>,\n >(\n context: TracingContext,\n callback: Callback,\n ...callbackArgs: CallbackArgs\n ): ReturnType<Callback> {\n return getInstrumenter().withContext(context, callback, ...callbackArgs);\n }\n\n /**\n * Parses a traceparent header value into a span identifier.\n *\n * @param traceparentHeader - The traceparent header to parse.\n * @returns An implementation-specific identifier for the span.\n */\n function parseTraceparentHeader(traceparentHeader: string): TracingContext | undefined {\n return getInstrumenter().parseTraceparentHeader(traceparentHeader);\n }\n\n /**\n * Creates a set of request headers to propagate tracing information to a backend.\n *\n * @param tracingContext - The context containing the span to serialize.\n * @returns The set of headers to add to a request.\n */\n function createRequestHeaders(tracingContext?: TracingContext): Record<string, string> {\n return getInstrumenter().createRequestHeaders(tracingContext);\n }\n\n return {\n startSpan,\n withSpan,\n withContext,\n parseTraceparentHeader,\n createRequestHeaders,\n };\n}\n"]}
1
+ {"version":3,"file":"tracingClient.js","sourceRoot":"","sources":["../../../src/tracing/tracingClient.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAqBlC,kDAkGC;A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EAAE,WAAW,CAAC,CAAC;QAChF,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,cAAc,CAAC,cAAc,CAAC,cAAc,EAAE,GAAG,EAAE,CAClF,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC,CAChD,CAAC;YACF,IAAI,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;YACtC,OAAO,MAAqC,CAAC;QAC/C,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAClB,IAAI,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;YAChD,MAAM,GAAG,CAAC;QACZ,CAAC;gBAAS,CAAC;YACT,IAAI,CAAC,GAAG,EAAE,CAAC;QACb,CAAC;IACH,CAAC;IAED,SAAS,WAAW,CAIlB,OAAuB,EACvB,QAAkB,EAClB,GAAG,YAA0B;QAE7B,OAAO,IAAA,iCAAe,GAAE,CAAC,WAAW,CAAC,OAAO,EAAE,QAAQ,EAAE,GAAG,YAAY,CAAC,CAAC;IAC3E,CAAC;IAED;;;;;OAKG;IACH,SAAS,sBAAsB,CAAC,iBAAyB;QACvD,OAAO,IAAA,iCAAe,GAAE,CAAC,sBAAsB,CAAC,iBAAiB,CAAC,CAAC;IACrE,CAAC;IAED;;;;;OAKG;IACH,SAAS,oBAAoB,CAAC,cAA+B;QAC3D,OAAO,IAAA,iCAAe,GAAE,CAAC,oBAAoB,CAAC,cAAc,CAAC,CAAC;IAChE,CAAC;IAED,OAAO;QACL,SAAS;QACT,QAAQ;QACR,WAAW;QACX,sBAAsB;QACtB,oBAAoB;KACrB,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n OperationTracingOptions,\n OptionsWithTracingContext,\n Resolved,\n TracingClient,\n TracingClientOptions,\n TracingContext,\n TracingSpan,\n TracingSpanOptions,\n} from \"./interfaces.js\";\nimport { getInstrumenter } from \"./instrumenter.js\";\nimport { knownContextKeys } from \"./tracingContext.js\";\n\n/**\n * Creates a new tracing client.\n *\n * @param options - Options used to configure the tracing client.\n * @returns - An instance of {@link TracingClient}.\n */\nexport function createTracingClient(options: TracingClientOptions): TracingClient {\n const { namespace, packageName, packageVersion } = options;\n\n function startSpan<Options extends { tracingOptions?: OperationTracingOptions }>(\n name: string,\n operationOptions?: Options,\n spanOptions?: TracingSpanOptions,\n ): {\n span: TracingSpan;\n updatedOptions: OptionsWithTracingContext<Options>;\n } {\n const startSpanResult = getInstrumenter().startSpan(name, {\n ...spanOptions,\n packageName: packageName,\n packageVersion: packageVersion,\n tracingContext: operationOptions?.tracingOptions?.tracingContext,\n });\n let tracingContext = startSpanResult.tracingContext;\n const span = startSpanResult.span;\n if (!tracingContext.getValue(knownContextKeys.namespace)) {\n tracingContext = tracingContext.setValue(knownContextKeys.namespace, namespace);\n }\n span.setAttribute(\"az.namespace\", tracingContext.getValue(knownContextKeys.namespace));\n const updatedOptions: OptionsWithTracingContext<Options> = Object.assign({}, operationOptions, {\n tracingOptions: { ...operationOptions?.tracingOptions, tracingContext },\n });\n\n return {\n span,\n updatedOptions,\n };\n }\n\n async function withSpan<\n Options extends { tracingOptions?: OperationTracingOptions },\n Callback extends (\n updatedOptions: Options,\n span: Omit<TracingSpan, \"end\">,\n ) => ReturnType<Callback>,\n >(\n name: string,\n operationOptions: Options,\n callback: Callback,\n spanOptions?: TracingSpanOptions,\n ): Promise<Resolved<ReturnType<Callback>>> {\n const { span, updatedOptions } = startSpan(name, operationOptions, spanOptions);\n try {\n const result = await withContext(updatedOptions.tracingOptions.tracingContext, () =>\n Promise.resolve(callback(updatedOptions, span)),\n );\n span.setStatus({ status: \"success\" });\n return result as ReturnType<typeof withSpan>;\n } catch (err: any) {\n span.setStatus({ status: \"error\", error: err });\n throw err;\n } finally {\n span.end();\n }\n }\n\n function withContext<\n CallbackArgs extends unknown[],\n Callback extends (...args: CallbackArgs) => ReturnType<Callback>,\n >(\n context: TracingContext,\n callback: Callback,\n ...callbackArgs: CallbackArgs\n ): ReturnType<Callback> {\n return getInstrumenter().withContext(context, callback, ...callbackArgs);\n }\n\n /**\n * Parses a traceparent header value into a span identifier.\n *\n * @param traceparentHeader - The traceparent header to parse.\n * @returns An implementation-specific identifier for the span.\n */\n function parseTraceparentHeader(traceparentHeader: string): TracingContext | undefined {\n return getInstrumenter().parseTraceparentHeader(traceparentHeader);\n }\n\n /**\n * Creates a set of request headers to propagate tracing information to a backend.\n *\n * @param tracingContext - The context containing the span to serialize.\n * @returns The set of headers to add to a request.\n */\n function createRequestHeaders(tracingContext?: TracingContext): Record<string, string> {\n return getInstrumenter().createRequestHeaders(tracingContext);\n }\n\n return {\n startSpan,\n withSpan,\n withContext,\n parseTraceparentHeader,\n createRequestHeaders,\n };\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  // Copyright (c) Microsoft Corporation.
3
- // Licensed under the MIT license.
3
+ // Licensed under the MIT License.
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.TracingContextImpl = exports.knownContextKeys = void 0;
6
6
  exports.createTracingContext = createTracingContext;
@@ -1 +1 @@
1
- {"version":3,"file":"tracingContext.js","sourceRoot":"","sources":["../../../src/tracing/tracingContext.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAiBlC,oDASC;AAtBD,gBAAgB;AACH,QAAA,gBAAgB,GAAG;IAC9B,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,gCAAgC,CAAC;IAClD,SAAS,EAAE,MAAM,CAAC,GAAG,CAAC,qCAAqC,CAAC;CAC7D,CAAC;AAEF;;;;;;GAMG;AACH,SAAgB,oBAAoB,CAAC,UAAuC,EAAE;IAC5E,IAAI,OAAO,GAAmB,IAAI,kBAAkB,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;IAC5E,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QACjB,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,wBAAgB,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAClE,CAAC;IACD,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;QACtB,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,wBAAgB,CAAC,SAAS,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IAC5E,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,gBAAgB;AAChB,MAAa,kBAAkB;IAE7B,YAAY,cAA+B;QACzC,IAAI,CAAC,WAAW;YACd,cAAc,YAAY,kBAAkB;gBAC1C,CAAC,CAAC,IAAI,GAAG,CAAkB,cAAc,CAAC,WAAW,CAAC;gBACtD,CAAC,CAAC,IAAI,GAAG,EAAE,CAAC;IAClB,CAAC;IAED,QAAQ,CAAC,GAAW,EAAE,KAAc;QAClC,MAAM,UAAU,GAAG,IAAI,kBAAkB,CAAC,IAAI,CAAC,CAAC;QAChD,UAAU,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QACvC,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,QAAQ,CAAC,GAAW;QAClB,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACnC,CAAC;IAED,WAAW,CAAC,GAAW;QACrB,MAAM,UAAU,GAAG,IAAI,kBAAkB,CAAC,IAAI,CAAC,CAAC;QAChD,UAAU,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACnC,OAAO,UAAU,CAAC;IACpB,CAAC;CACF;AAxBD,gDAwBC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { TracingContext, TracingSpan } from \"./interfaces.js\";\n\n/** @internal */\nexport const knownContextKeys = {\n span: Symbol.for(\"@typespec/ts-http-runtime span\"),\n namespace: Symbol.for(\"@typespec/ts-http-runtime namespace\"),\n};\n\n/**\n * Creates a new {@link TracingContext} with the given options.\n * @param options - A set of known keys that may be set on the context.\n * @returns A new {@link TracingContext} with the given options.\n *\n * @internal\n */\nexport function createTracingContext(options: CreateTracingContextOptions = {}): TracingContext {\n let context: TracingContext = new TracingContextImpl(options.parentContext);\n if (options.span) {\n context = context.setValue(knownContextKeys.span, options.span);\n }\n if (options.namespace) {\n context = context.setValue(knownContextKeys.namespace, options.namespace);\n }\n return context;\n}\n\n/** @internal */\nexport class TracingContextImpl implements TracingContext {\n private _contextMap: Map<symbol, unknown>;\n constructor(initialContext?: TracingContext) {\n this._contextMap =\n initialContext instanceof TracingContextImpl\n ? new Map<symbol, unknown>(initialContext._contextMap)\n : new Map();\n }\n\n setValue(key: symbol, value: unknown): TracingContext {\n const newContext = new TracingContextImpl(this);\n newContext._contextMap.set(key, value);\n return newContext;\n }\n\n getValue(key: symbol): unknown {\n return this._contextMap.get(key);\n }\n\n deleteValue(key: symbol): TracingContext {\n const newContext = new TracingContextImpl(this);\n newContext._contextMap.delete(key);\n return newContext;\n }\n}\n\n/**\n * Represents a set of items that can be set when creating a new {@link TracingContext}.\n */\nexport interface CreateTracingContextOptions {\n /** The {@link parentContext} - the newly created context will contain all the values of the parent context unless overridden. */\n parentContext?: TracingContext;\n /** An initial span to set on the context. */\n span?: TracingSpan;\n /** The namespace to set on any child spans. */\n namespace?: string;\n}\n"]}
1
+ {"version":3,"file":"tracingContext.js","sourceRoot":"","sources":["../../../src/tracing/tracingContext.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAiBlC,oDASC;AAtBD,gBAAgB;AACH,QAAA,gBAAgB,GAAG;IAC9B,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,gCAAgC,CAAC;IAClD,SAAS,EAAE,MAAM,CAAC,GAAG,CAAC,qCAAqC,CAAC;CAC7D,CAAC;AAEF;;;;;;GAMG;AACH,SAAgB,oBAAoB,CAAC,UAAuC,EAAE;IAC5E,IAAI,OAAO,GAAmB,IAAI,kBAAkB,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;IAC5E,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QACjB,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,wBAAgB,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAClE,CAAC;IACD,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;QACtB,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,wBAAgB,CAAC,SAAS,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IAC5E,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,gBAAgB;AAChB,MAAa,kBAAkB;IAE7B,YAAY,cAA+B;QACzC,IAAI,CAAC,WAAW;YACd,cAAc,YAAY,kBAAkB;gBAC1C,CAAC,CAAC,IAAI,GAAG,CAAkB,cAAc,CAAC,WAAW,CAAC;gBACtD,CAAC,CAAC,IAAI,GAAG,EAAE,CAAC;IAClB,CAAC;IAED,QAAQ,CAAC,GAAW,EAAE,KAAc;QAClC,MAAM,UAAU,GAAG,IAAI,kBAAkB,CAAC,IAAI,CAAC,CAAC;QAChD,UAAU,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QACvC,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,QAAQ,CAAC,GAAW;QAClB,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACnC,CAAC;IAED,WAAW,CAAC,GAAW;QACrB,MAAM,UAAU,GAAG,IAAI,kBAAkB,CAAC,IAAI,CAAC,CAAC;QAChD,UAAU,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACnC,OAAO,UAAU,CAAC;IACpB,CAAC;CACF;AAxBD,gDAwBC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { TracingContext, TracingSpan } from \"./interfaces.js\";\n\n/** @internal */\nexport const knownContextKeys = {\n span: Symbol.for(\"@typespec/ts-http-runtime span\"),\n namespace: Symbol.for(\"@typespec/ts-http-runtime namespace\"),\n};\n\n/**\n * Creates a new {@link TracingContext} with the given options.\n * @param options - A set of known keys that may be set on the context.\n * @returns A new {@link TracingContext} with the given options.\n *\n * @internal\n */\nexport function createTracingContext(options: CreateTracingContextOptions = {}): TracingContext {\n let context: TracingContext = new TracingContextImpl(options.parentContext);\n if (options.span) {\n context = context.setValue(knownContextKeys.span, options.span);\n }\n if (options.namespace) {\n context = context.setValue(knownContextKeys.namespace, options.namespace);\n }\n return context;\n}\n\n/** @internal */\nexport class TracingContextImpl implements TracingContext {\n private _contextMap: Map<symbol, unknown>;\n constructor(initialContext?: TracingContext) {\n this._contextMap =\n initialContext instanceof TracingContextImpl\n ? new Map<symbol, unknown>(initialContext._contextMap)\n : new Map();\n }\n\n setValue(key: symbol, value: unknown): TracingContext {\n const newContext = new TracingContextImpl(this);\n newContext._contextMap.set(key, value);\n return newContext;\n }\n\n getValue(key: symbol): unknown {\n return this._contextMap.get(key);\n }\n\n deleteValue(key: symbol): TracingContext {\n const newContext = new TracingContextImpl(this);\n newContext._contextMap.delete(key);\n return newContext;\n }\n}\n\n/**\n * Represents a set of items that can be set when creating a new {@link TracingContext}.\n */\nexport interface CreateTracingContextOptions {\n /** The {@link parentContext} - the newly created context will contain all the values of the parent context unless overridden. */\n parentContext?: TracingContext;\n /** An initial span to set on the context. */\n span?: TracingSpan;\n /** The namespace to set on any child spans. */\n namespace?: string;\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  // Copyright (c) Microsoft Corporation.
3
- // Licensed under the MIT license.
3
+ // Licensed under the MIT License.
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.cancelablePromiseRace = cancelablePromiseRace;
6
6
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"aborterUtils.js","sourceRoot":"","sources":["../../../src/util/aborterUtils.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AA4BlC,sDAiBC;AApBD;;GAEG;AACI,KAAK,UAAU,qBAAqB,CACzC,wBAA8D,EAC9D,OAA2C;;IAE3C,MAAM,OAAO,GAAG,IAAI,eAAe,EAAE,CAAC;IACtC,SAAS,YAAY;QACnB,OAAO,CAAC,KAAK,EAAE,CAAC;IAClB,CAAC;IACD,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,0CAAE,gBAAgB,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IAC9D,IAAI,CAAC;QACH,OAAO,MAAM,OAAO,CAAC,IAAI,CACvB,wBAAwB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,CACxE,CAAC;IACJ,CAAC;YAAS,CAAC;QACT,OAAO,CAAC,KAAK,EAAE,CAAC;QAChB,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,0CAAE,mBAAmB,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IACnE,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AbortSignalLike } from \"../abort-controller/AbortSignalLike.js\";\n\n/**\n * Options related to abort controller.\n */\nexport interface AbortOptions {\n /**\n * The abortSignal associated with containing operation.\n */\n abortSignal?: AbortSignalLike;\n /**\n * The abort error message associated with containing operation.\n */\n abortErrorMsg?: string;\n}\n\n/**\n * Represents a function that returns a promise that can be aborted.\n */\nexport type AbortablePromiseBuilder<T> = (abortOptions: {\n abortSignal?: AbortSignalLike;\n}) => Promise<T>;\n\n/**\n * promise.race() wrapper that aborts rest of promises as soon as the first promise settles.\n */\nexport async function cancelablePromiseRace<T extends unknown[]>(\n abortablePromiseBuilders: AbortablePromiseBuilder<T[number]>[],\n options?: { abortSignal?: AbortSignalLike },\n): Promise<T[number]> {\n const aborter = new AbortController();\n function abortHandler(): void {\n aborter.abort();\n }\n options?.abortSignal?.addEventListener(\"abort\", abortHandler);\n try {\n return await Promise.race(\n abortablePromiseBuilders.map((p) => p({ abortSignal: aborter.signal })),\n );\n } finally {\n aborter.abort();\n options?.abortSignal?.removeEventListener(\"abort\", abortHandler);\n }\n}\n"]}
1
+ {"version":3,"file":"aborterUtils.js","sourceRoot":"","sources":["../../../src/util/aborterUtils.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AA4BlC,sDAiBC;AApBD;;GAEG;AACI,KAAK,UAAU,qBAAqB,CACzC,wBAA8D,EAC9D,OAA2C;;IAE3C,MAAM,OAAO,GAAG,IAAI,eAAe,EAAE,CAAC;IACtC,SAAS,YAAY;QACnB,OAAO,CAAC,KAAK,EAAE,CAAC;IAClB,CAAC;IACD,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,0CAAE,gBAAgB,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IAC9D,IAAI,CAAC;QACH,OAAO,MAAM,OAAO,CAAC,IAAI,CACvB,wBAAwB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,CACxE,CAAC;IACJ,CAAC;YAAS,CAAC;QACT,OAAO,CAAC,KAAK,EAAE,CAAC;QAChB,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,0CAAE,mBAAmB,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IACnE,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { AbortSignalLike } from \"../abort-controller/AbortSignalLike.js\";\n\n/**\n * Options related to abort controller.\n */\nexport interface AbortOptions {\n /**\n * The abortSignal associated with containing operation.\n */\n abortSignal?: AbortSignalLike;\n /**\n * The abort error message associated with containing operation.\n */\n abortErrorMsg?: string;\n}\n\n/**\n * Represents a function that returns a promise that can be aborted.\n */\nexport type AbortablePromiseBuilder<T> = (abortOptions: {\n abortSignal?: AbortSignalLike;\n}) => Promise<T>;\n\n/**\n * promise.race() wrapper that aborts rest of promises as soon as the first promise settles.\n */\nexport async function cancelablePromiseRace<T extends unknown[]>(\n abortablePromiseBuilders: AbortablePromiseBuilder<T[number]>[],\n options?: { abortSignal?: AbortSignalLike },\n): Promise<T[number]> {\n const aborter = new AbortController();\n function abortHandler(): void {\n aborter.abort();\n }\n options?.abortSignal?.addEventListener(\"abort\", abortHandler);\n try {\n return await Promise.race(\n abortablePromiseBuilders.map((p) => p({ abortSignal: aborter.signal })),\n );\n } finally {\n aborter.abort();\n options?.abortSignal?.removeEventListener(\"abort\", abortHandler);\n }\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  // Copyright (c) Microsoft Corporation.
3
- // Licensed under the MIT license.
3
+ // Licensed under the MIT License.
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.uint8ArrayToString = uint8ArrayToString;
6
6
  exports.stringToUint8Array = stringToUint8Array;
@@ -1 +1 @@
1
- {"version":3,"file":"bytesEncoding.common.js","sourceRoot":"","sources":["../../../src/util/bytesEncoding.common.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAiBlC,gDAWC;AAQD,gDAWC;AAMD,gDAEC;AAMD,sDAEC;AAMD,wDAIC;AAMD,sDAEC;AAMD,wDAEC;AAMD,gDAEC;AAMD,sDAGC;AAQD,sDAeC;AAtHD;;;;;GAKG;AACH,SAAgB,kBAAkB,CAAC,KAAiB,EAAE,MAAoB;IACxE,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,OAAO;YACV,OAAO,sBAAsB,CAAC,KAAK,CAAC,CAAC;QACvC,KAAK,QAAQ;YACX,OAAO,kBAAkB,CAAC,KAAK,CAAC,CAAC;QACnC,KAAK,WAAW;YACd,OAAO,qBAAqB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I,CAAC,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;YAC5D,oFAAoF;YACpF,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAC3B,CAAC;QAED,KAAK,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,GAAG,UAAU,GAAG,SAAS,EAAE,EAAE,EAAE,CAAC,CAAC;IACvD,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\ndeclare global {\n // stub these out for the browser\n function btoa(input: string): string;\n function atob(input: string): string;\n}\n\n/** The supported character encoding type */\nexport type EncodingType = \"utf-8\" | \"base64\" | \"base64url\" | \"hex\";\n\n/**\n * The helper that transforms bytes with specific character encoding into string\n * @param bytes - the uint8array bytes\n * @param format - the format we use to encode the byte\n * @returns a string of the encoded string\n */\nexport function uint8ArrayToString(bytes: Uint8Array, format: EncodingType): string {\n switch (format) {\n case \"utf-8\":\n return uint8ArrayToUtf8String(bytes);\n case \"base64\":\n return uint8ArrayToBase64(bytes);\n case \"base64url\":\n return uint8ArrayToBase64Url(bytes);\n case \"hex\":\n return uint8ArrayToHexString(bytes);\n }\n}\n\n/**\n * The helper that transforms string to specific character encoded bytes array.\n * @param value - the string to be converted\n * @param format - the format we use to decode the value\n * @returns a uint8array\n */\nexport function stringToUint8Array(value: string, format: EncodingType): Uint8Array {\n switch (format) {\n case \"utf-8\":\n return utf8StringToUint8Array(value);\n case \"base64\":\n return base64ToUint8Array(value);\n case \"base64url\":\n return base64UrlToUint8Array(value);\n case \"hex\":\n return hexStringToUint8Array(value);\n }\n}\n\n/**\n * Decodes a Uint8Array into a Base64 string.\n * @internal\n */\nexport function uint8ArrayToBase64(bytes: Uint8Array): string {\n return btoa([...bytes].map((x) => String.fromCharCode(x)).join(\"\"));\n}\n\n/**\n * Decodes a Uint8Array into a Base64Url string.\n * @internal\n */\nexport function uint8ArrayToBase64Url(bytes: Uint8Array): string {\n return uint8ArrayToBase64(bytes).replace(/\\+/g, \"-\").replace(/\\//g, \"_\").replace(/=/g, \"\");\n}\n\n/**\n * Decodes a Uint8Array into a javascript string.\n * @internal\n */\nexport function uint8ArrayToUtf8String(bytes: Uint8Array): string {\n const decoder = new TextDecoder();\n const dataString = decoder.decode(bytes);\n return dataString;\n}\n\n/**\n * Decodes a Uint8Array into a hex string\n * @internal\n */\nexport function uint8ArrayToHexString(bytes: Uint8Array): string {\n return [...bytes].map((x) => x.toString(16).padStart(2, \"0\")).join(\"\");\n}\n\n/**\n * Encodes a JavaScript string into a Uint8Array.\n * @internal\n */\nexport function utf8StringToUint8Array(value: string): Uint8Array {\n return new TextEncoder().encode(value);\n}\n\n/**\n * Encodes a Base64 string into a Uint8Array.\n * @internal\n */\nexport function base64ToUint8Array(value: string): Uint8Array {\n return new Uint8Array([...atob(value)].map((x) => x.charCodeAt(0)));\n}\n\n/**\n * Encodes a Base64Url string into a Uint8Array.\n * @internal\n */\nexport function base64UrlToUint8Array(value: string): Uint8Array {\n const base64String = value.replace(/-/g, \"+\").replace(/_/g, \"/\");\n return base64ToUint8Array(base64String);\n}\n\nconst hexDigits = new Set(\"0123456789abcdefABCDEF\");\n\n/**\n * Encodes a hex string into a Uint8Array\n * @internal\n */\nexport function hexStringToUint8Array(value: string): Uint8Array {\n // If value has odd length, the last character will be ignored, consistent with NodeJS Buffer behavior\n const bytes = new Uint8Array(value.length / 2);\n for (let i = 0; i < value.length / 2; ++i) {\n const highNibble = value[2 * i];\n const lowNibble = value[2 * i + 1];\n if (!hexDigits.has(highNibble) || !hexDigits.has(lowNibble)) {\n // Replicate Node Buffer behavior by exiting early when we encounter an invalid byte\n return bytes.slice(0, i);\n }\n\n bytes[i] = parseInt(`${highNibble}${lowNibble}`, 16);\n }\n\n return bytes;\n}\n"]}
1
+ {"version":3,"file":"bytesEncoding.common.js","sourceR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,SAAS,GAAG,IAAI,GAAG,CAAC,wBAAwB,CAAC,CAAC;AAEpD;;;GAGG;AACH,SAAgB,qBAAqB,CAAC,KAAa;IACjD,sGAAsG;IACtG,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAC/C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC;QAC1C,MAAM,UAAU,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QAChC,MAAM,SAAS,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;QACnC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;YAC5D,oFAAoF;YACpF,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAC3B,CAAC;QAED,KAAK,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,GAAG,UAAU,GAAG,SAAS,EAAE,EAAE,EAAE,CAAC,CAAC;IACvD,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\ndeclare global {\n // stub these out for the browser\n function btoa(input: string): string;\n function atob(input: string): string;\n}\n\n/** The supported character encoding type */\nexport type EncodingType = \"utf-8\" | \"base64\" | \"base64url\" | \"hex\";\n\n/**\n * The helper that transforms bytes with specific character encoding into string\n * @param bytes - the uint8array bytes\n * @param format - the format we use to encode the byte\n * @returns a string of the encoded string\n */\nexport function uint8ArrayToString(bytes: Uint8Array, format: EncodingType): string {\n switch (format) {\n case \"utf-8\":\n return uint8ArrayToUtf8String(bytes);\n case \"base64\":\n return uint8ArrayToBase64(bytes);\n case \"base64url\":\n return uint8ArrayToBase64Url(bytes);\n case \"hex\":\n return uint8ArrayToHexString(bytes);\n }\n}\n\n/**\n * The helper that transforms string to specific character encoded bytes array.\n * @param value - the string to be converted\n * @param format - the format we use to decode the value\n * @returns a uint8array\n */\nexport function stringToUint8Array(value: string, format: EncodingType): Uint8Array {\n switch (format) {\n case \"utf-8\":\n return utf8StringToUint8Array(value);\n case \"base64\":\n return base64ToUint8Array(value);\n case \"base64url\":\n return base64UrlToUint8Array(value);\n case \"hex\":\n return hexStringToUint8Array(value);\n }\n}\n\n/**\n * Decodes a Uint8Array into a Base64 string.\n * @internal\n */\nexport function uint8ArrayToBase64(bytes: Uint8Array): string {\n return btoa([...bytes].map((x) => String.fromCharCode(x)).join(\"\"));\n}\n\n/**\n * Decodes a Uint8Array into a Base64Url string.\n * @internal\n */\nexport function uint8ArrayToBase64Url(bytes: Uint8Array): string {\n return uint8ArrayToBase64(bytes).replace(/\\+/g, \"-\").replace(/\\//g, \"_\").replace(/=/g, \"\");\n}\n\n/**\n * Decodes a Uint8Array into a javascript string.\n * @internal\n */\nexport function uint8ArrayToUtf8String(bytes: Uint8Array): string {\n const decoder = new TextDecoder();\n const dataString = decoder.decode(bytes);\n return dataString;\n}\n\n/**\n * Decodes a Uint8Array into a hex string\n * @internal\n */\nexport function uint8ArrayToHexString(bytes: Uint8Array): string {\n return [...bytes].map((x) => x.toString(16).padStart(2, \"0\")).join(\"\");\n}\n\n/**\n * Encodes a JavaScript string into a Uint8Array.\n * @internal\n */\nexport function utf8StringToUint8Array(value: string): Uint8Array {\n return new TextEncoder().encode(value);\n}\n\n/**\n * Encodes a Base64 string into a Uint8Array.\n * @internal\n */\nexport function base64ToUint8Array(value: string): Uint8Array {\n return new Uint8Array([...atob(value)].map((x) => x.charCodeAt(0)));\n}\n\n/**\n * Encodes a Base64Url string into a Uint8Array.\n * @internal\n */\nexport function base64UrlToUint8Array(value: string): Uint8Array {\n const base64String = value.replace(/-/g, \"+\").replace(/_/g, \"/\");\n return base64ToUint8Array(base64String);\n}\n\nconst hexDigits = new Set(\"0123456789abcdefABCDEF\");\n\n/**\n * Encodes a hex string into a Uint8Array\n * @internal\n */\nexport function hexStringToUint8Array(value: string): Uint8Array {\n // If value has odd length, the last character will be ignored, consistent with NodeJS Buffer behavior\n const bytes = new Uint8Array(value.length / 2);\n for (let i = 0; i < value.length / 2; ++i) {\n const highNibble = value[2 * i];\n const lowNibble = value[2 * i + 1];\n if (!hexDigits.has(highNibble) || !hexDigits.has(lowNibble)) {\n // Replicate Node Buffer behavior by exiting early when we encounter an invalid byte\n return bytes.slice(0, i);\n }\n\n bytes[i] = parseInt(`${highNibble}${lowNibble}`, 16);\n }\n\n return bytes;\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  // Copyright (c) Microsoft Corporation.
3
- // Licensed under the MIT license.
3
+ // Licensed under the MIT License.
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.uint8ArrayToString = uint8ArrayToString;
6
6
  exports.stringToUint8Array = stringToUint8Array;
@@ -1 +1 @@
1
- {"version":3,"file":"bytesEncoding.js","sourceRoot":"","sources":["../../../src/util/bytesEncoding.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAWlC,gDAEC;AAQD,gDAEC;AAlBD;;;;;GAKG;AACH,SAAgB,kBAAkB,CAAC,KAAiB,EAAE,MAAoB;IACxE,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AAC7C,CAAC;AAED;;;;;GAKG;AACH,SAAgB,kBAAkB,CAAC,KAAa,EAAE,MAAoB;IACpE,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AACpC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/** The supported character encoding type */\nexport type EncodingType = \"utf-8\" | \"base64\" | \"base64url\" | \"hex\";\n\n/**\n * The helper that transforms bytes with specific character encoding into string\n * @param bytes - the uint8array bytes\n * @param format - the format we use to encode the byte\n * @returns a string of the encoded string\n */\nexport function uint8ArrayToString(bytes: Uint8Array, format: EncodingType): string {\n return Buffer.from(bytes).toString(format);\n}\n\n/**\n * The helper that transforms string to specific character encoded bytes array.\n * @param value - the string to be converted\n * @param format - the format we use to decode the value\n * @returns a uint8array\n */\nexport function stringToUint8Array(value: string, format: EncodingType): Uint8Array {\n return Buffer.from(value, format);\n}\n"]}
1
+ {"version":3,"file":"bytesEncoding.js","sourceRoot":"","sources":["../../../src/util/bytesEncoding.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAWlC,gDAEC;AAQD,gDAEC;AAlBD;;;;;GAKG;AACH,SAAgB,kBAAkB,CAAC,KAAiB,EAAE,MAAoB;IACxE,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AAC7C,CAAC;AAED;;;;;GAKG;AACH,SAAgB,kBAAkB,CAAC,KAAa,EAAE,MAAoB;IACpE,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AACpC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/** The supported character encoding type */\nexport type EncodingType = \"utf-8\" | \"base64\" | \"base64url\" | \"hex\";\n\n/**\n * The helper that transforms bytes with specific character encoding into string\n * @param bytes - the uint8array bytes\n * @param format - the format we use to encode the byte\n * @returns a string of the encoded string\n */\nexport function uint8ArrayToString(bytes: Uint8Array, format: EncodingType): string {\n return Buffer.from(bytes).toString(format);\n}\n\n/**\n * The helper that transforms string to specific character encoded bytes array.\n * @param value - the string to be converted\n * @param format - the format we use to decode the value\n * @returns a uint8array\n */\nexport function stringToUint8Array(value: string, format: EncodingType): Uint8Array {\n return Buffer.from(value, format);\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  // Copyright (c) Microsoft Corporation.
3
- // Licensed under the MIT license.
3
+ // Licensed under the MIT License.
4
4
  var _a, _b, _c, _d;
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.isReactNative = exports.isNodeRuntime = exports.isNode = exports.isNodeLike = exports.isDeno = exports.isBun = exports.isWebWorker = exports.isBrowser = void 0;
@@ -1 +1 @@
1
- {"version":3,"file":"checkEnvironment.js","sourceRoot":"","sources":["../../../src/util/checkEnvironment.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;;AAiBlC;;GAEG;AACH,yDAAyD;AAC5C,QAAA,SAAS,GAAG,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,MAAM,CAAC,QAAQ,KAAK,WAAW,CAAC;AAEjG;;GAEG;AACU,QAAA,WAAW,GACtB,OAAO,IAAI,KAAK,QAAQ;IACxB,OAAO,CAAC,IAAY,aAAZ,IAAI,uBAAJ,IAAI,CAAU,aAAa,CAAA,KAAK,UAAU;IAClD,CAAC,CAAA,MAAA,IAAI,CAAC,WAAW,0CAAE,IAAI,MAAK,4BAA4B;QACtD,CAAA,MAAA,IAAI,CAAC,WAAW,0CAAE,IAAI,MAAK,0BAA0B;QACrD,CAAA,MAAA,IAAI,CAAC,WAAW,0CAAE,IAAI,MAAK,yBAAyB,CAAC,CAAC;AAE1D;;GAEG;AACU,QAAA,KAAK,GAAG,OAAO,GAAG,KAAK,WAAW,IAAI,OAAO,GAAG,CAAC,OAAO,KAAK,WAAW,CAAC;AAEtF;;GAEG;AACU,QAAA,MAAM,GACjB,OAAO,IAAI,KAAK,WAAW;IAC3B,OAAO,IAAI,CAAC,OAAO,KAAK,WAAW;IACnC,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,KAAK,WAAW,CAAC;AAE3C;;GAEG;AACU,QAAA,UAAU,GACrB,OAAO,UAAU,CAAC,OAAO,KAAK,WAAW;IACzC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC;IACnC,OAAO,CAAC,MAAA,UAAU,CAAC,OAAO,CAAC,QAAQ,0CAAE,IAAI,CAAC,CAAC;AAE7C;;;GAGG;AACU,QAAA,MAAM,GAAG,kBAAU,CAAC;AAEjC;;GAEG;AACU,QAAA,aAAa,GAAG,kBAAU,IAAI,CAAC,aAAK,IAAI,CAAC,cAAM,CAAC;AAE7D;;GAEG;AACH,4GAA4G;AAC/F,QAAA,aAAa,GACxB,OAAO,SAAS,KAAK,WAAW,IAAI,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,OAAO,MAAK,aAAa,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\ndeclare global {\n interface DenoGlobal {\n version: {\n deno: string;\n };\n }\n\n interface BunGlobal {\n version: string;\n }\n\n const Deno: DenoGlobal;\n const Bun: BunGlobal;\n}\n\n/**\n * A constant that indicates whether the environment the code is running is a Web Browser.\n */\n// eslint-disable-next-line @azure/azure-sdk/ts-no-window\nexport const isBrowser = typeof window !== \"undefined\" && typeof window.document !== \"undefined\";\n\n/**\n * A constant that indicates whether the environment the code is running is a Web Worker.\n */\nexport const isWebWorker =\n typeof self === \"object\" &&\n typeof (self as any)?.importScripts === \"function\" &&\n (self.constructor?.name === \"DedicatedWorkerGlobalScope\" ||\n self.constructor?.name === \"ServiceWorkerGlobalScope\" ||\n self.constructor?.name === \"SharedWorkerGlobalScope\");\n\n/**\n * A constant that indicates whether the environment the code is running is Bun.sh.\n */\nexport const isBun = typeof Bun !== \"undefined\" && typeof Bun.version !== \"undefined\";\n\n/**\n * A constant that indicates whether the environment the code is running is Deno.\n */\nexport const isDeno =\n typeof Deno !== \"undefined\" &&\n typeof Deno.version !== \"undefined\" &&\n typeof Deno.version.deno !== \"undefined\";\n\n/**\n * A constant that indicates whether the environment the code is running is a Node.js compatible environment.\n */\nexport const isNodeLike =\n typeof globalThis.process !== \"undefined\" &&\n Boolean(globalThis.process.version) &&\n Boolean(globalThis.process.versions?.node);\n\n/**\n * A constant that indicates whether the environment the code is running is a Node.js compatible environment.\n * @deprecated Use `isNodeLike` instead.\n */\nexport const isNode = isNodeLike;\n\n/**\n * A constant that indicates whether the environment the code is running is Node.JS.\n */\nexport const isNodeRuntime = isNodeLike && !isBun && !isDeno;\n\n/**\n * A constant that indicates whether the environment the code is running is in React-Native.\n */\n// https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Core/setUpNavigator.js\nexport const isReactNative =\n typeof navigator !== \"undefined\" && navigator?.product === \"ReactNative\";\n"]}
1
+ {"version":3,"file":"checkEnvironment.js","sourceRoot":"","sources":["../../../src/util/checkEnvironment.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;;AAiBlC;;GAEG;AACH,yDAAyD;AAC5C,QAAA,SAAS,GAAG,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,MAAM,CAAC,QAAQ,KAAK,WAAW,CAAC;AAEjG;;GAEG;AACU,QAAA,WAAW,GACtB,OAAO,IAAI,KAAK,QAAQ;IACxB,OAAO,CAAC,IAAY,aAAZ,IAAI,uBAAJ,IAAI,CAAU,aAAa,CAAA,KAAK,UAAU;IAClD,CAAC,CAAA,MAAA,IAAI,CAAC,WAAW,0CAAE,IAAI,MAAK,4BAA4B;QACtD,CAAA,MAAA,IAAI,CAAC,WAAW,0CAAE,IAAI,MAAK,0BAA0B;QACrD,CAAA,MAAA,IAAI,CAAC,WAAW,0CAAE,IAAI,MAAK,yBAAyB,CAAC,CAAC;AAE1D;;GAEG;AACU,QAAA,KAAK,GAAG,OAAO,GAAG,KAAK,WAAW,IAAI,OAAO,GAAG,CAAC,OAAO,KAAK,WAAW,CAAC;AAEtF;;GAEG;AACU,QAAA,MAAM,GACjB,OAAO,IAAI,KAAK,WAAW;IAC3B,OAAO,IAAI,CAAC,OAAO,KAAK,WAAW;IACnC,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,KAAK,WAAW,CAAC;AAE3C;;GAEG;AACU,QAAA,UAAU,GACrB,OAAO,UAAU,CAAC,OAAO,KAAK,WAAW;IACzC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC;IACnC,OAAO,CAAC,MAAA,UAAU,CAAC,OAAO,CAAC,QAAQ,0CAAE,IAAI,CAAC,CAAC;AAE7C;;;GAGG;AACU,QAAA,MAAM,GAAG,kBAAU,CAAC;AAEjC;;GAEG;AACU,QAAA,aAAa,GAAG,kBAAU,IAAI,CAAC,aAAK,IAAI,CAAC,cAAM,CAAC;AAE7D;;GAEG;AACH,4GAA4G;AAC/F,QAAA,aAAa,GACxB,OAAO,SAAS,KAAK,WAAW,IAAI,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,OAAO,MAAK,aAAa,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\ndeclare global {\n interface DenoGlobal {\n version: {\n deno: string;\n };\n }\n\n interface BunGlobal {\n version: string;\n }\n\n const Deno: DenoGlobal;\n const Bun: BunGlobal;\n}\n\n/**\n * A constant that indicates whether the environment the code is running is a Web Browser.\n */\n// eslint-disable-next-line @azure/azure-sdk/ts-no-window\nexport const isBrowser = typeof window !== \"undefined\" && typeof window.document !== \"undefined\";\n\n/**\n * A constant that indicates whether the environment the code is running is a Web Worker.\n */\nexport const isWebWorker =\n typeof self === \"object\" &&\n typeof (self as any)?.importScripts === \"function\" &&\n (self.constructor?.name === \"DedicatedWorkerGlobalScope\" ||\n self.constructor?.name === \"ServiceWorkerGlobalScope\" ||\n self.constructor?.name === \"SharedWorkerGlobalScope\");\n\n/**\n * A constant that indicates whether the environment the code is running is Bun.sh.\n */\nexport const isBun = typeof Bun !== \"undefined\" && typeof Bun.version !== \"undefined\";\n\n/**\n * A constant that indicates whether the environment the code is running is Deno.\n */\nexport const isDeno =\n typeof Deno !== \"undefined\" &&\n typeof Deno.version !== \"undefined\" &&\n typeof Deno.version.deno !== \"undefined\";\n\n/**\n * A constant that indicates whether the environment the code is running is a Node.js compatible environment.\n */\nexport const isNodeLike =\n typeof globalThis.process !== \"undefined\" &&\n Boolean(globalThis.process.version) &&\n Boolean(globalThis.process.versions?.node);\n\n/**\n * A constant that indicates whether the environment the code is running is a Node.js compatible environment.\n * @deprecated Use `isNodeLike` instead.\n */\nexport const isNode = isNodeLike;\n\n/**\n * A constant that indicates whether the environment the code is running is Node.JS.\n */\nexport const isNodeRuntime = isNodeLike && !isBun && !isDeno;\n\n/**\n * A constant that indicates whether the environment the code is running is in React-Native.\n */\n// https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Core/setUpNavigator.js\nexport const isReactNative =\n typeof navigator !== \"undefined\" && navigator?.product === \"ReactNative\";\n"]}