@azure/service-bus 7.10.0-beta.2 → 7.10.0-beta.3

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 (254) hide show
  1. package/dist/browser/connectionContext.js +1 -2
  2. package/dist/browser/connectionContext.js.map +1 -1
  3. package/dist/browser/constructorHelpers.js +3 -4
  4. package/dist/browser/constructorHelpers.js.map +1 -1
  5. package/dist/browser/core/autoLockRenewer.js +9 -5
  6. package/dist/browser/core/autoLockRenewer.js.map +1 -1
  7. package/dist/browser/core/batchingReceiver.js +26 -18
  8. package/dist/browser/core/batchingReceiver.js.map +1 -1
  9. package/dist/browser/core/linkEntity.js +74 -13
  10. package/dist/browser/core/linkEntity.js.map +1 -1
  11. package/dist/browser/core/managementClient.js +48 -48
  12. package/dist/browser/core/managementClient.js.map +1 -1
  13. package/dist/browser/core/messageReceiver.js +41 -14
  14. package/dist/browser/core/messageReceiver.js.map +1 -1
  15. package/dist/browser/core/messageSender.js +33 -10
  16. package/dist/browser/core/messageSender.js.map +1 -1
  17. package/dist/browser/core/receiverHelper.js +3 -2
  18. package/dist/browser/core/receiverHelper.js.map +1 -1
  19. package/dist/browser/core/shared.js +11 -4
  20. package/dist/browser/core/shared.js.map +1 -1
  21. package/dist/browser/core/streamingReceiver.js +74 -43
  22. package/dist/browser/core/streamingReceiver.js.map +1 -1
  23. package/dist/browser/diagnostics/instrumentServiceBusMessage.js +16 -8
  24. package/dist/browser/diagnostics/instrumentServiceBusMessage.js.map +1 -1
  25. package/dist/browser/receivers/receiver.js +68 -23
  26. package/dist/browser/receivers/receiver.js.map +1 -1
  27. package/dist/browser/receivers/receiverCommon.js +36 -21
  28. package/dist/browser/receivers/receiverCommon.js.map +1 -1
  29. package/dist/browser/receivers/sessionReceiver.js +69 -29
  30. package/dist/browser/receivers/sessionReceiver.js.map +1 -1
  31. package/dist/browser/sender.js +33 -11
  32. package/dist/browser/sender.js.map +1 -1
  33. package/dist/browser/serializers/queueResourceSerializer.js +9 -1
  34. package/dist/browser/serializers/queueResourceSerializer.js.map +1 -1
  35. package/dist/browser/serializers/ruleResourceSerializer.js +1 -2
  36. package/dist/browser/serializers/ruleResourceSerializer.js.map +1 -1
  37. package/dist/browser/serviceBusAtomManagementClient.js +181 -228
  38. package/dist/browser/serviceBusAtomManagementClient.js.map +1 -1
  39. package/dist/browser/serviceBusClient.js +31 -22
  40. package/dist/browser/serviceBusClient.js.map +1 -1
  41. package/dist/browser/serviceBusError.js +21 -1
  42. package/dist/browser/serviceBusError.js.map +1 -1
  43. package/dist/browser/serviceBusMessage.js +208 -13
  44. package/dist/browser/serviceBusMessage.js.map +1 -1
  45. package/dist/browser/serviceBusMessageBatch.js +32 -8
  46. package/dist/browser/serviceBusMessageBatch.js.map +1 -1
  47. package/dist/browser/serviceBusRuleManager.js +39 -15
  48. package/dist/browser/serviceBusRuleManager.js.map +1 -1
  49. package/dist/browser/session/messageSession.js +130 -25
  50. package/dist/browser/session/messageSession.js.map +1 -1
  51. package/dist/browser/util/atomXmlHelper.js +4 -5
  52. package/dist/browser/util/atomXmlHelper.js.map +1 -1
  53. package/dist/browser/util/compat/httpHeaders.js +1 -0
  54. package/dist/browser/util/compat/httpHeaders.js.map +1 -1
  55. package/dist/browser/util/constants.js +1 -1
  56. package/dist/browser/util/constants.js.map +1 -1
  57. package/dist/browser/util/sasServiceClientCredentials.js +8 -0
  58. package/dist/browser/util/sasServiceClientCredentials.js.map +1 -1
  59. package/dist/browser/util/semaphore.js +6 -2
  60. package/dist/browser/util/semaphore.js.map +1 -1
  61. package/dist/browser/util/utils.js +5 -7
  62. package/dist/browser/util/utils.js.map +1 -1
  63. package/dist/commonjs/connectionContext.js +1 -2
  64. package/dist/commonjs/connectionContext.js.map +1 -1
  65. package/dist/commonjs/constructorHelpers.js +3 -4
  66. package/dist/commonjs/constructorHelpers.js.map +1 -1
  67. package/dist/commonjs/core/autoLockRenewer.js +9 -5
  68. package/dist/commonjs/core/autoLockRenewer.js.map +1 -1
  69. package/dist/commonjs/core/batchingReceiver.js +26 -18
  70. package/dist/commonjs/core/batchingReceiver.js.map +1 -1
  71. package/dist/commonjs/core/linkEntity.js +74 -13
  72. package/dist/commonjs/core/linkEntity.js.map +1 -1
  73. package/dist/commonjs/core/managementClient.js +48 -48
  74. package/dist/commonjs/core/managementClient.js.map +1 -1
  75. package/dist/commonjs/core/messageReceiver.js +41 -14
  76. package/dist/commonjs/core/messageReceiver.js.map +1 -1
  77. package/dist/commonjs/core/messageSender.js +33 -10
  78. package/dist/commonjs/core/messageSender.js.map +1 -1
  79. package/dist/commonjs/core/receiverHelper.js +3 -2
  80. package/dist/commonjs/core/receiverHelper.js.map +1 -1
  81. package/dist/commonjs/core/shared.js +11 -4
  82. package/dist/commonjs/core/shared.js.map +1 -1
  83. package/dist/commonjs/core/streamingReceiver.js +74 -43
  84. package/dist/commonjs/core/streamingReceiver.js.map +1 -1
  85. package/dist/commonjs/diagnostics/instrumentServiceBusMessage.js +16 -8
  86. package/dist/commonjs/diagnostics/instrumentServiceBusMessage.js.map +1 -1
  87. package/dist/commonjs/receivers/receiver.js +68 -23
  88. package/dist/commonjs/receivers/receiver.js.map +1 -1
  89. package/dist/commonjs/receivers/receiverCommon.js +36 -21
  90. package/dist/commonjs/receivers/receiverCommon.js.map +1 -1
  91. package/dist/commonjs/receivers/sessionReceiver.js +69 -29
  92. package/dist/commonjs/receivers/sessionReceiver.js.map +1 -1
  93. package/dist/commonjs/sender.js +33 -11
  94. package/dist/commonjs/sender.js.map +1 -1
  95. package/dist/commonjs/serializers/queueResourceSerializer.js +9 -1
  96. package/dist/commonjs/serializers/queueResourceSerializer.js.map +1 -1
  97. package/dist/commonjs/serializers/ruleResourceSerializer.js +1 -2
  98. package/dist/commonjs/serializers/ruleResourceSerializer.js.map +1 -1
  99. package/dist/commonjs/serviceBusAtomManagementClient.js +181 -227
  100. package/dist/commonjs/serviceBusAtomManagementClient.js.map +1 -1
  101. package/dist/commonjs/serviceBusClient.js +31 -22
  102. package/dist/commonjs/serviceBusClient.js.map +1 -1
  103. package/dist/commonjs/serviceBusError.js +21 -1
  104. package/dist/commonjs/serviceBusError.js.map +1 -1
  105. package/dist/commonjs/serviceBusMessage.js +208 -12
  106. package/dist/commonjs/serviceBusMessage.js.map +1 -1
  107. package/dist/commonjs/serviceBusMessageBatch.js +32 -8
  108. package/dist/commonjs/serviceBusMessageBatch.js.map +1 -1
  109. package/dist/commonjs/serviceBusRuleManager.js +39 -15
  110. package/dist/commonjs/serviceBusRuleManager.js.map +1 -1
  111. package/dist/commonjs/session/messageSession.js +130 -25
  112. package/dist/commonjs/session/messageSession.js.map +1 -1
  113. package/dist/commonjs/tsdoc-metadata.json +11 -11
  114. package/dist/commonjs/util/atomXmlHelper.js +4 -5
  115. package/dist/commonjs/util/atomXmlHelper.js.map +1 -1
  116. package/dist/commonjs/util/compat/httpHeaders.js +1 -0
  117. package/dist/commonjs/util/compat/httpHeaders.js.map +1 -1
  118. package/dist/commonjs/util/constants.js +1 -1
  119. package/dist/commonjs/util/constants.js.map +1 -1
  120. package/dist/commonjs/util/runtimeInfo.js +2 -2
  121. package/dist/commonjs/util/runtimeInfo.js.map +1 -1
  122. package/dist/commonjs/util/sasServiceClientCredentials.js +8 -0
  123. package/dist/commonjs/util/sasServiceClientCredentials.js.map +1 -1
  124. package/dist/commonjs/util/semaphore.js +6 -2
  125. package/dist/commonjs/util/semaphore.js.map +1 -1
  126. package/dist/commonjs/util/utils.js +5 -7
  127. package/dist/commonjs/util/utils.js.map +1 -1
  128. package/dist/esm/connectionContext.js +1 -2
  129. package/dist/esm/connectionContext.js.map +1 -1
  130. package/dist/esm/constructorHelpers.js +3 -4
  131. package/dist/esm/constructorHelpers.js.map +1 -1
  132. package/dist/esm/core/autoLockRenewer.js +9 -5
  133. package/dist/esm/core/autoLockRenewer.js.map +1 -1
  134. package/dist/esm/core/batchingReceiver.js +26 -18
  135. package/dist/esm/core/batchingReceiver.js.map +1 -1
  136. package/dist/esm/core/linkEntity.js +74 -13
  137. package/dist/esm/core/linkEntity.js.map +1 -1
  138. package/dist/esm/core/managementClient.js +48 -48
  139. package/dist/esm/core/managementClient.js.map +1 -1
  140. package/dist/esm/core/messageReceiver.js +41 -14
  141. package/dist/esm/core/messageReceiver.js.map +1 -1
  142. package/dist/esm/core/messageSender.js +33 -10
  143. package/dist/esm/core/messageSender.js.map +1 -1
  144. package/dist/esm/core/receiverHelper.js +3 -2
  145. package/dist/esm/core/receiverHelper.js.map +1 -1
  146. package/dist/esm/core/shared.js +11 -4
  147. package/dist/esm/core/shared.js.map +1 -1
  148. package/dist/esm/core/streamingReceiver.js +74 -43
  149. package/dist/esm/core/streamingReceiver.js.map +1 -1
  150. package/dist/esm/diagnostics/instrumentServiceBusMessage.js +16 -8
  151. package/dist/esm/diagnostics/instrumentServiceBusMessage.js.map +1 -1
  152. package/dist/esm/receivers/receiver.js +68 -23
  153. package/dist/esm/receivers/receiver.js.map +1 -1
  154. package/dist/esm/receivers/receiverCommon.js +36 -21
  155. package/dist/esm/receivers/receiverCommon.js.map +1 -1
  156. package/dist/esm/receivers/sessionReceiver.js +69 -29
  157. package/dist/esm/receivers/sessionReceiver.js.map +1 -1
  158. package/dist/esm/sender.js +33 -11
  159. package/dist/esm/sender.js.map +1 -1
  160. package/dist/esm/serializers/queueResourceSerializer.js +9 -1
  161. package/dist/esm/serializers/queueResourceSerializer.js.map +1 -1
  162. package/dist/esm/serializers/ruleResourceSerializer.js +1 -2
  163. package/dist/esm/serializers/ruleResourceSerializer.js.map +1 -1
  164. package/dist/esm/serviceBusAtomManagementClient.js +181 -228
  165. package/dist/esm/serviceBusAtomManagementClient.js.map +1 -1
  166. package/dist/esm/serviceBusClient.js +31 -22
  167. package/dist/esm/serviceBusClient.js.map +1 -1
  168. package/dist/esm/serviceBusError.js +21 -1
  169. package/dist/esm/serviceBusError.js.map +1 -1
  170. package/dist/esm/serviceBusMessage.js +208 -13
  171. package/dist/esm/serviceBusMessage.js.map +1 -1
  172. package/dist/esm/serviceBusMessageBatch.js +32 -8
  173. package/dist/esm/serviceBusMessageBatch.js.map +1 -1
  174. package/dist/esm/serviceBusRuleManager.js +39 -15
  175. package/dist/esm/serviceBusRuleManager.js.map +1 -1
  176. package/dist/esm/session/messageSession.js +130 -25
  177. package/dist/esm/session/messageSession.js.map +1 -1
  178. package/dist/esm/util/atomXmlHelper.js +4 -5
  179. package/dist/esm/util/atomXmlHelper.js.map +1 -1
  180. package/dist/esm/util/compat/httpHeaders.js +1 -0
  181. package/dist/esm/util/compat/httpHeaders.js.map +1 -1
  182. package/dist/esm/util/constants.js +1 -1
  183. package/dist/esm/util/constants.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/sasServiceClientCredentials.js +8 -0
  187. package/dist/esm/util/sasServiceClientCredentials.js.map +1 -1
  188. package/dist/esm/util/semaphore.js +6 -2
  189. package/dist/esm/util/semaphore.js.map +1 -1
  190. package/dist/esm/util/utils.js +5 -7
  191. package/dist/esm/util/utils.js.map +1 -1
  192. package/dist/react-native/connectionContext.js +1 -2
  193. package/dist/react-native/connectionContext.js.map +1 -1
  194. package/dist/react-native/constructorHelpers.js +3 -4
  195. package/dist/react-native/constructorHelpers.js.map +1 -1
  196. package/dist/react-native/core/autoLockRenewer.js +9 -5
  197. package/dist/react-native/core/autoLockRenewer.js.map +1 -1
  198. package/dist/react-native/core/batchingReceiver.js +26 -18
  199. package/dist/react-native/core/batchingReceiver.js.map +1 -1
  200. package/dist/react-native/core/linkEntity.js +74 -13
  201. package/dist/react-native/core/linkEntity.js.map +1 -1
  202. package/dist/react-native/core/managementClient.js +48 -48
  203. package/dist/react-native/core/managementClient.js.map +1 -1
  204. package/dist/react-native/core/messageReceiver.js +41 -14
  205. package/dist/react-native/core/messageReceiver.js.map +1 -1
  206. package/dist/react-native/core/messageSender.js +33 -10
  207. package/dist/react-native/core/messageSender.js.map +1 -1
  208. package/dist/react-native/core/receiverHelper.js +3 -2
  209. package/dist/react-native/core/receiverHelper.js.map +1 -1
  210. package/dist/react-native/core/shared.js +11 -4
  211. package/dist/react-native/core/shared.js.map +1 -1
  212. package/dist/react-native/core/streamingReceiver.js +74 -43
  213. package/dist/react-native/core/streamingReceiver.js.map +1 -1
  214. package/dist/react-native/diagnostics/instrumentServiceBusMessage.js +16 -8
  215. package/dist/react-native/diagnostics/instrumentServiceBusMessage.js.map +1 -1
  216. package/dist/react-native/receivers/receiver.js +68 -23
  217. package/dist/react-native/receivers/receiver.js.map +1 -1
  218. package/dist/react-native/receivers/receiverCommon.js +36 -21
  219. package/dist/react-native/receivers/receiverCommon.js.map +1 -1
  220. package/dist/react-native/receivers/sessionReceiver.js +69 -29
  221. package/dist/react-native/receivers/sessionReceiver.js.map +1 -1
  222. package/dist/react-native/sender.js +33 -11
  223. package/dist/react-native/sender.js.map +1 -1
  224. package/dist/react-native/serializers/queueResourceSerializer.js +9 -1
  225. package/dist/react-native/serializers/queueResourceSerializer.js.map +1 -1
  226. package/dist/react-native/serializers/ruleResourceSerializer.js +1 -2
  227. package/dist/react-native/serializers/ruleResourceSerializer.js.map +1 -1
  228. package/dist/react-native/serviceBusAtomManagementClient.js +181 -228
  229. package/dist/react-native/serviceBusAtomManagementClient.js.map +1 -1
  230. package/dist/react-native/serviceBusClient.js +31 -22
  231. package/dist/react-native/serviceBusClient.js.map +1 -1
  232. package/dist/react-native/serviceBusError.js +21 -1
  233. package/dist/react-native/serviceBusError.js.map +1 -1
  234. package/dist/react-native/serviceBusMessage.js +208 -13
  235. package/dist/react-native/serviceBusMessage.js.map +1 -1
  236. package/dist/react-native/serviceBusMessageBatch.js +32 -8
  237. package/dist/react-native/serviceBusMessageBatch.js.map +1 -1
  238. package/dist/react-native/serviceBusRuleManager.js +39 -15
  239. package/dist/react-native/serviceBusRuleManager.js.map +1 -1
  240. package/dist/react-native/session/messageSession.js +130 -25
  241. package/dist/react-native/session/messageSession.js.map +1 -1
  242. package/dist/react-native/util/atomXmlHelper.js +4 -5
  243. package/dist/react-native/util/atomXmlHelper.js.map +1 -1
  244. package/dist/react-native/util/compat/httpHeaders.js +1 -0
  245. package/dist/react-native/util/compat/httpHeaders.js.map +1 -1
  246. package/dist/react-native/util/constants.js +1 -1
  247. package/dist/react-native/util/constants.js.map +1 -1
  248. package/dist/react-native/util/sasServiceClientCredentials.js +8 -0
  249. package/dist/react-native/util/sasServiceClientCredentials.js.map +1 -1
  250. package/dist/react-native/util/semaphore.js +6 -2
  251. package/dist/react-native/util/semaphore.js.map +1 -1
  252. package/dist/react-native/util/utils.js +5 -7
  253. package/dist/react-native/util/utils.js.map +1 -1
  254. package/package.json +38 -38
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/util/constants.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,IAAI,EAAE,oBAAoB;IAC1B,OAAO,EAAE,eAAe;CACzB,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,KAAK,CAAC;AAE/C;;;;GAIG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAG,CAAC;AAE3C;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC;AAElD;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,WAAW,CAAC;AAEtC;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,WAAW,CAAC;AAEtC;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,kBAAkB,CAAC;AAEpD;;;GAGG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,UAAU,CAAC;AAEpC;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,YAAY,CAAC;AAExC;;;GAGG;A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/**\n * @internal\n */\nexport const packageJsonInfo = {\n name: \"@azure/service-bus\",\n version: \"7.10.0-beta.2\",\n};\n\n/**\n * @internal\n */\nexport const messageDispositionTimeout = 20000;\n\n/**\n * The amount of time in milliseconds that a receiver\n * will wait while draining credits before returning.\n * @internal\n */\nexport const receiveDrainTimeoutInMs = 200;\n\n/**\n * @internal\n */\nexport const max32BitNumber = Math.pow(2, 31) - 1;\n\n/**\n * Queue name identifier\n * @internal\n */\nexport const QUEUE_NAME = \"QueueName\";\n\n/**\n * Topic name identifier\n * @internal\n */\nexport const TOPIC_NAME = \"TopicName\";\n\n/**\n * Subscription name identifier\n * @internal\n */\nexport const SUBSCRIPTION_NAME = \"SubscriptionName\";\n\n/**\n * Rule name identifier\n * @internal\n */\nexport const RULE_NAME = \"RuleName\";\n\n/**\n * Accessed at field\n * @internal\n */\nexport const ACCESSED_AT = \"AccessedAt\";\n\n/**\n * Updated at field\n * @internal\n */\nexport const UPDATED_AT = \"UpdatedAt\";\n\n/**\n * Created at field\n * @internal\n */\nexport const CREATED_AT = \"CreatedAt\";\n\n/**\n * Authorization rules on the entity\n * @internal\n */\nexport const AUTHORIZATION_RULES = \"AuthorizationRules\";\n\n/**\n * Is Anonymous Accessible field\n * @internal\n */\nexport const IS_ANONYMOUS_ACCESSIBLE = \"IsAnonymousAccessible\";\n\n/**\n * Entity Availability Status field\n * @internal\n */\nexport const ENTITY_AVAILABILITY_STATUS = \"EntityAvailabilityStatus\";\n\n/**\n * Enable express option\n * @internal\n */\nexport const ENABLE_EXPRESS = \"EnableExpress\";\n\n/**\n * Is express option\n * @internal\n */\nexport const IS_EXPRESS = \"IsExpress\";\n\n/**\n * Enable Subscription Partitioning option\n * @internal\n */\nexport const ENABLE_SUBSCRIPTION_PARTITIONING = \"EnableSubscriptionPartitioning\";\n\n/**\n * Filtering Messages Before Publishing option\n * @internal\n */\nexport const FILTER_MESSAGES_BEFORE_PUBLISHING = \"FilteringMessagesBeforePublishing\";\n\n/**\n * The entity's size in bytes.\n *\n * @internal\n */\nexport const SIZE_IN_BYTES = \"SizeInBytes\";\n\n/**\n * The entity's message count.\n *\n * @internal\n */\nexport const MESSAGE_COUNT = \"MessageCount\";\n\n/**\n * The topic's subscription count.\n *\n * @internal\n */\nexport const SUBSCRIPTION_COUNT = \"SubscriptionCount\";\n\n/**\n * The topic / subscription's count details.\n *\n * @internal\n */\nexport const COUNT_DETAILS = \"CountDetails\";\n\n/**\n * The default rule name.\n *\n * @internal\n */\nexport const DEFAULT_RULE_NAME = \"$Default\";\n\n/**\n * Max idle time before entity is deleted.\n * This is specified in ISO-8601 duration format such as \"PT1M\" for 1 minute, \"PT5S\" for 5 seconds.\n * @internal\n */\nexport const AUTO_DELETE_ON_IDLE = \"AutoDeleteOnIdle\";\n\n/**\n * The status information on response\n *\n * @internal\n */\nexport const STATUS = \"Status\";\n\n/**\n * The URL of Service Bus entity to forward messages to.\n *\n * @internal\n */\nexport const FORWARD_TO = \"ForwardTo\";\n\n/**\n * The user meta data information\n *\n * @internal\n */\nexport const USER_METADATA = \"UserMetadata\";\n\n/**\n * The maximum size in megabytes.\n *\n * @internal\n */\nexport const MAX_SIZE_IN_MEGABYTES = \"MaxSizeInMegabytes\";\n/**\n * The maximum size in kilobytes.\n *\n * @internal\n */\nexport const MAX_MESSAGE_SIZE_IN_KILOBYTES = \"MaxMessageSizeInKilobytes\";\n/**\n * The default message time to live.\n * This is specified in ISO-8601 duration format such as \"PT1M\" for 1 minute, \"PT5S\" for 5 seconds.\n * @internal\n */\nexport const DEFAULT_MESSAGE_TIME_TO_LIVE = \"DefaultMessageTimeToLive\";\n\n/**\n * The lock duration.\n * This is specified in ISO-8601 duration format such as \"PT1M\" for 1 minute, \"PT5S\" for 5 seconds.\n * @internal\n */\nexport const LOCK_DURATION = \"LockDuration\";\n\n/**\n * The indication if session is required or not.\n *\n * @internal\n */\nexport const REQUIRES_SESSION = \"RequiresSession\";\n\n/**\n * The indication if duplicate detection is required or not.\n *\n * @internal\n */\nexport const REQUIRES_DUPLICATE_DETECTION = \"RequiresDuplicateDetection\";\n\n/**\n * The indication if dead lettering on message expiration. If it is enabled and a message expires,\n * the Service Bus moves the message from the queue into the entity dead-letter sub-queue.\n * If disabled, message will be permanently deleted from the main entity.\n * Settable only at entity creation time.\n *\n * @internal\n */\nexport const DEAD_LETTERING_ON_MESSAGE_EXPIRATION = \"DeadLetteringOnMessageExpiration\";\n\n/**\n * The indication if dead lettering on filter evaluation exceptions.\n *\n * @internal\n */\nexport const DEAD_LETTERING_ON_FILTER_EVALUATION_EXCEPTIONS =\n \"DeadLetteringOnFilterEvaluationExceptions\";\n\n/**\n * The history time window for duplicate detection.\n * This is specified in ISO-8601 duration format such as \"PT1M\" for 1 minute, \"PT5S\" for 5 seconds.\n * @internal\n */\nexport const DUPLICATE_DETECTION_HISTORY_TIME_WINDOW = \"DuplicateDetectionHistoryTimeWindow\";\n\n/**\n * The maximum delivery count of messages after which if it is still not settled, gets moved to the dead-letter sub-queue.\n *\n * @internal\n */\nexport const MAX_DELIVERY_COUNT = \"MaxDeliveryCount\";\n\n/**\n * Indicates if the queue has enabled batch operations.\n *\n * @internal\n */\nexport const ENABLE_BATCHED_OPERATIONS = \"EnableBatchedOperations\";\n\n/**\n * Indicates whether the topic can be ordered\n *\n * @internal\n */\nexport const SUPPORT_ORDERING = \"SupportOrdering\";\n\n/**\n * Indicates whether the topic/queue should be split across multiple partitions\n *\n * @internal\n */\nexport const ENABLE_PARTITIONING = \"EnablePartitioning\";\n\n/**\n * The URL of Service Bus entity to forward deadlettered messages to.\n *\n * @internal\n */\nexport const FORWARD_DEADLETTERED_MESSAGES_TO = \"ForwardDeadLetteredMessagesTo\";\n\n/**\n * Query string parameter to set Service Bus API version\n *\n * @internal\n */\nexport const API_VERSION_QUERY_KEY = \"api-version\";\n\n/**\n * Current API version being sent to service bus\n *\n * @internal\n */\nexport const CURRENT_API_VERSION = \"2021-05\";\n\n/**\n * Constant representing the Odata Error 'message' property\n *\n * @internal\n */\nexport const ODATA_ERROR_MESSAGE = \"message\";\n/**\n * Constant representing the 'value' property of Odata Error 'message' property\n *\n * @internal\n */\nexport const ODATA_ERROR_MESSAGE_VALUE = \"value\";\n\n/**\n * Marker for atom metadata.\n *\n * @internal\n */\nexport const XML_METADATA_MARKER = \"$\";\n\n/**\n * Marker for atom value.\n *\n * @internal\n */\nexport const XML_VALUE_MARKER = \"_\";\n\n/**\n * Constant representing the property where the atom default elements are stored.\n *\n * @internal\n */\nexport const ATOM_METADATA_MARKER = \"_\";\n\n/**\n * Known HTTP status codes as documented and referenced in ATOM based management API feature\n * https://learn.microsoft.com/dotnet/api/system.net.httpstatuscode?view=netframework-4.8\n * @internal\n */\nexport const HttpResponseCodes = {\n 100: \"Continue\",\n 101: \"SwitchingProtocols\",\n 200: \"Ok\",\n 201: \"Created\",\n 202: \"Accepted\",\n 203: \"NonAuthoritativeInformation\",\n 204: \"NoContent\",\n 205: \"ResetContent\",\n 206: \"PartialContent\",\n 300: \"MultipleChoices\",\n 301: \"Moved\",\n 302: \"Redirect\",\n 303: \"RedirectMethod\",\n 304: \"NotModified\",\n 305: \"UseProxy\",\n 306: \"Unused\",\n 400: \"BadRequest\",\n 401: \"Unauthorized\",\n 402: \"PaymentRequired\",\n 403: \"Forbidden\",\n 404: \"NotFound\",\n 405: \"MethodNotAllowed\",\n 406: \"NotAcceptable\",\n 407: \"ProxyAuthenticationRequired\",\n 409: \"Conflict\",\n 410: \"Gone\",\n 411: \"LengthRequired\",\n 412: \"PreconditionFailed\",\n 413: \"RequestEntityTooLarge\",\n 414: \"RequestUriTooLong\",\n 415: \"UnsupportedMediaType\",\n 416: \"RequestRangeNotSatisfiable\",\n 417: \"ExpectationFailed\",\n 426: \"UpgradeRequired\",\n 500: \"InternalServerError\",\n 501: \"NotImplemented\",\n 502: \"BadGateway\",\n 503: \"ServiceUnavailable\",\n 504: \"GatewayTimeout\",\n 505: \"HttpVersionNotSupported\",\n};\n"]}
1
+ {"version":3,"file":"constants.js","source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BAAgB;IACrB,GAAG,EAAE,aAAa;IAClB,GAAG,EAAE,UAAU;IACf,GAAG,EAAE,QAAQ;IACb,GAAG,EAAE,YAAY;IACjB,GAAG,EAAE,cAAc;IACnB,GAAG,EAAE,iBAAiB;IACtB,GAAG,EAAE,WAAW;IAChB,GAAG,EAAE,UAAU;IACf,GAAG,EAAE,kBAAkB;IACvB,GAAG,EAAE,eAAe;IACpB,GAAG,EAAE,6BAA6B;IAClC,GAAG,EAAE,UAAU;IACf,GAAG,EAAE,MAAM;IACX,GAAG,EAAE,gBAAgB;IACrB,GAAG,EAAE,oBAAoB;IACzB,GAAG,EAAE,uBAAuB;IAC5B,GAAG,EAAE,mBAAmB;IACxB,GAAG,EAAE,sBAAsB;IAC3B,GAAG,EAAE,4BAA4B;IACjC,GAAG,EAAE,mBAAmB;IACxB,GAAG,EAAE,iBAAiB;IACtB,GAAG,EAAE,qBAAqB;IAC1B,GAAG,EAAE,gBAAgB;IACrB,GAAG,EAAE,YAAY;IACjB,GAAG,EAAE,oBAAoB;IACzB,GAAG,EAAE,gBAAgB;IACrB,GAAG,EAAE,yBAAyB;CAC/B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * @internal\n */\nexport const packageJsonInfo = {\n name: \"@azure/service-bus\",\n version: \"7.10.0-beta.3\",\n};\n\n/**\n * @internal\n */\nexport const messageDispositionTimeout = 20000;\n\n/**\n * The amount of time in milliseconds that a receiver\n * will wait while draining credits before returning.\n * @internal\n */\nexport const receiveDrainTimeoutInMs = 200;\n\n/**\n * @internal\n */\nexport const max32BitNumber = Math.pow(2, 31) - 1;\n\n/**\n * Queue name identifier\n * @internal\n */\nexport const QUEUE_NAME = \"QueueName\";\n\n/**\n * Topic name identifier\n * @internal\n */\nexport const TOPIC_NAME = \"TopicName\";\n\n/**\n * Subscription name identifier\n * @internal\n */\nexport const SUBSCRIPTION_NAME = \"SubscriptionName\";\n\n/**\n * Rule name identifier\n * @internal\n */\nexport const RULE_NAME = \"RuleName\";\n\n/**\n * Accessed at field\n * @internal\n */\nexport const ACCESSED_AT = \"AccessedAt\";\n\n/**\n * Updated at field\n * @internal\n */\nexport const UPDATED_AT = \"UpdatedAt\";\n\n/**\n * Created at field\n * @internal\n */\nexport const CREATED_AT = \"CreatedAt\";\n\n/**\n * Authorization rules on the entity\n * @internal\n */\nexport const AUTHORIZATION_RULES = \"AuthorizationRules\";\n\n/**\n * Is Anonymous Accessible field\n * @internal\n */\nexport const IS_ANONYMOUS_ACCESSIBLE = \"IsAnonymousAccessible\";\n\n/**\n * Entity Availability Status field\n * @internal\n */\nexport const ENTITY_AVAILABILITY_STATUS = \"EntityAvailabilityStatus\";\n\n/**\n * Enable express option\n * @internal\n */\nexport const ENABLE_EXPRESS = \"EnableExpress\";\n\n/**\n * Is express option\n * @internal\n */\nexport const IS_EXPRESS = \"IsExpress\";\n\n/**\n * Enable Subscription Partitioning option\n * @internal\n */\nexport const ENABLE_SUBSCRIPTION_PARTITIONING = \"EnableSubscriptionPartitioning\";\n\n/**\n * Filtering Messages Before Publishing option\n * @internal\n */\nexport const FILTER_MESSAGES_BEFORE_PUBLISHING = \"FilteringMessagesBeforePublishing\";\n\n/**\n * The entity's size in bytes.\n *\n * @internal\n */\nexport const SIZE_IN_BYTES = \"SizeInBytes\";\n\n/**\n * The entity's message count.\n *\n * @internal\n */\nexport const MESSAGE_COUNT = \"MessageCount\";\n\n/**\n * The topic's subscription count.\n *\n * @internal\n */\nexport const SUBSCRIPTION_COUNT = \"SubscriptionCount\";\n\n/**\n * The topic / subscription's count details.\n *\n * @internal\n */\nexport const COUNT_DETAILS = \"CountDetails\";\n\n/**\n * The default rule name.\n *\n * @internal\n */\nexport const DEFAULT_RULE_NAME = \"$Default\";\n\n/**\n * Max idle time before entity is deleted.\n * This is specified in ISO-8601 duration format such as \"PT1M\" for 1 minute, \"PT5S\" for 5 seconds.\n * @internal\n */\nexport const AUTO_DELETE_ON_IDLE = \"AutoDeleteOnIdle\";\n\n/**\n * The status information on response\n *\n * @internal\n */\nexport const STATUS = \"Status\";\n\n/**\n * The URL of Service Bus entity to forward messages to.\n *\n * @internal\n */\nexport const FORWARD_TO = \"ForwardTo\";\n\n/**\n * The user meta data information\n *\n * @internal\n */\nexport const USER_METADATA = \"UserMetadata\";\n\n/**\n * The maximum size in megabytes.\n *\n * @internal\n */\nexport const MAX_SIZE_IN_MEGABYTES = \"MaxSizeInMegabytes\";\n/**\n * The maximum size in kilobytes.\n *\n * @internal\n */\nexport const MAX_MESSAGE_SIZE_IN_KILOBYTES = \"MaxMessageSizeInKilobytes\";\n/**\n * The default message time to live.\n * This is specified in ISO-8601 duration format such as \"PT1M\" for 1 minute, \"PT5S\" for 5 seconds.\n * @internal\n */\nexport const DEFAULT_MESSAGE_TIME_TO_LIVE = \"DefaultMessageTimeToLive\";\n\n/**\n * The lock duration.\n * This is specified in ISO-8601 duration format such as \"PT1M\" for 1 minute, \"PT5S\" for 5 seconds.\n * @internal\n */\nexport const LOCK_DURATION = \"LockDuration\";\n\n/**\n * The indication if session is required or not.\n *\n * @internal\n */\nexport const REQUIRES_SESSION = \"RequiresSession\";\n\n/**\n * The indication if duplicate detection is required or not.\n *\n * @internal\n */\nexport const REQUIRES_DUPLICATE_DETECTION = \"RequiresDuplicateDetection\";\n\n/**\n * The indication if dead lettering on message expiration. If it is enabled and a message expires,\n * the Service Bus moves the message from the queue into the entity dead-letter sub-queue.\n * If disabled, message will be permanently deleted from the main entity.\n * Settable only at entity creation time.\n *\n * @internal\n */\nexport const DEAD_LETTERING_ON_MESSAGE_EXPIRATION = \"DeadLetteringOnMessageExpiration\";\n\n/**\n * The indication if dead lettering on filter evaluation exceptions.\n *\n * @internal\n */\nexport const DEAD_LETTERING_ON_FILTER_EVALUATION_EXCEPTIONS =\n \"DeadLetteringOnFilterEvaluationExceptions\";\n\n/**\n * The history time window for duplicate detection.\n * This is specified in ISO-8601 duration format such as \"PT1M\" for 1 minute, \"PT5S\" for 5 seconds.\n * @internal\n */\nexport const DUPLICATE_DETECTION_HISTORY_TIME_WINDOW = \"DuplicateDetectionHistoryTimeWindow\";\n\n/**\n * The maximum delivery count of messages after which if it is still not settled, gets moved to the dead-letter sub-queue.\n *\n * @internal\n */\nexport const MAX_DELIVERY_COUNT = \"MaxDeliveryCount\";\n\n/**\n * Indicates if the queue has enabled batch operations.\n *\n * @internal\n */\nexport const ENABLE_BATCHED_OPERATIONS = \"EnableBatchedOperations\";\n\n/**\n * Indicates whether the topic can be ordered\n *\n * @internal\n */\nexport const SUPPORT_ORDERING = \"SupportOrdering\";\n\n/**\n * Indicates whether the topic/queue should be split across multiple partitions\n *\n * @internal\n */\nexport const ENABLE_PARTITIONING = \"EnablePartitioning\";\n\n/**\n * The URL of Service Bus entity to forward deadlettered messages to.\n *\n * @internal\n */\nexport const FORWARD_DEADLETTERED_MESSAGES_TO = \"ForwardDeadLetteredMessagesTo\";\n\n/**\n * Query string parameter to set Service Bus API version\n *\n * @internal\n */\nexport const API_VERSION_QUERY_KEY = \"api-version\";\n\n/**\n * Current API version being sent to service bus\n *\n * @internal\n */\nexport const CURRENT_API_VERSION = \"2021-05\";\n\n/**\n * Constant representing the Odata Error 'message' property\n *\n * @internal\n */\nexport const ODATA_ERROR_MESSAGE = \"message\";\n/**\n * Constant representing the 'value' property of Odata Error 'message' property\n *\n * @internal\n */\nexport const ODATA_ERROR_MESSAGE_VALUE = \"value\";\n\n/**\n * Marker for atom metadata.\n *\n * @internal\n */\nexport const XML_METADATA_MARKER = \"$\";\n\n/**\n * Marker for atom value.\n *\n * @internal\n */\nexport const XML_VALUE_MARKER = \"_\";\n\n/**\n * Constant representing the property where the atom default elements are stored.\n *\n * @internal\n */\nexport const ATOM_METADATA_MARKER = \"_\";\n\n/**\n * Known HTTP status codes as documented and referenced in ATOM based management API feature\n * https://learn.microsoft.com/dotnet/api/system.net.httpstatuscode?view=netframework-4.8\n * @internal\n */\nexport const HttpResponseCodes = {\n 100: \"Continue\",\n 101: \"SwitchingProtocols\",\n 200: \"Ok\",\n 201: \"Created\",\n 202: \"Accepted\",\n 203: \"NonAuthoritativeInformation\",\n 204: \"NoContent\",\n 205: \"ResetContent\",\n 206: \"PartialContent\",\n 300: \"MultipleChoices\",\n 301: \"Moved\",\n 302: \"Redirect\",\n 303: \"RedirectMethod\",\n 304: \"NotModified\",\n 305: \"UseProxy\",\n 306: \"Unused\",\n 400: \"BadRequest\",\n 401: \"Unauthorized\",\n 402: \"PaymentRequired\",\n 403: \"Forbidden\",\n 404: \"NotFound\",\n 405: \"MethodNotAllowed\",\n 406: \"NotAcceptable\",\n 407: \"ProxyAuthenticationRequired\",\n 409: \"Conflict\",\n 410: \"Gone\",\n 411: \"LengthRequired\",\n 412: \"PreconditionFailed\",\n 413: \"RequestEntityTooLarge\",\n 414: \"RequestUriTooLong\",\n 415: \"UnsupportedMediaType\",\n 416: \"RequestRangeNotSatisfiable\",\n 417: \"ExpectationFailed\",\n 426: \"UpgradeRequired\",\n 500: \"InternalServerError\",\n 501: \"NotImplemented\",\n 502: \"BadGateway\",\n 503: \"ServiceUnavailable\",\n 504: \"GatewayTimeout\",\n 505: \"HttpVersionNotSupported\",\n};\n"]}
@@ -5,6 +5,14 @@ import { createSasTokenProvider } from "@azure/core-amqp";
5
5
  * @internal
