@azure/core-amqp 4.4.0-beta.1 → 4.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (343) hide show
  1. package/LICENSE +3 -3
  2. package/README.md +3 -5
  3. package/dist/browser/ConnectionContextBase.js +1 -1
  4. package/dist/browser/ConnectionContextBase.js.map +1 -1
  5. package/dist/browser/amqpAnnotatedMessage.d.ts +1 -1
  6. package/dist/browser/amqpAnnotatedMessage.js +1 -2
  7. package/dist/browser/amqpAnnotatedMessage.js.map +1 -1
  8. package/dist/browser/auth/token.js +1 -1
  9. package/dist/browser/auth/token.js.map +1 -1
  10. package/dist/browser/auth/tokenProvider.d.ts +1 -1
  11. package/dist/browser/auth/tokenProvider.js +2 -2
  12. package/dist/browser/auth/tokenProvider.js.map +1 -1
  13. package/dist/browser/cbs.d.ts +3 -3
  14. package/dist/browser/cbs.js +2 -2
  15. package/dist/browser/cbs.js.map +1 -1
  16. package/dist/browser/connectionConfig/connectionConfig.d.ts +1 -1
  17. package/dist/browser/connectionConfig/connectionConfig.js +29 -10
  18. package/dist/browser/connectionConfig/connectionConfig.js.map +1 -1
  19. package/dist/browser/errors.d.ts +3 -1
  20. package/dist/browser/errors.js +3 -1
  21. package/dist/browser/errors.js.map +1 -1
  22. package/dist/browser/index.d.ts +0 -1
  23. package/dist/browser/index.js +1 -2
  24. package/dist/browser/index.js.map +1 -1
  25. package/dist/browser/internals.js +1 -1
  26. package/dist/browser/internals.js.map +1 -1
  27. package/dist/browser/log.js +1 -1
  28. package/dist/browser/log.js.map +1 -1
  29. package/dist/browser/messageHeader.d.ts +1 -1
  30. package/dist/browser/messageHeader.js +1 -1
  31. package/dist/browser/messageHeader.js.map +1 -1
  32. package/dist/browser/messageProperties.d.ts +1 -2
  33. package/dist/browser/messageProperties.js +1 -1
  34. package/dist/browser/messageProperties.js.map +1 -1
  35. package/dist/browser/requestResponseLink.d.ts +2 -2
  36. package/dist/browser/requestResponseLink.js +3 -3
  37. package/dist/browser/requestResponseLink.js.map +1 -1
  38. package/dist/browser/retry.d.ts +1 -1
  39. package/dist/browser/retry.js +5 -12
  40. package/dist/browser/retry.js.map +1 -1
  41. package/dist/browser/util/checkNetworkConnection-browser.mjs.map +1 -1
  42. package/dist/browser/util/checkNetworkConnection.common.d.ts +6 -0
  43. package/dist/browser/util/checkNetworkConnection.common.js +10 -0
  44. package/dist/browser/util/checkNetworkConnection.common.js.map +1 -0
  45. package/dist/browser/util/checkNetworkConnection.d.ts +1 -5
  46. package/dist/browser/util/checkNetworkConnection.js +2 -8
  47. package/dist/browser/util/constants.d.ts +0 -1
  48. package/dist/browser/util/constants.js +1 -2
  49. package/dist/browser/util/constants.js.map +1 -1
  50. package/dist/browser/util/hmacSha256-browser.mjs.map +1 -1
  51. package/dist/browser/util/hmacSha256.common.d.ts +2 -0
  52. package/dist/browser/util/hmacSha256.common.js +11 -0
  53. package/dist/browser/util/hmacSha256.common.js.map +1 -0
  54. package/dist/browser/util/hmacSha256.d.ts +1 -16
  55. package/dist/browser/util/hmacSha256.js +2 -9
  56. package/dist/browser/util/lock.d.ts +1 -1
  57. package/dist/browser/util/lock.js +1 -1
  58. package/dist/browser/util/lock.js.map +1 -1
  59. package/dist/browser/util/runtimeInfo-browser.mjs.map +1 -1
  60. package/dist/browser/util/runtimeInfo.js +1 -1
  61. package/dist/browser/util/typeGuards.d.ts +1 -1
  62. package/dist/browser/util/typeGuards.js +1 -1
  63. package/dist/browser/util/typeGuards.js.map +1 -1
  64. package/dist/browser/util/utils.d.ts +3 -3
  65. package/dist/browser/util/utils.js +1 -1
  66. package/dist/browser/util/utils.js.map +1 -1
  67. package/dist/commonjs/ConnectionContextBase.js +1 -1
  68. package/dist/commonjs/ConnectionContextBase.js.map +1 -1
  69. package/dist/commonjs/amqpAnnotatedMessage.d.ts +1 -1
  70. package/dist/commonjs/amqpAnnotatedMessage.js +1 -2
  71. package/dist/commonjs/amqpAnnotatedMessage.js.map +1 -1
  72. package/dist/commonjs/auth/token.js +1 -1
  73. package/dist/commonjs/auth/token.js.map +1 -1
  74. package/dist/commonjs/auth/tokenProvider.d.ts +1 -1
  75. package/dist/commonjs/auth/tokenProvider.js +3 -3
  76. package/dist/commonjs/auth/tokenProvider.js.map +1 -1
  77. package/dist/commonjs/cbs.d.ts +3 -3
  78. package/dist/commonjs/cbs.js +1 -1
  79. package/dist/commonjs/cbs.js.map +1 -1
  80. package/dist/commonjs/connectionConfig/connectionConfig.d.ts +1 -1
  81. package/dist/commonjs/connectionConfig/connectionConfig.js +31 -12
  82. package/dist/commonjs/connectionConfig/connectionConfig.js.map +1 -1
  83. package/dist/commonjs/errors.d.ts +3 -1
  84. package/dist/commonjs/errors.js +7 -5
  85. package/dist/commonjs/errors.js.map +1 -1
  86. package/dist/commonjs/index.d.ts +0 -1
  87. package/dist/commonjs/index.js +1 -2
  88. package/dist/commonjs/index.js.map +1 -1
  89. package/dist/commonjs/internals.js +1 -1
  90. package/dist/commonjs/internals.js.map +1 -1
  91. package/dist/commonjs/log.js +3 -3
  92. package/dist/commonjs/log.js.map +1 -1
  93. package/dist/commonjs/messageHeader.d.ts +1 -1
  94. package/dist/commonjs/messageHeader.js +1 -1
  95. package/dist/commonjs/messageHeader.js.map +1 -1
  96. package/dist/commonjs/messageProperties.d.ts +1 -2
  97. package/dist/commonjs/messageProperties.js +1 -1
  98. package/dist/commonjs/messageProperties.js.map +1 -1
  99. package/dist/commonjs/requestResponseLink.d.ts +2 -2
  100. package/dist/commonjs/requestResponseLink.js +4 -4
  101. package/dist/commonjs/requestResponseLink.js.map +1 -1
  102. package/dist/commonjs/retry.d.ts +1 -1
  103. package/dist/commonjs/retry.js +7 -14
  104. package/dist/commonjs/retry.js.map +1 -1
  105. package/dist/commonjs/tsdoc-metadata.json +1 -1
  106. package/dist/commonjs/util/checkNetworkConnection.common.d.ts +6 -0
  107. package/dist/commonjs/util/checkNetworkConnection.common.js +13 -0
  108. package/dist/commonjs/util/checkNetworkConnection.common.js.map +1 -0
  109. package/dist/commonjs/util/checkNetworkConnection.js +2 -3
  110. package/dist/commonjs/util/checkNetworkConnection.js.map +1 -1
  111. package/dist/commonjs/util/constants.d.ts +0 -1
  112. package/dist/commonjs/util/constants.js +1 -2
  113. package/dist/commonjs/util/constants.js.map +1 -1
  114. package/dist/commonjs/util/hmacSha256.common.d.ts +2 -0
  115. package/dist/commonjs/util/hmacSha256.common.js +14 -0
  116. package/dist/commonjs/util/hmacSha256.common.js.map +1 -0
  117. package/dist/commonjs/util/hmacSha256.js +2 -3
  118. package/dist/commonjs/util/hmacSha256.js.map +1 -1
  119. package/dist/commonjs/util/lock.d.ts +1 -1
  120. package/dist/commonjs/util/lock.js +1 -1
  121. package/dist/commonjs/util/lock.js.map +1 -1
  122. package/dist/commonjs/util/runtimeInfo.js +3 -4
  123. package/dist/commonjs/util/runtimeInfo.js.map +1 -1
  124. package/dist/commonjs/util/typeGuards.d.ts +1 -1
  125. package/dist/commonjs/util/typeGuards.js +2 -3
  126. package/dist/commonjs/util/typeGuards.js.map +1 -1
  127. package/dist/commonjs/util/utils.d.ts +3 -3
  128. package/dist/commonjs/util/utils.js +10 -10
  129. package/dist/commonjs/util/utils.js.map +1 -1
  130. package/dist/esm/ConnectionContextBase.js +1 -1
  131. package/dist/esm/ConnectionContextBase.js.map +1 -1
  132. package/dist/esm/amqpAnnotatedMessage.d.ts +1 -1
  133. package/dist/esm/amqpAnnotatedMessage.js +1 -2
  134. package/dist/esm/amqpAnnotatedMessage.js.map +1 -1
  135. package/dist/esm/auth/token.js +1 -1
  136. package/dist/esm/auth/token.js.map +1 -1
  137. package/dist/esm/auth/tokenProvider.d.ts +1 -1
  138. package/dist/esm/auth/tokenProvider.js +2 -2
  139. package/dist/esm/auth/tokenProvider.js.map +1 -1
  140. package/dist/esm/cbs.d.ts +3 -3
  141. package/dist/esm/cbs.js +2 -2
  142. package/dist/esm/cbs.js.map +1 -1
  143. package/dist/esm/connectionConfig/connectionConfig.d.ts +1 -1
  144. package/dist/esm/connectionConfig/connectionConfig.js +29 -10
  145. package/dist/esm/connectionConfig/connectionConfig.js.map +1 -1
  146. package/dist/esm/errors.d.ts +3 -1
  147. package/dist/esm/errors.js +3 -1
  148. package/dist/esm/errors.js.map +1 -1
  149. package/dist/esm/index.d.ts +0 -1
  150. package/dist/esm/index.js +1 -2
  151. package/dist/esm/index.js.map +1 -1
  152. package/dist/esm/internals.js +1 -1
  153. package/dist/esm/internals.js.map +1 -1
  154. package/dist/esm/log.js +1 -1
  155. package/dist/esm/log.js.map +1 -1
  156. package/dist/esm/messageHeader.d.ts +1 -1
  157. package/dist/esm/messageHeader.js +1 -1
  158. package/dist/esm/messageHeader.js.map +1 -1
  159. package/dist/esm/messageProperties.d.ts +1 -2
  160. package/dist/esm/messageProperties.js +1 -1
  161. package/dist/esm/messageProperties.js.map +1 -1
  162. package/dist/esm/requestResponseLink.d.ts +2 -2
  163. package/dist/esm/requestResponseLink.js +3 -3
  164. package/dist/esm/requestResponseLink.js.map +1 -1
  165. package/dist/esm/retry.d.ts +1 -1
  166. package/dist/esm/retry.js +5 -12
  167. package/dist/esm/retry.js.map +1 -1
  168. package/dist/esm/util/checkNetworkConnection.common.d.ts +6 -0
  169. package/dist/esm/util/checkNetworkConnection.common.js +10 -0
  170. package/dist/esm/util/checkNetworkConnection.common.js.map +1 -0
  171. package/dist/esm/util/checkNetworkConnection.js +1 -1
  172. package/dist/esm/util/checkNetworkConnection.js.map +1 -1
  173. package/dist/esm/util/constants.d.ts +0 -1
  174. package/dist/esm/util/constants.js +1 -2
  175. package/dist/esm/util/constants.js.map +1 -1
  176. package/dist/esm/util/hmacSha256.common.d.ts +2 -0
  177. package/dist/esm/util/hmacSha256.common.js +11 -0
  178. package/dist/esm/util/hmacSha256.common.js.map +1 -0
  179. package/dist/esm/util/hmacSha256.js +1 -1
  180. package/dist/esm/util/hmacSha256.js.map +1 -1
  181. package/dist/esm/util/lock.d.ts +1 -1
  182. package/dist/esm/util/lock.js +1 -1
  183. package/dist/esm/util/lock.js.map +1 -1
  184. package/dist/esm/util/runtimeInfo.js +1 -1
  185. package/dist/esm/util/runtimeInfo.js.map +1 -1
  186. package/dist/esm/util/typeGuards.d.ts +1 -1
  187. package/dist/esm/util/typeGuards.js +1 -1
  188. package/dist/esm/util/typeGuards.js.map +1 -1
  189. package/dist/esm/util/utils.d.ts +3 -3
  190. package/dist/esm/util/utils.js +1 -1
  191. package/dist/esm/util/utils.js.map +1 -1
  192. package/dist/react-native/ConnectionContextBase.js +1 -1
  193. package/dist/react-native/ConnectionContextBase.js.map +1 -1
  194. package/dist/react-native/amqpAnnotatedMessage.d.ts +1 -1
  195. package/dist/react-native/amqpAnnotatedMessage.js +1 -2
  196. package/dist/react-native/amqpAnnotatedMessage.js.map +1 -1
  197. package/dist/react-native/auth/token.js +1 -1
  198. package/dist/react-native/auth/token.js.map +1 -1
  199. package/dist/react-native/auth/tokenProvider.d.ts +1 -1
  200. package/dist/react-native/auth/tokenProvider.js +2 -2
  201. package/dist/react-native/auth/tokenProvider.js.map +1 -1
  202. package/dist/react-native/cbs.d.ts +3 -3
  203. package/dist/react-native/cbs.js +2 -2
  204. package/dist/react-native/cbs.js.map +1 -1
  205. package/dist/react-native/connectionConfig/connectionConfig.d.ts +1 -1
  206. package/dist/react-native/connectionConfig/connectionConfig.js +29 -10
  207. package/dist/react-native/connectionConfig/connectionConfig.js.map +1 -1
  208. package/dist/react-native/errors.d.ts +3 -1
  209. package/dist/react-native/errors.js +3 -1
  210. package/dist/react-native/errors.js.map +1 -1
  211. package/dist/react-native/index.d.ts +0 -1
  212. package/dist/react-native/index.js +1 -2
  213. package/dist/react-native/index.js.map +1 -1
  214. package/dist/react-native/internals.js +1 -1
  215. package/dist/react-native/internals.js.map +1 -1
  216. package/dist/react-native/log.js +1 -1
  217. package/dist/react-native/log.js.map +1 -1
  218. package/dist/react-native/messageHeader.d.ts +1 -1
  219. package/dist/react-native/messageHeader.js +1 -1
  220. package/dist/react-native/messageHeader.js.map +1 -1
  221. package/dist/react-native/messageProperties.d.ts +1 -2
  222. package/dist/react-native/messageProperties.js +1 -1
  223. package/dist/react-native/messageProperties.js.map +1 -1
  224. package/dist/react-native/requestResponseLink.d.ts +2 -2
  225. package/dist/react-native/requestResponseLink.js +3 -3
  226. package/dist/react-native/requestResponseLink.js.map +1 -1
  227. package/dist/react-native/retry.d.ts +1 -1
  228. package/dist/react-native/retry.js +5 -12
  229. package/dist/react-native/retry.js.map +1 -1
  230. package/dist/react-native/util/checkNetworkConnection-react-native.mjs.map +1 -0
  231. package/dist/react-native/util/checkNetworkConnection.common.d.ts +6 -0
  232. package/dist/react-native/util/checkNetworkConnection.common.js +10 -0
  233. package/dist/react-native/util/checkNetworkConnection.common.js.map +1 -0
  234. package/dist/react-native/util/checkNetworkConnection.d.ts +2 -6
  235. package/dist/react-native/util/checkNetworkConnection.js +3 -27
  236. package/dist/react-native/util/constants.d.ts +0 -1
  237. package/dist/react-native/util/constants.js +1 -2
  238. package/dist/react-native/util/constants.js.map +1 -1
  239. package/dist/react-native/util/hmacSha256-react-native.mjs.map +1 -0
  240. package/dist/react-native/util/hmacSha256.common.d.ts +2 -0
  241. package/dist/react-native/util/hmacSha256.common.js +11 -0
  242. package/dist/react-native/util/hmacSha256.common.js.map +1 -0
  243. package/dist/react-native/util/hmacSha256.d.ts +2 -2
  244. package/dist/react-native/util/hmacSha256.js +3 -7
  245. package/dist/react-native/util/lock.d.ts +1 -1
  246. package/dist/react-native/util/lock.js +1 -1
  247. package/dist/react-native/util/lock.js.map +1 -1
  248. package/dist/react-native/util/runtimeInfo-react-native.mjs.map +1 -1
  249. package/dist/react-native/util/runtimeInfo.js +2 -2
  250. package/dist/react-native/util/typeGuards.d.ts +1 -1
  251. package/dist/react-native/util/typeGuards.js +1 -1
  252. package/dist/react-native/util/typeGuards.js.map +1 -1
  253. package/dist/react-native/util/utils.d.ts +3 -3
  254. package/dist/react-native/util/utils.js +1 -1
  255. package/dist/react-native/util/utils.js.map +1 -1
  256. package/package.json +29 -33
  257. package/dist/browser/ConnectionContextBase.d.ts.map +0 -1
  258. package/dist/browser/amqpAnnotatedMessage.d.ts.map +0 -1
  259. package/dist/browser/auth/token.d.ts.map +0 -1
  260. package/dist/browser/auth/tokenProvider.d.ts.map +0 -1
  261. package/dist/browser/cbs.d.ts.map +0 -1
  262. package/dist/browser/connectionConfig/connectionConfig.d.ts.map +0 -1
  263. package/dist/browser/errors.d.ts.map +0 -1
  264. package/dist/browser/index.d.ts.map +0 -1
  265. package/dist/browser/internals.d.ts.map +0 -1
  266. package/dist/browser/log.d.ts.map +0 -1
  267. package/dist/browser/messageHeader.d.ts.map +0 -1
  268. package/dist/browser/messageProperties.d.ts.map +0 -1
  269. package/dist/browser/requestResponseLink.d.ts.map +0 -1
  270. package/dist/browser/retry.d.ts.map +0 -1
  271. package/dist/browser/util/checkNetworkConnection-browser.d.mts.map +0 -1
  272. package/dist/browser/util/constants.d.ts.map +0 -1
  273. package/dist/browser/util/hmacSha256-browser.d.mts.map +0 -1
  274. package/dist/browser/util/lock.d.ts.map +0 -1
  275. package/dist/browser/util/runtimeInfo-browser.d.mts.map +0 -1
  276. package/dist/browser/util/typeGuards.d.ts.map +0 -1
  277. package/dist/browser/util/utils.d.ts.map +0 -1
  278. package/dist/commonjs/ConnectionContextBase.d.ts.map +0 -1
  279. package/dist/commonjs/amqpAnnotatedMessage.d.ts.map +0 -1
  280. package/dist/commonjs/auth/token.d.ts.map +0 -1
  281. package/dist/commonjs/auth/tokenProvider.d.ts.map +0 -1
  282. package/dist/commonjs/cbs.d.ts.map +0 -1
  283. package/dist/commonjs/connectionConfig/connectionConfig.d.ts.map +0 -1
  284. package/dist/commonjs/errors.d.ts.map +0 -1
  285. package/dist/commonjs/index.d.ts.map +0 -1
  286. package/dist/commonjs/internals.d.ts.map +0 -1
  287. package/dist/commonjs/log.d.ts.map +0 -1
  288. package/dist/commonjs/messageHeader.d.ts.map +0 -1
  289. package/dist/commonjs/messageProperties.d.ts.map +0 -1
  290. package/dist/commonjs/requestResponseLink.d.ts.map +0 -1
  291. package/dist/commonjs/retry.d.ts.map +0 -1
  292. package/dist/commonjs/util/checkNetworkConnection.d.ts.map +0 -1
  293. package/dist/commonjs/util/constants.d.ts.map +0 -1
  294. package/dist/commonjs/util/hmacSha256.d.ts.map +0 -1
  295. package/dist/commonjs/util/lock.d.ts.map +0 -1
  296. package/dist/commonjs/util/runtimeInfo.d.ts.map +0 -1
  297. package/dist/commonjs/util/typeGuards.d.ts.map +0 -1
  298. package/dist/commonjs/util/utils.d.ts.map +0 -1
  299. package/dist/core-amqp.d.ts +0 -1521
  300. package/dist/esm/ConnectionContextBase.d.ts.map +0 -1
  301. package/dist/esm/amqpAnnotatedMessage.d.ts.map +0 -1
  302. package/dist/esm/auth/token.d.ts.map +0 -1
  303. package/dist/esm/auth/tokenProvider.d.ts.map +0 -1
  304. package/dist/esm/cbs.d.ts.map +0 -1
  305. package/dist/esm/connectionConfig/connectionConfig.d.ts.map +0 -1
  306. package/dist/esm/errors.d.ts.map +0 -1
  307. package/dist/esm/index.d.ts.map +0 -1
  308. package/dist/esm/internals.d.ts.map +0 -1
  309. package/dist/esm/log.d.ts.map +0 -1
  310. package/dist/esm/messageHeader.d.ts.map +0 -1
  311. package/dist/esm/messageProperties.d.ts.map +0 -1
  312. package/dist/esm/requestResponseLink.d.ts.map +0 -1
  313. package/dist/esm/retry.d.ts.map +0 -1
  314. package/dist/esm/util/checkNetworkConnection.d.ts.map +0 -1
  315. package/dist/esm/util/constants.d.ts.map +0 -1
  316. package/dist/esm/util/hmacSha256.d.ts.map +0 -1
  317. package/dist/esm/util/lock.d.ts.map +0 -1
  318. package/dist/esm/util/runtimeInfo.d.ts.map +0 -1
  319. package/dist/esm/util/typeGuards.d.ts.map +0 -1
  320. package/dist/esm/util/utils.d.ts.map +0 -1
  321. package/dist/react-native/ConnectionContextBase.d.ts.map +0 -1
  322. package/dist/react-native/amqpAnnotatedMessage.d.ts.map +0 -1
  323. package/dist/react-native/auth/token.d.ts.map +0 -1
  324. package/dist/react-native/auth/tokenProvider.d.ts.map +0 -1
  325. package/dist/react-native/cbs.d.ts.map +0 -1
  326. package/dist/react-native/connectionConfig/connectionConfig.d.ts.map +0 -1
  327. package/dist/react-native/errors.d.ts.map +0 -1
  328. package/dist/react-native/index.d.ts.map +0 -1
  329. package/dist/react-native/internals.d.ts.map +0 -1
  330. package/dist/react-native/log.d.ts.map +0 -1
  331. package/dist/react-native/messageHeader.d.ts.map +0 -1
  332. package/dist/react-native/messageProperties.d.ts.map +0 -1
  333. package/dist/react-native/requestResponseLink.d.ts.map +0 -1
  334. package/dist/react-native/retry.d.ts.map +0 -1
  335. package/dist/react-native/util/checkNetworkConnection.d.ts.map +0 -1
  336. package/dist/react-native/util/checkNetworkConnection.js.map +0 -1
  337. package/dist/react-native/util/constants.d.ts.map +0 -1
  338. package/dist/react-native/util/hmacSha256.d.ts.map +0 -1
  339. package/dist/react-native/util/hmacSha256.js.map +0 -1
  340. package/dist/react-native/util/lock.d.ts.map +0 -1
  341. package/dist/react-native/util/runtimeInfo-react-native.d.mts.map +0 -1
  342. package/dist/react-native/util/typeGuards.d.ts.map +0 -1
  343. package/dist/react-native/util/utils.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,2BAA2B;AAE3B,OAAO,EAAqC,WAAW,IAAI,eAAe,EAAE,MAAM,cAAc,CAAC;AACjG,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC1F,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAErD;;;GAGG;AACH,MAAM,CAAN,IAAY,qBAqBX;AArBD,WAAY,qBAAqB;IAC/B,qGAA+D,CAAA;IAC/D,uFAAkD,CAAA;IAClD,mGAA8D,CAAA;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AG,IAAI,cAAc,CAAC,8BAA8B,CAAC,CAAC;QACjE,KAAK,CAAC,IAAI,GAAG,wBAAwB,CAAC,wBAAwB,CAAC,yBAAyB,CAAC,CAAC;QAC1F,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC;QACxB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,iFAAiF;IACjF,wCAAwC;IACxC,IAAI,OAAO,CAAC,MAAM,CAAC,IAAI,iBAAiB,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;QACrE,MAAM,KAAK,GAAG,IAAI,cAAc,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QACzD,KAAK,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;QACzB,IAAI,KAAK,CAAC,IAAI,IAAI,eAAe,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;YAC7D,YAAY;YACZ,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC;QAC1B,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;AAC9D,CAAC;AAED;;GAEG;AACH,SAAS,WAAW,CAAC,KAAU;IAC7B,OAAO,eAAe,CAAC,KAAK,CAAC,CAAC;AAChC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n/* eslint-disable eqeqeq */\n\nimport { AmqpError, AmqpResponseStatusCode, isAmqpError as rheaIsAmqpError } from \"rhea-promise\";\nimport { isDefined, isError, isNodeLike, isObjectWithProperties } from \"@azure/core-util\";\nimport { isNumber, isString } from \"./util/utils.js\";\n\n/**\n * Maps the conditions to the numeric AMQP Response status codes.\n * @internal\n */\nexport enum ConditionStatusMapper {\n \"com.microsoft:timeout\" = AmqpResponseStatusCode.RequestTimeout,\n \"amqp:not-found\" = AmqpResponseStatusCode.NotFound,\n \"amqp:not-implemented\" = AmqpResponseStatusCode.NotImplemented,\n \"com.microsoft:entity-already-exists\" = AmqpResponseStatusCode.Conflict,\n \"com.microsoft:message-lock-lost\" = AmqpResponseStatusCode.Gone,\n \"com.microsoft:session-lock-lost\" = AmqpResponseStatusCode.Gone,\n \"com.microsoft:no-matching-subscription\" = AmqpResponseStatusCode.InternalServerError,\n \"amqp:link:message-size-exceeded\" = AmqpResponseStatusCode.Forbidden,\n \"com.microsoft:server-busy\" = AmqpResponseStatusCode.ServiceUnavailable,\n \"com.microsoft:argument-error\" = AmqpResponseStatusCode.BadRequest,\n \"com.microsoft:argument-out-of-range\" = AmqpResponseStatusCode.BadRequest,\n \"com.microsoft:store-lock-lost\" = AmqpResponseStatusCode.Gone,\n \"com.microsoft:session-cannot-be-locked\" = AmqpResponseStatusCode.Gone,\n \"com.microsoft:partition-not-owned\" = AmqpResponseStatusCode.Gone,\n \"com.microsoft:entity-disabled\" = AmqpResponseStatusCode.BadRequest,\n \"com.microsoft:publisher-revoked\" = AmqpResponseStatusCode.Unauthorized,\n \"amqp:link:stolen\" = AmqpResponseStatusCode.Gone,\n \"amqp:not-allowed\" = AmqpResponseStatusCode.BadRequest,\n \"amqp:unauthorized-access\" = AmqpResponseStatusCode.Unauthorized,\n \"amqp:resource-limit-exceeded\" = AmqpResponseStatusCode.Forbidden,\n}\n\n/**\n * Maps the amqp error conditions to the Error names.\n */\nexport enum ConditionErrorNameMapper {\n /**\n * Error is thrown when the address is already in use.\n */\n \"com.microsoft:address-already-in-use\" = \"AddressAlreadyInUseError\",\n /**\n * Error is thrown when the store lock is lost.\n */\n \"com.microsoft:store-lock-lost\" = \"StoreLockLostError\",\n /**\n * Error is thrown when a matching subscription is not found.\n */\n \"com.microsoft:no-matching-subscription\" = \"NoMatchingSubscriptionError\",\n /**\n * Error is thrown when an attempt is made to access a partition that is not owned by the\n * requesting entity.\n */\n \"com.microsoft:partition-not-owned\" = \"PartitionNotOwnedError\",\n /**\n * Error is thrown when access to publisher has been revoked.\n */\n \"com.microsoft:publisher-revoked\" = \"PublisherRevokedError\",\n /**\n * Error is thrown when an attempt is made to create an entity that already exists.\n */\n \"com.microsoft:entity-already-exists\" = \"MessagingEntityAlreadyExistsError\",\n /**\n * Error is thrown when trying to access/connect to a disabled messaging entity.\n */\n \"com.microsoft:entity-disabled\" = \"MessagingEntityDisabledError\",\n /**\n * Error is thrown when the lock on the message is lost.\n */\n \"com.microsoft:message-lock-lost\" = \"MessageLockLostError\",\n /**\n * Error is thrown when the lock on the Azure ServiceBus session is lost.\n */\n \"com.microsoft:session-lock-lost\" = \"SessionLockLostError\",\n /**\n * Error is thrown when the Azure ServiceBus session cannot be locked.\n */\n \"com.microsoft:session-cannot-be-locked\" = \"SessionCannotBeLockedError\",\n /**\n * Error is thrown when an internal server error occurred. You may have found a bug?\n */\n \"amqp:internal-error\" = \"InternalServerError\", // Retryable\n /**\n * Error for signaling general communication errors related to messaging operations.\n */\n \"amqp:not-found\" = \"ServiceCommunicationError\",\n /**\n * Error is thrown when the message is not found.\n */\n \"com.microsoft:message-not-found\" = \"MessageNotFoundError\",\n /**\n * Error is thrown when relay is not found.\n */\n \"com.microsoft:relay-not-found\" = \"RelayNotFoundError\",\n /**\n * Error is thrown when a feature is not implemented yet but the placeholder is present.\n */\n \"amqp:not-implemented\" = \"NotImplementedError\",\n /**\n * Error is thrown when an operation is attempted but is not allowed.\n */\n \"amqp:not-allowed\" = \"InvalidOperationError\",\n /**\n * Error is thrown the the Azure EventHub/ServiceBus quota has been exceeded.\n * Quotas are reset periodically, this operation will have to wait until then.\n * The messaging entity has reached its maximum allowable size.\n * This can happen if the maximum number of receivers (which is 5) has already\n * been opened on a per-consumer group level.\n */\n \"amqp:resource-limit-exceeded\" = \"QuotaExceededError\",\n /**\n * Error is thrown when the connection parameters are wrong and the server refused the connection.\n */\n \"amqp:unauthorized-access\" = \"UnauthorizedError\",\n /**\n * Error is thrown when the connection parameters are wrong and the server refused the connection.\n */\n // eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values\n \"com.microsoft:auth-failed\" = \"UnauthorizedError\",\n /**\n * Error is thrown when the service is unavailable. The operation should be retried.\n */\n \"com.microsoft:timeout\" = \"ServiceUnavailableError\", // Retryable\n /**\n * Error is thrown when no new messages are received for the specified time.\n */\n \"com.microsoft:message-wait-timeout\" = \"MessageWaitTimeout\",\n /**\n * Error is thrown when an argument has a value that is out of the admissible range.\n */\n \"com.microsoft:argument-out-of-range\" = \"ArgumentOutOfRangeError\",\n /**\n * Error is thrown when a condition that should have been met in order to execute an operation was not.\n */\n \"amqp:precondition-failed\" = \"PreconditionFailedError\",\n /**\n * Error is thrown when a condition that should have been met in order to execute an operation was not.\n */\n // eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values\n \"com.microsoft:precondition-failed\" = \"PreconditionFailedError\",\n /**\n * Error is thrown when data could not be decoded.\n */\n \"amqp:decode-error\" = \"DecodeError\",\n /**\n * Error is thrown when an invalid field was passed in a frame body, and the operation could not proceed.\n */\n \"amqp:invalid-field\" = \"InvalidFieldError\",\n /**\n * Error is thrown when the client attempted to work with a server entity to which it\n * has no access because another client is working with it.\n */\n \"amqp:resource-locked\" = \"ResourceLockedError\",\n /**\n * Error is thrown when a server entity the client is working with has been deleted.\n */\n \"amqp:resource-deleted\" = \"ResourceDeletedError\",\n /**\n * Error is thrown when the peer sent a frame that is not permitted in the current state.\n */\n \"amqp:illegal-state\" = \"IllegalStateError\",\n /**\n * Error is thrown when the peer cannot send a frame because the smallest encoding of\n * the performative with the currently valid values would be too large to fit within\n * a frame of the agreed maximum frame size.\n */\n \"amqp:frame-size-too-small\" = \"FrameSizeTooSmallError\",\n /**\n * Error is thrown when an operator intervened to detach for some reason.\n */\n \"amqp:link:detach-forced\" = \"DetachForcedError\", // Retryable\n /**\n * Error is thrown when the peer sent more message transfers than currently allowed on the link.\n */\n \"amqp:link:transfer-limit-exceeded\" = \"TransferLimitExceededError\", // Retryable\n /**\n * Error is thrown when the message sent is too large: the maximum size is 256Kb.\n */\n \"amqp:link:message-size-exceeded\" = \"MessageTooLargeError\",\n /**\n * Error is thrown when the address provided cannot be resolved to a terminus at the current container.\n */\n \"amqp:link:redirect\" = \"LinkRedirectError\",\n /**\n * Error is thrown when two or more instances connect to the same partition\n * with different epoch values.\n */\n \"amqp:link:stolen\" = \"ReceiverDisconnectedError\",\n /**\n * Error is thrown when the peer violated incoming window for the session.\n */\n \"amqp:session:window-violation\" = \"SessionWindowViolationError\",\n /**\n * Error is thrown when input was received for a link that was detached with an error.\n */\n \"amqp:session:errant-link\" = \"ErrantLinkError\",\n /**\n * Error is thrown when an attach was received using a handle that is already in use for an attached link.\n */\n \"amqp:session:handle-in-use\" = \"HandleInUseError\",\n /**\n * Error is thrown when a frame (other than attach) was received referencing a handle which is not\n * currently in use of an attached link.\n */\n \"amqp:session:unattached-handle\" = \"UnattachedHandleError\",\n /**\n * Error is thrown when an operator intervened to close the connection for some reason.\n */\n \"amqp:connection:forced\" = \"ConnectionForcedError\", // Retryable\n /**\n * Error is thrown when a valid frame header cannot be formed from the incoming byte stream.\n */\n \"amqp:connection:framing-error\" = \"FramingError\",\n /**\n * Error is thrown when the container is no longer available on the current connection.\n */\n \"amqp:connection:redirect\" = \"ConnectionRedirectError\",\n /**\n * Error is thrown when the server is busy. Callers should wait a while and retry the operation.\n */\n \"com.microsoft:server-busy\" = \"ServerBusyError\", // Retryable\n /**\n * Error is thrown when an incorrect argument was received.\n */\n \"com.microsoft:argument-error\" = \"ArgumentError\",\n /**\n * Error is thrown when server cancels the operation due to an internal issue.\n */\n \"com.microsoft:operation-cancelled\" = \"OperationCancelledError\", // Retryable\n /**\n * Error is thrown when the client sender does not have enough link credits to send the message.\n */\n \"client.sender:not-enough-link-credit\" = \"SenderBusyError\", // Retryable\n /**\n * Error is thrown when the client sender's link isn't ready\n */\n \"client.sender:link-not-ready\" = \"SenderNotReadyError\", // Retryable\n\n /**\n * Error is thrown when a low level system error is thrown by node.js.\n * {@link https://nodejs.org/dist/latest-v8.x/docs/api/all.html#errors_class_system_error}\n */\n \"system:error\" = \"SystemError\",\n}\n\n/**\n * Maps the Error names to the amqp error conditions.\n */\nexport enum ErrorNameConditionMapper {\n /**\n * Error is thrown when the address is already in use.\n */\n AddressAlreadyInUseError = \"com.microsoft:address-already-in-use\",\n /**\n * Error is thrown when the store lock is lost.\n */\n StoreLockLostError = \"com.microsoft:store-lock-lost\",\n /**\n * Error is thrown when a matching subscription is not found.\n */\n NoMatchingSubscriptionError = \"com.microsoft:no-matching-subscription\",\n /**\n * Error is thrown when an attempt is made to access a partition that is not owned by the\n * requesting entity.\n */\n PartitionNotOwnedError = \"com.microsoft:partition-not-owned\",\n /**\n * Error is thrown when access to publisher has been revoked.\n */\n PublisherRevokedError = \"com.microsoft:publisher-revoked\",\n /**\n * Error is thrown when an attempt is made to create an entity that already exists.\n */\n MessagingEntityAlreadyExistsError = \"com.microsoft:entity-already-exists\",\n /**\n * Error is thrown when trying to access/connect to a disabled messaging entity.\n */\n MessagingEntityDisabledError = \"com.microsoft:entity-disabled\",\n /**\n * Error is thrown when the lock on the message is lost.\n */\n MessageLockLostError = \"com.microsoft:message-lock-lost\",\n /**\n * Error is thrown when the lock on the Azure ServiceBus session is lost.\n */\n SessionLockLostError = \"com.microsoft:session-lock-lost\",\n /**\n * Error is thrown when the Azure ServiceBus session cannot be locked.\n */\n SessionCannotBeLockedError = \"com.microsoft:session-cannot-be-locked\",\n /**\n * Error is thrown when an internal server error occurred. You may have found a bug?\n */\n InternalServerError = \"amqp:internal-error\", // Retryable\n /**\n * Error for signaling general communication errors related to messaging operations.\n */\n ServiceCommunicationError = \"amqp:not-found\",\n /**\n * Error is thrown when message is not found.\n */\n MessageNotFoundError = \"com.microsoft:message-not-found\",\n /**\n * Error is thrown when relay is not found.\n */\n RelayNotFoundError = \"com.microsoft:relay-not-found\",\n /**\n * Error is thrown when a feature is not implemented yet but the placeholder is present.\n */\n NotImplementedError = \"amqp:not-implemented\",\n /**\n * Error is thrown when an operation is attempted but is not allowed.\n */\n InvalidOperationError = \"amqp:not-allowed\",\n /**\n * Error is thrown the the Azure EventHub/ServiceBus quota has been exceeded.\n * Quotas are reset periodically, this operation will have to wait until then.\n * The messaging entity has reached its maximum allowable size.\n * This can happen if the maximum number of receivers (which is 5) has already\n * been opened on a per-consumer group level.\n */\n QuotaExceededError = \"amqp:resource-limit-exceeded\",\n /**\n * Error is thrown when the connection parameters are wrong and the server refused the connection.\n */\n UnauthorizedError = \"amqp:unauthorized-access\",\n /**\n * Error is thrown when the service is unavailable. The operation should be retried.\n */\n ServiceUnavailableError = \"com.microsoft:timeout\", // Retryable\n /**\n * Error is thrown when no new messages are received for the specified time.\n */\n MessageWaitTimeout = \"com.microsoft:message-wait-timeout\",\n /**\n * Error is thrown when an argument has a value that is out of the admissible range.\n */\n ArgumentOutOfRangeError = \"com.microsoft:argument-out-of-range\",\n /**\n * Error is thrown when a condition that should have been met in order to execute an operation was not.\n */\n PreconditionFailedError = \"amqp:precondition-failed\",\n /**\n * Error is thrown when data could not be decoded.\n */\n DecodeError = \"amqp:decode-error\",\n /**\n * Error is thrown when an invalid field was passed in a frame body, and the operation could not proceed.\n */\n InvalidFieldError = \"amqp:invalid-field\",\n /**\n * Error is thrown when the client attempted to work with a server entity to which it\n * has no access because another client is working with it.\n */\n ResourceLockedError = \"amqp:resource-locked\",\n /**\n * Error is thrown when a server entity the client is working with has been deleted.\n */\n ResourceDeletedError = \"amqp:resource-deleted\",\n /**\n * Error is thrown when the peer sent a frame that is not permitted in the current state.\n */\n IllegalStateError = \"amqp:illegal-state\",\n /**\n * Error is thrown when the peer cannot send a frame because the smallest encoding of\n * the performative with the currently valid values would be too large to fit within\n * a frame of the agreed maximum frame size.\n */\n FrameSizeTooSmallError = \"amqp:frame-size-too-small\",\n /**\n * Error is thrown when an operator intervened to detach for some reason.\n */\n DetachForcedError = \"amqp:link:detach-forced\", // Retryable\n /**\n * Error is thrown when the peer sent more message transfers than currently allowed on the link.\n */\n TransferLimitExceededError = \"amqp:link:transfer-limit-exceeded\", // Retryable\n /**\n * Error is thrown when the message sent is too large: the maximum size is 256Kb.\n */\n MessageTooLargeError = \"amqp:link:message-size-exceeded\",\n /**\n * Error is thrown when the address provided cannot be resolved to a terminus at the current container.\n */\n LinkRedirectError = \"amqp:link:redirect\",\n /**\n * Error is thrown when two or more instances connect to the same partition\n * with different epoch values.\n */\n ReceiverDisconnectedError = \"amqp:link:stolen\",\n /**\n * Error is thrown when the peer violated incoming window for the session.\n */\n SessionWindowViolationError = \"amqp:session:window-violation\",\n /**\n * Error is thrown when input was received for a link that was detached with an error.\n */\n ErrantLinkError = \"amqp:session:errant-link\",\n /**\n * Error is thrown when an attach was received using a handle that is already in use for an attached link.\n */\n HandleInUseError = \"amqp:session:handle-in-use\",\n /**\n * Error is thrown when a frame (other than attach) was received referencing a handle which is not\n * currently in use of an attached link.\n */\n UnattachedHandleError = \"amqp:session:unattached-handle\",\n /**\n * Error is thrown when an operator intervened to close the connection for some reason.\n */\n ConnectionForcedError = \"amqp:connection:forced\", // Retryable\n /**\n * Error is thrown when a valid frame header cannot be formed from the incoming byte stream.\n */\n FramingError = \"amqp:connection:framing-error\",\n /**\n * Error is thrown when the container is no longer available on the current connection.\n */\n ConnectionRedirectError = \"amqp:connection:redirect\",\n /**\n * Error is thrown when the server is busy. Callers should wait a while and retry the operation.\n */\n ServerBusyError = \"com.microsoft:server-busy\", // Retryable\n /**\n * Error is thrown when an incorrect argument was received.\n */\n ArgumentError = \"com.microsoft:argument-error\",\n /**\n * Error is thrown when server cancels the operation due to an internal issue.\n */\n OperationCancelledError = \"com.microsoft:operation-cancelled\", // Retryable\n /**\n * Error is thrown when the client sender does not have enough link credits to send the message.\n */\n SenderBusyError = \"client.sender:not-enough-link-credit\", // Retryable\n /**\n * Error is thrown when the client sender's link isn't ready\n */\n SenderNotReadyError = \"client.sender:link-not-ready\", // Retryable\n /**\n * Error is thrown when a low level system error is thrown by node.js.\n * {@link https://nodejs.org/api/errors.html#errors_class_systemerror}\n */\n SystemError = \"system:error\",\n}\n\n/**\n * Describes the fields on a Node.js SystemError.\n * Omits fields that are not related to network calls (e.g. file system calls).\n * See https://nodejs.org/dist/latest-v12.x/docs/api/errors.html#errors_class_systemerror\n */\nexport interface NetworkSystemError {\n address?: string;\n code: string;\n errno: string | number;\n info?: any;\n message: string;\n name: string;\n port?: number;\n stack: string;\n syscall: string;\n}\n\n/**\n * @internal\n */\nconst systemErrorFieldsToCopy: (keyof Omit<NetworkSystemError, \"name\" | \"message\">)[] = [\n \"address\",\n \"code\",\n \"errno\",\n \"info\",\n \"port\",\n \"stack\",\n \"syscall\",\n];\n\n/**\n * Determines if an error is a MessagingError.\n *\n * @param error - An error that can either be an Error or a MessagingError.\n */\nexport function isMessagingError(error: Error | MessagingError): error is MessagingError {\n return error.name === \"MessagingError\";\n}\n\n/**\n * Describes the base class for Messaging Error.\n */\nexport class MessagingError extends Error {\n /**\n * Address to which the network connection failed.\n * Only present if the `MessagingError` was instantiated with a Node.js `SystemError`.\n */\n address?: string;\n /**\n * A string label that identifies the error.\n */\n code?: string;\n /**\n * System-provided error number.\n * Only present if the `MessagingError` was instantiated with a Node.js `SystemError`.\n */\n errno?: number | string;\n /**\n * The error name. Default value: \"MessagingError\".\n */\n name: string = \"MessagingError\";\n /**\n * The unavailable network connection port.\n * Only present if the `MessagingError` was instantiated with a Node.js `SystemError`.\n */\n port?: number;\n /**\n * Name of the system call that triggered the error.\n * Only present if the `MessagingError` was instantiated with a Node.js `SystemError`.\n */\n syscall?: string;\n /**\n *\n * Describes whether the error is retryable. Default: true.\n */\n retryable: boolean = true;\n /**\n * Extra details about the error.\n */\n info?: any;\n /**\n * @param message - The error message that provides more information about the error.\n * @param originalError - An error whose properties will be copied to the MessagingError if the\n * property matches one found on the Node.js `SystemError`.\n */\n constructor(message: string, originalError?: Error) {\n super(message);\n\n if (!originalError) {\n return;\n }\n\n // copy properties from system error\n for (const propName of systemErrorFieldsToCopy) {\n if ((originalError as NetworkSystemError)[propName] != undefined) {\n this[propName] = (originalError as NetworkSystemError)[propName];\n }\n }\n }\n}\n\n/**\n * Provides a list of retryable AMQP errors.\n * \"InternalServerError\", \"ServerBusyError\", \"ServiceUnavailableError\", \"OperationCancelledError\",\n * \"SenderBusyError\", \"SenderNotReadyError\", \"MessagingError\", \"DetachForcedError\", \"ConnectionForcedError\",\n * \"TransferLimitExceededError\"\n */\nexport const retryableErrors: string[] = [\n \"InternalServerError\",\n \"ServerBusyError\",\n \"ServiceUnavailableError\",\n \"OperationCancelledError\",\n\n // The service may throw UnauthorizedError if credentials have been rotated.\n // Attempt to retry in case the user has also rotated their credentials.\n \"UnauthorizedError\",\n\n // OperationTimeoutError occurs when the service fails to respond within a given timeframe.\n // Since reasons for such failures can be transient, this is treated as a retryable error.\n \"OperationTimeoutError\",\n\n \"SenderBusyError\",\n \"SenderNotReadyError\",\n \"MessagingError\",\n \"DetachForcedError\",\n \"ConnectionForcedError\",\n \"TransferLimitExceededError\",\n\n // InsufficientCreditError occurs when the number of credits available on Rhea link is insufficient.\n // Since reasons for such shortage can be transient such as for pending delivery of messages, this is treated as a retryable error.\n \"InsufficientCreditError\",\n];\n\n/**\n * Maps some SystemErrors to amqp error conditions\n */\nexport enum SystemErrorConditionMapper {\n /* eslint-disable @typescript-eslint/no-duplicate-enum-values */\n ENOTFOUND = \"amqp:not-found\",\n EBUSY = \"com.microsoft:server-busy\",\n ECONNREFUSED = \"amqp:connection:forced\",\n ETIMEDOUT = \"com.microsoft:timeout\",\n ECONNRESET = \"com.microsoft:timeout\",\n ENETDOWN = \"com.microsoft:timeout\",\n EHOSTDOWN = \"com.microsoft:timeout\",\n ENETRESET = \"com.microsoft:timeout\",\n ENETUNREACH = \"com.microsoft:timeout\",\n ENONET = \"com.microsoft:timeout\",\n /* eslint-enable @typescript-eslint/no-duplicate-enum-values */\n}\n\n/**\n * Checks whether the provided error is a node.js SystemError.\n * @param err - An object that may contain error information.\n */\nexport function isSystemError(err: unknown): err is NetworkSystemError {\n if (!isObjectWithProperties(err, [\"code\", \"syscall\", \"errno\"])) {\n return false;\n }\n\n if (!isString(err.code) || !isString(err.syscall)) {\n return false;\n }\n\n if (!isString(err.errno) && !isNumber(err.errno)) {\n return false;\n }\n\n return true;\n}\n\n/**\n * @internal\n * Since browser doesn't differentiate between the various kinds of service communication errors,\n * this utility is used to look at the error target to identify such category of errors.\n * For more information refer to - https://html.spec.whatwg.org/multipage/comms.html#feedback-from-the-protocol\n * @param err - object that may contain error information\n */\nfunction isBrowserWebsocketError(err: any): boolean {\n let result: boolean = false;\n if (\n !isNodeLike &&\n self &&\n err.type === \"error\" &&\n err.target instanceof (self as any).WebSocket\n ) {\n result = true;\n }\n return result;\n}\n\n/**\n * @internal\n * Checks whether a object is an ErrorEvent or not. https://html.spec.whatwg.org/multipage/webappapis.html#errorevent\n * @param err - object that may contain error information\n */\nfunction isErrorEvent(err: any): err is { message: string; error: any } {\n return typeof err.error === \"object\" && typeof err.message === \"string\";\n}\n\n/**\n * @internal\n */\nconst rheaPromiseErrors = [\n // OperationTimeoutError occurs when the service fails to respond within a given timeframe.\n \"OperationTimeoutError\",\n\n // InsufficientCreditError occurs when the number of credits available on Rhea link is insufficient.\n \"InsufficientCreditError\",\n\n // Defines the error that occurs when the Sender fails to send a message.\n \"SendOperationFailedError\",\n];\n\n/**\n * Translates the AMQP error received at the protocol layer or a SystemError into a MessagingError.\n * All other errors are returned unaltered.\n *\n * @param err - The amqp error that was received.\n * @returns MessagingError object.\n */\nexport function translate(err: unknown): MessagingError | Error {\n if (!isDefined(err)) {\n return new Error(`Unknown error encountered.`);\n } else if (typeof err !== \"object\") {\n // The error is a scalar type, make it the message of an actual error.\n return new Error(String(err));\n }\n\n const errObj = isErrorEvent(err) ? err.error : err;\n\n // Built-in errors like TypeError and RangeError should not be retryable as these indicate issues\n // with user input and not an issue with the Messaging process.\n if (errObj instanceof TypeError || errObj instanceof RangeError) {\n return errObj;\n }\n\n if (isAmqpError(errObj)) {\n // translate\n const condition = errObj.condition;\n const description = errObj.description!;\n const error = new MessagingError(description);\n if ((errObj as any).stack) error.stack = (errObj as any).stack;\n error.info = errObj.info;\n if (condition) {\n error.code = ConditionErrorNameMapper[condition as keyof typeof ConditionErrorNameMapper];\n }\n if (\n description &&\n (description.includes(\"status-code: 404\") ||\n description.match(/The messaging entity .* could not be found.*/i) !== null)\n ) {\n error.code = \"MessagingEntityNotFoundError\";\n }\n if (error.code && retryableErrors.indexOf(error.code) === -1) {\n // not found\n error.retryable = false;\n }\n return error;\n }\n\n if (errObj instanceof Error && errObj.name === \"MessagingError\") {\n // already translated\n return errObj;\n }\n\n if (isSystemError(errObj)) {\n // translate\n const condition = errObj.code;\n const description = errObj.message;\n const error = new MessagingError(description, errObj);\n let errorType = \"SystemError\";\n if (condition) {\n const amqpErrorCondition =\n SystemErrorConditionMapper[condition as keyof typeof SystemErrorConditionMapper];\n errorType =\n ConditionErrorNameMapper[amqpErrorCondition as keyof typeof ConditionErrorNameMapper];\n }\n if (retryableErrors.indexOf(errorType) === -1) {\n // not found\n error.retryable = false;\n }\n return error;\n }\n\n if (isBrowserWebsocketError(errObj)) {\n // Translate browser communication errors during opening handshake to generic ServiceCommunicationError\n const error = new MessagingError(\"Websocket connection failed.\");\n error.code = ConditionErrorNameMapper[ErrorNameConditionMapper.ServiceCommunicationError];\n error.retryable = false;\n return error;\n }\n\n // Some errors come from rhea-promise and need to be converted to MessagingError.\n // A subset of these are also retryable.\n if (isError(errObj) && rheaPromiseErrors.indexOf(errObj.name) !== -1) {\n const error = new MessagingError(errObj.message, errObj);\n error.code = errObj.name;\n if (error.code && retryableErrors.indexOf(error.code) === -1) {\n // not found\n error.retryable = false;\n }\n return error;\n }\n\n return isError(errObj) ? errObj : new Error(String(errObj));\n}\n\n/**\n * @internal\n */\nfunction isAmqpError(error: any): error is AmqpError {\n return rhea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AO,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;AAC9D,CAAC;AAED;;GAEG;AACH,SAAS,WAAW,CAAC,KAAU;IAC7B,OAAO,eAAe,CAAC,KAAK,CAAC,CAAC;AAChC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n/* eslint-disable eqeqeq */\n\nimport type { AmqpError } from \"rhea-promise\";\nimport { AmqpResponseStatusCode, isAmqpError as rheaIsAmqpError } from \"rhea-promise\";\nimport { isDefined, isError, isNodeLike, isObjectWithProperties } from \"@azure/core-util\";\nimport { isNumber, isString } from \"./util/utils.js\";\n\n/**\n * Maps the conditions to the numeric AMQP Response status codes.\n * @internal\n */\nexport enum ConditionStatusMapper {\n \"com.microsoft:timeout\" = AmqpResponseStatusCode.RequestTimeout,\n \"amqp:not-found\" = AmqpResponseStatusCode.NotFound,\n \"amqp:not-implemented\" = AmqpResponseStatusCode.NotImplemented,\n \"com.microsoft:entity-already-exists\" = AmqpResponseStatusCode.Conflict,\n \"com.microsoft:message-lock-lost\" = AmqpResponseStatusCode.Gone,\n \"com.microsoft:session-lock-lost\" = AmqpResponseStatusCode.Gone,\n \"com.microsoft:no-matching-subscription\" = AmqpResponseStatusCode.InternalServerError,\n \"amqp:link:message-size-exceeded\" = AmqpResponseStatusCode.Forbidden,\n \"com.microsoft:server-busy\" = AmqpResponseStatusCode.ServiceUnavailable,\n \"com.microsoft:argument-error\" = AmqpResponseStatusCode.BadRequest,\n \"com.microsoft:argument-out-of-range\" = AmqpResponseStatusCode.BadRequest,\n \"com.microsoft:store-lock-lost\" = AmqpResponseStatusCode.Gone,\n \"com.microsoft:session-cannot-be-locked\" = AmqpResponseStatusCode.Gone,\n \"com.microsoft:partition-not-owned\" = AmqpResponseStatusCode.Gone,\n \"com.microsoft:entity-disabled\" = AmqpResponseStatusCode.BadRequest,\n \"com.microsoft:publisher-revoked\" = AmqpResponseStatusCode.Unauthorized,\n \"amqp:link:stolen\" = AmqpResponseStatusCode.Gone,\n \"amqp:not-allowed\" = AmqpResponseStatusCode.BadRequest,\n \"amqp:unauthorized-access\" = AmqpResponseStatusCode.Unauthorized,\n \"amqp:resource-limit-exceeded\" = AmqpResponseStatusCode.Forbidden,\n}\n\n/**\n * Maps the amqp error conditions to the Error names.\n */\nexport enum ConditionErrorNameMapper {\n /**\n * Error is thrown when the address is already in use.\n */\n \"com.microsoft:address-already-in-use\" = \"AddressAlreadyInUseError\",\n /**\n * Error is thrown when the store lock is lost.\n */\n \"com.microsoft:store-lock-lost\" = \"StoreLockLostError\",\n /**\n * Error is thrown when a matching subscription is not found.\n */\n \"com.microsoft:no-matching-subscription\" = \"NoMatchingSubscriptionError\",\n /**\n * Error is thrown when an attempt is made to access a partition that is not owned by the\n * requesting entity.\n */\n \"com.microsoft:partition-not-owned\" = \"PartitionNotOwnedError\",\n /**\n * Error is thrown when access to publisher has been revoked.\n */\n \"com.microsoft:publisher-revoked\" = \"PublisherRevokedError\",\n /**\n * Error is thrown when an attempt is made to create an entity that already exists.\n */\n \"com.microsoft:entity-already-exists\" = \"MessagingEntityAlreadyExistsError\",\n /**\n * Error is thrown when trying to access/connect to a disabled messaging entity.\n */\n \"com.microsoft:entity-disabled\" = \"MessagingEntityDisabledError\",\n /**\n * Error is thrown when the lock on the message is lost.\n */\n \"com.microsoft:message-lock-lost\" = \"MessageLockLostError\",\n /**\n * Error is thrown when the lock on the Azure ServiceBus session is lost.\n */\n \"com.microsoft:session-lock-lost\" = \"SessionLockLostError\",\n /**\n * Error is thrown when the Azure ServiceBus session cannot be locked.\n */\n \"com.microsoft:session-cannot-be-locked\" = \"SessionCannotBeLockedError\",\n /**\n * Error is thrown when an internal server error occurred. You may have found a bug?\n */\n \"amqp:internal-error\" = \"InternalServerError\", // Retryable\n /**\n * Error for signaling general communication errors related to messaging operations.\n */\n \"amqp:not-found\" = \"ServiceCommunicationError\",\n /**\n * Error is thrown when the message is not found.\n */\n \"com.microsoft:message-not-found\" = \"MessageNotFoundError\",\n /**\n * Error is thrown when relay is not found.\n */\n \"com.microsoft:relay-not-found\" = \"RelayNotFoundError\",\n /**\n * Error is thrown when a feature is not implemented yet but the placeholder is present.\n */\n \"amqp:not-implemented\" = \"NotImplementedError\",\n /**\n * Error is thrown when an operation is attempted but is not allowed.\n */\n \"amqp:not-allowed\" = \"InvalidOperationError\",\n /**\n * Error is thrown the the Azure EventHub/ServiceBus quota has been exceeded.\n * Quotas are reset periodically, this operation will have to wait until then.\n * The messaging entity has reached its maximum allowable size.\n * This can happen if the maximum number of receivers (which is 5) has already\n * been opened on a per-consumer group level.\n */\n \"amqp:resource-limit-exceeded\" = \"QuotaExceededError\",\n /**\n * Error is thrown when the connection parameters are wrong and the server refused the connection.\n */\n \"amqp:unauthorized-access\" = \"UnauthorizedError\",\n /**\n * Error is thrown when the connection parameters are wrong and the server refused the connection.\n */\n // eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values\n \"com.microsoft:auth-failed\" = \"UnauthorizedError\",\n /**\n * Error is thrown when the service is unavailable. The operation should be retried.\n */\n \"com.microsoft:timeout\" = \"ServiceUnavailableError\", // Retryable\n /**\n * Error is thrown when no new messages are received for the specified time.\n */\n \"com.microsoft:message-wait-timeout\" = \"MessageWaitTimeout\",\n /**\n * Error is thrown when an argument has a value that is out of the admissible range.\n */\n \"com.microsoft:argument-out-of-range\" = \"ArgumentOutOfRangeError\",\n /**\n * Error is thrown when a condition that should have been met in order to execute an operation was not.\n */\n \"amqp:precondition-failed\" = \"PreconditionFailedError\",\n /**\n * Error is thrown when a condition that should have been met in order to execute an operation was not.\n */\n // eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values\n \"com.microsoft:precondition-failed\" = \"PreconditionFailedError\",\n /**\n * Error is thrown when data could not be decoded.\n */\n \"amqp:decode-error\" = \"DecodeError\",\n /**\n * Error is thrown when an invalid field was passed in a frame body, and the operation could not proceed.\n */\n \"amqp:invalid-field\" = \"InvalidFieldError\",\n /**\n * Error is thrown when the client attempted to work with a server entity to which it\n * has no access because another client is working with it.\n */\n \"amqp:resource-locked\" = \"ResourceLockedError\",\n /**\n * Error is thrown when a server entity the client is working with has been deleted.\n */\n \"amqp:resource-deleted\" = \"ResourceDeletedError\",\n /**\n * Error is thrown when the peer sent a frame that is not permitted in the current state.\n */\n \"amqp:illegal-state\" = \"IllegalStateError\",\n /**\n * Error is thrown when the peer cannot send a frame because the smallest encoding of\n * the performative with the currently valid values would be too large to fit within\n * a frame of the agreed maximum frame size.\n */\n \"amqp:frame-size-too-small\" = \"FrameSizeTooSmallError\",\n /**\n * Error is thrown when an operator intervened to detach for some reason.\n */\n \"amqp:link:detach-forced\" = \"DetachForcedError\", // Retryable\n /**\n * Error is thrown when the peer sent more message transfers than currently allowed on the link.\n */\n \"amqp:link:transfer-limit-exceeded\" = \"TransferLimitExceededError\", // Retryable\n /**\n * Error is thrown when the message sent is too large: the maximum size is 256Kb.\n */\n \"amqp:link:message-size-exceeded\" = \"MessageTooLargeError\",\n /**\n * Error is thrown when the address provided cannot be resolved to a terminus at the current container.\n */\n \"amqp:link:redirect\" = \"LinkRedirectError\",\n /**\n * Error is thrown when two or more instances connect to the same partition\n * with different epoch values.\n */\n \"amqp:link:stolen\" = \"ReceiverDisconnectedError\",\n /**\n * Error is thrown when the peer violated incoming window for the session.\n */\n \"amqp:session:window-violation\" = \"SessionWindowViolationError\",\n /**\n * Error is thrown when input was received for a link that was detached with an error.\n */\n \"amqp:session:errant-link\" = \"ErrantLinkError\",\n /**\n * Error is thrown when an attach was received using a handle that is already in use for an attached link.\n */\n \"amqp:session:handle-in-use\" = \"HandleInUseError\",\n /**\n * Error is thrown when a frame (other than attach) was received referencing a handle which is not\n * currently in use of an attached link.\n */\n \"amqp:session:unattached-handle\" = \"UnattachedHandleError\",\n /**\n * Error is thrown when an operator intervened to close the connection for some reason.\n */\n \"amqp:connection:forced\" = \"ConnectionForcedError\", // Retryable\n /**\n * Error is thrown when a valid frame header cannot be formed from the incoming byte stream.\n */\n \"amqp:connection:framing-error\" = \"FramingError\",\n /**\n * Error is thrown when the container is no longer available on the current connection.\n */\n \"amqp:connection:redirect\" = \"ConnectionRedirectError\",\n /**\n * Error is thrown when the server is busy. Callers should wait a while and retry the operation.\n */\n \"com.microsoft:server-busy\" = \"ServerBusyError\", // Retryable\n /**\n * Error is thrown when an incorrect argument was received.\n */\n \"com.microsoft:argument-error\" = \"ArgumentError\",\n /**\n * Error is thrown when server cancels the operation due to an internal issue.\n */\n \"com.microsoft:operation-cancelled\" = \"OperationCancelledError\", // Retryable\n /**\n * Error is thrown when the client sender does not have enough link credits to send the message.\n */\n \"client.sender:not-enough-link-credit\" = \"SenderBusyError\", // Retryable\n /**\n * Error is thrown when the client sender's link isn't ready\n */\n \"client.sender:link-not-ready\" = \"SenderNotReadyError\", // Retryable\n\n /**\n * Error is thrown when a low level system error is thrown by node.js.\n * {@link https://nodejs.org/dist/latest-v8.x/docs/api/all.html#errors_class_system_error}\n */\n \"system:error\" = \"SystemError\",\n}\n\n/**\n * Maps the Error names to the amqp error conditions.\n */\nexport enum ErrorNameConditionMapper {\n /**\n * Error is thrown when the address is already in use.\n */\n AddressAlreadyInUseError = \"com.microsoft:address-already-in-use\",\n /**\n * Error is thrown when the store lock is lost.\n */\n StoreLockLostError = \"com.microsoft:store-lock-lost\",\n /**\n * Error is thrown when a matching subscription is not found.\n */\n NoMatchingSubscriptionError = \"com.microsoft:no-matching-subscription\",\n /**\n * Error is thrown when an attempt is made to access a partition that is not owned by the\n * requesting entity.\n */\n PartitionNotOwnedError = \"com.microsoft:partition-not-owned\",\n /**\n * Error is thrown when access to publisher has been revoked.\n */\n PublisherRevokedError = \"com.microsoft:publisher-revoked\",\n /**\n * Error is thrown when an attempt is made to create an entity that already exists.\n */\n MessagingEntityAlreadyExistsError = \"com.microsoft:entity-already-exists\",\n /**\n * Error is thrown when trying to access/connect to a disabled messaging entity.\n */\n MessagingEntityDisabledError = \"com.microsoft:entity-disabled\",\n /**\n * Error is thrown when the lock on the message is lost.\n */\n MessageLockLostError = \"com.microsoft:message-lock-lost\",\n /**\n * Error is thrown when the lock on the Azure ServiceBus session is lost.\n */\n SessionLockLostError = \"com.microsoft:session-lock-lost\",\n /**\n * Error is thrown when the Azure ServiceBus session cannot be locked.\n */\n SessionCannotBeLockedError = \"com.microsoft:session-cannot-be-locked\",\n /**\n * Error is thrown when an internal server error occurred. You may have found a bug?\n */\n InternalServerError = \"amqp:internal-error\", // Retryable\n /**\n * Error for signaling general communication errors related to messaging operations.\n */\n ServiceCommunicationError = \"amqp:not-found\",\n /**\n * Error is thrown when message is not found.\n */\n MessageNotFoundError = \"com.microsoft:message-not-found\",\n /**\n * Error is thrown when relay is not found.\n */\n RelayNotFoundError = \"com.microsoft:relay-not-found\",\n /**\n * Error is thrown when a feature is not implemented yet but the placeholder is present.\n */\n NotImplementedError = \"amqp:not-implemented\",\n /**\n * Error is thrown when an operation is attempted but is not allowed.\n */\n InvalidOperationError = \"amqp:not-allowed\",\n /**\n * Error is thrown the the Azure EventHub/ServiceBus quota has been exceeded.\n * Quotas are reset periodically, this operation will have to wait until then.\n * The messaging entity has reached its maximum allowable size.\n * This can happen if the maximum number of receivers (which is 5) has already\n * been opened on a per-consumer group level.\n */\n QuotaExceededError = \"amqp:resource-limit-exceeded\",\n /**\n * Error is thrown when the connection parameters are wrong and the server refused the connection.\n */\n UnauthorizedError = \"amqp:unauthorized-access\",\n /**\n * Error is thrown when the service is unavailable. The operation should be retried.\n */\n ServiceUnavailableError = \"com.microsoft:timeout\", // Retryable\n /**\n * Error is thrown when no new messages are received for the specified time.\n */\n MessageWaitTimeout = \"com.microsoft:message-wait-timeout\",\n /**\n * Error is thrown when an argument has a value that is out of the admissible range.\n */\n ArgumentOutOfRangeError = \"com.microsoft:argument-out-of-range\",\n /**\n * Error is thrown when a condition that should have been met in order to execute an operation was not.\n */\n PreconditionFailedError = \"amqp:precondition-failed\",\n /**\n * Error is thrown when data could not be decoded.\n */\n DecodeError = \"amqp:decode-error\",\n /**\n * Error is thrown when an invalid field was passed in a frame body, and the operation could not proceed.\n */\n InvalidFieldError = \"amqp:invalid-field\",\n /**\n * Error is thrown when the client attempted to work with a server entity to which it\n * has no access because another client is working with it.\n */\n ResourceLockedError = \"amqp:resource-locked\",\n /**\n * Error is thrown when a server entity the client is working with has been deleted.\n */\n ResourceDeletedError = \"amqp:resource-deleted\",\n /**\n * Error is thrown when the peer sent a frame that is not permitted in the current state.\n */\n IllegalStateError = \"amqp:illegal-state\",\n /**\n * Error is thrown when the peer cannot send a frame because the smallest encoding of\n * the performative with the currently valid values would be too large to fit within\n * a frame of the agreed maximum frame size.\n */\n FrameSizeTooSmallError = \"amqp:frame-size-too-small\",\n /**\n * Error is thrown when an operator intervened to detach for some reason.\n */\n DetachForcedError = \"amqp:link:detach-forced\", // Retryable\n /**\n * Error is thrown when the peer sent more message transfers than currently allowed on the link.\n */\n TransferLimitExceededError = \"amqp:link:transfer-limit-exceeded\", // Retryable\n /**\n * Error is thrown when the message sent is too large: the maximum size is 256Kb.\n */\n MessageTooLargeError = \"amqp:link:message-size-exceeded\",\n /**\n * Error is thrown when the address provided cannot be resolved to a terminus at the current container.\n */\n LinkRedirectError = \"amqp:link:redirect\",\n /**\n * Error is thrown when two or more instances connect to the same partition\n * with different epoch values.\n */\n ReceiverDisconnectedError = \"amqp:link:stolen\",\n /**\n * Error is thrown when the peer violated incoming window for the session.\n */\n SessionWindowViolationError = \"amqp:session:window-violation\",\n /**\n * Error is thrown when input was received for a link that was detached with an error.\n */\n ErrantLinkError = \"amqp:session:errant-link\",\n /**\n * Error is thrown when an attach was received using a handle that is already in use for an attached link.\n */\n HandleInUseError = \"amqp:session:handle-in-use\",\n /**\n * Error is thrown when a frame (other than attach) was received referencing a handle which is not\n * currently in use of an attached link.\n */\n UnattachedHandleError = \"amqp:session:unattached-handle\",\n /**\n * Error is thrown when an operator intervened to close the connection for some reason.\n */\n ConnectionForcedError = \"amqp:connection:forced\", // Retryable\n /**\n * Error is thrown when a valid frame header cannot be formed from the incoming byte stream.\n */\n FramingError = \"amqp:connection:framing-error\",\n /**\n * Error is thrown when the container is no longer available on the current connection.\n */\n ConnectionRedirectError = \"amqp:connection:redirect\",\n /**\n * Error is thrown when the server is busy. Callers should wait a while and retry the operation.\n */\n ServerBusyError = \"com.microsoft:server-busy\", // Retryable\n /**\n * Error is thrown when an incorrect argument was received.\n */\n ArgumentError = \"com.microsoft:argument-error\",\n /**\n * Error is thrown when server cancels the operation due to an internal issue.\n */\n OperationCancelledError = \"com.microsoft:operation-cancelled\", // Retryable\n /**\n * Error is thrown when the client sender does not have enough link credits to send the message.\n */\n SenderBusyError = \"client.sender:not-enough-link-credit\", // Retryable\n /**\n * Error is thrown when the client sender's link isn't ready\n */\n SenderNotReadyError = \"client.sender:link-not-ready\", // Retryable\n /**\n * Error is thrown when a low level system error is thrown by node.js.\n * {@link https://nodejs.org/api/errors.html#errors_class_systemerror}\n */\n SystemError = \"system:error\",\n}\n\n/**\n * Describes the fields on a Node.js SystemError.\n * Omits fields that are not related to network calls (e.g. file system calls).\n * See https://nodejs.org/dist/latest-v12.x/docs/api/errors.html#errors_class_systemerror\n */\nexport interface NetworkSystemError {\n address?: string;\n code: string;\n errno: string | number;\n info?: any;\n message: string;\n name: string;\n port?: number;\n stack: string;\n syscall: string;\n}\n\n/**\n * @internal\n */\nconst systemErrorFieldsToCopy: (keyof Omit<NetworkSystemError, \"name\" | \"message\">)[] = [\n \"address\",\n \"code\",\n \"errno\",\n \"info\",\n \"port\",\n \"stack\",\n \"syscall\",\n];\n\n/**\n * Determines if an error is a MessagingError.\n *\n * @param error - An error that can either be an Error or a MessagingError.\n */\nexport function isMessagingError(error: Error | MessagingError): error is MessagingError {\n return error.name === \"MessagingError\";\n}\n\n/**\n * Describes the base class for Messaging Error.\n */\nexport class MessagingError extends Error {\n /**\n * Address to which the network connection failed.\n * Only present if the `MessagingError` was instantiated with a Node.js `SystemError`.\n */\n address?: string;\n /**\n * A string label that identifies the error.\n */\n code?: string;\n /**\n * System-provided error number.\n * Only present if the `MessagingError` was instantiated with a Node.js `SystemError`.\n */\n errno?: number | string;\n /**\n * The error name. Default value: \"MessagingError\".\n */\n name: string = \"MessagingError\";\n /**\n * The unavailable network connection port.\n * Only present if the `MessagingError` was instantiated with a Node.js `SystemError`.\n */\n port?: number;\n /**\n * Name of the system call that triggered the error.\n * Only present if the `MessagingError` was instantiated with a Node.js `SystemError`.\n */\n syscall?: string;\n /**\n *\n * Describes whether the error is retryable. Default: true.\n */\n retryable: boolean = true;\n /**\n * Extra details about the error.\n */\n info?: any;\n /**\n * @param message - The error message that provides more information about the error.\n * @param originalError - An error whose properties will be copied to the MessagingError if the\n * property matches one found on the Node.js `SystemError`.\n */\n constructor(message: string, originalError?: Error) {\n super(message);\n\n if (!originalError) {\n return;\n }\n\n // copy properties from system error\n for (const propName of systemErrorFieldsToCopy) {\n if ((originalError as NetworkSystemError)[propName] != undefined) {\n this[propName] = (originalError as NetworkSystemError)[propName];\n }\n }\n }\n}\n\n/**\n * Provides a list of retryable AMQP errors.\n * \"InternalServerError\", \"ServerBusyError\", \"ServiceUnavailableError\", \"OperationCancelledError\",\n * \"SenderBusyError\", \"SenderNotReadyError\", \"MessagingError\", \"DetachForcedError\", \"ConnectionForcedError\",\n * \"TransferLimitExceededError\"\n */\nexport const retryableErrors: string[] = [\n \"InternalServerError\",\n \"ServerBusyError\",\n \"ServiceUnavailableError\",\n \"OperationCancelledError\",\n\n // The service may throw UnauthorizedError if credentials have been rotated.\n // Attempt to retry in case the user has also rotated their credentials.\n \"UnauthorizedError\",\n\n // OperationTimeoutError occurs when the service fails to respond within a given timeframe.\n // Since reasons for such failures can be transient, this is treated as a retryable error.\n \"OperationTimeoutError\",\n\n \"SenderBusyError\",\n \"SenderNotReadyError\",\n \"MessagingError\",\n \"DetachForcedError\",\n \"ConnectionForcedError\",\n \"TransferLimitExceededError\",\n\n // InsufficientCreditError occurs when the number of credits available on Rhea link is insufficient.\n // Since reasons for such shortage can be transient such as for pending delivery of messages, this is treated as a retryable error.\n \"InsufficientCreditError\",\n];\n\n/**\n * Maps some SystemErrors to amqp error conditions\n */\nexport enum SystemErrorConditionMapper {\n /* eslint-disable @typescript-eslint/no-duplicate-enum-values */\n ENOTFOUND = \"amqp:not-found\",\n EBUSY = \"com.microsoft:server-busy\",\n ECONNREFUSED = \"amqp:connection:forced\",\n ETIMEDOUT = \"com.microsoft:timeout\",\n ECONNRESET = \"com.microsoft:timeout\",\n ENETDOWN = \"com.microsoft:timeout\",\n EHOSTDOWN = \"com.microsoft:timeout\",\n ENETRESET = \"com.microsoft:timeout\",\n ENETUNREACH = \"com.microsoft:timeout\",\n ENONET = \"com.microsoft:timeout\",\n EADDRNOTAVAIL = \"com.microsoft:timeout\",\n EAI_AGAIN = \"com.microsoft:timeout\",\n /* eslint-enable @typescript-eslint/no-duplicate-enum-values */\n}\n\n/**\n * Checks whether the provided error is a node.js SystemError.\n * @param err - An object that may contain error information.\n */\nexport function isSystemError(err: unknown): err is NetworkSystemError {\n if (!isObjectWithProperties(err, [\"code\", \"syscall\", \"errno\"])) {\n return false;\n }\n\n if (!isString(err.code) || !isString(err.syscall)) {\n return false;\n }\n\n if (!isString(err.errno) && !isNumber(err.errno)) {\n return false;\n }\n\n return true;\n}\n\n/**\n * @internal\n * Since browser doesn't differentiate between the various kinds of service communication errors,\n * this utility is used to look at the error target to identify such category of errors.\n * For more information refer to - https://html.spec.whatwg.org/multipage/comms.html#feedback-from-the-protocol\n * @param err - object that may contain error information\n */\nfunction isBrowserWebsocketError(err: any): boolean {\n let result: boolean = false;\n if (\n !isNodeLike &&\n self &&\n err.type === \"error\" &&\n err.target instanceof (self as any).WebSocket\n ) {\n result = true;\n }\n return result;\n}\n\n/**\n * @internal\n * Checks whether a object is an ErrorEvent or not. https://html.spec.whatwg.org/multipage/webappapis.html#errorevent\n * @param err - object that may contain error information\n */\nfunction isErrorEvent(err: any): err is { message: string; error: any } {\n return typeof err.error === \"object\" && typeof err.message === \"string\";\n}\n\n/**\n * @internal\n */\nconst rheaPromiseErrors = [\n // OperationTimeoutError occurs when the service fails to respond within a given timeframe.\n \"OperationTimeoutError\",\n\n // InsufficientCreditError occurs when the number of credits available on Rhea link is insufficient.\n \"InsufficientCreditError\",\n\n // Defines the error that occurs when the Sender fails to send a message.\n \"SendOperationFailedError\",\n];\n\n/**\n * Translates the AMQP error received at the protocol layer or a SystemError into a MessagingError.\n * All other errors are returned unaltered.\n *\n * @param err - The amqp error that was received.\n * @returns MessagingError object.\n */\nexport function translate(err: unknown): MessagingError | Error {\n if (!isDefined(err)) {\n return new Error(`Unknown error encountered.`);\n } else if (typeof err !== \"object\") {\n // The error is a scalar type, make it the message of an actual error.\n return new Error(String(err));\n }\n\n const errObj = isErrorEvent(err) ? err.error : err;\n\n // Built-in errors like TypeError and RangeError should not be retryable as these indicate issues\n // with user input and not an issue with the Messaging process.\n if (errObj instanceof TypeError || errObj instanceof RangeError) {\n return errObj;\n }\n\n if (isAmqpError(errObj)) {\n // translate\n const condition = errObj.condition;\n const description = errObj.description!;\n const error = new MessagingError(description);\n if ((errObj as any).stack) error.stack = (errObj as any).stack;\n error.info = errObj.info;\n if (condition) {\n error.code = ConditionErrorNameMapper[condition as keyof typeof ConditionErrorNameMapper];\n }\n if (\n description &&\n (description.includes(\"status-code: 404\") ||\n description.match(/The messaging entity .* could not be found.*/i) !== null)\n ) {\n error.code = \"MessagingEntityNotFoundError\";\n }\n if (error.code && retryableErrors.indexOf(error.code) === -1) {\n // not found\n error.retryable = false;\n }\n return error;\n }\n\n if (errObj instanceof Error && errObj.name === \"MessagingError\") {\n // already translated\n return errObj;\n }\n\n if (isSystemError(errObj)) {\n // translate\n const condition = errObj.code;\n const description = errObj.message;\n const error = new MessagingError(description, errObj);\n let errorType = \"SystemError\";\n if (condition) {\n const amqpErrorCondition =\n SystemErrorConditionMapper[condition as keyof typeof SystemErrorConditionMapper];\n errorType =\n ConditionErrorNameMapper[amqpErrorCondition as keyof typeof ConditionErrorNameMapper];\n }\n if (retryableErrors.indexOf(errorType) === -1) {\n // not found\n error.retryable = false;\n }\n return error;\n }\n\n if (isBrowserWebsocketError(errObj)) {\n // Translate browser communication errors during opening handshake to generic ServiceCommunicationError\n const error = new MessagingError(\"Websocket connection failed.\");\n error.code = ConditionErrorNameMapper[ErrorNameConditionMapper.ServiceCommunicationError];\n error.retryable = false;\n return error;\n }\n\n // Some errors come from rhea-promise and need to be converted to MessagingError.\n // A subset of these are also retryable.\n if (isError(errObj) && rheaPromiseErrors.indexOf(errObj.name) !== -1) {\n const error = new MessagingError(errObj.message, errObj);\n error.code = errObj.name;\n if (error.code && retryableErrors.indexOf(error.code) === -1) {\n // not found\n error.retryable = false;\n }\n return error;\n }\n\n return isError(errObj) ? errObj : new Error(String(errObj));\n}\n\n/**\n * @internal\n */\nfunction isAmqpError(error: any): error is AmqpError {\n return rheaIsAmqpError(error);\n}\n"]}
