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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (254) hide show
  1. package/dist/browser/connectionContext.js +1 -2
  2. package/dist/browser/connectionContext.js.map +1 -1
  3. package/dist/browser/constructorHelpers.js +3 -4
  4. package/dist/browser/constructorHelpers.js.map +1 -1
  5. package/dist/browser/core/autoLockRenewer.js +9 -5
  6. package/dist/browser/core/autoLockRenewer.js.map +1 -1
  7. package/dist/browser/core/batchingReceiver.js +26 -18
  8. package/dist/browser/core/batchingReceiver.js.map +1 -1
  9. package/dist/browser/core/linkEntity.js +74 -13
  10. package/dist/browser/core/linkEntity.js.map +1 -1
  11. package/dist/browser/core/managementClient.js +48 -48
  12. package/dist/browser/core/managementClient.js.map +1 -1
  13. package/dist/browser/core/messageReceiver.js +41 -14
  14. package/dist/browser/core/messageReceiver.js.map +1 -1
  15. package/dist/browser/core/messageSender.js +33 -10
  16. package/dist/browser/core/messageSender.js.map +1 -1
  17. package/dist/browser/core/receiverHelper.js +3 -2
  18. package/dist/browser/core/receiverHelper.js.map +1 -1
  19. package/dist/browser/core/shared.js +11 -4
  20. package/dist/browser/core/shared.js.map +1 -1
  21. package/dist/browser/core/streamingReceiver.js +74 -43
  22. package/dist/browser/core/streamingReceiver.js.map +1 -1
  23. package/dist/browser/diagnostics/instrumentServiceBusMessage.js +16 -8
  24. package/dist/browser/diagnostics/instrumentServiceBusMessage.js.map +1 -1
  25. package/dist/browser/receivers/receiver.js +68 -23
  26. package/dist/browser/receivers/receiver.js.map +1 -1
  27. package/dist/browser/receivers/receiverCommon.js +36 -21
  28. package/dist/browser/receivers/receiverCommon.js.map +1 -1
  29. package/dist/browser/receivers/sessionReceiver.js +69 -29
  30. package/dist/browser/receivers/sessionReceiver.js.map +1 -1
  31. package/dist/browser/sender.js +33 -11
  32. package/dist/browser/sender.js.map +1 -1
  33. package/dist/browser/serializers/queueResourceSerializer.js +9 -1
  34. package/dist/browser/serializers/queueResourceSerializer.js.map +1 -1
  35. package/dist/browser/serializers/ruleResourceSerializer.js +1 -2
  36. package/dist/browser/serializers/ruleResourceSerializer.js.map +1 -1
  37. package/dist/browser/serviceBusAtomManagementClient.js +181 -228
  38. package/dist/browser/serviceBusAtomManagementClient.js.map +1 -1
  39. package/dist/browser/serviceBusClient.js +31 -22
  40. package/dist/browser/serviceBusClient.js.map +1 -1
  41. package/dist/browser/serviceBusError.js +21 -1
  42. package/dist/browser/serviceBusError.js.map +1 -1
  43. package/dist/browser/serviceBusMessage.js +208 -13
  44. package/dist/browser/serviceBusMessage.js.map +1 -1
  45. package/dist/browser/serviceBusMessageBatch.js +32 -8
  46. package/dist/browser/serviceBusMessageBatch.js.map +1 -1
  47. package/dist/browser/serviceBusRuleManager.js +39 -15
  48. package/dist/browser/serviceBusRuleManager.js.map +1 -1
  49. package/dist/browser/session/messageSession.js +130 -25
  50. package/dist/browser/session/messageSession.js.map +1 -1
  51. package/dist/browser/util/atomXmlHelper.js +4 -5
  52. package/dist/browser/util/atomXmlHelper.js.map +1 -1
  53. package/dist/browser/util/compat/httpHeaders.js +1 -0
  54. package/dist/browser/util/compat/httpHeaders.js.map +1 -1
  55. package/dist/browser/util/constants.js +1 -1
  56. package/dist/browser/util/constants.js.map +1 -1
  57. package/dist/browser/util/sasServiceClientCredentials.js +8 -0
  58. package/dist/browser/util/sasServiceClientCredentials.js.map +1 -1
  59. package/dist/browser/util/semaphore.js +6 -2
  60. package/dist/browser/util/semaphore.js.map +1 -1
  61. package/dist/browser/util/utils.js +5 -7
  62. package/dist/browser/util/utils.js.map +1 -1
  63. package/dist/commonjs/connectionContext.js +1 -2
  64. package/dist/commonjs/connectionContext.js.map +1 -1
  65. package/dist/commonjs/constructorHelpers.js +3 -4
  66. package/dist/commonjs/constructorHelpers.js.map +1 -1
  67. package/dist/commonjs/core/autoLockRenewer.js +9 -5
  68. package/dist/commonjs/core/autoLockRenewer.js.map +1 -1
  69. package/dist/commonjs/core/batchingReceiver.js +26 -18
  70. package/dist/commonjs/core/batchingReceiver.js.map +1 -1
  71. package/dist/commonjs/core/linkEntity.js +74 -13
  72. package/dist/commonjs/core/linkEntity.js.map +1 -1
  73. package/dist/commonjs/core/managementClient.js +48 -48
  74. package/dist/commonjs/core/managementClient.js.map +1 -1
  75. package/dist/commonjs/core/messageReceiver.js +41 -14
  76. package/dist/commonjs/core/messageReceiver.js.map +1 -1
  77. package/dist/commonjs/core/messageSender.js +33 -10
  78. package/dist/commonjs/core/messageSender.js.map +1 -1
  79. package/dist/commonjs/core/receiverHelper.js +3 -2
  80. package/dist/commonjs/core/receiverHelper.js.map +1 -1
  81. package/dist/commonjs/core/shared.js +11 -4
  82. package/dist/commonjs/core/shared.js.map +1 -1
  83. package/dist/commonjs/core/streamingReceiver.js +74 -43
  84. package/dist/commonjs/core/streamingReceiver.js.map +1 -1
  85. package/dist/commonjs/diagnostics/instrumentServiceBusMessage.js +16 -8
  86. package/dist/commonjs/diagnostics/instrumentServiceBusMessage.js.map +1 -1
  87. package/dist/commonjs/receivers/receiver.js +68 -23
  88. package/dist/commonjs/receivers/receiver.js.map +1 -1
  89. package/dist/commonjs/receivers/receiverCommon.js +36 -21
  90. package/dist/commonjs/receivers/receiverCommon.js.map +1 -1
  91. package/dist/commonjs/receivers/sessionReceiver.js +69 -29
  92. package/dist/commonjs/receivers/sessionReceiver.js.map +1 -1
  93. package/dist/commonjs/sender.js +33 -11
  94. package/dist/commonjs/sender.js.map +1 -1
  95. package/dist/commonjs/serializers/queueResourceSerializer.js +9 -1
  96. package/dist/commonjs/serializers/queueResourceSerializer.js.map +1 -1
  97. package/dist/commonjs/serializers/ruleResourceSerializer.js +1 -2
  98. package/dist/commonjs/serializers/ruleResourceSerializer.js.map +1 -1
  99. package/dist/commonjs/serviceBusAtomManagementClient.js +181 -227
  100. package/dist/commonjs/serviceBusAtomManagementClient.js.map +1 -1
  101. package/dist/commonjs/serviceBusClient.js +31 -22
  102. package/dist/commonjs/serviceBusClient.js.map +1 -1
  103. package/dist/commonjs/serviceBusError.js +21 -1
  104. package/dist/commonjs/serviceBusError.js.map +1 -1
  105. package/dist/commonjs/serviceBusMessage.js +208 -12
  106. package/dist/commonjs/serviceBusMessage.js.map +1 -1
  107. package/dist/commonjs/serviceBusMessageBatch.js +32 -8
  108. package/dist/commonjs/serviceBusMessageBatch.js.map +1 -1
  109. package/dist/commonjs/serviceBusRuleManager.js +39 -15
  110. package/dist/commonjs/serviceBusRuleManager.js.map +1 -1
  111. package/dist/commonjs/session/messageSession.js +130 -25
  112. package/dist/commonjs/session/messageSession.js.map +1 -1
  113. package/dist/commonjs/tsdoc-metadata.json +11 -11
  114. package/dist/commonjs/util/atomXmlHelper.js +4 -5
  115. package/dist/commonjs/util/atomXmlHelper.js.map +1 -1
  116. package/dist/commonjs/util/compat/httpHeaders.js +1 -0
  117. package/dist/commonjs/util/compat/httpHeaders.js.map +1 -1
  118. package/dist/commonjs/util/constants.js +1 -1
  119. package/dist/commonjs/util/constants.js.map +1 -1
  120. package/dist/commonjs/util/runtimeInfo.js +2 -2
  121. package/dist/commonjs/util/runtimeInfo.js.map +1 -1
  122. package/dist/commonjs/util/sasServiceClientCredentials.js +8 -0
  123. package/dist/commonjs/util/sasServiceClientCredentials.js.map +1 -1
  124. package/dist/commonjs/util/semaphore.js +6 -2
  125. package/dist/commonjs/util/semaphore.js.map +1 -1
  126. package/dist/commonjs/util/utils.js +5 -7
  127. package/dist/commonjs/util/utils.js.map +1 -1
  128. package/dist/esm/connectionContext.js +1 -2
  129. package/dist/esm/connectionContext.js.map +1 -1
  130. package/dist/esm/constructorHelpers.js +3 -4
  131. package/dist/esm/constructorHelpers.js.map +1 -1
  132. package/dist/esm/core/autoLockRenewer.js +9 -5
  133. package/dist/esm/core/autoLockRenewer.js.map +1 -1
  134. package/dist/esm/core/batchingReceiver.js +26 -18
  135. package/dist/esm/core/batchingReceiver.js.map +1 -1
  136. package/dist/esm/core/linkEntity.js +74 -13
  137. package/dist/esm/core/linkEntity.js.map +1 -1
  138. package/dist/esm/core/managementClient.js +48 -48
  139. package/dist/esm/core/managementClient.js.map +1 -1
  140. package/dist/esm/core/messageReceiver.js +41 -14
  141. package/dist/esm/core/messageReceiver.js.map +1 -1
  142. package/dist/esm/core/messageSender.js +33 -10
  143. package/dist/esm/core/messageSender.js.map +1 -1
  144. package/dist/esm/core/receiverHelper.js +3 -2
  145. package/dist/esm/core/receiverHelper.js.map +1 -1
  146. package/dist/esm/core/shared.js +11 -4
  147. package/dist/esm/core/shared.js.map +1 -1
  148. package/dist/esm/core/streamingReceiver.js +74 -43
  149. package/dist/esm/core/streamingReceiver.js.map +1 -1
  150. package/dist/esm/diagnostics/instrumentServiceBusMessage.js +16 -8
  151. package/dist/esm/diagnostics/instrumentServiceBusMessage.js.map +1 -1
  152. package/dist/esm/receivers/receiver.js +68 -23
  153. package/dist/esm/receivers/receiver.js.map +1 -1
  154. package/dist/esm/receivers/receiverCommon.js +36 -21
  155. package/dist/esm/receivers/receiverCommon.js.map +1 -1
  156. package/dist/esm/receivers/sessionReceiver.js +69 -29
  157. package/dist/esm/receivers/sessionReceiver.js.map +1 -1
  158. package/dist/esm/sender.js +33 -11
  159. package/dist/esm/sender.js.map +1 -1
  160. package/dist/esm/serializers/queueResourceSerializer.js +9 -1
  161. package/dist/esm/serializers/queueResourceSerializer.js.map +1 -1
  162. package/dist/esm/serializers/ruleResourceSerializer.js +1 -2
  163. package/dist/esm/serializers/ruleResourceSerializer.js.map +1 -1
  164. package/dist/esm/serviceBusAtomManagementClient.js +181 -228
  165. package/dist/esm/serviceBusAtomManagementClient.js.map +1 -1
  166. package/dist/esm/serviceBusClient.js +31 -22
  167. package/dist/esm/serviceBusClient.js.map +1 -1
  168. package/dist/esm/serviceBusError.js +21 -1
  169. package/dist/esm/serviceBusError.js.map +1 -1
  170. package/dist/esm/serviceBusMessage.js +208 -13
  171. package/dist/esm/serviceBusMessage.js.map +1 -1
  172. package/dist/esm/serviceBusMessageBatch.js +32 -8
  173. package/dist/esm/serviceBusMessageBatch.js.map +1 -1
  174. package/dist/esm/serviceBusRuleManager.js +39 -15
  175. package/dist/esm/serviceBusRuleManager.js.map +1 -1
  176. package/dist/esm/session/messageSession.js +130 -25
  177. package/dist/esm/session/messageSession.js.map +1 -1
  178. package/dist/esm/util/atomXmlHelper.js +4 -5
  179. package/dist/esm/util/atomXmlHelper.js.map +1 -1
  180. package/dist/esm/util/compat/httpHeaders.js +1 -0
  181. package/dist/esm/util/compat/httpHeaders.js.map +1 -1
  182. package/dist/esm/util/constants.js +1 -1
  183. package/dist/esm/util/constants.js.map +1 -1
  184. package/dist/esm/util/runtimeInfo.js +1 -1
  185. package/dist/esm/util/runtimeInfo.js.map +1 -1
  186. package/dist/esm/util/sasServiceClientCredentials.js +8 -0
  187. package/dist/esm/util/sasServiceClientCredentials.js.map +1 -1
  188. package/dist/esm/util/semaphore.js +6 -2
  189. package/dist/esm/util/semaphore.js.map +1 -1
  190. package/dist/esm/util/utils.js +5 -7
  191. package/dist/esm/util/utils.js.map +1 -1
  192. package/dist/react-native/connectionContext.js +1 -2
  193. package/dist/react-native/connectionContext.js.map +1 -1
  194. package/dist/react-native/constructorHelpers.js +3 -4
  195. package/dist/react-native/constructorHelpers.js.map +1 -1
  196. package/dist/react-native/core/autoLockRenewer.js +9 -5
  197. package/dist/react-native/core/autoLockRenewer.js.map +1 -1
  198. package/dist/react-native/core/batchingReceiver.js +26 -18
  199. package/dist/react-native/core/batchingReceiver.js.map +1 -1
  200. package/dist/react-native/core/linkEntity.js +74 -13
  201. package/dist/react-native/core/linkEntity.js.map +1 -1
  202. package/dist/react-native/core/managementClient.js +48 -48
  203. package/dist/react-native/core/managementClient.js.map +1 -1
  204. package/dist/react-native/core/messageReceiver.js +41 -14
  205. package/dist/react-native/core/messageReceiver.js.map +1 -1
  206. package/dist/react-native/core/messageSender.js +33 -10
  207. package/dist/react-native/core/messageSender.js.map +1 -1
  208. package/dist/react-native/core/receiverHelper.js +3 -2
  209. package/dist/react-native/core/receiverHelper.js.map +1 -1
  210. package/dist/react-native/core/shared.js +11 -4
  211. package/dist/react-native/core/shared.js.map +1 -1
  212. package/dist/react-native/core/streamingReceiver.js +74 -43
  213. package/dist/react-native/core/streamingReceiver.js.map +1 -1
  214. package/dist/react-native/diagnostics/instrumentServiceBusMessage.js +16 -8
  215. package/dist/react-native/diagnostics/instrumentServiceBusMessage.js.map +1 -1
  216. package/dist/react-native/receivers/receiver.js +68 -23
  217. package/dist/react-native/receivers/receiver.js.map +1 -1
  218. package/dist/react-native/receivers/receiverCommon.js +36 -21
  219. package/dist/react-native/receivers/receiverCommon.js.map +1 -1
  220. package/dist/react-native/receivers/sessionReceiver.js +69 -29
  221. package/dist/react-native/receivers/sessionReceiver.js.map +1 -1
  222. package/dist/react-native/sender.js +33 -11
  223. package/dist/react-native/sender.js.map +1 -1
  224. package/dist/react-native/serializers/queueResourceSerializer.js +9 -1
  225. package/dist/react-native/serializers/queueResourceSerializer.js.map +1 -1
  226. package/dist/react-native/serializers/ruleResourceSerializer.js +1 -2
  227. package/dist/react-native/serializers/ruleResourceSerializer.js.map +1 -1
  228. package/dist/react-native/serviceBusAtomManagementClient.js +181 -228
  229. package/dist/react-native/serviceBusAtomManagementClient.js.map +1 -1
  230. package/dist/react-native/serviceBusClient.js +31 -22
  231. package/dist/react-native/serviceBusClient.js.map +1 -1
  232. package/dist/react-native/serviceBusError.js +21 -1
  233. package/dist/react-native/serviceBusError.js.map +1 -1
  234. package/dist/react-native/serviceBusMessage.js +208 -13
  235. package/dist/react-native/serviceBusMessage.js.map +1 -1
  236. package/dist/react-native/serviceBusMessageBatch.js +32 -8
  237. package/dist/react-native/serviceBusMessageBatch.js.map +1 -1
  238. package/dist/react-native/serviceBusRuleManager.js +39 -15
  239. package/dist/react-native/serviceBusRuleManager.js.map +1 -1
  240. package/dist/react-native/session/messageSession.js +130 -25
  241. package/dist/react-native/session/messageSession.js.map +1 -1
  242. package/dist/react-native/util/atomXmlHelper.js +4 -5
  243. package/dist/react-native/util/atomXmlHelper.js.map +1 -1
  244. package/dist/react-native/util/compat/httpHeaders.js +1 -0
  245. package/dist/react-native/util/compat/httpHeaders.js.map +1 -1
  246. package/dist/react-native/util/constants.js +1 -1
  247. package/dist/react-native/util/constants.js.map +1 -1
  248. package/dist/react-native/util/sasServiceClientCredentials.js +8 -0
  249. package/dist/react-native/util/sasServiceClientCredentials.js.map +1 -1
  250. package/dist/react-native/util/semaphore.js +6 -2
  251. package/dist/react-native/util/semaphore.js.map +1 -1
  252. package/dist/react-native/util/utils.js +5 -7
  253. package/dist/react-native/util/utils.js.map +1 -1
  254. package/package.json +38 -38
