@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":"serviceBusMessageBatch.js","sourceRoot":"","sources":["../../src/serviceBusMessageBatch.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAGlC,iEAAuD;AACvD,gDAI0B;AAG1B,+CAGsB;AAItB,6DAA8D;AAC9D,iGAAiF;AAEjF;;;GAGG;AACH,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAC/B;;;GAGG;AACH,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAC/B;;;GAGG;AACH,MAAM,oBAAoB,GAAG,GAAG,CAAC;AA6DjC;;;;GAIG;AACH,MAAa,0BAA0B;IAarC;;;;;OAKG;IACH,YACU,QAA2B,EAC3B,eAAuB;QADvB,aAAQ,GAAR,QAAQ,CAAmB;QAC3B,oBAAe,GAAf,eAAe,CAAQ;QAhBjC;;WAEG;QACK,qBAAgB,GAAa,EAAE,CAAC;QACxC;;WAEG;QACK,kBAAa,GAAqB,EAAE,CAAC;QAW3C,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC;QACtB,IAAI,CAAC,uBAAuB,GAAG,EAAE,CAAC;IACpC,CAAC;IAED;;;OAGG;IACH,IAAI,cAAc;QAChB,OAAO,IAAI,CAAC,eAAe,CAAC;IAC9B,CAAC;IAED;;;;OA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C,CAAC,oBAAoB,CAAC,CAAC,CAAC,oBAAoB,CAAC;QACpF,WAAW,IAAI,WAAW,GAAG,eAAe,CAAC;QAC7C,kEAAkE;QAClE,mCAAmC;QACnC,IAAI,WAAW,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;YACvC,OAAO,KAAK,CAAC;QACf,CAAC;QAED,oEAAoE;QACpE,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QAC3C,IAAI,WAAW,EAAE,CAAC;YAChB,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QACvC,CAAC;QAED,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;QAChC,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AA1MD,gEA0MC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { ServiceBusMessage } from \"./serviceBusMessage.js\";\nimport { toRheaMessage } from \"./serviceBusMessage.js\";\nimport {\n errorInvalidMessageTypeSingle,\n throwIfNotValidServiceBusMessage,\n throwTypeErrorIfParameterMissing,\n} from \"./util/errors.js\";\nimport type { ConnectionContext } from \"./connectionContext.js\";\nimport type { MessageAnnotations, Message as RheaMessage } from \"rhea-promise\";\nimport {\n messageProperties as RheaMessagePropertiesList,\n message as RheaMessageUtil,\n} from \"rhea-promise\";\nimport type { TracingContext } from \"@azure/core-tracing\";\nimport type { TryAddOptions } from \"./modelsToBeSharedWithEventHubs.js\";\nimport type { AmqpAnnotatedMessage } from \"@azure/core-amqp\";\nimport { defaultDataTransformer } from \"./dataTransformer.js\";\nimport { instrumentMessage } from \"./diagnostics/instrumentServiceBusMessage.js\";\n\n/**\n * @internal\n * The amount of bytes to reserve as overhead for a small message.\n */\nconst smallMessageOverhead = 5;\n/**\n * @internal\n * The amount of bytes to reserve as overhead for a large message.\n */\nconst largeMessageOverhead = 8;\n/**\n * @internal\n * The maximum number of bytes that a message may be to be considered small.\n */\nconst smallMessageMaxBytes = 255;\n\n/**\n * A batch of messages that you can create using the {@link createBatch} method.\n *\n */\nexport interface ServiceBusMessageBatch {\n /**\n * Size of the batch in bytes after the events added to it have been encoded into a single AMQP\n * message.\n * @readonly\n */\n readonly sizeInBytes: number;\n\n /**\n * Number of messages added to the batch.\n * @readonly\n */\n readonly count: number;\n\n /**\n * The maximum size of the batch, in bytes. The `tryAddMessage` function on the batch will return `false`\n * if the message being added causes the size of the batch to exceed this limit. Use the `createMessageBatch()` method on\n * the `Sender` to set the maxSizeInBytes.\n * @readonly\n */\n readonly maxSizeInBytes: number;\n\n /**\n * Adds a message to the batch if permitted by the batch's size limit.\n * **NOTE**: Always remember to check the return value of this method, before calling it again\n * for the next event.\n *\n * @param message - The message to add to the batch.\n * @returns A boolean value indicating if the message has been added to the batch or not.\n */\n tryAddMessage(\n message: ServiceBusMessage | AmqpAnnotatedMessage,\n options?: TryAddOptions,\n ): boolean;\n\n /**\n * The AMQP message containing encoded events that were added to the batch.\n * Used internally by the `sendBatch()` method on the `Sender`.\n * This is not meant for the user to use directly.\n *\n * @readonly\n * @internal\n * @hidden\n */\n _generateMessage(): Buffer;\n\n /**\n * Gets the \"message\" span contexts that were created when adding events to the batch.\n * Used internally by the `sendBatch()` method to set up the right spans in traces if tracing is enabled.\n * @internal\n * @hidden\n */\n readonly _messageSpanContexts: TracingContext[];\n}\n\n/**\n * An internal class representing a batch of messages which can be used to send messages to Service Bus.\n *\n * @internal\n */\nexport class ServiceBusMessageBatchImpl implements ServiceBusMessageBatch {\n /**\n * Current size of the batch in bytes.\n */\n private _sizeInBytes: number;\n /**\n * Encoded amqp messages.\n */\n private _encodedMessages: Buffer[] = [];\n /**\n * List of 'message' span contexts.\n */\n private _spanContexts: TracingContext[] = [];\n /**\n * ServiceBusMessageBatch should not be constructed using `new ServiceBusMessageBatch()`\n * Use the `createBatch()` method on your `Sender` instead.\n * @internal\n * @hidden\n */\n constructor(\n private _context: ConnectionContext,\n private _maxSizeInBytes: number,\n ) {\n this._sizeInBytes = 0;\n this._batchMessageProperties = {};\n }\n\n /**\n * The maximum size of the batch, in bytes.\n * @readonly\n */\n get maxSizeInBytes(): number {\n return this._maxSizeInBytes;\n }\n\n /**\n * Size of the `ServiceBusMessageBatch` instance after the messages added to it have been\n * encoded into a single AMQP message.\n * @readonly\n */\n get sizeInBytes(): number {\n return this._sizeInBytes;\n }\n\n /**\n * Number of messages in the `ServiceBusMessageBatch` instance.\n * @readonly\n */\n get count(): number {\n return this._encodedMessages.length;\n }\n\n /**\n * Gets the \"message\" span contexts that were created when adding messages to the batch.\n * @internal\n * @hidden\n */\n get _messageSpanContexts(): TracingContext[] {\n return this._spanContexts;\n }\n\n /**\n * Generates an AMQP message that contains the provided encoded messages and annotations.\n *\n * @param encodedMessages - The already encoded messages to include in the AMQP batch.\n * @param annotations - The message annotations to set on the batch.\n * @param applicationProperties - The application properties to set on the batch.\n * @param messageProperties - The message properties to set on the batch.\n */\n private _generateBatch(\n encodedMessages: Buffer[],\n annotations?: MessageAnnotations,\n applicationProperties?: { [key: string]: any },\n messageProperties?: { [key: string]: string },\n ): Buffer {\n const batchEnvelope: RheaMessage = {\n body: RheaMessageUtil.data_sections(encodedMessages),\n message_annotations: annotations,\n application_properties: applicationProperties,\n };\n if (messageProperties) {\n for (const prop of RheaMessagePropertiesList) {\n if ((messageProperties as any)[prop]) {\n (batchEnvelope as any)[prop] = (messageProperties as any)[prop];\n }\n }\n }\n return RheaMessageUtil.encode(batchEnvelope);\n }\n\n /**\n * Represents the single AMQP message which is the result of encoding all the events\n * added into the `ServiceBusMessageBatch` instance.\n *\n * This is not meant for the user to use directly.\n *\n * When the `ServiceBusMessageBatch` instance is passed to the `sendBatch()` method on the `Sender`,\n * this single batched AMQP message is what gets sent over the wire to the service.\n * @readonly\n */\n _generateMessage(): Buffer {\n return this._generateBatch(\n this._encodedMessages,\n this._batchAnnotations,\n this._batchApplicationProperties,\n this._batchMessageProperties,\n );\n }\n\n /**\n * The message annotations to apply on the batch envelope.\n * This will reflect the message annotations on the first message\n * that was added to the batch.\n */\n private _batchAnnotations?: MessageAnnotations;\n /**\n * The message properties to apply on the batch envelope.\n * This will reflect the message properties on the first message\n * that was added to the batch.\n */\n private _batchMessageProperties?: { [key: string]: string };\n /**\n * The application properties to apply on the batch envelope.\n * This will reflect the application properties on the first message\n * that was added to the batch.\n */\n private _batchApplicationProperties?: { [key: string]: any };\n\n /**\n * Tries to add a message to the batch if permitted by the batch's size limit.\n * **NOTE**: Always remember to check the return value of this method, before calling it again\n * for the next message.\n *\n * @param originalMessage - An individual service bus message.\n * @returns A boolean value indicating if the message has been added to the batch or not.\n */\n public tryAddMessage(\n originalMessage: ServiceBusMessage | AmqpAnnotatedMessage,\n options: TryAddOptions = {},\n ): boolean {\n throwTypeErrorIfParameterMissing(this._context.connectionId, \"message\", originalMessage);\n throwIfNotValidServiceBusMessage(originalMessage, errorInvalidMessageTypeSingle);\n\n const { message, spanContext } = instrumentMessage(\n originalMessage,\n options,\n this._context.config.entityPath!,\n this._context.config.host,\n \"publish\",\n );\n\n // Convert ServiceBusMessage to AmqpMessage.\n const amqpMessage = toRheaMessage(message, defaultDataTransformer);\n\n const encodedMessage = RheaMessageUtil.encode(amqpMessage);\n let currentSize = this._sizeInBytes;\n\n // The first time an event is added, we need to calculate\n // the overhead of creating an AMQP batch, including the\n // message_annotations, application_properties and message_properties\n // that are taken from the 1st message.\n if (this.count === 0) {\n if (amqpMessage.message_annotations) {\n this._batchAnnotations = amqpMessage.message_annotations;\n }\n if (amqpMessage.application_properties) {\n this._batchApplicationProperties = amqpMessage.application_properties;\n }\n for (const prop of RheaMessagePropertiesList) {\n if ((amqpMessage as any)[prop]) {\n (this._batchMessageProperties as any)[prop] = (amqpMessage as any)[prop];\n }\n }\n // Figure out the overhead of creating a batch by generating an empty batch\n // with the expected batch annotations.\n currentSize += this._generateBatch(\n [],\n this._batchAnnotations,\n this._batchApplicationProperties,\n this._batchMessageProperties,\n ).length;\n }\n\n const messageSize = encodedMessage.length;\n const messageOverhead =\n messageSize <= smallMessageMaxBytes ? smallMessageOverhead : largeMessageOverhead;\n currentSize += messageSize + messageOverhead;\n // Check if the size of the batch exceeds the maximum allowed size\n // once we add the new event to it.\n if (currentSize > this._maxSizeInBytes) {\n return false;\n }\n\n // The message will fit in the batch, so it is now safe to store it.\n this._encodedMessages.push(encodedMessage);\n if (spanContext) {\n this._spanContexts.push(spanContext);\n }\n\n this._sizeInBytes = currentSize;\n return true;\n }\n}\n"]}
1
+ {"version":3,"file":"serviceBusMessageBatch.js","sourceRoot":"","sources":["../../src/serviceBusMessageBatch.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAGlC,iEAAuD;AACvD,gDAI0B;AAG1B,+CAGsB;AAItB,6DAA8D;AAC9D,iGAAiF;AAEjF;;;GAGG;AACH,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAC/B;;;GAGG;AACH,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAC/B;;;GAGG;AACH,MAAM,oBAAoB,GAAG,GAAG,CAAC;AA6DjC;;;;GAIG;AACH,MAAa,0BAA0B;IAoB3B;IACA;IApBV;;OAEG;IACK,YAAY,CAAS;IAC7B;;OAEG;IACK,gBAAgB,GAAa,EAAE,CAAC;IACxC;;OAEG;IACK,aAAa,GAAqB,EAAE,CAAC;IAC7C;;;;;OAKG;IACH,YACU,QAA2B,EAC3B,eAAuB;QADvB,aAAQ,GAAR,QAAQ,CAAmB;QAC3B,oBAAe,GAAf,eAAe,CAAQ;QAE/B,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC;QACtB,IAAI,CAAC,uBAAuB,GAAG,EAAE,CAAC;IACpC,CAAC;IAED;;;OAGG;IACH,IAAI,cAAc;QAChB,OAAO,IAAI,CAAC,eAAe,CAAC;IAC9B,CAAC;IAED;;;;OAIG;IACH,IAAI,WAAW;QACb,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAED;;;OAGG;IACH,IAAI,KAAK;QACP,OA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CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,oBAAoB,CAAC;QACpF,WAAW,IAAI,WAAW,GAAG,eAAe,CAAC;QAC7C,kEAAkE;QAClE,mCAAmC;QACnC,IAAI,WAAW,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;YACvC,OAAO,KAAK,CAAC;QACf,CAAC;QAED,oEAAoE;QACpE,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QAC3C,IAAI,WAAW,EAAE,CAAC;YAChB,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QACvC,CAAC;QAED,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;QAChC,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AA1MD,gEA0MC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { ServiceBusMessage } from \"./serviceBusMessage.js\";\nimport { toRheaMessage } from \"./serviceBusMessage.js\";\nimport {\n errorInvalidMessageTypeSingle,\n throwIfNotValidServiceBusMessage,\n throwTypeErrorIfParameterMissing,\n} from \"./util/errors.js\";\nimport type { ConnectionContext } from \"./connectionContext.js\";\nimport type { MessageAnnotations, Message as RheaMessage } from \"rhea-promise\";\nimport {\n messageProperties as RheaMessagePropertiesList,\n message as RheaMessageUtil,\n} from \"rhea-promise\";\nimport type { TracingContext } from \"@azure/core-tracing\";\nimport type { TryAddOptions } from \"./modelsToBeSharedWithEventHubs.js\";\nimport type { AmqpAnnotatedMessage } from \"@azure/core-amqp\";\nimport { defaultDataTransformer } from \"./dataTransformer.js\";\nimport { instrumentMessage } from \"./diagnostics/instrumentServiceBusMessage.js\";\n\n/**\n * @internal\n * The amount of bytes to reserve as overhead for a small message.\n */\nconst smallMessageOverhead = 5;\n/**\n * @internal\n * The amount of bytes to reserve as overhead for a large message.\n */\nconst largeMessageOverhead = 8;\n/**\n * @internal\n * The maximum number of bytes that a message may be to be considered small.\n */\nconst smallMessageMaxBytes = 255;\n\n/**\n * A batch of messages that you can create using the {@link createBatch} method.\n *\n */\nexport interface ServiceBusMessageBatch {\n /**\n * Size of the batch in bytes after the events added to it have been encoded into a single AMQP\n * message.\n * @readonly\n */\n readonly sizeInBytes: number;\n\n /**\n * Number of messages added to the batch.\n * @readonly\n */\n readonly count: number;\n\n /**\n * The maximum size of the batch, in bytes. The `tryAddMessage` function on the batch will return `false`\n * if the message being added causes the size of the batch to exceed this limit. Use the `createMessageBatch()` method on\n * the `Sender` to set the maxSizeInBytes.\n * @readonly\n */\n readonly maxSizeInBytes: number;\n\n /**\n * Adds a message to the batch if permitted by the batch's size limit.\n * **NOTE**: Always remember to check the return value of this method, before calling it again\n * for the next event.\n *\n * @param message - The message to add to the batch.\n * @returns A boolean value indicating if the message has been added to the batch or not.\n */\n tryAddMessage(\n message: ServiceBusMessage | AmqpAnnotatedMessage,\n options?: TryAddOptions,\n ): boolean;\n\n /**\n * The AMQP message containing encoded events that were added to the batch.\n * Used internally by the `sendBatch()` method on the `Sender`.\n * This is not meant for the user to use directly.\n *\n * @readonly\n * @internal\n * @hidden\n */\n _generateMessage(): Buffer;\n\n /**\n * Gets the \"message\" span contexts that were created when adding events to the batch.\n * Used internally by the `sendBatch()` method to set up the right spans in traces if tracing is enabled.\n * @internal\n * @hidden\n */\n readonly _messageSpanContexts: TracingContext[];\n}\n\n/**\n * An internal class representing a batch of messages which can be used to send messages to Service Bus.\n *\n * @internal\n */\nexport class ServiceBusMessageBatchImpl implements ServiceBusMessageBatch {\n /**\n * Current size of the batch in bytes.\n */\n private _sizeInBytes: number;\n /**\n * Encoded amqp messages.\n */\n private _encodedMessages: Buffer[] = [];\n /**\n * List of 'message' span contexts.\n */\n private _spanContexts: TracingContext[] = [];\n /**\n * ServiceBusMessageBatch should not be constructed using `new ServiceBusMessageBatch()`\n * Use the `createBatch()` method on your `Sender` instead.\n * @internal\n * @hidden\n */\n constructor(\n private _context: ConnectionContext,\n private _maxSizeInBytes: number,\n ) {\n this._sizeInBytes = 0;\n this._batchMessageProperties = {};\n }\n\n /**\n * The maximum size of the batch, in bytes.\n * @readonly\n */\n get maxSizeInBytes(): number {\n return this._maxSizeInBytes;\n }\n\n /**\n * Size of the `ServiceBusMessageBatch` instance after the messages added to it have been\n * encoded into a single AMQP message.\n * @readonly\n */\n get sizeInBytes(): number {\n return this._sizeInBytes;\n }\n\n /**\n * Number of messages in the `ServiceBusMessageBatch` instance.\n * @readonly\n */\n get count(): number {\n return this._encodedMessages.length;\n }\n\n /**\n * Gets the \"message\" span contexts that were created when adding messages to the batch.\n * @internal\n * @hidden\n */\n get _messageSpanContexts(): TracingContext[] {\n return this._spanContexts;\n }\n\n /**\n * Generates an AMQP message that contains the provided encoded messages and annotations.\n *\n * @param encodedMessages - The already encoded messages to include in the AMQP batch.\n * @param annotations - The message annotations to set on the batch.\n * @param applicationProperties - The application properties to set on the batch.\n * @param messageProperties - The message properties to set on the batch.\n */\n private _generateBatch(\n encodedMessages: Buffer[],\n annotations?: MessageAnnotations,\n applicationProperties?: { [key: string]: any },\n messageProperties?: { [key: string]: string },\n ): Buffer {\n const batchEnvelope: RheaMessage = {\n body: RheaMessageUtil.data_sections(encodedMessages),\n message_annotations: annotations,\n application_properties: applicationProperties,\n };\n if (messageProperties) {\n for (const prop of RheaMessagePropertiesList) {\n if ((messageProperties as any)[prop]) {\n (batchEnvelope as any)[prop] = (messageProperties as any)[prop];\n }\n }\n }\n return RheaMessageUtil.encode(batchEnvelope);\n }\n\n /**\n * Represents the single AMQP message which is the result of encoding all the events\n * added into the `ServiceBusMessageBatch` instance.\n *\n * This is not meant for the user to use directly.\n *\n * When the `ServiceBusMessageBatch` instance is passed to the `sendBatch()` method on the `Sender`,\n * this single batched AMQP message is what gets sent over the wire to the service.\n * @readonly\n */\n _generateMessage(): Buffer {\n return this._generateBatch(\n this._encodedMessages,\n this._batchAnnotations,\n this._batchApplicationProperties,\n this._batchMessageProperties,\n );\n }\n\n /**\n * The message annotations to apply on the batch envelope.\n * This will reflect the message annotations on the first message\n * that was added to the batch.\n */\n private _batchAnnotations?: MessageAnnotations;\n /**\n * The message properties to apply on the batch envelope.\n * This will reflect the message properties on the first message\n * that was added to the batch.\n */\n private _batchMessageProperties?: { [key: string]: string };\n /**\n * The application properties to apply on the batch envelope.\n * This will reflect the application properties on the first message\n * that was added to the batch.\n */\n private _batchApplicationProperties?: { [key: string]: any };\n\n /**\n * Tries to add a message to the batch if permitted by the batch's size limit.\n * **NOTE**: Always remember to check the return value of this method, before calling it again\n * for the next message.\n *\n * @param originalMessage - An individual service bus message.\n * @returns A boolean value indicating if the message has been added to the batch or not.\n */\n public tryAddMessage(\n originalMessage: ServiceBusMessage | AmqpAnnotatedMessage,\n options: TryAddOptions = {},\n ): boolean {\n throwTypeErrorIfParameterMissing(this._context.connectionId, \"message\", originalMessage);\n throwIfNotValidServiceBusMessage(originalMessage, errorInvalidMessageTypeSingle);\n\n const { message, spanContext } = instrumentMessage(\n originalMessage,\n options,\n this._context.config.entityPath!,\n this._context.config.host,\n \"publish\",\n );\n\n // Convert ServiceBusMessage to AmqpMessage.\n const amqpMessage = toRheaMessage(message, defaultDataTransformer);\n\n const encodedMessage = RheaMessageUtil.encode(amqpMessage);\n let currentSize = this._sizeInBytes;\n\n // The first time an event is added, we need to calculate\n // the overhead of creating an AMQP batch, including the\n // message_annotations, application_properties and message_properties\n // that are taken from the 1st message.\n if (this.count === 0) {\n if (amqpMessage.message_annotations) {\n this._batchAnnotations = amqpMessage.message_annotations;\n }\n if (amqpMessage.application_properties) {\n this._batchApplicationProperties = amqpMessage.application_properties;\n }\n for (const prop of RheaMessagePropertiesList) {\n if ((amqpMessage as any)[prop]) {\n (this._batchMessageProperties as any)[prop] = (amqpMessage as any)[prop];\n }\n }\n // Figure out the overhead of creating a batch by generating an empty batch\n // with the expected batch annotations.\n currentSize += this._generateBatch(\n [],\n this._batchAnnotations,\n this._batchApplicationProperties,\n this._batchMessageProperties,\n ).length;\n }\n\n const messageSize = encodedMessage.length;\n const messageOverhead =\n messageSize <= smallMessageMaxBytes ? smallMessageOverhead : largeMessageOverhead;\n currentSize += messageSize + messageOverhead;\n // Check if the size of the batch exceeds the maximum allowed size\n // once we add the new event to it.\n if (currentSize > this._maxSizeInBytes) {\n return false;\n }\n\n // The message will fit in the batch, so it is now safe to store it.\n this._encodedMessages.push(encodedMessage);\n if (spanContext) {\n this._spanContexts.push(spanContext);\n }\n\n this._sizeInBytes = currentSize;\n return true;\n }\n}\n"]}
@@ -14,6 +14,15 @@ const core_paging_1 = require("@azure/core-paging");
14
14
  * @internal