@@ -1,4 +1,3 @@
1
- /// <reference lib="es2020" />
2
1
  export { RequestResponseLink, SendRequestOptions } from "./requestResponseLink.js";
3
2
  export { retry, RetryOptions, RetryConfig, RetryOperationType, RetryMode } from "./retry.js";
4
3
  export { TokenType } from "./auth/token.js";
@@ -1,6 +1,5 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- /// <reference lib="es2020" />
2
+ // Licensed under the MIT License.
4
3
  export { RequestResponseLink } from "./requestResponseLink.js";
5
4
  export { retry, RetryOperationType, RetryMode } from "./retry.js";
6
5
  export { TokenType } from "./auth/token.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,8BAA8B;AAE9B,OAAO,EAAE,mBAAmB,EAAsB,MAAM,0BAA0B,CAAC;AACnF,OAAO,EAAE,KAAK,EAA6B,kBAAkB,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC7F,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAA2B,MAAM,wCAAwC,CAAC;AACnG,OAAO,EAAE,SAAS,EAAe,MAAM,UAAU,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EACL,qBAAqB,GAGtB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,wBAAwB,EACxB,wBAAwB,EACxB,SAAS,EACT,eAAe,EACf,aAAa,EACb,0BAA0B,GAE3B,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,KAAK,EACL,qBAAqB,EACrB,sBAAsB,GAGvB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,cAAc,gBAAgB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/// <reference lib=\"es2020\" />\n\nexport { RequestResponseLink, SendRequestOptions } from \"./requestResponseLink.js\";\nexport { retry, RetryOptions, RetryConfig, RetryOperationType, RetryMode } from \"./retry.js\";\nexport { TokenType } from \"./auth/token.js\";\nexport { ConnectionConfig, ConnectionConfigOptions } from \"./connectionConfig/connectionConfig.js\";\nexport { CbsClient, CbsResponse } from \"./cbs.js\";\nexport { Constants, StandardAbortMessage } from \"./util/constants.js\";\nexport { AmqpMessageHeader } from \"./messageHeader.js\";\nexport { AmqpMessageProperties } from \"./messageProperties.js\";\nexport {\n ConnectionContextBase,\n ConnectionProperties,\n CreateConnectionContextBaseParameters,\n} from \"./ConnectionContextBase.js\";\nexport {\n MessagingError,\n isMessagingError,\n ErrorNameConditionMapper,\n ConditionErrorNameMapper,\n translate,\n retryableErrors,\n isSystemError,\n SystemErrorConditionMapper,\n NetworkSystemError,\n} from \"./errors.js\";\nexport {\n delay,\n parseConnectionString,\n defaultCancellableLock,\n ParsedOutput,\n WebSocketOptions,\n} from \"./util/utils.js\";\nexport { AmqpAnnotatedMessage } from \"./amqpAnnotatedMessage.js\";\nexport { logger } from \"./log.js\";\nexport * from \"./internals.js\";\nexport { AcquireLockProperties, CancellableAsyncLock } from \"./util/lock.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,mBAAmB,EAAsB,MAAM,0BAA0B,CAAC;AACnF,OAAO,EAAE,KAAK,EAA6B,kBAAkB,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC7F,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAA2B,MAAM,wCAAwC,CAAC;AACnG,OAAO,EAAE,SAAS,EAAe,MAAM,UAAU,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EACL,qBAAqB,GAGtB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,wBAAwB,EACxB,wBAAwB,EACxB,SAAS,EACT,eAAe,EACf,aAAa,EACb,0BAA0B,GAE3B,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,KAAK,EACL,qBAAqB,EACrB,sBAAsB,GAGvB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,cAAc,gBAAgB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport { RequestResponseLink, SendRequestOptions } from \"./requestResponseLink.js\";\nexport { retry, RetryOptions, RetryConfig, RetryOperationType, RetryMode } from \"./retry.js\";\nexport { TokenType } from \"./auth/token.js\";\nexport { ConnectionConfig, ConnectionConfigOptions } from \"./connectionConfig/connectionConfig.js\";\nexport { CbsClient, CbsResponse } from \"./cbs.js\";\nexport { Constants, StandardAbortMessage } from \"./util/constants.js\";\nexport { AmqpMessageHeader } from \"./messageHeader.js\";\nexport { AmqpMessageProperties } from \"./messageProperties.js\";\nexport {\n ConnectionContextBase,\n ConnectionProperties,\n CreateConnectionContextBaseParameters,\n} from \"./ConnectionContextBase.js\";\nexport {\n MessagingError,\n isMessagingError,\n ErrorNameConditionMapper,\n ConditionErrorNameMapper,\n translate,\n retryableErrors,\n isSystemError,\n SystemErrorConditionMapper,\n NetworkSystemError,\n} from \"./errors.js\";\nexport {\n delay,\n parseConnectionString,\n defaultCancellableLock,\n ParsedOutput,\n WebSocketOptions,\n} from \"./util/utils.js\";\nexport { AmqpAnnotatedMessage } from \"./amqpAnnotatedMessage.js\";\nexport { logger } from \"./log.js\";\nexport * from \"./internals.js\";\nexport { AcquireLockProperties, CancellableAsyncLock } from \"./util/lock.js\";\n"]}