@@ -1,6 +1,5 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT License.
3
- import { __rest } from "tslib";
4
3
  import { AmqpAnnotatedMessage, Constants } from "@azure/core-amqp";
5
4
  import { Buffer } from "buffer";
6
5
  import Long from "long";
@@ -64,10 +63,12 @@ export function getMessagePropertyTypeMismatchError(msg) {
64
63
  * Converts given ServiceBusMessage to RheaMessage
65
64
  */
66
65
  export function toRheaMessage(msg, encoder) {
67
- var _a, _b;
68
66
  let amqpMsg;
69
67
  if (isAmqpAnnotatedMessage(msg)) {
70
- amqpMsg = Object.assign(Object.assign({}, AmqpAnnotatedMessage.toRheaMessage(msg)), { body: encoder.encode(msg.body, (_a = msg.bodyType) !== null && _a !== void 0 ? _a : "data") });
68
+ amqpMsg = {
69
+ ...AmqpAnnotatedMessage.toRheaMessage(msg),
70
+ body: encoder.encode(msg.body, msg.bodyType ?? "data"),
71
+ };
71
72
  }
72
73
  else {
73
74
  let bodyType = "data";
@@ -86,7 +87,7 @@ export function toRheaMessage(msg, encoder) {
86
87
  * incompatible way with the underying _rawAmqpMessage.bodyType" is not common
87
88
  * enough for us to try to do anything more than what I'm doing here.
88
89
  */
89
- bodyType = (_b = msg._rawAmqpMessage.bodyType) !== null && _b !== void 0 ? _b : "data";
90
+ bodyType = msg._rawAmqpMessage.bodyType ?? "data";
90
91
  }
91
92
  // TODO: it seems sensible that we'd also do this for AMQPAnnotated message.
92
93
  const validationError = getMessagePropertyTypeMismatchError(msg);
@@ -164,9 +165,8 @@ export function updateMessageId(rheaMessage, messageId) {
164
165
  }
165
166
  /** @internal */
166
167
  export function updateScheduledTime(rheaMessage, scheduledEnqueuedTimeUtc) {
167
- var _a;
168
168
  if (scheduledEnqueuedTimeUtc != null) {
169
- rheaMessage.message_annotations = (_a = rheaMessage.message_annotations) !== null && _a !== void 0 ? _a : {};
169
+ rheaMessage.message_annotations = rheaMessage.message_annotations ?? {};
170
170
  rheaMessage.message_annotations[Constants.scheduledEnqueueTime] = scheduledEnqueuedTimeUtc;
171
171
  }
172
172
  }
@@ -175,7 +175,6 @@ export function updateScheduledTime(rheaMessage, scheduledEnqueuedTimeUtc) {
175
175
  * Converts given RheaMessage to ServiceBusReceivedMessage
176
176
  */
177
177
  export function fromRheaMessage(rheaMessage, options) {
178
- var _a, _b, _c, _d, _e;
179
178
  if (!rheaMessage) {
180
179
  rheaMessage = {
181
180
  body: undefined,
@@ -262,7 +261,7 @@ export function fromRheaMessage(rheaMessage, options) {
262
261
  const rawMessage = AmqpAnnotatedMessage.fromRheaMessage(rheaMessage);
263
262
  rawMessage.bodyType = bodyType;
264
263
  if (rheaMessage.ttl == null) {
265
- rheaMessage.ttl = (_b = (_a = rawMessage.header) === null || _a === void 0 ? void 0 : _a.timeToLive) !== null && _b !== void 0 ? _b : Constants.maxDurationValue;
264
+ rheaMessage.ttl = rawMessage.header?.timeToLive ?? Constants.maxDurationValue;
266
265
  }
267
266
  if (props.enqueuedTimeUtc) {
268
267
  props.expiresAtUtc = new Date(Math.min(props.enqueuedTimeUtc.getTime() + rheaMessage.ttl, Constants.maxDurationValue));
@@ -282,16 +281,24 @@ export function fromRheaMessage(rheaMessage, options) {
282
281
  ? rawMessage.messageAnnotations
283
282
  : convertDatesToNumbers(rawMessage.messageAnnotations);
284
283
  }
285
- if ((_c = rawMessage.header) === null || _c === void 0 ? void 0 : _c.timeToLive) {
284
+ if (rawMessage.header?.timeToLive) {
286
285
  sbmsg.timeToLive = rawMessage.header.timeToLive;
287
286
  }
288
- const rcvdsbmsg = Object.assign(Object.assign(Object.assign({ _rawAmqpMessage: rawMessage, deliveryCount: rheaMessage.delivery_count, lockToken: delivery && delivery.tag && delivery.tag.length !== 0
287
+ const rcvdsbmsg = {
288
+ _rawAmqpMessage: rawMessage,
289
+ deliveryCount: rheaMessage.delivery_count,
290
+ lockToken: delivery && delivery.tag && delivery.tag.length !== 0
289
291
  ? uuid_to_string(shouldReorderLockToken === true
290
292
  ? reorderLockToken(typeof delivery.tag === "string" ? Buffer.from(delivery.tag) : delivery.tag)
291
293
  : typeof delivery.tag === "string"
292
294
  ? Buffer.from(delivery.tag)
293
295
  : delivery.tag)
294
- : undefined }, sbmsg), props), { deadLetterReason: (_d = sbmsg.applicationProperties) === null || _d === void 0 ? void 0 : _d.DeadLetterReason, deadLetterErrorDescription: (_e = sbmsg.applicationProperties) === null || _e === void 0 ? void 0 : _e.DeadLetterErrorDescription });
296
+ : undefined,
297
+ ...sbmsg,
298
+ ...props,
299
+ deadLetterReason: sbmsg.applicationProperties?.DeadLetterReason,
300
+ deadLetterErrorDescription: sbmsg.applicationProperties?.DeadLetterErrorDescription,
301
+ };
295
302
  logger.verbose("AmqpMessage to ServiceBusReceivedMessage: %O", rcvdsbmsg);
296
303
  return rcvdsbmsg;
297
304
  }
@@ -320,11 +327,199 @@ export function isServiceBusReceivedMessage(possible) {
320
327
  * @internal
321
328
  */
322
329
  export class ServiceBusMessageImpl {
330
+ /**
331
+ * The message body that needs to be sent or is received.
332
+ */
333
+ body;
334
+ /**
335
+ * The application specific properties.
336
+ */
337
+ applicationProperties;
338
+ /**
339
+ * The message identifier is an
340
+ * application-defined value that uniquely identifies the message and its payload. The identifier
341
+ * is a free-form string and can reflect a GUID or an identifier derived from the application
342
+ * context. If enabled, the
343
+ * {@link https://learn.microsoft.com/azure/service-bus-messaging/duplicate-detection | duplicate detection}
344
+ * identifies and removes second and further submissions of messages with the same MessageId.
345
+ */
346
+ messageId;
347
+ /**
348
+ * The content type of the message. Optionally describes
349
+ * the payload of the message, with a descriptor following the format of RFC2045, Section 5, for
350
+ * example "application/json".
351
+ */
352
+ contentType;
353
+ /**
354
+ * The correlation identifier that allows an
355
+ * application to specify a context for the message for the purposes of correlation, for example
356
+ * reflecting the MessageId of a message that is being replied to.
357
+ * See {@link https://learn.microsoft.com/azure/service-bus-messaging/service-bus-messages-payloads?#message-routing-and-correlation | Message Routing and Correlation}.
358
+ */
359
+ correlationId;
360
+ /**
361
+ * The partition key for sending a message to a
362
+ * partitioned entity. Maximum length is 128 characters. For {@link https://learn.microsoft.com/azure/service-bus-messaging/service-bus-partitioning | partitioned entities},
363
+ * setting this value enables assigning related messages to the same internal partition,
364
+ * so that submission sequence order is correctly recorded. The partition is chosen by a hash
365
+ * function over this value and cannot be chosen directly. For session-aware entities,
366
+ * the `sessionId` property overrides this value.
367
+ */
368
+ partitionKey;
369
+ /**
370
+ * The partition key for sending a message into an entity
371
+ * via a partitioned transfer queue. Maximum length is 128 characters. If a message is sent via a
372
+ * transfer queue in the scope of a transaction, this value selects the transfer queue partition:
373
+ * This is functionally equivalent to `partitionKey` property and ensures that messages are kept
374
+ * together and in order as they are transferred.
375
+ * See {@link https://learn.microsoft.com/azure/service-bus-messaging/service-bus-transactions#transfers-and-send-via | Transfers and Send Via}.
376
+ */
377
+ // Will be required later for implementing Transactions
378
+ // viaPartitionKey?: string;
379
+ /**
380
+ * The session identifier for a session-aware entity. Maximum
381
+ * length is 128 characters. For session-aware entities, this application-defined value specifies
382
+ * the session affiliation of the message. Messages with the same session identifier are subject
383
+ * to summary locking and enable exact in-order processing and demultiplexing. For
384
+ * session-unaware entities, this value is ignored.
385
+ * {@link https://learn.microsoft.com/azure/service-bus-messaging/message-sessions | Message Sessions}.
386
+ */
387
+ sessionId;
388
+ /**
389
+ * The session identifier augmenting the `replyTo` address.
390
+ * Maximum length is 128 characters. This value augments the ReplyTo information and specifies
391
+ * which SessionId should be set for the reply when sent to the reply entity.
392
+ * See {@link https://learn.microsoft.com/azure/service-bus-messaging/service-bus-messages-payloads?#message-routing-and-correlation | Message Routing and Correlation}.
393
+ */
394
+ replyToSessionId;
395
+ /**
396
+ * The message’s time to live value. This value is the relative
397
+ * duration after which the message expires, starting from the instant the message has been
398
+ * accepted and stored by the broker, as captured in `enqueuedTimeUtc`. When not set explicitly,
399
+ * the assumed value is the DefaultTimeToLive for the respective queue or topic. A message-level
400
+ * `timeToLive` value cannot be longer than the entity's DefaultTimeToLive setting and it is
401
+ * silently adjusted if it does. See
402
+ * {@link https://learn.microsoft.com/azure/service-bus-messaging/message-expiration | Expiration}.
403
+ */
404
+ timeToLive;
405
+ /**
406
+ * The application specific label. This property enables the
407
+ * application to indicate the purpose of the message to the receiver in a standardized. fashion,
408
+ * similar to an email subject line. The mapped AMQP property is "subject".
409
+ */
410
+ subject;
411
+ /**
412
+ * The "to" address. This property is reserved for future use in routing
413
+ * scenarios and presently ignored by the broker itself. Applications can use this value in
414
+ * rule-driven {@link https://learn.microsoft.com/azure/service-bus-messaging/service-bus-auto-forwarding | auto-forward chaining}
415
+ * scenarios to indicate the intended logical destination of the message.
416
+ */
417
+ to;
418
+ /**
419
+ * The address of an entity to send replies to. This optional and
420
+ * application-defined value is a standard way to express a reply path to the receiver of the
421
+ * message. When a sender expects a reply, it sets the value to the absolute or relative path of
422
+ * the queue or topic it expects the reply to be sent to. See
423
+ * {@link https://learn.microsoft.com/azure/service-bus-messaging/service-bus-messages-payloads?#message-routing-and-correlation | Message Routing and Correlation}.
424
+ */
425
+ replyTo;
426
+ /**
427
+ * The date and time in UTC at which the message will
428
+ * be enqueued. This property returns the time in UTC; when setting the property, the
429
+ * supplied DateTime value must also be in UTC. This value is for delayed message sending.
430
+ * It is utilized to delay messages sending to a specific time in the future. Message enqueuing
431
+ * time does not mean that the message will be sent at the same time. It will get enqueued,
432
+ * but the actual sending time depends on the queue's workload and its state.
433
+ */
434
+ scheduledEnqueueTimeUtc;
435
+ /**
436
+ * The lock token is a reference to the lock that is being held by the broker in
437
+ * `peekLock` receive mode. Locks are used internally settle messages as explained in the
438
+ * {@link https://learn.microsoft.com/azure/service-bus-messaging/message-transfers-locks-settlement | product documentation in more detail}
439
+ * - Not applicable when the message is received in `receiveAndDelete` receive mode.
440
+ * mode.
441
+ * @readonly
442
+ */
443
+ lockToken;
444
+ /**
445
+ * Number of deliveries that have been attempted for this message. The count is
446
+ * incremented when a message lock expires, or the message is explicitly abandoned using the
447
+ * `abandon()` method on the message.
448
+ * @readonly
449
+ */
450
+ deliveryCount;
451
+ /**
452
+ * The UTC instant at which the message has been accepted and stored in Service Bus.
453
+ * @readonly
454
+ */
455
+ enqueuedTimeUtc;
456
+ /**
457
+ * The UTC instant at which the message is marked for removal and no longer available for
458
+ * retrieval from the entity due to expiration. This property is computed from 2 other properties
459
+ * on the message: `enqueuedTimeUtc` + `timeToLive`.
460
+ */
461
+ expiresAtUtc;
462
+ /**
463
+ * The UTC instant until which the message is held locked in the queue/subscription.
464
+ * When the lock expires, the `deliveryCount` is incremented and the message is again available
465
+ * for retrieval.
466
+ * - Not applicable when the message is received in `receiveAndDelete` receive mode.
467
+ * mode.
468
+ */
469
+ lockedUntilUtc;
470
+ /**
471
+ * The original sequence number of the message. For
472
+ * messages that have been auto-forwarded, this property reflects the sequence number that had
473
+ * first been assigned to the message at its original point of submission.
474
+ * @readonly
475
+ */
476
+ enqueuedSequenceNumber;
477
+ /**
478
+ * The unique number assigned to a message by Service Bus.
479
+ * The sequence number is a unique 64-bit integer assigned to a message as it is accepted
480
+ * and stored by the broker and functions as its true identifier. For partitioned entities,
481
+ * the topmost 16 bits reflect the partition identifier. Sequence numbers monotonically increase.
482
+ * They roll over to 0 when the 48-64 bit range is exhausted.
483
+ * @readonly
484
+ */
485
+ sequenceNumber;
486
+ /**
487
+ * The name of the queue or subscription that this message
488
+ * was enqueued on, before it was deadlettered. Only set in messages that have been dead-lettered
489
+ * and subsequently auto-forwarded from the dead-letter sub-queue to another entity. Indicates the
490
+ * entity in which the message was dead-lettered.
491
+ * @readonly
492
+ */
493
+ deadLetterSource;
494
+ /**
495
+ * State of the message can be active, deferred or scheduled. Deferred messages have deferred state,
496
+ * scheduled messages have scheduled state, all other messages have active state.
497
+ */
498
+ state;
499
+ /**
500
+ * The associated delivery of the received message.
501
+ */
502
+ delivery;
503
+ /**
504
+ * The underlying raw amqp annotated message.
505
+ * @readonly
506
+ */
507
+ _rawAmqpMessage;
508
+ /**
509
+ * The reason for deadlettering the message.
510
+ * @readonly
511
+ */
512
+ deadLetterReason;
513
+ /**
514
+ * The error description for deadlettering the message.
515
+ * @readonly
516
+ */
517
+ deadLetterErrorDescription;
323
518
  /**
324
519
  * @internal
325
520
  */
326
521
  constructor(msg, delivery, shouldReorderLockToken, receiveMode, skipParsingBodyAsJson, skipConvertingDate) {
327
- const _a = fromRheaMessage(msg, { skipParsingBodyAsJson, delivery, shouldReorderLockToken, skipConvertingDate }), { _rawAmqpMessage } = _a, restOfMessageProps = __rest(_a, ["_rawAmqpMessage"]);
522
+ const { _rawAmqpMessage, ...restOfMessageProps } = fromRheaMessage(msg, { skipParsingBodyAsJson, delivery, shouldReorderLockToken, skipConvertingDate });
328
523
  this._rawAmqpMessage = _rawAmqpMessage; // need to initialize _rawAmqpMessage property to make compiler happy
329
524
  Object.assign(this, restOfMessageProps);
330
525
  this.state = restOfMessageProps.state; // to suppress error TS2564: Property 'state' has no initializer and is not definitely assigned in the constructor.
@@ -392,7 +587,7 @@ function convertDatesToNumbers(thing) {
392
587
  { foo: new Date(), children: { nested: new Date() }}
393
588
  */
394
589
  if (typeof thing === "object" && isDefined(thing)) {
395
- const thingShallowCopy = Object.assign({}, thing);
590
+ const thingShallowCopy = { ...thing };
396
591
  for (const key of Object.keys(thingShallowCopy)) {
397
592
  thingShallowCopy[key] = convertDatesToNumbers(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I,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,EAAE,CAAC;YAC/C,gBAAwB,CAAC,GAAG,CAAC,GAAG,qBAAqB,CAAE,gBAAwB,CAAC,GAAG,CAAC,CAAC,CAAC;QACzF,CAAC;QACD,OAAO,gBAAgB,CAAC;IAC1B,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { AmqpAnnotatedMessage, Constants } from \"@azure/core-amqp\";\nimport { Buffer } from \"buffer\";\nimport Long from \"long\";\nimport type {\n Delivery,\n DeliveryAnnotations,\n MessageAnnotations,\n Message as RheaMessage,\n} from \"rhea-promise\";\nimport { uuid_to_string } from \"rhea-promise\";\nimport { defaultDataTransformer } from \"./dataTransformer.js\";\nimport { messageLogger as logger } from \"./log.js\";\nimport type { ReceiveMode } from \"./models.js\";\nimport { isDefined, isObjectWithProperties } from \"@azure/core-util\";\nimport { reorderLockToken } from \"./util/utils.js\";\n\n/**\n * @internal\n */\nexport enum DispositionType {\n complete = \"complete\",\n deadletter = \"deadletter\",\n abandon = \"abandon\",\n defer = \"defer\",\n}\n\n/**\n * @internal\n * Describes the delivery annotations for Service Bus.\n */\nexport interface ServiceBusDeliveryAnnotations extends DeliveryAnnotations {\n /**\n * The offset of the last event.\n */\n last_enqueued_offset?: string;\n /**\n * The sequence number of the last event.\n */\n last_enqueued_sequence_number?: number;\n /**\n * The enqueued time of the last event.\n */\n last_enqueued_time_utc?: number;\n /**\n * The retrieval time of the last event.\n */\n runtime_info_retrieval_time_utc?: number;\n /**\n * Any unknown delivery annotations.\n */\n [x: string]: any;\n}\n\n/**\n * @internal\n * Describes the message annotations for Service Bus.\n */\nexport interface ServiceBusMessageAnnotations extends MessageAnnotations {\n /**\n * Annotation for the partition key set for the event.\n */\n \"x-opt-partition-key\"?: string | null;\n /**\n * Annontation for the sequence number of the event.\n */\n \"x-opt-sequence-number\"?: number;\n /**\n * Annotation for the enqueued time of the event.\n */\n \"x-opt-enqueued-time\"?: number;\n /**\n * Annotation for the offset of the event.\n */\n \"x-opt-offset\"?: string;\n /**\n * Annotation for the message being locked until.\n */\n \"x-opt-locked-until\"?: Date | number;\n /**\n * Annotation for the message state.\n */\n \"x-opt-message-state\"?: number;\n}\n\n/**\n * Describes the reason and error description for dead lettering a message using the `deadLetter()`\n * method on the message received from Service Bus.\n */\nexport interface DeadLetterOptions {\n /**\n * The reason for deadlettering the message.\n */\n deadLetterReason: string;\n /**\n * The error description for deadlettering the message.\n */\n deadLetterErrorDescription: string;\n}\n\n/**\n * Describes the message to be sent to Service Bus.\n */\nexport interface ServiceBusMessage {\n /**\n * The message body that needs to be sent or is received.\n * If the application receiving the message is not using this SDK,\n * convert your body payload to a byte array or Buffer for better\n * cross-language compatibility.\n */\n body: any;\n /**\n * The message identifier is an\n * application-defined value that uniquely identifies the message and its payload.\n *\n * Note: Numbers that are not whole integers are not allowed.\n */\n messageId?: string | number | Buffer;\n /**\n * The content type of the message. Optionally describes\n * the payload of the message, with a descriptor following the format of RFC2045, Section 5, for\n * example \"application/json\".\n */\n contentType?: string;\n /**\n * The correlation identifier that allows an\n * application to specify a context for the message for the purposes of correlation, for example\n * reflecting the MessageId of a message that is being replied to.\n * See {@link https://learn.microsoft.com/azure/service-bus-messaging/service-bus-messages-payloads?#message-routing-and-correlation | Message Routing and Correlation}.\n */\n correlationId?: string | number | Buffer;\n /**\n * The partition key for sending a message to a partitioned entity.\n * Maximum length is 128 characters. For {@link https://learn.microsoft.com/azure/service-bus-messaging/service-bus-partitioning | partitioned entities},\n * setting this value enables assigning related messages to the same internal partition,\n * so that submission sequence order is correctly recorded. The partition is chosen by a hash\n * function over this value and cannot be chosen directly.\n * - For session-aware entities, the `sessionId` property overrides this value.\n * - For non partitioned entities, partition key will be ignored\n *\n */\n partitionKey?: string;\n /**\n * The partition key for sending a message into an entity\n * via a partitioned transfer queue. Maximum length is 128 characters. If a message is sent via a\n * transfer queue in the scope of a transaction, this value selects the transfer queue partition:\n * This is functionally equivalent to `partitionKey` property and ensures that messages are kept\n * together and in order as they are transferred.\n * See {@link https://learn.microsoft.com/azure/service-bus-messaging/service-bus-transactions#transfers-and-send-via | Transfers and Send Via}.\n */\n\n // Will be required later for implementing Transactions\n // viaPartitionKey?: string;\n\n /**\n * The session identifier for a session-aware entity. Maximum\n * length is 128 characters. For session-aware entities, this application-defined value specifies\n * the session affiliation of the message. Messages with the same session identifier are subject\n * to summary locking and enable exact in-order processing and demultiplexing. For\n * session-unaware entities, this value is ignored.\n * {@link https://learn.microsoft.com/azure/service-bus-messaging/message-sessions | Message Sessions}.\n */\n sessionId?: string;\n /**\n * The session identifier augmenting the `replyTo` address.\n * Maximum length is 128 characters. This value augments the ReplyTo information and specifies\n * which SessionId should be set for the reply when sent to the reply entity.\n * See {@link https://learn.microsoft.com/azure/service-bus-messaging/service-bus-messages-payloads?#message-routing-and-correlation | Message Routing and Correlation}.\n */\n replyToSessionId?: string;\n /**\n * The message’s time to live value. This value is the relative\n * duration after which the message expires, starting from the instant the message has been\n * accepted and stored by the broker, as captured in `enqueuedTimeUtc`. When not set explicitly,\n * the assumed value is the DefaultTimeToLive for the respective queue or topic. A message-level\n * `timeToLive` value cannot be longer than the entity's DefaultTimeToLive setting and it is\n * silently adjusted if it does. See\n * {@link https://learn.microsoft.com/azure/service-bus-messaging/message-expiration | Expiration}.\n */\n timeToLive?: number;\n /**\n * The application specific label. This property enables the\n * application to indicate the purpose of the message to the receiver in a standardized. fashion,\n * similar to an email subject line. The mapped AMQP property is \"subject\".\n */\n subject?: string;\n /**\n * The \"to\" address. This property is reserved for future use in routing\n * scenarios and presently ignored by the broker itself. Applications can use this value in\n * rule-driven {@link https://learn.microsoft.com/azure/service-bus-messaging/service-bus-auto-forwarding | auto-forward chaining}\n * scenarios to indicate the intended logical destination of the message.\n */\n to?: string;\n /**\n * The address of an entity to send replies to. This optional and\n * application-defined value is a standard way to express a reply path to the receiver of the\n * message. When a sender expects a reply, it sets the value to the absolute or relative path of\n * the queue or topic it expects the reply to be sent to. See\n * {@link https://learn.microsoft.com/azure/service-bus-messaging/service-bus-messages-payloads?#message-routing-and-correlation | Message Routing and Correlation}.\n */\n replyTo?: string;\n /**\n * The date and time in UTC at which the message will\n * be enqueued. This property returns the time in UTC; when setting the property, the\n * supplied DateTime value must also be in UTC. This value is for delayed message sending.\n * It is utilized to delay messages sending to a specific time in the future. Message enqueuing\n * time does not mean that the message will be sent at the same time. It will get enqueued,\n * but the actual sending time depends on the queue's workload and its state.\n */\n scheduledEnqueueTimeUtc?: Date;\n /**\n * The application specific properties which can be\n * used for custom message metadata.\n */\n applicationProperties?: { [key: string]: number | boolean | string | Date | null };\n}\n\n/**\n * @internal\n * Gets the error message for when a property on given message is not of expected type\n */\nexport function getMessagePropertyTypeMismatchError(msg: ServiceBusMessage): Error | undefined {\n if (msg.contentType != null && typeof msg.contentType !== \"string\") {\n return new TypeError(\"The property 'contentType' on the message must be of type 'string'\");\n }\n\n if (msg.subject != null && typeof msg.subject !== \"string\") {\n return new TypeError(\"The property 'label' on the message must be of type 'string'\");\n }\n\n if (msg.to != null && typeof msg.to !== \"string\") {\n return new TypeError(\"The property 'to' on the message must be of type 'string'\");\n }\n\n if (msg.replyTo != null && typeof msg.replyTo !== \"string\") {\n return new TypeError(\"The property 'replyTo' on the message must be of type 'string'\");\n }\n\n if (msg.replyToSessionId != null && typeof msg.replyToSessionId !== \"string\") {\n return new TypeError(\"The property 'replyToSessionId' on the message must be of type 'string'\");\n }\n\n if (msg.timeToLive != null && typeof msg.timeToLive !== \"number\") {\n return new TypeError(\"The property 'timeToLive' on the message must be of type 'number'\");\n }\n\n if (msg.sessionId != null && typeof msg.sessionId !== \"string\") {\n return new TypeError(\"The property 'sessionId' on the message must be of type 'string'\");\n }\n\n if (\n msg.messageId != null &&\n typeof msg.messageId !== \"string\" &&\n typeof msg.messageId !== \"number\" &&\n !Buffer.isBuffer(msg.messageId)\n ) {\n return new TypeError(\n \"The property 'messageId' on the message must be of type string, number or Buffer\",\n );\n }\n\n if (\n msg.correlationId != null &&\n typeof msg.correlationId !== \"string\" &&\n typeof msg.correlationId !== \"number\" &&\n !Buffer.isBuffer(msg.correlationId)\n ) {\n return new TypeError(\n \"The property 'correlationId' on the message must be of type string, number or Buffer\",\n );\n }\n return;\n}\n\n/**\n * @internal\n * Converts given ServiceBusMessage to RheaMessage\n */\nexport function toRheaMessage(\n msg: ServiceBusMessage | ServiceBusReceivedMessage | AmqpAnnotatedMessage,\n encoder: Pick<typeof defaultDataTransformer, \"encode\">,\n): RheaMessage {\n let amqpMsg: RheaMessage;\n if (isAmqpAnnotatedMessage(msg)) {\n amqpMsg = {\n ...AmqpAnnotatedMessage.toRheaMessage(msg),\n body: encoder.encode(msg.body, msg.bodyType ?? \"data\"),\n };\n } else {\n let bodyType: \"data\" | \"sequence\" | \"value\" = \"data\";\n\n if (isServiceBusReceivedMessage(msg)) {\n /*\n * TODO: this is a bit complicated.\n *\n * It seems reasonable to expect to be able to round-trip a message (ie,\n * receive a message, and then send it again, possibly to another queue / topic).\n * If the user does that we need to make sure to respect their original AMQP\n * type so when the message is re - encoded we don't put 'body' into the wrong spot.\n *\n * The complication is that we need to decide if we're okay with respecting a field\n * from the rawAmqpMessage, which up until now we've treated as just vestigial\n * information on send. My hope is that the use case of \"alter the sb message in some\n * incompatible way with the underying _rawAmqpMessage.bodyType\" is not common\n * enough for us to try to do anything more than what I'm doing here.\n */\n bodyType = msg._rawAmqpMessage.bodyType ?? \"data\";\n }\n\n // TODO: it seems sensible that we'd also do this for AMQPAnnotated message.\n const validationError = getMessagePropertyTypeMismatchError(msg);\n\n if (validationError) {\n throw validationError;\n }\n\n amqpMsg = {\n body: encoder.encode(msg.body, bodyType),\n message_annotations: {},\n };\n\n if (msg.timeToLive) {\n amqpMsg.ttl = Math.min(msg.timeToLive, Constants.maxUint32Value);\n amqpMsg.creation_time = new Date();\n amqpMsg.absolute_expiry_time = new Date(\n Math.min(amqpMsg.creation_time.getTime() + amqpMsg.ttl, Constants.maxAbsoluteExpiryTime),\n );\n }\n }\n\n if (isAmqpAnnotatedMessage(msg)) {\n return amqpMsg;\n }\n\n if (msg.applicationProperties != null) {\n amqpMsg.application_properties = msg.applicationProperties;\n }\n if (msg.contentType != null) {\n amqpMsg.content_type = msg.contentType;\n }\n if (msg.sessionId != null) {\n if (msg.sessionId.length > Constants.maxSessionIdLength) {\n throw new Error(\n \"Length of 'sessionId' property on the message cannot be greater than 128 characters.\",\n );\n }\n\n amqpMsg.group_id = msg.sessionId;\n }\n if (msg.replyTo != null) {\n amqpMsg.reply_to = msg.replyTo;\n }\n if (msg.to != null) {\n amqpMsg.to = msg.to;\n }\n if (msg.subject != null) {\n amqpMsg.subject = msg.subject;\n }\n\n updateMessageId(amqpMsg, msg.messageId);\n\n if (msg.correlationId != null) {\n amqpMsg.correlation_id = msg.correlationId;\n }\n if (msg.replyToSessionId != null) {\n amqpMsg.reply_to_group_id = msg.replyToSessionId;\n }\n if (msg.partitionKey != null) {\n if (msg.partitionKey.length > Constants.maxPartitionKeyLength) {\n throw new Error(\n \"Length of 'partitionKey' property on the message cannot be greater than 128 characters.\",\n );\n }\n amqpMsg.message_annotations![Constants.partitionKey] = msg.partitionKey;\n }\n\n // Will be required later for implementing Transactions\n // if (msg.viaPartitionKey != null) {\n // if (msg.viaPartitionKey.length > Constants.maxPartitionKeyLength) {\n // throw new Error(\n // \"Length of 'viaPartitionKey' property on the message cannot be greater than 128 characters.\"\n // );\n // }\n // amqpMsg.message_annotations![Constants.viaPartitionKey] = msg.viaPartitionKey;\n // }\n\n updateScheduledTime(amqpMsg, msg.scheduledEnqueueTimeUtc);\n\n logger.verbose(\"SBMessage to RheaMessage: %O\", amqpMsg);\n return amqpMsg;\n}\n\n/** @internal */\nexport function updateMessageId(\n rheaMessage: RheaMessage,\n messageId: RheaMessage[\"message_id\"],\n): void {\n if (messageId != null) {\n if (typeof messageId === \"string\" && messageId.length > Constants.maxMessageIdLength) {\n throw new Error(\n `Length of 'messageId' property on the message cannot be greater than ${Constants.maxMessageIdLength} characters.`,\n );\n }\n\n rheaMessage.message_id = messageId;\n }\n}\n\n/** @internal */\nexport function updateScheduledTime(\n rheaMessage: RheaMessage,\n scheduledEnqueuedTimeUtc: Date | undefined,\n): void {\n if (scheduledEnqueuedTimeUtc != null) {\n rheaMessage.message_annotations = rheaMessage.message_annotations ?? {};\n rheaMessage.message_annotations[Constants.scheduledEnqueueTime] = scheduledEnqueuedTimeUtc;\n }\n}\n\n/**\n * Describes the message received from Service Bus during peek operations and so cannot be settled.\n */\nexport interface ServiceBusReceivedMessage extends ServiceBusMessage {\n /**\n * The reason for deadlettering the message.\n * @readonly\n */\n readonly deadLetterReason?: string;\n /**\n * The error description for deadlettering the message.\n * @readonly\n */\n readonly deadLetterErrorDescription?: string;\n /**\n * The lock token is a reference to the lock that is being held by the broker in\n * `peekLock` receive mode. Locks are used internally settle messages as explained in the\n * {@link https://learn.microsoft.com/azure/service-bus-messaging/message-transfers-locks-settlement | product documentation in more detail}\n * - Not applicable when the message is received in `receiveAndDelete` receive mode.\n * mode.\n * @readonly\n */\n readonly lockToken?: string;\n /**\n * Number of deliveries that have been attempted for this message. The count is\n * incremented when a message lock expires, or the message is explicitly abandoned using the\n * `abandon()` method on the message.\n * @readonly\n */\n readonly deliveryCount?: number;\n /**\n * The UTC instant at which the message has been accepted and stored in Service Bus.\n * @readonly\n */\n readonly enqueuedTimeUtc?: Date;\n /**\n * The UTC instant at which the message is marked for removal and no longer available for\n * retrieval from the entity due to expiration. This property is computed from 2 other properties\n * on the message: `enqueuedTimeUtc` + `timeToLive`.\n */\n readonly expiresAtUtc?: Date;\n /**\n * The UTC instant until which the message is held locked in the queue/subscription.\n * When the lock expires, the `deliveryCount` is incremented and the message is again available\n * for retrieval.\n * - Not applicable when the message is received in `receiveAndDelete` receive mode.\n * mode.\n */\n lockedUntilUtc?: Date;\n /**\n * The original sequence number of the message. For\n * messages that have been auto-forwarded, this property reflects the sequence number that had\n * first been assigned to the message at its original point of submission.\n * @readonly\n */\n readonly enqueuedSequenceNumber?: number;\n /**\n * The unique number assigned to a message by Service Bus.\n * The sequence number is a unique 64-bit integer assigned to a message as it is accepted\n * and stored by the broker and functions as its true identifier. For partitioned entities,\n * the topmost 16 bits reflect the partition identifier. Sequence numbers monotonically increase.\n * They roll over to 0 when the 48-64 bit range is exhausted.\n *\n * **Max safe integer** that Javascript currently supports is `2^53 - 1`. The sequence number\n * is an AMQP `Long` type which can be upto 64 bits long. To represent that we are using a\n * library named {@link https://github.com/dcodeIO/long.js | long.js}. We expect customers\n * to use the **`Long`** type exported by this library.\n * @readonly\n */\n readonly sequenceNumber?: Long;\n /**\n * The name of the queue or subscription that this message\n * was enqueued on, before it was deadlettered. Only set in messages that have been dead-lettered\n * and subsequently auto-forwarded from the dead-letter sub-queue to another entity. Indicates the\n * entity in which the message was dead-lettered.\n * @readonly\n */\n readonly deadLetterSource?: string;\n /**\n * State of the message can be active, deferred or scheduled. Deferred messages have deferred state,\n * scheduled messages have scheduled state, all other messages have active state.\n */\n readonly state: \"active\" | \"deferred\" | \"scheduled\";\n /**\n * The underlying raw amqp message.\n * @readonly\n */\n readonly _rawAmqpMessage: AmqpAnnotatedMessage;\n}\n\n/**\n * @internal\n * Converts given RheaMessage to ServiceBusReceivedMessage\n */\nexport function fromRheaMessage(\n rheaMessage: RheaMessage,\n options: {\n skipParsingBodyAsJson: boolean;\n skipConvertingDate?: boolean;\n delivery?: Delivery;\n shouldReorderLockToken?: boolean;\n },\n): ServiceBusReceivedMessage {\n if (!rheaMessage) {\n rheaMessage = {\n body: undefined,\n };\n }\n const {\n skipParsingBodyAsJson,\n delivery,\n shouldReorderLockToken,\n skipConvertingDate = false,\n } = options;\n const { body, bodyType } = defaultDataTransformer.decodeWithType(\n rheaMessage.body,\n skipParsingBodyAsJson,\n );\n\n const sbmsg: ServiceBusMessage = {\n body: body,\n };\n\n if (rheaMessage.application_properties != null) {\n sbmsg.applicationProperties = skipConvertingDate\n ? rheaMessage.application_properties\n : convertDatesToNumbers(rheaMessage.application_properties);\n }\n if (rheaMessage.content_type != null) {\n sbmsg.contentType = rheaMessage.content_type;\n }\n if (rheaMessage.group_id != null) {\n sbmsg.sessionId = rheaMessage.group_id;\n }\n if (rheaMessage.reply_to != null) {\n sbmsg.replyTo = rheaMessage.reply_to;\n }\n if (rheaMessage.to != null) {\n sbmsg.to = rheaMessage.to;\n }\n if (rheaMessage.subject != null) {\n sbmsg.subject = rheaMessage.subject;\n }\n if (rheaMessage.message_id != null) {\n sbmsg.messageId = rheaMessage.message_id;\n }\n if (rheaMessage.correlation_id != null) {\n sbmsg.correlationId = rheaMessage.correlation_id;\n }\n if (rheaMessage.reply_to_group_id != null) {\n sbmsg.replyToSessionId = rheaMessage.reply_to_group_id;\n }\n\n if (rheaMessage.message_annotations != null) {\n if (rheaMessage.message_annotations[Constants.partitionKey] != null) {\n sbmsg.partitionKey = rheaMessage.message_annotations[Constants.partitionKey];\n }\n\n // Will be required later for implementing Transactions\n // if (msg.message_annotations[Constants.viaPartitionKey] != null) {\n // sbmsg.viaPartitionKey = msg.message_annotations[Constants.viaPartitionKey];\n // }\n\n if (rheaMessage.message_annotations[Constants.scheduledEnqueueTime] != null) {\n sbmsg.scheduledEnqueueTimeUtc =\n rheaMessage.message_annotations[Constants.scheduledEnqueueTime];\n }\n }\n\n type PartialWritable<T> = Partial<{\n -readonly [P in keyof T]: T[P];\n }>;\n const props: PartialWritable<ServiceBusReceivedMessage> & {\n state: \"active\" | \"deferred\" | \"scheduled\";\n } = { state: \"active\" };\n if (rheaMessage.message_annotations != null) {\n if (rheaMessage.message_annotations[Constants.deadLetterSource] != null) {\n props.deadLetterSource = rheaMessage.message_annotations[Constants.deadLetterSource];\n }\n const messageState = rheaMessage.message_annotations[Constants.messageState];\n if (messageState === 1) {\n props.state = \"deferred\";\n } else if (messageState === 2) {\n props.state = \"scheduled\";\n }\n if (rheaMessage.message_annotations[Constants.enqueueSequenceNumber] != null) {\n props.enqueuedSequenceNumber =\n rheaMessage.message_annotations[Constants.enqueueSequenceNumber];\n }\n if (rheaMessage.message_annotations[Constants.sequenceNumber] != null) {\n if (Buffer.isBuffer(rheaMessage.message_annotations[Constants.sequenceNumber])) {\n props.sequenceNumber = Long.fromBytesBE(\n rheaMessage.message_annotations[Constants.sequenceNumber],\n );\n } else {\n props.sequenceNumber = Long.fromNumber(\n rheaMessage.message_annotations[Constants.sequenceNumber],\n );\n }\n }\n if (rheaMessage.message_annotations[Constants.enqueuedTime] != null) {\n props.enqueuedTimeUtc = new Date(\n rheaMessage.message_annotations[Constants.enqueuedTime] as number,\n );\n }\n if (rheaMessage.message_annotations[Constants.lockedUntil] != null) {\n props.lockedUntilUtc = new Date(\n rheaMessage.message_annotations[Constants.lockedUntil] as number,\n );\n }\n }\n\n const rawMessage = AmqpAnnotatedMessage.fromRheaMessage(rheaMessage);\n rawMessage.bodyType = bodyType;\n if (rheaMessage.ttl == null) {\n rheaMessage.ttl = rawMessage.header?.timeToLive ?? Constants.maxDurationValue;\n }\n if (props.enqueuedTimeUtc) {\n props.expiresAtUtc = new Date(\n Math.min(props.enqueuedTimeUtc.getTime() + rheaMessage.ttl, Constants.maxDurationValue),\n );\n }\n\n if (rawMessage.applicationProperties) {\n rawMessage.applicationProperties = skipConvertingDate\n ? rawMessage.applicationProperties\n : convertDatesToNumbers(rawMessage.applicationProperties);\n }\n if (rawMessage.deliveryAnnotations) {\n rawMessage.deliveryAnnotations = skipConvertingDate\n ? rawMessage.deliveryAnnotations\n : convertDatesToNumbers(rawMessage.deliveryAnnotations);\n }\n if (rawMessage.messageAnnotations) {\n rawMessage.messageAnnotations = skipConvertingDate\n ? rawMessage.messageAnnotations\n : convertDatesToNumbers(rawMessage.messageAnnotations);\n }\n\n if (rawMessage.header?.timeToLive) {\n sbmsg.timeToLive = rawMessage.header.timeToLive;\n }\n\n const rcvdsbmsg: ServiceBusReceivedMessage = {\n _rawAmqpMessage: rawMessage,\n deliveryCount: rheaMessage.delivery_count,\n lockToken:\n delivery && delivery.tag && delivery.tag.length !== 0\n ? uuid_to_string(\n shouldReorderLockToken === true\n ? reorderLockToken(\n typeof delivery.tag === \"string\" ? Buffer.from(delivery.tag) : delivery.tag,\n )\n : typeof delivery.tag === \"string\"\n ? Buffer.from(delivery.tag)\n : delivery.tag,\n )\n : undefined,\n ...sbmsg,\n ...props,\n deadLetterReason: sbmsg.applicationProperties?.DeadLetterReason as string | undefined,\n deadLetterErrorDescription: sbmsg.applicationProperties?.DeadLetterErrorDescription as\n | string\n | undefined,\n };\n\n logger.verbose(\"AmqpMessage to ServiceBusReceivedMessage: %O\", rcvdsbmsg);\n return rcvdsbmsg;\n}\n\n/**\n * @internal\n */\nexport function isServiceBusMessage(possible: unknown): possible is ServiceBusMessage {\n return isObjectWithProperties(possible, [\"body\"]);\n}\n\n/**\n * @internal\n */\nexport function isAmqpAnnotatedMessage(possible: unknown): possible is AmqpAnnotatedMessage {\n return (\n isObjectWithProperties(possible, [\"body\", \"bodyType\"]) &&\n possible.constructor.name !== ServiceBusMessageImpl.name\n );\n}\n\n/**\n * @internal\n */\nexport function isServiceBusReceivedMessage(\n possible: unknown,\n): possible is ServiceBusReceivedMessage {\n return isServiceBusMessage(possible) && \"_rawAmqpMessage\" in possible;\n}\n\n/**\n * Describes the message received from Service Bus.\n *\n * @internal\n */\nexport class ServiceBusMessageImpl implements ServiceBusReceivedMessage {\n /**\n * The message body that needs to be sent or is received.\n */\n body: any;\n /**\n * The application specific properties.\n */\n applicationProperties?: { [key: string]: any };\n /**\n * The message identifier is an\n * application-defined value that uniquely identifies the message and its payload. The identifier\n * is a free-form string and can reflect a GUID or an identifier derived from the application\n * context. If enabled, the\n * {@link https://learn.microsoft.com/azure/service-bus-messaging/duplicate-detection | duplicate detection}\n * identifies and removes second and further submissions of messages with the same MessageId.\n */\n messageId?: string | number | Buffer;\n /**\n * The content type of the message. Optionally describes\n * the payload of the message, with a descriptor following the format of RFC2045, Section 5, for\n * example \"application/json\".\n */\n contentType?: string;\n /**\n * The correlation identifier that allows an\n * application to specify a context for the message for the purposes of correlation, for example\n * reflecting the MessageId of a message that is being replied to.\n * See {@link https://learn.microsoft.com/azure/service-bus-messaging/service-bus-messages-payloads?#message-routing-and-correlation | Message Routing and Correlation}.\n */\n correlationId?: string | number | Buffer;\n /**\n * The partition key for sending a message to a\n * partitioned entity. Maximum length is 128 characters. For {@link https://learn.microsoft.com/azure/service-bus-messaging/service-bus-partitioning | partitioned entities},\n * setting this value enables assigning related messages to the same internal partition,\n * so that submission sequence order is correctly recorded. The partition is chosen by a hash\n * function over this value and cannot be chosen directly. For session-aware entities,\n * the `sessionId` property overrides this value.\n */\n partitionKey?: string;\n /**\n * The partition key for sending a message into an entity\n * via a partitioned transfer queue. Maximum length is 128 characters. If a message is sent via a\n * transfer queue in the scope of a transaction, this value selects the transfer queue partition:\n * This is functionally equivalent to `partitionKey` property and ensures that messages are kept\n * together and in order as they are transferred.\n * See {@link https://learn.microsoft.com/azure/service-bus-messaging/service-bus-transactions#transfers-and-send-via | Transfers and Send Via}.\n */\n // Will be required later for implementing Transactions\n // viaPartitionKey?: string;\n /**\n * The session identifier for a session-aware entity. Maximum\n * length is 128 characters. For session-aware entities, this application-defined value specifies\n * the session affiliation of the message. Messages with the same session identifier are subject\n * to summary locking and enable exact in-order processing and demultiplexing. For\n * session-unaware entities, this value is ignored.\n * {@link https://learn.microsoft.com/azure/service-bus-messaging/message-sessions | Message Sessions}.\n */\n sessionId?: string;\n /**\n * The session identifier augmenting the `replyTo` address.\n * Maximum length is 128 characters. This value augments the ReplyTo information and specifies\n * which SessionId should be set for the reply when sent to the reply entity.\n * See {@link https://learn.microsoft.com/azure/service-bus-messaging/service-bus-messages-payloads?#message-routing-and-correlation | Message Routing and Correlation}.\n */\n replyToSessionId?: string;\n /**\n * The message’s time to live value. This value is the relative\n * duration after which the message expires, starting from the instant the message has been\n * accepted and stored by the broker, as captured in `enqueuedTimeUtc`. When not set explicitly,\n * the assumed value is the DefaultTimeToLive for the respective queue or topic. A message-level\n * `timeToLive` value cannot be longer than the entity's DefaultTimeToLive setting and it is\n * silently adjusted if it does. See\n * {@link https://learn.microsoft.com/azure/service-bus-messaging/message-expiration | Expiration}.\n */\n timeToLive?: number;\n /**\n * The application specific label. This property enables the\n * application to indicate the purpose of the message to the receiver in a standardized. fashion,\n * similar to an email subject line. The mapped AMQP property is \"subject\".\n */\n subject?: string;\n /**\n * The \"to\" address. This property is reserved for future use in routing\n * scenarios and presently ignored by the broker itself. Applications can use this value in\n * rule-driven {@link https://learn.microsoft.com/azure/service-bus-messaging/service-bus-auto-forwarding | auto-forward chaining}\n * scenarios to indicate the intended logical destination of the message.\n */\n to?: string;\n /**\n * The address of an entity to send replies to. This optional and\n * application-defined value is a standard way to express a reply path to the receiver of the\n * message. When a sender expects a reply, it sets the value to the absolute or relative path of\n * the queue or topic it expects the reply to be sent to. See\n * {@link https://learn.microsoft.com/azure/service-bus-messaging/service-bus-messages-payloads?#message-routing-and-correlation | Message Routing and Correlation}.\n */\n replyTo?: string;\n /**\n * The date and time in UTC at which the message will\n * be enqueued. This property returns the time in UTC; when setting the property, the\n * supplied DateTime value must also be in UTC. This value is for delayed message sending.\n * It is utilized to delay messages sending to a specific time in the future. Message enqueuing\n * time does not mean that the message will be sent at the same time. It will get enqueued,\n * but the actual sending time depends on the queue's workload and its state.\n */\n scheduledEnqueueTimeUtc?: Date;\n /**\n * The lock token is a reference to the lock that is being held by the broker in\n * `peekLock` receive mode. Locks are used internally settle messages as explained in the\n * {@link https://learn.microsoft.com/azure/service-bus-messaging/message-transfers-locks-settlement | product documentation in more detail}\n * - Not applicable when the message is received in `receiveAndDelete` receive mode.\n * mode.\n * @readonly\n */\n readonly lockToken?: string;\n /**\n * Number of deliveries that have been attempted for this message. The count is\n * incremented when a message lock expires, or the message is explicitly abandoned using the\n * `abandon()` method on the message.\n * @readonly\n */\n readonly deliveryCount?: number;\n /**\n * The UTC instant at which the message has been accepted and stored in Service Bus.\n * @readonly\n */\n readonly enqueuedTimeUtc?: Date;\n /**\n * The UTC instant at which the message is marked for removal and no longer available for\n * retrieval from the entity due to expiration. This property is computed from 2 other properties\n * on the message: `enqueuedTimeUtc` + `timeToLive`.\n */\n readonly expiresAtUtc?: Date;\n /**\n * The UTC instant until which the message is held locked in the queue/subscription.\n * When the lock expires, the `deliveryCount` is incremented and the message is again available\n * for retrieval.\n * - Not applicable when the message is received in `receiveAndDelete` receive mode.\n * mode.\n */\n lockedUntilUtc?: Date;\n /**\n * The original sequence number of the message. For\n * messages that have been auto-forwarded, this property reflects the sequence number that had\n * first been assigned to the message at its original point of submission.\n * @readonly\n */\n readonly enqueuedSequenceNumber?: number;\n /**\n * The unique number assigned to a message by Service Bus.\n * The sequence number is a unique 64-bit integer assigned to a message as it is accepted\n * and stored by the broker and functions as its true identifier. For partitioned entities,\n * the topmost 16 bits reflect the partition identifier. Sequence numbers monotonically increase.\n * They roll over to 0 when the 48-64 bit range is exhausted.\n * @readonly\n */\n readonly sequenceNumber?: Long;\n /**\n * The name of the queue or subscription that this message\n * was enqueued on, before it was deadlettered. Only set in messages that have been dead-lettered\n * and subsequently auto-forwarded from the dead-letter sub-queue to another entity. Indicates the\n * entity in which the message was dead-lettered.\n * @readonly\n */\n readonly deadLetterSource?: string;\n /**\n * State of the message can be active, deferred or scheduled. Deferred messages have deferred state,\n * scheduled messages have scheduled state, all other messages have active state.\n */\n readonly state: \"active\" | \"deferred\" | \"scheduled\";\n /**\n * The associated delivery of the received message.\n */\n readonly delivery: Delivery;\n /**\n * The underlying raw amqp annotated message.\n * @readonly\n */\n readonly _rawAmqpMessage: AmqpAnnotatedMessage;\n /**\n * The reason for deadlettering the message.\n * @readonly\n */\n readonly deadLetterReason?: string;\n /**\n * The error description for deadlettering the message.\n * @readonly\n */\n readonly deadLetterErrorDescription?: string;\n /**\n * @internal\n */\n constructor(\n msg: RheaMessage,\n delivery: Delivery,\n shouldReorderLockToken: boolean,\n receiveMode: ReceiveMode,\n skipParsingBodyAsJson: boolean,\n skipConvertingDate: boolean,\n ) {\n const { _rawAmqpMessage, ...restOfMessageProps } = fromRheaMessage(\n msg,\n\n { skipParsingBodyAsJson, delivery, shouldReorderLockToken, skipConvertingDate },\n );\n this._rawAmqpMessage = _rawAmqpMessage; // need to initialize _rawAmqpMessage property to make compiler happy\n Object.assign(this, restOfMessageProps);\n this.state = restOfMessageProps.state; // to suppress error TS2564: Property 'state' has no initializer and is not definitely assigned in the constructor.\n\n // Lock on a message is applicable only in peekLock mode, but the service sets\n // the lock token even in receiveAndDelete mode if the entity in question is partitioned.\n if (receiveMode === \"receiveAndDelete\") {\n this.lockToken = undefined;\n }\n this.delivery = delivery;\n }\n\n /**\n * Creates a clone of the current message to allow it to be re-sent to the queue\n * @returns ServiceBusMessage\n */\n clone(): ServiceBusMessage {\n // We are returning a ServiceBusMessage object because that object can then be sent to Service Bus\n const clone: ServiceBusMessage = {\n body: this.body,\n contentType: this.contentType,\n correlationId: this.correlationId,\n subject: this.subject,\n messageId: this.messageId,\n partitionKey: this.partitionKey,\n replyTo: this.replyTo,\n replyToSessionId: this.replyToSessionId,\n scheduledEnqueueTimeUtc: this.scheduledEnqueueTimeUtc,\n sessionId: this.sessionId,\n timeToLive: this.timeToLive,\n to: this.to,\n applicationProperties: this.applicationProperties,\n // Will be required later for implementing Transactions\n // viaPartitionKey: this.viaPartitionKey\n };\n\n return clone;\n }\n}\n\n/**\n * Converts any Date objects into a number representing date.getTime().\n * Recursively checks for any Date objects in arrays and objects.\n * @internal\n */\nfunction convertDatesToNumbers<T = unknown>(thing: T): T {\n // fast exit\n if (!isDefined(thing)) return thing;\n\n // When 'thing' is a Date, return the number representation\n if (\n typeof thing === \"object\" &&\n isObjectWithProperties(thing, [\"getTime\"]) &&\n typeof thing.getTime === \"function\"\n ) {\n return thing.getTime();\n }\n\n /*\n Examples:\n [0, 'foo', new Date(), { nested: new Date()}]\n */\n if (Array.isArray(thing)) {\n const result = [];\n for (const element of thing) {\n result.push(convertDatesToNumbers(element));\n }\n return result as unknown as T;\n }\n\n /*\n Examples:\n { foo: new Date(), children: { nested: new Date() }}\n */\n if (typeof thing === \"object\" && isDefined<object>(thing)) {\n const thingShallowCopy = { ...thing };\n for (const key of Object.keys(thingShallowCopy)) {\n (thingShallowCopy as any)[key] = convertDatesToNumbers((thingShallowCopy as any)[key]);\n }\n return thingShallowCopy;\n }\n\n return thing;\n}\n"]}
1
+ {"version":3,"file":"serviceBusMessage.js","sourceRoot":"","sources":["../../src/serviceBusMessage.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,IAAI,MAAM,MAAM,CAAC;AAOxB,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,aAAa,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAEnD,OAAO,EAAE,SAAS,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEnD;;GAEG;AACH,MAAM,CAAN,IAAY,eAKX;AALD,WAAY,eAAe;IACzB,wCAAqB,CAAA;IACrB,4CAAyB,CAAA;IACzB,sCAAmB,CAAA;IACnB,kCAAe,CAAA;AACjB,CAAC,EALW,eAAe,KAAf,eAAe,QAK1B;AAgMD;;;GAGG;AACH,MAAM,UAAU,mCAAmC,CAAC,GAAsB;IACxE,IAAI,GAAG,CAAC,WAAW,IAAI,IAAI,IAAI,OAAO,GAAG,CAAC,WAAW,KAAK,QAAQ,EAAE,CAAC;QACnE,OAAO,IAAI,SAAS,CAAC,oEAAoE,CAAC,CAAC;IAC7F,CAAC;IAED,IAAI,GAAG,CAAC,OAAO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B,CAAE,gBAAwB,CAAC,GAAG,CAAC,CAAC,CAAC;QACzF,CAAC;QACD,OAAO,gBAAgB,CAAC;IAC1B,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { AmqpAnnotatedMessage, Constants } from \"@azure/core-amqp\";\nimport { Buffer } from \"buffer\";\nimport Long from \"long\";\nimport type {\n Delivery,\n DeliveryAnnotations,\n MessageAnnotations,\n Message as RheaMessage,\n} from \"rhea-promise\";\nimport { uuid_to_string } from \"rhea-promise\";\nimport { defaultDataTransformer } from \"./dataTransformer.js\";\nimport { messageLogger as logger } from \"./log.js\";\nimport type { ReceiveMode } from \"./models.js\";\nimport { isDefined, isObjectWithProperties } from \"@azure/core-util\";\nimport { reorderLockToken } from \"./util/utils.js\";\n\n/**\n * @internal\n */\nexport enum DispositionType {\n complete = \"complete\",\n deadletter = \"deadletter\",\n abandon = \"abandon\",\n defer = \"defer\",\n}\n\n/**\n * @internal\n * Describes the delivery annotations for Service Bus.\n */\nexport interface ServiceBusDeliveryAnnotations extends DeliveryAnnotations {\n /**\n * The offset of the last event.\n */\n last_enqueued_offset?: string;\n /**\n * The sequence number of the last event.\n */\n last_enqueued_sequence_number?: number;\n /**\n * The enqueued time of the last event.\n */\n last_enqueued_time_utc?: number;\n /**\n * The retrieval time of the last event.\n */\n runtime_info_retrieval_time_utc?: number;\n /**\n * Any unknown delivery annotations.\n */\n [x: string]: any;\n}\n\n/**\n * @internal\n * Describes the message annotations for Service Bus.\n */\nexport interface ServiceBusMessageAnnotations extends MessageAnnotations {\n /**\n * Annotation for the partition key set for the event.\n */\n \"x-opt-partition-key\"?: string | null;\n /**\n * Annontation for the sequence number of the event.\n */\n \"x-opt-sequence-number\"?: number;\n /**\n * Annotation for the enqueued time of the event.\n */\n \"x-opt-enqueued-time\"?: number;\n /**\n * Annotation for the offset of the event.\n */\n \"x-opt-offset\"?: string;\n /**\n * Annotation for the message being locked until.\n */\n \"x-opt-locked-until\"?: Date | number;\n /**\n * Annotation for the message state.\n */\n \"x-opt-message-state\"?: number;\n}\n\n/**\n * Describes the reason and error description for dead lettering a message using the `deadLetter()`\n * method on the message received from Service Bus.\n */\nexport interface DeadLetterOptions {\n /**\n * The reason for deadlettering the message.\n */\n deadLetterReason: string;\n /**\n * The error description for deadlettering the message.\n */\n deadLetterErrorDescription: string;\n}\n\n/**\n * Describes the message to be sent to Service Bus.\n */\nexport interface ServiceBusMessage {\n /**\n * The message body that needs to be sent or is received.\n * If the application receiving the message is not using this SDK,\n * convert your body payload to a byte array or Buffer for better\n * cross-language compatibility.\n */\n body: any;\n /**\n * The message identifier is an\n * application-defined value that uniquely identifies the message and its payload.\n *\n * Note: Numbers that are not whole integers are not allowed.\n */\n messageId?: string | number | Buffer;\n /**\n * The content type of the message. Optionally describes\n * the payload of the message, with a descriptor following the format of RFC2045, Section 5, for\n * example \"application/json\".\n */\n contentType?: string;\n /**\n * The correlation identifier that allows an\n * application to specify a context for the message for the purposes of correlation, for example\n * reflecting the MessageId of a message that is being replied to.\n * See {@link https://learn.microsoft.com/azure/service-bus-messaging/service-bus-messages-payloads?#message-routing-and-correlation | Message Routing and Correlation}.\n */\n correlationId?: string | number | Buffer;\n /**\n * The partition key for sending a message to a partitioned entity.\n * Maximum length is 128 characters. For {@link https://learn.microsoft.com/azure/service-bus-messaging/service-bus-partitioning | partitioned entities},\n * setting this value enables assigning related messages to the same internal partition,\n * so that submission sequence order is correctly recorded. The partition is chosen by a hash\n * function over this value and cannot be chosen directly.\n * - For session-aware entities, the `sessionId` property overrides this value.\n * - For non partitioned entities, partition key will be ignored\n *\n */\n partitionKey?: string;\n /**\n * The partition key for sending a message into an entity\n * via a partitioned transfer queue. Maximum length is 128 characters. If a message is sent via a\n * transfer queue in the scope of a transaction, this value selects the transfer queue partition:\n * This is functionally equivalent to `partitionKey` property and ensures that messages are kept\n * together and in order as they are transferred.\n * See {@link https://learn.microsoft.com/azure/service-bus-messaging/service-bus-transactions#transfers-and-send-via | Transfers and Send Via}.\n */\n\n // Will be required later for implementing Transactions\n // viaPartitionKey?: string;\n\n /**\n * The session identifier for a session-aware entity. Maximum\n * length is 128 characters. For session-aware entities, this application-defined value specifies\n * the session affiliation of the message. Messages with the same session identifier are subject\n * to summary locking and enable exact in-order processing and demultiplexing. For\n * session-unaware entities, this value is ignored.\n * {@link https://learn.microsoft.com/azure/service-bus-messaging/message-sessions | Message Sessions}.\n */\n sessionId?: string;\n /**\n * The session identifier augmenting the `replyTo` address.\n * Maximum length is 128 characters. This value augments the ReplyTo information and specifies\n * which SessionId should be set for the reply when sent to the reply entity.\n * See {@link https://learn.microsoft.com/azure/service-bus-messaging/service-bus-messages-payloads?#message-routing-and-correlation | Message Routing and Correlation}.\n */\n replyToSessionId?: string;\n /**\n * The message’s time to live value. This value is the relative\n * duration after which the message expires, starting from the instant the message has been\n * accepted and stored by the broker, as captured in `enqueuedTimeUtc`. When not set explicitly,\n * the assumed value is the DefaultTimeToLive for the respective queue or topic. A message-level\n * `timeToLive` value cannot be longer than the entity's DefaultTimeToLive setting and it is\n * silently adjusted if it does. See\n * {@link https://learn.microsoft.com/azure/service-bus-messaging/message-expiration | Expiration}.\n */\n timeToLive?: number;\n /**\n * The application specific label. This property enables the\n * application to indicate the purpose of the message to the receiver in a standardized. fashion,\n * similar to an email subject line. The mapped AMQP property is \"subject\".\n */\n subject?: string;\n /**\n * The \"to\" address. This property is reserved for future use in routing\n * scenarios and presently ignored by the broker itself. Applications can use this value in\n * rule-driven {@link https://learn.microsoft.com/azure/service-bus-messaging/service-bus-auto-forwarding | auto-forward chaining}\n * scenarios to indicate the intended logical destination of the message.\n */\n to?: string;\n /**\n * The address of an entity to send replies to. This optional and\n * application-defined value is a standard way to express a reply path to the receiver of the\n * message. When a sender expects a reply, it sets the value to the absolute or relative path of\n * the queue or topic it expects the reply to be sent to. See\n * {@link https://learn.microsoft.com/azure/service-bus-messaging/service-bus-messages-payloads?#message-routing-and-correlation | Message Routing and Correlation}.\n */\n replyTo?: string;\n /**\n * The date and time in UTC at which the message will\n * be enqueued. This property returns the time in UTC; when setting the property, the\n * supplied DateTime value must also be in UTC. This value is for delayed message sending.\n * It is utilized to delay messages sending to a specific time in the future. Message enqueuing\n * time does not mean that the message will be sent at the same time. It will get enqueued,\n * but the actual sending time depends on the queue's workload and its state.\n */\n scheduledEnqueueTimeUtc?: Date;\n /**\n * The application specific properties which can be\n * used for custom message metadata.\n */\n applicationProperties?: { [key: string]: number | boolean | string | Date | null };\n}\n\n/**\n * @internal\n * Gets the error message for when a property on given message is not of expected type\n */\nexport function getMessagePropertyTypeMismatchError(msg: ServiceBusMessage): Error | undefined {\n if (msg.contentType != null && typeof msg.contentType !== \"string\") {\n return new TypeError(\"The property 'contentType' on the message must be of type 'string'\");\n }\n\n if (msg.subject != null && typeof msg.subject !== \"string\") {\n return new TypeError(\"The property 'label' on the message must be of type 'string'\");\n }\n\n if (msg.to != null && typeof msg.to !== \"string\") {\n return new TypeError(\"The property 'to' on the message must be of type 'string'\");\n }\n\n if (msg.replyTo != null && typeof msg.replyTo !== \"string\") {\n return new TypeError(\"The property 'replyTo' on the message must be of type 'string'\");\n }\n\n if (msg.replyToSessionId != null && typeof msg.replyToSessionId !== \"string\") {\n return new TypeError(\"The property 'replyToSessionId' on the message must be of type 'string'\");\n }\n\n if (msg.timeToLive != null && typeof msg.timeToLive !== \"number\") {\n return new TypeError(\"The property 'timeToLive' on the message must be of type 'number'\");\n }\n\n if (msg.sessionId != null && typeof msg.sessionId !== \"string\") {\n return new TypeError(\"The property 'sessionId' on the message must be of type 'string'\");\n }\n\n if (\n msg.messageId != null &&\n typeof msg.messageId !== \"string\" &&\n typeof msg.messageId !== \"number\" &&\n !Buffer.isBuffer(msg.messageId)\n ) {\n return new TypeError(\n \"The property 'messageId' on the message must be of type string, number or Buffer\",\n );\n }\n\n if (\n msg.correlationId != null &&\n typeof msg.correlationId !== \"string\" &&\n typeof msg.correlationId !== \"number\" &&\n !Buffer.isBuffer(msg.correlationId)\n ) {\n return new TypeError(\n \"The property 'correlationId' on the message must be of type string, number or Buffer\",\n );\n }\n return;\n}\n\n/**\n * @internal\n * Converts given ServiceBusMessage to RheaMessage\n */\nexport function toRheaMessage(\n msg: ServiceBusMessage | ServiceBusReceivedMessage | AmqpAnnotatedMessage,\n encoder: Pick<typeof defaultDataTransformer, \"encode\">,\n): RheaMessage {\n let amqpMsg: RheaMessage;\n if (isAmqpAnnotatedMessage(msg)) {\n amqpMsg = {\n ...AmqpAnnotatedMessage.toRheaMessage(msg),\n body: encoder.encode(msg.body, msg.bodyType ?? \"data\"),\n };\n } else {\n let bodyType: \"data\" | \"sequence\" | \"value\" = \"data\";\n\n if (isServiceBusReceivedMessage(msg)) {\n /*\n * TODO: this is a bit complicated.\n *\n * It seems reasonable to expect to be able to round-trip a message (ie,\n * receive a message, and then send it again, possibly to another queue / topic).\n * If the user does that we need to make sure to respect their original AMQP\n * type so when the message is re - encoded we don't put 'body' into the wrong spot.\n *\n * The complication is that we need to decide if we're okay with respecting a field\n * from the rawAmqpMessage, which up until now we've treated as just vestigial\n * information on send. My hope is that the use case of \"alter the sb message in some\n * incompatible way with the underying _rawAmqpMessage.bodyType\" is not common\n * enough for us to try to do anything more than what I'm doing here.\n */\n bodyType = msg._rawAmqpMessage.bodyType ?? \"data\";\n }\n\n // TODO: it seems sensible that we'd also do this for AMQPAnnotated message.\n const validationError = getMessagePropertyTypeMismatchError(msg);\n\n if (validationError) {\n throw validationError;\n }\n\n amqpMsg = {\n body: encoder.encode(msg.body, bodyType),\n message_annotations: {},\n };\n\n if (msg.timeToLive) {\n amqpMsg.ttl = Math.min(msg.timeToLive, Constants.maxUint32Value);\n amqpMsg.creation_time = new Date();\n amqpMsg.absolute_expiry_time = new Date(\n Math.min(amqpMsg.creation_time.getTime() + amqpMsg.ttl, Constants.maxAbsoluteExpiryTime),\n );\n }\n }\n\n if (isAmqpAnnotatedMessage(msg)) {\n return amqpMsg;\n }\n\n if (msg.applicationProperties != null) {\n amqpMsg.application_properties = msg.applicationProperties;\n }\n if (msg.contentType != null) {\n amqpMsg.content_type = msg.contentType;\n }\n if (msg.sessionId != null) {\n if (msg.sessionId.length > Constants.maxSessionIdLength) {\n throw new Error(\n \"Length of 'sessionId' property on the message cannot be greater than 128 characters.\",\n );\n }\n\n amqpMsg.group_id = msg.sessionId;\n }\n if (msg.replyTo != null) {\n amqpMsg.reply_to = msg.replyTo;\n }\n if (msg.to != null) {\n amqpMsg.to = msg.to;\n }\n if (msg.subject != null) {\n amqpMsg.subject = msg.subject;\n }\n\n updateMessageId(amqpMsg, msg.messageId);\n\n if (msg.correlationId != null) {\n amqpMsg.correlation_id = msg.correlationId;\n }\n if (msg.replyToSessionId != null) {\n amqpMsg.reply_to_group_id = msg.replyToSessionId;\n }\n if (msg.partitionKey != null) {\n if (msg.partitionKey.length > Constants.maxPartitionKeyLength) {\n throw new Error(\n \"Length of 'partitionKey' property on the message cannot be greater than 128 characters.\",\n );\n }\n amqpMsg.message_annotations![Constants.partitionKey] = msg.partitionKey;\n }\n\n // Will be required later for implementing Transactions\n // if (msg.viaPartitionKey != null) {\n // if (msg.viaPartitionKey.length > Constants.maxPartitionKeyLength) {\n // throw new Error(\n // \"Length of 'viaPartitionKey' property on the message cannot be greater than 128 characters.\"\n // );\n // }\n // amqpMsg.message_annotations![Constants.viaPartitionKey] = msg.viaPartitionKey;\n // }\n\n updateScheduledTime(amqpMsg, msg.scheduledEnqueueTimeUtc);\n\n logger.verbose(\"SBMessage to RheaMessage: %O\", amqpMsg);\n return amqpMsg;\n}\n\n/** @internal */\nexport function updateMessageId(\n rheaMessage: RheaMessage,\n messageId: RheaMessage[\"message_id\"],\n): void {\n if (messageId != null) {\n if (typeof messageId === \"string\" && messageId.length > Constants.maxMessageIdLength) {\n throw new Error(\n `Length of 'messageId' property on the message cannot be greater than ${Constants.maxMessageIdLength} characters.`,\n );\n }\n\n rheaMessage.message_id = messageId;\n }\n}\n\n/** @internal */\nexport function updateScheduledTime(\n rheaMessage: RheaMessage,\n scheduledEnqueuedTimeUtc: Date | undefined,\n): void {\n if (scheduledEnqueuedTimeUtc != null) {\n rheaMessage.message_annotations = rheaMessage.message_annotations ?? {};\n rheaMessage.message_annotations[Constants.scheduledEnqueueTime] = scheduledEnqueuedTimeUtc;\n }\n}\n\n/**\n * Describes the message received from Service Bus during peek operations and so cannot be settled.\n */\nexport interface ServiceBusReceivedMessage extends ServiceBusMessage {\n /**\n * The reason for deadlettering the message.\n * @readonly\n */\n readonly deadLetterReason?: string;\n /**\n * The error description for deadlettering the message.\n * @readonly\n */\n readonly deadLetterErrorDescription?: string;\n /**\n * The lock token is a reference to the lock that is being held by the broker in\n * `peekLock` receive mode. Locks are used internally settle messages as explained in the\n * {@link https://learn.microsoft.com/azure/service-bus-messaging/message-transfers-locks-settlement | product documentation in more detail}\n * - Not applicable when the message is received in `receiveAndDelete` receive mode.\n * mode.\n * @readonly\n */\n readonly lockToken?: string;\n /**\n * Number of deliveries that have been attempted for this message. The count is\n * incremented when a message lock expires, or the message is explicitly abandoned using the\n * `abandon()` method on the message.\n * @readonly\n */\n readonly deliveryCount?: number;\n /**\n * The UTC instant at which the message has been accepted and stored in Service Bus.\n * @readonly\n */\n readonly enqueuedTimeUtc?: Date;\n /**\n * The UTC instant at which the message is marked for removal and no longer available for\n * retrieval from the entity due to expiration. This property is computed from 2 other properties\n * on the message: `enqueuedTimeUtc` + `timeToLive`.\n */\n readonly expiresAtUtc?: Date;\n /**\n * The UTC instant until which the message is held locked in the queue/subscription.\n * When the lock expires, the `deliveryCount` is incremented and the message is again available\n * for retrieval.\n * - Not applicable when the message is received in `receiveAndDelete` receive mode.\n * mode.\n */\n lockedUntilUtc?: Date;\n /**\n * The original sequence number of the message. For\n * messages that have been auto-forwarded, this property reflects the sequence number that had\n * first been assigned to the message at its original point of submission.\n * @readonly\n */\n readonly enqueuedSequenceNumber?: number;\n /**\n * The unique number assigned to a message by Service Bus.\n * The sequence number is a unique 64-bit integer assigned to a message as it is accepted\n * and stored by the broker and functions as its true identifier. For partitioned entities,\n * the topmost 16 bits reflect the partition identifier. Sequence numbers monotonically increase.\n * They roll over to 0 when the 48-64 bit range is exhausted.\n *\n * **Max safe integer** that Javascript currently supports is `2^53 - 1`. The sequence number\n * is an AMQP `Long` type which can be upto 64 bits long. To represent that we are using a\n * library named {@link https://github.com/dcodeIO/long.js | long.js}. We expect customers\n * to use the **`Long`** type exported by this library.\n * @readonly\n */\n readonly sequenceNumber?: Long;\n /**\n * The name of the queue or subscription that this message\n * was enqueued on, before it was deadlettered. Only set in messages that have been dead-lettered\n * and subsequently auto-forwarded from the dead-letter sub-queue to another entity. Indicates the\n * entity in which the message was dead-lettered.\n * @readonly\n */\n readonly deadLetterSource?: string;\n /**\n * State of the message can be active, deferred or scheduled. Deferred messages have deferred state,\n * scheduled messages have scheduled state, all other messages have active state.\n */\n readonly state: \"active\" | \"deferred\" | \"scheduled\";\n /**\n * The underlying raw amqp message.\n * @readonly\n */\n readonly _rawAmqpMessage: AmqpAnnotatedMessage;\n}\n\n/**\n * @internal\n * Converts given RheaMessage to ServiceBusReceivedMessage\n */\nexport function fromRheaMessage(\n rheaMessage: RheaMessage,\n options: {\n skipParsingBodyAsJson: boolean;\n skipConvertingDate?: boolean;\n delivery?: Delivery;\n shouldReorderLockToken?: boolean;\n },\n): ServiceBusReceivedMessage {\n if (!rheaMessage) {\n rheaMessage = {\n body: undefined,\n };\n }\n const {\n skipParsingBodyAsJson,\n delivery,\n shouldReorderLockToken,\n skipConvertingDate = false,\n } = options;\n const { body, bodyType } = defaultDataTransformer.decodeWithType(\n rheaMessage.body,\n skipParsingBodyAsJson,\n );\n\n const sbmsg: ServiceBusMessage = {\n body: body,\n };\n\n if (rheaMessage.application_properties != null) {\n sbmsg.applicationProperties = skipConvertingDate\n ? rheaMessage.application_properties\n : convertDatesToNumbers(rheaMessage.application_properties);\n }\n if (rheaMessage.content_type != null) {\n sbmsg.contentType = rheaMessage.content_type;\n }\n if (rheaMessage.group_id != null) {\n sbmsg.sessionId = rheaMessage.group_id;\n }\n if (rheaMessage.reply_to != null) {\n sbmsg.replyTo = rheaMessage.reply_to;\n }\n if (rheaMessage.to != null) {\n sbmsg.to = rheaMessage.to;\n }\n if (rheaMessage.subject != null) {\n sbmsg.subject = rheaMessage.subject;\n }\n if (rheaMessage.message_id != null) {\n sbmsg.messageId = rheaMessage.message_id;\n }\n if (rheaMessage.correlation_id != null) {\n sbmsg.correlationId = rheaMessage.correlation_id;\n }\n if (rheaMessage.reply_to_group_id != null) {\n sbmsg.replyToSessionId = rheaMessage.reply_to_group_id;\n }\n\n if (rheaMessage.message_annotations != null) {\n if (rheaMessage.message_annotations[Constants.partitionKey] != null) {\n sbmsg.partitionKey = rheaMessage.message_annotations[Constants.partitionKey];\n }\n\n // Will be required later for implementing Transactions\n // if (msg.message_annotations[Constants.viaPartitionKey] != null) {\n // sbmsg.viaPartitionKey = msg.message_annotations[Constants.viaPartitionKey];\n // }\n\n if (rheaMessage.message_annotations[Constants.scheduledEnqueueTime] != null) {\n sbmsg.scheduledEnqueueTimeUtc =\n rheaMessage.message_annotations[Constants.scheduledEnqueueTime];\n }\n }\n\n type PartialWritable<T> = Partial<{\n -readonly [P in keyof T]: T[P];\n }>;\n const props: PartialWritable<ServiceBusReceivedMessage> & {\n state: \"active\" | \"deferred\" | \"scheduled\";\n } = { state: \"active\" };\n if (rheaMessage.message_annotations != null) {\n if (rheaMessage.message_annotations[Constants.deadLetterSource] != null) {\n props.deadLetterSource = rheaMessage.message_annotations[Constants.deadLetterSource];\n }\n const messageState = rheaMessage.message_annotations[Constants.messageState];\n if (messageState === 1) {\n props.state = \"deferred\";\n } else if (messageState === 2) {\n props.state = \"scheduled\";\n }\n if (rheaMessage.message_annotations[Constants.enqueueSequenceNumber] != null) {\n props.enqueuedSequenceNumber =\n rheaMessage.message_annotations[Constants.enqueueSequenceNumber];\n }\n if (rheaMessage.message_annotations[Constants.sequenceNumber] != null) {\n if (Buffer.isBuffer(rheaMessage.message_annotations[Constants.sequenceNumber])) {\n props.sequenceNumber = Long.fromBytesBE(\n rheaMessage.message_annotations[Constants.sequenceNumber],\n );\n } else {\n props.sequenceNumber = Long.fromNumber(\n rheaMessage.message_annotations[Constants.sequenceNumber],\n );\n }\n }\n if (rheaMessage.message_annotations[Constants.enqueuedTime] != null) {\n props.enqueuedTimeUtc = new Date(\n rheaMessage.message_annotations[Constants.enqueuedTime] as number,\n );\n }\n if (rheaMessage.message_annotations[Constants.lockedUntil] != null) {\n props.lockedUntilUtc = new Date(\n rheaMessage.message_annotations[Constants.lockedUntil] as number,\n );\n }\n }\n\n const rawMessage = AmqpAnnotatedMessage.fromRheaMessage(rheaMessage);\n rawMessage.bodyType = bodyType;\n if (rheaMessage.ttl == null) {\n rheaMessage.ttl = rawMessage.header?.timeToLive ?? Constants.maxDurationValue;\n }\n if (props.enqueuedTimeUtc) {\n props.expiresAtUtc = new Date(\n Math.min(props.enqueuedTimeUtc.getTime() + rheaMessage.ttl, Constants.maxDurationValue),\n );\n }\n\n if (rawMessage.applicationProperties) {\n rawMessage.applicationProperties = skipConvertingDate\n ? rawMessage.applicationProperties\n : convertDatesToNumbers(rawMessage.applicationProperties);\n }\n if (rawMessage.deliveryAnnotations) {\n rawMessage.deliveryAnnotations = skipConvertingDate\n ? rawMessage.deliveryAnnotations\n : convertDatesToNumbers(rawMessage.deliveryAnnotations);\n }\n if (rawMessage.messageAnnotations) {\n rawMessage.messageAnnotations = skipConvertingDate\n ? rawMessage.messageAnnotations\n : convertDatesToNumbers(rawMessage.messageAnnotations);\n }\n\n if (rawMessage.header?.timeToLive) {\n sbmsg.timeToLive = rawMessage.header.timeToLive;\n }\n\n const rcvdsbmsg: ServiceBusReceivedMessage = {\n _rawAmqpMessage: rawMessage,\n deliveryCount: rheaMessage.delivery_count,\n lockToken:\n delivery && delivery.tag && delivery.tag.length !== 0\n ? uuid_to_string(\n shouldReorderLockToken === true\n ? reorderLockToken(\n typeof delivery.tag === \"string\" ? Buffer.from(delivery.tag) : delivery.tag,\n )\n : typeof delivery.tag === \"string\"\n ? Buffer.from(delivery.tag)\n : delivery.tag,\n )\n : undefined,\n ...sbmsg,\n ...props,\n deadLetterReason: sbmsg.applicationProperties?.DeadLetterReason as string | undefined,\n deadLetterErrorDescription: sbmsg.applicationProperties?.DeadLetterErrorDescription as\n | string\n | undefined,\n };\n\n logger.verbose(\"AmqpMessage to ServiceBusReceivedMessage: %O\", rcvdsbmsg);\n return rcvdsbmsg;\n}\n\n/**\n * @internal\n */\nexport function isServiceBusMessage(possible: unknown): possible is ServiceBusMessage {\n return isObjectWithProperties(possible, [\"body\"]);\n}\n\n/**\n * @internal\n */\nexport function isAmqpAnnotatedMessage(possible: unknown): possible is AmqpAnnotatedMessage {\n return (\n isObjectWithProperties(possible, [\"body\", \"bodyType\"]) &&\n possible.constructor.name !== ServiceBusMessageImpl.name\n );\n}\n\n/**\n * @internal\n */\nexport function isServiceBusReceivedMessage(\n possible: unknown,\n): possible is ServiceBusReceivedMessage {\n return isServiceBusMessage(possible) && \"_rawAmqpMessage\" in possible;\n}\n\n/**\n * Describes the message received from Service Bus.\n *\n * @internal\n */\nexport class ServiceBusMessageImpl implements ServiceBusReceivedMessage {\n /**\n * The message body that needs to be sent or is received.\n */\n body: any;\n /**\n * The application specific properties.\n */\n applicationProperties?: { [key: string]: any };\n /**\n * The message identifier is an\n * application-defined value that uniquely identifies the message and its payload. The identifier\n * is a free-form string and can reflect a GUID or an identifier derived from the application\n * context. If enabled, the\n * {@link https://learn.microsoft.com/azure/service-bus-messaging/duplicate-detection | duplicate detection}\n * identifies and removes second and further submissions of messages with the same MessageId.\n */\n messageId?: string | number | Buffer;\n /**\n * The content type of the message. Optionally describes\n * the payload of the message, with a descriptor following the format of RFC2045, Section 5, for\n * example \"application/json\".\n */\n contentType?: string;\n /**\n * The correlation identifier that allows an\n * application to specify a context for the message for the purposes of correlation, for example\n * reflecting the MessageId of a message that is being replied to.\n * See {@link https://learn.microsoft.com/azure/service-bus-messaging/service-bus-messages-payloads?#message-routing-and-correlation | Message Routing and Correlation}.\n */\n correlationId?: string | number | Buffer;\n /**\n * The partition key for sending a message to a\n * partitioned entity. Maximum length is 128 characters. For {@link https://learn.microsoft.com/azure/service-bus-messaging/service-bus-partitioning | partitioned entities},\n * setting this value enables assigning related messages to the same internal partition,\n * so that submission sequence order is correctly recorded. The partition is chosen by a hash\n * function over this value and cannot be chosen directly. For session-aware entities,\n * the `sessionId` property overrides this value.\n */\n partitionKey?: string;\n /**\n * The partition key for sending a message into an entity\n * via a partitioned transfer queue. Maximum length is 128 characters. If a message is sent via a\n * transfer queue in the scope of a transaction, this value selects the transfer queue partition:\n * This is functionally equivalent to `partitionKey` property and ensures that messages are kept\n * together and in order as they are transferred.\n * See {@link https://learn.microsoft.com/azure/service-bus-messaging/service-bus-transactions#transfers-and-send-via | Transfers and Send Via}.\n */\n // Will be required later for implementing Transactions\n // viaPartitionKey?: string;\n /**\n * The session identifier for a session-aware entity. Maximum\n * length is 128 characters. For session-aware entities, this application-defined value specifies\n * the session affiliation of the message. Messages with the same session identifier are subject\n * to summary locking and enable exact in-order processing and demultiplexing. For\n * session-unaware entities, this value is ignored.\n * {@link https://learn.microsoft.com/azure/service-bus-messaging/message-sessions | Message Sessions}.\n */\n sessionId?: string;\n /**\n * The session identifier augmenting the `replyTo` address.\n * Maximum length is 128 characters. This value augments the ReplyTo information and specifies\n * which SessionId should be set for the reply when sent to the reply entity.\n * See {@link https://learn.microsoft.com/azure/service-bus-messaging/service-bus-messages-payloads?#message-routing-and-correlation | Message Routing and Correlation}.\n */\n replyToSessionId?: string;\n /**\n * The message’s time to live value. This value is the relative\n * duration after which the message expires, starting from the instant the message has been\n * accepted and stored by the broker, as captured in `enqueuedTimeUtc`. When not set explicitly,\n * the assumed value is the DefaultTimeToLive for the respective queue or topic. A message-level\n * `timeToLive` value cannot be longer than the entity's DefaultTimeToLive setting and it is\n * silently adjusted if it does. See\n * {@link https://learn.microsoft.com/azure/service-bus-messaging/message-expiration | Expiration}.\n */\n timeToLive?: number;\n /**\n * The application specific label. This property enables the\n * application to indicate the purpose of the message to the receiver in a standardized. fashion,\n * similar to an email subject line. The mapped AMQP property is \"subject\".\n */\n subject?: string;\n /**\n * The \"to\" address. This property is reserved for future use in routing\n * scenarios and presently ignored by the broker itself. Applications can use this value in\n * rule-driven {@link https://learn.microsoft.com/azure/service-bus-messaging/service-bus-auto-forwarding | auto-forward chaining}\n * scenarios to indicate the intended logical destination of the message.\n */\n to?: string;\n /**\n * The address of an entity to send replies to. This optional and\n * application-defined value is a standard way to express a reply path to the receiver of the\n * message. When a sender expects a reply, it sets the value to the absolute or relative path of\n * the queue or topic it expects the reply to be sent to. See\n * {@link https://learn.microsoft.com/azure/service-bus-messaging/service-bus-messages-payloads?#message-routing-and-correlation | Message Routing and Correlation}.\n */\n replyTo?: string;\n /**\n * The date and time in UTC at which the message will\n * be enqueued. This property returns the time in UTC; when setting the property, the\n * supplied DateTime value must also be in UTC. This value is for delayed message sending.\n * It is utilized to delay messages sending to a specific time in the future. Message enqueuing\n * time does not mean that the message will be sent at the same time. It will get enqueued,\n * but the actual sending time depends on the queue's workload and its state.\n */\n scheduledEnqueueTimeUtc?: Date;\n /**\n * The lock token is a reference to the lock that is being held by the broker in\n * `peekLock` receive mode. Locks are used internally settle messages as explained in the\n * {@link https://learn.microsoft.com/azure/service-bus-messaging/message-transfers-locks-settlement | product documentation in more detail}\n * - Not applicable when the message is received in `receiveAndDelete` receive mode.\n * mode.\n * @readonly\n */\n readonly lockToken?: string;\n /**\n * Number of deliveries that have been attempted for this message. The count is\n * incremented when a message lock expires, or the message is explicitly abandoned using the\n * `abandon()` method on the message.\n * @readonly\n */\n readonly deliveryCount?: number;\n /**\n * The UTC instant at which the message has been accepted and stored in Service Bus.\n * @readonly\n */\n readonly enqueuedTimeUtc?: Date;\n /**\n * The UTC instant at which the message is marked for removal and no longer available for\n * retrieval from the entity due to expiration. This property is computed from 2 other properties\n * on the message: `enqueuedTimeUtc` + `timeToLive`.\n */\n readonly expiresAtUtc?: Date;\n /**\n * The UTC instant until which the message is held locked in the queue/subscription.\n * When the lock expires, the `deliveryCount` is incremented and the message is again available\n * for retrieval.\n * - Not applicable when the message is received in `receiveAndDelete` receive mode.\n * mode.\n */\n lockedUntilUtc?: Date;\n /**\n * The original sequence number of the message. For\n * messages that have been auto-forwarded, this property reflects the sequence number that had\n * first been assigned to the message at its original point of submission.\n * @readonly\n */\n readonly enqueuedSequenceNumber?: number;\n /**\n * The unique number assigned to a message by Service Bus.\n * The sequence number is a unique 64-bit integer assigned to a message as it is accepted\n * and stored by the broker and functions as its true identifier. For partitioned entities,\n * the topmost 16 bits reflect the partition identifier. Sequence numbers monotonically increase.\n * They roll over to 0 when the 48-64 bit range is exhausted.\n * @readonly\n */\n readonly sequenceNumber?: Long;\n /**\n * The name of the queue or subscription that this message\n * was enqueued on, before it was deadlettered. Only set in messages that have been dead-lettered\n * and subsequently auto-forwarded from the dead-letter sub-queue to another entity. Indicates the\n * entity in which the message was dead-lettered.\n * @readonly\n */\n readonly deadLetterSource?: string;\n /**\n * State of the message can be active, deferred or scheduled. Deferred messages have deferred state,\n * scheduled messages have scheduled state, all other messages have active state.\n */\n readonly state: \"active\" | \"deferred\" | \"scheduled\";\n /**\n * The associated delivery of the received message.\n */\n readonly delivery: Delivery;\n /**\n * The underlying raw amqp annotated message.\n * @readonly\n */\n readonly _rawAmqpMessage: AmqpAnnotatedMessage;\n /**\n * The reason for deadlettering the message.\n * @readonly\n */\n readonly deadLetterReason?: string;\n /**\n * The error description for deadlettering the message.\n * @readonly\n */\n readonly deadLetterErrorDescription?: string;\n /**\n * @internal\n */\n constructor(\n msg: RheaMessage,\n delivery: Delivery,\n shouldReorderLockToken: boolean,\n receiveMode: ReceiveMode,\n skipParsingBodyAsJson: boolean,\n skipConvertingDate: boolean,\n ) {\n const { _rawAmqpMessage, ...restOfMessageProps } = fromRheaMessage(\n msg,\n\n { skipParsingBodyAsJson, delivery, shouldReorderLockToken, skipConvertingDate },\n );\n this._rawAmqpMessage = _rawAmqpMessage; // need to initialize _rawAmqpMessage property to make compiler happy\n Object.assign(this, restOfMessageProps);\n this.state = restOfMessageProps.state; // to suppress error TS2564: Property 'state' has no initializer and is not definitely assigned in the constructor.\n\n // Lock on a message is applicable only in peekLock mode, but the service sets\n // the lock token even in receiveAndDelete mode if the entity in question is partitioned.\n if (receiveMode === \"receiveAndDelete\") {\n this.lockToken = undefined;\n }\n this.delivery = delivery;\n }\n\n /**\n * Creates a clone of the current message to allow it to be re-sent to the queue\n * @returns ServiceBusMessage\n */\n clone(): ServiceBusMessage {\n // We are returning a ServiceBusMessage object because that object can then be sent to Service Bus\n const clone: ServiceBusMessage = {\n body: this.body,\n contentType: this.contentType,\n correlationId: this.correlationId,\n subject: this.subject,\n messageId: this.messageId,\n partitionKey: this.partitionKey,\n replyTo: this.replyTo,\n replyToSessionId: this.replyToSessionId,\n scheduledEnqueueTimeUtc: this.scheduledEnqueueTimeUtc,\n sessionId: this.sessionId,\n timeToLive: this.timeToLive,\n to: this.to,\n applicationProperties: this.applicationProperties,\n // Will be required later for implementing Transactions\n // viaPartitionKey: this.viaPartitionKey\n };\n\n return clone;\n }\n}\n\n/**\n * Converts any Date objects into a number representing date.getTime().\n * Recursively checks for any Date objects in arrays and objects.\n * @internal\n */\nfunction convertDatesToNumbers<T = unknown>(thing: T): T {\n // fast exit\n if (!isDefined(thing)) return thing;\n\n // When 'thing' is a Date, return the number representation\n if (\n typeof thing === \"object\" &&\n isObjectWithProperties(thing, [\"getTime\"]) &&\n typeof thing.getTime === \"function\"\n ) {\n return thing.getTime();\n }\n\n /*\n Examples:\n [0, 'foo', new Date(), { nested: new Date()}]\n */\n if (Array.isArray(thing)) {\n const result = [];\n for (const element of thing) {\n result.push(convertDatesToNumbers(element));\n }\n return result as unknown as T;\n }\n\n /*\n Examples:\n { foo: new Date(), children: { nested: new Date() }}\n */\n if (typeof thing === \"object\" && isDefined<object>(thing)) {\n const thingShallowCopy = { ...thing };\n for (const key of Object.keys(thingShallowCopy)) {\n (thingShallowCopy as any)[key] = convertDatesToNumbers((thingShallowCopy as any)[key]);\n }\n return thingShallowCopy;\n }\n\n return thing;\n}\n"]}
@@ -26,6 +26,20 @@ const smallMessageMaxBytes = 255;
26
26
  * @internal
27
27
  */
28
28
  export class ServiceBusMessageBatchImpl {
29
+ _context;
30
+ _maxSizeInBytes;
31
+ /**
32
+ * Current size of the batch in bytes.
33
+ */
34
+ _sizeInBytes;
35
+ /**
36
+ * Encoded amqp messages.
37
+ */
38
+ _encodedMessages = [];
39
+ /**
40
+ * List of 'message' span contexts.
41
+ */
42
+ _spanContexts = [];
29
43
  /**
30
44
  * ServiceBusMessageBatch should not be constructed using `new ServiceBusMessageBatch()`
31
45
  * Use the `createBatch()` method on your `Sender` instead.
@@ -35,14 +49,6 @@ export class ServiceBusMessageBatchImpl {
35
49
  constructor(_context, _maxSizeInBytes) {
36
50
  this._context = _context;
37
51
  this._maxSizeInBytes = _maxSizeInBytes;
38
- /**
39
- * Encoded amqp messages.
40
- */
41
- this._encodedMessages = [];
42
- /**
43
- * List of 'message' span contexts.
44
- */
45
- this._spanContexts = [];
46
52
  this._sizeInBytes = 0;
47
53
  this._batchMessageProperties = {};
48
54
  }
@@ -112,6 +118,24 @@ export class ServiceBusMessageBatchImpl {
112
118
  _generateMessage() {
113
119
  return this._generateBatch(this._encodedMessages, this._batchAnnotations, this._batchApplicationProperties, this._batchMessageProperties);
114
120
  }
121
+ /**
122
+ * The message annotations to apply on the batch envelope.
123
+ * This will reflect the message annotations on the first message
124
+ * that was added to the batch.
125
+ */
126
+ _batchAnnotations;
127
+ /**
128
+ * The message properties to apply on the batch envelope.
129
+ * This will reflect the message properties on the first message
130
+ * that was added to the batch.
131
+ */
132
+ _batchMessageProperties;
133
+ /**
134
+ * The application properties to apply on the batch envelope.
135
+ * This will reflect the application properties on the first message
136
+ * that was added to the batch.
137
+ */
138
+ _batchApplicationProperties;
115
139
  /**
116
140
  * Tries to add a message to the batch if permitted by the batch's size limit.
117
141
  * **NOTE**: Always remember to check the return value of this method, before calling it again