@azure/event-hubs 5.13.0-beta.2 → 6.0.0-alpha.20250129.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (616) hide show
  1. package/README.md +32 -31
  2. package/dist/browser/batchingPartitionChannel.d.ts +94 -0
  3. package/dist/browser/batchingPartitionChannel.d.ts.map +1 -0
  4. package/{dist-esm/src → dist/browser}/batchingPartitionChannel.js +4 -4
  5. package/dist/browser/batchingPartitionChannel.js.map +1 -0
  6. package/dist/browser/connectionContext.d.ts +108 -0
  7. package/dist/browser/connectionContext.d.ts.map +1 -0
  8. package/{dist-esm/src → dist/browser}/connectionContext.js +9 -11
  9. package/dist/browser/connectionContext.js.map +1 -0
  10. package/dist/browser/dataTransformer.d.ts +53 -0
  11. package/dist/browser/dataTransformer.d.ts.map +1 -0
  12. package/{dist-esm/src → dist/browser}/dataTransformer.js +2 -2
  13. package/dist/browser/dataTransformer.js.map +1 -0
  14. package/dist/browser/diagnostics/instrumentEventData.d.ts +28 -0
  15. package/dist/browser/diagnostics/instrumentEventData.d.ts.map +1 -0
  16. package/{dist-esm/src → dist/browser}/diagnostics/instrumentEventData.js +3 -3
  17. package/dist/browser/diagnostics/instrumentEventData.js.map +1 -0
  18. package/dist/browser/diagnostics/tracing.d.ts +19 -0
  19. package/dist/browser/diagnostics/tracing.d.ts.map +1 -0
  20. package/{dist-esm/src → dist/browser}/diagnostics/tracing.js +2 -2
  21. package/dist/browser/diagnostics/tracing.js.map +1 -0
  22. package/dist/browser/eventData.d.ts +295 -0
  23. package/dist/browser/eventData.d.ts.map +1 -0
  24. package/{dist-esm/src → dist/browser}/eventData.js +39 -5
  25. package/dist/browser/eventData.js.map +1 -0
  26. package/dist/browser/eventDataAdapter.d.ts +69 -0
  27. package/dist/browser/eventDataAdapter.d.ts.map +1 -0
  28. package/{dist-esm/src → dist/browser}/eventDataAdapter.js +1 -1
  29. package/dist/browser/eventDataAdapter.js.map +1 -0
  30. package/dist/browser/eventDataBatch.d.ts +225 -0
  31. package/dist/browser/eventDataBatch.d.ts.map +1 -0
  32. package/{dist-esm/src → dist/browser}/eventDataBatch.js +7 -4
  33. package/dist/browser/eventDataBatch.js.map +1 -0
  34. package/dist/browser/eventHubBufferedProducerClient.d.ts +323 -0
  35. package/dist/browser/eventHubBufferedProducerClient.d.ts.map +1 -0
  36. package/{dist-esm/src → dist/browser}/eventHubBufferedProducerClient.js +10 -9
  37. package/dist/browser/eventHubBufferedProducerClient.js.map +1 -0
  38. package/dist/browser/eventHubConsumerClient.d.ts +277 -0
  39. package/dist/browser/eventHubConsumerClient.d.ts.map +1 -0
  40. package/{dist-esm/src → dist/browser}/eventHubConsumerClient.js +12 -12
  41. package/dist/browser/eventHubConsumerClient.js.map +1 -0
  42. package/dist/browser/eventHubConsumerClientModels.d.ts +218 -0
  43. package/dist/browser/eventHubConsumerClientModels.d.ts.map +1 -0
  44. package/dist/browser/eventHubConsumerClientModels.js +4 -0
  45. package/dist/browser/eventHubConsumerClientModels.js.map +1 -0
  46. package/dist/browser/eventHubProducerClient.d.ts +266 -0
  47. package/dist/browser/eventHubProducerClient.d.ts.map +1 -0
  48. package/{dist-esm/src → dist/browser}/eventHubProducerClient.js +12 -10
  49. package/dist/browser/eventHubProducerClient.js.map +1 -0
  50. package/dist/browser/eventHubSender.d.ts +227 -0
  51. package/dist/browser/eventHubSender.d.ts.map +1 -0
  52. package/{dist-esm/src → dist/browser}/eventHubSender.js +12 -12
  53. package/dist/browser/eventHubSender.js.map +1 -0
  54. package/dist/browser/eventPosition.d.ts +73 -0
  55. package/dist/browser/eventPosition.d.ts.map +1 -0
  56. package/{dist-esm/src → dist/browser}/eventPosition.js +2 -2
  57. package/dist/browser/eventPosition.js.map +1 -0
  58. package/dist/browser/eventProcessor.d.ts +232 -0
  59. package/dist/browser/eventProcessor.d.ts.map +1 -0
  60. package/{dist-esm/src → dist/browser}/eventProcessor.js +18 -18
  61. package/dist/browser/eventProcessor.js.map +1 -0
  62. package/dist/browser/eventhubConnectionConfig.d.ts +96 -0
  63. package/dist/browser/eventhubConnectionConfig.d.ts.map +1 -0
  64. package/{dist-esm/src → dist/browser}/eventhubConnectionConfig.js +2 -2
  65. package/dist/browser/eventhubConnectionConfig.js.map +1 -0
  66. package/dist/browser/impl/awaitableQueue.d.ts +25 -0
  67. package/dist/browser/impl/awaitableQueue.d.ts.map +1 -0
  68. package/{dist-esm/src → dist/browser}/impl/awaitableQueue.js +1 -1
  69. package/dist/browser/impl/awaitableQueue.js.map +1 -0
  70. package/dist/browser/impl/partitionAssigner.d.ts +29 -0
  71. package/dist/browser/impl/partitionAssigner.d.ts.map +1 -0
  72. package/{dist-esm/src → dist/browser}/impl/partitionAssigner.js +2 -2
  73. package/dist/browser/impl/partitionAssigner.js.map +1 -0
  74. package/dist/browser/impl/partitionGate.d.ts +27 -0
  75. package/dist/browser/impl/partitionGate.d.ts.map +1 -0
  76. package/{dist-esm/src → dist/browser}/impl/partitionGate.js +1 -1
  77. package/{dist-esm/src → dist/browser}/impl/partitionGate.js.map +1 -1
  78. package/dist/browser/impl/partitionKeyToIdMapper.d.ts +6 -0
  79. package/dist/browser/impl/partitionKeyToIdMapper.d.ts.map +1 -0
  80. package/{dist-esm/src → dist/browser}/impl/partitionKeyToIdMapper.js +1 -1
  81. package/{dist-esm/src → dist/browser}/impl/partitionKeyToIdMapper.js.map +1 -1
  82. package/dist/browser/inMemoryCheckpointStore.d.ts +44 -0
  83. package/dist/browser/inMemoryCheckpointStore.d.ts.map +1 -0
  84. package/{dist-esm/src → dist/browser}/inMemoryCheckpointStore.js +3 -3
  85. package/dist/browser/inMemoryCheckpointStore.js.map +1 -0
  86. package/dist/browser/index.d.ts +21 -0
  87. package/dist/browser/index.d.ts.map +1 -0
  88. package/{dist-esm/src → dist/browser}/index.js +9 -9
  89. package/dist/browser/index.js.map +1 -0
  90. package/dist/browser/loadBalancerStrategies/balancedStrategy.d.ts +30 -0
  91. package/dist/browser/loadBalancerStrategies/balancedStrategy.d.ts.map +1 -0
  92. package/{dist-esm/src → dist/browser}/loadBalancerStrategies/balancedStrategy.js +2 -2
  93. package/dist/browser/loadBalancerStrategies/balancedStrategy.js.map +1 -0
  94. package/dist/browser/loadBalancerStrategies/greedyStrategy.d.ts +24 -0
  95. package/dist/browser/loadBalancerStrategies/greedyStrategy.d.ts.map +1 -0
  96. package/{dist-esm/src → dist/browser}/loadBalancerStrategies/greedyStrategy.js +2 -2
  97. package/dist/browser/loadBalancerStrategies/greedyStrategy.js.map +1 -0
  98. package/dist/browser/loadBalancerStrategies/loadBalancingStrategy.d.ts +28 -0
  99. package/dist/browser/loadBalancerStrategies/loadBalancingStrategy.d.ts.map +1 -0
  100. package/{dist-esm/src → dist/browser}/loadBalancerStrategies/loadBalancingStrategy.js +2 -2
  101. package/dist/browser/loadBalancerStrategies/loadBalancingStrategy.js.map +1 -0
  102. package/dist/browser/loadBalancerStrategies/unbalancedStrategy.d.ts +20 -0
  103. package/dist/browser/loadBalancerStrategies/unbalancedStrategy.d.ts.map +1 -0
  104. package/{dist-esm/src → dist/browser}/loadBalancerStrategies/unbalancedStrategy.js +1 -1
  105. package/dist/browser/loadBalancerStrategies/unbalancedStrategy.js.map +1 -0
  106. package/dist/browser/logger.d.ts +37 -0
  107. package/dist/browser/logger.d.ts.map +1 -0
  108. package/{dist-esm/src → dist/browser}/logger.js +1 -1
  109. package/dist/browser/logger.js.map +1 -0
  110. package/dist/browser/managementClient.d.ts +145 -0
  111. package/dist/browser/managementClient.d.ts.map +1 -0
  112. package/{dist-esm/src → dist/browser}/managementClient.js +8 -8
  113. package/dist/browser/managementClient.js.map +1 -0
  114. package/dist/browser/models/private.d.ts +185 -0
  115. package/dist/browser/models/private.d.ts.map +1 -0
  116. package/dist/browser/models/private.js +4 -0
  117. package/dist/browser/models/private.js.map +1 -0
  118. package/dist/browser/models/public.d.ts +240 -0
  119. package/dist/browser/models/public.d.ts.map +1 -0
  120. package/{dist-esm/src → dist/browser}/models/public.js +1 -1
  121. package/dist/browser/models/public.js.map +1 -0
  122. package/dist/browser/package.json +3 -0
  123. package/dist/browser/partitionProcessor.d.ts +134 -0
  124. package/dist/browser/partitionProcessor.d.ts.map +1 -0
  125. package/{dist-esm/src → dist/browser}/partitionProcessor.js +2 -2
  126. package/dist/browser/partitionProcessor.js.map +1 -0
  127. package/dist/browser/partitionPump.d.ts +38 -0
  128. package/dist/browser/partitionPump.d.ts.map +1 -0
  129. package/{dist-esm/src → dist/browser}/partitionPump.js +6 -7
  130. package/dist/browser/partitionPump.js.map +1 -0
  131. package/dist/browser/partitionReceiver.d.ts +82 -0
  132. package/dist/browser/partitionReceiver.d.ts.map +1 -0
  133. package/{dist-esm/src → dist/browser}/partitionReceiver.js +14 -12
  134. package/dist/browser/partitionReceiver.js.map +1 -0
  135. package/dist/browser/pumpManager.d.ts +72 -0
  136. package/dist/browser/pumpManager.d.ts.map +1 -0
  137. package/{dist-esm/src → dist/browser}/pumpManager.js +4 -4
  138. package/dist/browser/pumpManager.js.map +1 -0
  139. package/dist/browser/util/connectionStringUtils.d.ts +52 -0
  140. package/dist/browser/util/connectionStringUtils.d.ts.map +1 -0
  141. package/{dist-esm/src → dist/browser}/util/connectionStringUtils.js +1 -1
  142. package/{dist-esm/src → dist/browser}/util/connectionStringUtils.js.map +1 -1
  143. package/dist/browser/util/constants.d.ts +25 -0
  144. package/dist/browser/util/constants.d.ts.map +1 -0
  145. package/{dist-esm/src → dist/browser}/util/constants.js +4 -2
  146. package/dist/browser/util/constants.js.map +1 -0
  147. package/dist/browser/util/delayWithoutThrow.d.ts +8 -0
  148. package/dist/browser/util/delayWithoutThrow.d.ts.map +1 -0
  149. package/{dist-esm/src → dist/browser}/util/delayWithoutThrow.js +1 -1
  150. package/dist/browser/util/delayWithoutThrow.js.map +1 -0
  151. package/dist/browser/util/error.d.ts +39 -0
  152. package/dist/browser/util/error.d.ts.map +1 -0
  153. package/{dist-esm/src → dist/browser}/util/error.js +2 -2
  154. package/dist/browser/util/error.js.map +1 -0
  155. package/dist/browser/util/getPromiseParts.d.ts +10 -0
  156. package/dist/browser/util/getPromiseParts.d.ts.map +1 -0
  157. package/{dist-esm/src → dist/browser}/util/getPromiseParts.js +1 -1
  158. package/{dist-esm/src → dist/browser}/util/getPromiseParts.js.map +1 -1
  159. package/dist/browser/util/operationOptions.d.ts +16 -0
  160. package/dist/browser/util/operationOptions.d.ts.map +1 -0
  161. package/dist/browser/util/operationOptions.js +4 -0
  162. package/dist/browser/util/operationOptions.js.map +1 -0
  163. package/dist/browser/util/parseEndpoint.d.ts +11 -0
  164. package/dist/browser/util/parseEndpoint.d.ts.map +1 -0
  165. package/{dist-esm/src → dist/browser}/util/parseEndpoint.js +1 -1
  166. package/{dist-esm/src → dist/browser}/util/parseEndpoint.js.map +1 -1
  167. package/dist/browser/util/retries.d.ts +6 -0
  168. package/dist/browser/util/retries.d.ts.map +1 -0
  169. package/{dist-esm/src → dist/browser}/util/retries.js +1 -1
  170. package/dist/browser/util/retries.js.map +1 -0
  171. package/dist/browser/util/runtimeInfo-browser.d.mts.map +1 -0
  172. package/dist/browser/util/runtimeInfo-browser.mjs.map +1 -0
  173. package/dist/browser/util/runtimeInfo.d.ts +6 -0
  174. package/{dist-esm/src/util/runtimeInfo.browser.js → dist/browser/util/runtimeInfo.js} +2 -2
  175. package/dist/browser/util/timerLoop.d.ts +26 -0
  176. package/dist/browser/util/timerLoop.d.ts.map +1 -0
  177. package/{dist-esm/src → dist/browser}/util/timerLoop.js +1 -1
  178. package/{dist-esm/src → dist/browser}/util/timerLoop.js.map +1 -1
  179. package/dist/browser/util/typeGuards.d.ts +8 -0
  180. package/dist/browser/util/typeGuards.d.ts.map +1 -0
  181. package/{dist-esm/src → dist/browser}/util/typeGuards.js +2 -2
  182. package/dist/browser/util/typeGuards.js.map +1 -0
  183. package/dist/browser/util/utils.d.ts +7 -0
  184. package/dist/browser/util/utils.d.ts.map +1 -0
  185. package/{dist-esm/src → dist/browser}/util/utils.js +1 -1
  186. package/{dist-esm/src → dist/browser}/util/utils.js.map +1 -1
  187. package/dist/browser/withAuth.d.ts +25 -0
  188. package/dist/browser/withAuth.d.ts.map +1 -0
  189. package/{dist-esm/src → dist/browser}/withAuth.js +4 -4
  190. package/dist/browser/withAuth.js.map +1 -0
  191. package/dist/commonjs/batchingPartitionChannel.d.ts +94 -0
  192. package/dist/commonjs/batchingPartitionChannel.d.ts.map +1 -0
  193. package/dist/commonjs/batchingPartitionChannel.js +252 -0
  194. package/dist/commonjs/batchingPartitionChannel.js.map +1 -0
  195. package/dist/commonjs/connectionContext.d.ts +108 -0
  196. package/dist/commonjs/connectionContext.d.ts.map +1 -0
  197. package/dist/commonjs/connectionContext.js +322 -0
  198. package/dist/commonjs/connectionContext.js.map +1 -0
  199. package/dist/commonjs/dataTransformer.d.ts +53 -0
  200. package/dist/commonjs/dataTransformer.d.ts.map +1 -0
  201. package/dist/commonjs/dataTransformer.js +138 -0
  202. package/dist/commonjs/dataTransformer.js.map +1 -0
  203. package/dist/commonjs/diagnostics/instrumentEventData.d.ts +28 -0
  204. package/dist/commonjs/diagnostics/instrumentEventData.d.ts.map +1 -0
  205. package/dist/commonjs/diagnostics/instrumentEventData.js +73 -0
  206. package/dist/commonjs/diagnostics/instrumentEventData.js.map +1 -0
  207. package/dist/commonjs/diagnostics/tracing.d.ts +19 -0
  208. package/dist/commonjs/diagnostics/tracing.d.ts.map +1 -0
  209. package/dist/commonjs/diagnostics/tracing.js +44 -0
  210. package/dist/commonjs/diagnostics/tracing.js.map +1 -0
  211. package/dist/commonjs/eventData.d.ts +295 -0
  212. package/dist/commonjs/eventData.d.ts.map +1 -0
  213. package/dist/commonjs/eventData.js +253 -0
  214. package/dist/commonjs/eventData.js.map +1 -0
  215. package/dist/commonjs/eventDataAdapter.d.ts +69 -0
  216. package/dist/commonjs/eventDataAdapter.d.ts.map +1 -0
  217. package/dist/commonjs/eventDataAdapter.js +38 -0
  218. package/dist/commonjs/eventDataAdapter.js.map +1 -0
  219. package/dist/commonjs/eventDataBatch.d.ts +225 -0
  220. package/dist/commonjs/eventDataBatch.d.ts.map +1 -0
  221. package/dist/commonjs/eventDataBatch.js +254 -0
  222. package/dist/commonjs/eventDataBatch.js.map +1 -0
  223. package/dist/commonjs/eventHubBufferedProducerClient.d.ts +323 -0
  224. package/dist/commonjs/eventHubBufferedProducerClient.d.ts.map +1 -0
  225. package/dist/commonjs/eventHubBufferedProducerClient.js +289 -0
  226. package/dist/commonjs/eventHubBufferedProducerClient.js.map +1 -0
  227. package/dist/commonjs/eventHubConsumerClient.d.ts +277 -0
  228. package/dist/commonjs/eventHubConsumerClient.d.ts.map +1 -0
  229. package/dist/commonjs/eventHubConsumerClient.js +298 -0
  230. package/dist/commonjs/eventHubConsumerClient.js.map +1 -0
  231. package/dist/commonjs/eventHubConsumerClientModels.d.ts +218 -0
  232. package/dist/commonjs/eventHubConsumerClientModels.d.ts.map +1 -0
  233. package/dist/commonjs/eventHubConsumerClientModels.js +5 -0
  234. package/dist/commonjs/eventHubConsumerClientModels.js.map +1 -0
  235. package/dist/commonjs/eventHubProducerClient.d.ts +266 -0
  236. package/dist/commonjs/eventHubProducerClient.d.ts.map +1 -0
  237. package/dist/commonjs/eventHubProducerClient.js +319 -0
  238. package/dist/commonjs/eventHubProducerClient.js.map +1 -0
  239. package/dist/commonjs/eventHubSender.d.ts +227 -0
  240. package/dist/commonjs/eventHubSender.d.ts.map +1 -0
  241. package/dist/commonjs/eventHubSender.js +547 -0
  242. package/dist/commonjs/eventHubSender.js.map +1 -0
  243. package/dist/commonjs/eventPosition.d.ts +73 -0
  244. package/dist/commonjs/eventPosition.d.ts.map +1 -0
  245. package/dist/commonjs/eventPosition.js +128 -0
  246. package/dist/commonjs/eventPosition.js.map +1 -0
  247. package/dist/commonjs/eventProcessor.d.ts +232 -0
  248. package/dist/commonjs/eventProcessor.d.ts.map +1 -0
  249. package/dist/commonjs/eventProcessor.js +371 -0
  250. package/dist/commonjs/eventProcessor.js.map +1 -0
  251. package/dist/commonjs/eventhubConnectionConfig.d.ts +96 -0
  252. package/dist/commonjs/eventhubConnectionConfig.d.ts.map +1 -0
  253. package/dist/commonjs/eventhubConnectionConfig.js +101 -0
  254. package/dist/commonjs/eventhubConnectionConfig.js.map +1 -0
  255. package/dist/commonjs/impl/awaitableQueue.d.ts +25 -0
  256. package/dist/commonjs/impl/awaitableQueue.d.ts.map +1 -0
  257. package/dist/commonjs/impl/awaitableQueue.js +51 -0
  258. package/dist/commonjs/impl/awaitableQueue.js.map +1 -0
  259. package/dist/commonjs/impl/partitionAssigner.d.ts +29 -0
  260. package/dist/commonjs/impl/partitionAssigner.d.ts.map +1 -0
  261. package/dist/commonjs/impl/partitionAssigner.js +58 -0
  262. package/dist/commonjs/impl/partitionAssigner.js.map +1 -0
  263. package/dist/commonjs/impl/partitionGate.d.ts +27 -0
  264. package/dist/commonjs/impl/partitionGate.d.ts.map +1 -0
  265. package/dist/commonjs/impl/partitionGate.js +44 -0
  266. package/dist/commonjs/impl/partitionGate.js.map +1 -0
  267. package/dist/commonjs/impl/partitionKeyToIdMapper.d.ts +6 -0
  268. package/dist/commonjs/impl/partitionKeyToIdMapper.d.ts.map +1 -0
  269. package/dist/commonjs/impl/partitionKeyToIdMapper.js +115 -0
  270. package/dist/commonjs/impl/partitionKeyToIdMapper.js.map +1 -0
  271. package/dist/commonjs/inMemoryCheckpointStore.d.ts +44 -0
  272. package/dist/commonjs/inMemoryCheckpointStore.d.ts.map +1 -0
  273. package/dist/commonjs/inMemoryCheckpointStore.js +96 -0
  274. package/dist/commonjs/inMemoryCheckpointStore.js.map +1 -0
  275. package/dist/commonjs/index.d.ts +21 -0
  276. package/dist/commonjs/index.d.ts.map +1 -0
  277. package/dist/commonjs/index.js +26 -0
  278. package/dist/commonjs/index.js.map +1 -0
  279. package/dist/commonjs/loadBalancerStrategies/balancedStrategy.d.ts +30 -0
  280. package/dist/commonjs/loadBalancerStrategies/balancedStrategy.d.ts.map +1 -0
  281. package/dist/commonjs/loadBalancerStrategies/balancedStrategy.js +43 -0
  282. package/dist/commonjs/loadBalancerStrategies/balancedStrategy.js.map +1 -0
  283. package/dist/commonjs/loadBalancerStrategies/greedyStrategy.d.ts +24 -0
  284. package/dist/commonjs/loadBalancerStrategies/greedyStrategy.d.ts.map +1 -0
  285. package/dist/commonjs/loadBalancerStrategies/greedyStrategy.js +32 -0
  286. package/dist/commonjs/loadBalancerStrategies/greedyStrategy.js.map +1 -0
  287. package/dist/commonjs/loadBalancerStrategies/loadBalancingStrategy.d.ts +28 -0
  288. package/dist/commonjs/loadBalancerStrategies/loadBalancingStrategy.d.ts.map +1 -0
  289. package/dist/commonjs/loadBalancerStrategies/loadBalancingStrategy.js +248 -0
  290. package/dist/commonjs/loadBalancerStrategies/loadBalancingStrategy.js.map +1 -0
  291. package/dist/commonjs/loadBalancerStrategies/unbalancedStrategy.d.ts +20 -0
  292. package/dist/commonjs/loadBalancerStrategies/unbalancedStrategy.d.ts.map +1 -0
  293. package/dist/commonjs/loadBalancerStrategies/unbalancedStrategy.js +26 -0
  294. package/dist/commonjs/loadBalancerStrategies/unbalancedStrategy.js.map +1 -0
  295. package/dist/commonjs/logger.d.ts +37 -0
  296. package/dist/commonjs/logger.d.ts.map +1 -0
  297. package/dist/commonjs/logger.js +65 -0
  298. package/dist/commonjs/logger.js.map +1 -0
  299. package/dist/commonjs/managementClient.d.ts +145 -0
  300. package/dist/commonjs/managementClient.d.ts.map +1 -0
  301. package/dist/commonjs/managementClient.js +275 -0
  302. package/dist/commonjs/managementClient.js.map +1 -0
  303. package/dist/commonjs/models/private.d.ts +185 -0
  304. package/dist/commonjs/models/private.d.ts.map +1 -0
  305. package/dist/commonjs/models/private.js +5 -0
  306. package/dist/commonjs/models/private.js.map +1 -0
  307. package/dist/commonjs/models/public.d.ts +240 -0
  308. package/dist/commonjs/models/public.d.ts.map +1 -0
  309. package/dist/commonjs/models/public.js +21 -0
  310. package/dist/commonjs/models/public.js.map +1 -0
  311. package/dist/commonjs/package.json +3 -0
  312. package/dist/commonjs/partitionProcessor.d.ts +134 -0
  313. package/dist/commonjs/partitionProcessor.d.ts.map +1 -0
  314. package/dist/commonjs/partitionProcessor.js +138 -0
  315. package/dist/commonjs/partitionProcessor.js.map +1 -0
  316. package/dist/commonjs/partitionPump.d.ts +38 -0
  317. package/dist/commonjs/partitionPump.d.ts.map +1 -0
  318. package/dist/commonjs/partitionPump.js +171 -0
  319. package/dist/commonjs/partitionPump.js.map +1 -0
  320. package/dist/commonjs/partitionReceiver.d.ts +82 -0
  321. package/dist/commonjs/partitionReceiver.d.ts.map +1 -0
  322. package/dist/commonjs/partitionReceiver.js +335 -0
  323. package/dist/commonjs/partitionReceiver.js.map +1 -0
  324. package/dist/commonjs/pumpManager.d.ts +72 -0
  325. package/dist/commonjs/pumpManager.d.ts.map +1 -0
  326. package/dist/commonjs/pumpManager.js +122 -0
  327. package/dist/commonjs/pumpManager.js.map +1 -0
  328. package/{types/latest → dist/commonjs}/tsdoc-metadata.json +1 -1
  329. package/dist/commonjs/util/connectionStringUtils.d.ts +52 -0
  330. package/dist/commonjs/util/connectionStringUtils.d.ts.map +1 -0
  331. package/dist/commonjs/util/connectionStringUtils.js +51 -0
  332. package/dist/commonjs/util/connectionStringUtils.js.map +1 -0
  333. package/dist/commonjs/util/constants.d.ts +25 -0
  334. package/dist/commonjs/util/constants.d.ts.map +1 -0
  335. package/dist/commonjs/util/constants.js +30 -0
  336. package/dist/commonjs/util/constants.js.map +1 -0
  337. package/dist/commonjs/util/delayWithoutThrow.d.ts +8 -0
  338. package/dist/commonjs/util/delayWithoutThrow.d.ts.map +1 -0
  339. package/dist/commonjs/util/delayWithoutThrow.js +20 -0
  340. package/dist/commonjs/util/delayWithoutThrow.js.map +1 -0
  341. package/dist/commonjs/util/error.d.ts +39 -0
  342. package/dist/commonjs/util/error.d.ts.map +1 -0
  343. package/dist/commonjs/util/error.js +110 -0
  344. package/dist/commonjs/util/error.js.map +1 -0
  345. package/dist/commonjs/util/getPromiseParts.d.ts +10 -0
  346. package/dist/commonjs/util/getPromiseParts.d.ts.map +1 -0
  347. package/dist/commonjs/util/getPromiseParts.js +23 -0
  348. package/dist/commonjs/util/getPromiseParts.js.map +1 -0
  349. package/dist/commonjs/util/operationOptions.d.ts +16 -0
  350. package/dist/commonjs/util/operationOptions.d.ts.map +1 -0
  351. package/dist/commonjs/util/operationOptions.js +5 -0
  352. package/dist/commonjs/util/operationOptions.js.map +1 -0
  353. package/dist/commonjs/util/parseEndpoint.d.ts +11 -0
  354. package/dist/commonjs/util/parseEndpoint.d.ts.map +1 -0
  355. package/dist/commonjs/util/parseEndpoint.js +20 -0
  356. package/dist/commonjs/util/parseEndpoint.js.map +1 -0
  357. package/dist/commonjs/util/retries.d.ts +6 -0
  358. package/dist/commonjs/util/retries.d.ts.map +1 -0
  359. package/dist/commonjs/util/retries.js +16 -0
  360. package/dist/commonjs/util/retries.js.map +1 -0
  361. package/dist/commonjs/util/runtimeInfo.d.ts +6 -0
  362. package/dist/commonjs/util/runtimeInfo.d.ts.map +1 -0
  363. package/dist/commonjs/util/runtimeInfo.js +15 -0
  364. package/dist/commonjs/util/runtimeInfo.js.map +1 -0
  365. package/dist/commonjs/util/timerLoop.d.ts +26 -0
  366. package/dist/commonjs/util/timerLoop.d.ts.map +1 -0
  367. package/dist/commonjs/util/timerLoop.js +30 -0
  368. package/dist/commonjs/util/timerLoop.js.map +1 -0
  369. package/dist/commonjs/util/typeGuards.d.ts +8 -0
  370. package/dist/commonjs/util/typeGuards.d.ts.map +1 -0
  371. package/dist/commonjs/util/typeGuards.js +15 -0
  372. package/dist/commonjs/util/typeGuards.js.map +1 -0
  373. package/dist/commonjs/util/utils.d.ts +7 -0
  374. package/dist/commonjs/util/utils.d.ts.map +1 -0
  375. package/dist/commonjs/util/utils.js +16 -0
  376. package/dist/commonjs/util/utils.js.map +1 -0
  377. package/dist/commonjs/withAuth.d.ts +25 -0
  378. package/dist/commonjs/withAuth.d.ts.map +1 -0
  379. package/dist/commonjs/withAuth.js +88 -0
  380. package/dist/commonjs/withAuth.js.map +1 -0
  381. package/dist/esm/batchingPartitionChannel.d.ts +94 -0
  382. package/dist/esm/batchingPartitionChannel.d.ts.map +1 -0
  383. package/dist/esm/batchingPartitionChannel.js +248 -0
  384. package/dist/esm/batchingPartitionChannel.js.map +1 -0
  385. package/dist/esm/connectionContext.d.ts +108 -0
  386. package/dist/esm/connectionContext.d.ts.map +1 -0
  387. package/dist/esm/connectionContext.js +318 -0
  388. package/dist/esm/connectionContext.js.map +1 -0
  389. package/dist/esm/dataTransformer.d.ts +53 -0
  390. package/dist/esm/dataTransformer.d.ts.map +1 -0
  391. package/dist/esm/dataTransformer.js +133 -0
  392. package/dist/esm/dataTransformer.js.map +1 -0
  393. package/dist/esm/diagnostics/instrumentEventData.d.ts +28 -0
  394. package/dist/esm/diagnostics/instrumentEventData.d.ts.map +1 -0
  395. package/dist/esm/diagnostics/instrumentEventData.js +68 -0
  396. package/dist/esm/diagnostics/instrumentEventData.js.map +1 -0
  397. package/dist/esm/diagnostics/tracing.d.ts +19 -0
  398. package/dist/esm/diagnostics/tracing.d.ts.map +1 -0
  399. package/dist/esm/diagnostics/tracing.js +40 -0
  400. package/dist/esm/diagnostics/tracing.js.map +1 -0
  401. package/dist/esm/eventData.d.ts +295 -0
  402. package/dist/esm/eventData.d.ts.map +1 -0
  403. package/dist/esm/eventData.js +245 -0
  404. package/dist/esm/eventData.js.map +1 -0
  405. package/dist/esm/eventDataAdapter.d.ts +69 -0
  406. package/dist/esm/eventDataAdapter.d.ts.map +1 -0
  407. package/dist/esm/eventDataAdapter.js +35 -0
  408. package/dist/esm/eventDataAdapter.js.map +1 -0
  409. package/dist/esm/eventDataBatch.d.ts +225 -0
  410. package/dist/esm/eventDataBatch.d.ts.map +1 -0
  411. package/dist/esm/eventDataBatch.js +249 -0
  412. package/dist/esm/eventDataBatch.js.map +1 -0
  413. package/dist/esm/eventHubBufferedProducerClient.d.ts +323 -0
  414. package/dist/esm/eventHubBufferedProducerClient.d.ts.map +1 -0
  415. package/dist/esm/eventHubBufferedProducerClient.js +285 -0
  416. package/dist/esm/eventHubBufferedProducerClient.js.map +1 -0
  417. package/dist/esm/eventHubConsumerClient.d.ts +277 -0
  418. package/dist/esm/eventHubConsumerClient.d.ts.map +1 -0
  419. package/dist/esm/eventHubConsumerClient.js +293 -0
  420. package/dist/esm/eventHubConsumerClient.js.map +1 -0
  421. package/dist/esm/eventHubConsumerClientModels.d.ts +218 -0
  422. package/dist/esm/eventHubConsumerClientModels.d.ts.map +1 -0
  423. package/dist/esm/eventHubConsumerClientModels.js +4 -0
  424. package/dist/esm/eventHubConsumerClientModels.js.map +1 -0
  425. package/dist/esm/eventHubProducerClient.d.ts +266 -0
  426. package/dist/esm/eventHubProducerClient.d.ts.map +1 -0
  427. package/dist/esm/eventHubProducerClient.js +315 -0
  428. package/dist/esm/eventHubProducerClient.js.map +1 -0
  429. package/dist/esm/eventHubSender.d.ts +227 -0
  430. package/dist/esm/eventHubSender.d.ts.map +1 -0
  431. package/dist/esm/eventHubSender.js +541 -0
  432. package/dist/esm/eventHubSender.js.map +1 -0
  433. package/dist/esm/eventPosition.d.ts +73 -0
  434. package/dist/esm/eventPosition.d.ts.map +1 -0
  435. package/dist/esm/eventPosition.js +121 -0
  436. package/dist/esm/eventPosition.js.map +1 -0
  437. package/dist/esm/eventProcessor.d.ts +232 -0
  438. package/dist/esm/eventProcessor.d.ts.map +1 -0
  439. package/dist/esm/eventProcessor.js +367 -0
  440. package/dist/esm/eventProcessor.js.map +1 -0
  441. package/dist/esm/eventhubConnectionConfig.d.ts +96 -0
  442. package/dist/esm/eventhubConnectionConfig.d.ts.map +1 -0
  443. package/dist/esm/eventhubConnectionConfig.js +98 -0
  444. package/dist/esm/eventhubConnectionConfig.js.map +1 -0
  445. package/dist/esm/impl/awaitableQueue.d.ts +25 -0
  446. package/dist/esm/impl/awaitableQueue.d.ts.map +1 -0
  447. package/dist/esm/impl/awaitableQueue.js +47 -0
  448. package/dist/esm/impl/awaitableQueue.js.map +1 -0
  449. package/dist/esm/impl/partitionAssigner.d.ts +29 -0
  450. package/dist/esm/impl/partitionAssigner.d.ts.map +1 -0
  451. package/dist/esm/impl/partitionAssigner.js +54 -0
  452. package/dist/esm/impl/partitionAssigner.js.map +1 -0
  453. package/dist/esm/impl/partitionGate.d.ts +27 -0
  454. package/dist/esm/impl/partitionGate.d.ts.map +1 -0
  455. package/dist/esm/impl/partitionGate.js +40 -0
  456. package/dist/esm/impl/partitionGate.js.map +1 -0
  457. package/dist/esm/impl/partitionKeyToIdMapper.d.ts +6 -0
  458. package/dist/esm/impl/partitionKeyToIdMapper.d.ts.map +1 -0
  459. package/dist/esm/impl/partitionKeyToIdMapper.js +111 -0
  460. package/dist/esm/impl/partitionKeyToIdMapper.js.map +1 -0
  461. package/dist/esm/inMemoryCheckpointStore.d.ts +44 -0
  462. package/dist/esm/inMemoryCheckpointStore.d.ts.map +1 -0
  463. package/dist/esm/inMemoryCheckpointStore.js +92 -0
  464. package/dist/esm/inMemoryCheckpointStore.js.map +1 -0
  465. package/dist/esm/index.d.ts +21 -0
  466. package/dist/esm/index.d.ts.map +1 -0
  467. package/dist/esm/index.js +12 -0
  468. package/dist/esm/index.js.map +1 -0
  469. package/dist/esm/loadBalancerStrategies/balancedStrategy.d.ts +30 -0
  470. package/dist/esm/loadBalancerStrategies/balancedStrategy.d.ts.map +1 -0
  471. package/dist/esm/loadBalancerStrategies/balancedStrategy.js +39 -0
  472. package/dist/esm/loadBalancerStrategies/balancedStrategy.js.map +1 -0
  473. package/dist/esm/loadBalancerStrategies/greedyStrategy.d.ts +24 -0
  474. package/dist/esm/loadBalancerStrategies/greedyStrategy.d.ts.map +1 -0
  475. package/dist/esm/loadBalancerStrategies/greedyStrategy.js +28 -0
  476. package/dist/esm/loadBalancerStrategies/greedyStrategy.js.map +1 -0
  477. package/dist/esm/loadBalancerStrategies/loadBalancingStrategy.d.ts +28 -0
  478. package/dist/esm/loadBalancerStrategies/loadBalancingStrategy.d.ts.map +1 -0
  479. package/dist/esm/loadBalancerStrategies/loadBalancingStrategy.js +245 -0
  480. package/dist/esm/loadBalancerStrategies/loadBalancingStrategy.js.map +1 -0
  481. package/dist/esm/loadBalancerStrategies/unbalancedStrategy.d.ts +20 -0
  482. package/dist/esm/loadBalancerStrategies/unbalancedStrategy.d.ts.map +1 -0
  483. package/dist/esm/loadBalancerStrategies/unbalancedStrategy.js +22 -0
  484. package/dist/esm/loadBalancerStrategies/unbalancedStrategy.js.map +1 -0
  485. package/dist/esm/logger.d.ts +37 -0
  486. package/dist/esm/logger.d.ts.map +1 -0
  487. package/dist/esm/logger.js +56 -0
  488. package/dist/esm/logger.js.map +1 -0
  489. package/dist/esm/managementClient.d.ts +145 -0
  490. package/dist/esm/managementClient.d.ts.map +1 -0
  491. package/dist/esm/managementClient.js +271 -0
  492. package/dist/esm/managementClient.js.map +1 -0
  493. package/dist/esm/models/private.d.ts +185 -0
  494. package/dist/esm/models/private.d.ts.map +1 -0
  495. package/dist/esm/models/private.js +4 -0
  496. package/dist/esm/models/private.js.map +1 -0
  497. package/dist/esm/models/public.d.ts +240 -0
  498. package/dist/esm/models/public.d.ts.map +1 -0
  499. package/dist/esm/models/public.js +18 -0
  500. package/dist/esm/models/public.js.map +1 -0
  501. package/dist/esm/package.json +3 -0
  502. package/dist/esm/partitionProcessor.d.ts +134 -0
  503. package/dist/esm/partitionProcessor.d.ts.map +1 -0
  504. package/dist/esm/partitionProcessor.js +134 -0
  505. package/dist/esm/partitionProcessor.js.map +1 -0
  506. package/dist/esm/partitionPump.d.ts +38 -0
  507. package/dist/esm/partitionPump.d.ts.map +1 -0
  508. package/dist/esm/partitionPump.js +166 -0
  509. package/dist/esm/partitionPump.js.map +1 -0
  510. package/dist/esm/partitionReceiver.d.ts +82 -0
  511. package/dist/esm/partitionReceiver.d.ts.map +1 -0
  512. package/dist/esm/partitionReceiver.js +330 -0
  513. package/dist/esm/partitionReceiver.js.map +1 -0
  514. package/dist/esm/pumpManager.d.ts +72 -0
  515. package/dist/esm/pumpManager.d.ts.map +1 -0
  516. package/dist/esm/pumpManager.js +118 -0
  517. package/dist/esm/pumpManager.js.map +1 -0
  518. package/dist/esm/util/connectionStringUtils.d.ts +52 -0
  519. package/dist/esm/util/connectionStringUtils.d.ts.map +1 -0
  520. package/dist/esm/util/connectionStringUtils.js +48 -0
  521. package/dist/esm/util/connectionStringUtils.js.map +1 -0
  522. package/dist/esm/util/constants.d.ts +25 -0
  523. package/dist/esm/util/constants.d.ts.map +1 -0
  524. package/dist/esm/util/constants.js +27 -0
  525. package/dist/esm/util/constants.js.map +1 -0
  526. package/dist/esm/util/delayWithoutThrow.d.ts +8 -0
  527. package/dist/esm/util/delayWithoutThrow.d.ts.map +1 -0
  528. package/dist/esm/util/delayWithoutThrow.js +17 -0
  529. package/dist/esm/util/delayWithoutThrow.js.map +1 -0
  530. package/dist/esm/util/error.d.ts +39 -0
  531. package/dist/esm/util/error.d.ts.map +1 -0
  532. package/dist/esm/util/error.js +103 -0
  533. package/dist/esm/util/error.js.map +1 -0
  534. package/dist/esm/util/getPromiseParts.d.ts +10 -0
  535. package/dist/esm/util/getPromiseParts.d.ts.map +1 -0
  536. package/dist/esm/util/getPromiseParts.js +20 -0
  537. package/dist/esm/util/getPromiseParts.js.map +1 -0
  538. package/dist/esm/util/operationOptions.d.ts +16 -0
  539. package/dist/esm/util/operationOptions.d.ts.map +1 -0
  540. package/dist/esm/util/operationOptions.js +4 -0
  541. package/dist/esm/util/operationOptions.js.map +1 -0
  542. package/dist/esm/util/parseEndpoint.d.ts +11 -0
  543. package/dist/esm/util/parseEndpoint.d.ts.map +1 -0
  544. package/dist/esm/util/parseEndpoint.js +17 -0
  545. package/dist/esm/util/parseEndpoint.js.map +1 -0
  546. package/dist/esm/util/retries.d.ts +6 -0
  547. package/dist/esm/util/retries.d.ts.map +1 -0
  548. package/dist/esm/util/retries.js +13 -0
  549. package/dist/esm/util/retries.js.map +1 -0
  550. package/dist/esm/util/runtimeInfo.d.ts +6 -0
  551. package/dist/esm/util/runtimeInfo.d.ts.map +1 -0
  552. package/{dist-esm/src → dist/esm}/util/runtimeInfo.js +1 -1
  553. package/{dist-esm/src → dist/esm}/util/runtimeInfo.js.map +1 -1
  554. package/dist/esm/util/timerLoop.d.ts +26 -0
  555. package/dist/esm/util/timerLoop.d.ts.map +1 -0
  556. package/dist/esm/util/timerLoop.js +27 -0
  557. package/dist/esm/util/timerLoop.js.map +1 -0
  558. package/dist/esm/util/typeGuards.d.ts +8 -0
  559. package/dist/esm/util/typeGuards.d.ts.map +1 -0
  560. package/dist/esm/util/typeGuards.js +12 -0
  561. package/dist/esm/util/typeGuards.js.map +1 -0
  562. package/dist/esm/util/utils.d.ts +7 -0
  563. package/dist/esm/util/utils.d.ts.map +1 -0
  564. package/dist/esm/util/utils.js +13 -0
  565. package/dist/esm/util/utils.js.map +1 -0
  566. package/dist/esm/withAuth.d.ts +25 -0
  567. package/dist/esm/withAuth.d.ts.map +1 -0
  568. package/dist/esm/withAuth.js +84 -0
  569. package/dist/esm/withAuth.js.map +1 -0
  570. package/package.json +85 -80
  571. package/dist/index.js +0 -5372
  572. package/dist/index.js.map +0 -1
  573. package/dist-esm/src/batchingPartitionChannel.js.map +0 -1
  574. package/dist-esm/src/connectionContext.js.map +0 -1
  575. package/dist-esm/src/dataTransformer.js.map +0 -1
  576. package/dist-esm/src/diagnostics/instrumentEventData.js.map +0 -1
  577. package/dist-esm/src/diagnostics/tracing.js.map +0 -1
  578. package/dist-esm/src/eventData.js.map +0 -1
  579. package/dist-esm/src/eventDataAdapter.js.map +0 -1
  580. package/dist-esm/src/eventDataBatch.js.map +0 -1
  581. package/dist-esm/src/eventHubBufferedProducerClient.js.map +0 -1
  582. package/dist-esm/src/eventHubConsumerClient.js.map +0 -1
  583. package/dist-esm/src/eventHubConsumerClientModels.js +0 -4
  584. package/dist-esm/src/eventHubConsumerClientModels.js.map +0 -1
  585. package/dist-esm/src/eventHubProducerClient.js.map +0 -1
  586. package/dist-esm/src/eventHubSender.js.map +0 -1
  587. package/dist-esm/src/eventPosition.js.map +0 -1
  588. package/dist-esm/src/eventProcessor.js.map +0 -1
  589. package/dist-esm/src/eventhubConnectionConfig.js.map +0 -1
  590. package/dist-esm/src/impl/awaitableQueue.js.map +0 -1
  591. package/dist-esm/src/impl/partitionAssigner.js.map +0 -1
  592. package/dist-esm/src/inMemoryCheckpointStore.js.map +0 -1
  593. package/dist-esm/src/index.js.map +0 -1
  594. package/dist-esm/src/loadBalancerStrategies/balancedStrategy.js.map +0 -1
  595. package/dist-esm/src/loadBalancerStrategies/greedyStrategy.js.map +0 -1
  596. package/dist-esm/src/loadBalancerStrategies/loadBalancingStrategy.js.map +0 -1
  597. package/dist-esm/src/loadBalancerStrategies/unbalancedStrategy.js.map +0 -1
  598. package/dist-esm/src/logger.js.map +0 -1
  599. package/dist-esm/src/managementClient.js.map +0 -1
  600. package/dist-esm/src/models/private.js +0 -4
  601. package/dist-esm/src/models/private.js.map +0 -1
  602. package/dist-esm/src/models/public.js.map +0 -1
  603. package/dist-esm/src/partitionProcessor.js.map +0 -1
  604. package/dist-esm/src/partitionPump.js.map +0 -1
  605. package/dist-esm/src/partitionReceiver.js.map +0 -1
  606. package/dist-esm/src/pumpManager.js.map +0 -1
  607. package/dist-esm/src/util/constants.js.map +0 -1
  608. package/dist-esm/src/util/delayWithoutThrow.js.map +0 -1
  609. package/dist-esm/src/util/error.js.map +0 -1
  610. package/dist-esm/src/util/operationOptions.js +0 -4
  611. package/dist-esm/src/util/operationOptions.js.map +0 -1
  612. package/dist-esm/src/util/retries.js.map +0 -1
  613. package/dist-esm/src/util/runtimeInfo.browser.js.map +0 -1
  614. package/dist-esm/src/util/typeGuards.js.map +0 -1
  615. package/dist-esm/src/withAuth.js.map +0 -1
  616. package/types/latest/event-hubs.d.ts +0 -1877
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eventHubConsumerClientModels.js","sourceRoot":"","sources":["../../src/eventHubConsumerClientModels.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { CloseReason } from \"./models/public.js\";\nimport type { EventPosition } from \"./eventPosition.js\";\nimport type { LastEnqueuedEventProperties } from \"./partitionReceiver.js\";\nimport type { MessagingError } from \"@azure/core-amqp\";\nimport type { OperationTracingOptions } from \"@azure/core-tracing\";\nimport type { ReceivedEventData } from \"./eventData.js\";\n\n/**\n * @internal\n */\nexport interface BasicPartitionProperties {\n /**\n * The fully qualified Event Hubs namespace. This is likely to be similar to\n * <yournamespace>.servicebus.windows.net\n */\n fullyQualifiedNamespace: string;\n /**\n * The event hub name.\n */\n eventHubName: string;\n /**\n * The consumer group name.\n */\n consumerGroup: string;\n /**\n * The identifier of the Event Hub partition.\n */\n partitionId: string;\n}\n\n/**\n * Interface that describes the context passed to each of the functions that are a part\n * of the `SubscriptionEventHandlers`. When implementing any of these functions, use\n * the context object to get information about the partition as well as the\n * ability to checkpoint.\n */\nexport interface PartitionContext {\n /**\n * The fully qualified Event Hubs namespace. This is likely to be similar to\n * <yournamespace>.servicebus.windows.net\n */\n readonly fullyQualifiedNamespace: string;\n /**\n * The event hub name.\n */\n readonly eventHubName: string;\n /**\n * The consumer group name.\n */\n readonly consumerGroup: string;\n /**\n * The identifier of the Event Hub partition.\n */\n readonly partitionId: string;\n /**\n * Information on the last enqueued event in the partition that is being processed.\n * This property is only updated if the `trackLastEnqueuedEventProperties` option is set to true\n * when creating an instance of EventProcessor.\n * @readonly\n */\n readonly lastEnqueuedEventProperties?: LastEnqueuedEventProperties;\n /**\n * Updates the checkpoint using the event data.\n *\n * A checkpoint is meant to represent the last successfully processed event by the user from a particular\n * partition of a consumer group in an Event Hub instance.\n *\n * @param eventData - The event that you want to update the checkpoint with.\n */\n updateCheckpoint(eventData: ReceivedEventData): Promise<void>;\n}\n\n/**\n * Signature of the user provided function invoked by `EventHubConsumerClient` when a set of events is received.\n */\nexport type ProcessEventsHandler = (\n events: ReceivedEventData[],\n context: PartitionContext,\n) => Promise<void>;\n\n/**\n * Signature of the user provided function invoked by `EventHubConsumerClient` for errors that occur when\n * receiving events or when executing any of the user provided functions passed to the `subscribe()` method.\n */\nexport type ProcessErrorHandler = (\n error: Error | MessagingError,\n context: PartitionContext,\n) => Promise<void>;\n\n/**\n * Signature of the user provided function invoked by `EventHubConsumerClient` just before starting to receive\n * events from a partition.\n */\nexport type ProcessInitializeHandler = (context: PartitionContext) => Promise<void>;\n\n/**\n * Signature of the user provided function invoked by `EventHubConsumerClient` just after stopping to receive\n * events from a partition.\n */\nexport type ProcessCloseHandler = (reason: CloseReason, context: PartitionContext) => Promise<void>;\n\n/**\n * Interface that describes the functions to be implemented by the user which are invoked by\n * the `EventHubConsumerClient` when the `subscribe()` method is called to receive events\n * from Event Hub.\n */\nexport interface SubscriptionEventHandlers {\n /**\n * The function invoked by `EventHubConsumerClient` when a set of events is received. The\n * `PartitionContext` passed to this function can be used to determine which partition is being read from.\n *\n * The `updateCheckpoint()` method on the context can be used to update checkpoints in the `CheckpointStore`\n * (if one was provided to the client). Use this in frequent intervals to mark events that have been processed\n * so that the client can restart from such checkpoints in the event of a restart or error recovery.\n *\n * Note: It is possible for received events to be an empty array.\n * This can happen if there are no new events to receive\n * in the `maxWaitTimeInSeconds`, which is defaulted to 60 seconds.\n * The `maxWaitTimeInSeconds` can be changed by setting\n * it in the `options` passed to `subscribe()`.\n */\n processEvents: ProcessEventsHandler;\n /**\n * The function invoked by `EventHubConsumerClient` for errors that occur when receiving events\n * or when executing any of the user provided functions passed to the `subscribe()` method.\n *\n * The `PartitionContext` passed to this function will indicate the partition that was being processed\n * when the error was thrown. In cases where an error is thrown outside of processing events from a\n * partition(e.g. failure to perform load balancing), the `partitionId` on the context will be an empty string.\n *\n * After the client completes executing this function, the `partitionClose` function is invoked.\n */\n processError: ProcessErrorHandler;\n /**\n * The function invoked by `EventHubConsumerClient` each time the subscription is about to begin\n * reading from a partition. The `PartitionContext` passed to this function can be used to determine\n * which partition is about to be read from.\n *\n * The client will start receiving events for the partition only after completing the execution of\n * this function (if provided). Therefore, use this function to carry out any setup work including\n * async tasks.\n */\n processInitialize?: ProcessInitializeHandler;\n /**\n * The function invoked by `EventHubConsumerClient` each time the subscription stops reading events from\n * a partition. The information on this partition will be available on the `PartitionContext` passed to the\n * function `processClose`.\n *\n * If the `CloseReason` passed to this function is `OwnershipLost`, then another subscription has taken over\n * reading from the same partition using the same consumer group. This is expected if you have multiple\n * instances of your application running and have passed the `CheckpointStore` to the client to load balance.\n *\n * If the `CloseReason` is `Shutdown`, this indicates that either `subscription.close()` was called, or an\n * error occured. Unless the subscription was explicitly closed via `subscription.close()`, the subscription\n * will attempt to resume reading events from the last checkpoint for the partition.\n */\n processClose?: ProcessCloseHandler;\n}\n\n/**\n * Options to configure the `subscribe` method on the `EventHubConsumerClient`.\n * For example, `{ maxBatchSize: 20, maxWaitTimeInSeconds: 120, startPosition: { sequenceNumber: 123 } }`\n */\nexport interface SubscribeOptions {\n /**\n * The number of events to request per batch\n */\n maxBatchSize?: number;\n /**\n * The maximum amount of time to wait to build up the requested message count before\n * passing the data to user code for processing. If not provided, it defaults to 60 seconds.\n */\n maxWaitTimeInSeconds?: number;\n /**\n * The event position in a partition to start receiving events from if no checkpoint is found.\n * Pass a map of partition id to position if you would like to use different starting\n * position for each partition.\n */\n startPosition?: EventPosition | { [partitionId: string]: EventPosition };\n /**\n * Indicates whether or not the consumer should request information on the last enqueued event on its\n * associated partition, and track that information as events are received.\n\n * When information about the partition's last enqueued event is being tracked, each event received\n * from the Event Hubs service will carry metadata about the partition that it otherwise would not. This results in a small amount of\n * additional network bandwidth consumption that is generally a favorable trade-off when considered\n * against periodically making requests for partition properties using the Event Hub client.\n */\n trackLastEnqueuedEventProperties?: boolean;\n /**\n * The owner level to use as this subscription subscribes to partitions.\n */\n ownerLevel?: number;\n /**\n * Options for configuring tracing.\n */\n tracingOptions?: OperationTracingOptions;\n /**\n * Option to disable the client from running JSON.parse() on the message body when receiving the message.\n * Not applicable if the message was sent with AMQP body type value or sequence. Use this option when you\n * prefer to work directly with the bytes present in the message body than have the client attempt to parse it.\n */\n skipParsingBodyAsJson?: boolean;\n /**\n * The count of events requested eagerly and queued without regard to whether a read was requested.\n */\n prefetchCount?: number;\n}\n\n/**\n * Interface that describes the object returned by the `subscribe()` method on the `EventHubConsumerClient`.\n */\nexport interface Subscription {\n /**\n * Stops the subscription from receiving more messages.\n *\n * If a checkpoint store has been configured this will also mark this subscription's\n * partitions as abandoned, freeing them up to be read by other consumers.\n *\n * @returns Promise<void>\n * @throws Error if the underlying connection encounters an error while closing.\n */\n close(): Promise<void>;\n /**\n * Indicates whether the receiver is running.\n * `true` - is running; `false` otherwise.\n * @readonly\n */\n isRunning: boolean;\n}\n"]}
@@ -0,0 +1,266 @@
1
+ import type { CreateBatchOptions, EventHubClientOptions, GetEventHubPropertiesOptions, GetPartitionIdsOptions, GetPartitionPropertiesOptions, SendBatchOptions } from "./models/public.js";
2
+ import type { EventDataBatch } from "./eventDataBatch.js";
3
+ import type { EventHubProperties, PartitionProperties } from "./managementClient.js";
4
+ import type { NamedKeyCredential, SASCredential, TokenCredential } from "@azure/core-auth";
5
+ import type { AmqpAnnotatedMessage } from "@azure/core-amqp";
6
+ import type { EventData } from "./eventData.js";
7
+ import type { OperationOptions } from "./util/operationOptions.js";
8
+ /**
9
+ * The `EventHubProducerClient` class is used to send events to an Event Hub.
10
+ *
11
+ * There are multiple ways to create an `EventHubProducerClient`
12
+ * - Use the connection string from the SAS policy created for your Event Hub instance.
13
+ * - Use the connection string from the SAS policy created for your Event Hub namespace,
14
+ * and the name of the Event Hub instance
15
+ * - Use the full namespace like `<yournamespace>.servicebus.windows.net`, and a credentials object.
16
+ *
17
+ * Optionally, you can also pass an options bag to configure the retry policy or proxy settings.
18
+ *
19
+ */
20
+ export declare class EventHubProducerClient {
21
+ /**
22
+ * Describes the amqp connection context for the client.
23
+ */
24
+ private _context;
25
+ /**
26
+ * The options passed by the user when creating the EventHubClient instance.
27
+ */
28
+ private _clientOptions;
29
+ /**
30
+ * Map of partitionId to senders
31
+ */
32
+ private _sendersMap;
33
+ /**
34
+ * Indicates whether or not the EventHubProducerClient should enable idempotent publishing to Event Hub partitions.
35
+ * If enabled, the producer will only be able to publish directly to partitions;
36
+ * it will not be able to publish to the Event Hubs gateway for automatic partition routing
37
+ * nor will it be able to use a partition key.
38
+ * Default: false
39
+ */
40
+ private _enableIdempotentRetries?;
41
+ /**
42
+ * The set of options that can be specified to influence publishing behavior specific to the configured Event Hub partition.
43
+ * These options are not necessary in the majority of scenarios and are intended for use with specialized scenarios,
44
+ * such as when recovering the state used for idempotent publishing.
45
+ */
46
+ private _partitionOptions?;
47
+ /**
48
+ * @readonly
49
+ * The name of the Event Hub instance for which this client is created.
50
+ */
51
+ get eventHubName(): string;
52
+ /**
53
+ * @readonly
54
+ * The fully qualified namespace of the Event Hub instance for which this client is created.
55
+ * This is likely to be similar to <yournamespace>.servicebus.windows.net.
56
+ */
57
+ get fullyQualifiedNamespace(): string;
58
+ /**
59
+ * The name used to identify this EventHubProducerClient.
60
+ * If not specified or empty, a random unique one will be generated.
61
+ */
62
+ readonly identifier: string;
63
+ /**
64
+ * The `EventHubProducerClient` class is used to send events to an Event Hub.
65
+ * Use the `options` parmeter to configure retry policy or proxy settings.
66
+ * @param connectionString - The connection string to use for connecting to the Event Hub instance.
67
+ * It is expected that the shared key properties and the Event Hub path are contained in this connection string.
68
+ * e.g. 'Endpoint=sb://my-servicebus-namespace.servicebus.windows.net/;SharedAccessKeyName=my-SA-name;SharedAccessKey=my-SA-key;EntityPath=my-event-hub-name'.
69
+ * @param options - A set of options to apply when configuring the client.
70
+ * - `retryOptions` : Configures the retry policy for all the operations on the client.
71
+ * For example, `{ "maxRetries": 4 }` or `{ "maxRetries": 4, "retryDelayInMs": 30000 }`.
72
+ * - `webSocketOptions`: Configures the channelling of the AMQP connection over Web Sockets.
73
+ * - `userAgent` : A string to append to the built in user agent string that is passed to the service.
74
+ */
75
+ constructor(connectionString: string, options?: EventHubClientOptions);
76
+ /**
77
+ * The `EventHubProducerClient` class is used to send events to an Event Hub.
78
+ * Use the `options` parmeter to configure retry policy or proxy settings.
79
+ * @param connectionString - The connection string to use for connecting to the Event Hubs namespace.
80
+ * It is expected that the shared key properties are contained in this connection string, but not the Event Hub path,
81
+ * e.g. 'Endpoint=sb://my-servicebus-namespace.servicebus.windows.net/;SharedAccessKeyName=my-SA-name;SharedAccessKey=my-SA-key;'.
82
+ * @param eventHubName - The name of the specific Event Hub to connect the client to.
83
+ * @param options - A set of options to apply when configuring the client.
84
+ * - `retryOptions` : Configures the retry policy for all the operations on the client.
85
+ * For example, `{ "maxRetries": 4 }` or `{ "maxRetries": 4, "retryDelayInMs": 30000 }`.
86
+ * - `webSocketOptions`: Configures the channelling of the AMQP connection over Web Sockets.
87
+ * - `userAgent` : A string to append to the built in user agent string that is passed to the service.
88
+ */
89
+ constructor(connectionString: string, eventHubName: string, options?: EventHubClientOptions);
90
+ /**
91
+ * The `EventHubProducerClient` class is used to send events to an Event Hub.
92
+ * Use the `options` parmeter to configure retry policy or proxy settings.
93
+ * @param fullyQualifiedNamespace - The full namespace which is likely to be similar to
94
+ * <yournamespace>.servicebus.windows.net
95
+ * @param eventHubName - The name of the specific Event Hub to connect the client to.
96
+ * @param credential - An credential object used by the client to get the token to authenticate the connection
97
+ * with the Azure Event Hubs service.
98
+ * See &commat;azure/identity for creating credentials that support AAD auth.
99
+ * Use the `AzureNamedKeyCredential` from &commat;azure/core-auth if you want to pass in a `SharedAccessKeyName`
100
+ * and `SharedAccessKey` without using a connection string. These fields map to the `name` and `key` field respectively
101
+ * in `AzureNamedKeyCredential`.
102
+ * Use the `AzureSASCredential` from &commat;azure/core-auth if you want to pass in a `SharedAccessSignature`
103
+ * without using a connection string. This field maps to `signature` in `AzureSASCredential`.
104
+ * @param options - A set of options to apply when configuring the client.
105
+ * - `retryOptions` : Configures the retry policy for all the operations on the client.
106
+ * For example, `{ "maxRetries": 4 }` or `{ "maxRetries": 4, "retryDelayInMs": 30000 }`.
107
+ * - `webSocketOptions`: Configures the channelling of the AMQP connection over Web Sockets.
108
+ * - `userAgent` : A string to append to the built in user agent string that is passed to the service.
109
+ */
110
+ constructor(fullyQualifiedNamespace: string, eventHubName: string, credential: TokenCredential | NamedKeyCredential | SASCredential, options?: EventHubClientOptions);
111
+ /**
112
+ * Creates an instance of `EventDataBatch` to which one can add events until the maximum supported size is reached.
113
+ * The batch can be passed to the {@link sendBatch} method of the `EventHubProducerClient` to be sent to Azure Event Hubs.
114
+ *
115
+ * Events with different values for partitionKey or partitionId will need to be put into different batches.
116
+ * To simplify such batch management across partitions or to have the client automatically batch events
117
+ * and send them in specific intervals, use `EventHubBufferedProducerClient` instead.
118
+ *
119
+ * The below example assumes you have an array of events at hand to be batched safely.
120
+ * If you have events coming in one by one, `EventHubBufferedProducerClient` is recommended instead
121
+ * for effecient management of batches.
122
+ *
123
+ * Example usage:
124
+ * ```ts
125
+ * const client = new EventHubProducerClient(connectionString);
126
+ * let batch = await client.createBatch();
127
+ * for (let i = 0; i < messages.length; i++) {
128
+ * if (!batch.tryAdd(messages[i])) {
129
+ * await client.sendBatch(batch);
130
+ * batch = await client.createBatch();
131
+ * if (!batch.tryAdd(messages[i])) {
132
+ * throw new Error("Message too big to fit")
133
+ * }
134
+ * if (i === messages.length - 1) {
135
+ * await client.sendBatch(batch);
136
+ * }
137
+ * }
138
+ * }
139
+ * ```
140
+ *
141
+ * @param options - Configures the behavior of the batch.
142
+ * - `partitionKey` : A value that is hashed and used by the Azure Event Hubs service to determine the partition to which
143
+ * the events need to be sent.
144
+ * - `partitionId` : Id of the partition to which the batch of events need to be sent.
145
+ * - `maxSizeInBytes`: The upper limit for the size of batch. The `tryAdd` function will return `false` after this limit is reached.
146
+ * - `abortSignal` : A signal the request to cancel the operation.
147
+ * @returns Promise<EventDataBatch>
148
+ * @throws Error if both `partitionId` and `partitionKey` are set in the options.
149
+ * @throws Error if the underlying connection has been closed, create a new EventHubProducerClient.
150
+ * @throws AbortError if the operation is cancelled via the abortSignal in the options.
151
+ */
152
+ createBatch(options?: CreateBatchOptions): Promise<EventDataBatch>;
153
+ /**
154
+ * Get the information about the state of publishing for a partition as observed by the `EventHubProducerClient`.
155
+ * This data can always be read, but will only be populated with information relevant to the active features
156
+ * for the producer client.
157
+ *
158
+ * @param partitionId - Id of the partition from which to retrieve publishing properties.
159
+ * @param options - The set of options to apply to the operation call.
160
+ * - `abortSignal` : A signal the request to cancel the send operation.
161
+ * @returns Promise<void>
162
+ * @throws AbortError if the operation is cancelled via the abortSignal.
163
+ */
164
+ private getPartitionPublishingProperties;
165
+ /**
166
+ * Sends an array of events as a batch to the associated Event Hub.
167
+ *
168
+ * Azure Event Hubs has a limit on the size of the batch that can be sent which if exceeded
169
+ * will result in an error with code `MessageTooLargeError`.
170
+ * To safely send within batch size limits, use `EventHubProducerClient.createBatch()` or
171
+ * `EventHubBufferedProducerClient` instead.
172
+ *
173
+ * Example usage:
174
+ * ```ts
175
+ * const client = new EventHubProducerClient(connectionString);
176
+ * await client.sendBatch(messages);
177
+ * ```
178
+ *
179
+ * @param batch - An array of {@link EventData} or `AmqpAnnotatedMessage`.
180
+ * @param options - A set of options that can be specified to influence the way in which
181
+ * events are sent to the associated Event Hub.
182
+ * - `abortSignal` : A signal the request to cancel the send operation.
183
+ * - `partitionId` : The partition this batch will be sent to. If set, `partitionKey` can not be set.
184
+ * - `partitionKey` : A value that is hashed to produce a partition assignment. If set, `partitionId` can not be set.
185
+ *
186
+ * @returns Promise<void>
187
+ * @throws MessageTooLargeError if all the events in the input array cannot be fit into a batch.
188
+ * @throws AbortError if the operation is cancelled via the abortSignal.
189
+ * @throws MessagingError if an error is encountered while sending a message.
190
+ * @throws Error if the underlying connection or sender has been closed.
191
+ */
192
+ sendBatch(batch: EventData[] | AmqpAnnotatedMessage[], options?: SendBatchOptions): Promise<void>;
193
+ /**
194
+ * Sends a batch of events created using `EventHubProducerClient.createBatch()` to the associated Event Hub.
195
+ *
196
+ * Events with different values for partitionKey or partitionId will need to be put into different batches.
197
+ * To simplify such batch management across partitions or to have the client automatically batch events
198
+ * and send them in specific intervals, use `EventHubBufferedProducerClient` instead.
199
+ *
200
+ * The below example assumes you have an array of events at hand to be batched safely.
201
+ * If you have events coming in one by one, `EventHubBufferedProducerClient` is recommended instead
202
+ * for effecient management of batches.
203
+ *
204
+ * Example usage:
205
+ * ```ts
206
+ * const client = new EventHubProducerClient(connectionString);
207
+ * let batch = await client.createBatch();
208
+ * for (let i = 0; i < messages.length; i++) {
209
+ * if (!batch.tryAdd(messages[i])) {
210
+ * await client.sendBatch(batch);
211
+ * batch = await client.createBatch();
212
+ * if (!batch.tryAdd(messages[i])) {
213
+ * throw new Error("Message too big to fit")
214
+ * }
215
+ * if (i === messages.length - 1) {
216
+ * await client.sendBatch(batch);
217
+ * }
218
+ * }
219
+ * }
220
+ * ```
221
+ * @param batch - A batch of events that you can create using the {@link createBatch} method.
222
+ * @param options - A set of options that can be specified to influence the way in which
223
+ * events are sent to the associated Event Hub.
224
+ * - `abortSignal` : A signal the request to cancel the send operation.
225
+ *
226
+ * @returns Promise<void>
227
+ * @throws AbortError if the operation is cancelled via the abortSignal.
228
+ * @throws MessagingError if an error is encountered while sending a message.
229
+ * @throws Error if the underlying connection or sender has been closed.
230
+ */
231
+ sendBatch(batch: EventDataBatch, options?: OperationOptions): Promise<void>;
232
+ /**
233
+ * Closes the AMQP connection to the Event Hub instance,
234
+ * returning a promise that will be resolved when disconnection is completed.
235
+ * @returns Promise<void>
236
+ * @throws Error if the underlying connection encounters an error while closing.
237
+ */
238
+ close(): Promise<void>;
239
+ /**
240
+ * Provides the Event Hub runtime information.
241
+ * @param options - The set of options to apply to the operation call.
242
+ * @returns A promise that resolves with information about the Event Hub instance.
243
+ * @throws Error if the underlying connection has been closed, create a new EventHubProducerClient.
244
+ * @throws AbortError if the operation is cancelled via the abortSignal.
245
+ */
246
+ getEventHubProperties(options?: GetEventHubPropertiesOptions): Promise<EventHubProperties>;
247
+ /**
248
+ * Provides the id for each partition associated with the Event Hub.
249
+ * @param options - The set of options to apply to the operation call.
250
+ * @returns A promise that resolves with an Array of strings representing the id for
251
+ * each partition associated with the Event Hub.
252
+ * @throws Error if the underlying connection has been closed, create a new EventHubProducerClient.
253
+ * @throws AbortError if the operation is cancelled via the abortSignal.
254
+ */
255
+ getPartitionIds(options?: GetPartitionIdsOptions): Promise<Array<string>>;
256
+ /**
257
+ * Provides information about the state of the specified partition.
258
+ * @param partitionId - The id of the partition for which information is required.
259
+ * @param options - The set of options to apply to the operation call.
260
+ * @returns A promise that resolves with information about the state of the partition .
261
+ * @throws Error if the underlying connection has been closed, create a new EventHubProducerClient.
262
+ * @throws AbortError if the operation is cancelled via the abortSignal.
263
+ */
264
+ getPartitionProperties(partitionId: string, options?: GetPartitionPropertiesOptions): Promise<PartitionProperties>;
265
+ }
266
+ //# sourceMappingURL=eventHubProducerClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eventHubProducerClient.d.ts","sourceRoot":"","sources":["../../src/eventHubProducerClient.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,kBAAkB,EAClB,qBAAqB,EACrB,4BAA4B,EAC5B,sBAAsB,EACtB,6BAA6B,EAC7B,gBAAgB,EACjB,MAAM,oBAAoB,CAAC;AAK5B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAErF,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAW3F,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAqB,MAAM,gBAAgB,CAAC;AAGnE,OAAO,KAAK,EAAE,gBAAgB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G,SAAS,CAAC,KAAK,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IA8FjF;;;;;OAKG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAS5B;;;;;;OAMG;IACH,qBAAqB,CAAC,OAAO,GAAE,4BAAiC,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAO9F;;;;;;;OAOG;IACH,eAAe,CAAC,OAAO,GAAE,sBAA2B,GAAG,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAW7E;;;;;;;OAOG;IACH,sBAAsB,CACpB,WAAW,EAAE,MAAM,EACnB,OAAO,GAAE,6BAAkC,GAC1C,OAAO,CAAC,mBAAmB,CAAC;CAMhC"}
@@ -1,15 +1,16 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- import { createConnectionContext } from "./connectionContext";
4
- import { EventDataBatchImpl, isEventDataBatch } from "./eventDataBatch";
2
+ // Licensed under the MIT License.
3
+ import { createConnectionContext } from "./connectionContext.js";
4
+ import { EventDataBatchImpl, isEventDataBatch } from "./eventDataBatch.js";
5
5
  import { isDefined } from "@azure/core-util";