@@ -1,5 +1,5 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
2
+ // Licensed under the MIT License.
3
3
  import { createSasTokenProvider } from "./auth/tokenProvider.js";
4
4
  import { isSasTokenProvider } from "./util/typeGuards.js";
5
5
  export { createSasTokenProvider, isSasTokenProvider };
@@ -1 +1 @@
1
- {"version":3,"file":"internals.js","sourceRoot":"","sources":["../../src/internals.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAoB,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACnF,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAoB,sBAAsB,EAAE,kBAAkB,EAAE,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { SasTokenProvider, createSasTokenProvider } from \"./auth/tokenProvider.js\";\nimport { isSasTokenProvider } from \"./util/typeGuards.js\";\n\nexport { SasTokenProvider, createSasTokenProvider, isSasTokenProvider };\n"]}
1
+ {"version":3,"file":"internals.js","sourceRoot":"","sources":["../../src/internals.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAoB,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACnF,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAoB,sBAAsB,EAAE,kBAAkB,EAAE,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { SasTokenProvider, createSasTokenProvider } from \"./auth/tokenProvider.js\";\nimport { isSasTokenProvider } from \"./util/typeGuards.js\";\n\nexport { SasTokenProvider, createSasTokenProvider, isSasTokenProvider };\n"]}
@@ -1,5 +1,5 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
2
+ // Licensed under the MIT License.
3
3
  import { createClientLogger } from "@azure/logger";