6
6
  */
7
7
  export class SasServiceClientCredentials {
8
+ /**
9
+ * The NamedKeyCredential containing the key name and secret key value.
10
+ */
11
+ _credential;
12
+ /**
13
+ * A SasTokenProvider provides a method to retrieve an `AccessToken`.
14
+ */
15
+ _tokenProvider;
8
16
  /**
9
17
  * Creates a new sasServiceClientCredentials object.
10
18
  *
@@ -1 +1 @@
1
- {"version":3,"file":"sasServiceClientCredentials.js","sourceRoot":"","sources":["../../../src/util/sasServiceClientCredentials.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAE,s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AAO,CAAC;IACjB,CAAC;IAED,QAAQ,CAAC,QAAgB;QACvB,OAAO,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAChD,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport type { AccessToken, NamedKeyCredential } from \"@azure/core-auth\";\nimport type { PipelineRequest } from \"@azure/core-rest-pipeline\";\nimport { createHttpHeaders } from \"@azure/core-rest-pipeline\";\nimport { generateKey } from \"./crypto.js\";\nimport type { SasTokenProvider } from \"@azure/core-amqp\";\nimport { createSasTokenProvider } from \"@azure/core-amqp\";\n\n/**\n * @internal\n */\nexport class SasServiceClientCredentials {\n /**\n * The NamedKeyCredential containing the key name and secret key value.\n */\n private _credential: NamedKeyCredential;\n\n /**\n * A SasTokenProvider provides a method to retrieve an `AccessToken`.\n */\n private _tokenProvider: SasTokenProvider;\n /**\n * Creates a new sasServiceClientCredentials object.\n *\n * @param credential - The NamedKeyCredential containing the key name and secret key value.\n */\n constructor(credential: NamedKeyCredential) {\n this._credential = credential;\n this._tokenProvider = createSasTokenProvider(credential);\n }\n\n private async _generateSignature(targetUri: string, expirationDate: number): Promise<string> {\n const stringToSign = `${targetUri}\\n${expirationDate}`;\n const result = await generateKey(this._credential.key, stringToSign);\n return result;\n }\n\n /**\n * Signs a request with the Authentication header.\n *\n * @param request - The {@link PipelineRequest} to be signed.\n * @returns The signed request object.\n */\n async signRequest(request: PipelineRequest): Promise<PipelineRequest> {\n if (!request.headers) request.headers = createHttpHeaders();\n\n const targetUri = encodeURIComponent(request.url.toLowerCase()).toLowerCase();\n\n const date = new Date();\n date.setMinutes(date.getMinutes() + 5);\n const expirationDate = Math.round(date.getTime() / 1000);\n const signature = await this._generateSignature(targetUri, expirationDate);\n request.headers.set(\n \"authorization\",\n `SharedAccessSignature sig=${signature}&se=${expirationDate}&skn=${this._credential.name}&sr=${targetUri}`,\n );\n request.withCredentials = true;\n return request;\n }\n\n getToken(audience: string): Promise<AccessToken> {\n return this._tokenProvider.getToken(audience);\n }\n}\n"]}
1
+ {"version":3,"file":"sasServiceClientCredentials.js","sourceRoot":"","sources":["../../../src/util/sasServiceClientCredentials.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAE1D;;GAEG;AACH,MAAM,OAAO,2BAA2B;IACtC;;OAEG;IACK,WAAW,CAAqB;IAExC;;OAEG;IACK,cAAc,CAAmB;IACzC;;;;OAIG;IACH,YAAY,UAA8B;QACxC,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;QAC9B,IAAI,CAAC,cAAc,GAAG,sBAAsB,CAAC,UAAU,CAAC,CAAC;IAC3D,CAAC;IAEO,KAAK,CAAC,kBAAkB,CAAC,SAAiB,EAAE,cAAsB;QACxE,MAAM,YAAY,GAAG,GAAG,SAAS,KAAK,cAAc,EAAE,CAAC;QACvD,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;QACrE,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,WAAW,CAAC,OAAwB;QACxC,IAAI,CAAC,OAAO,CAAC,OAAO;YAAE,OAAO,CAAC,OAAO,GAAG,iBAAiB,EAAE,CAAC;QAE5D,MAAM,SAAS,GAAG,kBAAkB,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;QAE9E,MAAM,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;QACxB,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,CAAC;QACvC,MAAM,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;QACzD,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;QAC3E,OAAO,CAAC,OAAO,CAAC,GAAG,CACjB,eAAe,EACf,6BAA6B,SAAS,OAAO,cAAc,QAAQ,IAAI,CAAC,WAAW,CAAC,IAAI,OAAO,SAAS,EAAE,CAC3G,CAAC;QACF,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC;QAC/B,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,QAAQ,CAAC,QAAgB;QACvB,OAAO,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAChD,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport type { AccessToken, NamedKeyCredential } from \"@azure/core-auth\";\nimport type { PipelineRequest } from \"@azure/core-rest-pipeline\";\nimport { createHttpHeaders } from \"@azure/core-rest-pipeline\";\nimport { generateKey } from \"./crypto.js\";\nimport type { SasTokenProvider } from \"@azure/core-amqp\";\nimport { createSasTokenProvider } from \"@azure/core-amqp\";\n\n/**\n * @internal\n */\nexport class SasServiceClientCredentials {\n /**\n * The NamedKeyCredential containing the key name and secret key value.\n */\n private _credential: NamedKeyCredential;\n\n /**\n * A SasTokenProvider provides a method to retrieve an `AccessToken`.\n */\n private _tokenProvider: SasTokenProvider;\n /**\n * Creates a new sasServiceClientCredentials object.\n *\n * @param credential - The NamedKeyCredential containing the key name and secret key value.\n */\n constructor(credential: NamedKeyCredential) {\n this._credential = credential;\n this._tokenProvider = createSasTokenProvider(credential);\n }\n\n private async _generateSignature(targetUri: string, expirationDate: number): Promise<string> {\n const stringToSign = `${targetUri}\\n${expirationDate}`;\n const result = await generateKey(this._credential.key, stringToSign);\n return result;\n }\n\n /**\n * Signs a request with the Authentication header.\n *\n * @param request - The {@link PipelineRequest} to be signed.\n * @returns The signed request object.\n */\n async signRequest(request: PipelineRequest): Promise<PipelineRequest> {\n if (!request.headers) request.headers = createHttpHeaders();\n\n const targetUri = encodeURIComponent(request.url.toLowerCase()).toLowerCase();\n\n const date = new Date();\n date.setMinutes(date.getMinutes() + 5);\n const expirationDate = Math.round(date.getTime() / 1000);\n const signature = await this._generateSignature(targetUri, expirationDate);\n request.headers.set(\n \"authorization\",\n `SharedAccessSignature sig=${signature}&se=${expirationDate}&skn=${this._credential.name}&sr=${targetUri}`,\n );\n request.withCredentials = true;\n return request;\n }\n\n getToken(audience: string): Promise<AccessToken> {\n return this._tokenProvider.getToken(audience);\n }\n}\n"]}
@@ -5,9 +5,13 @@
5
5
  * A simple Semaphore
6
6
  */
7
7
  export class Semaphore {
8
+ /**
9
+ * The number of concurrent calls that can be made.
10
+ */
11
+ limit;
12
+ _queue = [];
13
+ _used = 0;
8
14
  constructor(limit) {
9
- this._queue = [];
10
- this._used = 0;
11
15
  if (typeof limit !== "number") {
12
16
  throw new TypeError(`Expected limit to be a number, got ${typeof limit}`);
13
17
  }
@@ -1 +1 @@
1
- {"version":3,"file":"semaphore.js","sourceRoot":"","sources":["../../../src/util/semaphore.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;;GAGG;AACH,MAAM,OAAO,SAAS;IAOpB,YAAY,KAAa;QAFjB,WAAM,GAA+D,EAAE,CAAC;QACxE,UAAK,GAAW,CAAC,CAAC;QAExB,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC9B,MAAM,IAAI,SAAS,CAAC,sCAAsC,OAAO,KAAK,EAAE,CAAC,CAAC;QAC5E,CAAC;QAED,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;YACd,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;QACjD,CAAC;QACD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED;;;OAGG;IACH,OAAO;QACL,IAAI,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;YAC5B,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC;YAChB,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;QAC3B,CAAC;QAED,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAC7B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC5B,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,OAAO;QACL,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;YACvB,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;YACjC,IAAI,IAAI,EAAE,CAAC;gBACT,IAAI,EAAE,CAAC;YACT,CAAC;QACH,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;IAED;;;;;OAKG;IACH,GAAG,CAAI,EAA4B;QACjC,OAAO,IAAI,CAAC,OAAO,EAAE;aAClB,IAAI,CAAC,EAAE,CAAC;aACR,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE;YACZ,IAAI,CAAC,OAAO,EAAE,CAAC;YACf,OAAO,GAAG,CAAC;QACb,CAAC,CAAC;aACD,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;YACb,IAAI,CAAC,OAAO,EAAE,CAAC;YACf,MAAM,GAAG,CAAC;QACZ,CAAC,CAAC,CAAC;IACP,CAAC;IAED;;OAEG;IACH,gBAAgB;QACd,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED;;OAEG;IACH,gBAAgB;QACd,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;IAC5B,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * @internal\n * A simple Semaphore\n */\nexport class Semaphore {\n /**\n * The number of concurrent calls that can be made.\n */\n limit: number;\n private _queue: ((value?: void | PromiseLike<void> | undefined) => void)[] = [];\n private _used: number = 0;\n constructor(limit: number) {\n if (typeof limit !== \"number\") {\n throw new TypeError(`Expected limit to be a number, got ${typeof limit}`);\n }\n\n if (limit < 1) {\n throw new Error(\"limit cannot be less than 1\");\n }\n this.limit = limit;\n }\n\n /**\n * Acquires a lock from the semaphore, returns a Promise that resolves when the caller holds\n * a lock.\n */\n acquire(): Promise<void> {\n if (this._used < this.limit) {\n this._used += 1;\n return Promise.resolve();\n }\n\n return new Promise((resolve) => {\n this._queue.push(resolve);\n });\n }\n\n /**\n * Releases a lock back to the semaphore.\n */\n release(): void {\n if (this._queue.length) {\n const item = this._queue.shift();\n if (item) {\n item();\n }\n } else {\n this._used -= 1;\n }\n }\n\n /**\n * Aquires a lock from the semaphore and then execute the fn. If the fn returns a Promise,\n * wait for that promise to settle and then release the lock back to the semaphore.\n * @param fn - The function that needs to be executed in the ciritical region.\n * @returns A Promise that will settle with the return value of fn.\n */\n use<T>(fn: () => T | PromiseLike<T>): Promise<T> {\n return this.acquire()\n .then(fn)\n .then((val) => {\n this.release();\n return val;\n })\n .catch((err) => {\n this.release();\n throw err;\n });\n }\n\n /**\n * Provides the number of locks currently held.\n */\n currentLockCount(): number {\n return this._used;\n }\n\n /**\n * Provides the number of tasks waiting to acquire a lock.\n */\n awaitedTaskCount(): number {\n return this._queue.length;\n }\n}\n"]}
1
+ {"version":3,"file":"semaphore.js","sourceRoot":"","sources":["../../../src/util/semaphore.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;;GAGG;AACH,MAAM,OAAO,SAAS;IACpB;;OAEG;IACH,KAAK,CAAS;IACN,MAAM,GAA+D,EAAE,CAAC;IACxE,KAAK,GAAW,CAAC,CAAC;IAC1B,YAAY,KAAa;QACvB,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC9B,MAAM,IAAI,SAAS,CAAC,sCAAsC,OAAO,KAAK,EAAE,CAAC,CAAC;QAC5E,CAAC;QAED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AgB;QACd,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;IAC5B,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * @internal\n * A simple Semaphore\n */\nexport class Semaphore {\n /**\n * The number of concurrent calls that can be made.\n */\n limit: number;\n private _queue: ((value?: void | PromiseLike<void> | undefined) => void)[] = [];\n private _used: number = 0;\n constructor(limit: number) {\n if (typeof limit !== \"number\") {\n throw new TypeError(`Expected limit to be a number, got ${typeof limit}`);\n }\n\n if (limit < 1) {\n throw new Error(\"limit cannot be less than 1\");\n }\n this.limit = limit;\n }\n\n /**\n * Acquires a lock from the semaphore, returns a Promise that resolves when the caller holds\n * a lock.\n */\n acquire(): Promise<void> {\n if (this._used < this.limit) {\n this._used += 1;\n return Promise.resolve();\n }\n\n return new Promise((resolve) => {\n this._queue.push(resolve);\n });\n }\n\n /**\n * Releases a lock back to the semaphore.\n */\n release(): void {\n if (this._queue.length) {\n const item = this._queue.shift();\n if (item) {\n item();\n }\n } else {\n this._used -= 1;\n }\n }\n\n /**\n * Aquires a lock from the semaphore and then execute the fn. If the fn returns a Promise,\n * wait for that promise to settle and then release the lock back to the semaphore.\n * @param fn - The function that needs to be executed in the ciritical region.\n * @returns A Promise that will settle with the return value of fn.\n */\n use<T>(fn: () => T | PromiseLike<T>): Promise<T> {\n return this.acquire()\n .then(fn)\n .then((val) => {\n this.release();\n return val;\n })\n .catch((err) => {\n this.release();\n throw err;\n });\n }\n\n /**\n * Provides the number of locks currently held.\n */\n currentLockCount(): number {\n return this._used;\n }\n\n /**\n * Provides the number of tasks waiting to acquire a lock.\n */\n awaitedTaskCount(): number {\n return this._queue.length;\n }\n}\n"]}
@@ -398,16 +398,14 @@ export async function waitForTimeoutOrAbortOrResolve(args) {
398
398
  let timer = undefined;
399
399
  let clearAbortSignal = undefined;
400
400
  const clearAbortSignalAndTimer = () => {
401
- var _a, _b;
402
- ((_b = (_a = args.timeoutFunctions) === null || _a === void 0 ? void 0 : _a.clearTimeoutFn) !== null && _b !== void 0 ? _b : clearTimeout)(timer);
401
+ (args.timeoutFunctions?.clearTimeoutFn ?? clearTimeout)(timer);
403
402
  if (clearAbortSignal) {
404
403
  clearAbortSignal();
405
404
  }
406
405
  };
407
406
  const abortOrTimeoutPromise = new Promise((_resolve, reject) => {
408
- var _a, _b;
409
407
  clearAbortSignal = checkAndRegisterWithAbortSignal(reject, args.abortSignal);
410
- timer = ((_b = (_a = args.timeoutFunctions) === null || _a === void 0 ? void 0 : _a.setTimeoutFn) !== null && _b !== void 0 ? _b : setTimeout)(() => {
408
+ timer = (args.timeoutFunctions?.setTimeoutFn ?? setTimeout)(() => {
411
409
  reject(new OperationTimeoutError(args.timeoutMessage));
412
410
  }, args.timeoutMs);
413
411
  });
@@ -475,15 +473,15 @@ export const getHttpResponseOnly = (pipelineResponse) => toHttpResponse(pipeline
475
473
  */
476
474
  export async function waitForSendable(sendLogger, logPrefix, name, timeout, sender, outgoingAvaiable) {
477
475
  let waitTimeForSendable = 1000;
478
- if (!(sender === null || sender === void 0 ? void 0 : sender.sendable()) && timeout > waitTimeForSendable) {
476
+ if (!sender?.sendable() && timeout > waitTimeForSendable) {
479
477
  sendLogger.verbose("%s Sender '%s', waiting for 1 second for sender to become sendable", logPrefix, name);
480
478
  await delay(waitTimeForSendable);
481
- sendLogger.verbose("%s Sender '%s' after waiting for a second, credit: %d available: %d", logPrefix, name, sender === null || sender === void 0 ? void 0 : sender.credit, outgoingAvaiable);
479
+ sendLogger.verbose("%s Sender '%s' after waiting for a second, credit: %d available: %d", logPrefix, name, sender?.credit, outgoingAvaiable);
482
480
  }
483
481
  else {
484
482
  waitTimeForSendable = 0;
485
483
  }
486
- if (!(sender === null || sender === void 0 ? void 0 : sender.sendable())) {
484
+ if (!sender?.sendable()) {
487
485
  // let us retry to send the message after some time.
488
486
  const msg = `[${logPrefix}] Sender "${name}", ` + `cannot send the message right now. Please try later.`;
489
487
  sendLogger.warning(msg);
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ChB,oEAAoE,EACpE,SAAS,EACT,IAAI,CACL,CAAC;QAEF,MAAM,KAAK,CAAC,mBAAmB,CAAC,CAAC;QAEjC,UAAU,CAAC,OAAO,CAChB,qEAAqE,EACrE,SAAS,EACT,IAAI,EACJ,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,MAAM,EACd,gBAAgB,CACjB,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,mBAAmB,GAAG,CAAC,CAAC;IAC1B,CAAC;IAED,IAAI,CAAC,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,QAAQ,EAAE,CAAA,EAAE,CAAC;QACxB,oDAAoD;QACpD,MAAM,GAAG,GACP,IAAI,SAAS,aAAa,IAAI,KAAK,GAAG,sDAAsD,CAAC;QAC/F,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACxB,MAAM,SAAS,GAAc;YAC3B,SAAS,EAAE,wBAAwB,CAAC,eAAe;YACnD,WAAW,EAAE,GAAG;SACjB,CAAC;QACF,MAAM,wBAAwB,CAAC,SAAS,CAAC,CAAC;IAC5C,CAAC;IACD,OAAO,mBAAmB,CAAC;AAC7B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport Long from \"long\";\nimport type { ServiceBusLogger } from \"../log.js\";\nimport { logger, receiverLogger, messageLogger } from \"../log.js\";\nimport type { AmqpError } from \"rhea-promise\";\nimport { OperationTimeoutError, generate_uuid } from \"rhea-promise\";\nimport isBuffer from \"is-buffer\";\nimport * as Constants from \"../util/constants.js\";\nimport type { AbortSignalLike } from \"@azure/abort-controller\";\nimport { AbortError } from \"@azure/abort-controller\";\nimport type { PipelineResponse } from \"@azure/core-rest-pipeline\";\nimport { isDefined } from \"@azure/core-util\";\nimport type { HttpResponse } from \"./compat/index.js\";\nimport { toHttpResponse } from \"./compat/index.js\";\nimport { ErrorNameConditionMapper, StandardAbortMessage, delay } from \"@azure/core-amqp\";\nimport { translateServiceBusError } from \"../serviceBusError.js\";\n\n/**\n * @internal\n * Provides a uniue name by appending a string guid to the given string in the following format:\n * `{name}-{uuid}`.\n * @param name - The nme of the entity\n */\nexport function getUniqueName(name: string): string {\n return `${name}-${generate_uuid()}`;\n}\n\n/**\n * @internal\n * Returns the passed identifier if it is not undefined or empty;\n * otherwise generate and returns a unique one in the following format;\n * `{prefix}-{uuid}`.\n * @param prefix - The prefix used to generate identifier\n * @param identifier - an identifier name\n */\nexport function ensureValidIdentifier(prefix: string, identifier?: string): string {\n return identifier ? identifier : getUniqueName(prefix);\n}\n\n/**\n * @internal\n * If you try to turn a Guid into a Buffer in .NET, the bytes of the first three groups get\n * flipped within the group, but the last two groups don't get flipped, so we end up with a\n * different byte order. This is the order of bytes needed to make Service Bus recognize the token.\n *\n * @param lockToken - The lock token whose bytes need to be reorded.\n * @returns Buffer representing reordered bytes.\n */\nexport function reorderLockToken(lockTokenBytes: Buffer): Buffer {\n if (!lockTokenBytes || !Buffer.isBuffer(lockTokenBytes)) {\n return lockTokenBytes;\n }\n\n return Buffer.from([\n lockTokenBytes[3],\n lockTokenBytes[2],\n lockTokenBytes[1],\n lockTokenBytes[0],\n\n lockTokenBytes[5],\n lockTokenBytes[4],\n\n lockTokenBytes[7],\n lockTokenBytes[6],\n\n lockTokenBytes[8],\n lockTokenBytes[9],\n\n lockTokenBytes[10],\n lockTokenBytes[11],\n lockTokenBytes[12],\n lockTokenBytes[13],\n lockTokenBytes[14],\n lockTokenBytes[15],\n ]);\n}\n\n/**\n * @internal\n * Provides the time in milliseconds after which the lock renewal should occur.\n * @param lockedUntilUtc - The time until which the message is locked.\n */\nexport function calculateRenewAfterDuration(lockedUntilUtc: Date): number {\n const now = Date.now();\n const lockedUntil = lockedUntilUtc.getTime();\n const remainingTime = lockedUntil - now;\n receiverLogger.verbose(\"Locked until utc : %d\", lockedUntil);\n receiverLogger.verbose(\"Current time is : %d\", now);\n receiverLogger.verbose(\"Remaining time is : %d\", remainingTime);\n if (remainingTime < 1000) {\n return 0;\n }\n const buffer = Math.min(remainingTime / 2, 10000); // 10 seconds\n const renewAfter = remainingTime - buffer;\n receiverLogger.verbose(\"Renew after : %d\", renewAfter);\n return renewAfter;\n}\n\n/**\n * @internal\n * Converts the .net ticks to a JS Date object.\n *\n * - The epoch for the DateTimeOffset type is `0000-01-01`, while the epoch for JS Dates is\n * `1970-01-01`.\n * - The DateTimeOffset ticks value for the date `1970-01-01` is `621355968000000000`.\n * - Hence, to convert it to the JS epoch; we `subtract` the delta from the given value.\n * - Ticks in DateTimeOffset is `1/10000000` second, while ticks in JS Date is `1/1000` second.\n * - Thus, we `divide` the value by `10000` to convert it to JS Date ticks.\n *\n * @param buf - Input as a Buffer\n * @returns The JS Date object.\n */\nexport function convertTicksToDate(buf: number[]): Date {\n const epochMicroDiff: number = 621355968000000000;\n const longValue: Long = Long.fromBytesBE(buf);\n const timeInMS = longValue.sub(epochMicroDiff).div(10000).toNumber();\n const result = new Date(timeInMS);\n logger.verbose(\"The converted date is: %s\", result.toString());\n return result;\n}\n\n/**\n * @internal\n * Converts any given input to a Buffer.\n * @param input - The input that needs to be converted to a Buffer.\n */\nexport function toBuffer(input: unknown): Buffer {\n let result: any;\n messageLogger.verbose(\n \"[utils.toBuffer] The given message body that needs to be converted to buffer is: \",\n input,\n );\n if (isBuffer(input)) {\n result = input;\n } else {\n // string, undefined, null, boolean, array, object, number should end up here\n // coercing undefined to null as that will ensure that null value will be given to the\n // customer on receive.\n if (input === undefined) input = null;\n try {\n const inputStr = JSON.stringify(input);\n result = Buffer.from(inputStr, \"utf8\");\n } catch (err: any) {\n const msg =\n `An error occurred while executing JSON.stringify() on the given input ` +\n input +\n `${err instanceof Error ? err.stack : JSON.stringify(err)}`;\n messageLogger.warning(\"[utils.toBuffer] \" + msg);\n throw err instanceof Error ? err : new Error(msg);\n }\n }\n messageLogger.verbose(\"[utils.toBuffer] The converted buffer is: %O.\", result);\n return result;\n}\n\n/**\n * @internal\n * Helper utility to retrieve `string` value from given string,\n * or throws error if undefined.\n */\nexport function getString(value: unknown, nameOfProperty: string): string {\n const result = getStringOrUndefined(value);\n if (result === undefined) {\n throw new Error(\n `\"${nameOfProperty}\" received from service expected to be a string value and not undefined.`,\n );\n }\n return result;\n}\n\n/**\n * @internal\n * Helper utility to retrieve `string` value from given input,\n * or undefined if not passed in.\n */\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function getStringOrUndefined(value: any): string | undefined {\n if (!isDefined(value)) {\n return undefined;\n }\n return value.toString();\n}\n\n/**\n * @internal\n * Helper utility to retrieve `integer` value from given string,\n * or throws error if undefined.\n */\nexport function getInteger(value: unknown, nameOfProperty: string): number {\n const result = getIntegerOrUndefined(value);\n if (result === undefined) {\n throw new Error(\n `\"${nameOfProperty}\" received from service expected to be a number value and not undefined.`,\n );\n }\n return result;\n}\n\n/**\n * @internal\n * Helper utility to retrieve `integer` value from given string,\n * or undefined if not passed in.\n */\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function getIntegerOrUndefined(value: any): number | undefined {\n if (!isDefined(value)) {\n return undefined;\n }\n const result = parseInt(value.toString());\n return isNaN(result) ? undefined : result;\n}\n\n/**\n * @internal\n * Helper utility to convert ISO-8601 time into Date type.\n */\nexport function getDate(value: string, nameOfProperty: string): Date {\n return new Date(getString(value, nameOfProperty));\n}\n\n/**\n * @internal\n * Helper utility to retrieve `boolean` value from given string,\n * or throws error if undefined.\n */\nexport function getBoolean(value: unknown, nameOfProperty: string): boolean {\n const result = getBooleanOrUndefined(value);\n if (result === undefined) {\n throw new Error(\n `\"${nameOfProperty}\" received from service expected to be a boolean value and not undefined.`,\n );\n }\n return result;\n}\n\n/**\n * @internal\n * Helper utility to retrieve `boolean` value from given string,\n * or undefined if not passed in.\n */\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function getBooleanOrUndefined(value: any): boolean | undefined {\n if (!isDefined(value)) {\n return undefined;\n }\n return value.toString().trim().toLowerCase() === \"true\";\n}\n\n/**\n * @internal\n * Helps in differentiating JSON like objects from other kinds of objects.\n */\nconst EMPTY_JSON_OBJECT_CONSTRUCTOR = {}.constructor;\n\n/**\n * @internal\n * Returns `true` if given input is a JSON like object.\n */\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function isJSONLikeObject(value: any): boolean {\n // `value.constructor === {}.constructor` differentiates among the \"object\"s,\n // would filter the JSON objects and won't match any array or other kinds of objects\n\n // -------------------------------------------------------------------------------\n // Few examples | typeof obj ===\"object\" | obj.constructor==={}.constructor\n // -------------------------------------------------------------------------------\n // {abc:1} | true | true\n // [\"a\",\"b\"] | true | false\n // [{\"a\":1},{\"b\":2}] | true | false\n // new Date() | true | false\n // 123 | false | false\n // -------------------------------------------------------------------------------\n return typeof value === \"object\" && value.constructor === EMPTY_JSON_OBJECT_CONSTRUCTOR;\n}\n\n/**\n * @internal\n * Helper utility to retrieve message count details from given input,\n */\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function getMessageCountDetails(value: any): MessageCountDetails {\n const xmlnsPrefix = getXMLNSPrefix(value);\n if (!isDefined(value)) {\n value = {};\n }\n return {\n activeMessageCount: parseInt(value[`${xmlnsPrefix}:ActiveMessageCount`]) || 0,\n deadLetterMessageCount: parseInt(value[`${xmlnsPrefix}:DeadLetterMessageCount`]) || 0,\n scheduledMessageCount: parseInt(value[`${xmlnsPrefix}:ScheduledMessageCount`]) || 0,\n transferMessageCount: parseInt(value[`${xmlnsPrefix}:TransferMessageCount`]) || 0,\n transferDeadLetterMessageCount:\n parseInt(value[`${xmlnsPrefix}:TransferDeadLetterMessageCount`]) || 0,\n };\n}\n\n/**\n * @internal\n * Gets the xmlns prefix from the root of the objects that are part of the parsed response body.\n */\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function getXMLNSPrefix(value: any): string {\n if (!value[Constants.XML_METADATA_MARKER]) {\n throw new Error(\n `Error occurred while parsing the response body - cannot find the XML_METADATA_MARKER \"$\" on the object ${JSON.stringify(\n value,\n )}`,\n );\n }\n const keys = Object.keys(value[Constants.XML_METADATA_MARKER]);\n if (keys.length !== 1) {\n throw new Error(\n `Error occurred while parsing the response body - unexpected number of \"xmlns:\\${prefix}\" keys at ${JSON.stringify(\n value[Constants.XML_METADATA_MARKER],\n )}`,\n );\n }\n if (!keys[0].startsWith(\"xmlns:\")) {\n throw new Error(\n `Error occurred while parsing the response body - unexpected key at ${JSON.stringify(\n value[Constants.XML_METADATA_MARKER],\n )}`,\n );\n }\n // Pick the substring that's after \"xmlns:\"\n const xmlnsPrefix = keys[0].substring(6);\n if (!xmlnsPrefix) {\n throw new Error(\n `Error occurred while parsing the response body - unexpected xmlns prefix at ${JSON.stringify(\n value[Constants.XML_METADATA_MARKER],\n )}`,\n );\n }\n return xmlnsPrefix;\n}\n\n/**\n * Represents type of message count details in ATOM based management operations.\n * @internal\n */\nexport type MessageCountDetails = {\n activeMessageCount: number;\n deadLetterMessageCount: number;\n scheduledMessageCount: number;\n transferMessageCount: number;\n transferDeadLetterMessageCount: number;\n};\n\n/**\n * Represents type of `AuthorizationRule` in ATOM based management operations.\n */\nexport interface AuthorizationRule {\n /**\n * The claim type.\n */\n claimType: string;\n /**\n * The list of rights(\"Manage\" | \"Send\" | \"Listen\").\n */\n accessRights?: (\"Manage\" | \"Send\" | \"Listen\")[];\n /**\n * The authorization rule key name.\n */\n keyName: string;\n /**\n * The primary key for the authorization rule.\n */\n primaryKey?: string;\n /**\n * The secondary key for the authorization rule.\n */\n secondaryKey?: string;\n}\n\n/**\n * @internal\n * Helper utility to retrieve array of `AuthorizationRule` from given input,\n * or undefined if not passed in.\n */\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function getAuthorizationRulesOrUndefined(value: any): AuthorizationRule[] | undefined {\n const authorizationRules: AuthorizationRule[] = [];\n\n // Ignore special case as Service Bus treats \"\" as a valid value for authorization rules\n if (typeof value === \"string\" && value.trim() === \"\") {\n return undefined;\n }\n\n if (!isDefined(value)) {\n return undefined;\n }\n\n const rawAuthorizationRules = value.AuthorizationRule;\n if (Array.isArray(rawAuthorizationRules)) {\n for (let i = 0; i < rawAuthorizationRules.length; i++) {\n authorizationRules.push(buildAuthorizationRule(rawAuthorizationRules[i]));\n }\n } else {\n authorizationRules.push(buildAuthorizationRule(rawAuthorizationRules));\n }\n return authorizationRules;\n}\n\n/**\n * @internal\n * Helper utility to build an instance of parsed authorization rule as `AuthorizationRule` from given input.\n */\nfunction buildAuthorizationRule(value: any): AuthorizationRule {\n let accessRights;\n if (isDefined(value[\"Rights\"])) {\n accessRights = value[\"Rights\"][\"AccessRights\"];\n }\n\n const authorizationRule: AuthorizationRule = {\n claimType: value[\"ClaimType\"],\n accessRights,\n keyName: value[\"KeyName\"],\n primaryKey: value[\"PrimaryKey\"],\n secondaryKey: value[\"SecondaryKey\"],\n };\n\n if (authorizationRule.accessRights && !Array.isArray(authorizationRule.accessRights)) {\n authorizationRule.accessRights = [authorizationRule.accessRights];\n }\n return authorizationRule;\n}\n\n/**\n * @internal\n * Helper utility to extract output containing array of `RawAuthorizationRule` instances from given input,\n * or undefined if not passed in.\n */\nexport function getRawAuthorizationRules(authorizationRules: AuthorizationRule[] | undefined): any {\n if (!isDefined(authorizationRules)) {\n return undefined;\n }\n\n if (!Array.isArray(authorizationRules)) {\n throw new TypeError(\n `authorizationRules must be an array of AuthorizationRule objects or undefined, but received ${JSON.stringify(\n authorizationRules,\n undefined,\n 2,\n )}`,\n );\n }\n\n const rawAuthorizationRules: any[] = [];\n for (let i = 0; i < authorizationRules.length; i++) {\n rawAuthorizationRules.push(buildRawAuthorizationRule(authorizationRules[i]));\n }\n return { AuthorizationRule: rawAuthorizationRules };\n}\n\n/**\n * @internal\n * Helper utility to build an instance of raw authorization rule as RawAuthorizationRule from given `AuthorizationRule` input.\n * @param authorizationRule - parsed Authorization Rule instance\n */\nfunction buildRawAuthorizationRule(authorizationRule: AuthorizationRule): any {\n if (!isJSONLikeObject(authorizationRule) || authorizationRule === null) {\n throw new TypeError(\n `Expected authorizationRule input to be a JS object value, but received ${JSON.stringify(\n authorizationRule,\n undefined,\n 2,\n )}`,\n );\n }\n\n const rawAuthorizationRule: any = {\n ClaimType: authorizationRule.claimType,\n // ClaimValue is not settable by the users, but service expects the value for PUT requests\n ClaimValue: \"None\",\n Rights: {\n AccessRights: authorizationRule.accessRights,\n },\n KeyName: authorizationRule.keyName,\n PrimaryKey: authorizationRule.primaryKey,\n SecondaryKey: authorizationRule.secondaryKey,\n };\n rawAuthorizationRule[Constants.XML_METADATA_MARKER] = {\n \"p5:type\": \"SharedAccessAuthorizationRule\",\n \"xmlns:p5\": \"http://www.w3.org/2001/XMLSchema-instance\",\n };\n return rawAuthorizationRule;\n}\n\n/**\n * @internal\n * Helper utility to check if given string is an absolute URL\n */\nexport function isAbsoluteUrl(url: string): boolean {\n const _url = url.toLowerCase();\n return _url.startsWith(\"sb://\") || _url.startsWith(\"http://\") || _url.startsWith(\"https://\");\n}\n\n/**\n * Possible values for `status` of the Service Bus messaging entities.\n */\nexport type EntityStatus =\n | \"Active\"\n | \"Creating\"\n | \"Deleting\"\n | \"ReceiveDisabled\"\n | \"SendDisabled\"\n | \"Disabled\"\n | \"Renaming\"\n | \"Restoring\"\n | \"Unknown\";\n\n/**\n * Possible values for `availabilityStatus` of the Service Bus messaging entities.\n */\nexport type EntityAvailabilityStatus =\n | \"Available\"\n | \"Limited\"\n | \"Renaming\"\n | \"Restoring\"\n | \"Unknown\";\n\n/**\n * @internal\n */\ntype setTimeoutArgs = (callback: (...args: any[]) => void, ms: number, ...args: any[]) => any;\n\n/**\n * An executor for a function that returns a Promise that obeys both a timeout and an\n * optional AbortSignal.\n * @param timeoutMs - The number of milliseconds to allow before throwing an OperationTimeoutError.\n * @param timeoutMessage - The message to place in the .description field for the thrown exception for Timeout.\n * @param abortSignal - The abortSignal associated with containing operation.\n * @param abortErrorMsg - The abort error message associated with containing operation.\n * @param value - The value to be resolved with after a timeout of t milliseconds.\n *\n * @internal\n */\nexport async function waitForTimeoutOrAbortOrResolve<T>(args: {\n actionFn: () => Promise<T>;\n timeoutMs: number;\n timeoutMessage: string;\n abortSignal?: AbortSignalLike;\n // these are optional and only here for testing.\n timeoutFunctions?: {\n setTimeoutFn: setTimeoutArgs;\n clearTimeoutFn: (timeoutId: any) => void;\n };\n}): Promise<T> {\n if (args.abortSignal && args.abortSignal.aborted) {\n throw new AbortError(StandardAbortMessage);\n }\n\n let timer: any | undefined = undefined;\n let clearAbortSignal: (() => void) | undefined = undefined;\n\n const clearAbortSignalAndTimer = (): void => {\n (args.timeoutFunctions?.clearTimeoutFn ?? clearTimeout)(timer);\n\n if (clearAbortSignal) {\n clearAbortSignal();\n }\n };\n\n const abortOrTimeoutPromise = new Promise<T>((_resolve, reject) => {\n clearAbortSignal = checkAndRegisterWithAbortSignal(reject, args.abortSignal);\n\n timer = (args.timeoutFunctions?.setTimeoutFn ?? setTimeout)(() => {\n reject(new OperationTimeoutError(args.timeoutMessage));\n }, args.timeoutMs);\n });\n\n try {\n return await Promise.race([abortOrTimeoutPromise, args.actionFn()]);\n } finally {\n clearAbortSignalAndTimer();\n }\n}\n\n/**\n * Registers listener to the abort event on the abortSignal to call your abortFn and\n * returns a function that will clear the same listener.\n *\n * If abort signal is already aborted, then throws an AbortError and returns a function that does nothing\n *\n * @returns A function that removes any of our attached event listeners on the abort signal or an empty function if\n * the abortSignal was not defined.\n *\n * @internal\n */\nexport function checkAndRegisterWithAbortSignal(\n onAbortFn: (abortError: AbortError) => void,\n abortSignal?: AbortSignalLike,\n): () => void {\n if (abortSignal == null) {\n return () => {\n /** Nothing to do here, no abort signal */\n };\n }\n\n if (abortSignal.aborted) {\n throw new AbortError(StandardAbortMessage);\n }\n\n const onAbort = (): void => {\n abortSignal.removeEventListener(\"abort\", onAbort);\n onAbortFn(new AbortError(StandardAbortMessage));\n };\n\n abortSignal.addEventListener(\"abort\", onAbort);\n\n return () => abortSignal.removeEventListener(\"abort\", onAbort);\n}\n\n/**\n * @internal\n * The user agent prefix string for the ServiceBus client.\n * See guideline at https://azure.github.io/azure-sdk/general_azurecore.html#telemetry-policy\n */\nexport const libInfo: string = `azsdk-js-azureservicebus/${Constants.packageJsonInfo.version}`;\n\n/**\n * @internal\n * Returns the formatted prefix by removing the spaces, by appending the libInfo.\n */\nexport function formatUserAgentPrefix(prefix?: string): string {\n let userAgentPrefix = `${(prefix || \"\").replace(\" \", \"\")}`;\n userAgentPrefix = userAgentPrefix.length > 0 ? userAgentPrefix + \" \" : \"\";\n return `${userAgentPrefix}${libInfo}`;\n}\n\n/**\n * @internal\n * Helper method which returns `HttpResponse` from an object of shape `PipelineResponse`.\n * TODO: remove this and use toHttpResponse() directly\n */\nexport const getHttpResponseOnly = (pipelineResponse: PipelineResponse): HttpResponse =>\n toHttpResponse(pipelineResponse);\n\n/**\n * @internal\n * Type with the service versions for the ATOM API.\n */\nexport type ServiceBusAtomAPIVersion = \"2021-05\" | \"2017-04\";\n\n/**\n * @internal\n * Waits for one second if a sender is not sendable then check again. Throws\n * SenderBusyError if it is still not sendable.\n * Only waits when operation timeout is greater than one second.\n * @returns the actual waiting time.\n */\nexport async function waitForSendable(\n sendLogger: ServiceBusLogger,\n logPrefix: string,\n name: string,\n timeout: number,\n sender:\n | {\n sendable: () => boolean;\n credit: number;\n }\n | undefined,\n outgoingAvaiable: number,\n): Promise<number> {\n let waitTimeForSendable = 1000;\n if (!sender?.sendable() && timeout > waitTimeForSendable) {\n sendLogger.verbose(\n \"%s Sender '%s', waiting for 1 second for sender to become sendable\",\n logPrefix,\n name,\n );\n\n await delay(waitTimeForSendable);\n\n sendLogger.verbose(\n \"%s Sender '%s' after waiting for a second, credit: %d available: %d\",\n logPrefix,\n name,\n sender?.credit,\n outgoingAvaiable,\n );\n } else {\n waitTimeForSendable = 0;\n }\n\n if (!sender?.sendable()) {\n // let us retry to send the message after some time.\n const msg =\n `[${logPrefix}] Sender \"${name}\", ` + `cannot send the message right now. Please try later.`;\n sendLogger.warning(msg);\n const amqpError: AmqpError = {\n condition: ErrorNameConditionMapper.SenderBusyError,\n description: msg,\n };\n throw translateServiceBusError(amqpError);\n }\n return waitTimeForSendable;\n}\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/util/utils.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAElE,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzF,OAAO,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAEjE;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,IAAY;IACxC,OAAO,GAAG,IAAI,IAAI,aAAa,EAAE,EAAE,CAAC;AACtC,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAAc,EAAE,UAAmB;IACvE,OAAO,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;AACzD,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,gBAAgB,CAAC,cAAsB;IACrD,IAAI,CAAC,cAAc,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC;QACxD,OAAO,cAAc,CAAC;IACxB,CAAC;IAED,OAAO,MAAM,CAAC,IA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UAAU,CAAC,OAAO,CAChB,oEAAoE,EACpE,SAAS,EACT,IAAI,CACL,CAAC;QAEF,MAAM,KAAK,CAAC,mBAAmB,CAAC,CAAC;QAEjC,UAAU,CAAC,OAAO,CAChB,qEAAqE,EACrE,SAAS,EACT,IAAI,EACJ,MAAM,EAAE,MAAM,EACd,gBAAgB,CACjB,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,mBAAmB,GAAG,CAAC,CAAC;IAC1B,CAAC;IAED,IAAI,CAAC,MAAM,EAAE,QAAQ,EAAE,EAAE,CAAC;QACxB,oDAAoD;QACpD,MAAM,GAAG,GACP,IAAI,SAAS,aAAa,IAAI,KAAK,GAAG,sDAAsD,CAAC;QAC/F,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACxB,MAAM,SAAS,GAAc;YAC3B,SAAS,EAAE,wBAAwB,CAAC,eAAe;YACnD,WAAW,EAAE,GAAG;SACjB,CAAC;QACF,MAAM,wBAAwB,CAAC,SAAS,CAAC,CAAC;IAC5C,CAAC;IACD,OAAO,mBAAmB,CAAC;AAC7B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport Long from \"long\";\nimport type { ServiceBusLogger } from \"../log.js\";\nimport { logger, receiverLogger, messageLogger } from \"../log.js\";\nimport type { AmqpError } from \"rhea-promise\";\nimport { OperationTimeoutError, generate_uuid } from \"rhea-promise\";\nimport isBuffer from \"is-buffer\";\nimport * as Constants from \"../util/constants.js\";\nimport type { AbortSignalLike } from \"@azure/abort-controller\";\nimport { AbortError } from \"@azure/abort-controller\";\nimport type { PipelineResponse } from \"@azure/core-rest-pipeline\";\nimport { isDefined } from \"@azure/core-util\";\nimport type { HttpResponse } from \"./compat/index.js\";\nimport { toHttpResponse } from \"./compat/index.js\";\nimport { ErrorNameConditionMapper, StandardAbortMessage, delay } from \"@azure/core-amqp\";\nimport { translateServiceBusError } from \"../serviceBusError.js\";\n\n/**\n * @internal\n * Provides a uniue name by appending a string guid to the given string in the following format:\n * `{name}-{uuid}`.\n * @param name - The nme of the entity\n */\nexport function getUniqueName(name: string): string {\n return `${name}-${generate_uuid()}`;\n}\n\n/**\n * @internal\n * Returns the passed identifier if it is not undefined or empty;\n * otherwise generate and returns a unique one in the following format;\n * `{prefix}-{uuid}`.\n * @param prefix - The prefix used to generate identifier\n * @param identifier - an identifier name\n */\nexport function ensureValidIdentifier(prefix: string, identifier?: string): string {\n return identifier ? identifier : getUniqueName(prefix);\n}\n\n/**\n * @internal\n * If you try to turn a Guid into a Buffer in .NET, the bytes of the first three groups get\n * flipped within the group, but the last two groups don't get flipped, so we end up with a\n * different byte order. This is the order of bytes needed to make Service Bus recognize the token.\n *\n * @param lockToken - The lock token whose bytes need to be reorded.\n * @returns Buffer representing reordered bytes.\n */\nexport function reorderLockToken(lockTokenBytes: Buffer): Buffer {\n if (!lockTokenBytes || !Buffer.isBuffer(lockTokenBytes)) {\n return lockTokenBytes;\n }\n\n return Buffer.from([\n lockTokenBytes[3],\n lockTokenBytes[2],\n lockTokenBytes[1],\n lockTokenBytes[0],\n\n lockTokenBytes[5],\n lockTokenBytes[4],\n\n lockTokenBytes[7],\n lockTokenBytes[6],\n\n lockTokenBytes[8],\n lockTokenBytes[9],\n\n lockTokenBytes[10],\n lockTokenBytes[11],\n lockTokenBytes[12],\n lockTokenBytes[13],\n lockTokenBytes[14],\n lockTokenBytes[15],\n ]);\n}\n\n/**\n * @internal\n * Provides the time in milliseconds after which the lock renewal should occur.\n * @param lockedUntilUtc - The time until which the message is locked.\n */\nexport function calculateRenewAfterDuration(lockedUntilUtc: Date): number {\n const now = Date.now();\n const lockedUntil = lockedUntilUtc.getTime();\n const remainingTime = lockedUntil - now;\n receiverLogger.verbose(\"Locked until utc : %d\", lockedUntil);\n receiverLogger.verbose(\"Current time is : %d\", now);\n receiverLogger.verbose(\"Remaining time is : %d\", remainingTime);\n if (remainingTime < 1000) {\n return 0;\n }\n const buffer = Math.min(remainingTime / 2, 10000); // 10 seconds\n const renewAfter = remainingTime - buffer;\n receiverLogger.verbose(\"Renew after : %d\", renewAfter);\n return renewAfter;\n}\n\n/**\n * @internal\n * Converts the .net ticks to a JS Date object.\n *\n * - The epoch for the DateTimeOffset type is `0000-01-01`, while the epoch for JS Dates is\n * `1970-01-01`.\n * - The DateTimeOffset ticks value for the date `1970-01-01` is `621355968000000000`.\n * - Hence, to convert it to the JS epoch; we `subtract` the delta from the given value.\n * - Ticks in DateTimeOffset is `1/10000000` second, while ticks in JS Date is `1/1000` second.\n * - Thus, we `divide` the value by `10000` to convert it to JS Date ticks.\n *\n * @param buf - Input as a Buffer\n * @returns The JS Date object.\n */\nexport function convertTicksToDate(buf: number[]): Date {\n const epochMicroDiff: number = 621355968000000000;\n const longValue: Long = Long.fromBytesBE(buf);\n const timeInMS = longValue.sub(epochMicroDiff).div(10000).toNumber();\n const result = new Date(timeInMS);\n logger.verbose(\"The converted date is: %s\", result.toString());\n return result;\n}\n\n/**\n * @internal\n * Converts any given input to a Buffer.\n * @param input - The input that needs to be converted to a Buffer.\n */\nexport function toBuffer(input: unknown): Buffer {\n let result: any;\n messageLogger.verbose(\n \"[utils.toBuffer] The given message body that needs to be converted to buffer is: \",\n input,\n );\n if (isBuffer(input)) {\n result = input;\n } else {\n // string, undefined, null, boolean, array, object, number should end up here\n // coercing undefined to null as that will ensure that null value will be given to the\n // customer on receive.\n if (input === undefined) input = null;\n try {\n const inputStr = JSON.stringify(input);\n result = Buffer.from(inputStr, \"utf8\");\n } catch (err: any) {\n const msg =\n `An error occurred while executing JSON.stringify() on the given input ` +\n input +\n `${err instanceof Error ? err.stack : JSON.stringify(err)}`;\n messageLogger.warning(\"[utils.toBuffer] \" + msg);\n throw err instanceof Error ? err : new Error(msg);\n }\n }\n messageLogger.verbose(\"[utils.toBuffer] The converted buffer is: %O.\", result);\n return result;\n}\n\n/**\n * @internal\n * Helper utility to retrieve `string` value from given string,\n * or throws error if undefined.\n */\nexport function getString(value: unknown, nameOfProperty: string): string {\n const result = getStringOrUndefined(value);\n if (result === undefined) {\n throw new Error(\n `\"${nameOfProperty}\" received from service expected to be a string value and not undefined.`,\n );\n }\n return result;\n}\n\n/**\n * @internal\n * Helper utility to retrieve `string` value from given input,\n * or undefined if not passed in.\n */\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function getStringOrUndefined(value: any): string | undefined {\n if (!isDefined(value)) {\n return undefined;\n }\n return value.toString();\n}\n\n/**\n * @internal\n * Helper utility to retrieve `integer` value from given string,\n * or throws error if undefined.\n */\nexport function getInteger(value: unknown, nameOfProperty: string): number {\n const result = getIntegerOrUndefined(value);\n if (result === undefined) {\n throw new Error(\n `\"${nameOfProperty}\" received from service expected to be a number value and not undefined.`,\n );\n }\n return result;\n}\n\n/**\n * @internal\n * Helper utility to retrieve `integer` value from given string,\n * or undefined if not passed in.\n */\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function getIntegerOrUndefined(value: any): number | undefined {\n if (!isDefined(value)) {\n return undefined;\n }\n const result = parseInt(value.toString());\n return isNaN(result) ? undefined : result;\n}\n\n/**\n * @internal\n * Helper utility to convert ISO-8601 time into Date type.\n */\nexport function getDate(value: string, nameOfProperty: string): Date {\n return new Date(getString(value, nameOfProperty));\n}\n\n/**\n * @internal\n * Helper utility to retrieve `boolean` value from given string,\n * or throws error if undefined.\n */\nexport function getBoolean(value: unknown, nameOfProperty: string): boolean {\n const result = getBooleanOrUndefined(value);\n if (result === undefined) {\n throw new Error(\n `\"${nameOfProperty}\" received from service expected to be a boolean value and not undefined.`,\n );\n }\n return result;\n}\n\n/**\n * @internal\n * Helper utility to retrieve `boolean` value from given string,\n * or undefined if not passed in.\n */\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function getBooleanOrUndefined(value: any): boolean | undefined {\n if (!isDefined(value)) {\n return undefined;\n }\n return value.toString().trim().toLowerCase() === \"true\";\n}\n\n/**\n * @internal\n * Helps in differentiating JSON like objects from other kinds of objects.\n */\nconst EMPTY_JSON_OBJECT_CONSTRUCTOR = {}.constructor;\n\n/**\n * @internal\n * Returns `true` if given input is a JSON like object.\n */\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function isJSONLikeObject(value: any): boolean {\n // `value.constructor === {}.constructor` differentiates among the \"object\"s,\n // would filter the JSON objects and won't match any array or other kinds of objects\n\n // -------------------------------------------------------------------------------\n // Few examples | typeof obj ===\"object\" | obj.constructor==={}.constructor\n // -------------------------------------------------------------------------------\n // {abc:1} | true | true\n // [\"a\",\"b\"] | true | false\n // [{\"a\":1},{\"b\":2}] | true | false\n // new Date() | true | false\n // 123 | false | false\n // -------------------------------------------------------------------------------\n return typeof value === \"object\" && value.constructor === EMPTY_JSON_OBJECT_CONSTRUCTOR;\n}\n\n/**\n * @internal\n * Helper utility to retrieve message count details from given input,\n */\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function getMessageCountDetails(value: any): MessageCountDetails {\n const xmlnsPrefix = getXMLNSPrefix(value);\n if (!isDefined(value)) {\n value = {};\n }\n return {\n activeMessageCount: parseInt(value[`${xmlnsPrefix}:ActiveMessageCount`]) || 0,\n deadLetterMessageCount: parseInt(value[`${xmlnsPrefix}:DeadLetterMessageCount`]) || 0,\n scheduledMessageCount: parseInt(value[`${xmlnsPrefix}:ScheduledMessageCount`]) || 0,\n transferMessageCount: parseInt(value[`${xmlnsPrefix}:TransferMessageCount`]) || 0,\n transferDeadLetterMessageCount:\n parseInt(value[`${xmlnsPrefix}:TransferDeadLetterMessageCount`]) || 0,\n };\n}\n\n/**\n * @internal\n * Gets the xmlns prefix from the root of the objects that are part of the parsed response body.\n */\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function getXMLNSPrefix(value: any): string {\n if (!value[Constants.XML_METADATA_MARKER]) {\n throw new Error(\n `Error occurred while parsing the response body - cannot find the XML_METADATA_MARKER \"$\" on the object ${JSON.stringify(\n value,\n )}`,\n );\n }\n const keys = Object.keys(value[Constants.XML_METADATA_MARKER]);\n if (keys.length !== 1) {\n throw new Error(\n `Error occurred while parsing the response body - unexpected number of \"xmlns:\\${prefix}\" keys at ${JSON.stringify(\n value[Constants.XML_METADATA_MARKER],\n )}`,\n );\n }\n if (!keys[0].startsWith(\"xmlns:\")) {\n throw new Error(\n `Error occurred while parsing the response body - unexpected key at ${JSON.stringify(\n value[Constants.XML_METADATA_MARKER],\n )}`,\n );\n }\n // Pick the substring that's after \"xmlns:\"\n const xmlnsPrefix = keys[0].substring(6);\n if (!xmlnsPrefix) {\n throw new Error(\n `Error occurred while parsing the response body - unexpected xmlns prefix at ${JSON.stringify(\n value[Constants.XML_METADATA_MARKER],\n )}`,\n );\n }\n return xmlnsPrefix;\n}\n\n/**\n * Represents type of message count details in ATOM based management operations.\n * @internal\n */\nexport type MessageCountDetails = {\n activeMessageCount: number;\n deadLetterMessageCount: number;\n scheduledMessageCount: number;\n transferMessageCount: number;\n transferDeadLetterMessageCount: number;\n};\n\n/**\n * Represents type of `AuthorizationRule` in ATOM based management operations.\n */\nexport interface AuthorizationRule {\n /**\n * The claim type.\n */\n claimType: string;\n /**\n * The list of rights(\"Manage\" | \"Send\" | \"Listen\").\n */\n accessRights?: (\"Manage\" | \"Send\" | \"Listen\")[];\n /**\n * The authorization rule key name.\n */\n keyName: string;\n /**\n * The primary key for the authorization rule.\n */\n primaryKey?: string;\n /**\n * The secondary key for the authorization rule.\n */\n secondaryKey?: string;\n}\n\n/**\n * @internal\n * Helper utility to retrieve array of `AuthorizationRule` from given input,\n * or undefined if not passed in.\n */\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function getAuthorizationRulesOrUndefined(value: any): AuthorizationRule[] | undefined {\n const authorizationRules: AuthorizationRule[] = [];\n\n // Ignore special case as Service Bus treats \"\" as a valid value for authorization rules\n if (typeof value === \"string\" && value.trim() === \"\") {\n return undefined;\n }\n\n if (!isDefined(value)) {\n return undefined;\n }\n\n const rawAuthorizationRules = value.AuthorizationRule;\n if (Array.isArray(rawAuthorizationRules)) {\n for (let i = 0; i < rawAuthorizationRules.length; i++) {\n authorizationRules.push(buildAuthorizationRule(rawAuthorizationRules[i]));\n }\n } else {\n authorizationRules.push(buildAuthorizationRule(rawAuthorizationRules));\n }\n return authorizationRules;\n}\n\n/**\n * @internal\n * Helper utility to build an instance of parsed authorization rule as `AuthorizationRule` from given input.\n */\nfunction buildAuthorizationRule(value: any): AuthorizationRule {\n let accessRights;\n if (isDefined(value[\"Rights\"])) {\n accessRights = value[\"Rights\"][\"AccessRights\"];\n }\n\n const authorizationRule: AuthorizationRule = {\n claimType: value[\"ClaimType\"],\n accessRights,\n keyName: value[\"KeyName\"],\n primaryKey: value[\"PrimaryKey\"],\n secondaryKey: value[\"SecondaryKey\"],\n };\n\n if (authorizationRule.accessRights && !Array.isArray(authorizationRule.accessRights)) {\n authorizationRule.accessRights = [authorizationRule.accessRights];\n }\n return authorizationRule;\n}\n\n/**\n * @internal\n * Helper utility to extract output containing array of `RawAuthorizationRule` instances from given input,\n * or undefined if not passed in.\n */\nexport function getRawAuthorizationRules(authorizationRules: AuthorizationRule[] | undefined): any {\n if (!isDefined(authorizationRules)) {\n return undefined;\n }\n\n if (!Array.isArray(authorizationRules)) {\n throw new TypeError(\n `authorizationRules must be an array of AuthorizationRule objects or undefined, but received ${JSON.stringify(\n authorizationRules,\n undefined,\n 2,\n )}`,\n );\n }\n\n const rawAuthorizationRules: any[] = [];\n for (let i = 0; i < authorizationRules.length; i++) {\n rawAuthorizationRules.push(buildRawAuthorizationRule(authorizationRules[i]));\n }\n return { AuthorizationRule: rawAuthorizationRules };\n}\n\n/**\n * @internal\n * Helper utility to build an instance of raw authorization rule as RawAuthorizationRule from given `AuthorizationRule` input.\n * @param authorizationRule - parsed Authorization Rule instance\n */\nfunction buildRawAuthorizationRule(authorizationRule: AuthorizationRule): any {\n if (!isJSONLikeObject(authorizationRule) || authorizationRule === null) {\n throw new TypeError(\n `Expected authorizationRule input to be a JS object value, but received ${JSON.stringify(\n authorizationRule,\n undefined,\n 2,\n )}`,\n );\n }\n\n const rawAuthorizationRule: any = {\n ClaimType: authorizationRule.claimType,\n // ClaimValue is not settable by the users, but service expects the value for PUT requests\n ClaimValue: \"None\",\n Rights: {\n AccessRights: authorizationRule.accessRights,\n },\n KeyName: authorizationRule.keyName,\n PrimaryKey: authorizationRule.primaryKey,\n SecondaryKey: authorizationRule.secondaryKey,\n };\n rawAuthorizationRule[Constants.XML_METADATA_MARKER] = {\n \"p5:type\": \"SharedAccessAuthorizationRule\",\n \"xmlns:p5\": \"http://www.w3.org/2001/XMLSchema-instance\",\n };\n return rawAuthorizationRule;\n}\n\n/**\n * @internal\n * Helper utility to check if given string is an absolute URL\n */\nexport function isAbsoluteUrl(url: string): boolean {\n const _url = url.toLowerCase();\n return _url.startsWith(\"sb://\") || _url.startsWith(\"http://\") || _url.startsWith(\"https://\");\n}\n\n/**\n * Possible values for `status` of the Service Bus messaging entities.\n */\nexport type EntityStatus =\n | \"Active\"\n | \"Creating\"\n | \"Deleting\"\n | \"ReceiveDisabled\"\n | \"SendDisabled\"\n | \"Disabled\"\n | \"Renaming\"\n | \"Restoring\"\n | \"Unknown\";\n\n/**\n * Possible values for `availabilityStatus` of the Service Bus messaging entities.\n */\nexport type EntityAvailabilityStatus =\n | \"Available\"\n | \"Limited\"\n | \"Renaming\"\n | \"Restoring\"\n | \"Unknown\";\n\n/**\n * @internal\n */\ntype setTimeoutArgs = (callback: (...args: any[]) => void, ms: number, ...args: any[]) => any;\n\n/**\n * An executor for a function that returns a Promise that obeys both a timeout and an\n * optional AbortSignal.\n * @param timeoutMs - The number of milliseconds to allow before throwing an OperationTimeoutError.\n * @param timeoutMessage - The message to place in the .description field for the thrown exception for Timeout.\n * @param abortSignal - The abortSignal associated with containing operation.\n * @param abortErrorMsg - The abort error message associated with containing operation.\n * @param value - The value to be resolved with after a timeout of t milliseconds.\n *\n * @internal\n */\nexport async function waitForTimeoutOrAbortOrResolve<T>(args: {\n actionFn: () => Promise<T>;\n timeoutMs: number;\n timeoutMessage: string;\n abortSignal?: AbortSignalLike;\n // these are optional and only here for testing.\n timeoutFunctions?: {\n setTimeoutFn: setTimeoutArgs;\n clearTimeoutFn: (timeoutId: any) => void;\n };\n}): Promise<T> {\n if (args.abortSignal && args.abortSignal.aborted) {\n throw new AbortError(StandardAbortMessage);\n }\n\n let timer: any | undefined = undefined;\n let clearAbortSignal: (() => void) | undefined = undefined;\n\n const clearAbortSignalAndTimer = (): void => {\n (args.timeoutFunctions?.clearTimeoutFn ?? clearTimeout)(timer);\n\n if (clearAbortSignal) {\n clearAbortSignal();\n }\n };\n\n const abortOrTimeoutPromise = new Promise<T>((_resolve, reject) => {\n clearAbortSignal = checkAndRegisterWithAbortSignal(reject, args.abortSignal);\n\n timer = (args.timeoutFunctions?.setTimeoutFn ?? setTimeout)(() => {\n reject(new OperationTimeoutError(args.timeoutMessage));\n }, args.timeoutMs);\n });\n\n try {\n return await Promise.race([abortOrTimeoutPromise, args.actionFn()]);\n } finally {\n clearAbortSignalAndTimer();\n }\n}\n\n/**\n * Registers listener to the abort event on the abortSignal to call your abortFn and\n * returns a function that will clear the same listener.\n *\n * If abort signal is already aborted, then throws an AbortError and returns a function that does nothing\n *\n * @returns A function that removes any of our attached event listeners on the abort signal or an empty function if\n * the abortSignal was not defined.\n *\n * @internal\n */\nexport function checkAndRegisterWithAbortSignal(\n onAbortFn: (abortError: AbortError) => void,\n abortSignal?: AbortSignalLike,\n): () => void {\n if (abortSignal == null) {\n return () => {\n /** Nothing to do here, no abort signal */\n };\n }\n\n if (abortSignal.aborted) {\n throw new AbortError(StandardAbortMessage);\n }\n\n const onAbort = (): void => {\n abortSignal.removeEventListener(\"abort\", onAbort);\n onAbortFn(new AbortError(StandardAbortMessage));\n };\n\n abortSignal.addEventListener(\"abort\", onAbort);\n\n return () => abortSignal.removeEventListener(\"abort\", onAbort);\n}\n\n/**\n * @internal\n * The user agent prefix string for the ServiceBus client.\n * See guideline at https://azure.github.io/azure-sdk/general_azurecore.html#telemetry-policy\n */\nexport const libInfo: string = `azsdk-js-azureservicebus/${Constants.packageJsonInfo.version}`;\n\n/**\n * @internal\n * Returns the formatted prefix by removing the spaces, by appending the libInfo.\n */\nexport function formatUserAgentPrefix(prefix?: string): string {\n let userAgentPrefix = `${(prefix || \"\").replace(\" \", \"\")}`;\n userAgentPrefix = userAgentPrefix.length > 0 ? userAgentPrefix + \" \" : \"\";\n return `${userAgentPrefix}${libInfo}`;\n}\n\n/**\n * @internal\n * Helper method which returns `HttpResponse` from an object of shape `PipelineResponse`.\n * TODO: remove this and use toHttpResponse() directly\n */\nexport const getHttpResponseOnly = (pipelineResponse: PipelineResponse): HttpResponse =>\n toHttpResponse(pipelineResponse);\n\n/**\n * @internal\n * Type with the service versions for the ATOM API.\n */\nexport type ServiceBusAtomAPIVersion = \"2021-05\" | \"2017-04\";\n\n/**\n * @internal\n * Waits for one second if a sender is not sendable then check again. Throws\n * SenderBusyError if it is still not sendable.\n * Only waits when operation timeout is greater than one second.\n * @returns the actual waiting time.\n */\nexport async function waitForSendable(\n sendLogger: ServiceBusLogger,\n logPrefix: string,\n name: string,\n timeout: number,\n sender:\n | {\n sendable: () => boolean;\n credit: number;\n }\n | undefined,\n outgoingAvaiable: number,\n): Promise<number> {\n let waitTimeForSendable = 1000;\n if (!sender?.sendable() && timeout > waitTimeForSendable) {\n sendLogger.verbose(\n \"%s Sender '%s', waiting for 1 second for sender to become sendable\",\n logPrefix,\n name,\n );\n\n await delay(waitTimeForSendable);\n\n sendLogger.verbose(\n \"%s Sender '%s' after waiting for a second, credit: %d available: %d\",\n logPrefix,\n name,\n sender?.credit,\n outgoingAvaiable,\n );\n } else {\n waitTimeForSendable = 0;\n }\n\n if (!sender?.sendable()) {\n // let us retry to send the message after some time.\n const msg =\n `[${logPrefix}] Sender \"${name}\", ` + `cannot send the message right now. Please try later.`;\n sendLogger.warning(msg);\n const amqpError: AmqpError = {\n condition: ErrorNameConditionMapper.SenderBusyError,\n description: msg,\n };\n throw translateServiceBusError(amqpError);\n }\n return waitTimeForSendable;\n}\n"]}
@@ -77,10 +77,9 @@ function getNumberOfReceivers(connectionContext, receiverType) {
77
77
  var ConnectionContext;
78
78
  (function (ConnectionContext) {
79
79
  function create(config, tokenCredential, options) {
80
- var _a;
81
80
  if (!options)
82
81
  options = {};
83
- const userAgent = `${(0, utils_js_1.formatUserAgentPrefix)((_a = options.userAgentOptions) === null || _a === void 0 ? void 0 : _a.userAgentPrefix)} ${(0, runtimeInfo_js_1.getRuntimeInfo)()}`;
82
+ const userAgent = `${(0, utils_js_1.formatUserAgentPrefix)(options.userAgentOptions?.userAgentPrefix)} ${(0, runtimeInfo_js_1.getRuntimeInfo)()}`;
84
83
  const parameters = {
85
84
  config: config,
86
85
  // re-enabling this will be a post-GA discussion similar to event-hubs.
@@ -1 +1 @@
1
- {"version":3,"file":"connectionContext.js","sourceRoot":"","sources":["../../src/connectionContext.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAElC,qCAAsD;AACtD,sDAAsD;AAMtD,gDAAyD;AAUzD,+CAAgD;AAIhD,oEAA8D;AAC9D,8CAAwD;AACxD,0DAAuD;AAEvD,6DAAuD;AA4GvD;;;GAGG;AACH,KAAK,UAAU,yBAAyB,CACtC,iBAAoC,EACpC,wBAAyE,EACzE,YAAoC;IAEpC,MAAM,WAAW,GAAoB,EAAE,CAAC;IAExC,+DAA+D;IAC/D,KAAK,MAAM,YAAY,IAAI,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,EAAE,CAAC;QAC3E,MAAM,QAAQ,GAAG,iBAAiB,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC;QAClE,IAAI,QAAQ,IAAI,QAAQ,CAAC,YAAY,KAAK,YAAY,EAAE,CAAC;YACvD,yBAAM,CAAC,OAAO,CACZ,4CAA4C,EAC5C,iBAAiB,CAAC,UAAU,CAAC,EAAE,EAC/B,QAAQ,CAAC,YAAY,E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,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC;gBACrE,GAAG,4BAA4B,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC;aACjF,CAAC,CAAC;YAEH,yBAAM,CAAC,OAAO,CAAC,GAAG,SAAS,iCAAiC,CAAC,CAAC;YAC9D,MAAM,OAAO,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;YAEjC,yBAAM,CAAC,OAAO,CAAC,GAAG,SAAS,0CAA0C,CAAC,CAAC;YACvE,MAAM,OAAO,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;YACjC,OAAO,CAAC,wBAAwB,GAAG,IAAI,CAAC;YACxC,yBAAM,CAAC,OAAO,CAAC,IAAI,SAAS,wDAAwD,CAAC,CAAC;QACxF,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAClB,MAAM,MAAM,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;YAC3E,yBAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,SAAS,iDAAiD,CAAC,CAAC;YACpF,MAAM,MAAM,CAAC;QACf,CAAC;IACH,CAAC;IAhCqB,uBAAK,QAgC1B,CAAA;AACH,CAAC,EAjZgB,iBAAiB,iCAAjB,iBAAiB,QAiZjC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { connectionLogger as logger } from \"./log.js\";\nimport { packageJsonInfo } from \"./util/constants.js\";\nimport type {\n ConnectionConfig,\n CreateConnectionContextBaseParameters,\n SasTokenProvider,\n} from \"@azure/core-amqp\";\nimport { ConnectionContextBase } from \"@azure/core-amqp\";\nimport type { TokenCredential } from \"@azure/core-auth\";\nimport type { ServiceBusClientOptions } from \"./constructorHelpers.js\";\nimport type {\n AmqpError,\n Connection,\n ConnectionError,\n EventContext,\n OnAmqpEvent,\n} from \"rhea-promise\";\nimport { ConnectionEvents } from \"rhea-promise\";\nimport type { MessageSender } from \"./core/messageSender.js\";\nimport type { MessageSession } from \"./session/messageSession.js\";\nimport type { MessageReceiver } from \"./core/messageReceiver.js\";\nimport { ManagementClient } from \"./core/managementClient.js\";\nimport { formatUserAgentPrefix } from \"./util/utils.js\";\nimport { getRuntimeInfo } from \"./util/runtimeInfo.js\";\nimport type { NonSessionReceiverType, ReceiverType } from \"./core/linkEntity.js\";\nimport { ServiceBusError } from \"./serviceBusError.js\";\n\n/**\n * @internal\n * Provides contextual information like the underlying amqp connection, cbs session, management session,\n * tokenCredential, senders, receivers, etc. about the ServiceBus client.\n */\nexport interface ConnectionContext extends ConnectionContextBase {\n /**\n * The credential to be used for Authentication.\n * Default value: SasTokenProvider.\n */\n tokenCredential: SasTokenProvider | TokenCredential;\n /**\n * A map of active Service Bus Senders with sender name as key.\n */\n senders: { [name: string]: MessageSender };\n /**\n * A map of active Service Bus receivers for non session enabled queues/subscriptions\n * with receiver name as key.\n */\n messageReceivers: { [name: string]: MessageReceiver };\n /**\n * A map of active Service Bus receivers for session enabled queues/subscriptions\n * with receiver name as key.\n */\n messageSessions: { [name: string]: MessageSession };\n /**\n * A map of ManagementClient instances for operations over the $management link\n * with key as the entity path.\n */\n managementClients: { [name: string]: ManagementClient };\n /**\n * Function returning a promise that resolves once the connectionContext is ready to open an AMQP link.\n * ConnectionContext will be ready to open an AMQP link when:\n * - The AMQP connection is already open on both sides.\n * - The AMQP connection has been closed or disconnected. In this case, a new AMQP connection is expected\n * to be created first.\n * An AMQP link cannot be opened if the AMQP connection\n * is in the process of closing or disconnecting.\n */\n readyToOpenLink(): Promise<void>;\n /**\n * Fetches the receiver from the cache in ConnectionContext based on the receiverName given.\n * Useful for when a message needs to be settled or have its lock renewed.\n *\n * TODO: Track the right receiver on the message instead of the ConnectionContext to remove\n * the need for this helper.\n */\n getReceiverFromCache(\n receiverName: string,\n sessionId?: string,\n ): MessageReceiver | MessageSession | undefined;\n /**\n * Gets the management client for given entity path from the cache\n * Creates one if none exists in the cache\n */\n getManagementClient(entityPath: string): ManagementClient;\n /**\n * Indicates whether the connection is in the process of closing.\n * When this returns `true`, a `disconnected` event will be received\n * after the connection is closed.\n */\n isConnectionClosing(): boolean;\n}\n\n/**\n * Describes the members on the ConnectionContext that are only\n * used by it internally.\n * @hidden\n * @internal\n */\nexport interface ConnectionContextInternalMembers extends ConnectionContext {\n /**\n * Resolves once the context's connection emits a `disconnected` event.\n */\n waitForDisconnectedEvent(): Promise<void>;\n /**\n * Resolves once the connection has finished being reset.\n * Connections are reset as part of reacting to a `disconnected` event.\n */\n waitForConnectionReset(): Promise<void>;\n}\n\n/**\n * @internal\n * Helper type to get the names of all the functions on an object.\n */\n// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\ntype FunctionPropertyNames<T> = { [K in keyof T]: T[K] extends Function ? K : never }[keyof T];\n/**\n * @internal\n * Helper type to get the types of all the functions on an object.\n */\ntype FunctionProperties<T> = Pick<T, FunctionPropertyNames<T>>;\n/**\n * @internal\n * Helper type to get the types of all the functions on ConnectionContext\n * and the internal methods from ConnectionContextInternalMembers.\n * Note that this excludes the functions that ConnectionContext inherits.\n * Each function also has its `this` type set as `ConnectionContext`.\n */\ntype ConnectionContextMethods = Omit<\n FunctionProperties<ConnectionContextInternalMembers>,\n FunctionPropertyNames<ConnectionContextBase>\n> &\n ThisType<ConnectionContextInternalMembers>;\n\n/**\n * @internal\n * Helper method to call onDetached on the non-sessions batching and streaming receivers from the connection context upon seeing an error.\n */\nasync function callOnDetachedOnReceivers(\n connectionContext: ConnectionContext,\n contextOrConnectionError: Error | ConnectionError | AmqpError | undefined,\n receiverType: NonSessionReceiverType,\n): Promise<void[]> {\n const detachCalls: Promise<void>[] = [];\n\n // Iterating over non-sessions batching and streaming receivers\n for (const receiverName of Object.keys(connectionContext.messageReceivers)) {\n const receiver = connectionContext.messageReceivers[receiverName];\n if (receiver && receiver.receiverType === receiverType) {\n logger.verbose(\n \"[%s] calling detached on %s receiver '%s'.\",\n connectionContext.connection.id,\n receiver.receiverType,\n receiver.name,\n );\n detachCalls.push(\n receiver.onDetached(contextOrConnectionError).catch((err) => {\n logger.logError(\n err,\n \"[%s] An error occurred while calling onDetached() on the %s receiver '%s'\",\n connectionContext.connection.id,\n receiver.receiverType,\n receiver.name,\n );\n }),\n );\n }\n }\n return Promise.all(detachCalls);\n}\n\n/**\n * @internal\n * Helper method to call onDetached on the session receivers from the connection context upon seeing an error.\n */\nasync function callOnDetachedOnSessionReceivers(\n connectionContext: ConnectionContext,\n contextOrConnectionError: Error | ConnectionError | AmqpError | undefined,\n): Promise<void[]> {\n const getSessionError = (sessionId: string, entityPath: string): ServiceBusError => {\n const sessionInfo =\n `The receiver for session \"${sessionId}\" in \"${entityPath}\" has been closed and can no longer be used. ` +\n `Please create a new receiver using the \"acceptSession\" or \"acceptNextSession\" method on the ServiceBusClient.`;\n\n const errorMessage =\n contextOrConnectionError == null\n ? `Unknown error occurred on the AMQP connection while receiving messages. ` + sessionInfo\n : `Error occurred on the AMQP connection while receiving messages. ` +\n sessionInfo +\n `\\nMore info - \\n${contextOrConnectionError}`;\n\n const error = new ServiceBusError(errorMessage, \"SessionLockLost\");\n error.retryable = false;\n return error;\n };\n\n const detachCalls: Promise<void>[] = [];\n\n for (const receiverName of Object.keys(connectionContext.messageSessions)) {\n const receiver = connectionContext.messageSessions[receiverName];\n logger.verbose(\n \"[%s] calling detached on %s receiver(sessions).\",\n connectionContext.connection.id,\n receiver.name,\n );\n detachCalls.push(\n receiver.onDetached(getSessionError(receiver.sessionId, receiver.entityPath)).catch((err) => {\n logger.logError(\n err,\n \"[%s] An error occurred while calling onDetached() on the session receiver(sessions) '%s'\",\n connectionContext.connection.id,\n receiver.name,\n );\n }),\n );\n }\n\n return Promise.all(detachCalls);\n}\n\n/**\n * @internal\n * Helper method to get the number of receivers of specified type from the connectionContext.\n */\nfunction getNumberOfReceivers(\n connectionContext: Pick<ConnectionContext, \"messageReceivers\" | \"messageSessions\">,\n receiverType: ReceiverType,\n): number {\n if (receiverType === \"session\") {\n const receivers = connectionContext.messageSessions;\n return Object.keys(receivers).length;\n }\n const receivers = connectionContext.messageReceivers;\n const receiverNames = Object.keys(receivers);\n const count = receiverNames.reduce(\n (acc, name) => (receivers[name].receiverType === receiverType ? ++acc : acc),\n 0,\n );\n return count;\n}\n\n/**\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace ConnectionContext {\n export function create(\n config: ConnectionConfig,\n tokenCredential: SasTokenProvider | TokenCredential,\n options?: ServiceBusClientOptions,\n ): ConnectionContext {\n if (!options) options = {};\n const userAgent = `${formatUserAgentPrefix(\n options.userAgentOptions?.userAgentPrefix,\n )} ${getRuntimeInfo()}`;\n const parameters: CreateConnectionContextBaseParameters = {\n config: config,\n // re-enabling this will be a post-GA discussion similar to event-hubs.\n // dataTransformer: options.dataTransformer,\n isEntityPathRequired: false,\n connectionProperties: {\n product: \"MSJSClient\",\n userAgent,\n version: packageJsonInfo.version,\n },\n };\n // Let us create the base context and then add ServiceBus specific ConnectionContext properties.\n const connectionContext = ConnectionContextBase.create(parameters) as ConnectionContext;\n connectionContext.tokenCredential = tokenCredential;\n connectionContext.senders = {};\n connectionContext.messageReceivers = {};\n connectionContext.messageSessions = {};\n connectionContext.managementClients = {};\n\n let waitForConnectionRefreshResolve: () => void;\n let waitForConnectionRefreshPromise: Promise<void> | undefined;\n Object.assign<ConnectionContext, ConnectionContextMethods>(connectionContext, {\n isConnectionClosing() {\n // When the connection is not open, but the remote end is open,\n // then the rhea connection is in the process of terminating.\n return Boolean(!this.connection.isOpen() && this.connection.isRemoteOpen());\n },\n async readyToOpenLink() {\n logger.verbose(\n `[${this.connectionId}] Waiting until the connection is ready to open link.`,\n );\n // Check that the connection isn't in the process of closing.\n // This can happen when the idle timeout has been reached but\n // the underlying socket is waiting to be destroyed.\n if (this.isConnectionClosing()) {\n logger.verbose(\n `[${this.connectionId}] Connection is closing, waiting for disconnected event`,\n );\n // Wait for the disconnected event that indicates the underlying socket has closed.\n await this.waitForDisconnectedEvent();\n }\n\n // Wait for the connection to be reset.\n await this.waitForConnectionReset();\n logger.verbose(`[${this.connectionId}] Connection is ready to open link.`);\n },\n waitForDisconnectedEvent() {\n return new Promise((resolve) => {\n logger.verbose(\n `[${this.connectionId}] Attempting to reinitialize connection` +\n ` but the connection is in the process of closing.` +\n ` Waiting for the disconnect event before continuing.`,\n );\n this.connection.once(ConnectionEvents.disconnected, resolve);\n });\n },\n waitForConnectionReset() {\n // Check if the connection is currently in the process of disconnecting.\n if (waitForConnectionRefreshPromise) {\n logger.verbose(`[${this.connectionId}] Waiting for connection reset`);\n return waitForConnectionRefreshPromise;\n }\n\n logger.verbose(\n `[${this.connectionId}] Connection not waiting to be reset. Resolving immediately.`,\n );\n return Promise.resolve();\n },\n getReceiverFromCache(\n receiverName: string,\n sessionId?: string,\n ): MessageReceiver | MessageSession | undefined {\n if (sessionId != null && this.messageSessions[receiverName]) {\n return this.messageSessions[receiverName];\n }\n\n if (this.messageReceivers[receiverName]) {\n return this.messageReceivers[receiverName];\n }\n\n let existingReceivers = \"\";\n if (sessionId != null) {\n for (const messageSessionName of Object.keys(this.messageSessions)) {\n if (this.messageSessions[messageSessionName].sessionId === sessionId) {\n existingReceivers = this.messageSessions[messageSessionName].name;\n break;\n }\n }\n } else {\n existingReceivers +=\n (existingReceivers ? \", \" : \"\") + Object.keys(this.messageReceivers).join(\",\");\n }\n\n logger.verbose(\n \"[%s] Failed to find receiver '%s' among existing receivers: %s\",\n this.connectionId,\n receiverName,\n existingReceivers,\n );\n return;\n },\n getManagementClient(entityPath: string): ManagementClient {\n if (!this.managementClients[entityPath]) {\n this.managementClients[entityPath] = new ManagementClient(this, entityPath, {\n address: `${entityPath}/$management`,\n });\n }\n return this.managementClients[entityPath];\n },\n });\n\n // Define listeners to be added to the connection object for\n // \"connection_open\" and \"connection_error\" events.\n const onConnectionOpen: OnAmqpEvent = () => {\n connectionContext.wasConnectionCloseCalled = false;\n logger.verbose(\n \"[%s] setting 'wasConnectionCloseCalled' property of connection context to %s.\",\n connectionContext.connection.id,\n connectionContext.wasConnectionCloseCalled,\n );\n };\n\n const disconnected: OnAmqpEvent = async (context: EventContext) => {\n if (waitForConnectionRefreshPromise) {\n return;\n }\n\n waitForConnectionRefreshPromise = new Promise((resolve) => {\n waitForConnectionRefreshResolve = resolve;\n });\n\n const connectionError =\n context.connection && context.connection.error ? context.connection.error : undefined;\n if (connectionError) {\n logger.logError(\n connectionError,\n \"[%s] Error (context.connection.error) occurred on the amqp connection\",\n connectionContext.connection.id,\n );\n }\n const contextError = context.error;\n if (contextError) {\n logger.logError(\n contextError,\n \"[%s] Error (context.error) occurred on the amqp connection\",\n connectionContext.connection.id,\n );\n }\n const state: Readonly<{\n wasConnectionCloseCalled: boolean;\n numSenders: number;\n numReceivers: number;\n }> = {\n wasConnectionCloseCalled: connectionContext.wasConnectionCloseCalled,\n numSenders: Object.keys(connectionContext.senders).length,\n numReceivers:\n Object.keys(connectionContext.messageReceivers).length +\n Object.keys(connectionContext.messageSessions).length,\n };\n\n // Clear internal map maintained by rhea to avoid reconnecting of old links once the\n // connection is back up.\n connectionContext.connection.removeAllSessions();\n\n // Close the cbs session to ensure all the event handlers are released.\n await connectionContext.cbsSession.close();\n\n // Close the management sessions to ensure all the event handlers are released.\n for (const entityPath of Object.keys(connectionContext.managementClients)) {\n await connectionContext.managementClients[entityPath].close();\n }\n\n if (state.wasConnectionCloseCalled) {\n // Do Nothing\n } else {\n // Calling onDetached on sender\n if (state.numSenders) {\n // We don't do recovery for the sender:\n // Because we don't want to keep the sender active all the time\n // and the \"next\" send call would bear the burden of creating the link.\n // Call onDetached() on sender so that it can gracefully shutdown\n // by cleaning up the timers and closing the links.\n // We don't call onDetached for sender after `refreshConnection()`\n // because any new send calls that potentially initialize links would also get affected if called later.\n logger.verbose(\n `[${connectionContext.connection.id}] connection.close() was not called from the sdk and there were ${state.numSenders} ` +\n `senders. We should not reconnect.`,\n );\n const detachCalls: Promise<void>[] = [];\n for (const senderName of Object.keys(connectionContext.senders)) {\n const sender = connectionContext.senders[senderName];\n if (sender) {\n logger.verbose(\n \"[%s] calling detached on sender '%s'.\",\n connectionContext.connection.id,\n sender.name,\n );\n detachCalls.push(\n sender.onDetached().catch((err) => {\n logger.logError(\n err,\n \"[%s] An error occurred while calling onDetached() the sender '%s'\",\n connectionContext.connection.id,\n sender.name,\n );\n }),\n );\n }\n }\n await Promise.all(detachCalls);\n }\n\n // Calling onDetached on batching receivers for the same reasons as sender\n const numBatchingReceivers = getNumberOfReceivers(connectionContext, \"batching\");\n if (numBatchingReceivers) {\n logger.verbose(\n `[${connectionContext.connection.id}] connection.close() was not called from the sdk and there were ${numBatchingReceivers} ` +\n `batching receivers. We should not reconnect.`,\n );\n\n // Call onDetached() on receivers so that batching receivers it can gracefully close any ongoing batch operation\n await callOnDetachedOnReceivers(\n connectionContext,\n connectionError || contextError,\n \"batching\",\n );\n }\n\n // Calling onDetached on session receivers\n const numSessionReceivers = getNumberOfReceivers(connectionContext, \"session\");\n if (numSessionReceivers) {\n logger.verbose(\n `[${connectionContext.connection.id}] connection.close() was not called from the sdk and there were ${numSessionReceivers} ` +\n `session receivers. We should close them.`,\n );\n\n await callOnDetachedOnSessionReceivers(\n connectionContext,\n connectionError || contextError,\n );\n }\n }\n await refreshConnection();\n waitForConnectionRefreshResolve();\n waitForConnectionRefreshPromise = undefined;\n // The connection should always be brought back up if the sdk did not call connection.close()\n // and there was at least one receiver link on the connection before it went down.\n logger.verbose(\"[%s] state: %O\", connectionContext.connectionId, state);\n\n // Calling onDetached on streaming receivers\n const numStreamingReceivers = getNumberOfReceivers(connectionContext, \"streaming\");\n if (!state.wasConnectionCloseCalled && numStreamingReceivers) {\n logger.verbose(\n `[${connectionContext.connection.id}] connection.close() was not called from the sdk and there were ${numStreamingReceivers} ` +\n `streaming receivers. We should reconnect.`,\n );\n\n // Calling `onDetached()` on streaming receivers after the refreshConnection() since `onDetached()` would\n // recover the streaming receivers and that would only be possible after the connection is refreshed.\n //\n // This is different from the batching receiver since `onDetached()` for the batching receiver would\n // return the outstanding messages and close the receive link.\n await callOnDetachedOnReceivers(\n connectionContext,\n connectionError || contextError,\n \"streaming\",\n );\n }\n };\n\n const protocolError: OnAmqpEvent = async (context: EventContext) => {\n if (context.connection && context.connection.error) {\n logger.logError(\n context.connection.error,\n \"[%s] Error (context.connection.error) occurred on the amqp connection\",\n connectionContext.connection.id,\n );\n }\n if (context.error) {\n logger.logError(\n context.error,\n \"[%s] Error (context.error) occurred on the amqp connection\",\n connectionContext.connection.id,\n );\n }\n };\n\n const error: OnAmqpEvent = async (context: EventContext) => {\n if (context.connection && context.connection.error) {\n logger.logError(\n context.connection.error,\n \"[%s] Error (context.connection.error) occurred on the amqp connection\",\n connectionContext.connection.id,\n );\n }\n if (context.error) {\n logger.logError(\n context.error,\n \"[%s] Error (context.error) occurred on the amqp connection\",\n connectionContext.connection.id,\n );\n }\n };\n\n async function refreshConnection(): Promise<void> {\n const originalConnectionId = connectionContext.connectionId;\n try {\n await cleanConnectionContext();\n } catch (err: any) {\n logger.logError(\n err,\n `[${connectionContext.connectionId}] There was an error closing the connection before reconnecting`,\n );\n }\n // Create a new connection, id, locks, and cbs client.\n connectionContext.refreshConnection();\n addConnectionListeners(connectionContext.connection);\n logger.verbose(\n `The connection \"${originalConnectionId}\" has been updated to \"${connectionContext.connectionId}\".`,\n );\n }\n\n function addConnectionListeners(connection: Connection): void {\n // Add listeners on the connection object.\n connection.on(ConnectionEvents.connectionOpen, onConnectionOpen);\n connection.on(ConnectionEvents.disconnected, disconnected);\n connection.on(ConnectionEvents.protocolError, protocolError);\n connection.on(ConnectionEvents.error, error);\n }\n\n async function cleanConnectionContext(): Promise<void> {\n // Remove listeners from the connection object.\n connectionContext.connection.removeListener(\n ConnectionEvents.connectionOpen,\n onConnectionOpen,\n );\n connectionContext.connection.removeListener(ConnectionEvents.disconnected, disconnected);\n connectionContext.connection.removeListener(ConnectionEvents.protocolError, protocolError);\n connectionContext.connection.removeListener(ConnectionEvents.error, error);\n // Close the connection\n await connectionContext.connection.close();\n }\n\n addConnectionListeners(connectionContext.connection);\n\n logger.verbose(\"[%s] Created connection context successfully.\", connectionContext.connectionId);\n\n return connectionContext;\n }\n\n /**\n * Closes the AMQP connection created by this ServiceBusClient along with AMQP links for\n * sender/receivers created by the queue/topic/subscription clients created by this\n * ServiceBusClient.\n * Once closed,\n * - the clients created by this ServiceBusClient cannot be used to send/receive messages anymore.\n * - this ServiceBusClient cannot be used to create any new queues/topics/subscriptions clients.\n */\n export async function close(context: ConnectionContext): Promise<void> {\n const logPrefix = `[${context.connectionId}]`;\n\n try {\n logger.verbose(`${logPrefix} Permanently closing the amqp connection on the client.`);\n\n const senderNames = Object.keys(context.senders);\n const messageReceiverNames = Object.keys(context.messageReceivers);\n const messageSessionNames = Object.keys(context.messageSessions);\n const managementClientsEntityPaths = Object.keys(context.managementClients);\n logger.verbose(\n `${logPrefix} Permanently closing all the senders(${senderNames.length}), MessageReceivers(${messageReceiverNames.length}), MessageSessions(${messageSessionNames.length}), and ManagementClients(${managementClientsEntityPaths.length}).`,\n );\n await Promise.all([\n ...senderNames.map((n) => context.senders[n].close()),\n ...messageReceiverNames.map((n) => context.messageReceivers[n].close()),\n ...messageSessionNames.map((n) => context.messageSessions[n].close()),\n ...managementClientsEntityPaths.map((p) => context.managementClients[p].close()),\n ]);\n\n logger.verbose(`${logPrefix} Permanently closing cbsSession`);\n await context.cbsSession.close();\n\n logger.verbose(`${logPrefix} Permanently closing internal connection`);\n await context.connection.close();\n context.wasConnectionCloseCalled = true;\n logger.verbose(`[${logPrefix} Permanently closed the amqp connection on the client.`);\n } catch (err: any) {\n const errObj = err instanceof Error ? err : new Error(JSON.stringify(err));\n logger.logError(err, `${logPrefix} An error occurred while closing the connection`);\n throw errObj;\n }\n }\n}\n"]}
1
+ {"version":3,"file":"connectionContext.js","sourceRoot":"","sources":["../../src/connectionContext.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAElC,qCAAsD;AACtD,sDAAsD;AAMtD,gDAAyD;AAUzD,+CAAgD;AAIhD,oEAA8D;AAC9D,8CAAwD;AACxD,0DAAuD;AAEvD,6DAAuD;AA4GvD;;;GAGG;AACH,KAAK,UAAU,yBAAyB,CACtC,iBAAoC,EACpC,wBAAyE,EACzE,YAAoC;IAEpC,MAAM,WAAW,GAAoB,EAAE,CAAC;IAExC,+DAA+D;IAC/D,KAAK,MAAM,YAAY,IAAI,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,EAAE,CAAC;QAC3E,MAAM,QAAQ,GAAG,iBAAiB,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC;QAClE,IAAI,QAAQ,IAAI,QAAQ,CAAC,YAAY,KAAK,YAAY,EAAE,CAAC;YACvD,yBAAM,CAAC,OAAO,CACZ,4CAA4C,EAC5C,iBAAiB,CAAC,UAAU,CAAC,EAAE,EAC/B,QAAQ,CAAC,YAAY,EACrB,QAAQ,CAAC,IAAI,CACd,CAAC;YACF,WAAW,CAAC,IAAI,CACd,QAAQ,CAAC,UAAU,CAAC,wBAAwB,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;gBAC1D,yBAAM,CAAC,QAAQ,CACb,GAAG,EACH,2EAA2E,EAC3E,iBAAiB,CAAC,UAAU,CAAC,EAAE,EAC/B,QAAQ,CAAC,YAAY,EACrB,QAAQ,CAAC,IAAI,CACd,CAAC;YACJ,CAAC,CAAC,CACH,CAAC;QACJ,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;AAClC,CAAC;AAED;;;GAGG;AACH,KAAK,UAAU,gCAAg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,UAAU,CAAC,KAAK,EAAE,CAAC;YACjC,OAAO,CAAC,wBAAwB,GAAG,IAAI,CAAC;YACxC,yBAAM,CAAC,OAAO,CAAC,IAAI,SAAS,wDAAwD,CAAC,CAAC;QACxF,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAClB,MAAM,MAAM,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;YAC3E,yBAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,SAAS,iDAAiD,CAAC,CAAC;YACpF,MAAM,MAAM,CAAC;QACf,CAAC;IACH,CAAC;IAhCqB,uBAAK,QAgC1B,CAAA;AACH,CAAC,EAjZgB,iBAAiB,iCAAjB,iBAAiB,QAiZjC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { connectionLogger as logger } from \"./log.js\";\nimport { packageJsonInfo } from \"./util/constants.js\";\nimport type {\n ConnectionConfig,\n CreateConnectionContextBaseParameters,\n SasTokenProvider,\n} from \"@azure/core-amqp\";\nimport { ConnectionContextBase } from \"@azure/core-amqp\";\nimport type { TokenCredential } from \"@azure/core-auth\";\nimport type { ServiceBusClientOptions } from \"./constructorHelpers.js\";\nimport type {\n AmqpError,\n Connection,\n ConnectionError,\n EventContext,\n OnAmqpEvent,\n} from \"rhea-promise\";\nimport { ConnectionEvents } from \"rhea-promise\";\nimport type { MessageSender } from \"./core/messageSender.js\";\nimport type { MessageSession } from \"./session/messageSession.js\";\nimport type { MessageReceiver } from \"./core/messageReceiver.js\";\nimport { ManagementClient } from \"./core/managementClient.js\";\nimport { formatUserAgentPrefix } from \"./util/utils.js\";\nimport { getRuntimeInfo } from \"./util/runtimeInfo.js\";\nimport type { NonSessionReceiverType, ReceiverType } from \"./core/linkEntity.js\";\nimport { ServiceBusError } from \"./serviceBusError.js\";\n\n/**\n * @internal\n * Provides contextual information like the underlying amqp connection, cbs session, management session,\n * tokenCredential, senders, receivers, etc. about the ServiceBus client.\n */\nexport interface ConnectionContext extends ConnectionContextBase {\n /**\n * The credential to be used for Authentication.\n * Default value: SasTokenProvider.\n */\n tokenCredential: SasTokenProvider | TokenCredential;\n /**\n * A map of active Service Bus Senders with sender name as key.\n */\n senders: { [name: string]: MessageSender };\n /**\n * A map of active Service Bus receivers for non session enabled queues/subscriptions\n * with receiver name as key.\n */\n messageReceivers: { [name: string]: MessageReceiver };\n /**\n * A map of active Service Bus receivers for session enabled queues/subscriptions\n * with receiver name as key.\n */\n messageSessions: { [name: string]: MessageSession };\n /**\n * A map of ManagementClient instances for operations over the $management link\n * with key as the entity path.\n */\n managementClients: { [name: string]: ManagementClient };\n /**\n * Function returning a promise that resolves once the connectionContext is ready to open an AMQP link.\n * ConnectionContext will be ready to open an AMQP link when:\n * - The AMQP connection is already open on both sides.\n * - The AMQP connection has been closed or disconnected. In this case, a new AMQP connection is expected\n * to be created first.\n * An AMQP link cannot be opened if the AMQP connection\n * is in the process of closing or disconnecting.\n */\n readyToOpenLink(): Promise<void>;\n /**\n * Fetches the receiver from the cache in ConnectionContext based on the receiverName given.\n * Useful for when a message needs to be settled or have its lock renewed.\n *\n * TODO: Track the right receiver on the message instead of the ConnectionContext to remove\n * the need for this helper.\n */\n getReceiverFromCache(\n receiverName: string,\n sessionId?: string,\n ): MessageReceiver | MessageSession | undefined;\n /**\n * Gets the management client for given entity path from the cache\n * Creates one if none exists in the cache\n */\n getManagementClient(entityPath: string): ManagementClient;\n /**\n * Indicates whether the connection is in the process of closing.\n * When this returns `true`, a `disconnected` event will be received\n * after the connection is closed.\n */\n isConnectionClosing(): boolean;\n}\n\n/**\n * Describes the members on the ConnectionContext that are only\n * used by it internally.\n * @hidden\n * @internal\n */\nexport interface ConnectionContextInternalMembers extends ConnectionContext {\n /**\n * Resolves once the context's connection emits a `disconnected` event.\n */\n waitForDisconnectedEvent(): Promise<void>;\n /**\n * Resolves once the connection has finished being reset.\n * Connections are reset as part of reacting to a `disconnected` event.\n */\n waitForConnectionReset(): Promise<void>;\n}\n\n/**\n * @internal\n * Helper type to get the names of all the functions on an object.\n */\n// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\ntype FunctionPropertyNames<T> = { [K in keyof T]: T[K] extends Function ? K : never }[keyof T];\n/**\n * @internal\n * Helper type to get the types of all the functions on an object.\n */\ntype FunctionProperties<T> = Pick<T, FunctionPropertyNames<T>>;\n/**\n * @internal\n * Helper type to get the types of all the functions on ConnectionContext\n * and the internal methods from ConnectionContextInternalMembers.\n * Note that this excludes the functions that ConnectionContext inherits.\n * Each function also has its `this` type set as `ConnectionContext`.\n */\ntype ConnectionContextMethods = Omit<\n FunctionProperties<ConnectionContextInternalMembers>,\n FunctionPropertyNames<ConnectionContextBase>\n> &\n ThisType<ConnectionContextInternalMembers>;\n\n/**\n * @internal\n * Helper method to call onDetached on the non-sessions batching and streaming receivers from the connection context upon seeing an error.\n */\nasync function callOnDetachedOnReceivers(\n connectionContext: ConnectionContext,\n contextOrConnectionError: Error | ConnectionError | AmqpError | undefined,\n receiverType: NonSessionReceiverType,\n): Promise<void[]> {\n const detachCalls: Promise<void>[] = [];\n\n // Iterating over non-sessions batching and streaming receivers\n for (const receiverName of Object.keys(connectionContext.messageReceivers)) {\n const receiver = connectionContext.messageReceivers[receiverName];\n if (receiver && receiver.receiverType === receiverType) {\n logger.verbose(\n \"[%s] calling detached on %s receiver '%s'.\",\n connectionContext.connection.id,\n receiver.receiverType,\n receiver.name,\n );\n detachCalls.push(\n receiver.onDetached(contextOrConnectionError).catch((err) => {\n logger.logError(\n err,\n \"[%s] An error occurred while calling onDetached() on the %s receiver '%s'\",\n connectionContext.connection.id,\n receiver.receiverType,\n receiver.name,\n );\n }),\n );\n }\n }\n return Promise.all(detachCalls);\n}\n\n/**\n * @internal\n * Helper method to call onDetached on the session receivers from the connection context upon seeing an error.\n */\nasync function callOnDetachedOnSessionReceivers(\n connectionContext: ConnectionContext,\n contextOrConnectionError: Error | ConnectionError | AmqpError | undefined,\n): Promise<void[]> {\n const getSessionError = (sessionId: string, entityPath: string): ServiceBusError => {\n const sessionInfo =\n `The receiver for session \"${sessionId}\" in \"${entityPath}\" has been closed and can no longer be used. ` +\n `Please create a new receiver using the \"acceptSession\" or \"acceptNextSession\" method on the ServiceBusClient.`;\n\n const errorMessage =\n contextOrConnectionError == null\n ? `Unknown error occurred on the AMQP connection while receiving messages. ` + sessionInfo\n : `Error occurred on the AMQP connection while receiving messages. ` +\n sessionInfo +\n `\\nMore info - \\n${contextOrConnectionError}`;\n\n const error = new ServiceBusError(errorMessage, \"SessionLockLost\");\n error.retryable = false;\n return error;\n };\n\n const detachCalls: Promise<void>[] = [];\n\n for (const receiverName of Object.keys(connectionContext.messageSessions)) {\n const receiver = connectionContext.messageSessions[receiverName];\n logger.verbose(\n \"[%s] calling detached on %s receiver(sessions).\",\n connectionContext.connection.id,\n receiver.name,\n );\n detachCalls.push(\n receiver.onDetached(getSessionError(receiver.sessionId, receiver.entityPath)).catch((err) => {\n logger.logError(\n err,\n \"[%s] An error occurred while calling onDetached() on the session receiver(sessions) '%s'\",\n connectionContext.connection.id,\n receiver.name,\n );\n }),\n );\n }\n\n return Promise.all(detachCalls);\n}\n\n/**\n * @internal\n * Helper method to get the number of receivers of specified type from the connectionContext.\n */\nfunction getNumberOfReceivers(\n connectionContext: Pick<ConnectionContext, \"messageReceivers\" | \"messageSessions\">,\n receiverType: ReceiverType,\n): number {\n if (receiverType === \"session\") {\n const receivers = connectionContext.messageSessions;\n return Object.keys(receivers).length;\n }\n const receivers = connectionContext.messageReceivers;\n const receiverNames = Object.keys(receivers);\n const count = receiverNames.reduce(\n (acc, name) => (receivers[name].receiverType === receiverType ? ++acc : acc),\n 0,\n );\n return count;\n}\n\n/**\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace ConnectionContext {\n export function create(\n config: ConnectionConfig,\n tokenCredential: SasTokenProvider | TokenCredential,\n options?: ServiceBusClientOptions,\n ): ConnectionContext {\n if (!options) options = {};\n const userAgent = `${formatUserAgentPrefix(\n options.userAgentOptions?.userAgentPrefix,\n )} ${getRuntimeInfo()}`;\n const parameters: CreateConnectionContextBaseParameters = {\n config: config,\n // re-enabling this will be a post-GA discussion similar to event-hubs.\n // dataTransformer: options.dataTransformer,\n isEntityPathRequired: false,\n connectionProperties: {\n product: \"MSJSClient\",\n userAgent,\n version: packageJsonInfo.version,\n },\n };\n // Let us create the base context and then add ServiceBus specific ConnectionContext properties.\n const connectionContext = ConnectionContextBase.create(parameters) as ConnectionContext;\n connectionContext.tokenCredential = tokenCredential;\n connectionContext.senders = {};\n connectionContext.messageReceivers = {};\n connectionContext.messageSessions = {};\n connectionContext.managementClients = {};\n\n let waitForConnectionRefreshResolve: () => void;\n let waitForConnectionRefreshPromise: Promise<void> | undefined;\n Object.assign<ConnectionContext, ConnectionContextMethods>(connectionContext, {\n isConnectionClosing() {\n // When the connection is not open, but the remote end is open,\n // then the rhea connection is in the process of terminating.\n return Boolean(!this.connection.isOpen() && this.connection.isRemoteOpen());\n },\n async readyToOpenLink() {\n logger.verbose(\n `[${this.connectionId}] Waiting until the connection is ready to open link.`,\n );\n // Check that the connection isn't in the process of closing.\n // This can happen when the idle timeout has been reached but\n // the underlying socket is waiting to be destroyed.\n if (this.isConnectionClosing()) {\n logger.verbose(\n `[${this.connectionId}] Connection is closing, waiting for disconnected event`,\n );\n // Wait for the disconnected event that indicates the underlying socket has closed.\n await this.waitForDisconnectedEvent();\n }\n\n // Wait for the connection to be reset.\n await this.waitForConnectionReset();\n logger.verbose(`[${this.connectionId}] Connection is ready to open link.`);\n },\n waitForDisconnectedEvent() {\n return new Promise((resolve) => {\n logger.verbose(\n `[${this.connectionId}] Attempting to reinitialize connection` +\n ` but the connection is in the process of closing.` +\n ` Waiting for the disconnect event before continuing.`,\n );\n this.connection.once(ConnectionEvents.disconnected, resolve);\n });\n },\n waitForConnectionReset() {\n // Check if the connection is currently in the process of disconnecting.\n if (waitForConnectionRefreshPromise) {\n logger.verbose(`[${this.connectionId}] Waiting for connection reset`);\n return waitForConnectionRefreshPromise;\n }\n\n logger.verbose(\n `[${this.connectionId}] Connection not waiting to be reset. Resolving immediately.`,\n );\n return Promise.resolve();\n },\n getReceiverFromCache(\n receiverName: string,\n sessionId?: string,\n ): MessageReceiver | MessageSession | undefined {\n if (sessionId != null && this.messageSessions[receiverName]) {\n return this.messageSessions[receiverName];\n }\n\n if (this.messageReceivers[receiverName]) {\n return this.messageReceivers[receiverName];\n }\n\n let existingReceivers = \"\";\n if (sessionId != null) {\n for (const messageSessionName of Object.keys(this.messageSessions)) {\n if (this.messageSessions[messageSessionName].sessionId === sessionId) {\n existingReceivers = this.messageSessions[messageSessionName].name;\n break;\n }\n }\n } else {\n existingReceivers +=\n (existingReceivers ? \", \" : \"\") + Object.keys(this.messageReceivers).join(\",\");\n }\n\n logger.verbose(\n \"[%s] Failed to find receiver '%s' among existing receivers: %s\",\n this.connectionId,\n receiverName,\n existingReceivers,\n );\n return;\n },\n getManagementClient(entityPath: string): ManagementClient {\n if (!this.managementClients[entityPath]) {\n this.managementClients[entityPath] = new ManagementClient(this, entityPath, {\n address: `${entityPath}/$management`,\n });\n }\n return this.managementClients[entityPath];\n },\n });\n\n // Define listeners to be added to the connection object for\n // \"connection_open\" and \"connection_error\" events.\n const onConnectionOpen: OnAmqpEvent = () => {\n connectionContext.wasConnectionCloseCalled = false;\n logger.verbose(\n \"[%s] setting 'wasConnectionCloseCalled' property of connection context to %s.\",\n connectionContext.connection.id,\n connectionContext.wasConnectionCloseCalled,\n );\n };\n\n const disconnected: OnAmqpEvent = async (context: EventContext) => {\n if (waitForConnectionRefreshPromise) {\n return;\n }\n\n waitForConnectionRefreshPromise = new Promise((resolve) => {\n waitForConnectionRefreshResolve = resolve;\n });\n\n const connectionError =\n context.connection && context.connection.error ? context.connection.error : undefined;\n if (connectionError) {\n logger.logError(\n connectionError,\n \"[%s] Error (context.connection.error) occurred on the amqp connection\",\n connectionContext.connection.id,\n );\n }\n const contextError = context.error;\n if (contextError) {\n logger.logError(\n contextError,\n \"[%s] Error (context.error) occurred on the amqp connection\",\n connectionContext.connection.id,\n );\n }\n const state: Readonly<{\n wasConnectionCloseCalled: boolean;\n numSenders: number;\n numReceivers: number;\n }> = {\n wasConnectionCloseCalled: connectionContext.wasConnectionCloseCalled,\n numSenders: Object.keys(connectionContext.senders).length,\n numReceivers:\n Object.keys(connectionContext.messageReceivers).length +\n Object.keys(connectionContext.messageSessions).length,\n };\n\n // Clear internal map maintained by rhea to avoid reconnecting of old links once the\n // connection is back up.\n connectionContext.connection.removeAllSessions();\n\n // Close the cbs session to ensure all the event handlers are released.\n await connectionContext.cbsSession.close();\n\n // Close the management sessions to ensure all the event handlers are released.\n for (const entityPath of Object.keys(connectionContext.managementClients)) {\n await connectionContext.managementClients[entityPath].close();\n }\n\n if (state.wasConnectionCloseCalled) {\n // Do Nothing\n } else {\n // Calling onDetached on sender\n if (state.numSenders) {\n // We don't do recovery for the sender:\n // Because we don't want to keep the sender active all the time\n // and the \"next\" send call would bear the burden of creating the link.\n // Call onDetached() on sender so that it can gracefully shutdown\n // by cleaning up the timers and closing the links.\n // We don't call onDetached for sender after `refreshConnection()`\n // because any new send calls that potentially initialize links would also get affected if called later.\n logger.verbose(\n `[${connectionContext.connection.id}] connection.close() was not called from the sdk and there were ${state.numSenders} ` +\n `senders. We should not reconnect.`,\n );\n const detachCalls: Promise<void>[] = [];\n for (const senderName of Object.keys(connectionContext.senders)) {\n const sender = connectionContext.senders[senderName];\n if (sender) {\n logger.verbose(\n \"[%s] calling detached on sender '%s'.\",\n connectionContext.connection.id,\n sender.name,\n );\n detachCalls.push(\n sender.onDetached().catch((err) => {\n logger.logError(\n err,\n \"[%s] An error occurred while calling onDetached() the sender '%s'\",\n connectionContext.connection.id,\n sender.name,\n );\n }),\n );\n }\n }\n await Promise.all(detachCalls);\n }\n\n // Calling onDetached on batching receivers for the same reasons as sender\n const numBatchingReceivers = getNumberOfReceivers(connectionContext, \"batching\");\n if (numBatchingReceivers) {\n logger.verbose(\n `[${connectionContext.connection.id}] connection.close() was not called from the sdk and there were ${numBatchingReceivers} ` +\n `batching receivers. We should not reconnect.`,\n );\n\n // Call onDetached() on receivers so that batching receivers it can gracefully close any ongoing batch operation\n await callOnDetachedOnReceivers(\n connectionContext,\n connectionError || contextError,\n \"batching\",\n );\n }\n\n // Calling onDetached on session receivers\n const numSessionReceivers = getNumberOfReceivers(connectionContext, \"session\");\n if (numSessionReceivers) {\n logger.verbose(\n `[${connectionContext.connection.id}] connection.close() was not called from the sdk and there were ${numSessionReceivers} ` +\n `session receivers. We should close them.`,\n );\n\n await callOnDetachedOnSessionReceivers(\n connectionContext,\n connectionError || contextError,\n );\n }\n }\n await refreshConnection();\n waitForConnectionRefreshResolve();\n waitForConnectionRefreshPromise = undefined;\n // The connection should always be brought back up if the sdk did not call connection.close()\n // and there was at least one receiver link on the connection before it went down.\n logger.verbose(\"[%s] state: %O\", connectionContext.connectionId, state);\n\n // Calling onDetached on streaming receivers\n const numStreamingReceivers = getNumberOfReceivers(connectionContext, \"streaming\");\n if (!state.wasConnectionCloseCalled && numStreamingReceivers) {\n logger.verbose(\n `[${connectionContext.connection.id}] connection.close() was not called from the sdk and there were ${numStreamingReceivers} ` +\n `streaming receivers. We should reconnect.`,\n );\n\n // Calling `onDetached()` on streaming receivers after the refreshConnection() since `onDetached()` would\n // recover the streaming receivers and that would only be possible after the connection is refreshed.\n //\n // This is different from the batching receiver since `onDetached()` for the batching receiver would\n // return the outstanding messages and close the receive link.\n await callOnDetachedOnReceivers(\n connectionContext,\n connectionError || contextError,\n \"streaming\",\n );\n }\n };\n\n const protocolError: OnAmqpEvent = async (context: EventContext) => {\n if (context.connection && context.connection.error) {\n logger.logError(\n context.connection.error,\n \"[%s] Error (context.connection.error) occurred on the amqp connection\",\n connectionContext.connection.id,\n );\n }\n if (context.error) {\n logger.logError(\n context.error,\n \"[%s] Error (context.error) occurred on the amqp connection\",\n connectionContext.connection.id,\n );\n }\n };\n\n const error: OnAmqpEvent = async (context: EventContext) => {\n if (context.connection && context.connection.error) {\n logger.logError(\n context.connection.error,\n \"[%s] Error (context.connection.error) occurred on the amqp connection\",\n connectionContext.connection.id,\n );\n }\n if (context.error) {\n logger.logError(\n context.error,\n \"[%s] Error (context.error) occurred on the amqp connection\",\n connectionContext.connection.id,\n );\n }\n };\n\n async function refreshConnection(): Promise<void> {\n const originalConnectionId = connectionContext.connectionId;\n try {\n await cleanConnectionContext();\n } catch (err: any) {\n logger.logError(\n err,\n `[${connectionContext.connectionId}] There was an error closing the connection before reconnecting`,\n );\n }\n // Create a new connection, id, locks, and cbs client.\n connectionContext.refreshConnection();\n addConnectionListeners(connectionContext.connection);\n logger.verbose(\n `The connection \"${originalConnectionId}\" has been updated to \"${connectionContext.connectionId}\".`,\n );\n }\n\n function addConnectionListeners(connection: Connection): void {\n // Add listeners on the connection object.\n connection.on(ConnectionEvents.connectionOpen, onConnectionOpen);\n connection.on(ConnectionEvents.disconnected, disconnected);\n connection.on(ConnectionEvents.protocolError, protocolError);\n connection.on(ConnectionEvents.error, error);\n }\n\n async function cleanConnectionContext(): Promise<void> {\n // Remove listeners from the connection object.\n connectionContext.connection.removeListener(\n ConnectionEvents.connectionOpen,\n onConnectionOpen,\n );\n connectionContext.connection.removeListener(ConnectionEvents.disconnected, disconnected);\n connectionContext.connection.removeListener(ConnectionEvents.protocolError, protocolError);\n connectionContext.connection.removeListener(ConnectionEvents.error, error);\n // Close the connection\n await connectionContext.connection.close();\n }\n\n addConnectionListeners(connectionContext.connection);\n\n logger.verbose(\"[%s] Created connection context successfully.\", connectionContext.connectionId);\n\n return connectionContext;\n }\n\n /**\n * Closes the AMQP connection created by this ServiceBusClient along with AMQP links for\n * sender/receivers created by the queue/topic/subscription clients created by this\n * ServiceBusClient.\n * Once closed,\n * - the clients created by this ServiceBusClient cannot be used to send/receive messages anymore.\n * - this ServiceBusClient cannot be used to create any new queues/topics/subscriptions clients.\n */\n export async function close(context: ConnectionContext): Promise<void> {\n const logPrefix = `[${context.connectionId}]`;\n\n try {\n logger.verbose(`${logPrefix} Permanently closing the amqp connection on the client.`);\n\n const senderNames = Object.keys(context.senders);\n const messageReceiverNames = Object.keys(context.messageReceivers);\n const messageSessionNames = Object.keys(context.messageSessions);\n const managementClientsEntityPaths = Object.keys(context.managementClients);\n logger.verbose(\n `${logPrefix} Permanently closing all the senders(${senderNames.length}), MessageReceivers(${messageReceiverNames.length}), MessageSessions(${messageSessionNames.length}), and ManagementClients(${managementClientsEntityPaths.length}).`,\n );\n await Promise.all([\n ...senderNames.map((n) => context.senders[n].close()),\n ...messageReceiverNames.map((n) => context.messageReceivers[n].close()),\n ...messageSessionNames.map((n) => context.messageSessions[n].close()),\n ...managementClientsEntityPaths.map((p) => context.managementClients[p].close()),\n ]);\n\n logger.verbose(`${logPrefix} Permanently closing cbsSession`);\n await context.cbsSession.close();\n\n logger.verbose(`${logPrefix} Permanently closing internal connection`);\n await context.connection.close();\n context.wasConnectionCloseCalled = true;\n logger.verbose(`[${logPrefix} Permanently closed the amqp connection on the client.`);\n } catch (err: any) {\n const errObj = err instanceof Error ? err : new Error(JSON.stringify(err));\n logger.logError(err, `${logPrefix} An error occurred while closing the connection`);\n throw errObj;\n }\n }\n}\n"]}
@@ -47,12 +47,11 @@ function setCustomEndpointAddress(config, customEndpointAddress) {
47
47
  *
48
48
  */
49
49
  function createConnectionContext(connectionString, credential, options) {
50
- var _a, _b;
51
50
  const config = core_amqp_1.ConnectionConfig.create(connectionString);
52
- config.webSocket = (_a = options === null || options === void 0 ? void 0 : options.webSocketOptions) === null || _a === void 0 ? void 0 : _a.webSocket;
51
+ config.webSocket = options?.webSocketOptions?.webSocket;
53
52
  config.webSocketEndpointPath = "$servicebus/websocket";
54
- config.webSocketConstructorOptions = (_b = options === null || options === void 0 ? void 0 : options.webSocketOptions) === null || _b === void 0 ? void 0 : _b.webSocketConstructorOptions;
55
- if (options === null || options === void 0 ? void 0 : options.customEndpointAddress) {
53
+ config.webSocketConstructorOptions = options?.webSocketOptions?.webSocketConstructorOptions;
54
+ if (options?.customEndpointAddress) {
56
55
  setCustomEndpointAddress(config, options.customEndpointAddress);
57
56
  }
58
57
  return connectionContext_js_1.ConnectionContext.create(config, credential, options);