6
- import { isCredential } from "./util/typeGuards";
7
- import { logErrorStackTrace, logger } from "./logger";
8
- import { idempotentAlreadyPublished, idempotentSomeAlreadyPublished, throwErrorIfConnectionClosed, throwTypeErrorIfParameterMissing, validateProducerPartitionSettings, } from "./util/error";
9
- import { EventHubSender } from "./eventHubSender";
10
- import { toSpanOptions, tracingClient } from "./diagnostics/tracing";
11
- import { instrumentEventData } from "./diagnostics/instrumentEventData";
12
- import { getRandomName } from "./util/utils";
6
+ import { isCredential } from "./util/typeGuards.js";
7
+ import { logErrorStackTrace, logger } from "./logger.js";
8
+ import { idempotentAlreadyPublished, idempotentSomeAlreadyPublished, throwErrorIfConnectionClosed, throwTypeErrorIfParameterMissing, validateProducerPartitionSettings, } from "./util/error.js";
9
+ import { assertIsEventData } from "./eventData.js";
10
+ import { EventHubSender } from "./eventHubSender.js";
11
+ import { toSpanOptions, tracingClient } from "./diagnostics/tracing.js";
12
+ import { instrumentEventData } from "./diagnostics/instrumentEventData.js";
13
+ import { getRandomName } from "./util/utils.js";
13
14
  /**
14
15
  * The `EventHubProducerClient` class is used to send events to an Event Hub.
15
16
  *
@@ -188,6 +189,7 @@ export class EventHubProducerClient {
188
189
  if (!Array.isArray(batch)) {
189
190
  batch = [batch];
190
191
  }
192
+ batch.forEach(assertIsEventData);
191
193
  if (batch.some((event) => isDefined(event._publishedSequenceNumber))) {
192
194
  throw new Error(idempotentSomeAlreadyPublished);
193
195
  }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eventHubProducerClient.js","sourceRoot":"","sources":["../../src/eventHubProducerClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAcjE,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAI3E,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EACL,0BAA0B,EAC1B,8BAA8B,EAC9B,4BAA4B,EAC5B,gCAAgC,EAChC,iCAAiC,GAClC,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;;;;;;;;;;GAWG;AAC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AG,MAAM,CAAC,WAAW,CAAC,CAAC;IAC3C,CAAC;IACD,IAAI,SAAS,CAAC,YAAY,CAAC,EAAE,CAAC;QAC5B,MAAM,CAAC,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC;IAC7C,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { ConnectionContext } from \"./connectionContext.js\";\nimport { createConnectionContext } from \"./connectionContext.js\";\nimport type {\n CreateBatchOptions,\n EventHubClientOptions,\n GetEventHubPropertiesOptions,\n GetPartitionIdsOptions,\n GetPartitionPropertiesOptions,\n SendBatchOptions,\n} from \"./models/public.js\";\nimport type {\n PartitionPublishingOptions,\n PartitionPublishingProperties,\n} from \"./models/private.js\";\nimport type { EventDataBatch } from \"./eventDataBatch.js\";\nimport { EventDataBatchImpl, isEventDataBatch } from \"./eventDataBatch.js\";\nimport type { EventHubProperties, PartitionProperties } from \"./managementClient.js\";\nimport type { TracingContext, TracingSpanLink } from \"@azure/core-tracing\";\nimport type { NamedKeyCredential, SASCredential, TokenCredential } from \"@azure/core-auth\";\nimport { isDefined } from \"@azure/core-util\";\nimport { isCredential } from \"./util/typeGuards.js\";\nimport { logErrorStackTrace, logger } from \"./logger.js\";\nimport {\n idempotentAlreadyPublished,\n idempotentSomeAlreadyPublished,\n throwErrorIfConnectionClosed,\n throwTypeErrorIfParameterMissing,\n validateProducerPartitionSettings,\n} from \"./util/error.js\";\nimport type { AmqpAnnotatedMessage } from \"@azure/core-amqp\";\nimport type { EventData, EventDataInternal } from \"./eventData.js\";\nimport { assertIsEventData } from \"./eventData.js\";\nimport { EventHubSender } from \"./eventHubSender.js\";\nimport type { OperationOptions } from \"./util/operationOptions.js\";\nimport { toSpanOptions, tracingClient } from \"./diagnostics/tracing.js\";\nimport { instrumentEventData } from \"./diagnostics/instrumentEventData.js\";\nimport { getRandomName } from \"./util/utils.js\";\n\n/**\n * The `EventHubProducerClient` class is used to send events to an Event Hub.\n *\n * There are multiple ways to create an `EventHubProducerClient`\n * - Use the connection string from the SAS policy created for your Event Hub instance.\n * - Use the connection string from the SAS policy created for your Event Hub namespace,\n * and the name of the Event Hub instance\n * - Use the full namespace like `<yournamespace>.servicebus.windows.net`, and a credentials object.\n *\n * Optionally, you can also pass an options bag to configure the retry policy or proxy settings.\n *\n */\nexport class EventHubProducerClient {\n /**\n * Describes the amqp connection context for the client.\n */\n private _context: ConnectionContext;\n\n /**\n * The options passed by the user when creating the EventHubClient instance.\n */\n private _clientOptions: EventHubClientOptions;\n /**\n * Map of partitionId to senders\n */\n private _sendersMap: Map<string, EventHubSender>;\n /**\n * Indicates whether or not the EventHubProducerClient should enable idempotent publishing to Event Hub partitions.\n * If enabled, the producer will only be able to publish directly to partitions;\n * it will not be able to publish to the Event Hubs gateway for automatic partition routing\n * nor will it be able to use a partition key.\n * Default: false\n */\n private _enableIdempotentRetries?: boolean;\n /**\n * The set of options that can be specified to influence publishing behavior specific to the configured Event Hub partition.\n * These options are not necessary in the majority of scenarios and are intended for use with specialized scenarios,\n * such as when recovering the state used for idempotent publishing.\n */\n private _partitionOptions?: Record<string, PartitionPublishingOptions>;\n /**\n * @readonly\n * The name of the Event Hub instance for which this client is created.\n */\n get eventHubName(): string {\n return this._context.config.entityPath;\n }\n\n /**\n * @readonly\n * The fully qualified namespace of the Event Hub instance for which this client is created.\n * This is likely to be similar to <yournamespace>.servicebus.windows.net.\n */\n get fullyQualifiedNamespace(): string {\n return this._context.config.host;\n }\n\n /**\n * The name used to identify this EventHubProducerClient.\n * If not specified or empty, a random unique one will be generated.\n */\n public readonly identifier: string;\n\n /**\n * The `EventHubProducerClient` class is used to send events to an Event Hub.\n * Use the `options` parmeter to configure retry policy or proxy settings.\n * @param connectionString - The connection string to use for connecting to the Event Hub instance.\n * It is expected that the shared key properties and the Event Hub path are contained in this connection string.\n * e.g. 'Endpoint=sb://my-servicebus-namespace.servicebus.windows.net/;SharedAccessKeyName=my-SA-name;SharedAccessKey=my-SA-key;EntityPath=my-event-hub-name'.\n * @param options - A set of options to apply when configuring the client.\n * - `retryOptions` : Configures the retry policy for all the operations on the client.\n * For example, `{ \"maxRetries\": 4 }` or `{ \"maxRetries\": 4, \"retryDelayInMs\": 30000 }`.\n * - `webSocketOptions`: Configures the channelling of the AMQP connection over Web Sockets.\n * - `userAgent` : A string to append to the built in user agent string that is passed to the service.\n */\n constructor(connectionString: string, options?: EventHubClientOptions); // eslint-disable-line @azure/azure-sdk/ts-naming-options\n /**\n * The `EventHubProducerClient` class is used to send events to an Event Hub.\n * Use the `options` parmeter to configure retry policy or proxy settings.\n * @param connectionString - The connection string to use for connecting to the Event Hubs namespace.\n * It is expected that the shared key properties are contained in this connection string, but not the Event Hub path,\n * e.g. 'Endpoint=sb://my-servicebus-namespace.servicebus.windows.net/;SharedAccessKeyName=my-SA-name;SharedAccessKey=my-SA-key;'.\n * @param eventHubName - The name of the specific Event Hub to connect the client to.\n * @param options - A set of options to apply when configuring the client.\n * - `retryOptions` : Configures the retry policy for all the operations on the client.\n * For example, `{ \"maxRetries\": 4 }` or `{ \"maxRetries\": 4, \"retryDelayInMs\": 30000 }`.\n * - `webSocketOptions`: Configures the channelling of the AMQP connection over Web Sockets.\n * - `userAgent` : A string to append to the built in user agent string that is passed to the service.\n */\n constructor(connectionString: string, eventHubName: string, options?: EventHubClientOptions); // eslint-disable-line @azure/azure-sdk/ts-naming-options\n /**\n * The `EventHubProducerClient` class is used to send events to an Event Hub.\n * Use the `options` parmeter to configure retry policy or proxy settings.\n * @param fullyQualifiedNamespace - The full namespace which is likely to be similar to\n * <yournamespace>.servicebus.windows.net\n * @param eventHubName - The name of the specific Event Hub to connect the client to.\n * @param credential - An credential object used by the client to get the token to authenticate the connection\n * with the Azure Event Hubs service.\n * See &commat;azure/identity for creating credentials that support AAD auth.\n * Use the `AzureNamedKeyCredential` from &commat;azure/core-auth if you want to pass in a `SharedAccessKeyName`\n * and `SharedAccessKey` without using a connection string. These fields map to the `name` and `key` field respectively\n * in `AzureNamedKeyCredential`.\n * Use the `AzureSASCredential` from &commat;azure/core-auth if you want to pass in a `SharedAccessSignature`\n * without using a connection string. This field maps to `signature` in `AzureSASCredential`.\n * @param options - A set of options to apply when configuring the client.\n * - `retryOptions` : Configures the retry policy for all the operations on the client.\n * For example, `{ \"maxRetries\": 4 }` or `{ \"maxRetries\": 4, \"retryDelayInMs\": 30000 }`.\n * - `webSocketOptions`: Configures the channelling of the AMQP connection over Web Sockets.\n * - `userAgent` : A string to append to the built in user agent string that is passed to the service.\n */\n constructor(\n fullyQualifiedNamespace: string,\n eventHubName: string,\n credential: TokenCredential | NamedKeyCredential | SASCredential,\n options?: EventHubClientOptions, // eslint-disable-line @azure/azure-sdk/ts-naming-options\n );\n constructor(\n fullyQualifiedNamespaceOrConnectionString1: string,\n eventHubNameOrOptions2?: string | EventHubClientOptions,\n credentialOrOptions3?:\n | TokenCredential\n | NamedKeyCredential\n | SASCredential\n | EventHubClientOptions,\n options4?: EventHubClientOptions, // eslint-disable-line @azure/azure-sdk/ts-naming-options\n ) {\n this._context = createConnectionContext(\n fullyQualifiedNamespaceOrConnectionString1,\n eventHubNameOrOptions2,\n credentialOrOptions3,\n options4,\n );\n if (typeof eventHubNameOrOptions2 !== \"string\") {\n this._clientOptions = eventHubNameOrOptions2 || {};\n } else if (!isCredential(credentialOrOptions3)) {\n this._clientOptions = credentialOrOptions3 || {};\n } else {\n this._clientOptions = options4 || {};\n }\n this.identifier = this._clientOptions.identifier ?? getRandomName();\n this._sendersMap = new Map();\n }\n\n /**\n * Creates an instance of `EventDataBatch` to which one can add events until the maximum supported size is reached.\n * The batch can be passed to the {@link sendBatch} method of the `EventHubProducerClient` to be sent to Azure Event Hubs.\n *\n * Events with different values for partitionKey or partitionId will need to be put into different batches.\n * To simplify such batch management across partitions or to have the client automatically batch events\n * and send them in specific intervals, use `EventHubBufferedProducerClient` instead.\n *\n * The below example assumes you have an array of events at hand to be batched safely.\n * If you have events coming in one by one, `EventHubBufferedProducerClient` is recommended instead\n * for effecient management of batches.\n *\n * Example usage:\n * ```ts\n * const client = new EventHubProducerClient(connectionString);\n * let batch = await client.createBatch();\n * for (let i = 0; i < messages.length; i++) {\n * if (!batch.tryAdd(messages[i])) {\n * await client.sendBatch(batch);\n * batch = await client.createBatch();\n * if (!batch.tryAdd(messages[i])) {\n * throw new Error(\"Message too big to fit\")\n * }\n * if (i === messages.length - 1) {\n * await client.sendBatch(batch);\n * }\n * }\n * }\n * ```\n *\n * @param options - Configures the behavior of the batch.\n * - `partitionKey` : A value that is hashed and used by the Azure Event Hubs service to determine the partition to which\n * the events need to be sent.\n * - `partitionId` : Id of the partition to which the batch of events need to be sent.\n * - `maxSizeInBytes`: The upper limit for the size of batch. The `tryAdd` function will return `false` after this limit is reached.\n * - `abortSignal` : A signal the request to cancel the operation.\n * @returns Promise<EventDataBatch>\n * @throws Error if both `partitionId` and `partitionKey` are set in the options.\n * @throws Error if the underlying connection has been closed, create a new EventHubProducerClient.\n * @throws AbortError if the operation is cancelled via the abortSignal in the options.\n */\n async createBatch(options: CreateBatchOptions = {}): Promise<EventDataBatch> {\n throwErrorIfConnectionClosed(this._context);\n\n const partitionId = isDefined(options.partitionId) ? String(options.partitionId) : undefined;\n\n validateProducerPartitionSettings({\n enableIdempotentRetries: this._enableIdempotentRetries,\n partitionId,\n partitionKey: options.partitionKey,\n });\n\n let sender = this._sendersMap.get(partitionId || \"\");\n if (!sender) {\n const partitionPublishingOptions = isDefined(partitionId)\n ? this._partitionOptions?.[partitionId]\n : undefined;\n sender = EventHubSender.create(this._context, this.identifier, {\n enableIdempotentProducer: Boolean(this._enableIdempotentRetries),\n partitionId,\n partitionPublishingOptions,\n });\n this._sendersMap.set(partitionId || \"\", sender);\n }\n\n let maxMessageSize = await sender.getMaxMessageSize({\n retryOptions: this._clientOptions.retryOptions,\n abortSignal: options.abortSignal,\n });\n\n if (options.maxSizeInBytes) {\n if (options.maxSizeInBytes > maxMessageSize) {\n const error = new Error(\n `Max message size (${options.maxSizeInBytes} bytes) is greater than maximum message size (${maxMessageSize} bytes) on the AMQP sender link.`,\n );\n logger.warning(`[${this._context.connectionId}] ${error.message}`);\n logErrorStackTrace(error);\n throw error;\n }\n maxMessageSize = options.maxSizeInBytes;\n }\n return new EventDataBatchImpl(\n this._context,\n maxMessageSize,\n Boolean(this._enableIdempotentRetries),\n options.partitionKey,\n partitionId,\n );\n }\n\n /**\n * Get the information about the state of publishing for a partition as observed by the `EventHubProducerClient`.\n * This data can always be read, but will only be populated with information relevant to the active features\n * for the producer client.\n *\n * @param partitionId - Id of the partition from which to retrieve publishing properties.\n * @param options - The set of options to apply to the operation call.\n * - `abortSignal` : A signal the request to cancel the send operation.\n * @returns Promise<void>\n * @throws AbortError if the operation is cancelled via the abortSignal.\n */\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore this is called in EventHubBufferedProducerClient via cast-to-any workaround\n private async getPartitionPublishingProperties(\n partitionId: string,\n options: OperationOptions = {},\n ): Promise<PartitionPublishingProperties> {\n if (!isDefined(partitionId)) {\n throw new TypeError(\n `getPartitionPublishingProperties called without required argument \"partitionId\"`,\n );\n }\n\n if (typeof partitionId === \"number\") {\n partitionId = String(partitionId);\n }\n\n let sender = this._sendersMap.get(partitionId);\n if (!sender) {\n sender = EventHubSender.create(this._context, this.identifier, {\n enableIdempotentProducer: Boolean(this._enableIdempotentRetries),\n partitionId,\n partitionPublishingOptions: this._partitionOptions?.[partitionId],\n });\n this._sendersMap.set(partitionId, sender);\n }\n\n return sender.getPartitionPublishingProperties(options);\n }\n\n /**\n * Sends an array of events as a batch to the associated Event Hub.\n *\n * Azure Event Hubs has a limit on the size of the batch that can be sent which if exceeded\n * will result in an error with code `MessageTooLargeError`.\n * To safely send within batch size limits, use `EventHubProducerClient.createBatch()` or\n * `EventHubBufferedProducerClient` instead.\n *\n * Example usage:\n * ```ts\n * const client = new EventHubProducerClient(connectionString);\n * await client.sendBatch(messages);\n * ```\n *\n * @param batch - An array of {@link EventData} or `AmqpAnnotatedMessage`.\n * @param options - A set of options that can be specified to influence the way in which\n * events are sent to the associated Event Hub.\n * - `abortSignal` : A signal the request to cancel the send operation.\n * - `partitionId` : The partition this batch will be sent to. If set, `partitionKey` can not be set.\n * - `partitionKey` : A value that is hashed to produce a partition assignment. If set, `partitionId` can not be set.\n *\n * @returns Promise<void>\n * @throws MessageTooLargeError if all the events in the input array cannot be fit into a batch.\n * @throws AbortError if the operation is cancelled via the abortSignal.\n * @throws MessagingError if an error is encountered while sending a message.\n * @throws Error if the underlying connection or sender has been closed.\n */\n async sendBatch(\n batch: EventData[] | AmqpAnnotatedMessage[],\n options?: SendBatchOptions,\n ): Promise<void>;\n /**\n * Sends a batch of events created using `EventHubProducerClient.createBatch()` to the associated Event Hub.\n *\n * Events with different values for partitionKey or partitionId will need to be put into different batches.\n * To simplify such batch management across partitions or to have the client automatically batch events\n * and send them in specific intervals, use `EventHubBufferedProducerClient` instead.\n *\n * The below example assumes you have an array of events at hand to be batched safely.\n * If you have events coming in one by one, `EventHubBufferedProducerClient` is recommended instead\n * for effecient management of batches.\n *\n * Example usage:\n * ```ts\n * const client = new EventHubProducerClient(connectionString);\n * let batch = await client.createBatch();\n * for (let i = 0; i < messages.length; i++) {\n * if (!batch.tryAdd(messages[i])) {\n * await client.sendBatch(batch);\n * batch = await client.createBatch();\n * if (!batch.tryAdd(messages[i])) {\n * throw new Error(\"Message too big to fit\")\n * }\n * if (i === messages.length - 1) {\n * await client.sendBatch(batch);\n * }\n * }\n * }\n * ```\n * @param batch - A batch of events that you can create using the {@link createBatch} method.\n * @param options - A set of options that can be specified to influence the way in which\n * events are sent to the associated Event Hub.\n * - `abortSignal` : A signal the request to cancel the send operation.\n *\n * @returns Promise<void>\n * @throws AbortError if the operation is cancelled via the abortSignal.\n * @throws MessagingError if an error is encountered while sending a message.\n * @throws Error if the underlying connection or sender has been closed.\n */\n async sendBatch(batch: EventDataBatch, options?: OperationOptions): Promise<void>;\n async sendBatch(\n batch: EventDataBatch | EventData[],\n options: SendBatchOptions | OperationOptions = {},\n ): Promise<void> {\n throwErrorIfConnectionClosed(this._context);\n throwTypeErrorIfParameterMissing(this._context.connectionId, \"sendBatch\", \"batch\", batch);\n\n let partitionId: string | undefined;\n let partitionKey: string | undefined;\n\n // Holds an EventData properties object containing tracing properties.\n // This lets us avoid cloning batch when it is EventData[], which is\n // important as the idempotent EventHubSender needs to decorate the\n // original EventData passed through.\n const eventDataTracingProperties: Array<EventData[\"properties\"]> = [];\n\n // link message span contexts\n let spanContextsToLink: TracingContext[] = [];\n\n if (isEventDataBatch(batch)) {\n if (\n this._enableIdempotentRetries &&\n isDefined((batch as EventDataBatchImpl).startingPublishedSequenceNumber)\n ) {\n throw new Error(idempotentAlreadyPublished);\n }\n const partitionAssignment = extractPartitionAssignmentFromBatch(batch, options);\n partitionId = partitionAssignment.partitionId;\n partitionKey = partitionAssignment.partitionKey;\n spanContextsToLink = (batch as EventDataBatchImpl)._messageSpanContexts;\n } else {\n if (!Array.isArray(batch)) {\n batch = [batch];\n }\n batch.forEach(assertIsEventData);\n if (batch.some((event) => isDefined((event as EventDataInternal)._publishedSequenceNumber))) {\n throw new Error(idempotentSomeAlreadyPublished);\n }\n const partitionAssignment = extractPartitionAssignmentFromOptions(options);\n partitionId = partitionAssignment.partitionId;\n partitionKey = partitionAssignment.partitionKey;\n\n for (let i = 0; i < batch.length; i++) {\n batch[i] = instrumentEventData(\n batch[i],\n options,\n this._context.config.entityPath,\n this._context.config.host,\n \"publish\",\n ).event;\n eventDataTracingProperties[i] = batch[i].properties;\n }\n }\n\n validateProducerPartitionSettings({\n enableIdempotentRetries: this._enableIdempotentRetries,\n partitionId,\n partitionKey,\n });\n\n return tracingClient.withSpan(\n `${EventHubProducerClient.name}.${this.sendBatch.name}`,\n options,\n (updatedOptions) => {\n let sender = this._sendersMap.get(partitionId || \"\");\n if (!sender) {\n const partitionPublishingOptions = isDefined(partitionId)\n ? this._partitionOptions?.[partitionId]\n : undefined;\n sender = EventHubSender.create(this._context, this.identifier, {\n enableIdempotentProducer: Boolean(this._enableIdempotentRetries),\n partitionId,\n partitionPublishingOptions,\n });\n this._sendersMap.set(partitionId || \"\", sender);\n }\n\n return sender.send(batch, {\n ...updatedOptions,\n partitionId,\n partitionKey,\n retryOptions: this._clientOptions.retryOptions,\n });\n },\n {\n spanLinks: spanContextsToLink.map<TracingSpanLink>((tracingContext) => {\n return { tracingContext };\n }),\n ...toSpanOptions(this._context.config, \"publish\", \"client\"),\n },\n );\n }\n\n /**\n * Closes the AMQP connection to the Event Hub instance,\n * returning a promise that will be resolved when disconnection is completed.\n * @returns Promise<void>\n * @throws Error if the underlying connection encounters an error while closing.\n */\n async close(): Promise<void> {\n await this._context.close();\n\n for (const pair of this._sendersMap) {\n await pair[1].close();\n }\n this._sendersMap.clear();\n }\n\n /**\n * Provides the Event Hub runtime information.\n * @param options - The set of options to apply to the operation call.\n * @returns A promise that resolves with information about the Event Hub instance.\n * @throws Error if the underlying connection has been closed, create a new EventHubProducerClient.\n * @throws AbortError if the operation is cancelled via the abortSignal.\n */\n getEventHubProperties(options: GetEventHubPropertiesOptions = {}): Promise<EventHubProperties> {\n return this._context.managementSession!.getEventHubProperties({\n ...options,\n retryOptions: this._clientOptions.retryOptions,\n });\n }\n\n /**\n * Provides the id for each partition associated with the Event Hub.\n * @param options - The set of options to apply to the operation call.\n * @returns A promise that resolves with an Array of strings representing the id for\n * each partition associated with the Event Hub.\n * @throws Error if the underlying connection has been closed, create a new EventHubProducerClient.\n * @throws AbortError if the operation is cancelled via the abortSignal.\n */\n getPartitionIds(options: GetPartitionIdsOptions = {}): Promise<Array<string>> {\n return this._context\n .managementSession!.getEventHubProperties({\n ...options,\n retryOptions: this._clientOptions.retryOptions,\n })\n .then((eventHubProperties) => {\n return eventHubProperties.partitionIds;\n });\n }\n\n /**\n * Provides information about the state of the specified partition.\n * @param partitionId - The id of the partition for which information is required.\n * @param options - The set of options to apply to the operation call.\n * @returns A promise that resolves with information about the state of the partition .\n * @throws Error if the underlying connection has been closed, create a new EventHubProducerClient.\n * @throws AbortError if the operation is cancelled via the abortSignal.\n */\n getPartitionProperties(\n partitionId: string,\n options: GetPartitionPropertiesOptions = {},\n ): Promise<PartitionProperties> {\n return this._context.managementSession!.getPartitionProperties(partitionId, {\n ...options,\n retryOptions: this._clientOptions.retryOptions,\n });\n }\n}\n\n/**\n * @internal\n */\nfunction extractPartitionAssignmentFromOptions(options: SendBatchOptions = {}): {\n partitionKey?: string;\n partitionId?: string;\n} {\n const result: ReturnType<typeof extractPartitionAssignmentFromOptions> = {};\n const { partitionId, partitionKey } = options;\n\n if (isDefined(partitionId)) {\n result.partitionId = String(partitionId);\n }\n if (isDefined(partitionKey)) {\n result.partitionKey = String(partitionKey);\n }\n\n return result;\n}\n\n/**\n * @internal\n */\nfunction extractPartitionAssignmentFromBatch(\n batch: EventDataBatch,\n options: SendBatchOptions,\n): { partitionKey?: string; partitionId?: string } {\n const result: ReturnType<typeof extractPartitionAssignmentFromBatch> = {};\n const partitionId = batch.partitionId;\n const partitionKey = batch.partitionKey;\n\n const { partitionId: unexpectedPartitionId, partitionKey: unexpectedPartitionKey } =\n extractPartitionAssignmentFromOptions(options);\n if (unexpectedPartitionKey && partitionKey !== unexpectedPartitionKey) {\n throw new Error(\n `The partitionKey (${unexpectedPartitionKey}) set on sendBatch does not match the partitionKey (${partitionKey}) set when creating the batch.`,\n );\n }\n if (unexpectedPartitionId && unexpectedPartitionId !== partitionId) {\n throw new Error(\n `The partitionId (${unexpectedPartitionId}) set on sendBatch does not match the partitionId (${partitionId}) set when creating the batch.`,\n );\n }\n\n if (isDefined(partitionId)) {\n result.partitionId = String(partitionId);\n }\n if (isDefined(partitionKey)) {\n result.partitionKey = String(partitionKey);\n }\n\n return result;\n}\n"]}
@@ -0,0 +1,227 @@
1
+ import type { RetryOptions } from "@azure/core-amqp";
2
+ import type { EventData } from "./eventData.js";
3
+ import type { EventDataBatch } from "./eventDataBatch.js";
4
+ import type { AbortSignalLike } from "@azure/abort-controller";
5
+ import type { ConnectionContext } from "./connectionContext.js";
6
+ import type { EventHubProducerOptions, IdempotentLinkProperties } from "./models/private.js";
7
+ import type { SendOptions } from "./models/public.js";
8
+ import type { PartitionPublishingOptions, PartitionPublishingProperties } from "./models/private.js";
9
+ /**
10
+ * @internal
11
+ */
12
+ export interface EventHubSenderOptions {
13
+ /**
14
+ * Indicates whether or not the sender should enable idempotent publishing to Event Hub partitions.
15
+ */
16
+ enableIdempotentProducer: boolean;
17
+ /**
18
+ * The EventHub partition id to which the sender wants to send the event data.
19
+ */
20
+ partitionId?: string;
21
+ /**
22
+ * The set of options that can be specified to influence publishing behavior
23
+ * specific to a partition.
24
+ */
25
+ partitionPublishingOptions?: PartitionPublishingOptions;
26
+ }
27
+ /**
28
+ * Describes the EventHubSender that will send event data to EventHub.
29
+ * @internal
30
+ */
31
+ export declare class EventHubSender {
32
+ /**
33
+ * The unique lock name per connection that is used to acquire the
34
+ * lock for establishing a sender link by an entity on that connection.
35
+ */
36
+ private readonly senderLock;
37
+ /**
38
+ * The handler function to handle errors that happen on the
39
+ * underlying sender.
40
+ */
41
+ private readonly _onAmqpError;
42
+ /**
43
+ * The handler function to handle "sender_close" event
44
+ * that happens on the underlying sender.
45
+ */
46
+ private readonly _onAmqpClose;
47
+ /**
48
+ * The message handler that will be set as the handler on
49
+ * the underlying rhea sender's session for the "session_error" event.
50
+ */
51
+ private _onSessionError;
52
+ /**
53
+ * The message handler that will be set as the handler on
54
+ * the underlying rhea sender's session for the "session_close" event.
55
+ */
56
+ private _onSessionClose;
57
+ /**
58
+ * The AMQP sender link.
59
+ */
60
+ private _sender?;
61
+ /**
62
+ * The partition ID.
63
+ */
64
+ private readonly partitionId?;
65
+ /**
66
+ * Indicates whether the sender is configured for idempotent publishing.
67
+ */
68
+ private _isIdempotentProducer;
69
+ /**
70
+ * Indicates whether the sender has an in-flight send while idempotent
71
+ * publishing is enabled.
72
+ */
73
+ private _hasPendingSend?;
74
+ /**
75
+ * A local copy of the PartitionPublishingProperties that can be mutated to
76
+ * keep track of the lastSequenceNumber used.
77
+ */
78
+ private _localPublishingProperties?;
79
+ /**
80
+ * The user-provided set of options that can be specified to influence
81
+ * publishing behavior specific to a partition.
82
+ */
83
+ private _userProvidedPublishingOptions?;
84
+ /**
85
+ * Indicates whether the link is in the process of connecting
86
+ * (establishing) itself. Default value: `false`.
87
+ */
88
+ private isConnecting;
89
+ /**
90
+ * The unique name for the entity (mostly a guid).
91
+ */
92
+ private readonly name;
93
+ /**
94
+ * The address in the following form:
95
+ * - `"<hubName>"`
96
+ * - `"<hubName>/Partitions/<partitionId>"`.
97
+ */
98
+ private readonly address;
99
+ /**
100
+ * The token audience in the following form:
101
+ * - `"sb://<yournamespace>.servicebus.windows.net/<hubName>"`
102
+ * - `"sb://<yournamespace>.servicebus.windows.net/<hubName>/Partitions/<partitionId>"`.
103
+ */
104
+ private readonly audience;
105
+ /**
106
+ * Provides relevant information about the amqp connection,
107
+ * cbs and $management sessions, token provider, sender and receivers.
108
+ */
109
+ private readonly _context;
110
+ /**
111
+ * The auth loop.
112
+ */
113
+ private authLoop?;
114
+ /**
115
+ * The logger.
116
+ */
117
+ private readonly logger;
118
+ /** The client identifier */
119
+ private _id;
120
+ /**
121
+ * Creates a new EventHubSender instance.
122
+ * @param context - The connection context.
123
+ * @param options - Options used to configure the EventHubSender.
124
+ */
125
+ constructor(context: ConnectionContext, senderId: string, { partitionId, enableIdempotentProducer, partitionPublishingOptions }: EventHubSenderOptions);
126
+ /**
127
+ * Deletes the sender from the context. Clears the token renewal timer. Closes the sender link.
128
+ */
129
+ close(): Promise<void>;
130
+ /**
131
+ * Determines whether the AMQP sender link is open. If open then returns true else returns false.
132
+ * @returns boolean
133
+ */
134
+ isOpen(): boolean;
135
+ /**
136
+ * Returns maximum message size on the AMQP sender link.
137
+ * @param abortSignal - An implementation of the `AbortSignalLike` interface to signal the request to cancel the operation.
138
+ * For example, use the &commat;azure/abort-controller to create an `AbortSignal`.
139
+ * @returns Promise<number>
140
+ * @throws AbortError if the operation is cancelled via the abortSignal.
141
+ */
142
+ getMaxMessageSize(options?: {
143
+ retryOptions?: RetryOptions;
144
+ abortSignal?: AbortSignalLike;
145
+ }): Promise<number>;
146
+ /**
147
+ * Get the information about the state of publishing for a partition as observed by the `EventHubSender`.
148
+ * This data can always be read, but will only be populated with information relevant to the active features
149
+ * for the producer client.
150
+ */
151
+ getPartitionPublishingProperties(options?: {
152
+ retryOptions?: RetryOptions;
153
+ abortSignal?: AbortSignalLike;
154
+ }): Promise<PartitionPublishingProperties>;
155
+ /**
156
+ * Send a batch of EventData to the EventHub. The "message_annotations",
157
+ * "application_properties" and "properties" of the first message will be set as that
158
+ * of the envelope (batch message).
159
+ * @param events - An array of EventData objects to be sent in a Batch message.
160
+ * @param options - Options to control the way the events are batched along with request options
161
+ */
162
+ send(events: EventData[] | EventDataBatch, options?: SendOptions & EventHubProducerOptions & {
163
+ tracingProperties?: Array<EventData["properties"]>;
164
+ }): Promise<void>;
165
+ /**
166
+ * @param sender - The rhea sender that contains the idempotent producer properties.
167
+ */
168
+ private _populateLocalPublishingProperties;
169
+ private _deleteFromCache;
170
+ private _createSenderOptions;
171
+ /**
172
+ * Tries to send the message to EventHub if there is enough credit to send them
173
+ * and the circular buffer has available space to settle the message after sending them.
174
+ *
175
+ * We have implemented a synchronous send over here in the sense that we shall be waiting
176
+ * for the message to be accepted or rejected and accordingly resolve or reject the promise.
177
+ * @param rheaMessage - The message to be sent to EventHub.
178
+ * @returns Promise<void>
179
+ */
180
+ private _trySendBatch;
181
+ private _getLink;
182
+ /**
183
+ * Initializes the sender session on the connection.
184
+ * Should only be called from _createLinkIfNotOpen
185
+ */
186
+ private _init;
187
+ /**
188
+ * Creates a new sender to the given event hub, and optionally to a given partition if it is
189
+ * not present in the context or returns the one present in the context.
190
+ * @hidden
191
+ * @param options - Options used to configure the EventHubSender.
192
+ */
193
+ static create(context: ConnectionContext, senderId: string, options: EventHubSenderOptions): EventHubSender;
194
+ }
195
+ /**
196
+ * Generates the link properties for an indemopotent sender given
197
+ * based on the user-provided and locally-cached publishing options.
198
+ *
199
+ * Note: The set of idempotent properties a user specifies at EventHubProducerClient instantiation-time
200
+ * is slightly different than what the service returns and the EventHubSender keeps track of locally.
201
+ *
202
+ * The difference is that the user specifies the `startingSequenceNumber`, whereas the local options
203
+ * (those returned by getPartitionPublishingProperties) specifies `lastPublishedSequenceNumber`.
204
+ *
205
+ * These _can_ be the same, but the user is technically free to set any `startingSequenceNumber` they want.
206
+ * @internal
207
+ */
208
+ export declare function generateIdempotentLinkProperties(userProvidedPublishingOptions: PartitionPublishingOptions | undefined, localPublishingOptions: PartitionPublishingProperties | undefined): IdempotentLinkProperties | Record<string, never>;
209
+ /**
210
+ * Encodes a list or batch of events into a single binary message that can be sent to the service.
211
+ *
212
+ * Prior to encoding, any special properties not specified by the user, such as tracing or idempotent
213
+ * properties, are assigned to the list or batch of events as needed.
214
+ *
215
+ * @internal
216
+ * @param events - Events to transform for sending to the service.
217
+ * @param publishingProps - Describes the current publishing state for the partition.
218
+ * @param options - Options used to configure this function.
219
+ */
220
+ export declare function transformEventsForSend(events: EventData[] | EventDataBatch, publishingProps: PartitionPublishingProperties, options?: SendOptions & {
221
+ /**
222
+ * A list containing the `Diagnostic-Id` tracing property that is associated with each EventData.
223
+ * The index of tracingProperties corresponds to the same index in `events` when `events` is EventData[].
224
+ */
225
+ tracingProperties?: Array<EventData["properties"]>;
226
+ }): Buffer;
227
+ //# sourceMappingURL=eventHubSender.d.ts.map