4
4
  import { isObjectWithProperties } from "@azure/core-util";
5
5
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"log.js","sourceRoot":"","sources":["../../src/log.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAE1D;;;GAGG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,kBAAkB,CAAC,WAAW,CAAC,CAAC;AAEtD;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAc;IAC/C,IAAI,sBAAsB,CAAC,KAAK,EAAE,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC;QAC7C,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createClientLogger } from \"@azure/logger\";\nimport { isObjectWithProperties } from \"@azure/core-util\";\n\n/**\n * The \\@azure/logger configuration for this package.\n * This will output logs using the `azure:event-hubs` namespace prefix.\n */\nexport const logger = createClientLogger(\"core-amqp\");\n\n/**\n * Logs the error's stack trace to \"verbose\" if a stack trace is available.\n * @param error - Error containing a stack trace.\n * @internal\n */\nexport function logErrorStackTrace(error: unknown): void {\n if (isObjectWithProperties(error, [\"stack\"])) {\n logger.verbose(error.stack);\n }\n}\n"]}
1
+ {"version":3,"file":"log.js","sourceRoot":"","sources":["../../src/log.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAE1D;;;GAGG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,kBAAkB,CAAC,WAAW,CAAC,CAAC;AAEtD;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAc;IAC/C,IAAI,sBAAsB,CAAC,KAAK,EAAE,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC;QAC7C,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { createClientLogger } from \"@azure/logger\";\nimport { isObjectWithProperties } from \"@azure/core-util\";\n\n/**\n * The \\@azure/logger configuration for this package.\n * This will output logs using the `azure:event-hubs` namespace prefix.\n */\nexport const logger = createClientLogger(\"core-amqp\");\n\n/**\n * Logs the error's stack trace to \"verbose\" if a stack trace is available.\n * @param error - Error containing a stack trace.\n * @internal\n */\nexport function logErrorStackTrace(error: unknown): void {\n if (isObjectWithProperties(error, [\"stack\"])) {\n logger.verbose(error.stack);\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { MessageHeader as RheaMessageHeader } from "rhea-promise";
1
+ import type { MessageHeader as RheaMessageHeader } from "rhea-promise";
2
2
  /**
3
3
  * Describes the defined set of standard header properties of the message.
4
4
  */
@@ -1,5 +1,5 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
2
+ // Licensed under the MIT License.
3
3
  /* eslint-disable eqeqeq */
4
4
  import { logger } from "./log.js";
5
5
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"messageHeader.js","sourceRoot":"","sources":["../../src/messageHeader.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,2BAA2B;AAG3B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AA+BlC;;GAEG;AACH,4GAA4G;AAC5G,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B;;;;;OAKG;IACH,mBAAmB,CAAC,KAAwB;QAC1C,MAAM,UAAU,GAAsB,EAAE,CAAC;QACzC,IAAI,KAAK,CAAC,aAAa,IAAI,SAAS,EAAE,CAAC;YACrC,UAAU,CAAC,cAAc,GAAG,KAAK,CAAC,aAAa,CAAC;QAClD,CAAC;QACD,IAAI,KAAK,CAAC,OAAO,IAAI,SAAS;YAAE,UAAU,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QACnE,IAAI,KAAK,CAAC,aAAa,IAAI,SAAS,EAAE,CAAC;YACrC,UAAU,CAAC,cAAc,GAAG,KAAK,CAAC,aAAa,CAAC;QAClD,CAAC;QACD,IAAI,KAAK,CAAC,QAAQ,IAAI,SAAS,EAAE,CAAC;YAChC,UAAU,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QACvC,CAAC;QACD,IAAI,KAAK,CAAC,UAAU,IAAI,SAAS,EAAE,CAAC;YAClC,UAAU,CAAC,GAAG,GAAG,KAAK,CAAC,UAAU,CAAC;QACpC,CAAC;QACD,MAAM,CAAC,OAAO,CAAC,0BAA0B,EAAE,UAAU,CAAC,CAAC;QACvD,OAAO,UAAU,CAAC;IACpB,CAAC;IAED;;;;;OAKG;IACH,qBAAqB,CAAC,KAAwB;QAC5C,MAAM,SAAS,GAAsB,EAAE,CAAC;QACxC,IAAI,KAAK,CAAC,cAAc,IAAI,SAAS,EAAE,CAAC;YACtC,SAAS,CAAC,aAAa,GAAG,KAAK,CAAC,cAAc,CAAC;QACjD,CAAC;QACD,IAAI,KAAK,CAAC,OAAO,IAAI,SAAS,EAAE,CAAC;YAC/B,SAAS,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QACpC,CAAC;QACD,IAAI,KAAK,CAAC,cAAc,IAAI,SAAS,EAAE,CAAC;YACtC,SAAS,CAAC,aAAa,GAAG,KAAK,CAAC,cAAc,CAAC;QACjD,CAAC;QACD,IAAI,KAAK,CAAC,QAAQ,IAAI,SAAS,EAAE,CAAC;YAChC,SAAS,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QACtC,CAAC;QACD,IAAI,KAAK,CAAC,GAAG,IAAI,SAAS,EAAE,CAAC;YAC3B,SAAS,CAAC,UAAU,GAAG,KAAK,CAAC,GAAG,CAAC;QACnC,CAAC;QACD,MAAM,CAAC,OAAO,CAAC,4BAA4B,EAAE,SAAS,CAAC,CAAC;QACxD,OAAO,SAAS,CAAC;IACnB,CAAC;CACF,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n/* eslint-disable eqeqeq */\n\nimport { MessageHeader as RheaMessageHeader } from \"rhea-promise\";\nimport { logger } from \"./log.js\";\n\n/**\n * Describes the defined set of standard header properties of the message.\n */\nexport interface AmqpMessageHeader {\n /**\n * If this value is true, then this message has not been\n * acquired by any other link. If this value is false, then this message MAY have previously\n * been acquired by another link or links.\n */\n firstAcquirer?: boolean;\n /**\n * The number of prior unsuccessful delivery attempts.\n */\n deliveryCount?: number;\n /**\n * time to live in ms.\n */\n timeToLive?: number;\n /**\n * Specifies durability requirements.\n */\n durable?: boolean;\n /**\n * The relative message priority. Higher numbers indicate higher\n * priority messages.\n */\n priority?: number;\n}\n\n/**\n * Describes the operations that can be performed on the message header.\n */\n// eslint-disable-next-line @typescript-eslint/no-redeclare -- renaming constant would be a breaking change.\nexport const AmqpMessageHeader = {\n /**\n * Converts MessageHeader to RheaMessageHeader.\n *\n * @param props - Message header.\n * @returns RheaMessageHeader\n */\n toRheaMessageHeader(props: AmqpMessageHeader): RheaMessageHeader {\n const amqpHeader: RheaMessageHeader = {};\n if (props.deliveryCount != undefined) {\n amqpHeader.delivery_count = props.deliveryCount;\n }\n if (props.durable != undefined) amqpHeader.durable = props.durable;\n if (props.firstAcquirer != undefined) {\n amqpHeader.first_acquirer = props.firstAcquirer;\n }\n if (props.priority != undefined) {\n amqpHeader.priority = props.priority;\n }\n if (props.timeToLive != undefined) {\n amqpHeader.ttl = props.timeToLive;\n }\n logger.verbose(\"To RheaMessageHeader: %O\", amqpHeader);\n return amqpHeader;\n },\n\n /**\n * Converts RheaMessageHeader to MessageHeader.\n *\n * @param props - Amqp Message Header\n * @returns MessageHeader.\n */\n fromRheaMessageHeader(props: RheaMessageHeader): AmqpMessageHeader {\n const msgHeader: AmqpMessageHeader = {};\n if (props.delivery_count != undefined) {\n msgHeader.deliveryCount = props.delivery_count;\n }\n if (props.durable != undefined) {\n msgHeader.durable = props.durable;\n }\n if (props.first_acquirer != undefined) {\n msgHeader.firstAcquirer = props.first_acquirer;\n }\n if (props.priority != undefined) {\n msgHeader.priority = props.priority;\n }\n if (props.ttl != undefined) {\n msgHeader.timeToLive = props.ttl;\n }\n logger.verbose(\"From RheaMessageHeader: %O\", msgHeader);\n return msgHeader;\n },\n};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I,SAAS,EAAE,CAAC;YAC/B,SAAS,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QACpC,CAAC;QACD,IAAI,KAAK,CAAC,cAAc,IAAI,SAAS,EAAE,CAAC;YACtC,SAAS,CAAC,aAAa,GAAG,KAAK,CAAC,cAAc,CAAC;QACjD,CAAC;QACD,IAAI,KAAK,CAAC,QAAQ,IAAI,SAAS,EAAE,CAAC;YAChC,SAAS,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QACtC,CAAC;QACD,IAAI,KAAK,CAAC,GAAG,IAAI,SAAS,EAAE,CAAC;YAC3B,SAAS,CAAC,UAAU,GAAG,KAAK,CAAC,GAAG,CAAC;QACnC,CAAC;QACD,MAAM,CAAC,OAAO,CAAC,4BAA4B,EAAE,SAAS,CAAC,CAAC;QACxD,OAAO,SAAS,CAAC;IACnB,CAAC;CACF,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n/* eslint-disable eqeqeq */\n\nimport type { MessageHeader as RheaMessageHeader } from \"rhea-promise\";\nimport { logger } from \"./log.js\";\n\n/**\n * Describes the defined set of standard header properties of the message.\n */\nexport interface AmqpMessageHeader {\n /**\n * If this value is true, then this message has not been\n * acquired by any other link. If this value is false, then this message MAY have previously\n * been acquired by another link or links.\n */\n firstAcquirer?: boolean;\n /**\n * The number of prior unsuccessful delivery attempts.\n */\n deliveryCount?: number;\n /**\n * time to live in ms.\n */\n timeToLive?: number;\n /**\n * Specifies durability requirements.\n */\n durable?: boolean;\n /**\n * The relative message priority. Higher numbers indicate higher\n * priority messages.\n */\n priority?: number;\n}\n\n/**\n * Describes the operations that can be performed on the message header.\n */\n// eslint-disable-next-line @typescript-eslint/no-redeclare -- renaming constant would be a breaking change.\nexport const AmqpMessageHeader = {\n /**\n * Converts MessageHeader to RheaMessageHeader.\n *\n * @param props - Message header.\n * @returns RheaMessageHeader\n */\n toRheaMessageHeader(props: AmqpMessageHeader): RheaMessageHeader {\n const amqpHeader: RheaMessageHeader = {};\n if (props.deliveryCount != undefined) {\n amqpHeader.delivery_count = props.deliveryCount;\n }\n if (props.durable != undefined) amqpHeader.durable = props.durable;\n if (props.firstAcquirer != undefined) {\n amqpHeader.first_acquirer = props.firstAcquirer;\n }\n if (props.priority != undefined) {\n amqpHeader.priority = props.priority;\n }\n if (props.timeToLive != undefined) {\n amqpHeader.ttl = props.timeToLive;\n }\n logger.verbose(\"To RheaMessageHeader: %O\", amqpHeader);\n return amqpHeader;\n },\n\n /**\n * Converts RheaMessageHeader to MessageHeader.\n *\n * @param props - Amqp Message Header\n * @returns MessageHeader.\n */\n fromRheaMessageHeader(props: RheaMessageHeader): AmqpMessageHeader {\n const msgHeader: AmqpMessageHeader = {};\n if (props.delivery_count != undefined) {\n msgHeader.deliveryCount = props.delivery_count;\n }\n if (props.durable != undefined) {\n msgHeader.durable = props.durable;\n }\n if (props.first_acquirer != undefined) {\n msgHeader.firstAcquirer = props.first_acquirer;\n }\n if (props.priority != undefined) {\n msgHeader.priority = props.priority;\n }\n if (props.ttl != undefined) {\n msgHeader.timeToLive = props.ttl;\n }\n logger.verbose(\"From RheaMessageHeader: %O\", msgHeader);\n return msgHeader;\n },\n};\n"]}
@@ -1,5 +1,4 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
- import { MessageProperties as RheaMessageProperties } from "rhea-promise";
1
+ import type { MessageProperties as RheaMessageProperties } from "rhea-promise";
3
2
  /**
4
3
  * Describes the defined set of standard properties of the message.
5
4
  */
@@ -1,5 +1,5 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
2
+ // Licensed under the MIT License.
3
3
  /* eslint-disable eqeqeq */
4
4
  import { logger } from "./log.js";
5
5
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"messageProperties.js","sourceRoot":"","sources":["../../src/messageProperties.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,2BAA2B;AAG3B,OAAO,EAAE,MAAM,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YACrC,aAAa,CAAC,YAAY,GAAG,KAAK,CAAC,aAAa,CAAC,OAAO,EAAE,CAAC;QAC7D,CAAC;QACD,IAAI,KAAK,CAAC,QAAQ,IAAI,SAAS,EAAE,CAAC;YAChC,aAAa,CAAC,OAAO,GAAG,KAAK,CAAC,QAAQ,CAAC;QACzC,CAAC;QACD,IAAI,KAAK,CAAC,cAAc,IAAI,SAAS,EAAE,CAAC;YACtC,aAAa,CAAC,aAAa,GAAG,KAAK,CAAC,cAAc,CAAC;QACrD,CAAC;QACD,IAAI,KAAK,CAAC,UAAU,IAAI,SAAS,EAAE,CAAC;YAClC,aAAa,CAAC,SAAS,GAAG,KAAK,CAAC,UAAU,CAAC;QAC7C,CAAC;QACD,IAAI,KAAK,CAAC,QAAQ,IAAI,SAAS,EAAE,CAAC;YAChC,aAAa,CAAC,OAAO,GAAG,KAAK,CAAC,QAAQ,CAAC;QACzC,CAAC;QACD,IAAI,KAAK,CAAC,iBAAiB,IAAI,SAAS,EAAE,CAAC;YACzC,aAAa,CAAC,cAAc,GAAG,KAAK,CAAC,iBAAiB,CAAC;QACzD,CAAC;QACD,IAAI,KAAK,CAAC,OAAO,IAAI,SAAS,EAAE,CAAC;YAC/B,aAAa,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QACxC,CAAC;QACD,IAAI,KAAK,CAAC,EAAE,IAAI,SAAS,EAAE,CAAC;YAC1B,aAAa,CAAC,EAAE,GAAG,KAAK,CAAC,EAAE,CAAC;QAC9B,CAAC;QACD,oCAAoC;QACpC,0CAA0C;QAC1C,IAAI;QAEJ,MAAM,CAAC,OAAO,CAAC,gCAAgC,EAAE,aAAa,CAAC,CAAC;QAChE,OAAO,aAAa,CAAC;IACvB,CAAC;CACF,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n/* eslint-disable eqeqeq */\n\nimport { MessageProperties as RheaMessageProperties } from \"rhea-promise\";\nimport { logger } from \"./log.js\";\n\n/**\n * Describes the defined set of standard properties of the message.\n */\nexport interface AmqpMessageProperties {\n /**\n * The application message identifier that uniquely identifies a message.\n * The user is responsible for making sure that this is unique in the given context. Guids usually make a good fit.\n */\n messageId?: string | number | Buffer;\n /**\n * The address of the node to send replies to.\n */\n replyTo?: string;\n /**\n * The address of the node the message is destined for.\n */\n to?: string;\n /**\n * The id that can be used to mark or identify messages between clients.\n */\n correlationId?: string | number | Buffer;\n /**\n * MIME type for the message.\n */\n contentType?: string;\n /**\n * The content-encoding property is used as a modifier to the content-type.\n * When present, its value indicates what additional content encodings have been applied to the application-data.\n */\n contentEncoding?: string;\n /**\n * The time when this message is considered expired.\n */\n absoluteExpiryTime?: number;\n /**\n * The time this message was created.\n */\n creationTime?: number;\n /**\n * The group this message belongs to.\n */\n groupId?: string;\n /**\n * The sequence number of this message with its group.\n */\n groupSequence?: number;\n /**\n * The group the reply message belongs to.\n */\n replyToGroupId?: string;\n /**\n * A common field for summary information about the message\n * content and purpose.\n */\n subject?: string;\n // /**\n // * The identity of the user responsible for producing the message.\n // */\n // userId?: string;\n}\n\n/**\n * Describes the operations that can be performed on the amqp message properties.\n */\n// eslint-disable-next-line @typescript-eslint/no-redeclare -- renaming constant would be a breaking change.\nexport const AmqpMessageProperties = {\n /**\n * Converts MessageProperties to RheaMessageProperties.\n * @param props - Message properties.\n * @returns RheaMessageProperties.\n */\n toRheaMessageProperties(props: AmqpMessageProperties): RheaMessageProperties {\n const amqpProperties: RheaMessageProperties = {};\n if (props.absoluteExpiryTime != undefined) {\n amqpProperties.absolute_expiry_time = new Date(props.absoluteExpiryTime);\n }\n if (props.contentEncoding != undefined) {\n amqpProperties.content_encoding = props.contentEncoding;\n }\n if (props.contentType != undefined) {\n amqpProperties.content_type = props.contentType;\n }\n if (props.correlationId != undefined) {\n amqpProperties.correlation_id = props.correlationId;\n }\n if (props.creationTime != undefined) {\n amqpProperties.creation_time = new Date(props.creationTime);\n }\n if (props.groupId != undefined) {\n amqpProperties.group_id = props.groupId;\n }\n if (props.groupSequence != undefined) {\n amqpProperties.group_sequence = props.groupSequence;\n }\n if (props.messageId != undefined) {\n amqpProperties.message_id = props.messageId;\n }\n if (props.replyTo != undefined) {\n amqpProperties.reply_to = props.replyTo;\n }\n if (props.replyToGroupId != undefined) {\n amqpProperties.reply_to_group_id = props.replyToGroupId;\n }\n if (props.subject != undefined) {\n amqpProperties.subject = props.subject;\n }\n if (props.to != undefined) {\n amqpProperties.to = props.to;\n }\n // if (props.userId != undefined) {\n // amqpProperties.user_id = props.userId;\n // }\n\n logger.verbose(\"To RheaMessageProperties: %O\", amqpProperties);\n return amqpProperties;\n },\n\n /**\n * Converts RheaMessageProperties to MessageProperties.\n * @param props - Amqp message properties.\n * @returns MessageProperties.\n */\n fromRheaMessageProperties(props: RheaMessageProperties): AmqpMessageProperties {\n const msgProperties: AmqpMessageProperties = {};\n if (props.absolute_expiry_time != undefined) {\n msgProperties.absoluteExpiryTime = props.absolute_expiry_time.getTime();\n }\n if (props.content_encoding != undefined) {\n msgProperties.contentEncoding = props.content_encoding;\n }\n if (props.content_type != undefined) {\n msgProperties.contentType = props.content_type;\n }\n if (props.correlation_id != undefined) {\n msgProperties.correlationId = props.correlation_id;\n }\n if (props.creation_time != undefined) {\n msgProperties.creationTime = props.creation_time.getTime();\n }\n if (props.group_id != undefined) {\n msgProperties.groupId = props.group_id;\n }\n if (props.group_sequence != undefined) {\n msgProperties.groupSequence = props.group_sequence;\n }\n if (props.message_id != undefined) {\n msgProperties.messageId = props.message_id;\n }\n if (props.reply_to != undefined) {\n msgProperties.replyTo = props.reply_to;\n }\n if (props.reply_to_group_id != undefined) {\n msgProperties.replyToGroupId = props.reply_to_group_id;\n }\n if (props.subject != undefined) {\n msgProperties.subject = props.subject;\n }\n if (props.to != undefined) {\n msgProperties.to = props.to;\n }\n // if (props.user_id != undefined) {\n // msgProperties.userId = props.user_id;\n // }\n\n logger.verbose(\"From RheaMessageProperties: %O\", msgProperties);\n return msgProperties;\n },\n};\n"]}
1
+ {"version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right (c) Microsoft Corporation.\n// Licensed under the MIT License.\n/* eslint-disable eqeqeq */\n\nimport type { MessageProperties as RheaMessageProperties } from \"rhea-promise\";\nimport { logger } from \"./log.js\";\n\n/**\n * Describes the defined set of standard properties of the message.\n */\nexport interface AmqpMessageProperties {\n /**\n * The application message identifier that uniquely identifies a message.\n * The user is responsible for making sure that this is unique in the given context. Guids usually make a good fit.\n */\n messageId?: string | number | Buffer;\n /**\n * The address of the node to send replies to.\n */\n replyTo?: string;\n /**\n * The address of the node the message is destined for.\n */\n to?: string;\n /**\n * The id that can be used to mark or identify messages between clients.\n */\n correlationId?: string | number | Buffer;\n /**\n * MIME type for the message.\n */\n contentType?: string;\n /**\n * The content-encoding property is used as a modifier to the content-type.\n * When present, its value indicates what additional content encodings have been applied to the application-data.\n */\n contentEncoding?: string;\n /**\n * The time when this message is considered expired.\n */\n absoluteExpiryTime?: number;\n /**\n * The time this message was created.\n */\n creationTime?: number;\n /**\n * The group this message belongs to.\n */\n groupId?: string;\n /**\n * The sequence number of this message with its group.\n */\n groupSequence?: number;\n /**\n * The group the reply message belongs to.\n */\n replyToGroupId?: string;\n /**\n * A common field for summary information about the message\n * content and purpose.\n */\n subject?: string;\n // /**\n // * The identity of the user responsible for producing the message.\n // */\n // userId?: string;\n}\n\n/**\n * Describes the operations that can be performed on the amqp message properties.\n */\n// eslint-disable-next-line @typescript-eslint/no-redeclare -- renaming constant would be a breaking change.\nexport const AmqpMessageProperties = {\n /**\n * Converts MessageProperties to RheaMessageProperties.\n * @param props - Message properties.\n * @returns RheaMessageProperties.\n */\n toRheaMessageProperties(props: AmqpMessageProperties): RheaMessageProperties {\n const amqpProperties: RheaMessageProperties = {};\n if (props.absoluteExpiryTime != undefined) {\n amqpProperties.absolute_expiry_time = new Date(props.absoluteExpiryTime);\n }\n if (props.contentEncoding != undefined) {\n amqpProperties.content_encoding = props.contentEncoding;\n }\n if (props.contentType != undefined) {\n amqpProperties.content_type = props.contentType;\n }\n if (props.correlationId != undefined) {\n amqpProperties.correlation_id = props.correlationId;\n }\n if (props.creationTime != undefined) {\n amqpProperties.creation_time = new Date(props.creationTime);\n }\n if (props.groupId != undefined) {\n amqpProperties.group_id = props.groupId;\n }\n if (props.groupSequence != undefined) {\n amqpProperties.group_sequence = props.groupSequence;\n }\n if (props.messageId != undefined) {\n amqpProperties.message_id = props.messageId;\n }\n if (props.replyTo != undefined) {\n amqpProperties.reply_to = props.replyTo;\n }\n if (props.replyToGroupId != undefined) {\n amqpProperties.reply_to_group_id = props.replyToGroupId;\n }\n if (props.subject != undefined) {\n amqpProperties.subject = props.subject;\n }\n if (props.to != undefined) {\n amqpProperties.to = props.to;\n }\n // if (props.userId != undefined) {\n // amqpProperties.user_id = props.userId;\n // }\n\n logger.verbose(\"To RheaMessageProperties: %O\", amqpProperties);\n return amqpProperties;\n },\n\n /**\n * Converts RheaMessageProperties to MessageProperties.\n * @param props - Amqp message properties.\n * @returns MessageProperties.\n */\n fromRheaMessageProperties(props: RheaMessageProperties): AmqpMessageProperties {\n const msgProperties: AmqpMessageProperties = {};\n if (props.absolute_expiry_time != undefined) {\n msgProperties.absoluteExpiryTime = props.absolute_expiry_time.getTime();\n }\n if (props.content_encoding != undefined) {\n msgProperties.contentEncoding = props.content_encoding;\n }\n if (props.content_type != undefined) {\n msgProperties.contentType = props.content_type;\n }\n if (props.correlation_id != undefined) {\n msgProperties.correlationId = props.correlation_id;\n }\n if (props.creation_time != undefined) {\n msgProperties.creationTime = props.creation_time.getTime();\n }\n if (props.group_id != undefined) {\n msgProperties.groupId = props.group_id;\n }\n if (props.group_sequence != undefined) {\n msgProperties.groupSequence = props.group_sequence;\n }\n if (props.message_id != undefined) {\n msgProperties.messageId = props.message_id;\n }\n if (props.reply_to != undefined) {\n msgProperties.replyTo = props.reply_to;\n }\n if (props.reply_to_group_id != undefined) {\n msgProperties.replyToGroupId = props.reply_to_group_id;\n }\n if (props.subject != undefined) {\n msgProperties.subject = props.subject;\n }\n if (props.to != undefined) {\n msgProperties.to = props.to;\n }\n // if (props.user_id != undefined) {\n // msgProperties.userId = props.user_id;\n // }\n\n logger.verbose(\"From RheaMessageProperties: %O\", msgProperties);\n return msgProperties;\n },\n};\n"]}
@@ -1,5 +1,5 @@
1
- import { AbortSignalLike } from "@azure/abort-controller";
2
- import { Connection, EventContext, Receiver, ReceiverOptions, ReqResLink, Message as RheaMessage, Sender, SenderOptions, Session } from "rhea-promise";
1
+ import type { AbortSignalLike } from "@azure/abort-controller";
2
+ import type { Connection, EventContext, Receiver, ReceiverOptions, ReqResLink, Message as RheaMessage, Sender, SenderOptions, Session } from "rhea-promise";
3
3
  /**
4
4
  * Describes the options that can be specified while sending a request.
5
5
  */