15
15
  */
16
16
  class ServiceBusRuleManagerImpl {
17
+ _context;
18
+ _entityPath;
19
+ _retryOptions;
20
+ /**
21
+ * Denotes if close() was called on this sender
22
+ */
23
+ _isClosed = false;
24
+ name;
25
+ entityPath;
17
26
  /**
18
27
  * @internal
19
28
  * @throws Error if the underlying connection is closed.
@@ -22,10 +31,6 @@ class ServiceBusRuleManagerImpl {
22
31
  this._context = _context;
23
32
  this._entityPath = _entityPath;
24
33
  this._retryOptions = _retryOptions;
25
- /**
26
- * Denotes if close() was called on this sender
27
- */
28
- this._isClosed = false;
29
34
  (0, errors_js_1.throwErrorIfConnectionClosed)(_context);
30
35
  this.entityPath = _entityPath;
31
36
  this.name = (0, utils_js_1.getUniqueName)("ruleManager");
@@ -44,21 +49,26 @@ class ServiceBusRuleManagerImpl {
44
49
  }
45
50
  else {
46
51
  // Overload#1 - where the sqlExpression in the ruleAction is undefined
47
- operOptions = Object.assign(Object.assign({}, ruleActionOrOperationOptions), options);
52
+ operOptions = { ...ruleActionOrOperationOptions, ...options };
48
53
  }
49
54
  }
50
- return tracing_js_1.tracingClient.withSpan("ServiceBusRuleManager.createRule", operOptions !== null && operOptions !== void 0 ? operOptions : {}, async (updatedOptions) => {
55
+ return tracing_js_1.tracingClient.withSpan("ServiceBusRuleManager.createRule", operOptions ?? {}, async (updatedOptions) => {
51
56
  const addRuleOperationPromise = async () => {
52
57
  return this._context
53
58
  .getManagementClient(this._entityPath)
54
- .addRule(ruleName, filter, sqlRuleAction === null || sqlRuleAction === void 0 ? void 0 : sqlRuleAction.sqlExpression, Object.assign(Object.assign({}, updatedOptions), { associatedLinkName: this.name, requestName: "addRule", timeoutInMs: this._retryOptions.timeoutInMs }));
59
+ .addRule(ruleName, filter, sqlRuleAction?.sqlExpression, {
60
+ ...updatedOptions,
61
+ associatedLinkName: this.name,
62
+ requestName: "addRule",
63
+ timeoutInMs: this._retryOptions.timeoutInMs,
64
+ });
55
65
  };
56
66
  const config = {
57
67
  operation: addRuleOperationPromise,
58
68
  connectionId: this._context.connectionId,
59
69
  operationType: core_amqp_1.RetryOperationType.management,
60
70
  retryOptions: this._retryOptions,
61
- abortSignal: updatedOptions === null || updatedOptions === void 0 ? void 0 : updatedOptions.abortSignal,
71
+ abortSignal: updatedOptions?.abortSignal,
62
72
  };
63
73
  return (0, core_amqp_1.retry)(config);
64
74
  });
@@ -67,16 +77,21 @@ class ServiceBusRuleManagerImpl {
67
77
  * Get all rules associated with the subscription.
68
78
  */
69
79
  async getRules(options) {
70
- return tracing_js_1.tracingClient.withSpan("ServiceBusRuleManager.getRules", options !== null && options !== void 0 ? options : {}, async (updatedOptions) => {
80
+ return tracing_js_1.tracingClient.withSpan("ServiceBusRuleManager.getRules", options ?? {}, async (updatedOptions) => {
71
81
  const getRulesOperationPromise = async () => {
72
- return this._context.getManagementClient(this._entityPath).getRules(Object.assign(Object.assign({}, updatedOptions), { associatedLinkName: this.name, requestName: "getRules", timeoutInMs: this._retryOptions.timeoutInMs }));
82
+ return this._context.getManagementClient(this._entityPath).getRules({
83
+ ...updatedOptions,
84
+ associatedLinkName: this.name,
85
+ requestName: "getRules",
86
+ timeoutInMs: this._retryOptions.timeoutInMs,
87
+ });
73
88
  };
74
89
  const config = {
75
90
  operation: getRulesOperationPromise,
76
91
  connectionId: this._context.connectionId,
77
92
  operationType: core_amqp_1.RetryOperationType.management,
78
93
  retryOptions: this._retryOptions,
79
- abortSignal: updatedOptions === null || updatedOptions === void 0 ? void 0 : updatedOptions.abortSignal,
94
+ abortSignal: updatedOptions?.abortSignal,
80
95
  };
81
96
  return (0, core_amqp_1.retry)(config);
82
97
  });
@@ -94,8 +109,12 @@ class ServiceBusRuleManagerImpl {
94
109
  const pagedResult = {
95
110
  firstPageLink: 0,
96
111
  getPage: async (pageLink, maxPageSize) => {
97
- const top = maxPageSize !== null && maxPageSize !== void 0 ? maxPageSize : 100;
98
- const rules = await this.getRules(Object.assign({ skip: pageLink, maxCount: top }, options));
112
+ const top = maxPageSize ?? 100;
113
+ const rules = await this.getRules({
114
+ skip: pageLink,
115
+ maxCount: top,
116
+ ...options,
117
+ });
99
118
  return rules.length
100
119
  ? {
101
120
  page: rules,
@@ -112,14 +131,19 @@ class ServiceBusRuleManagerImpl {
112
131
  async deleteRule(ruleName, options = {}) {
113
132
  return tracing_js_1.tracingClient.withSpan("ServiceBusRuleManager.deleteRule", options, async (updatedOptions) => {
114
133
  const removeRuleOperationPromise = async () => {
115
- return this._context.getManagementClient(this._entityPath).removeRule(ruleName, Object.assign(Object.assign({}, updatedOptions), { associatedLinkName: this.name, requestName: "removeRule", timeoutInMs: this._retryOptions.timeoutInMs }));
134
+ return this._context.getManagementClient(this._entityPath).removeRule(ruleName, {
135
+ ...updatedOptions,
136
+ associatedLinkName: this.name,
137
+ requestName: "removeRule",
138
+ timeoutInMs: this._retryOptions.timeoutInMs,
139
+ });
116
140
  };
117
141
  const config = {
118
142
  operation: removeRuleOperationPromise,
119
143
  connectionId: this._context.connectionId,
120
144
  operationType: core_amqp_1.RetryOperationType.management,
121
145
  retryOptions: this._retryOptions,
122
- abortSignal: updatedOptions === null || updatedOptions === void 0 ? void 0 : updatedOptions.abortSignal,
146
+ abortSignal: updatedOptions?.abortSignal,
123
147
  };
124
148
  return (0, core_amqp_1.retry)(config);
125
149
  });
@@ -1 +1 @@
1
- {"version":3,"file":"serviceBusRuleManager.js","sourceRoot":"","sources":["../../src/serviceBusRuleManager.ts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AK,IAAmB,EAAE;gBAC3D,OAAO,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,UAAU,CAAC,QAAQ,kCACzE,cAAc,KACjB,kBAAkB,EAAE,IAAI,CAAC,IAAI,EAC7B,WAAW,EAAE,YAAY,EACzB,WAAW,EAAE,IAAI,CAAC,aAAa,CAAC,WAAW,IAC3C,CAAC;YACL,CAAC,CAAC;YACF,MAAM,MAAM,GAAsB;gBAChC,SAAS,EAAE,0BAA0B;gBACrC,YAAY,EAAE,IAAI,CAAC,QAAQ,CAAC,YAAY;gBACxC,aAAa,EAAE,8BAAkB,CAAC,UAAU;gBAC5C,YAAY,EAAE,IAAI,CAAC,aAAa;gBAChC,WAAW,EAAE,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,WAAW;aACzC,CAAC;YACF,OAAO,IAAA,iBAAK,EAAO,MAAM,CAAC,CAAC;QAC7B,CAAC,CACF,CAAC;IACJ,CAAC;CACF;AA3LD,8DA2LC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { OperationOptionsBase } from \"./modelsToBeSharedWithEventHubs.js\";\nimport type { ConnectionContext } from \"./connectionContext.js\";\nimport type { RetryConfig, RetryOptions } from \"@azure/core-amqp\";\nimport { RetryOperationType, retry } from \"@azure/core-amqp\";\nimport type { CorrelationRuleFilter } from \"./core/managementClient.js\";\nimport { ruleManagerLogger as logger } from \"./log.js\";\nimport type { RuleProperties, SqlRuleAction } from \"./serializers/ruleResourceSerializer.js\";\nimport { isSqlRuleAction } from \"./serializers/ruleResourceSerializer.js\";\nimport { getUniqueName } from \"./util/utils.js\";\nimport { throwErrorIfConnectionClosed } from \"./util/errors.js\";\nimport type { SqlRuleFilter } from \"./serializers/ruleResourceSerializer.js\";\nimport { tracingClient } from \"./diagnostics/tracing.js\";\nimport type { PagedAsyncIterableIterator, PagedResult } from \"@azure/core-paging\";\nimport { getPagedAsyncIterator } from \"@azure/core-paging\";\nimport type { OperationOptions } from \"@azure/core-client\";\nimport type { ListRequestOptions } from \"./serviceBusAtomManagementClient.js\";\n\n/**\n * Allows rules for a subscription to be managed. This rule manager requires only Listen claims, whereas the\n * {@link ServiceBusAdministrationClient} requires Manage claims.\n */\nexport interface ServiceBusRuleManager {\n /**\n * Adds a rule to the current subscription to filter the messages reaching from topic to the subscription.\n *\n * @param ruleName - the name of the rule\n * @param filter - the filter expression that the rule evaluates.\n * @param options - The options that can be used to abort, trace and control other configurations on the request.\n */\n createRule(\n ruleName: string,\n filter: SqlRuleFilter | CorrelationRuleFilter,\n options?: OperationOptionsBase,\n ): Promise<void>;\n /**\n * Adds a rule to the current subscription to filter the messages reaching from topic to the subscription.\n *\n * @param ruleName - the name of the rule\n * @param filter - the filter expression that the rule evaluates.\n * @param ruleAction - The SQL like expression that can be executed on the message should the associated filter apply.\n * @param options - The options that can be used to abort, trace and control other configurations on the request.\n */\n createRule(\n ruleName: string,\n filter: SqlRuleFilter | CorrelationRuleFilter,\n ruleAction?: SqlRuleAction,\n options?: OperationOptionsBase,\n ): Promise<void>;\n /**\n * Deletes a rule.\n *\n * @param ruleName - the name of the rule\n */\n deleteRule(ruleName: string, options?: OperationOptionsBase): Promise<void>;\n /**\n * Returns an async iterable iterator to list all the rules\n * under the specified subscription.\n *\n * .byPage() returns an async iterable iterator to list the rules in pages.\n *\n * @returns An asyncIterableIterator that supports paging.\n */\n listRules(options?: OperationOptions): PagedAsyncIterableIterator<RuleProperties>;\n}\n\n/**\n * @internal\n */\nexport class ServiceBusRuleManagerImpl implements ServiceBusRuleManager {\n /**\n * Denotes if close() was called on this sender\n */\n private _isClosed: boolean = false;\n private name: string;\n public entityPath: string;\n\n /**\n * @internal\n * @throws Error if the underlying connection is closed.\n */\n constructor(\n private _context: ConnectionContext,\n private _entityPath: string,\n private _retryOptions: RetryOptions = {},\n ) {\n throwErrorIfConnectionClosed(_context);\n this.entityPath = _entityPath;\n this.name = getUniqueName(\"ruleManager\");\n }\n\n public get isClosed(): boolean {\n return this._isClosed || this._context.wasConnectionCloseCalled;\n }\n\n /**\n * Adds a rule to the current subscription to filter the messages reaching from topic to the subscription.\n *\n * @param ruleName - the name of the rule\n * @param filter - the filter expression that the rule evaluates.\n * @param options - The options that can be used to abort, trace and control other configurations on the request.\n */\n createRule(\n ruleName: string,\n filter: SqlRuleFilter | CorrelationRuleFilter,\n options?: OperationOptions,\n ): Promise<void>;\n /**\n * Adds a rule to the current subscription to filter the messages reaching from topic to the subscription.\n *\n * @param ruleName - the name of the rule\n * @param filter - the filter expression that the rule evaluates.\n * @param ruleAction - The SQL like expression that can be executed on the message should the associated filter apply.\n * @param options - The options that can be used to abort, trace and control other configurations on the request.\n */\n createRule(\n ruleName: string,\n filter: SqlRuleFilter | CorrelationRuleFilter,\n ruleAction?: SqlRuleAction,\n options?: OperationOptions,\n ): Promise<void>;\n async createRule(\n ruleName: string,\n filter: SqlRuleFilter | CorrelationRuleFilter,\n ruleActionOrOperationOptions?: SqlRuleAction | OperationOptionsBase,\n options: OperationOptions = {},\n ): Promise<void> {\n let sqlRuleAction: SqlRuleAction | undefined = undefined;\n let operOptions: OperationOptions | undefined;\n if (ruleActionOrOperationOptions) {\n if (isSqlRuleAction(ruleActionOrOperationOptions)) {\n // Overload#2 - where the sqlExpression in the ruleAction is defined\n sqlRuleAction = ruleActionOrOperationOptions;\n operOptions = options;\n } else {\n // Overload#1 - where the sqlExpression in the ruleAction is undefined\n operOptions = { ...ruleActionOrOperationOptions, ...options };\n }\n }\n\n return tracingClient.withSpan(\n \"ServiceBusRuleManager.createRule\",\n operOptions ?? {},\n async (updatedOptions) => {\n const addRuleOperationPromise = async (): Promise<void> => {\n return this._context\n .getManagementClient(this._entityPath)\n .addRule(ruleName, filter, sqlRuleAction?.sqlExpression, {\n ...updatedOptions,\n associatedLinkName: this.name,\n requestName: \"addRule\",\n timeoutInMs: this._retryOptions.timeoutInMs,\n });\n };\n const config: RetryConfig<void> = {\n operation: addRuleOperationPromise,\n connectionId: this._context.connectionId,\n operationType: RetryOperationType.management,\n retryOptions: this._retryOptions,\n abortSignal: updatedOptions?.abortSignal,\n };\n return retry<void>(config);\n },\n );\n }\n\n /**\n * Get all rules associated with the subscription.\n */\n private async getRules(\n options?: ListRequestOptions & OperationOptions,\n ): Promise<RuleProperties[]> {\n return tracingClient.withSpan(\n \"ServiceBusRuleManager.getRules\",\n options ?? {},\n async (updatedOptions) => {\n const getRulesOperationPromise = async (): Promise<RuleProperties[]> => {\n return this._context.getManagementClient(this._entityPath).getRules({\n ...updatedOptions,\n associatedLinkName: this.name,\n requestName: \"getRules\",\n timeoutInMs: this._retryOptions.timeoutInMs,\n });\n };\n const config: RetryConfig<RuleProperties[]> = {\n operation: getRulesOperationPromise,\n connectionId: this._context.connectionId,\n operationType: RetryOperationType.management,\n retryOptions: this._retryOptions,\n abortSignal: updatedOptions?.abortSignal,\n };\n return retry<RuleProperties[]>(config);\n },\n );\n }\n\n /**\n * Returns an async iterable iterator to list all the rules\n * under the specified subscription.\n *\n * .byPage() returns an async iterable iterator to list the rules in pages.\n *\n * @returns An asyncIterableIterator that supports paging.\n */\n public listRules(\n options?: OperationOptions,\n ): PagedAsyncIterableIterator<RuleProperties, RuleProperties[], { maxPageSize?: number }> {\n logger.verbose(`Performing operation - listRules() with options: %j`, options);\n const pagedResult: PagedResult<RuleProperties[], { maxPageSize?: number }, number> = {\n firstPageLink: 0,\n getPage: async (pageLink, maxPageSize) => {\n const top = maxPageSize ?? 100;\n const rules = await this.getRules({\n skip: pageLink,\n maxCount: top,\n ...options,\n });\n return rules.length\n ? {\n page: rules,\n nextPageLink: rules.length > 0 ? pageLink + rules.length : undefined,\n }\n : undefined;\n },\n };\n\n return getPagedAsyncIterator(pagedResult);\n }\n\n /**\n * Deletes a rule.\n */\n async deleteRule(ruleName: string, options: OperationOptions = {}): Promise<void> {\n return tracingClient.withSpan(\n \"ServiceBusRuleManager.deleteRule\",\n options,\n async (updatedOptions) => {\n const removeRuleOperationPromise = async (): Promise<void> => {\n return this._context.getManagementClient(this._entityPath).removeRule(ruleName, {\n ...updatedOptions,\n associatedLinkName: this.name,\n requestName: \"removeRule\",\n timeoutInMs: this._retryOptions.timeoutInMs,\n });\n };\n const config: RetryConfig<void> = {\n operation: removeRuleOperationPromise,\n connectionId: this._context.connectionId,\n operationType: RetryOperationType.management,\n retryOptions: this._retryOptions,\n abortSignal: updatedOptions?.abortSignal,\n };\n return retry<void>(config);\n },\n );\n }\n}\n"]}
1
+ {"version":3,"file":"serviceBusRuleManager.js","sourceRoot":"","sources":["../../src/serviceBusRuleManager.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAKlC,gDAA6D;AAE7D,qCAAuD;AAEvD,uFAA0E;AAC1E,8CAAgD;AAChD,gDAAgE;AAEhE,yDAAyD;AAEzD,oDAA2D;AAoD3D;;GAEG;AACH,MAAa,yBAAyB;IAa1B;IACA;IACA;IAdV;;OAEG;IACK,SAAS,GAAY,KAAK,CAAC;IAC3B,IAAI,CAAS;IACd,UAAU,CAAS;IAE1B;;;OAGG;IACH,YACU,QAA2B,EAC3B,WAAmB,EACnB,gBAA8B,EAAE;QAFhC,aAAQ,GAAR,QAAQ,CAAmB;QAC3B,gBAAW,GAAX,WAAW,CAAQ;QACnB,kBAAa,GAAb,aAAa,CAAmB;QAExC,IAAA,wCAA4B,EAAC,QAAQ,CAAC,CAAC;QACvC,IAAI,CAAC,UAAU,GAAG,WAAW,CAAC;QAC9B,IAAI,CAAC,IAAI,GAAG,IAAA,wBAAa,EAAC,aAAa,CAAC,CAAC;IAC3C,CAAC;IAED,IAAW,QAAQ;QACjB,OAAO,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,QAAQ,CAAC,wBAAwB,CAAC;IAClE,CAAC;IA4BD,KAAK,CAAC,UAAU,CACd,QAAgB,EAChB,MAA6C,EAC7C,4BAAmE,EACnE,UAA4B,EAAE;QAE9B,IAAI,aAAa,GAA8B,SAAS,CAAC;QACz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,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS;qBACrE;oBACH,CAAC,CAAC,SAAS,CAAC;YAChB,CAAC;SACF,CAAC;QAEF,OAAO,IAAA,mCAAqB,EAAC,WAAW,CAAC,CAAC;IAC5C,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,UAAU,CAAC,QAAgB,EAAE,UAA4B,EAAE;QAC/D,OAAO,0BAAa,CAAC,QAAQ,CAC3B,kCAAkC,EAClC,OAAO,EACP,KAAK,EAAE,cAAc,EAAE,EAAE;YACvB,MAAM,0BAA0B,GAAG,KAAK,IAAmB,EAAE;gBAC3D,OAAO,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,UAAU,CAAC,QAAQ,EAAE;oBAC9E,GAAG,cAAc;oBACjB,kBAAkB,EAAE,IAAI,CAAC,IAAI;oBAC7B,WAAW,EAAE,YAAY;oBACzB,WAAW,EAAE,IAAI,CAAC,aAAa,CAAC,WAAW;iBAC5C,CAAC,CAAC;YACL,CAAC,CAAC;YACF,MAAM,MAAM,GAAsB;gBAChC,SAAS,EAAE,0BAA0B;gBACrC,YAAY,EAAE,IAAI,CAAC,QAAQ,CAAC,YAAY;gBACxC,aAAa,EAAE,8BAAkB,CAAC,UAAU;gBAC5C,YAAY,EAAE,IAAI,CAAC,aAAa;gBAChC,WAAW,EAAE,cAAc,EAAE,WAAW;aACzC,CAAC;YACF,OAAO,IAAA,iBAAK,EAAO,MAAM,CAAC,CAAC;QAC7B,CAAC,CACF,CAAC;IACJ,CAAC;CACF;AA3LD,8DA2LC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { OperationOptionsBase } from \"./modelsToBeSharedWithEventHubs.js\";\nimport type { ConnectionContext } from \"./connectionContext.js\";\nimport type { RetryConfig, RetryOptions } from \"@azure/core-amqp\";\nimport { RetryOperationType, retry } from \"@azure/core-amqp\";\nimport type { CorrelationRuleFilter } from \"./core/managementClient.js\";\nimport { ruleManagerLogger as logger } from \"./log.js\";\nimport type { RuleProperties, SqlRuleAction } from \"./serializers/ruleResourceSerializer.js\";\nimport { isSqlRuleAction } from \"./serializers/ruleResourceSerializer.js\";\nimport { getUniqueName } from \"./util/utils.js\";\nimport { throwErrorIfConnectionClosed } from \"./util/errors.js\";\nimport type { SqlRuleFilter } from \"./serializers/ruleResourceSerializer.js\";\nimport { tracingClient } from \"./diagnostics/tracing.js\";\nimport type { PagedAsyncIterableIterator, PagedResult } from \"@azure/core-paging\";\nimport { getPagedAsyncIterator } from \"@azure/core-paging\";\nimport type { OperationOptions } from \"@azure/core-client\";\nimport type { ListRequestOptions } from \"./serviceBusAtomManagementClient.js\";\n\n/**\n * Allows rules for a subscription to be managed. This rule manager requires only Listen claims, whereas the\n * {@link ServiceBusAdministrationClient} requires Manage claims.\n */\nexport interface ServiceBusRuleManager {\n /**\n * Adds a rule to the current subscription to filter the messages reaching from topic to the subscription.\n *\n * @param ruleName - the name of the rule\n * @param filter - the filter expression that the rule evaluates.\n * @param options - The options that can be used to abort, trace and control other configurations on the request.\n */\n createRule(\n ruleName: string,\n filter: SqlRuleFilter | CorrelationRuleFilter,\n options?: OperationOptionsBase,\n ): Promise<void>;\n /**\n * Adds a rule to the current subscription to filter the messages reaching from topic to the subscription.\n *\n * @param ruleName - the name of the rule\n * @param filter - the filter expression that the rule evaluates.\n * @param ruleAction - The SQL like expression that can be executed on the message should the associated filter apply.\n * @param options - The options that can be used to abort, trace and control other configurations on the request.\n */\n createRule(\n ruleName: string,\n filter: SqlRuleFilter | CorrelationRuleFilter,\n ruleAction?: SqlRuleAction,\n options?: OperationOptionsBase,\n ): Promise<void>;\n /**\n * Deletes a rule.\n *\n * @param ruleName - the name of the rule\n */\n deleteRule(ruleName: string, options?: OperationOptionsBase): Promise<void>;\n /**\n * Returns an async iterable iterator to list all the rules\n * under the specified subscription.\n *\n * .byPage() returns an async iterable iterator to list the rules in pages.\n *\n * @returns An asyncIterableIterator that supports paging.\n */\n listRules(options?: OperationOptions): PagedAsyncIterableIterator<RuleProperties>;\n}\n\n/**\n * @internal\n */\nexport class ServiceBusRuleManagerImpl implements ServiceBusRuleManager {\n /**\n * Denotes if close() was called on this sender\n */\n private _isClosed: boolean = false;\n private name: string;\n public entityPath: string;\n\n /**\n * @internal\n * @throws Error if the underlying connection is closed.\n */\n constructor(\n private _context: ConnectionContext,\n private _entityPath: string,\n private _retryOptions: RetryOptions = {},\n ) {\n throwErrorIfConnectionClosed(_context);\n this.entityPath = _entityPath;\n this.name = getUniqueName(\"ruleManager\");\n }\n\n public get isClosed(): boolean {\n return this._isClosed || this._context.wasConnectionCloseCalled;\n }\n\n /**\n * Adds a rule to the current subscription to filter the messages reaching from topic to the subscription.\n *\n * @param ruleName - the name of the rule\n * @param filter - the filter expression that the rule evaluates.\n * @param options - The options that can be used to abort, trace and control other configurations on the request.\n */\n createRule(\n ruleName: string,\n filter: SqlRuleFilter | CorrelationRuleFilter,\n options?: OperationOptions,\n ): Promise<void>;\n /**\n * Adds a rule to the current subscription to filter the messages reaching from topic to the subscription.\n *\n * @param ruleName - the name of the rule\n * @param filter - the filter expression that the rule evaluates.\n * @param ruleAction - The SQL like expression that can be executed on the message should the associated filter apply.\n * @param options - The options that can be used to abort, trace and control other configurations on the request.\n */\n createRule(\n ruleName: string,\n filter: SqlRuleFilter | CorrelationRuleFilter,\n ruleAction?: SqlRuleAction,\n options?: OperationOptions,\n ): Promise<void>;\n async createRule(\n ruleName: string,\n filter: SqlRuleFilter | CorrelationRuleFilter,\n ruleActionOrOperationOptions?: SqlRuleAction | OperationOptionsBase,\n options: OperationOptions = {},\n ): Promise<void> {\n let sqlRuleAction: SqlRuleAction | undefined = undefined;\n let operOptions: OperationOptions | undefined;\n if (ruleActionOrOperationOptions) {\n if (isSqlRuleAction(ruleActionOrOperationOptions)) {\n // Overload#2 - where the sqlExpression in the ruleAction is defined\n sqlRuleAction = ruleActionOrOperationOptions;\n operOptions = options;\n } else {\n // Overload#1 - where the sqlExpression in the ruleAction is undefined\n operOptions = { ...ruleActionOrOperationOptions, ...options };\n }\n }\n\n return tracingClient.withSpan(\n \"ServiceBusRuleManager.createRule\",\n operOptions ?? {},\n async (updatedOptions) => {\n const addRuleOperationPromise = async (): Promise<void> => {\n return this._context\n .getManagementClient(this._entityPath)\n .addRule(ruleName, filter, sqlRuleAction?.sqlExpression, {\n ...updatedOptions,\n associatedLinkName: this.name,\n requestName: \"addRule\",\n timeoutInMs: this._retryOptions.timeoutInMs,\n });\n };\n const config: RetryConfig<void> = {\n operation: addRuleOperationPromise,\n connectionId: this._context.connectionId,\n operationType: RetryOperationType.management,\n retryOptions: this._retryOptions,\n abortSignal: updatedOptions?.abortSignal,\n };\n return retry<void>(config);\n },\n );\n }\n\n /**\n * Get all rules associated with the subscription.\n */\n private async getRules(\n options?: ListRequestOptions & OperationOptions,\n ): Promise<RuleProperties[]> {\n return tracingClient.withSpan(\n \"ServiceBusRuleManager.getRules\",\n options ?? {},\n async (updatedOptions) => {\n const getRulesOperationPromise = async (): Promise<RuleProperties[]> => {\n return this._context.getManagementClient(this._entityPath).getRules({\n ...updatedOptions,\n associatedLinkName: this.name,\n requestName: \"getRules\",\n timeoutInMs: this._retryOptions.timeoutInMs,\n });\n };\n const config: RetryConfig<RuleProperties[]> = {\n operation: getRulesOperationPromise,\n connectionId: this._context.connectionId,\n operationType: RetryOperationType.management,\n retryOptions: this._retryOptions,\n abortSignal: updatedOptions?.abortSignal,\n };\n return retry<RuleProperties[]>(config);\n },\n );\n }\n\n /**\n * Returns an async iterable iterator to list all the rules\n * under the specified subscription.\n *\n * .byPage() returns an async iterable iterator to list the rules in pages.\n *\n * @returns An asyncIterableIterator that supports paging.\n */\n public listRules(\n options?: OperationOptions,\n ): PagedAsyncIterableIterator<RuleProperties, RuleProperties[], { maxPageSize?: number }> {\n logger.verbose(`Performing operation - listRules() with options: %j`, options);\n const pagedResult: PagedResult<RuleProperties[], { maxPageSize?: number }, number> = {\n firstPageLink: 0,\n getPage: async (pageLink, maxPageSize) => {\n const top = maxPageSize ?? 100;\n const rules = await this.getRules({\n skip: pageLink,\n maxCount: top,\n ...options,\n });\n return rules.length\n ? {\n page: rules,\n nextPageLink: rules.length > 0 ? pageLink + rules.length : undefined,\n }\n : undefined;\n },\n };\n\n return getPagedAsyncIterator(pagedResult);\n }\n\n /**\n * Deletes a rule.\n */\n async deleteRule(ruleName: string, options: OperationOptions = {}): Promise<void> {\n return tracingClient.withSpan(\n \"ServiceBusRuleManager.deleteRule\",\n options,\n async (updatedOptions) => {\n const removeRuleOperationPromise = async (): Promise<void> => {\n return this._context.getManagementClient(this._entityPath).removeRule(ruleName, {\n ...updatedOptions,\n associatedLinkName: this.name,\n requestName: \"removeRule\",\n timeoutInMs: this._retryOptions.timeoutInMs,\n });\n };\n const config: RetryConfig<void> = {\n operation: removeRuleOperationPromise,\n connectionId: this._context.connectionId,\n operationType: RetryOperationType.management,\n retryOptions: this._retryOptions,\n abortSignal: updatedOptions?.abortSignal,\n };\n return retry<void>(config);\n },\n );\n }\n}\n"]}
@@ -22,15 +22,127 @@ const core_util_1 = require("@azure/core-util");
22
22
  * Describes the receiver for a Message Session.
23
23
  */
24
24
  class MessageSession extends linkEntity_js_1.LinkEntity {
25
+ identifier;
26
+ _providedSessionId;
27
+ /**
28
+ * Provides the duration until which the session is locked.
29
+ */
30
+ sessionLockedUntilUtc;
31
+ /**
32
+ * The sessionId for the message session. Empty string is valid sessionId.
33
+ */
34
+ sessionId;
35
+ /**
36
+ * The maximum number of concurrent sessions that the
37
+ * client should initiate.
38
+ * - **Default**: `1`.
39
+ */
40
+ maxConcurrentSessions;
41
+ /**
42
+ * The maximum number of messages that should be
43
+ * processed concurrently in a session while in streaming mode. Once this limit has been reached,
44
+ * more messages will not be received until the user's message handler has completed processing current message.
45
+ * - **Default**: `1` (message in a session at a time).
46
+ */
47
+ maxConcurrentCalls = 1;
48
+ /**
49
+ * The mode in which messages should be received.
50
+ * Default: ReceiveMode.peekLock
51
+ */
52
+ receiveMode;
53
+ /**
54
+ * Indicates whether `Message.complete()` should be called
55
+ * automatically after the message processing is complete while receiving messages with handlers.
56
+ * Default: false.
57
+ */
58
+ autoComplete;
59
+ /**
60
+ * The maximum duration within which the
61
+ * lock will be renewed automatically. This value should be greater than the longest message
62
+ * lock duration; for example, the `lockDuration` property on the received message.
63
+ *
64
+ * Default: `300 * 1000` (5 minutes);
65
+ */
66
+ maxAutoRenewDurationInMs;
67
+ /**
68
+ * Should lock renewal happen automatically.
69
+ */
70
+ autoRenewLock;
25
71
  /**
26
72
  * Denotes if we are currently receiving messages
27
73
  */
28
74
  get isReceivingMessages() {
29
75
  return this._batchingReceiverLite.isReceivingMessages || this._isReceivingMessagesForSubscriber;
30
76
  }
77
+ _batchingReceiverLite;
78
+ _isReceivingMessagesForSubscriber;
79
+ /**
80
+ * Maintains a map of deliveries that
81
+ * are being actively disposed. It acts as a store for correlating the responses received for
82
+ * active dispositions.
83
+ */
84
+ _deliveryDispositionMap = new Map();
85
+ /**
86
+ * The message handler provided by the user that will
87
+ * be wrapped inside _onAmqpMessage.
88
+ */
89
+ _onMessage;
90
+ /**
91
+ * The error handler provided by the user that will be wrapped
92
+ * inside _onAmqpError.
93
+ */
94
+ _onError;
95
+ /**
96
+ * If the user provided error handler is present then it will
97
+ * notify the user's error handler about the error.
98
+ */
99
+ _notifyError;
100
+ /**
101
+ * The message handler that will be set as the handler on the
102
+ * underlying rhea receiver for the "receiver_close" event.
103
+ */
104
+ _onAmqpClose;
105
+ /**
106
+ * The message handler that will be set as the handler on
107
+ * the underlying rhea receiver's session for the "session_error" event.
108
+ */
109
+ _onSessionError;
110
+ /**
111
+ * The message handler that will be set as the handler on
112
+ * the underlying rhea receiver's session for the "session_close" event.
113
+ */
114
+ _onSessionClose;
115
+ /**
116
+ * The message handler that will be set as the handler on the
117
+ * underlying rhea receiver for the "receiver_error" event.
118
+ */
119
+ _onAmqpError;
120
+ /**
121
+ * The message handler that will be set as the handler on the
122
+ * underlying rhea receiver for the "settled" event.
123
+ */
124
+ _onSettled;
125
+ /**
126
+ * The session lock renewal timer that keeps
127
+ * track of when the MessageSession is due for session lock renewal.
128
+ */
129
+ _sessionLockRenewalTimer;
130
+ _totalAutoLockRenewDuration;
131
+ /**
132
+ * Whether to prevent the client from running JSON.parse() on the message body when receiving the message.
133
+ */
134
+ skipParsingBodyAsJson;
135
+ /**
136
+ * Whether to skip converting Date type on properties of message annotations
137
+ * or application properties into numbers when receiving the message. By
138
+ * default, properties of Date type is converted into UNIX epoch number for
139
+ * compatibility.
140
+ */
141
+ skipConvertingDate;
31
142
  get receiverHelper() {
32
143
  return this._receiverHelper;
33
144
  }
145
+ _receiverHelper;
34
146
  /**
35
147
  * Ensures that the session lock is renewed before it expires. The lock will not be renewed for
36
148
  * more than the configured totalAutoLockRenewDuration.
@@ -62,12 +174,11 @@ class MessageSession extends linkEntity_js_1.LinkEntity {
62
174
  }
63
175
  }
64
176
  async createRheaLink(options, _abortSignal) {
65
- var _a, _b;
66
177
  this._lastSBError = undefined;
67
178
  let errorMessage = "";
68
179
  const link = await this._context.connection.createReceiver(options);
69
180
  this._intermediateLink = link;
70
- const receivedSessionId = (_b = (_a = link.source) === null || _a === void 0 ? void 0 : _a.filter) === null || _b === void 0 ? void 0 : _b[core_amqp_1.Constants.sessionFilterName];
181
+ const receivedSessionId = link.source?.filter?.[core_amqp_1.Constants.sessionFilterName];
71
182
  if (this._providedSessionId === undefined && receivedSessionId === undefined) {
72
183
  // When we ask for any sessions (passing option of session-filter: undefined),
73
184
  // but don't receive one back, check whether service has sent any error.
@@ -111,14 +222,13 @@ class MessageSession extends linkEntity_js_1.LinkEntity {
111
222
  * Creates a new AMQP receiver under a new AMQP session.
112
223
  */
113
224
  async _init(opts = {}) {
114
- var _a, _b;
115
225
  try {
116
226
  const sessionOptions = this._createMessageSessionOptions(this.identifier, opts.timeoutInMs);
117
227
  await this.initLink(sessionOptions, opts.abortSignal);
118
228
  if (!this.link) {
119
229
  throw new Error("INTERNAL ERROR: failed to create receiver but without an error.");
120
230
  }
121
- const receivedSessionId = (_b = (_a = this.link.source) === null || _a === void 0 ? void 0 : _a.filter) === null || _b === void 0 ? void 0 : _b[core_amqp_1.Constants.sessionFilterName];
231
+ const receivedSessionId = this.link.source?.filter?.[core_amqp_1.Constants.sessionFilterName];
122
232
  if (this._providedSessionId === undefined)
123
233
  this.sessionId = receivedSessionId;
124
234
  this.sessionLockedUntilUtc = (0, utils_js_1.convertTicksToDate)(this.link.properties["com.microsoft:locked-until-utc"]);
@@ -170,6 +280,9 @@ class MessageSession extends linkEntity_js_1.LinkEntity {
170
280
  }, timeoutInMs);
171
281
  return rcvrOptions;
172
282
  }
283
+ _retryOptions;
284
+ _lastSBError;
285
+ _intermediateLink;
173
286
  /**
174
287
  * Constructs a MessageSession instance which lets you receive messages as batches
175
288
  * or via callbacks using subscribe.
@@ -185,19 +298,6 @@ class MessageSession extends linkEntity_js_1.LinkEntity {
185
298
  });
186
299
  this.identifier = identifier;
187
300
  this._providedSessionId = _providedSessionId;
188
- /**
189
- * The maximum number of messages that should be
190
- * processed concurrently in a session while in streaming mode. Once this limit has been reached,
191
- * more messages will not be received until the user's message handler has completed processing current message.
192
- * - **Default**: `1` (message in a session at a time).
193
- */
194
- this.maxConcurrentCalls = 1;
195
- /**
196
- * Maintains a map of deliveries that
197
- * are being actively disposed. It acts as a store for correlating the responses received for
198
- * active dispositions.
199
- */
200
- this._deliveryDispositionMap = new Map();
201
301
  this._receiverHelper = new receiverHelper_js_1.ReceiverHelper(() => ({
202
302
  receiver: this.link,
203
303
  logPrefix: this.logPrefix,
@@ -357,10 +457,9 @@ class MessageSession extends linkEntity_js_1.LinkEntity {
357
457
  this._subscribeImpl(onMessage, onError, options);
358
458
  }
359
459
  _subscribeImpl(onMessage, onError, options) {
360
- var _a;
361
460
  if (!options)
362
461
  options = {};
363
- if ((_a = options.abortSignal) === null || _a === void 0 ? void 0 : _a.aborted) {
462
+ if (options.abortSignal?.aborted) {
364
463
  throw new abort_controller_1.AbortError(core_amqp_1.StandardAbortMessage);
365
464
  }
366
465
  this._isReceivingMessagesForSubscriber = true;
@@ -514,9 +613,12 @@ class MessageSession extends linkEntity_js_1.LinkEntity {
514
613
  */
515
614
  async receiveMessages(maxMessageCount, maxWaitTimeInMs, maxTimeAfterFirstMessageInMs, options) {
516
615
  try {
517
- return await this._batchingReceiverLite.receiveMessages(Object.assign({ maxMessageCount,
616
+ return await this._batchingReceiverLite.receiveMessages({
617
+ maxMessageCount,
518
618
  maxWaitTimeInMs,
519
- maxTimeAfterFirstMessageInMs }, options));
619
+ maxTimeAfterFirstMessageInMs,
620
+ ...options,
621
+ });
520
622
  }
521
623
  catch (error) {
522
624
  log_js_1.receiverLogger.logError(error, `${this.logPrefix} Rejecting receiveMessages() with error`);
@@ -594,7 +696,11 @@ class MessageSession extends linkEntity_js_1.LinkEntity {
594
696
  else if (operation === serviceBusMessage_js_1.DispositionType.deadletter) {
595
697
  const error = {
596
698
  condition: core_amqp_1.Constants.deadLetterName,
597
- info: Object.assign(Object.assign({}, options.propertiesToModify), { DeadLetterReason: options.deadLetterReason, DeadLetterErrorDescription: options.deadLetterDescription }),
699
+ info: {
700
+ ...options.propertiesToModify,
701
+ DeadLetterReason: options.deadLetterReason,
702
+ DeadLetterErrorDescription: options.deadLetterDescription,
703
+ },
598
704
  };
599
705
  delivery.reject(error);
600
706
  }
@@ -607,14 +713,13 @@ class MessageSession extends linkEntity_js_1.LinkEntity {
607
713
  * @param options - Options that can be provided while creating the MessageSession.
608
714
  */
609
715
  static async create(identifier, context, entityPath, sessionId, options) {
610
- var _a, _b;
611
716
  (0, errors_js_1.throwErrorIfConnectionClosed)(context);
612
717
  const messageSession = new MessageSession(identifier, context, entityPath, sessionId, options);
613
718
  let timeoutInMs;
614
719
  // Only passing client timeout in link properties for accepting next available
615
720
  // session as this is the only long-polling scenario.
616
721
  if (sessionId === undefined) {
617
- timeoutInMs = (_b = (_a = options.retryOptions) === null || _a === void 0 ? void 0 : _a.timeoutInMs) !== null && _b !== void 0 ? _b : core_amqp_1.Constants.defaultOperationTimeoutInMs;
722
+ timeoutInMs = options.retryOptions?.timeoutInMs ?? core_amqp_1.Constants.defaultOperationTimeoutInMs;
618
723
  // The number of milliseconds to use as the basis for calculating a random jitter amount
619
724
  // opening receiver links. This is intended to ensure that multiple
620
725
  // session operations don't timeout at the same exact moment.
@@ -641,7 +746,7 @@ class MessageSession extends linkEntity_js_1.LinkEntity {
641
746
  }
642
747
  }
643
748
  await messageSession._init({
644
- abortSignal: options === null || options === void 0 ? void 0 : options.abortSignal,
749
+ abortSignal: options?.abortSignal,
645
750
  timeoutInMs,
646
751
  });
647
752
  return messageSession;