@@ -1,8 +1,8 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
2
+ // Licensed under the MIT License.
3
3
  import { AbortError } from "@azure/abort-controller";
4
4
  import { ConditionStatusMapper, translate } from "./errors.js";
5
- import { ReceiverEvents, SenderEvents, generate_uuid, } from "rhea-promise";
5
+ import { ReceiverEvents, SenderEvents, generate_uuid } from "rhea-promise";
6
6
  import { Constants, StandardAbortMessage } from "./util/constants.js";
7
7
  import { logErrorStackTrace, logger } from "./log.js";
8
8
  import { isDefined } from "@azure/core-util";
@@ -120,7 +120,7 @@ export class RequestResponseLink {
120
120
  }
121
121
  },
122
122
  });
123
- logger.verbose("[%s] %s request sent: %O", this.connection.id, request.to || "$management", request);
123
+ logger.verbose("[%s] %s request sent: %O", this.connection.id, request.to || "$management");
124
124
  this.sender.send(request);
125
125
  });
126
126
  }
@@ -1 +1 @@
1
- {"version":3,"file":"requestResponseLink.js","sourceRoot":"","sources":["../../src/requestResponseLink.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,UAAU,EAAmB,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,qBAAqB,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,EAIL,cAAc,EAKd,YA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AAC;YACpD,MAAM,CAAC,OAAO,CACZ,IAAI,YAAY,sEAAsE,GAAG,GAAG,CAC7F,CAAC;YACF,OAAO,CAAC,4BAA4B,EAAE,CAAC;YACvC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACvC,CAAC;QACD,YAAY,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AbortError, AbortSignalLike } from \"@azure/abort-controller\";\nimport { ConditionStatusMapper, translate } from \"./errors.js\";\nimport {\n Connection,\n EventContext,\n Receiver,\n ReceiverEvents,\n ReceiverOptions,\n ReqResLink,\n Message as RheaMessage,\n Sender,\n SenderEvents,\n SenderOptions,\n Session,\n generate_uuid,\n} from \"rhea-promise\";\nimport { Constants, StandardAbortMessage } from \"./util/constants.js\";\nimport { logErrorStackTrace, logger } from \"./log.js\";\nimport { isDefined } from \"@azure/core-util\";\n\n/**\n * Describes the options that can be specified while sending a request.\n */\nexport interface SendRequestOptions {\n /**\n * Cancels the operation.\n */\n abortSignal?: AbortSignalLike;\n /**\n * Max time to wait for the operation to complete.\n * Default: `60000 milliseconds`.\n */\n timeoutInMs?: number;\n /**\n * Name of the request being performed.\n */\n requestName?: string;\n}\n\n/**\n * @internal\n */\nexport interface DeferredPromiseWithCallback {\n resolve: (value?: any) => void;\n reject: (reason?: any) => void;\n /**\n * To be called before resolving or rejecting the deferred promise\n */\n cleanupBeforeResolveOrReject: () => void;\n}\n\n/**\n * Describes an amqp request(sender)-response(receiver) link that is created over an amqp session.\n */\nexport class RequestResponseLink implements ReqResLink {\n /**\n * @param session - The amqp session.\n * @param sender - The amqp sender link.\n * @param receiver - The amqp receiver link.\n */\n constructor(\n public session: Session,\n public sender: Sender,\n public receiver: Receiver,\n ) {\n this.session = session;\n this.sender = sender;\n this.receiver = receiver;\n this.receiver.on(ReceiverEvents.message, (context) => {\n onMessageReceived(context, this.connection.id, this._responsesMap);\n });\n this.sender.on(SenderEvents.senderError, (context) => {\n onSenderError(context, this.connection.id, this._responsesMap);\n });\n }\n\n /**\n * Maintains a map of responses that\n * are being actively returned. It acts as a store for correlating the responses received for\n * the send requests.\n */\n private _responsesMap: Map<string, DeferredPromiseWithCallback> = new Map<\n string,\n DeferredPromiseWithCallback\n >();\n\n /**\n * Provides the underlying amqp connection object.\n * @returns Connection.\n */\n get connection(): Connection {\n return this.session.connection;\n }\n\n /**\n * Indicates whether the session and the sender and receiver links are all open or closed.\n * @returns boolean - `true` - `open`, `false` - `closed`.\n */\n isOpen(): boolean {\n return this.session.isOpen() && this.sender.isOpen() && this.receiver.isOpen();\n }\n\n /**\n * Sends the given request message and returns the received response. If the operation is not\n * completed in the provided timeout in milliseconds `default: 60000`, then `OperationTimeoutError` is thrown.\n *\n * @param request - The AMQP (request) message.\n * @param options - Options that can be provided while sending a request.\n * @returns Promise<Message> The AMQP (response) message.\n */\n sendRequest(request: RheaMessage, options: SendRequestOptions = {}): Promise<RheaMessage> {\n const timeoutInMs = options.timeoutInMs || Constants.defaultOperationTimeoutInMs;\n\n const aborter: AbortSignalLike | undefined = options.abortSignal;\n\n // If message_id is not already set on the request, set it to a unique value\n // This helps in determining the right response for current request among multiple incoming messages\n if (!request.message_id) {\n request.message_id = generate_uuid();\n }\n\n return new Promise<RheaMessage>((resolve: any, reject: any) => {\n let timer: ReturnType<typeof setTimeout> | undefined = undefined;\n\n const rejectOnAbort = (): void => {\n this._responsesMap.delete(request.message_id as string);\n const address = this.receiver.address || \"address\";\n const requestName = options.requestName;\n const desc: string =\n `[${this.connection.id}] The request \"${requestName}\" ` +\n `to \"${address}\" has been cancelled by the user.`;\n // Cancellation is a user-intended action, so log to info instead of warning.\n logger.info(desc);\n const error = new AbortError(StandardAbortMessage);\n\n reject(error);\n };\n\n const onAbort = (): void => {\n // safe to clear the timeout if it hasn't already occurred.\n if (isDefined(timer)) {\n clearTimeout(timer);\n }\n aborter!.removeEventListener(\"abort\", onAbort);\n\n rejectOnAbort();\n };\n\n if (aborter) {\n // the aborter may have been triggered between request attempts\n // so check if it was triggered and reject if needed.\n if (aborter.aborted) {\n return rejectOnAbort();\n }\n aborter.addEventListener(\"abort\", onAbort);\n }\n\n timer = setTimeout(() => {\n this._responsesMap.delete(request.message_id as string);\n if (aborter) {\n aborter.removeEventListener(\"abort\", onAbort);\n }\n const address = this.receiver?.address || \"address\";\n const desc: string =\n `The request with message_id \"${request.message_id}\" to \"${address}\" ` +\n `endpoint timed out. Please try again later.`;\n const e: Error = {\n name: \"OperationTimeoutError\",\n message: desc,\n };\n return reject(translate(e));\n }, timeoutInMs);\n\n this._responsesMap.set(request.message_id as string, {\n resolve: resolve,\n reject: reject,\n cleanupBeforeResolveOrReject: () => {\n if (aborter) aborter.removeEventListener(\"abort\", onAbort);\n if (isDefined(timer)) {\n clearTimeout(timer);\n }\n },\n });\n\n logger.verbose(\n \"[%s] %s request sent: %O\",\n this.connection.id,\n request.to || \"$management\",\n request,\n );\n this.sender.send(request);\n });\n }\n\n /**\n * Closes the sender, receiver link and the underlying session.\n * @returns Promise<void>\n */\n async close(): Promise<void> {\n await this.sender.close({ closeSession: false });\n await this.receiver.close({ closeSession: false });\n await this.session.close();\n }\n\n /**\n * Removes the sender, receiver link and it's underlying session.\n * @returns void\n */\n remove(): void {\n this.sender.remove();\n this.receiver.remove();\n this.session.remove();\n }\n\n /**\n * Creates an amqp request/response link.\n *\n * @param connection - The amqp connection.\n * @param senderOptions - Options that must be provided to create the sender link.\n * @param receiverOptions - Options that must be provided to create the receiver link.\n * @param createOptions - Optional parameters that can be used to affect this method's behavior.\n * For example, `abortSignal` can be passed to allow cancelling an in-progress `create` invocation.\n * @returns Promise<RequestResponseLink>\n */\n static async create(\n connection: Connection,\n senderOptions: SenderOptions,\n receiverOptions: ReceiverOptions,\n createOptions: { abortSignal?: AbortSignalLike } = {},\n ): Promise<RequestResponseLink> {\n const { abortSignal } = createOptions;\n const session = await connection.createSession({ abortSignal });\n const sender = await session.createSender({ ...senderOptions, abortSignal });\n const receiver = await session.createReceiver({ ...receiverOptions, abortSignal });\n logger.verbose(\n \"[%s] Successfully created the sender and receiver links on the same session.\",\n connection.id,\n );\n return new RequestResponseLink(session, sender, receiver);\n }\n}\n/**\n * @internal\n *\n * Type used in getCodeDescriptionAndError to get the normalized info from the responses emitted by EventHubs and ServiceBus.\n */\ntype NormalizedInfo = {\n statusCode: number;\n statusDescription: string;\n errorCondition: string;\n};\n\n/**\n * @internal\n *\n * Handle different variations of property names in responses emitted by EventHubs and ServiceBus.\n */\nexport const getCodeDescriptionAndError = (\n props: { [key: string]: string | number | undefined } = {},\n): NormalizedInfo => {\n return {\n statusCode: (props[Constants.statusCode] || props.statusCode) as number,\n statusDescription: (props[Constants.statusDescription] || props.statusDescription) as string,\n errorCondition: (props[Constants.errorCondition] || props.errorCondition) as string,\n };\n};\n\n/**\n * This is used as the onMessage handler for the \"message\" event on the receiver.\n *\n * (This is inspired from the message settlement sequence in service-bus SDK which\n * relies on a single listener for settled event for all the messages.)\n * The sequence is as follows:\n * 1. User calls `await RequestResponseLink.sendRequest()`\n * 2. This creates a `Promise` that gets stored in the _responsesMap\n * 3. When the service acknowledges the response, this method gets called for that request.\n * 4. We resolve() the promise from the _responsesMap with the message.\n * 5. User's code after the sendRequest continues.\n *\n * @internal\n */\nexport function onMessageReceived(\n context: Pick<EventContext, \"message\">,\n connectionId: string,\n responsesMap: Map<string, DeferredPromiseWithCallback>,\n): void {\n const message = context.message;\n if (!message) {\n logger.verbose(\n `[${connectionId}] \"message\" property on the EventContext is \"undefined\" which is unexpected, ` +\n `returning from the \"onMessageReceived\" handler without resolving or rejecting the promise ` +\n `upon encountering the message event.`,\n );\n return;\n }\n\n const responseCorrelationId = message.correlation_id;\n if (!responsesMap.has(responseCorrelationId as string)) {\n logger.verbose(\n `[${connectionId}] correlationId \"${responseCorrelationId}\" property on the response does not match with ` +\n `any of the \"request-id\"s in the map, returning from the \"onMessageReceived\" handler without resolving ` +\n `or rejecting the promise upon encountering the message event.`,\n );\n return;\n }\n\n const promise = responsesMap.get(responseCorrelationId as string) as DeferredPromiseWithCallback;\n promise.cleanupBeforeResolveOrReject();\n\n const deleteResult = responsesMap.delete(responseCorrelationId as string);\n logger.verbose(\n `[${connectionId}] Successfully deleted the response with id ${responseCorrelationId} from the map. ` +\n `Delete result - ${deleteResult}`,\n );\n\n const info = getCodeDescriptionAndError(message.application_properties);\n let error;\n if (!info.statusCode) {\n error = new Error(\n `[${connectionId}] No statusCode in the \"application_properties\" in the returned response with correlation-id: ${responseCorrelationId}`,\n );\n }\n if (info.statusCode > 199 && info.statusCode < 300) {\n logger.verbose(\n `[${connectionId}] Resolving the response with correlation-id: ${responseCorrelationId}`,\n );\n return promise.resolve(message);\n }\n if (!error) {\n const condition =\n info.errorCondition || ConditionStatusMapper[info.statusCode] || \"amqp:internal-error\";\n error = translate({\n condition: condition,\n description: info.statusDescription,\n });\n logger.warning(`${error?.name}: ${error?.message}`);\n }\n logErrorStackTrace(error);\n return promise.reject(error);\n}\n\nfunction onSenderError(\n context: Pick<EventContext, \"sender\">,\n connectionId: string,\n responsesMap: Map<string, DeferredPromiseWithCallback>,\n): void {\n if (context.sender) {\n for (const [key, promise] of responsesMap.entries()) {\n logger.verbose(\n `[${connectionId}] Sender closed due to error when sending request with message_id \"${key}\"`,\n );\n promise.cleanupBeforeResolveOrReject();\n promise.reject(context.sender.error);\n }\n responsesMap.clear();\n }\n}\n"]}
1
+ {"version":3,"file":"requestResponseLink.js","sourceRoot":"","sources":["../../src/requestResponseLink.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAY/D,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC3E,O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AG,GAAG,CAC7F,CAAC;YACF,OAAO,CAAC,4BAA4B,EAAE,CAAC;YACvC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACvC,CAAC;QACD,YAAY,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { AbortSignalLike } from \"@azure/abort-controller\";\nimport { AbortError } from \"@azure/abort-controller\";\nimport { ConditionStatusMapper, translate } from \"./errors.js\";\nimport type {\n Connection,\n EventContext,\n Receiver,\n ReceiverOptions,\n ReqResLink,\n Message as RheaMessage,\n Sender,\n SenderOptions,\n Session,\n} from \"rhea-promise\";\nimport { ReceiverEvents, SenderEvents, generate_uuid } from \"rhea-promise\";\nimport { Constants, StandardAbortMessage } from \"./util/constants.js\";\nimport { logErrorStackTrace, logger } from \"./log.js\";\nimport { isDefined } from \"@azure/core-util\";\n\n/**\n * Describes the options that can be specified while sending a request.\n */\nexport interface SendRequestOptions {\n /**\n * Cancels the operation.\n */\n abortSignal?: AbortSignalLike;\n /**\n * Max time to wait for the operation to complete.\n * Default: `60000 milliseconds`.\n */\n timeoutInMs?: number;\n /**\n * Name of the request being performed.\n */\n requestName?: string;\n}\n\n/**\n * @internal\n */\nexport interface DeferredPromiseWithCallback {\n resolve: (value?: any) => void;\n reject: (reason?: any) => void;\n /**\n * To be called before resolving or rejecting the deferred promise\n */\n cleanupBeforeResolveOrReject: () => void;\n}\n\n/**\n * Describes an amqp request(sender)-response(receiver) link that is created over an amqp session.\n */\nexport class RequestResponseLink implements ReqResLink {\n /**\n * @param session - The amqp session.\n * @param sender - The amqp sender link.\n * @param receiver - The amqp receiver link.\n */\n constructor(\n public session: Session,\n public sender: Sender,\n public receiver: Receiver,\n ) {\n this.session = session;\n this.sender = sender;\n this.receiver = receiver;\n this.receiver.on(ReceiverEvents.message, (context) => {\n onMessageReceived(context, this.connection.id, this._responsesMap);\n });\n this.sender.on(SenderEvents.senderError, (context) => {\n onSenderError(context, this.connection.id, this._responsesMap);\n });\n }\n\n /**\n * Maintains a map of responses that\n * are being actively returned. It acts as a store for correlating the responses received for\n * the send requests.\n */\n private _responsesMap: Map<string, DeferredPromiseWithCallback> = new Map<\n string,\n DeferredPromiseWithCallback\n >();\n\n /**\n * Provides the underlying amqp connection object.\n * @returns Connection.\n */\n get connection(): Connection {\n return this.session.connection;\n }\n\n /**\n * Indicates whether the session and the sender and receiver links are all open or closed.\n * @returns boolean - `true` - `open`, `false` - `closed`.\n */\n isOpen(): boolean {\n return this.session.isOpen() && this.sender.isOpen() && this.receiver.isOpen();\n }\n\n /**\n * Sends the given request message and returns the received response. If the operation is not\n * completed in the provided timeout in milliseconds `default: 60000`, then `OperationTimeoutError` is thrown.\n *\n * @param request - The AMQP (request) message.\n * @param options - Options that can be provided while sending a request.\n * @returns Promise<Message> The AMQP (response) message.\n */\n sendRequest(request: RheaMessage, options: SendRequestOptions = {}): Promise<RheaMessage> {\n const timeoutInMs = options.timeoutInMs || Constants.defaultOperationTimeoutInMs;\n\n const aborter: AbortSignalLike | undefined = options.abortSignal;\n\n // If message_id is not already set on the request, set it to a unique value\n // This helps in determining the right response for current request among multiple incoming messages\n if (!request.message_id) {\n request.message_id = generate_uuid();\n }\n\n return new Promise<RheaMessage>((resolve: any, reject: any) => {\n let timer: ReturnType<typeof setTimeout> | undefined = undefined;\n\n const rejectOnAbort = (): void => {\n this._responsesMap.delete(request.message_id as string);\n const address = this.receiver.address || \"address\";\n const requestName = options.requestName;\n const desc: string =\n `[${this.connection.id}] The request \"${requestName}\" ` +\n `to \"${address}\" has been cancelled by the user.`;\n // Cancellation is a user-intended action, so log to info instead of warning.\n logger.info(desc);\n const error = new AbortError(StandardAbortMessage);\n\n reject(error);\n };\n\n const onAbort = (): void => {\n // safe to clear the timeout if it hasn't already occurred.\n if (isDefined(timer)) {\n clearTimeout(timer);\n }\n aborter!.removeEventListener(\"abort\", onAbort);\n\n rejectOnAbort();\n };\n\n if (aborter) {\n // the aborter may have been triggered between request attempts\n // so check if it was triggered and reject if needed.\n if (aborter.aborted) {\n return rejectOnAbort();\n }\n aborter.addEventListener(\"abort\", onAbort);\n }\n\n timer = setTimeout(() => {\n this._responsesMap.delete(request.message_id as string);\n if (aborter) {\n aborter.removeEventListener(\"abort\", onAbort);\n }\n const address = this.receiver?.address || \"address\";\n const desc: string =\n `The request with message_id \"${request.message_id}\" to \"${address}\" ` +\n `endpoint timed out. Please try again later.`;\n const e: Error = {\n name: \"OperationTimeoutError\",\n message: desc,\n };\n return reject(translate(e));\n }, timeoutInMs);\n\n this._responsesMap.set(request.message_id as string, {\n resolve: resolve,\n reject: reject,\n cleanupBeforeResolveOrReject: () => {\n if (aborter) aborter.removeEventListener(\"abort\", onAbort);\n if (isDefined(timer)) {\n clearTimeout(timer);\n }\n },\n });\n\n logger.verbose(\"[%s] %s request sent: %O\", this.connection.id, request.to || \"$management\");\n this.sender.send(request);\n });\n }\n\n /**\n * Closes the sender, receiver link and the underlying session.\n * @returns Promise<void>\n */\n async close(): Promise<void> {\n await this.sender.close({ closeSession: false });\n await this.receiver.close({ closeSession: false });\n await this.session.close();\n }\n\n /**\n * Removes the sender, receiver link and it's underlying session.\n * @returns void\n */\n remove(): void {\n this.sender.remove();\n this.receiver.remove();\n this.session.remove();\n }\n\n /**\n * Creates an amqp request/response link.\n *\n * @param connection - The amqp connection.\n * @param senderOptions - Options that must be provided to create the sender link.\n * @param receiverOptions - Options that must be provided to create the receiver link.\n * @param createOptions - Optional parameters that can be used to affect this method's behavior.\n * For example, `abortSignal` can be passed to allow cancelling an in-progress `create` invocation.\n * @returns Promise<RequestResponseLink>\n */\n static async create(\n connection: Connection,\n senderOptions: SenderOptions,\n receiverOptions: ReceiverOptions,\n createOptions: { abortSignal?: AbortSignalLike } = {},\n ): Promise<RequestResponseLink> {\n const { abortSignal } = createOptions;\n const session = await connection.createSession({ abortSignal });\n const sender = await session.createSender({ ...senderOptions, abortSignal });\n const receiver = await session.createReceiver({ ...receiverOptions, abortSignal });\n logger.verbose(\n \"[%s] Successfully created the sender and receiver links on the same session.\",\n connection.id,\n );\n return new RequestResponseLink(session, sender, receiver);\n }\n}\n/**\n * @internal\n *\n * Type used in getCodeDescriptionAndError to get the normalized info from the responses emitted by EventHubs and ServiceBus.\n */\ntype NormalizedInfo = {\n statusCode: number;\n statusDescription: string;\n errorCondition: string;\n};\n\n/**\n * @internal\n *\n * Handle different variations of property names in responses emitted by EventHubs and ServiceBus.\n */\nexport const getCodeDescriptionAndError = (\n props: { [key: string]: string | number | undefined } = {},\n): NormalizedInfo => {\n return {\n statusCode: (props[Constants.statusCode] || props.statusCode) as number,\n statusDescription: (props[Constants.statusDescription] || props.statusDescription) as string,\n errorCondition: (props[Constants.errorCondition] || props.errorCondition) as string,\n };\n};\n\n/**\n * This is used as the onMessage handler for the \"message\" event on the receiver.\n *\n * (This is inspired from the message settlement sequence in service-bus SDK which\n * relies on a single listener for settled event for all the messages.)\n * The sequence is as follows:\n * 1. User calls `await RequestResponseLink.sendRequest()`\n * 2. This creates a `Promise` that gets stored in the _responsesMap\n * 3. When the service acknowledges the response, this method gets called for that request.\n * 4. We resolve() the promise from the _responsesMap with the message.\n * 5. User's code after the sendRequest continues.\n *\n * @internal\n */\nexport function onMessageReceived(\n context: Pick<EventContext, \"message\">,\n connectionId: string,\n responsesMap: Map<string, DeferredPromiseWithCallback>,\n): void {\n const message = context.message;\n if (!message) {\n logger.verbose(\n `[${connectionId}] \"message\" property on the EventContext is \"undefined\" which is unexpected, ` +\n `returning from the \"onMessageReceived\" handler without resolving or rejecting the promise ` +\n `upon encountering the message event.`,\n );\n return;\n }\n\n const responseCorrelationId = message.correlation_id;\n if (!responsesMap.has(responseCorrelationId as string)) {\n logger.verbose(\n `[${connectionId}] correlationId \"${responseCorrelationId}\" property on the response does not match with ` +\n `any of the \"request-id\"s in the map, returning from the \"onMessageReceived\" handler without resolving ` +\n `or rejecting the promise upon encountering the message event.`,\n );\n return;\n }\n\n const promise = responsesMap.get(responseCorrelationId as string) as DeferredPromiseWithCallback;\n promise.cleanupBeforeResolveOrReject();\n\n const deleteResult = responsesMap.delete(responseCorrelationId as string);\n logger.verbose(\n `[${connectionId}] Successfully deleted the response with id ${responseCorrelationId} from the map. ` +\n `Delete result - ${deleteResult}`,\n );\n\n const info = getCodeDescriptionAndError(message.application_properties);\n let error;\n if (!info.statusCode) {\n error = new Error(\n `[${connectionId}] No statusCode in the \"application_properties\" in the returned response with correlation-id: ${responseCorrelationId}`,\n );\n }\n if (info.statusCode > 199 && info.statusCode < 300) {\n logger.verbose(\n `[${connectionId}] Resolving the response with correlation-id: ${responseCorrelationId}`,\n );\n return promise.resolve(message);\n }\n if (!error) {\n const condition =\n info.errorCondition || ConditionStatusMapper[info.statusCode] || \"amqp:internal-error\";\n error = translate({\n condition: condition,\n description: info.statusDescription,\n });\n logger.warning(`${error?.name}: ${error?.message}`);\n }\n logErrorStackTrace(error);\n return promise.reject(error);\n}\n\nfunction onSenderError(\n context: Pick<EventContext, \"sender\">,\n connectionId: string,\n responsesMap: Map<string, DeferredPromiseWithCallback>,\n): void {\n if (context.sender) {\n for (const [key, promise] of responsesMap.entries()) {\n logger.verbose(\n `[${connectionId}] Sender closed due to error when sending request with message_id \"${key}\"`,\n );\n promise.cleanupBeforeResolveOrReject();\n promise.reject(context.sender.error);\n }\n responsesMap.clear();\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { AbortSignalLike } from "@azure/abort-controller";
1
+ import type { AbortSignalLike } from "@azure/abort-controller";
2
2
  /**
3
3
  * Describes the Retry Mode type
4
4
  */
@@ -1,5 +1,5 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
2
+ // Licensed under the MIT License.
3
3
  /* eslint-disable eqeqeq */
4
4
  import { translate } from "./errors.js";
5
5
  import { Constants } from "./util/constants.js";
@@ -154,17 +154,10 @@ export async function retry(config) {
154
154
  return result;
155
155
  }
156
156
  else {
157
- throw compileErrors(errors);
158
- }
159
- }
160
- function compileErrors(errors) {
161
- if (!errors.length) {
162
- throw new RangeError("Error array is empty");
157
+ if (errors.length === 1) {
158
+ throw errors[0];
159
+ }
160
+ throw new AggregateError(errors);
163
161
  }
164
- let i = 0;
165
- const str = errors.map((error) => `Error ${i++}: ${error}`).join("\n\n");
166
- const lastError = errors[errors.length - 1];
167
- lastError.message = str;
168
- return lastError;
169
162
  }
170
163
  //# sourceMappingURL=retry.js.map